mirror of
https://github.com/moodle/moodle.git
synced 2025-04-17 14:35:29 +02:00
Some improvements to how the tabs and links behave.
This commit is contained in:
parent
00f6fb1b71
commit
2662cf46fc
@ -145,7 +145,7 @@ class block_admin extends block_list {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/import.php?id='.$this->instance->pageid.'">'.get_string('import').'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/restore.gif" height="16" width="16" alt="" />';
|
||||
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/question/edit.php?courseid='.$this->instance->pageid.'">'.get_string('questions', 'quiz').'</a>';
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/question/edit.php?courseid='.$this->instance->pageid.'&clean=true">'.get_string('questions', 'quiz').'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/questions.gif" height="16" width="16" alt="" />';
|
||||
|
||||
$this->content->items[]='<a href="scales.php?id='.$this->instance->pageid.'">'.get_string('scales').'</a>';
|
||||
|
@ -61,9 +61,7 @@
|
||||
$mode = 'categories';
|
||||
include($CFG->dirroot.'/mod/quiz/tabs.php');
|
||||
} else {
|
||||
print_header_simple(get_string('editcategories', 'quiz'), '',
|
||||
'<a href="edit.php">'.get_string('editquestions', 'quiz').'</a>'.
|
||||
' -> '.get_string('editcategories', 'quiz'));
|
||||
print_header_simple(get_string('editcategories', 'quiz'), '', get_string('editcategories', 'quiz'));
|
||||
|
||||
// print tabs
|
||||
$currenttab = 'categories';
|
||||
|
@ -18,6 +18,12 @@
|
||||
|
||||
$courseid = required_param('courseid', 0, PARAM_INT);
|
||||
|
||||
// The optional parameter 'clean' allows us to clear module information,
|
||||
// guaranteeing a module-independent question bank editing interface
|
||||
if (optional_param('clean', false, PARAM_BOOL)) {
|
||||
unset($SESSION->modform);
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $courseid)) {
|
||||
error("This course doesn't exist");
|
||||
}
|
||||
@ -27,6 +33,8 @@
|
||||
if (!isteacheredit($course->id)) {
|
||||
error("You can't modify this course!");
|
||||
}
|
||||
|
||||
$SESSION->returnurl = $FULLME;
|
||||
|
||||
// Print basic page layout.
|
||||
|
||||
@ -41,7 +49,7 @@
|
||||
: "";
|
||||
print_header_simple($streditingquestions, '',
|
||||
"<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
|
||||
" -> <a href=\"$CFG->wwwroot/mod/quiz/view.php?q=$SESSION->modform->instance\">".format_string($SESSION->modform->name).'</a>'.
|
||||
" -> <a href=\"$CFG->wwwroot/mod/quiz/view.php?q={$SESSION->modform->instance}\">".format_string($SESSION->modform->name).'</a>'.
|
||||
" -> $streditingquestions",
|
||||
"", "", true, $strupdatemodule);
|
||||
|
||||
|
@ -68,9 +68,7 @@
|
||||
$mode = 'export';
|
||||
include($CFG->dirroot.'/mod/quiz/tabs.php');
|
||||
} else {
|
||||
print_header_simple($strexportquestions, '',
|
||||
"<a href=\"edit.php?courseid={$course->id}\">".get_string('editquestions', 'quiz').'</a>'.
|
||||
' -> '.$strexportquestions);
|
||||
print_header_simple($strexportquestions, '', $strexportquestions);
|
||||
// print tabs
|
||||
$currenttab = 'export';
|
||||
include('tabs.php');
|
||||
|
@ -71,9 +71,7 @@
|
||||
$mode = 'import';
|
||||
include($CFG->dirroot.'/mod/quiz/tabs.php');
|
||||
} else {
|
||||
print_header_simple($strimportquestions, '',
|
||||
'<a href="edit.php">'.get_string('editquestions', 'quiz').'</a>'.
|
||||
' -> '.$strimportquestions);
|
||||
print_header_simple($strimportquestions, '', $strimportquestions);
|
||||
// print tabs
|
||||
$currenttab = 'import';
|
||||
include('tabs.php');
|
||||
|
@ -68,19 +68,22 @@
|
||||
error("Must specify question id or category");
|
||||
}
|
||||
|
||||
if (!isset($SESSION->returnurl)) {
|
||||
$SESSION->returnurl = 'edit.php?courseid='.$course->id;
|
||||
}
|
||||
|
||||
// TODO: generalise this so it works for any activity
|
||||
$contextquiz = optional_param('contextquiz', 0, PARAM_INT); // the quiz from which this question is being edited
|
||||
$editurl = $contextquiz ? $CFG->wwwroot.'/mod/quiz/edit.php' : 'edit.php?courseid='.$course->id;
|
||||
$contextquiz = isset($SESSION->modform->instance) ? $SESSION->modform->instance : 0;
|
||||
|
||||
if (isset($_REQUEST['cancel'])) {
|
||||
redirect($editurl);
|
||||
redirect($SESSION->returnurl);
|
||||
}
|
||||
|
||||
if(!empty($id) && isset($_REQUEST['hide']) && confirm_sesskey()) {
|
||||
if(!set_field('question', 'hidden', $_REQUEST['hide'], 'id', $id)) {
|
||||
error("Faild to hide the question.");
|
||||
}
|
||||
redirect($editurl);
|
||||
redirect($SESSION->returnurl);
|
||||
}
|
||||
|
||||
if (empty($qtype)) {
|
||||
@ -98,7 +101,7 @@
|
||||
// TODO: remove restriction to quiz
|
||||
$streditingquestion = get_string('editingquestion', 'quiz');
|
||||
if (isset($SESSION->modform->instance)) {
|
||||
$strediting = '<a href=".$editurl.">'.get_string('editingquiz', 'quiz').'</a> -> '.
|
||||
$strediting = '<a href="'.$SESSION->returnurl.'">'.get_string('editingquiz', 'quiz').'</a> -> '.
|
||||
$streditingquestion;
|
||||
} else {
|
||||
$strediting = '<a href="edit.php?courseid='.$course->id.'">'.
|
||||
@ -123,7 +126,7 @@
|
||||
error("An error occurred trying to delete question (id $question->id)");
|
||||
}
|
||||
}
|
||||
redirect($editurl);
|
||||
redirect($SESSION->returnurl);
|
||||
} else {
|
||||
error("Confirmation string was incorrect");
|
||||
}
|
||||
@ -137,7 +140,7 @@
|
||||
}
|
||||
|
||||
notice_yesno(get_string("deletequestioncheck", "quiz", $question->name),
|
||||
"question.php?sesskey=$USER->sesskey&id=$question->id&delete=$delete&confirm=".md5($delete), $editurl);
|
||||
"question.php?sesskey=$USER->sesskey&id=$question->id&delete=$delete&confirm=".md5($delete), $SESSION->returnurl);
|
||||
}
|
||||
print_footer($course);
|
||||
exit;
|
||||
@ -282,7 +285,7 @@
|
||||
// $QTYPES[$question->qtype]->get_question_options($question);
|
||||
// quiz_regrade_question_in_quizzes($question, $replaceinquiz);
|
||||
//}
|
||||
redirect($editurl);
|
||||
redirect($SESSION->returnurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user