From 414a4a91b1d676c74a9d71ea65d243a3f8511ba9 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Thu, 20 Aug 2009 08:39:07 +0000 Subject: [PATCH] MDL-19787 upgraded calls to print_table, print_single_button, print_user_picture, print_container* and notice_yesno --- admin/blocks.php | 4 +--- admin/delete.php | 13 +++++++++---- admin/enrol.php | 4 ++-- admin/filters.php | 11 ++++++----- admin/index.php | 3 +-- admin/innodb.php | 5 +++-- admin/langimport.php | 4 ++-- admin/mnet/access_control.php | 3 ++- admin/mnet/index.php | 11 ++++------- admin/mnet/mnet_themes.html | 4 ++-- admin/modules.php | 4 +--- admin/multilangupgrade.php | 2 +- admin/portfolio.php | 2 +- admin/qtypes.php | 6 +++--- admin/report/configlog/index.php | 4 ++-- admin/report/courseoverview/index.php | 7 ++++--- admin/report/questioninstances/index.php | 4 ++-- admin/report/security/index.php | 8 ++++---- admin/repository.php | 2 +- admin/repositoryinstance.php | 3 ++- admin/roles/allow.php | 2 +- admin/roles/assign.php | 13 +++++++------ admin/roles/define.php | 14 +++++++------- admin/roles/lib.php | 2 +- admin/roles/manage.php | 19 ++++++++++++------- admin/roles/override.php | 3 ++- admin/settings.php | 2 +- admin/timezoneimport.php | 2 +- admin/user.php | 6 ++++-- admin/user/user_bulk_confirm.php | 7 +++---- admin/user/user_bulk_delete.php | 7 +++---- admin/user/user_bulk_display.php | 3 ++- admin/user/user_bulk_enrol.php | 3 ++- admin/user/user_bulk_message.php | 9 ++++----- 34 files changed, 103 insertions(+), 93 deletions(-) diff --git a/admin/blocks.php b/admin/blocks.php index 3815328a97..f6acc1a44b 100644 --- a/admin/blocks.php +++ b/admin/blocks.php @@ -57,9 +57,7 @@ } if (!$confirm) { - notice_yesno(get_string('blockdeleteconfirm', '', $strblockname), - 'blocks.php?delete='.$block->id.'&confirm=1&sesskey='.sesskey(), - 'blocks.php'); + echo $OUTPUT->confirm(get_string('blockdeleteconfirm', '', $strblockname), 'blocks.php?delete='.$block->id.'&confirm=1', 'blocks.php'); echo $OUTPUT->footer(); exit; diff --git a/admin/delete.php b/admin/delete.php index 7855e75939..215c766172 100644 --- a/admin/delete.php +++ b/admin/delete.php @@ -22,16 +22,21 @@ if (empty($sure)) { $optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey()); - notice_yesno ('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?', - 'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get'); + + $formcontinue = html_form::make_button('delete.php', $optionsyes, get_string('yes')); + $formcancel = html_form::make_button('index.php', null, get_string('no'), 'get'); + echo $OUTPUT->confirm('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?', $formcontinue, $formcancel); echo $OUTPUT->footer(); exit; } if (!data_submitted() or empty($reallysure)) { $optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey(), 'reallysure'=>'yes'); - notice_yesno ('Are you REALLY REALLY completely sure you want to delete everything inside the directory '. $deletedir .' (this includes all user images, and any other course files that have been created) ?', - 'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get'); + $formcontinue = html_form::make_button('delete.php', $optionsyes, get_string('yes')); + $formcancel = html_form::make_button('index.php', null, get_string('no'), 'get'); + echo $OUTPUT->confirm('Are you REALLY REALLY completely sure you want to delete everything inside the directory '. + $deletedir .' (this includes all user images, and any other course files that have been created) ?', + $formcontinue, $formcancel); echo $OUTPUT->footer(); exit; } diff --git a/admin/enrol.php b/admin/enrol.php index 598b0cb7e0..4eafca5010 100644 --- a/admin/enrol.php +++ b/admin/enrol.php @@ -64,7 +64,7 @@ echo "
"; echo ""; - $table = new stdClass(); + $table = new html_table(); $table->head = array(get_string('name'), get_string('enable'), get_string('default'), $str->settings); $table->align = array('left', 'center', 'center', 'center'); $table->size = array('60%', '', '', '15%'); @@ -103,7 +103,7 @@ } asort($table->data); - print_table($table); + echo $OUTPUT->table($table); echo "
\n"; echo "
"; diff --git a/admin/filters.php b/admin/filters.php index daafb9cca3..3726674bb0 100644 --- a/admin/filters.php +++ b/admin/filters.php @@ -120,9 +120,10 @@ $title = get_string('deletefilterareyousure', 'admin', $filtername); admin_externalpage_print_header(); echo $OUTPUT->heading($title); - notice_yesno(get_string('deletefilterareyousuremessage', 'admin', $filtername), $returnurl . - '?action=delete&filterpath=' . $filterpath . '&confirm=1&sesskey=' . sesskey(), - $returnurl, NULL, NULL, 'post', 'get'); + + $linkcontinue = new moodle_url($returnurl, array('action' => 'delete', 'filterpath' => $filterpath, 'confirm' => 1)); + $formcancel = html_form::make_button($returnurl, null, get_string('no'), 'get'); + echo $OUTPUT->confirm(get_string('deletefilterareyousuremessage', 'admin', $filtername), $linkcontinue, $formcancel); echo $OUTPUT->footer(); exit; } @@ -181,7 +182,7 @@ } $stringfilters = filter_get_string_filters(); - $table = new object(); + $table = new html_table(); $table->head = array(get_string('filter'), get_string('isactive', 'filters'), get_string('order'), get_string('applyto', 'filters'), get_string('settings'), get_string('delete')); $table->align = array('left', 'left', 'center', 'left', 'left'); @@ -217,7 +218,7 @@ $table->rowclasses[] = 'dimmed_text'; } - print_table($table); + echo $OUTPUT->table($table); echo '

