]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19810 Upgraded calls to helpbutton, print_simple_box* and notify
authornicolasconnault <nicolasconnault>
Tue, 18 Aug 2009 05:15:09 +0000 (05:15 +0000)
committernicolasconnault <nicolasconnault>
Tue, 18 Aug 2009 05:15:09 +0000 (05:15 +0000)
mod/hotpot/index.php
mod/hotpot/lib.php
mod/hotpot/report.php
mod/hotpot/report/default.php
mod/hotpot/report/fullstat/report.php
mod/hotpot/review.php
mod/hotpot/show.php
mod/hotpot/view.php

index c65ba1c9a93b43210385d09caad84138fe805e79..0ba4995fbbce74919d2287884a8bf0a1f019f896 100644 (file)
@@ -96,7 +96,7 @@
             $confirm = optional_param('confirm', 0, PARAM_BOOL);
             if (!$confirm) {
 
-                print_simple_box_start("center", "60%", "#FFAAAA", 20, "noticebox");
+                echo $OUTPUT->box_start("generalbox boxaligncenter boxwidthnormal errorboxcontent");
 
                 if (count($regrade_hotpots)==1) {
                     echo $OUTPUT->heading(get_string('regradecheck', 'hotpot', $regrade_hotpots[$regrade]->name));
                 .   '</td></tr></table></div>'
                 ;
 
-                print_simple_box_end();
+                echo $OUTPUT->box_end();
                 echo $OUTPUT->footer();
                 exit;
 
 
                 // regrade attempts for these hotpots
                 foreach ($regrade_hotpots as $hotpot) {
-                    notify("<b>$hotpot->name</b>");
+                    echo $OUTPUT->notification("<b>$hotpot->name</b>");
 
                     // delete questions and responses for this hotpot
                     if ($records = $DB->get_records('hotpot_questions', array('hotpot'=>$hotpot->id), '', 'id,hotpot')) {
                         if (!empty($CFG->hotpot_showtimes)) {
                             $msg .= ' ('.format_time(sprintf("%0.2f", microtime_diff($attemptstart, microtime()))).')';
                         }
-                        notify($msg);
+                        echo $OUTPUT->notification($msg);
                     }
                     $hotpotcount++;
                 } // end foreach $hotpots
                     if (!empty($CFG->hotpot_showtimes)) {
                         $msg .= ' ('.format_time(sprintf("%0.2f", microtime_diff($hotpotstart, microtime()))).')';
                     }
-                    notify($msg);
+                    echo $OUTPUT->notification($msg);
                 }
-                notify(get_string('regradecomplete', 'quiz'));
+                echo $OUTPUT->notification(get_string('regradecomplete', 'quiz'));
             } // end if $confirm
         } // end regrade
 
