Skip to content

Commit

Permalink
Merge branch 'MDL-36302-master' of git://github.com/damyon/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Nov 27, 2012
2 parents a6d3387 + 736a655 commit 0fa3d61
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions course/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
$returnto = optional_param('returnto', 0, PARAM_ALPHANUM); // generic navigation return page switch

$PAGE->set_pagelayout('admin');
$PAGE->set_url('/course/edit.php');
$pageparams = array('id'=>$id);
if (empty($id)) {
$pageparams = array('category'=>$categoryid);
}
$PAGE->set_url('/course/edit.php', $pageparams);

// basic access control checks
if ($id) { // editing course
Expand All @@ -46,15 +50,13 @@
$category = $DB->get_record('course_categories', array('id'=>$course->category), '*', MUST_EXIST);
$coursecontext = context_course::instance($course->id);
require_capability('moodle/course:update', $coursecontext);
$PAGE->url->param('id',$id);

} else if ($categoryid) { // creating new course in this category
$course = null;
require_login();
$category = $DB->get_record('course_categories', array('id'=>$categoryid), '*', MUST_EXIST);
$catcontext = context_coursecat::instance($category->id);
require_capability('moodle/course:create', $catcontext);
$PAGE->url->param('category',$categoryid);
$PAGE->set_context($catcontext);

} else {
Expand Down

0 comments on commit 0fa3d61

Please sign in to comment.