MDL-19810 Upgraded calls to helpbutton, print_simple_box* and notify

This commit is contained in:
nicolasconnault 2009-08-18 05:15:09 +00:00
parent ee9e63b5a1
commit 7eeedf5937
8 changed files with 34 additions and 31 deletions

View 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));
@ -126,7 +126,7 @@
. '</td></tr></table></div>'
;
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("<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')) {
@ -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

View 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");
}
}
}

View 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];

View 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";

View 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'])) {

View 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();
}
?>

View 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();
?>

View File

@ -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 '<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;
@ -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 "<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%\">";