index 94044871edd676936a83373d04f4979aced8770a..57b866ca1d55c2c4d19c76839022542495af646e 100644 (file)
@@ -998,14 +998,14 @@ function hotpot_delete_instance($id) {
  * @param string $strtable
  */
 function hotpot_delete_and_notify($table, $select, $params, $strtable) {
-    global $DB;
+    global $DB, $OUTPUT;
 
     $count = max(0, $DB->count_records_select($table, $select, $params));
     if ($count) {
         $DB->delete_records_select($table, $select, $params);
         $count -= max(0, $DB->count_records_select($table, $select, $params));
         if ($count) {
-            notify(get_string('deleted')." $count x $strtable");
+            echo $OUTPUT->notification(get_string('deleted')." $count x $strtable");
         }
     }
 }
index 33b288b028c117917cdc454af5c2fc42c502f1c4..2bb5794b336c7dd70a37aa94c4f0e38f5b942db9 100644 (file)
@@ -547,7 +547,7 @@ function hotpot_print_report_selector(&$course, &$hotpot, &$formdata) {
     );
 
     print '<tr><td>';
-    helpbutton('reportcontent', get_string('reportcontent', 'hotpot'), 'hotpot');
+    echo $OUTPUT->help_icon(moodle_help_icon::make('reportcontent', get_string('reportcontent', 'hotpot'), 'hotpot'));
     print '</td><th align="right" scope="col">'.get_string('reportcontent', 'hotpot').':</th><td colspan="7">';
     foreach ($menus as $name => $options) {
         $value = $formdata[$name];
@@ -586,7 +586,7 @@ function hotpot_print_report_selector(&$course, &$hotpot, &$formdata) {
     );
 
     print '<tr><td>';
-    helpbutton('reportformat', get_string('reportformat', 'hotpot'), 'hotpot');
+    echo $OUTPUT->help_icon(moodle_help_icon::make('reportformat', get_string('reportformat', 'hotpot'), 'hotpot'));
     print '</td>';
     foreach ($menus as $name => $options) {
         $value = $formdata[$name];
index 60a1cdfe5f2ed34e8b963af86c02ee0540c70b8c..5b9e3a80c64b94d1d61e1733e56349a89a859430 100644 (file)
@@ -360,7 +360,7 @@ class hotpot_default_report {
         }
     }
     function print_html_start(&$table) {
-
+        global $OUTPUT;
         // default class for the table
         if (empty($table->tableclass)) {
             $table->tableclass = 'generaltable';
@@ -426,7 +426,7 @@ class hotpot_default_report {
             print $table->start."\n";
         }
 
-        print_simple_box_start("$table->tablealign", "$table->width", "#ffffff", 0);
+        echo $OUTPUT->box_start("generalbox boxalign$table->tablealign");
         print '<table width="100%" border="'.$table->border.'" valign="top" align="center"  cellpadding="'.$table->cellpadding.'" cellspacing="'.$table->cellspacing.'" class="'.$table->tableclass.'">'."\n";
 
         if (isset($table->caption)) {
@@ -528,8 +528,9 @@ class hotpot_default_report {
         }
     }
     function print_html_finish(&$table) {
+        global $OUTPUT;
         print "</table>\n";
-        print_simple_box_end();
+        echo $OUTPUT->box_end();
 
         if (isset($table->finish)) {
             print $table->finish."\n";
index d82fbb343b83b1bf7b72e4e4349b22d41130a960..1945f6c9d938971d2f58f52a350af94f6e1141f5 100644 (file)
@@ -12,7 +12,7 @@ class hotpot_report extends hotpot_default_report {
                return true;
        }
        function create_responses_table(&$hotpot, &$course, &$users, &$attempts, &$questions, &$options, &$tables) {
-               global $CFG;
+               global $CFG, $OUTPUT;
                $is_html = ($options['reportformat']=='htm');
                // shortcuts for font tags
                $br = $is_html ? "<br />\n" : "\n";
@@ -136,7 +136,7 @@ class hotpot_report extends hotpot_default_report {
                                                        if (empty($table->caption)) {
                                                                $table->caption = get_string('indivresp', 'quiz');
                                                                if ($is_html) {
-                                                                       $table->caption .= helpbutton('responsestable', $table->caption, 'hotpot', true, false, '', true);
+                                                                       $table->caption .= $OUTPUT->help_icon(moodle_help_icon::make('responsestable', $table->caption, 'hotpot'));
                                                                }
                                                        }
                                                        $hints = empty($response->hints) ? 0 : $response->hints;
@@ -162,6 +162,7 @@ class hotpot_report extends hotpot_default_report {
                $tables[] = &$table;
        }
        function create_analysis_table(&$users, &$attempts, &$questions, &$options, &$tables) {
+        global $OUTPUT;
                $is_html = ($options['reportformat']=='htm');
                // the fields we are interested in, in the order we want them
                $fields = array('correct', 'wrong', 'ignored', 'hints', 'clues', 'checks', 'weighting');
@@ -259,14 +260,14 @@ class hotpot_report extends hotpot_default_report {
                        $br = $is_html ? '<br />' : "\n";
                        $space = $is_html ? '&nbsp;' : "";
                        $no_value = $is_html ? '--' : "";
-                       $help_button = $is_html ? helpbutton("discrimination", get_string('discrimination', 'quiz'), "quiz", true, false, "", true) : "";
+                       $help_button = $is_html ? $OUTPUT->help_icon(moodle_help_icon::make("discrimination", get_string('discrimination', 'quiz'), "quiz")) : "";
                        // table properties
                        unset($table);
                        $table->border = 1;
                        $table->width = '100%';
                        $table->caption = get_string('itemanal', 'quiz');
                        if ($is_html) {
-                               $table->caption .= helpbutton('analysistable', $table->caption, 'hotpot', true, false, '', true);
+                               $table->caption .= $OUTPUT->help_icon(moodle_help_icon::make('analysistable', $table->caption, 'hotpot'));
                        }
                        // initialize legend, if necessary
                        if (!empty($options['reportshowlegend'])) {
index de6ab85fb978d8a6cdd65544fe225d29c9402686..617ffa45d9a7e387057e786486ed7114ec2c407a 100644 (file)
@@ -89,7 +89,8 @@
 ///////////////////////////
 function hotpot_print_attempt_summary(&$hotpot, &$attempt) {
     // start table
-    print_simple_box_start("center", "80%", "#ffffff", 0);
+    global $OUTPUT;
+    echo $OUTPUT->box_start("generalbox boxaligncenter boxwidthwide");
     print '<table width="100%" border="1" valign="top" align="center" cellpadding="2" cellspacing="2" class="generaltable">'."\n";
     // add attempt properties
     $fields = array('attempt', 'score', 'penalties', 'status', 'timetaken', 'timerecorded');
@@ -127,7 +128,7 @@ function hotpot_print_attempt_summary(&$hotpot, &$attempt) {
     }
     // finish table
     print '</table>';
-    print_simple_box_end();
+    echo $OUTPUT->box_end();
 }
 function hotpot_print_review_buttons(&$course, &$hotpot, &$attempt, $context) {
     global $DB;
@@ -154,7 +155,7 @@ function hotpot_print_review_buttons(&$course, &$hotpot, &$attempt, $context) {
     print "</table>\n";
 }
 function hotpot_print_attempt_details(&$hotpot, &$attempt) {
-    global $DB;
+    global $DB, $OUTPUT;
 
     // define fields to print
     $textfields = array('correct', 'ignored', 'wrong');
@@ -197,7 +198,7 @@ function hotpot_print_attempt_details(&$hotpot, &$attempt) {
     }
     $colspan = max(2, $colspan);
     // start table of questions and responses
-    print_simple_box_start("center", "80%", "#ffffff", 0);
+    echo $OUTPUT->box_start("generalbox boxaligncenter boxwidthwide");
     print '<table width="100%" border="1" valign="top" align="center" cellpadding="2" cellspacing="2" class="generaltable">'."\n";
     if (empty($q)) {
         print '<tr><td align="center" class="generaltablecell"><b>'.get_string("noresponses", "hotpot")."</b></td></tr>\n";
@@ -245,6 +246,6 @@ function hotpot_print_attempt_details(&$hotpot, &$attempt) {
     }
     // finish table
     print "</table>\n";
-    print_simple_box_end();
+    echo $OUTPUT->box_end();
 }
 ?>
index 6179ecc89a4a8509aca21087e0b262fe4447182a..b8306b0a7e9c83556854dcfec9567eaadc573c74 100644 (file)
@@ -42,7 +42,7 @@
 //]]>
 </script>
 <?php
-    print_simple_box_start("center", "96%");
+    echo $OUTPUT->box_start("generalbox boxaligncenter boxwidthwide");
     if($hp = new hotpot_xml_quiz($params)) {
         print '<pre id="contents">';
         switch ($params->action) {
@@ -63,9 +63,9 @@
         }
         print '</pre>';
     } else {
-        print_simple_box("Could not open Hot Potatoes XML file", "center", "", "#FFBBBB");
+        echo $OUTPUT->box("Could not open Hot Potatoes XML file", "errorboxcontent generalbox");
     }
-    print_simple_box_end();
+    echo $OUTPUT->box_end();
     print '<br />';
     echo $OUTPUT->close_window_button();
 ?>
index 2be69dc7069468938c78c5f520737c23b62cebef..4e3875fb5ac018dadbdfe98302e1f249c493dc6e 100644 (file)
             $boxalign = 'center';
             $boxwidth = 500;
             if (trim(strip_tags($hotpot->summary))) {
-                print_simple_box_start($boxalign, $boxwidth);
+                echo $OUTPUT->box_start("generalbox boxalign$boxalign");
                 print '<div class="mdl-align">'.format_text($hotpot->summary)."</div>\n";
-                print_simple_box_end();
+                echo $OUTPUT->box_end();
                 print "<br />\n";
             }
             print '<form id="passwordform" method="post" action="view.php?id='.$cm->id.'">'."\n";
-            print_simple_box_start($boxalign, $boxwidth);
+            echo $OUTPUT->box_start("generalbox boxalign$boxalign");
             print '<div class="mdl-align">';
             print get_string('requirepasswordmessage', 'quiz').'<br /><br />';
             print '<b>'.get_string('password').':</b> ';
             print '<input name="hppassword" type="password" value="" /> ';
             print '<input type="submit" value="'.get_string("ok").'" /> ';
             print "</div>\n";
-            print_simple_box_end();
+            echo $OUTPUT->box_end();
             print "</form>\n";
             echo $OUTPUT->footer();
             exit;
             print_header($title, $heading, $navigation, "", $head.$styles.$scripts, true, $button, $loggedinas, false, $body_tags
             );
             if (!empty($available_msg)) {
-                notify($available_msg);
+                echo $OUTPUT->notification($available_msg);
             }
             print $body.$footer;
         break;
                         $loggedinas, false, $body_tags
                     );
                     if (!empty($available_msg)) {
-                        notify($available_msg);
+                        echo $OUTPUT->notification($available_msg);
                     }
                     print "<iframe id=\"$iframe_id\" src=\"view.php?id=$cm->id&amp;framename=main\" height=\"100%\" width=\"100%\">";
                     print "<ilayer name=\"$iframe_id\" src=\"view.php?id=$cm->id&amp;framename=main\" height=\"100%\" width=\"100%\">";