' . get_string('filterallwarning', 'filters') . '

'; echo $OUTPUT->footer(); diff --git a/admin/index.php b/admin/index.php index 5287a39abe..1b5be55960 100644 --- a/admin/index.php +++ b/admin/index.php @@ -127,8 +127,7 @@ if (!core_tables_exist()) { $copyrightnotice = str_replace('target="_blank"', 'onclick="this.target=\'_blank\'"', $copyrightnotice); // extremely ugly validation hack echo $OUTPUT->box($copyrightnotice, 'copyrightnotice'); echo '
'; - notice_yesno(get_string('doyouagree'), "index.php?agreelicense=1&lang=$CFG->lang", - "http://docs.moodle.org/en/License"); + echo $OUTPUT->confirm(get_string('doyouagree'), "index.php?agreelicense=1&lang=$CFG->lang", "http://docs.moodle.org/en/License"); echo $OUTPUT->footer(); die; } diff --git a/admin/innodb.php b/admin/innodb.php index cee3236935..a504f83c9f 100644 --- a/admin/innodb.php +++ b/admin/innodb.php @@ -36,8 +36,9 @@ } else { $optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey()); - notice_yesno('Are you sure you want convert all your tables to the InnoDB format?', - 'innodb.php', 'index.php', $optionsyes, NULL, 'post', 'get'); + $formcontinue = html_form::make_button('innodb.php', $optionsyes, get_string('yes')); + $formcancel = html_form::make_button('index.php', null, get_string('no'), 'get'); + echo $OUTPUT->confirm('Are you sure you want convert all your tables to the InnoDB format?', $formcontinue, $formcancel); echo $OUTPUT->footer(); } diff --git a/admin/langimport.php b/admin/langimport.php index 15f5717c32..34aaad421f 100755 --- a/admin/langimport.php +++ b/admin/langimport.php @@ -104,8 +104,8 @@ } else if (!$confirm && confirm_sesskey()) { admin_externalpage_print_header(); - notice_yesno(get_string('uninstallconfirm', 'admin', $uninstalllang), - 'langimport.php?mode='.DELETION_OF_SELECTED_LANG.'&uninstalllang='.$uninstalllang.'&confirm=1&sesskey='.sesskey(), + echo $OUTPUT->confirm(get_string('uninstallconfirm', 'admin', $uninstalllang), + 'langimport.php?mode='.DELETION_OF_SELECTED_LANG.'&uninstalllang='.$uninstalllang.'&confirm=1', 'langimport.php'); echo $OUTPUT->footer(); die; diff --git a/admin/mnet/access_control.php b/admin/mnet/access_control.php index f6c0006ead..2d7876ad58 100644 --- a/admin/mnet/access_control.php +++ b/admin/mnet/access_control.php @@ -163,6 +163,7 @@ if (!$acl) { echo $OUTPUT->heading(get_string('noaclentries','mnet')); $table = NULL; } else { + $table = new html_table(); $table->head = $headings; $table->align = array('left', 'left', 'center'); $table->width = "95%"; @@ -183,7 +184,7 @@ if (!$acl) { } if (!empty($table)) { - print_table($table); + echo $OUTPUT->table($table); echo '

 

