]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19813 Upgraded calls to helpbutton, print_simple_box* and notify
authornicolasconnault <nicolasconnault>
Tue, 18 Aug 2009 05:16:08 +0000 (05:16 +0000)
committernicolasconnault <nicolasconnault>
Tue, 18 Aug 2009 05:16:08 +0000 (05:16 +0000)
12 files changed:
mod/quiz/comment.php
mod/quiz/edit.php
mod/quiz/editlib.php
mod/quiz/locallib.php
mod/quiz/report/grading/report.php
mod/quiz/report/overview/report.php
mod/quiz/report/responses/report.php
mod/quiz/report/statistics/qstats.php
mod/quiz/report/statistics/report.php
mod/quiz/report/statistics/statistics_table.php
mod/quiz/reviewquestion.php
mod/quiz/view.php

index 68658969cc2cc23bf7b7e3a8ecbc835fc5201f1b..3aa5154e3731e402a1f7fe16ee2970686f8e13a8 100644 (file)
 
     /// If success, notify and print a close button.
         if (!is_string($error)) {
-            notify(get_string('changessaved'), 'notifysuccess');
+            echo $OUTPUT->notification(get_string('changessaved'), 'notifysuccess');
             close_window(2, true);
         }
 
     /// Otherwise, display the error and fall throug to re-display the form.
-        notify($error);
+        echo $OUTPUT->notification($error);
     }
 
 /// Print the comment form.
index d69b6639e2ecedbdeec755bc2e0d7894333d62e2..a9277b728ea3fad66d5496e2d1a653264cc73044 100644 (file)
@@ -106,8 +106,7 @@ function module_specific_controls($totalnumber, $recurse, $category, $cmid, $cmo
             $out .= '<input type="hidden" name="categoryid" value="' . $category->id . '" />';
             $out .= ' <input type="submit" name="addrandom" value="'.
                     $straddtoquiz.'" '.$disabled.' />';
-            $out .= helpbutton('random', get_string('random', 'quiz'), 'quiz',
-                    true, false, '', true);
+            $out .= $OUTPUT->help_icon(moodle_help_icon::make('random', get_string('random', 'quiz'), 'quiz'));
         }
     }
     return $out;
@@ -521,8 +520,7 @@ if ($quiz_reordertool) {
     echo '</div>';
 }
 echo $OUTPUT->heading($pagetitle.": ".$quiz->name, 2);
-helpbutton('editconcepts', get_string('basicideasofquiz', 'quiz'), 'quiz',
-        true, get_string('basicideasofquiz', 'quiz'));
+echo $OUTPUT->help_icon(moodle_help_icon::make('editconcepts', get_string('basicideasofquiz', 'quiz'), 'quiz', get_string('basicideasofquiz', 'quiz')));
 quiz_print_status_bar($quiz);
 
 $tabindex = 0;
index 6076e687846ae3b283e5e207507030393b0af847..eeeafb748ff1f2d0391e061540dc403f633b1913 100644 (file)
@@ -640,7 +640,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete = true,
  * @param unknown_type $hasattempts
  */
 function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts) {
-    global $CFG;
+    global $CFG, $OUTPUT;
     static $randombuttoncount = 0;
     $randombuttoncount++;
     echo '<div class="pagecontrols">';
@@ -678,7 +678,7 @@ function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts) {
             </div>
         </form>
     </div>
-    <?php helpbutton('random', get_string('random', 'quiz'), 'quiz', true, false, ''); ?>
+    <?php echo $OUTPUT->help_icon(moodle_help_icon::make('random', get_string('random', 'quiz'), 'quiz')); ?>
     <?php
     echo "\n</div>";
 }
