mirrored from git://git.moodle.org/moodle.git
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '31830-26' of git://github.com/samhemelryk/moodle
Conflicts: theme/bootstrapbase/style/moodle.css
- Loading branch information
Showing
60 changed files
with
13,816 additions
and
1,285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Performs course category management ajax actions. | ||
* | ||
* Please note functions may throw exceptions, please ensure your JS handles them as well as the outcome objects. | ||
* | ||
* @package core_course | ||
* @copyright 2013 Sam Hemelryk | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
define('AJAX_SCRIPT', true); | ||
|
||
require_once('../../config.php'); | ||
require_once($CFG->dirroot.'/lib/coursecatlib.php'); | ||
require_once($CFG->dirroot.'/course/lib.php'); | ||
|
||
$action = required_param('action', PARAM_ALPHA); | ||
require_sesskey(); // Gotta have the sesskey. | ||
require_login(); // Gotta be logged in (of course). | ||
|
||
// Prepare an outcome object. We always use this. | ||
$outcome = new stdClass; | ||
$outcome->error = false; | ||
$outcome->outcome = false; | ||
|
||
echo $OUTPUT->header(); | ||
|
||
switch ($action) { | ||
case 'movecourseup' : | ||
$courseid = required_param('courseid', PARAM_INT); | ||
$outcome->outcome = \core_course\management\helper::action_course_change_sortorder_up_one_by_record($courseid); | ||
break; | ||
case 'movecoursedown' : | ||
$courseid = required_param('courseid', PARAM_INT); | ||
$outcome->outcome = \core_course\management\helper::action_course_change_sortorder_down_one_by_record($courseid); | ||
break; | ||
case 'movecourseintocategory': | ||
$courseid = required_param('courseid', PARAM_INT); | ||
$categoryid = required_param('categoryid', PARAM_INT); | ||
$outcome->outcome = \core_course\management\helper::move_courses_into_category($categoryid, $courseid); | ||
break; | ||
case 'movecourseafter' : | ||
$courseid = required_param('courseid', PARAM_INT); | ||
$moveaftercourseid = required_param('moveafter', PARAM_INT); | ||
$outcome->outcome = \core_course\management\helper::action_course_change_sortorder_after_course( | ||
$courseid, $moveaftercourseid); | ||
break; | ||
case 'hidecourse' : | ||
$courseid = required_param('courseid', PARAM_INT); | ||
$outcome->outcome = \core_course\management\helper::action_course_hide_by_record($courseid); | ||
break; | ||
case 'showcourse' : | ||
$courseid = required_param('courseid', PARAM_INT); | ||
$outcome->outcome = \core_course\management\helper::action_course_show_by_record($courseid); | ||
break; | ||
case 'movecategoryup' : | ||
$categoryid = required_param('categoryid', PARAM_INT); | ||
$outcome->outcome = \core_course\management\helper::action_category_change_sortorder_up_one_by_id($categoryid); | ||
break; | ||
case 'movecategorydown' : | ||
$categoryid = required_param('categoryid', PARAM_INT); | ||
$outcome->outcome = \core_course\management\helper::action_category_change_sortorder_down_one_by_id($categoryid); | ||
break; | ||
case 'hidecategory' : | ||
$categoryid = required_param('categoryid', PARAM_INT); | ||
$outcome->outcome = \core_course\management\helper::action_category_hide_by_id($categoryid); | ||
$outcome->categoryvisibility = \core_course\management\helper::get_category_children_visibility($categoryid); | ||
$outcome->coursevisibility = \core_course\management\helper::get_category_courses_visibility($categoryid); | ||
break; | ||
case 'showcategory' : | ||
$categoryid = required_param('categoryid', PARAM_INT); | ||
$outcome->outcome = \core_course\management\helper::action_category_show_by_id($categoryid); | ||
$outcome->categoryvisibility = \core_course\management\helper::get_category_children_visibility($categoryid); | ||
$outcome->coursevisibility = \core_course\management\helper::get_category_courses_visibility($categoryid); | ||
break; | ||
case 'getsubcategorieshtml' : | ||
$categoryid = required_param('categoryid', PARAM_INT); | ||
/* @var core_course_management_renderer $renderer */ | ||
$renderer = $PAGE->get_renderer('core_course', 'management'); | ||
$outcome->html = html_writer::start_tag('ul', array('class' => 'ml')); | ||
$coursecat = coursecat::get($categoryid); | ||
foreach ($coursecat->get_children() as $subcat) { | ||
$outcome->html .= $renderer->category_listitem($subcat, array(), $subcat->get_children_count()); | ||
} | ||
$outcome->html .= html_writer::end_tag('ul'); | ||
$outcome->outcome = true; | ||
break; | ||
} | ||
|
||
echo json_encode($outcome); | ||
echo $OUTPUT->footer(); | ||
// Thats all folks. | ||
// Don't ever even consider putting anything after this. It just wouldn't make sense. | ||
// But you already knew that, you smart developer you. | ||
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.