]> git.mjollnir.org Git - moodle.git/commitdiff
question bank: MDL-18822 Highlight the last question you edited in the list
authortjhunt <tjhunt>
Fri, 5 Jun 2009 08:30:53 +0000 (08:30 +0000)
committertjhunt <tjhunt>
Fri, 5 Jun 2009 08:30:53 +0000 (08:30 +0000)
Helpful if you need to edit a lot of questions - saves you from losing your place.
Idea and patch by Oleg Sychev.

question/editlib.php
question/question.php

index dbcc783f4e379dc5869f4242ad6ecfd1c797a35d..07afeb70349611f9dc0e8233866c9db2ddbdad3c 100644 (file)
@@ -776,6 +776,7 @@ class question_bank_view {
     protected $extrarows;
     protected $requiredcolumns;
     protected $sort;
+    protected $lastchangedid;
     protected $countsql;
     protected $loadsql;
     protected $sqlparams;
@@ -803,6 +804,8 @@ class question_bank_view {
             $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();
@@ -1340,6 +1343,9 @@ class question_bank_view {
         if ($question->hidden) {
             $classes[] = 'dimmed_text';
         }
+        if ($question->id == $this->lastchangedid) {
+            $nameclass='highlight';
+        }
         if (!empty($this->extrarows)) {
             $classes[] = 'r' . ($rowcount % 2);
         }
index bfaf0e28113f428ccd033980d617832a48a58e27..4f5158b8772079b23abbbce27dc807f4ce9708e0 100644 (file)
@@ -216,11 +216,12 @@ if ($mform->is_cancelled()){
             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);