From: nicolasconnault Date: Thu, 20 Aug 2009 08:40:49 +0000 (+0000) Subject: MDL-19797 upgraded calls to print_table, print_single_button, print_user_picture... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=03fcc729ab84071f93cd2a7c1eb9c5cf093c9483;p=moodle.git MDL-19797 upgraded calls to print_table, print_single_button, print_user_picture, print_container* and notice_yesno --- diff --git a/grade/edit/letter/index.php b/grade/edit/letter/index.php index d3c53b3c65..b2d500a8dd 100644 --- a/grade/edit/letter/index.php +++ b/grade/edit/letter/index.php @@ -53,13 +53,13 @@ foreach($letters as $boundary=>$letter) { $max = $boundary - 0.01; } -$table = new object(); +$table = new html_table(); $table->head = array(get_string('max', 'grades'), get_string('min', 'grades'), get_string('letter', 'grades')); $table->size = array('30%', '30%', '40%'); $table->align = array('left', 'left', 'left'); $table->width = '30%'; $table->data = $data; -print_table($table); +echo $OUTPUT->table($table); echo $OUTPUT->footer(); diff --git a/grade/edit/outcome/edit.php b/grade/edit/outcome/edit.php index d522183fd6..c00b73b019 100644 --- a/grade/edit/outcome/edit.php +++ b/grade/edit/outcome/edit.php @@ -124,7 +124,7 @@ if ($courseid) { } if (!grade_scale::fetch_all_local($courseid) && !grade_scale::fetch_all_global()) { - notice_yesno(get_string('noscales', 'grades'), $CFG->wwwroot.'/grade/edit/scale/edit.php?courseid='.$courseid, $returnurl); + echo $OUTPUT->confirm(get_string('noscales', 'grades'), $CFG->wwwroot.'/grade/edit/scale/edit.php?courseid='.$courseid, $returnurl); echo $OUTPUT->footer(); die(); } diff --git a/grade/edit/outcome/import.php b/grade/edit/outcome/import.php index d01ca29a92..0cd1880021 100644 --- a/grade/edit/outcome/import.php +++ b/grade/edit/outcome/import.php @@ -135,7 +135,7 @@ if ($handle = fopen($imported_file['userfile']['tmp_name'], 'r')) { if ($error) { echo $OUTPUT->box_start('generalbox importoutcomenofile'); echo get_string('importoutcomenofile', 'grades', $line); - echo print_single_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get', '_self', true); + echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get')); echo $OUTPUT->box_end(); $fatal_error = true; break; @@ -154,7 +154,7 @@ if ($handle = fopen($imported_file['userfile']['tmp_name'], 'r')) { if ( count($csv_data) != count($file_headers) ) { echo $OUTPUT->box_start('generalbox importoutcomenofile'); echo get_string('importoutcomenofile', 'grades', $line); - echo print_single_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get', '_self', true); + echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get')); echo $OUTPUT->box_end(); $fatal_error = true; //echo $OUTPUT->box(var_export($csv_data, true) ."
". var_export($header, true)); @@ -166,7 +166,7 @@ if ($handle = fopen($imported_file['userfile']['tmp_name'], 'r')) { if ($csv_data[$imported_headers[$header]] == '') { echo $OUTPUT->box_start('generalbox importoutcomenofile'); echo get_string('importoutcomenofile', 'grades', $line); - echo print_single_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get', '_self', true); + echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get')); echo $OUTPUT->box_end(); $fatal_error = true; break; diff --git a/grade/edit/outcome/index.php b/grade/edit/outcome/index.php index bf1fbdfe19..141b99cb31 100644 --- a/grade/edit/outcome/index.php +++ b/grade/edit/outcome/index.php @@ -97,13 +97,13 @@ switch ($action) { if(!$deleteconfirmed){ print_header(get_string('outcomedelete', 'grades')); - notice_yesno(get_string('outcomeconfirmdelete', 'grades', $outcome->fullname), - "index.php?id={$courseid}", "index.php?id={$courseid}", - array('outcomeid' => $outcome->id, - 'action'=> 'delete', - 'sesskey' => sesskey(), - 'deleteconfirmed'=> 1) - ); + $confirmurl = new moodle_url('index.php', array( + 'id' => $courseid, 'outcomeid' => $outcome->id, + 'action'=> 'delete', + 'sesskey' => sesskey(), + 'deleteconfirmed'=> 1)); + + echo $OUTPUT->confirm(get_string('outcomeconfirmdelete', 'grades', $outcome->fullname), $confirmurl, "index.php?id={$courseid}"); echo $OUTPUT->footer(); die; }else{ @@ -170,13 +170,13 @@ if ($courseid and $outcomes = grade_outcome::fetch_all_local($courseid)) { $data[] = $line; } - $table = new object(); + $table = new html_table(); $table->head = array($strfullname, $strshortname, $strscale, $stritems, $stredit); $table->size = array('30%', '20%', '20%', '20%', '10%' ); $table->align = array('left', 'left', 'left', 'center', 'center'); $table->width = '90%'; $table->data = $data; - $return .= print_table($table, true); + $return .= $OUTPUT->table($table); $outcomes_tables[] = $return; } @@ -226,13 +226,13 @@ if ($outcomes = grade_outcome::fetch_all_global()) { $data[] = $line; } - $table = new object(); + $table = new html_table(); $table->head = array($strfullname, $strshortname, $strscale, $strcourses, $stritems, $stredit); $table->size = array('30%', '20%', '20%', '10%', '10%', '10%'); $table->align = array('left', 'left', 'left', 'center', 'center', 'center'); $table->width = '90%'; $table->data = $data; - $return .= print_table($table, true); + $return .= $OUTPUT->table($table); $outcomes_tables[] = $return; } @@ -245,12 +245,12 @@ foreach($outcomes_tables as $table) { print($table); } -echo '
'; -print_single_button('edit.php', array('courseid'=>$courseid), $strcreatenewoutcome); +echo $OUTPUT->container_start('buttons'); +echo $OUTPUT->button(html_form::make_button('edit.php', array('courseid'=>$courseid), $strcreatenewoutcome)); if ( !empty($outcomes_tables) ) { - print_single_button('export.php', array('id'=>$courseid, 'sesskey'=>sesskey()), get_string('exportalloutcomes', 'grades')); + echo $OUTPUT->button(html_form::make_button('export.php', array('id'=>$courseid, 'sesskey'=>sesskey()), get_string('exportalloutcomes', 'grades'))); } -echo '
'; +echo $OUTPUT->container_end(); $upload_form->display(); diff --git a/grade/edit/scale/index.php b/grade/edit/scale/index.php index 88a568ed28..b14489eb5c 100644 --- a/grade/edit/scale/index.php +++ b/grade/edit/scale/index.php @@ -77,8 +77,8 @@ if (!$courseid) { admin_externalpage_print_header(); } -$table = new stdClass(); -$table2 = new stdClass(); +$table = new html_table(); +$table2 = new html_table(); $heading = ''; if ($courseid and $scales = grade_scale::fetch_all_local($courseid)) { @@ -145,11 +145,10 @@ if ($courseid) { } echo $OUTPUT->heading($strcustomscales, 3, 'main'); -print_table($table); +echo $OUTPUT->table($table); echo $OUTPUT->heading($strstandardscale, 3, 'main'); -print_table($table2); -echo '
'; -print_single_button('edit.php', array('courseid'=>$courseid), $srtcreatenewscale); -echo '
'; - +echo $OUTPUT->table($table2); +echo $OUTPUT->container_start('buttons'); +echo $OUTPUT->button(html_form::make_button('edit.php', array('courseid'=>$courseid), $srtcreatenewscale)); +echo $OUTPUT->container_end(); echo $OUTPUT->footer(); diff --git a/grade/edit/tree/index.php b/grade/edit/tree/index.php index 284b36b1c2..38edc602c1 100644 --- a/grade/edit/tree/index.php +++ b/grade/edit/tree/index.php @@ -144,7 +144,9 @@ switch ($action) { $strdeletecheckfull = get_string('deletecheck', '', $object->get_name()); $optionsyes = array('eid'=>$eid, 'confirm'=>1, 'sesskey'=>sesskey(), 'id'=>$course->id, 'action'=>'delete'); $optionsno = array('id'=>$course->id); - notice_yesno($strdeletecheckfull, 'index.php', 'index.php', $optionsyes, $optionsno, 'post', 'get'); + $formcontinue = html_form::make_button('index.php', $optionsyes, get_string('yes')); + $formcancel = html_form::make_button('index.php', $optionsno, get_string('no'), 'get'); + echo $OUTPUT->confirm($strdeletecheckfull, $formcontinue, $formcancel); echo $OUTPUT->footer(); die; } @@ -329,22 +331,22 @@ echo ''; echo $OUTPUT->box_end(); // Print action buttons -echo '
'; +echo $OUTPUT->container_start('buttons'); if ($moving) { - print_single_button('index.php', array('id'=>$course->id), get_string('cancel'), 'get'); + echo $OUTPUT->button(html_form::make_button('index.php', array('id'=>$course->id), get_string('cancel'), 'get')); } else { - print_single_button('category.php', array('courseid'=>$course->id), get_string('addcategory', 'grades'), 'get'); - print_single_button('item.php', array('courseid'=>$course->id), get_string('additem', 'grades'), 'get'); + echo $OUTPUT->button(html_form::make_button('category.php', array('courseid'=>$course->id), get_string('addcategory', 'grades'), 'get')); + echo $OUTPUT->button(html_form::make_button('item.php', array('courseid'=>$course->id), get_string('additem', 'grades'), 'get')); if (!empty($CFG->enableoutcomes)) { - print_single_button('outcomeitem.php', array('courseid'=>$course->id), get_string('addoutcomeitem', 'grades'), 'get'); + echo $OUTPUT->button(html_form::make_button('outcomeitem.php', array('courseid'=>$course->id), get_string('addoutcomeitem', 'grades'), 'get')); } //print_single_button('index.php', array('id'=>$course->id, 'action'=>'autosort'), get_string('autosort', 'grades'), 'get'); } -echo '
'; +echo $OUTPUT->container_end(); echo $OUTPUT->footer(); diff --git a/grade/edit/tree/outcomeitem.php b/grade/edit/tree/outcomeitem.php index 29daf9708d..279f7977f7 100644 --- a/grade/edit/tree/outcomeitem.php +++ b/grade/edit/tree/outcomeitem.php @@ -204,7 +204,7 @@ if ($data = $mform->get_data()) { print_grade_page_head($courseid, 'edittree', null, $heading); if (!grade_outcome::fetch_all_available($COURSE->id)) { - notice_yesno(get_string('nooutcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/course.php?id='.$courseid, $returnurl); + echo $OUTPUT->confirm(get_string('nooutcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/course.php?id='.$courseid, $returnurl); echo $OUTPUT->footer(); die(); } diff --git a/grade/export/key.php b/grade/export/key.php index 8cee15694b..69382778ec 100644 --- a/grade/export/key.php +++ b/grade/export/key.php @@ -64,7 +64,9 @@ if ($id and $delete) { print_header(get_string('deleteselectedkey'), get_string('deleteselectedkey')); $optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1); $optionsno = array('id'=>$courseid); - notice_yesno(get_string('deletekeyconfirm', 'userkey', $key->value), 'key.php', 'keymanager.php', $optionsyes, $optionsno, 'get', 'get'); + $formcontinue = html_form::make_button('key.php', $optionsyes, get_string('yes'), 'get'); + $formcancel = html_form::make_button('keymanager.php', $optionsno, get_string('no'), 'get'); + echo $OUTPUT->confirm(get_string('deletekeyconfirm', 'userkey', $key->value), $formcontinue, $formcancel); echo $OUTPUT->footer(); die; diff --git a/grade/export/keymanager.php b/grade/export/keymanager.php index 29ef1ddcc9..cb0e812bc3 100644 --- a/grade/export/keymanager.php +++ b/grade/export/keymanager.php @@ -53,16 +53,17 @@ if ($keys) { $data[] = $line; } } +$table = new html_table(); $table->head = array(get_string('keyvalue', 'userkey'), get_string('keyiprestriction', 'userkey'), get_string('keyvaliduntil', 'userkey'), $stredit); $table->size = array('50%', '30%', '10%', '10%'); $table->align = array('left', 'left', 'left', 'center'); $table->width = '90%'; $table->data = $data; -print_table($table); +echo $OUTPUT->table($table); -echo '
'; -print_single_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey')); -echo '
'; +echo $OUTPUT->container_start('buttons'); +echo $OUTPUT->button(html_form::make_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey'))); +echo $OUTPUT->container_end(); echo $OUTPUT->footer(); ?> diff --git a/grade/export/lib.php b/grade/export/lib.php index 452e5163be..274027ba68 100755 --- a/grade/export/lib.php +++ b/grade/export/lib.php @@ -288,29 +288,29 @@ abstract class grade_export { public function print_continue() { global $CFG, $OUTPUT; - $params = $this->get_export_params(); - + $params = $this->get_export_params(); echo $OUTPUT->heading(get_string('export', 'grades')); - echo ''; + echo $OUTPUT->container_end(); } } diff --git a/grade/import/key.php b/grade/import/key.php index 0929d1675e..b70950adec 100644 --- a/grade/import/key.php +++ b/grade/import/key.php @@ -64,7 +64,9 @@ if ($id and $delete) { print_header(get_string('deleteselectedkey'), get_string('deleteselectedkey')); $optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1); $optionsno = array('id'=>$courseid); - notice_yesno(get_string('deletekeyconfirm', 'userkey', $key->value), 'key.php', 'keymanager.php', $optionsyes, $optionsno, 'get', 'get'); + $formcontinue = html_form::make_button('key.php', $optionsyes, get_string('yes'), 'get'); + $formcancel = html_form::make_button('keymanager.php', $optionsno, get_string('no'), 'get'); + echo $OUTPUT->confirm(get_string('deletekeyconfirm', 'userkey', $key->value), $formcontinue, $formcancel); echo $OUTPUT->footer(); die; diff --git a/grade/import/keymanager.php b/grade/import/keymanager.php index 3f5a0cb14f..cdf7fff93a 100644 --- a/grade/import/keymanager.php +++ b/grade/import/keymanager.php @@ -52,16 +52,17 @@ if ($keys = $DB->get_records_select('user_private_key', "script='grade/import' A $data[] = $line; } } +$table = new html_table(); $table->head = array(get_string('keyvalue', 'userkey'), get_string('keyiprestriction', 'userkey'), get_string('keyvaliduntil', 'userkey'), $stredit); $table->size = array('50%', '30%', '10%', '10%'); $table->align = array('left', 'left', 'left', 'center'); $table->width = '90%'; $table->data = $data; -print_table($table); +echo $OUTPUT->table($table); -echo '
'; -print_single_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey')); -echo '
'; +echo $OUTPUT->container_start('buttons'); +echo $OUTPUT->button(html_form::make_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey'))); +echo $OUTPUT->container_end(); echo $OUTPUT->footer(); ?> diff --git a/grade/report/grader/ajaxlib.php b/grade/report/grader/ajaxlib.php index 23794f93ef..4b7411e719 100644 --- a/grade/report/grader/ajaxlib.php +++ b/grade/report/grader/ajaxlib.php @@ -158,7 +158,7 @@ class grade_report_grader_ajax extends grade_report_grader { * @return string */ function get_studentrowhtml($user) { - global $CFG, $USER; + global $CFG, $USER, $OUTPUT; $showuserimage = $this->get_pref('showuserimage'); $showuseridnumber = $this->get_pref('showuseridnumber'); $fixedstudents = empty($USER->screenreader) && $this->get_pref('fixedstudents'); @@ -183,7 +183,7 @@ class grade_report_grader_ajax extends grade_report_grader { // Student name and link $user_pic = null; if ($showuserimage) { - $user_pic = '
' . print_user_picture($user, $this->courseid, true, 0, true) . '
'; + $user_pic = '
' . $OUTPUT->user_picture(moodle_user_picture::make($user, $this->courseid)) . '
'; } $studentrowhtml .= '' diff --git a/grade/report/grader/index.php b/grade/report/grader/index.php index bad78c153a..31d4ef2ba4 100644 --- a/grade/report/grader/index.php +++ b/grade/report/grader/index.php @@ -84,7 +84,7 @@ if (has_capability('moodle/grade:edit', $context)) { $string = get_string('turneditingon'); } - $buttons = print_single_button('index.php', $options, $string, 'get', '_self', true); + $buttons = $OUTPUT->button(html_form::make_button('index.php', $options, $string, 'get')); } else { $USER->gradeediting[$course->id] = 0; diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 131029b28f..7a8480bfd9 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -740,7 +740,7 @@ class grade_report_grader extends grade_report { // Student name and link $user_pic = null; if ($showuserimage) { - $user_pic = '
' . print_user_picture($user, $this->courseid, null, 0, true) . '
'; + $user_pic = '
' . $OUTPUT->user_picture(moodle_user_picture::make($user, $this->courseid)) . '
'; } $studentshtml .= '' @@ -1015,7 +1015,7 @@ class grade_report_grader extends grade_report { $user_pic = null; if ($showuserimage) { - $user_pic = '
' . print_user_picture($user, $this->courseid, NULL, 0, true) . "
\n"; + $user_pic = '
' . $OUTPUT->user_picture(moodle_user_picture::make($user, $this->courseid)) . "
\n"; } $studentshtml .= '' @@ -1448,7 +1448,7 @@ class grade_report_grader extends grade_report { return true; } - + /** * Returns whether or not to display fixed students column. * Includes a browser check, because IE6 doesn't support the scrollbar. @@ -1457,13 +1457,13 @@ class grade_report_grader extends grade_report { */ public function is_fixed_students() { global $USER, $CFG; - return empty($USER->screenreader) && $CFG->grade_report_fixedstudents && - (check_browser_version('MSIE', '7.0') || + return empty($USER->screenreader) && $CFG->grade_report_fixedstudents && + (check_browser_version('MSIE', '7.0') || check_browser_version('Firefox', '2.0') || check_browser_version('Gecko', '2006010100') || check_browser_version('Camino', '1.0') || check_browser_version('Opera', '6.0') || - check_browser_version('Safari', '2.0')); + check_browser_version('Safari', '2.0')); } } ?>