From: tjhunt Date: Thu, 22 Jan 2009 02:32:39 +0000 (+0000) Subject: question bank: MDL-17871 Possibility for tool tips on column headings. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0ff5afdfbf3a7b79ad7f8f687c296815f2f70b3f;p=moodle.git question bank: MDL-17871 Possibility for tool tips on column headings. --- diff --git a/lang/en_utf8/question.php b/lang/en_utf8/question.php index 1020a2c603..caced23647 100644 --- a/lang/en_utf8/question.php +++ b/lang/en_utf8/question.php @@ -154,10 +154,13 @@ $string['questioncatsfor'] = 'Question Categories for \'$a\''; $string['questiondoesnotexist'] = 'This question does not exist'; $string['questionsaveerror'] = 'Errors occur during saving question - ($a)'; $string['questionsmovedto'] = 'Questions still in use moved to "$a" in the parent course category.'; +$string['questionname'] = 'Question name'; $string['questionsrescuedfrom'] = 'Questions saved from context $a.'; $string['questionsrescuedfrominfo'] = 'These questions (some of which may be hidden) were saved when context $a was deleted because they are still used by some quizzes or other activities.'; +$string['questiontype'] = 'Question type'; $string['questionuse'] = 'Use question in this activity'; $string['saveflags'] = 'Save the state of the flags'; +$string['selectquestionsforbulk'] = 'Select questions for bulk actions'; $string['shareincontext'] = 'Share in context for $a'; $string['tofilecategory'] = 'Write category to file'; $string['tofilecontext'] = 'Write context to file'; diff --git a/question/editlib.php b/question/editlib.php index 48084486b2..38fd056f7c 100644 --- a/question/editlib.php +++ b/question/editlib.php @@ -155,19 +155,26 @@ abstract class question_bank_column_base { $sortable = $this->is_sortable(); $name = $this->get_name(); $title = $this->get_title(); + $tip = $this->get_tip(); if (is_array($sortable)) { if ($title) { echo '
' . $title . '
'; } $links = array(); foreach ($sortable as $subsort => $details) { - $links[] = $this->make_sort_link($name . '_' . $subsort, $details['title'], !empty($details['reverse'])); + $links[] = $this->make_sort_link($name . '_' . $subsort, $details['title'], '', !empty($details['reverse'])); } echo implode(' / ', $links); } else if ($sortable) { - echo $this->make_sort_link($name, $this->qbank->get_sort($name), $title); + echo $this->make_sort_link($name, $this->qbank->get_sort($name), $title, $tip); } else { + if ($tip) { + echo ''; + } echo $title; + if ($tip) { + echo ''; + } } echo "\n"; } @@ -177,7 +184,15 @@ abstract class question_bank_column_base { * @param object $question the row from the $question table, augmented with extra information. * @param string $rowclasses CSS class names that should be applied to this row of output. */ - protected function get_title() { + abstract protected function get_title() { + return ''; + } + + /** + * @return string a fuller version of the name. Use this when get_title() returns + * something very short, and you want a longer version as a tool tip. + */ + protected function get_title_tip() { return ''; } @@ -194,10 +209,13 @@ abstract class question_bank_column_base { if ($currentsort) { $newsortreverse = $currentsort > 0; } + if (!$tip) { + $tip = $title; + } if ($newsortreverse) { - $tip = get_string('sortbyxreverse', '', $title); + $tip = get_string('sortbyxreverse', '', $tip); } else { - $tip = get_string('sortbyx', '', $title); + $tip = get_string('sortbyx', '', $tip); } echo ''; echo $title; @@ -351,6 +369,10 @@ class question_bank_checkbox_column extends question_bank_column_base { return ''; } + protected function get_title_tip() { + return get_string('selectquestionsforbulk', 'question'); + } + protected function display_content($question, $rowclasses) { echo ''; @@ -373,6 +395,10 @@ class question_bank_question_type_column extends question_bank_column_base { return get_string('qtypeveryshort', 'question'); } + protected function get_title_tip() { + return get_string('questiontype', 'question'); + } + protected function display_content($question, $rowclasses) { echo print_question_icon($question); }