Skip to content

Commit

Permalink
MDL-9647 simplify dealing with headers/footers in admin sections
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Apr 30, 2007
1 parent 3f7353c commit 1ae083e
Show file tree
Hide file tree
Showing 67 changed files with 286 additions and 362 deletions.
7 changes: 3 additions & 4 deletions admin/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');

$adminroot = admin_get_root();
admin_externalpage_setup('userauthentication', $adminroot);
admin_externalpage_setup('userauthentication');

$action = optional_param('action', '', PARAM_ACTION);
$auth = optional_param('auth', '', PARAM_SAFEDIR);
Expand Down Expand Up @@ -227,7 +226,7 @@
}

// output form
admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();

//print stus messages
if ($status !== '') {
Expand Down Expand Up @@ -298,6 +297,6 @@
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges', 'admin').'" /></div>';
echo '</div>';
echo '</form>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();

?>
7 changes: 3 additions & 4 deletions admin/auth_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
require_once '../config.php';
require_once $CFG->libdir.'/adminlib.php';

$adminroot = admin_get_root();
admin_externalpage_setup('userauthentication', $adminroot);
admin_externalpage_setup('userauthentication');
$auth = required_param('auth', PARAM_SAFEDIR);
$authplugin = get_auth_plugin($auth);
$err = array();
Expand Down Expand Up @@ -59,7 +58,7 @@
asort($options);

// output configuration form
admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();

// choose an authentication method
echo "<form $CFG->frametarget id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
Expand All @@ -80,7 +79,7 @@
echo "</div>\n";
echo "</form>\n";

admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
exit;

/// Functions /////////////////////////////////////////////////////////////////
Expand Down
8 changes: 4 additions & 4 deletions admin/block.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$adminroot = admin_get_root();
admin_externalpage_setup('manageblocks', $adminroot);
require_once($CFG->libdir.'/blocklib.php');

admin_externalpage_setup('manageblocks');

$blockid = required_param('block', PARAM_INT);

if(($blockrecord = blocks_get_record($blockid)) === false) {
Expand Down Expand Up @@ -55,7 +55,7 @@
$CFG->pagepath = 'block/' . $block->name() . '/config';


admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();

print_heading($strblockname);

Expand All @@ -70,6 +70,6 @@
echo '</p>';
$block->config_print();
echo '</form>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();

?>
9 changes: 4 additions & 5 deletions admin/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
require_once($CFG->libdir.'/tablelib.php');
require_once($CFG->libdir.'/ddllib.php');

$adminroot = admin_get_root();
admin_externalpage_setup('manageblocks', $adminroot);
admin_externalpage_setup('manageblocks');

$confirm = optional_param('confirm', 0, PARAM_BOOL);
$hide = optional_param('hide', 0, PARAM_INT);
Expand All @@ -30,7 +29,7 @@
$strmultiple = get_string('blockmultiple', 'admin');
$strshowblockcourse = get_string('showblockcourse');

admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();

print_heading($strmanageblocks);

Expand Down Expand Up @@ -76,7 +75,7 @@
notice_yesno(get_string('blockdeleteconfirm', '', $strblockname),
'blocks.php?delete='.$block->id.'&amp;confirm=1&amp;sesskey='.$USER->sesskey,
'blocks.php');
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
exit;

} else {
Expand Down Expand Up @@ -246,6 +245,6 @@
$table->print_html();
}

admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();

?>
12 changes: 6 additions & 6 deletions admin/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$adminroot = admin_get_root();
admin_externalpage_setup('purgemoodledata', $adminroot);

admin_externalpage_setup('purgemoodledata');

require_login();

Expand All @@ -17,22 +17,22 @@

$deletedir = $CFG->dataroot; // The directory to delete!

admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();
print_heading('Purge moodledata');

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');
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_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');
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
exit;
}

Expand All @@ -46,7 +46,7 @@

echo '<h1 align="center">Done!</h1>';
print_continue($CFG->wwwroot);
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
exit;


Expand Down
7 changes: 3 additions & 4 deletions admin/enrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
$enrol = optional_param('enrol', $CFG->enrol, PARAM_SAFEDIR);
$CFG->pagepath = 'enrol';

$adminroot = admin_get_root();
admin_externalpage_setup('enrolment', $adminroot);
admin_externalpage_setup('enrolment');



Expand Down Expand Up @@ -41,7 +40,7 @@

$str = get_strings(array('enrolmentplugins', 'users', 'administration', 'settings', 'edit'));

admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();

