Skip to content

Commit

Permalink
question bank: MDL-18822 Highlight the last question you edited in th…
Browse files Browse the repository at this point in the history
…e list

Helpful if you need to edit a lot of questions - saves you from losing your place.
Idea and patch by Oleg Sychev.
  • Loading branch information
tjhunt committed Jun 5, 2009
1 parent f4d76b9 commit aa9c6ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions question/editlib.php
Expand Up @@ -776,6 +776,7 @@ class question_bank_view {
protected $extrarows;
protected $requiredcolumns;
protected $sort;
protected $lastchangedid;
protected $countsql;
protected $loadsql;
protected $sqlparams;
Expand Down Expand Up @@ -803,6 +804,8 @@ public function __construct($contexts, $pageurl, $course, $cm = null) {
$this->editquestionurl->param('courseid', $this->course->id);
}

$this->lastchangedid = optional_param('lastchanged',0,PARAM_INT);

$this->init_column_types();
$this->init_columns($this->wanted_columns());
$this->init_sort();
Expand Down Expand Up @@ -1340,6 +1343,9 @@ protected function get_row_classes($question, $rowcount) {
if ($question->hidden) {
$classes[] = 'dimmed_text';
}
if ($question->id == $this->lastchangedid) {
$nameclass='highlight';
}
if (!empty($this->extrarows)) {
$classes[] = 'r' . ($rowcount % 2);
}
Expand Down
9 changes: 5 additions & 4 deletions question/question.php
Expand Up @@ -216,11 +216,12 @@
notify(get_string('changessaved'), '');
close_window(3);
} else {
if($appendqnumstring){
$returnurl_object=new moodle_url($returnurl);
$returnurl=$returnurl_object->out(false,array($appendqnumstring=>($question->id), "sesskey"=>sesskey(), "cmid"=>$cmid));
$nexturl = new moodle_url($returnurl);
$nexturl->param('lastchanged', $question->id);
if($appendqnumstring) {
$nexturl->params(array($appendqnumstring=>($question->id), "sesskey"=>sesskey(), "cmid"=>$cmid));
}
redirect($returnurl);
redirect($nexturl->out());
}
} else {
$nexturlparams = array('returnurl'=>$returnurl, 'appendqnumstring'=>$appendqnumstring);
Expand Down

0 comments on commit aa9c6ec

Please sign in to comment.