Skip to content

Commit

Permalink
Administrative Updates
Browse files Browse the repository at this point in the history
Filtering of quests
Teams
WYSIWYG Editor change to Froala
UI tweaks
Bug fixes
  • Loading branch information
claytical committed Aug 19, 2014
1 parent f5d982e commit 36eb938
Show file tree
Hide file tree
Showing 554 changed files with 4,491 additions and 3,606 deletions.
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Pull request guidelines

[GitHub pull requests](https://help.github.com/articles/using-pull-requests) are a great way for everyone in the community to contribute to the Laravel codebase. Found a bug? Just fix it in your fork and submit a pull request. This will then be reviewed, and, if found as good, merged into the main repository.

In order to keep the codebase clean, stable and at high quality, even with so many people contributing, some guidelines are necessary for high-quality pull requests:

- **Branch:** Unless they are immediate documentation fixes relevant for old versions, pull requests should be sent to the `develop` branch only. Make sure to select that branch as target when creating the pull request (GitHub will not automatically select it.)
- **Documentation:** If you are adding a new feature or changing the API in any relevant way, this should be documented. The documentation files can be found directly in the core repository.
- **Unit tests:** To keep old bugs from re-appearing and generally hold quality at a high level, the Laravel core is thoroughly unit-tested. Thus, when you create a pull request, it is expected that you unit test any new code you add. For any bug you fix, you should also add regression tests to make sure the bug will never appear again. If you are unsure about how to write tests, the core team or other contributors will gladly help.
Empty file modified application/bundles.php
100755 → 100644
Empty file.
Empty file modified application/config/.gitignore
100755 → 100644
Empty file.
134 changes: 67 additions & 67 deletions application/config/administrator.php
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
<?php

return array(

/**
* Page title
*
* @type string
*/
'title' => 'Admin',

/**
* The path to your model config directory
*
* @type string
*/
'model_config_path' => path('app') . 'config/administrator',

/**
* The menu structure of the site. Each item should either be the name of the model's config file or an array of names of model config files.
* By doing the latter, you can group certain models together. Each name needs to have a config file in your model config path with the same
* name. So 'users' would require a 'users.php' file in your model config path.
*
* @type array
*
* array(
* 'Products' => array('products', 'product_images', 'orders'),
* 'users',
* )
*/
'menu' => array(
'Models' => array('player', 'quest')
),

/**
* The permission option is the highest-level authentication check that lets you define a closure that should return true if the current user
* is allowed to view the admin section. Any "falsey" response will send the user back to the 'login_path' defined below.
*
* @type closure
*/
'permission'=> function()
{
return TRUE;
// return Auth::check();
},

/**
* The login path is the path where Administrator will send the user if they fail a permission check
*
* @type string
*/
'login_path' => 'user/login',

/**
* This is the key of the return path that is sent with the redirection to your login_action. Input::get('redirect') will hold the return URL.
*
* @type string
*/
'login_redirect_key' => 'redirect',

/**
* Global default rows per page
*
* @type NULL|int
*/
'global_rows_per_page' => 20,

<?php

return array(

/**
* Page title
*
* @type string
*/
'title' => 'Admin',

/**
* The path to your model config directory
*
* @type string
*/
'model_config_path' => path('app') . 'config/administrator',

/**
* The menu structure of the site. Each item should either be the name of the model's config file or an array of names of model config files.
* By doing the latter, you can group certain models together. Each name needs to have a config file in your model config path with the same
* name. So 'users' would require a 'users.php' file in your model config path.
*
* @type array
*
* array(
* 'Products' => array('products', 'product_images', 'orders'),
* 'users',
* )
*/
'menu' => array(
'Models' => array('player', 'quest')
),

/**
* The permission option is the highest-level authentication check that lets you define a closure that should return true if the current user
* is allowed to view the admin section. Any "falsey" response will send the user back to the 'login_path' defined below.
*
* @type closure
*/
'permission'=> function()
{
return TRUE;
// return Auth::check();
},

/**
* The login path is the path where Administrator will send the user if they fail a permission check
*
* @type string
*/
'login_path' => 'user/login',

/**
* This is the key of the return path that is sent with the redirection to your login_action. Input::get('redirect') will hold the return URL.
*
* @type string
*/
'login_redirect_key' => 'redirect',

/**
* Global default rows per page
*
* @type NULL|int
*/
'global_rows_per_page' => 20,

);
Empty file modified application/config/application.php
100755 → 100644
Empty file.
Empty file modified application/config/auth.php
100755 → 100644
Empty file.
Empty file modified application/config/cache.php
100755 → 100644
Empty file.
Empty file modified application/config/error.php
100755 → 100644
Empty file.
Empty file modified application/config/mimes.php
100755 → 100644
Empty file.
Empty file modified application/config/session.php
100755 → 100644
Empty file.
Empty file modified application/config/strings.php
100755 → 100644
Empty file.
Empty file modified application/controllers/base.php
100755 → 100644
Empty file.
2 changes: 2 additions & 0 deletions application/controllers/course.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public function get_setup() {
$teams = Team::where('group_id', '=', Session::get('current_course'))->order_by('label', 'asc')->get();
$data->teams = $teams;

// $sections = Section::where('group_id', '=', Session::get('current_course'))->order_by('name', 'asc');
// $data->sections = $sections->get();
return View::make('courses.all')
->with('course', $data);
}
Expand Down
6 changes: 2 additions & 4 deletions application/controllers/level.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public function post_index() {
if (Input::has('tab')) {

return Redirect::to('admin/course#levels')
->with_message($level->label . " created.", 'success');
}
->with_message($level->label . " created.", 'success'); }
else {
return View::make('levels.index')
->with('levels', $levels->order_by('amount', 'asc')->get());
Expand All @@ -48,8 +47,7 @@ public function post_edit() {
if (Input::has('tab')) {

return Redirect::to('admin/course#levels')
->with_message($level->label . " modified.", 'success');
}
->with_message($level->label . " modified.", 'success'); }
else {

return Redirect::to('admin/levels');
Expand Down
Empty file modified application/controllers/notice.php
100755 → 100644
Empty file.
2 changes: 2 additions & 0 deletions application/controllers/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public function post_update() {
$post->post = Input::get('body');
$post->menu = Input::has('menuitem');
$post->frontpage = Input::has('frontpage');
$post->video_url = Input::get('vimeo');
if (Input::get('existingFiles') && Input::get('files')) {
$existingFiles = Input::get('existingFiles');
$newFiles = explode(",", Input::get('files'));
Expand Down Expand Up @@ -132,6 +133,7 @@ public function post_create() {
'menu' => Input::has('menuitem'),
'frontpage' => Input::has('frontpage'),
'filename' => Input::get('files'),
'video_url' => Input::get('vimeo'),
'user_id' => Session::get('uid'),
'group_id' => Session::get('current_course')
));
Expand Down
38 changes: 29 additions & 9 deletions application/controllers/quest.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ public function get_update($id) {
$quest->category = $questInfo->category;
$quest->levels = $levels;
$quest->all_skills = $all_skills;
$quest->type = $questInfo->type;
$quest->uploads = $questInfo->allow_upload;
$quest->text = $questInfo->allow_text;
$quest->locks = $locks;
$encoded_files = explode(",", $questInfo->filename);

Expand Down Expand Up @@ -179,6 +182,8 @@ public function post_update() {
$quest->name = Input::get('title');
$quest->instructions = Input::get('instructions');
$quest->category = Input::get('category');
$quest->allow_text = Input::get('allow_text');
$quest->allow_upload = Input::get('allow_upload');
if (Input::get('existingFiles') && Input::get('files')) {
$existingFiles = Input::get('existingFiles');
$newFiles = explode(",", Input::get('files'));
Expand Down Expand Up @@ -298,11 +303,13 @@ public function get_index($id = NULL) {
if (!empty($ids)) {
$quests = Group::find(Session::get('current_course'))
->quests()
->where_not_in('id',$ids);
->where_not_in('id',$ids)
->where('visible', '=', 1);;
}
else {
$quests = Group::find(Session::get('current_course'))
->quests();
->quests()
->where('visible','=', 1);

}
$student_skill_levels = Student::skill_levels_check(Session::get('uid'), Session::get('current_course'));
Expand Down Expand Up @@ -371,7 +378,7 @@ public function get_grade($id) {
$data->students = Group::find(Session::get('current_course'))
->users()
->where('active', '=', 1)
// ->where_not_in('user_id', $user_ids)
->where_not_in('user_id', $user_ids)
->order_by('username', 'asc')
->lists('username', 'id');
foreach($data->quest->skills()->lists('name', 'id') as $key => $skill) {
Expand Down Expand Up @@ -436,7 +443,7 @@ public function post_grade() {
$notice = new Notice;
$notice->user_id = $student;
$notice->group_id = Session::get('current_course');
$notice->notification = "<p>".Input::get('note')."</p>";
//$notice->notification = "<p>".Input::get('note')."</p>";
$quest = Quest::find(Input::get('quest_id'));
$notice->title = $quest->name . " has been graded";
$notice->url = "quests/completed#".Input::get('quest_id');
Expand Down Expand Up @@ -468,11 +475,13 @@ public function get_available() {
if (!empty($ids)) {
$quests = Group::find(Session::get('current_course'))
->quests()
->where_not_in('id',$ids);
->where_not_in('id',$ids)
->where('visible', '=', 1);
}
else {
$quests = Group::find(Session::get('current_course'))
->quests();
->quests()
->where('visible', '=', 1);

}
$student_skill_levels = Student::skill_levels_check(Session::get('uid'), Session::get('current_course'));
Expand Down Expand Up @@ -732,6 +741,7 @@ public function get_completed_by_student() {
'quest_id' => $quest->quest_id,
'completed' => $quest->created_at,
'category' => $quest->category,
'note' => $quest->note,
'submission' => $submission,
'type' => $quest->type,
'skills' => DB::table('skill_user')
Expand Down Expand Up @@ -951,8 +961,19 @@ public function get_admin() {
$data = new stdClass();
$quests = Group::find(Session::get('current_course'))
->quests();
$data->quests = $quests->get();
// $data->quests = $quests->get();
foreach($quests->get() as $quest) {
$level_required = DB::table('quest_lock')->where('quest_id', '=', $quest->id)->get();
$quest->required = $level_required;
$questsWithLocks[] = $quest;

}
$data->quests = $questsWithLocks;
$data->categories = array_unique($quests->lists('category'));
$data->skills = Group::find(Session::get('current_course'))->skills()->get();
array_unshift($data->categories, "All Categories");
$data->levels = Group::find(Session::get('current_course'))->levels()->lists('label', 'amount');

if(($key = array_search("", $data->categories)) !== false) {
unset($data->categories[$key]);
}
Expand All @@ -963,8 +984,7 @@ public function get_admin() {
}






}

Expand Down
Empty file modified application/controllers/question.php
100755 → 100644
Empty file.
40 changes: 40 additions & 0 deletions application/controllers/skill.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,48 @@ public function post_index() {
}

}

public function get_remove_confirm($id) {

$skill = Skill::find($id);
$skillName = $skill->name;

if ($skill->group_id == Session::get('current_course')) {
$skill->delete();
DB::table('quest_skill')
->where('skill_id', '=', $id)
->delete();
DB::table('skill_user')
->where('skill_id', '=', $id)
->delete();
DB::table('quest_lock')
->where('skill_id', '=', $id)
->delete();
}
return Redirect::to('admin/course#skills')
->with_message($skillName . " deleted.", 'success');
}


public function get_remove($id) {

$skill = Skill::find($id);
$skillName = $skill->name;


if (DB::table('quest_skill')->where('skill_id', '=', $id)->count() > 0) {
return Redirect::to('admin/course#skills')
->with_message($skillName . " has quests attached to it. In order to delete it, you need to remove all quests that are associated with it.", 'warning');

}

if (DB::table('skill_user')->where('skill_id', '=', $id)->count() > 0) {
return Redirect::to('admin/course#skills')
->with_message("<p>Students have already earned " . $skillName . ". If you remove it, they will lose those points.</p><p><a class='btn btn-danger btn-md' href='".URL::to("admin/skill/remove/".$id."/confirm")."'>Remove Anyway</a></p>", 'warning');

}


if ($skill->group_id == Session::get('current_course')) {
$skill->delete();
DB::table('quest_skill')
Expand All @@ -47,6 +84,9 @@ public function get_remove($id) {
DB::table('skill_user')
->where('skill_id', '=', $id)
->delete();
DB::table('quest_lock')
->where('skill_id', '=', $id)
->delete();
}
return Redirect::to('admin/course#skills')
->with_message($skillName . " deleted.", 'success');
Expand Down
6 changes: 6 additions & 0 deletions application/controllers/submission.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public function get_index() {
public function get_view($id) {
$data = new stdClass();
$data->submission = Submission::find($id);
$data->revisions = Submission::where('quest_id', '=', $data->submission->quest_id)
->where('user_id', '=', $data->submission->user_id)
->get();
$data->quest = Quest::find($data->submission->quest_id);

return View::make('submission.view')
Expand All @@ -34,6 +37,9 @@ public function get_view($id) {
public function get_revise($id) {
$data = new stdClass();
$data->submission = Submission::find($id);
$data->revisions = Submission::where('quest_id', '=', $data->submission->quest_id)
->where('user_id', '=', $data->submission->user_id)
->get();
$data->quest = Quest::find($data->submission->quest_id);
$data->comments = Comment::where('quest_id', '=', $data->submission->quest_id)
->where('user_id', '=', $data->submission->user_id)
Expand Down
Loading

0 comments on commit 36eb938

Please sign in to comment.