$modules = get_list_of_plugins("enrol");
$options = array();
Expand Down Expand Up @@ -102,6 +101,6 @@
echo "</div>";
echo "</form>";

admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();

?>
7 changes: 3 additions & 4 deletions admin/enrol_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
require_once("../config.php");
require_once($CFG->libdir.'/adminlib.php');

$adminroot = admin_get_root();
admin_externalpage_setup('enrolment', $adminroot);
admin_externalpage_setup('enrolment');

$enrol = required_param('enrol', PARAM_ALPHA);
$CFG->pagepath = 'enrol/' . $enrol;
Expand Down Expand Up @@ -42,7 +41,7 @@
}
asort($options);

admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();

echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
echo "<div>";
Expand All @@ -66,7 +65,7 @@
echo "</div>";
echo "</form>";

admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();

exit;
?>
7 changes: 3 additions & 4 deletions admin/environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
require_once($CFG->libdir.'/environmentlib.php');
require_once($CFG->libdir.'/componentlib.class.php');

$adminroot = admin_get_root();
admin_externalpage_setup('environment', $adminroot);
admin_externalpage_setup('environment');

/// Parameters
$action = optional_param('action', '', PARAM_ACTION);
Expand All @@ -53,7 +52,7 @@
$strmisc = get_string('miscellaneous');

/// Print the header stuff
admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();

/// Print the component download link
echo '<div class="reportlink"><a href="environment.php?action=updatecomponent&amp;sesskey='.$USER->sesskey.'">'.$strupdate.'</a></div>';
Expand Down Expand Up @@ -133,5 +132,5 @@
$status = check_moodle_environment($version, $environment_results);

/// Print footer
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>
7 changes: 3 additions & 4 deletions admin/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');

$adminroot = admin_get_root();
admin_externalpage_setup('managefilters', $adminroot);
admin_externalpage_setup('managefilters');

// get parameters
$param = new Object;
Expand Down Expand Up @@ -71,7 +70,7 @@
//==============================

$filtername = ucfirst($filtername);
admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();
print_heading( $filtername );

print_simple_box(get_string("configwarning", "admin"), "center", "50%");
Expand All @@ -94,5 +93,5 @@
<?php
print_simple_box_end();

admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>
7 changes: 3 additions & 4 deletions admin/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
// defines
define('FILTER_TABLE','filter_administration_table');

$adminroot = admin_get_root();
admin_externalpage_setup('managefilters', $adminroot);
admin_externalpage_setup('managefilters');

// get values from page
$params = new object();
Expand Down Expand Up @@ -263,7 +262,7 @@
// Display logic
//==============================

admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();

print_heading_with_help($txt->managefilters, 'filters');

Expand All @@ -272,6 +271,6 @@

// cache control table has been removed

admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();

?>
8 changes: 4 additions & 4 deletions admin/health.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
}

require_once($CFG->libdir.'/adminlib.php');
$adminroot = admin_get_root();
admin_externalpage_setup('healthcenter', $adminroot);

admin_externalpage_setup('healthcenter');

define('SEVERITY_NOTICE', 'notice');
define('SEVERITY_ANNOYANCE', 'annoyance');
Expand All @@ -28,7 +28,7 @@

$site = get_site();

admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();

echo <<<STYLES
<style type="text/css">
Expand Down Expand Up @@ -100,7 +100,7 @@
}


admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();


function health_find_problems() {
Expand Down
6 changes: 3 additions & 3 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,8 @@

/// Print default admin page with notifications.

admin_externalpage_setup('adminnotifications', $adminroot);
admin_externalpage_print_header($adminroot);
admin_externalpage_setup('adminnotifications');
admin_externalpage_print_header();

/// Deprecated database! Warning!!
if (!empty($CFG->migrated_to_new_db)) {
Expand Down Expand Up @@ -624,7 +624,7 @@
}


admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();


?>
10 changes: 5 additions & 5 deletions admin/innodb.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$adminroot = admin_get_root();
admin_externalpage_setup('toinodb', $adminroot);

admin_externalpage_setup('toinodb');

$confirm = optional_param('confirm', 0, PARAM_BOOL);

require_login();

require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));

admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();
print_heading('Convert all MySQL tables from MYISAM to InnoDB');

if ($CFG->dbfamily != 'mysql') {
Expand All @@ -31,13 +31,13 @@
}
notify('... done.', 'notifysuccess');
print_continue('index.php');
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();

} 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');
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
}

?>
Loading

0 comments on commit 1ae083e

Please sign in to comment.