Skip to content

Commit

Permalink
MDL-19787 upgraded calls to print_table, print_single_button, print_u…
Browse files Browse the repository at this point in the history
…ser_picture, print_container* and notice_yesno
  • Loading branch information
nicolasconnault committed Aug 20, 2009
1 parent 7755599 commit 414a4a9
Show file tree
Hide file tree
Showing 34 changed files with 103 additions and 93 deletions.
4 changes: 1 addition & 3 deletions admin/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
13 changes: 9 additions & 4 deletions admin/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions admin/enrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
echo "<div>";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />";

$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%');
Expand Down Expand Up @@ -103,7 +103,7 @@
}
asort($table->data);

print_table($table);
echo $OUTPUT->table($table);

echo "<div style=\"text-align:center\"><input type=\"submit\" value=\"".get_string("savechanges")."\" /></div>\n";
echo "</div>";
Expand Down
11 changes: 6 additions & 5 deletions admin/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -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&amp;filterpath=' . $filterpath . '&amp;confirm=1&amp;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;
}
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -217,7 +218,7 @@
$table->rowclasses[] = 'dimmed_text';
}

print_table($table);
echo $OUTPUT->table($table);
echo '<p class="filtersettingnote">' . get_string('filterallwarning', 'filters') . '</p>';
echo $OUTPUT->footer();

Expand Down
3 changes: 1 addition & 2 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@
$copyrightnotice = str_replace('target="_blank"', 'onclick="this.target=\'_blank\'"', $copyrightnotice); // extremely ugly validation hack
echo $OUTPUT->box($copyrightnotice, 'copyrightnotice');
echo '<br />';
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;
}
Expand Down
5 changes: 3 additions & 2 deletions admin/innodb.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
4 changes: 2 additions & 2 deletions admin/langimport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.'&amp;uninstalllang='.$uninstalllang.'&amp;confirm=1&amp;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;
Expand Down
3 changes: 2 additions & 1 deletion admin/mnet/access_control.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
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%";
Expand All @@ -183,7 +184,7 @@
}

if (!empty($table)) {
print_table($table);
echo $OUTPUT->table($table);
echo '<p>&nbsp;</p>';
$baseurl = new moodle_url(null, array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage));
$pagingbar = moodle_paging_bar::make($aclcount, $page, $perpage, $baseurl);
Expand Down
11 changes: 4 additions & 7 deletions admin/mnet/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()."&amp;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
Expand Down
4 changes: 2 additions & 2 deletions admin/mnet/mnet_themes.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
$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 '</td>';
echo "</tr>";

Expand Down Expand Up @@ -116,7 +116,7 @@
$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 '</td>';
echo "</tr>";
}
Expand Down
4 changes: 1 addition & 3 deletions admin/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@
$strmodulename = get_string("modulename", "$delete");

if (!$confirm) {
notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename),
"modules.php?delete=$delete&amp;confirm=1&amp;sesskey=".sesskey(),
"modules.php");
echo $OUTPUT->confirm(get_string("moduledeleteconfirm", "", $strmodulename), "modules.php?delete=$delete&confirm=1", "modules.php");
echo $OUTPUT->footer();
exit;

Expand Down
2 changes: 1 addition & 1 deletion admin/multilangupgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

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;
}
Expand Down
2 changes: 1 addition & 1 deletion admin/portfolio.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
}
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;
}

Expand Down
6 changes: 3 additions & 3 deletions admin/qtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . '&amp;confirm=1&amp;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;
}
Expand Down
4 changes: 2 additions & 2 deletions admin/report/configlog/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
$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%');
Expand Down Expand Up @@ -104,6 +104,6 @@
}
$rs->close();

print_table($table);
echo $OUTPUT->table($table);

echo $OUTPUT->footer();
7 changes: 4 additions & 3 deletions admin/report/courseoverview/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
echo '<form action="index.php" method="post">'."\n";
echo '<div>';

$table = new html_table();
$table->width = '*';
$table->align = array('left','left','left','left','left','left');

Expand All @@ -64,7 +65,7 @@
'<input type="text" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
'<input type="submit" value="'.get_string('view').'" />') ;

print_table($table);
echo $OUTPUT->table($table);
echo '</div>';
echo '</form>';

Expand Down Expand Up @@ -98,7 +99,7 @@
echo '<div class="graph"><img alt="'.get_string('courseoverviewgraph').'" src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
}

$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)) {
Expand All @@ -121,7 +122,7 @@
}
$table->data[] = $a;
}
print_table($table);
echo $OUTPUT->table($table);
}
}
echo $OUTPUT->footer();
Expand Down
4 changes: 2 additions & 2 deletions admin/report/questioninstances/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
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'),
Expand Down Expand Up @@ -124,7 +124,7 @@
$totalhidden);

// Print it.
print_table($table);
echo $OUTPUT->table($table);
}

// Footer.
Expand Down
8 changes: 4 additions & 4 deletions admin/report/security/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
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');
Expand All @@ -92,7 +92,7 @@

$table->data[] = $row;

print_table($table);
echo $OUTPUT->table($table);

echo $OUTPUT->box($result->details, 'generalbox boxwidthnormal boxaligncenter'); // TODO: add proper css

Expand All @@ -101,7 +101,7 @@
} 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');
Expand All @@ -121,7 +121,7 @@

$table->data[] = $row;
}
print_table($table);
echo $OUTPUT->table($table);
}

echo $OUTPUT->footer();
2 changes: 1 addition & 1 deletion admin/repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
}
exit;
}
notice_yesno(get_string('confirmremove', 'repository', $repositorytype->get_readablename()), $sesskeyurl . '&amp;delete=' . $delete . '&amp;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)) {
Expand Down
3 changes: 2 additions & 1 deletion admin/repositoryinstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@
}
exit;
}
notice_yesno(get_string('confirmdelete', 'repository', $instance->name), $sesskeyurl . '&amp;type=' . $type . '&amp;delete=' . $delete . '&amp;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;
}

Expand Down
2 changes: 1 addition & 1 deletion admin/roles/allow.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

echo '<form action="' . $baseurl . '" method="post">';
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
print_table($table);
echo $OUTPUT->table($table);
echo '<div class="buttons"><input type="submit" name="submit" value="'.get_string('savechanges').'"/>';
echo '</div></form>';

Expand Down
13 changes: 7 additions & 6 deletions admin/roles/assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -414,17 +414,18 @@
foreach ($roleusers as $user) {
$strroleusers[] = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '" >' . fullname($user) . '</a>';
}
$rolehodlernames[$roleid] = implode('<br />', $strroleusers);
$roleholdernames[$roleid] = implode('<br />', $strroleusers);
$showroleholders = true;
}
} else if ($assigncounts[$roleid] > MAX_USERS_TO_LIST_PER_ROLE) {
$rolehodlernames[$roleid] = '<a href="'.$baseurl.'&amp;roleid='.$roleid.'">'.$strmorethanmax.'</a>';
$roleholdernames[$roleid] = '<a href="'.$baseurl.'&amp;roleid='.$roleid.'">'.$strmorethanmax.'</a>';
} 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'));
Expand All @@ -441,12 +442,12 @@
$row = array('<a href="'.$baseurl.'&amp;roleid='.$roleid.'">'.$rolename.'</a>',
$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 '<div class="backlink"><a href="' . $url . '">' .
Expand Down
Loading

0 comments on commit 414a4a9

Please sign in to comment.