'; $baseurl = new moodle_url(null, array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage)); $pagingbar = moodle_paging_bar::make($aclcount, $page, $perpage, $baseurl); diff --git a/admin/mnet/index.php b/admin/mnet/index.php index 105e7fee76..beda619e34 100644 --- a/admin/mnet/index.php +++ b/admin/mnet/index.php @@ -49,13 +49,10 @@ } elseif (!empty($form->submit) && $form->submit == get_string('delete')) { $MNET->get_private_key(); $SESSION->mnet_confirm_delete_key = md5(sha1($MNET->keypair['keypair_PEM'])).':'.time(); - notice_yesno(get_string("deletekeycheck", "mnet"), - "index.php?sesskey=".sesskey()."&confirm=".md5($MNET->public_key), - "index.php", - array('sesskey' => sesskey()), - NULL, - 'post', - 'get'); + + $formcontinue = html_form::make_button('index.php', array('confirm' => md5($MNET->public_key)), get_string('yes')); + $formcancel = html_form::make_button('index.php', null, get_string('no'), 'get'); + echo $OUTPUT->confirm(get_string("deletekeycheck", "mnet"), $formcontinue, $formcancel); exit; } else { // We're deleting diff --git a/admin/mnet/mnet_themes.html b/admin/mnet/mnet_themes.html index 0fbe99e902..67de832256 100644 --- a/admin/mnet/mnet_themes.html +++ b/admin/mnet/mnet_themes.html @@ -47,7 +47,7 @@ print_tabs(array($tabs), 'mnetthemes'); $options['choose'] = $unlikely_name;// Something unlikely to ever be a theme name... initially $unlikely_name = 'ZoqZoqZ'; $options['sesskey'] = $sesskey; $options['hostid'] = $mnet_peer->id; - print_single_button('mnet_themes.php', $options, $strchoose); + echo $OUTPUT->button(html_form::make_button('mnet_themes.php', $options, $strchoose)); echo ''; echo ""; @@ -116,7 +116,7 @@ print_tabs(array($tabs), 'mnetthemes'); $options['choose'] = $theme; $options['sesskey'] = $sesskey; $options['hostid'] = $mnet_peer->id; - print_single_button('mnet_themes.php', $options, $strchoose); + echo $OUTPUT->button(html_form::make_button('mnet_themes.php', $options, $strchoose)); echo ''; echo ""; } diff --git a/admin/modules.php b/admin/modules.php index 6bbbdbdf43..a8938c16ac 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -77,9 +77,7 @@ $strmodulename = get_string("modulename", "$delete"); if (!$confirm) { - notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename), - "modules.php?delete=$delete&confirm=1&sesskey=".sesskey(), - "modules.php"); + echo $OUTPUT->confirm(get_string("moduledeleteconfirm", "", $strmodulename), "modules.php?delete=$delete&confirm=1", "modules.php"); echo $OUTPUT->footer(); exit; diff --git a/admin/multilangupgrade.php b/admin/multilangupgrade.php index 22e7860600..801c8b0585 100644 --- a/admin/multilangupgrade.php +++ b/admin/multilangupgrade.php @@ -18,7 +18,7 @@ $strmultilangupgrade = get_String('multilangupgradeinfo', 'admin'); if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form $optionsyes = array('go'=>1, 'sesskey'=>sesskey()); - notice_yesno($strmultilangupgrade, 'multilangupgrade.php', 'index.php', $optionsyes, null, 'post', 'get'); + echo $OUTPUT->confirm($strmultilangupgrade, new moodle_url('multilangupgrade.php', $optionsyes), 'index.php'); echo $OUTPUT->footer(); die; } diff --git a/admin/portfolio.php b/admin/portfolio.php index fbba7452f2..3dcdc2ef1d 100644 --- a/admin/portfolio.php +++ b/admin/portfolio.php @@ -101,7 +101,7 @@ if (!empty($edit) || !empty($new)) { } exit; } - notice_yesno(get_string('sure', 'portfolio', $instance->get('name')), $sesskeyurl . '&delete=' . $delete . '&sure=yes', $baseurl); + echo $OUTPUT->confirm(get_string('sure', 'portfolio', $instance->get('name')), $sesskeyurl . '&delete=' . $delete . '&sure=yes', $baseurl); $return = false; } diff --git a/admin/qtypes.php b/admin/qtypes.php index fb5cb7f24c..4e2ff79848 100644 --- a/admin/qtypes.php +++ b/admin/qtypes.php @@ -122,9 +122,9 @@ $qtypename = $QTYPES[$delete]->local_name(); admin_externalpage_print_header(); echo $OUTPUT->heading(get_string('deleteqtypeareyousure', 'admin', $qtypename)); - notice_yesno(get_string('deleteqtypeareyousuremessage', 'admin', $qtypename), - admin_url('qtypes.php?delete=' . $delete . '&confirm=1&sesskey=' . sesskey()), - admin_url('qtypes.php'), NULL, NULL, 'post', 'get'); + echo $OUTPUT->confirm(get_string('deleteqtypeareyousuremessage', 'admin', $qtypename), + admin_url('qtypes.php?delete=' . $delete . '&confirm=1'), + admin_url('qtypes.php')); echo $OUTPUT->footer(); exit; } diff --git a/admin/report/configlog/index.php b/admin/report/configlog/index.php index 869644400c..46fe4df471 100644 --- a/admin/report/configlog/index.php +++ b/admin/report/configlog/index.php @@ -67,7 +67,7 @@ if (($CFG->fullnamedisplay == 'firstname lastname') or $fullnamedisplay = $hcolumns['lastname'].' / '.$hcolumns['firstname']; } -$table = new object(); +$table = new html_table(); $table->head = array($hcolumns['timemodified'], $fullnamedisplay, $hcolumns['plugin'], $hcolumns['name'], $hcolumns['value'], $hcolumns['oldvalue']); $table->align = array('left', 'left', 'left', 'left', 'left', 'left'); $table->size = array('30%', '10%', '10%', '10%', '20%', '20%'); @@ -104,6 +104,6 @@ foreach ($rs as $log) { } $rs->close(); -print_table($table); +echo $OUTPUT->table($table); echo $OUTPUT->footer(); diff --git a/admin/report/courseoverview/index.php b/admin/report/courseoverview/index.php index 54dbae9fb7..3f1a72961a 100644 --- a/admin/report/courseoverview/index.php +++ b/admin/report/courseoverview/index.php @@ -48,6 +48,7 @@ echo '
'."\n"; echo '
'; + $table = new html_table(); $table->width = '*'; $table->align = array('left','left','left','left','left','left'); @@ -64,7 +65,7 @@ '', '') ; - print_table($table); + echo $OUTPUT->table($table); echo '
'; echo '
'; @@ -98,7 +99,7 @@ echo '
'.get_string('courseoverviewgraph').'
'; } - $table = new StdClass; + $table = new html_table(); $table->align = array('left','center','center','center'); $table->head = array(get_string('course'),$param->line1); if (!empty($param->line2)) { @@ -121,7 +122,7 @@ } $table->data[] = $a; } - print_table($table); + echo $OUTPUT->table($table); } } echo $OUTPUT->footer(); diff --git a/admin/report/questioninstances/index.php b/admin/report/questioninstances/index.php index d097cbabc6..d892c54cf6 100644 --- a/admin/report/questioninstances/index.php +++ b/admin/report/questioninstances/index.php @@ -78,7 +78,7 @@ if ($requestedqtype) { echo $OUTPUT->heading($title); // Initialise the table. - $table = new stdClass; + $table = new html_table(); $table->head = array( get_string('context', 'role'), get_string('totalquestions', 'report_questioninstances'), @@ -124,7 +124,7 @@ if ($requestedqtype) { $totalhidden); // Print it. - print_table($table); + echo $OUTPUT->table($table); } // Footer. diff --git a/admin/report/security/index.php b/admin/report/security/index.php index 18a5e34048..c5129592bc 100644 --- a/admin/report/security/index.php +++ b/admin/report/security/index.php @@ -74,7 +74,7 @@ $url = "$CFG->wwwroot/$CFG->admin/report/security/index.php"; if ($issue and ($result = $issue(true))) { report_security_hide_timearning(); - $table = new object(); + $table = new html_table(); $table->head = array($strissue, $strstatus, $strdesc, $strconfig); $table->size = array('30%', '10%', '50%', '10%' ); $table->align = array('left', 'left', 'left', 'left'); @@ -92,7 +92,7 @@ if ($issue and ($result = $issue(true))) { $table->data[] = $row; - print_table($table); + echo $OUTPUT->table($table); echo $OUTPUT->box($result->details, 'generalbox boxwidthnormal boxaligncenter'); // TODO: add proper css @@ -101,7 +101,7 @@ if ($issue and ($result = $issue(true))) { } else { report_security_hide_timearning(); - $table = new object(); + $table = new html_table(); $table->head = array($strissue, $strstatus, $strdesc); $table->size = array('30%', '10%', '60%' ); $table->align = array('left', 'left', 'left'); @@ -121,7 +121,7 @@ if ($issue and ($result = $issue(true))) { $table->data[] = $row; } - print_table($table); + echo $OUTPUT->table($table); } echo $OUTPUT->footer(); diff --git a/admin/repository.php b/admin/repository.php index 4a2c507d2a..b26d89d1f0 100644 --- a/admin/repository.php +++ b/admin/repository.php @@ -156,7 +156,7 @@ if (!empty($edit) || !empty($new)) { } exit; } - notice_yesno(get_string('confirmremove', 'repository', $repositorytype->get_readablename()), $sesskeyurl . '&delete=' . $delete . '&sure=yes', $baseurl); + echo $OUTPUT->confirm(get_string('confirmremove', 'repository', $repositorytype->get_readablename()), $sesskeyurl . '&delete=' . $delete . '&sure=yes', $baseurl); $return = false; } else if (!empty($move) && !empty($type)) { diff --git a/admin/repositoryinstance.php b/admin/repositoryinstance.php index c83cac1a8f..a2c694e0c9 100644 --- a/admin/repositoryinstance.php +++ b/admin/repositoryinstance.php @@ -122,7 +122,8 @@ if (!empty($edit) || !empty($new)) { } exit; } - notice_yesno(get_string('confirmdelete', 'repository', $instance->name), $sesskeyurl . '&type=' . $type . '&delete=' . $delete . '&sure=yes', "$CFG->wwwroot/$CFG->admin/repositoryinstance.php?session=". sesskey()); + + echo $OUTPUT->confirm(get_string('confirmdelete', 'repository', $instance->name), "$sesskeyurl&type=$type'&delete=$delete'&sure=yes", "$CFG->wwwroot/$CFG->admin/repositoryinstance.php?session=". sesskey()); $return = false; } diff --git a/admin/roles/allow.php b/admin/roles/allow.php index c0b6f3dab5..1acdee1e87 100755 --- a/admin/roles/allow.php +++ b/admin/roles/allow.php @@ -76,7 +76,7 @@ echo '
'; echo ''; - print_table($table); + echo $OUTPUT->table($table); echo '
'; echo '
'; diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 6ffa560bec..ae035c8c21 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -402,7 +402,7 @@ // Get the names of role holders for roles with between 1 and MAX_USERS_TO_LIST_PER_ROLE users, // and so determine whether to show the extra column. - $rolehodlernames = array(); + $roleholdernames = array(); $strmorethanmax = get_string('morethan', 'role', MAX_USERS_TO_LIST_PER_ROLE); $showroleholders = false; foreach ($assignableroles as $roleid => $notused) { @@ -414,17 +414,18 @@ foreach ($roleusers as $user) { $strroleusers[] = '' . fullname($user) . ''; } - $rolehodlernames[$roleid] = implode('
', $strroleusers); + $roleholdernames[$roleid] = implode('
', $strroleusers); $showroleholders = true; } } else if ($assigncounts[$roleid] > MAX_USERS_TO_LIST_PER_ROLE) { - $rolehodlernames[$roleid] = ''.$strmorethanmax.''; + $roleholdernames[$roleid] = ''.$strmorethanmax.''; } else { - $rolehodlernames[$roleid] = ''; + $roleholdernames[$roleid] = ''; } } // Print overview table + $table = new html_table(); $table->tablealign = 'center'; $table->width = '60%'; $table->head = array(get_string('role'), get_string('description'), get_string('userswiththisrole', 'role')); @@ -441,12 +442,12 @@ $row = array(''.$rolename.'', $description, $assigncounts[$roleid]); if ($showroleholders) { - $row[] = $rolehodlernames[$roleid]; + $row[] = $roleholdernames[$roleid]; } $table->data[] = $row; } - print_table($table); + echo $OUTPUT->table($table); if (!$isfrontpage && ($url = get_context_url($context))) { echo '