@@ -750,12 +750,12 @@ function quiz_print_singlequestion($question, $returnurl, $quiz) {
  * @param boolean $quiz_qbanktool Indicate to this function if the question bank window open
  */
 function quiz_print_randomquestion(&$question, &$pageurl, &$quiz, $quiz_qbanktool) {
-    global $DB, $QTYPES, $THEME;
+    global $DB, $QTYPES, $THEME, $OUTPUT;
     check_theme_arrows();
     echo '<div class="quiz_randomquestion">';
 
     if (!$category = $DB->get_record('question_categories', array('id' => $question->category))) {
-        notify('Random question category not found!');
+        echo $OUTPUT->notification('Random question category not found!');
         return;
     }
 
@@ -859,11 +859,11 @@ function quiz_print_singlequestion_reordertool($question, $returnurl, $quiz) {
  * @param object $quiz The quiz in the context of which the question is being displayed
  */
 function quiz_print_randomquestion_reordertool(&$question, &$pageurl, &$quiz) {
-    global $DB, $QTYPES;
+    global $DB, $QTYPES, $OUTPUT;
 
     // Load the category, and the number of available questions in it.
     if (!$category = $DB->get_record('question_categories', array('id' => $question->category))) {
-        notify('Random question category not found!');
+        echo $OUTPUT->notification('Random question category not found!');
         return;
     }
     $questioncount = count($QTYPES['random']->get_usable_questions_from_category(
@@ -1136,7 +1136,7 @@ class quiz_question_bank_view extends question_bank_view {
  *      the last value used +1.
  */
 function quiz_print_grading_form($quiz, $pageurl, $tabindex) {
-    global $USER;
+    global $USER, $OUTPUT;
     $strsave = get_string('save', 'quiz');
     echo "<form method=\"post\" action=\"edit.php\"><div>";
     echo '<fieldset class="invisiblefieldset" style="display: block;">';
@@ -1147,7 +1147,7 @@ function quiz_print_grading_form($quiz, $pageurl, $tabindex) {
     echo '<label for="inputmaxgrade">' . get_string('maximumgradex', '', $a) . "</label>";
     echo '<input type="hidden" name="savechanges" value="save" />';
     echo '<input type="submit" value="' . $strsave . '" />';
-    helpbutton('maxgrade', get_string('maximumgrade'), 'quiz');
+    echo $OUTPUT->help_icon(moodle_help_icon::make('maxgrade', get_string('maximumgrade'), 'quiz'));
     echo '</fieldset>';
     echo "</div></form>\n";
     return $tabindex + 1;
index 00cd7d7061f0b8551668b24930afa5d696fe8053..eafe14f0081de39f9e164666042d1ba17fb4851c 100644 (file)
@@ -559,7 +559,7 @@ function quiz_set_grade($newgrade, &$quiz) {
  */
 function quiz_save_best_grade($quiz, $userid = null, $attempts = array()) {
     global $DB;
-    global $USER;
+    global $USER, $OUTPUT;
 
     if (empty($userid)) {
         $userid = $USER->id;
@@ -568,7 +568,7 @@ function quiz_save_best_grade($quiz, $userid = null, $attempts = array()) {
     if (!$attempts){
         // Get all the attempts made by the user
         if (!$attempts = quiz_get_user_attempts($quiz->id, $userid)) {
-            notify('Could not find any user attempts');
+            echo $OUTPUT->notification('Could not find any user attempts');
             return false;
         }
     }
index d7c34255c1adbe4e4886506d05fbf82f9398bbee..c3b29f379ad95b90dd14737b51e54a6a4284a66b 100644 (file)
@@ -61,7 +61,7 @@ class quiz_grading_report extends quiz_default_report {
         // Check permissions
         $this->context = get_context_instance(CONTEXT_MODULE, $cm->id);
         if (!has_capability('mod/quiz:grade', $this->context)) {
-            notify(get_string('gradingnotallowed', 'quiz_grading'));
+            echo $OUTPUT->notification(get_string('gradingnotallowed', 'quiz_grading'));
             return true;
         }
 
@@ -135,7 +135,7 @@ class quiz_grading_report extends quiz_default_report {
                     // the following will update the state and attempt
                     $error = question_process_comment($question, $state, $attempt, $response['comment'], $response['grade']);
                     if (is_string($error)) {
-                        notify($error);
+                        echo $OUTPUT->notification($error);
                         $allok = false;
                     } else if ($state->changed) {
                         // If the state has changed save it and update the quiz grade
@@ -145,9 +145,9 @@ class quiz_grading_report extends quiz_default_report {
                 }
 
                 if ($allok) {
-                    notify(get_string('changessaved', 'quiz'), 'notifysuccess');
+                    echo $OUTPUT->notification(get_string('changessaved', 'quiz'), 'notifysuccess');
                 } else {
-                    notify(get_string('changessavedwitherrors', 'quiz'), 'notifysuccess');
+                    echo $OUTPUT->notification(get_string('changessavedwitherrors', 'quiz'), 'notifysuccess');
                 }
             }
         }
@@ -160,15 +160,15 @@ class quiz_grading_report extends quiz_default_report {
 
         if(empty($this->users)) {
             if ($currentgroup){
-                notify(get_string('nostudentsingroup'));
+                echo $OUTPUT->notification(get_string('nostudentsingroup'));
             } else {
-                notify(get_string('nostudentsyet'));
+                echo $OUTPUT->notification(get_string('nostudentsyet'));
             }
             return true;
         }
         $qattempts = quiz_get_total_qas_graded_and_ungraded($quiz, array_keys($gradeableqs), array_keys($this->users));
         if(empty($qattempts)) {
-            notify(get_string('noattemptstoshow', 'quiz'));
+            echo $OUTPUT->notification(get_string('noattemptstoshow', 'quiz'));
             return true;
         }
         $qmenu = array();
@@ -226,7 +226,7 @@ class quiz_grading_report extends quiz_default_report {
      *       Finnish documenting
      **/
     function view_question($quiz, $question, $totalattempts, $ungraded) {
-        global $CFG, $DB;
+        global $CFG, $DB, $OUTPUT;
 
         $usercount = count($this->users);
 
@@ -319,7 +319,7 @@ class quiz_grading_report extends quiz_default_report {
             $table->print_html();
             echo '</div>';
         } else {
-            notify(get_string('noattemptstoshow', 'quiz'));
+            echo $OUTPUT->notification(get_string('noattemptstoshow', 'quiz'));
         }
     }
 
@@ -416,7 +416,7 @@ class quiz_grading_report extends quiz_default_report {
             echo '<div class="boxaligncenter"><input type="submit" value="'.get_string('savechanges').'" /></div>'.
                 '</form>';
         } else {
-            notify(get_string('noattemptstoshow', 'quiz'));
+            echo $OUTPUT->notification(get_string('noattemptstoshow', 'quiz'));
         }
     }
 
index 0490f0fd303bd87e66d2cef3dc8340675e50bcc8..2f21b1b7a7a5dcebb87febe09d76222f49d073de 100644 (file)
@@ -189,10 +189,10 @@ class quiz_overview_report extends quiz_default_report {
         }
         $nostudents = false;
         if (!$students){
-            notify(get_string('nostudentsyet'));
+            echo $OUTPUT->notification(get_string('nostudentsyet'));
             $nostudents = true;
         }else if ($currentgroup && !$groupstudents){
-            notify(get_string('nostudentsingroup'));
+            echo $OUTPUT->notification(get_string('nostudentsingroup'));
             $nostudents = true;
         }
         if (!$table->is_downloading()) {
@@ -426,7 +426,7 @@ class quiz_overview_report extends quiz_default_report {
     function regrade_all($dry, $quiz, $groupstudents){
         global $DB, $OUTPUT;
         if (!has_capability('mod/quiz:regrade', $this->context)) {
-            notify(get_string('regradenotallowed', 'quiz'));
+            echo $OUTPUT->notification(get_string('regradenotallowed', 'quiz'));
             return true;
         }
         // Fetch all attempts
@@ -509,7 +509,7 @@ class quiz_overview_report extends quiz_default_report {
     function regrade_all_needed($quiz, $groupstudents){
         global $DB, $OUTPUT;
         if (!has_capability('mod/quiz:regrade', $this->context)) {
-            notify(get_string('regradenotallowed', 'quiz'));
+            echo $OUTPUT->notification(get_string('regradenotallowed', 'quiz'));
             return;
         }
         // Fetch all attempts that need regrading
index 813f551a22ee83d4dfb23c5cc1a510abca8234f0..2e0babcc53283fc8abbbc63f62b358cf8552eb61 100644 (file)
@@ -17,7 +17,7 @@ class quiz_responses_report extends quiz_default_report {
      * Display the report.
      */
     function display($quiz, $cm, $course) {
-        global $CFG, $COURSE, $DB, $PAGE;
+        global $CFG, $COURSE, $DB, $PAGE, $OUTPUT;
 
         $context = get_context_instance(CONTEXT_MODULE, $cm->id);
 
@@ -150,10 +150,10 @@ class quiz_responses_report extends quiz_default_report {
         }
         $nostudents = false;
         if (!$students){
-            notify(get_string('nostudentsyet'));
+            echo $OUTPUT->notification(get_string('nostudentsyet'));
             $nostudents = true;
         }else if ($currentgroup && !$groupstudents){
-            notify(get_string('nostudentsingroup'));
+            echo $OUTPUT->notification(get_string('nostudentsingroup'));
             $nostudents = true;
         }
         if (!$table->is_downloading()) {
index ef3509d105f27e8085016ff0d45ca73da58ddf5a..3b5adc9845bd2ab2ec34aab19c8f99b242367910 100644 (file)
@@ -172,7 +172,7 @@ class qstats{
     }
     
     function process_states(){
-        global $DB;
+        global $DB, $OUTPUT;
         set_time_limit(0);
         $subquestionstats = array();
         foreach ($this->states as $state){
@@ -210,7 +210,7 @@ class qstats{
             $this->subquestions[$qid]->maxgrade = $this->subquestions[$qid]->_stats->maxgrade;
             $this->_initial_question_walker($this->subquestions[$qid]->_stats);
             if ($subquestionstats[$qid]->differentweights){
-                notify(get_string('erroritemappearsmorethanoncewithdifferentweight', 'quiz_statistics', $this->subquestions[$qid]->name));
+                echo $OUTPUT->notification(get_string('erroritemappearsmorethanoncewithdifferentweight', 'quiz_statistics', $this->subquestions[$qid]->name));
             }
             if ($this->subquestions[$qid]->_stats->usedin){
                 sort($this->subquestions[$qid]->_stats->usedin, SORT_NUMERIC);
@@ -296,4 +296,4 @@ class qstats{
         return $this->sumofgradevariance;
     }
 }
-?>
\ No newline at end of file
+?>
index 771d45dec37c366673b7b9e61cb33c0b0e3121c7..e39bbd0de8afc02d0df82551783f411efaf3f844 100644 (file)
@@ -103,7 +103,7 @@ class quiz_statistics_report extends quiz_default_report {
                 groups_print_activity_menu($cm, $reporturl->out());
                 echo '<br />';
                 if ($currentgroup && !$groupstudents){
-                    notify(get_string('nostudentsingroup', 'quiz_statistics'));
+                    echo $OUTPUT->notification(get_string('nostudentsingroup', 'quiz_statistics'));
                 }
             }
         }
@@ -422,7 +422,7 @@ class quiz_statistics_report extends quiz_default_report {
             $select = html_select::make($downloadoptions, 'download', $this->table->defaultdownloadformat, false);
             $select->nothingvalue = '';
             $quizinformationtablehtml .= $OUTPUT->select($select);;
-            $quizinformationtablehtml .= helpbutton('tableexportformats', get_string('tableexportformats', 'table'), 'moodle', true, false, '', true);
+            $quizinformationtablehtml .= $OUTPUT->help_icon(moodle_help_icon::make('tableexportformats', get_string('tableexportformats', 'table')));
             $quizinformationtablehtml .= '</div></form>';
         }
         $quizinformationtablehtml .= print_table($quizinformationtable, true);
index 61596e08d544d6fd56322424a09635c06e89377b..5d4efa3f37f7bca23cf36a08a5b58523e3f2ffbf 100644 (file)
@@ -141,11 +141,12 @@ class quiz_report_statistics_table extends flexible_table {
         return quiz_report_scale_sumgrades_as_percentage($question->_stats->maxgrade, $this->quiz);
     }
     function col_effective_weight($question){
+        global $OUTPUT;
         if (!$question->_stats->subquestion){
             if ($question->_stats->negcovar){
                 $negcovar = get_string('negcovar', 'quiz_statistics');
                 if (!$this->is_downloading()){
-                    $negcovar .= helpbutton('negcovar', $negcovar, 'quiz_statistics', true, false, '', true);
+                    $negcovar .= $OUTPUT->help_icon(moodle_help_icon::make('negcovar', $negcovar, 'quiz_statistics'));
                     return '<div class="negcovar">'.$negcovar.'</div>';
                 } else {
                     return $negcovar;
index f13abdaf6ae75f272f4fcd2230cde634f22d41cc..fd126ae6367de4b2fe8aeb2160aaca26150fe018 100644 (file)
     if (!$attemptobj->has_capability('mod/quiz:viewreports')) {
     /// Can't review during the attempt - send them back to the attempt page.
         if (!$attemptobj->is_finished()) {
-            notify(get_string('cannotreviewopen', 'quiz'));
+            echo $OUTPUT->notification(get_string('cannotreviewopen', 'quiz'));
             echo $OUTPUT->close_window_button();
         }
     /// Can't review other users' attempts.
         if (!$attemptobj->is_own_attempt()) {
-            notify(get_string('notyourattempt', 'quiz'));
+            echo $OUTPUT->notification(get_string('notyourattempt', 'quiz'));
             echo $OUTPUT->close_window_button();
         }
     /// Can't review unless Students may review -> Responses option is turned on.
         if (!$options->responses) {
             $accessmanager = $attemptobj->get_access_manager(time());
-            notify($accessmanager->cannot_review_message($attemptobj->get_review_options()));
+            echo $OUTPUT->notification($accessmanager->cannot_review_message($attemptobj->get_review_options()));
             echo $OUTPUT->close_window_button();
         }
     }
index 2ea3c72ecddc64848ddd0cddc294d4f0fb16e0d4..4f7c5da837678224b9f88edfd00b52dbd2a3965a 100644 (file)
 /// If they are not enrolled in this course in a good enough role, tell them to enrol.
     if (!($canattempt || $canpreview || $canreviewmine)) {
         echo $OUTPUT->box('<p>' . get_string('youneedtoenrol', 'quiz') . "</p>\n\n<p>" .
-                print_continue($CFG->wwwroot . '/course/view.php?id=' . $course->id, true) .
+                $OUTPUT->continue_button($CFG->wwwroot . '/course/view.php?id=' . $course->id) .
                 "</p>\n", 'generalbox', 'notice');
         echo $OUTPUT->footer();
         exit;
     if ($buttontext) {
         $accessmanager->print_start_attempt_button($canpreview, $buttontext, $unfinished);
     } else {
-        print_continue($CFG->wwwroot . '/course/view.php?id=' . $course->id);
+        echo $OUTPUT->continue_button($CFG->wwwroot . '/course/view.php?id=' . $course->id);
     }
     echo $OUTPUT->box_end();