From 7eeedf59378072a767fb5e6657ac0a61676a817b Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Tue, 18 Aug 2009 05:15:09 +0000 Subject: [PATCH] MDL-19810 Upgraded calls to helpbutton, print_simple_box* and notify --- mod/hotpot/index.php | 12 ++++++------ mod/hotpot/lib.php | 4 ++-- mod/hotpot/report.php | 4 ++-- mod/hotpot/report/default.php | 7 ++++--- mod/hotpot/report/fullstat/report.php | 9 +++++---- mod/hotpot/review.php | 11 ++++++----- mod/hotpot/show.php | 6 +++--- mod/hotpot/view.php | 12 ++++++------ 8 files changed, 34 insertions(+), 31 deletions(-) diff --git a/mod/hotpot/index.php b/mod/hotpot/index.php index c65ba1c9a93..0ba4995fbbc 100644 --- a/mod/hotpot/index.php +++ b/mod/hotpot/index.php @@ -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)); @@ -126,7 +126,7 @@ . '' ; - print_simple_box_end(); + echo $OUTPUT->box_end(); echo $OUTPUT->footer(); exit; @@ -138,7 +138,7 @@ // regrade attempts for these hotpots foreach ($regrade_hotpots as $hotpot) { - notify("$hotpot->name"); + echo $OUTPUT->notification("$hotpot->name"); // delete questions and responses for this hotpot if ($records = $DB->get_records('hotpot_questions', array('hotpot'=>$hotpot->id), '', 'id,hotpot')) { @@ -167,7 +167,7 @@ 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 @@ -176,9 +176,9 @@ 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 diff --git a/mod/hotpot/lib.php b/mod/hotpot/lib.php index 94044871edd..57b866ca1d5 100644 --- a/mod/hotpot/lib.php +++ b/mod/hotpot/lib.php @@ -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"); } } } diff --git a/mod/hotpot/report.php b/mod/hotpot/report.php index 33b288b028c..2bb5794b336 100644 --- a/mod/hotpot/report.php +++ b/mod/hotpot/report.php @@ -547,7 +547,7 @@ function hotpot_print_report_selector(&$course, &$hotpot, &$formdata) { ); print ''; - helpbutton('reportcontent', get_string('reportcontent', 'hotpot'), 'hotpot'); + echo $OUTPUT->help_icon(moodle_help_icon::make('reportcontent', get_string('reportcontent', 'hotpot'), 'hotpot')); print ''.get_string('reportcontent', 'hotpot').':'; foreach ($menus as $name => $options) { $value = $formdata[$name]; @@ -586,7 +586,7 @@ function hotpot_print_report_selector(&$course, &$hotpot, &$formdata) { ); print ''; - helpbutton('reportformat', get_string('reportformat', 'hotpot'), 'hotpot'); + echo $OUTPUT->help_icon(moodle_help_icon::make('reportformat', get_string('reportformat', 'hotpot'), 'hotpot')); print ''; foreach ($menus as $name => $options) { $value = $formdata[$name]; diff --git a/mod/hotpot/report/default.php b/mod/hotpot/report/default.php index 60a1cdfe5f2..5b9e3a80c64 100644 --- a/mod/hotpot/report/default.php +++ b/mod/hotpot/report/default.php @@ -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 ''."\n"; if (isset($table->caption)) { @@ -528,8 +528,9 @@ class hotpot_default_report { } } function print_html_finish(&$table) { + global $OUTPUT; print "
\n"; - print_simple_box_end(); + echo $OUTPUT->box_end(); if (isset($table->finish)) { print $table->finish."\n"; diff --git a/mod/hotpot/report/fullstat/report.php b/mod/hotpot/report/fullstat/report.php index d82fbb343b8..1945f6c9d93 100644 --- a/mod/hotpot/report/fullstat/report.php +++ b/mod/hotpot/report/fullstat/report.php @@ -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 ? "
\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 ? '
' : "\n"; $space = $is_html ? ' ' : ""; $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'])) { diff --git a/mod/hotpot/review.php b/mod/hotpot/review.php index de6ab85fb97..617ffa45d9a 100644 --- a/mod/hotpot/review.php +++ b/mod/hotpot/review.php @@ -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 ''."\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 '
'; - 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 "\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 ''."\n"; if (empty($q)) { print '\n"; @@ -245,6 +246,6 @@ function hotpot_print_attempt_details(&$hotpot, &$attempt) { } // finish table print "
'.get_string("noresponses", "hotpot")."
\n"; - print_simple_box_end(); + echo $OUTPUT->box_end(); } ?> diff --git a/mod/hotpot/show.php b/mod/hotpot/show.php index 6179ecc89a4..b8306b0a7e9 100644 --- a/mod/hotpot/show.php +++ b/mod/hotpot/show.php @@ -42,7 +42,7 @@ //]]> box_start("generalbox boxaligncenter boxwidthwide"); if($hp = new hotpot_xml_quiz($params)) { print '
';
         switch ($params->action) {
@@ -63,9 +63,9 @@
         }
         print '
'; } 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 '
'; echo $OUTPUT->close_window_button(); ?> diff --git a/mod/hotpot/view.php b/mod/hotpot/view.php index 2be69dc7069..4e3875fb5ac 100644 --- a/mod/hotpot/view.php +++ b/mod/hotpot/view.php @@ -70,20 +70,20 @@ $boxalign = 'center'; $boxwidth = 500; if (trim(strip_tags($hotpot->summary))) { - print_simple_box_start($boxalign, $boxwidth); + echo $OUTPUT->box_start("generalbox boxalign$boxalign"); print '
'.format_text($hotpot->summary)."
\n"; - print_simple_box_end(); + echo $OUTPUT->box_end(); print "
\n"; } print '
'."\n"; - print_simple_box_start($boxalign, $boxwidth); + echo $OUTPUT->box_start("generalbox boxalign$boxalign"); print '
'; print get_string('requirepasswordmessage', 'quiz').'

'; print ''.get_string('password').': '; print ' '; print ' '; print "
\n"; - print_simple_box_end(); + echo $OUTPUT->box_end(); print "
\n"; echo $OUTPUT->footer(); exit; @@ -370,7 +370,7 @@ 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; @@ -426,7 +426,7 @@ $loggedinas, false, $body_tags ); if (!empty($available_msg)) { - notify($available_msg); + echo $OUTPUT->notification($available_msg); } print "