Skip to content

Commit

Permalink
Merge branch 'MDL-28075' of git://github.com/timhunt/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Oct 7, 2014
2 parents be89890 + 50b5dde commit 0c1a176
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 45 deletions.
25 changes: 9 additions & 16 deletions question/addquestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,22 @@
}

$PAGE->set_url('/question/addquestion.php', $hiddenparams);
if ($cmid) {
$questionbankurl = new moodle_url('/question/edit.php', array('cmid' => $cmid));
} else {
$questionbankurl = new moodle_url('/question/edit.php', array('courseid' => $courseid));
}
navigation_node::override_active_url($questionbankurl);

$chooseqtype = get_string('chooseqtypetoadd', 'question');
$PAGE->set_heading($COURSE->fullname);
if ($cm !== null) {
// Nasty hack, but we don't want this link if returnurl returns to view.php
if (stripos($returnurl, "/mod/{$cm->modname}/view.php")!== 0) {
$PAGE->navbar->add(get_string('editinga', 'moodle', get_string('modulename', $cm->modname)),$returnurl);
}
$PAGE->navbar->add($chooseqtype);
$PAGE->set_title($chooseqtype);
echo $OUTPUT->header();
} else {
$PAGE->navbar->add(get_string('questionbank', 'question'),$returnurl);
$PAGE->navbar->add($chooseqtype);
$PAGE->set_title($chooseqtype);
echo $OUTPUT->header();
}
$PAGE->navbar->add($chooseqtype);
$PAGE->set_title($chooseqtype);

// Display a form to choose the question type.
echo $OUTPUT->header();
echo $OUTPUT->notification(get_string('youmustselectaqtype', 'question'));
echo $OUTPUT->box_start('generalbox boxwidthnormal boxaligncenter', 'chooseqtypebox');
echo print_choose_qtype_to_add_form($hiddenparams, null, false);
echo $OUTPUT->box_end();

echo $OUTPUT->footer();

47 changes: 18 additions & 29 deletions question/question.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,20 @@
}
$PAGE->set_url($url);

if ($cmid) {
$questionbankurl = new moodle_url('/question/edit.php', array('cmid' => $cmid));
} else {
$questionbankurl = new moodle_url('/question/edit.php', array('courseid' => $courseid));
}
navigation_node::override_active_url($questionbankurl);

if ($originalreturnurl) {
if (strpos($originalreturnurl, '/') !== 0) {
throw new coding_exception("returnurl must be a local URL starting with '/'. $originalreturnurl was given.");
}
$returnurl = new moodle_url($originalreturnurl);
} else if ($cmid) {
$returnurl = new moodle_url('/question/edit.php', array('cmid' => $cmid));
} else {
$returnurl = new moodle_url('/question/edit.php', array('courseid' => $courseid));
$returnurl = $questionbankurl;
}
if ($scrollpos) {
$returnurl->param('scrollpos', $scrollpos);
Expand Down Expand Up @@ -308,31 +313,15 @@
redirect($nexturl);
}

} else {
$streditingquestion = $qtypeobj->get_heading();
$PAGE->set_title($streditingquestion);
$PAGE->set_heading($COURSE->fullname);
if ($cm !== null) {
$strmodule = get_string('modulename', $cm->modname);
$streditingmodule = get_string('editinga', 'moodle', $strmodule);
$PAGE->navbar->add(get_string('modulenameplural', $cm->modname), new moodle_url('/mod/'.$cm->modname.'/index.php', array('id'=>$cm->course)));
$PAGE->navbar->add(format_string($module->name), new moodle_url('/mod/'.$cm->modname.'/view.php', array('id'=>$cm->id)));
if (stripos($returnurl, "{$CFG->wwwroot}/mod/{$cm->modname}/view.php")!== 0){
//don't need this link if returnurl returns to view.php
$PAGE->navbar->add($streditingmodule, $returnurl);
}
$PAGE->navbar->add($streditingquestion);
echo $OUTPUT->header();
}

} else {
$strediting = '<a href="edit.php?courseid='.$COURSE->id.'">'.get_string('editquestions', 'question').'</a> -> '.$streditingquestion;
$PAGE->navbar->add(get_string('editquestions', 'question'), $returnurl);
$PAGE->navbar->add($streditingquestion);
echo $OUTPUT->header();
}
$streditingquestion = $qtypeobj->get_heading();
$PAGE->set_title($streditingquestion);
$PAGE->set_heading($COURSE->fullname);
$PAGE->navbar->add($streditingquestion);

// Display a heading, question editing form and possibly some extra content needed for
// for this question type.
$qtypeobj->display_question_editing_page($mform, $question, $wizardnow);
echo $OUTPUT->footer();
}
// Display a heading, question editing form and possibly some extra content needed for
// for this question type.
echo $OUTPUT->header();
$qtypeobj->display_question_editing_page($mform, $question, $wizardnow);
echo $OUTPUT->footer();

0 comments on commit 0c1a176

Please sign in to comment.