Admin page cleanup (Google soc 2006)
This commit is contained in:
+1243
File diff suppressed because it is too large
Load Diff
+13
-17
@@ -3,21 +3,12 @@
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('userauthentication');
|
||||
|
||||
$auth = optional_param('auth', '', PARAM_SAFEDIR);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!$site = get_site()) {
|
||||
redirect("index.php");
|
||||
}
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only the admin can use this page");
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
$focus = '';
|
||||
|
||||
@@ -25,6 +16,10 @@
|
||||
|
||||
if ($config = data_submitted()) {
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
$config = (array)$config;
|
||||
|
||||
// extract and sanitize the auth key explicitly
|
||||
@@ -126,17 +121,18 @@
|
||||
$strsettings = get_string("settings");
|
||||
$strusers = get_string("users");
|
||||
|
||||
print_header("$site->shortname: $strauthenticationoptions", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> <a href=\"users.php\">$strusers</a> -> $strauthenticationoptions", "$focus");
|
||||
admin_externalpage_print_header();
|
||||
|
||||
echo "<center><b>";
|
||||
echo "<form target=\"{$CFG->framename}\" name=\"authmenu\" method=\"post\" action=\"auth.php\">";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />";
|
||||
print_string("chooseauthmethod","auth");
|
||||
|
||||
echo ' ';
|
||||
|
||||
choose_from_menu ($options, "auth", $auth, "","document.location='auth.php?sesskey=$USER->sesskey&auth='+document.authmenu.auth.options[document.authmenu.auth.selectedIndex].value", "");
|
||||
|
||||
echo "</b></center>";
|
||||
echo "</b></center><br />";
|
||||
|
||||
print_simple_box_start("center", "100%");
|
||||
print_heading($options[$auth]);
|
||||
@@ -235,7 +231,7 @@
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
exit;
|
||||
|
||||
/// Functions /////////////////////////////////////////////////////////////////
|
||||
|
||||
+5
-14
@@ -3,17 +3,10 @@
|
||||
// block.php - allows admin to edit all local configuration variables for a block
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
admin_externalpage_setup('blockmanagement');
|
||||
require_once($CFG->libdir.'/blocklib.php');
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error('Only an admin can use this page');
|
||||
}
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
$blockid = required_param('block', PARAM_INT);
|
||||
|
||||
if(($blockrecord = blocks_get_record($blockid)) === false) {
|
||||
@@ -62,10 +55,8 @@
|
||||
// of the page. It is also used to generate the link to the Moodle Docs for this view.
|
||||
$CFG->pagepath = 'block/' . $block->name() . '/config';
|
||||
|
||||
print_header($site->shortname.': '.$strblockname.": $strconfiguration", $site->fullname,
|
||||
"<a href=\"index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"blocks.php\">$strmanageblocks</a> -> ".$strblockname);
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
print_heading($strblockname);
|
||||
|
||||
@@ -80,6 +71,6 @@
|
||||
echo '</p>';
|
||||
$block->config_print();
|
||||
echo '</form>';
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
?>
|
||||
|
||||
+5
-15
@@ -3,6 +3,8 @@
|
||||
// Allows the admin to configure blocks (hide/show, delete and configure)
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
admin_externalpage_setup('blockmanagement');
|
||||
require_once($CFG->libdir.'/blocklib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
@@ -12,16 +14,6 @@
|
||||
$delete = optional_param('delete', 0, PARAM_INT);
|
||||
$multiple = optional_param('multiple', 0, PARAM_INT);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only administrators can use this page!");
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
|
||||
/// Print headings
|
||||
|
||||
@@ -37,9 +29,7 @@
|
||||
$strname = get_string('name');
|
||||
$strmultiple = get_string('blockmultiple', 'admin');
|
||||
|
||||
print_header("$site->shortname: $strmanageblocks", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> $strmanageblocks");
|
||||
admin_externalpage_print_header();
|
||||
|
||||
print_heading($strmanageblocks);
|
||||
|
||||
@@ -85,7 +75,7 @@
|
||||
notice_yesno(get_string('blockdeleteconfirm', '', $strblockname),
|
||||
'blocks.php?delete='.$block->id.'&confirm=1&sesskey='.$USER->sesskey,
|
||||
'blocks.php');
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
exit;
|
||||
|
||||
} else {
|
||||
@@ -241,6 +231,6 @@
|
||||
$table->print_html();
|
||||
}
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
?>
|
||||
|
||||
+9
-17
@@ -3,29 +3,23 @@
|
||||
// Yes, enrol is correct English spelling.
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
|
||||
$enrol = optional_param('enrol', $CFG->enrol, PARAM_SAFEDIR);
|
||||
$CFG->pagepath = 'enrol';
|
||||
|
||||
require_login();
|
||||
admin_externalpage_setup('enrolment');
|
||||
|
||||
if (!$site = get_site()) {
|
||||
redirect("index.php");
|
||||
}
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only the admin can use this page");
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
|
||||
|
||||
/// Save settings
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
if (empty($frm->enable)) {
|
||||
$frm->enable = array();
|
||||
}
|
||||
@@ -39,16 +33,14 @@
|
||||
$frm->enable = array_merge(array('manual'), $frm->enable); // make sure manual plugin is called first
|
||||
set_config('enrol_plugins_enabled', implode(',', $frm->enable));
|
||||
set_config('enrol', $frm->default);
|
||||
redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
|
||||
redirect("enrol.php", get_string("changessaved"), 1);
|
||||
}
|
||||
|
||||
/// Print the form
|
||||
|
||||
$str = get_strings(array('enrolmentplugins', 'users', 'administration', 'settings', 'edit'));
|
||||
|
||||
print_header("$site->shortname: $str->enrolmentplugins", "$site->fullname",
|
||||
"<a href=\"index.php\">$str->administration</a> ->
|
||||
<a href=\"users.php\">$str->users</a> -> $str->enrolmentplugins");
|
||||
admin_externalpage_print_header();
|
||||
|
||||
$modules = get_list_of_plugins("enrol");
|
||||
$options = array();
|
||||
@@ -97,7 +89,7 @@
|
||||
$default = '';
|
||||
}
|
||||
$table->data[$name] = array($name, $enable, $default,
|
||||
'<a href="enrol_config.php?sesskey='.$USER->sesskey.'&enrol='.$module.'">'.$str->edit.'</a>');
|
||||
'<a href="enrol_config.php?enrol='.$module.'">'.$str->edit.'</a>');
|
||||
}
|
||||
asort($table->data);
|
||||
|
||||
@@ -106,6 +98,6 @@
|
||||
echo "<center><input type=\"submit\" value=\"".get_string("savechanges")."\"></center>\n";
|
||||
echo "</form>";
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
?>
|
||||
+10
-20
@@ -3,23 +3,13 @@
|
||||
// Yes, enrol is correct English spelling.
|
||||
|
||||
require_once("../config.php");
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('enrolment');
|
||||
|
||||
$enrol = required_param('enrol', PARAM_ALPHA);
|
||||
$CFG->pagepath = 'enrol/' . $enrol;
|
||||
|
||||
require_login();
|
||||
|
||||
if (!$site = get_site()) {
|
||||
redirect("index.php");
|
||||
}
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only the admin can use this page");
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
|
||||
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
|
||||
|
||||
@@ -28,6 +18,9 @@
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
if ($enrolment->process_config($frm)) {
|
||||
redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
|
||||
}
|
||||
@@ -40,6 +33,7 @@
|
||||
/// get language strings
|
||||
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
|
||||
|
||||
unset($options);
|
||||
|
||||
$modules = get_list_of_plugins("enrol");
|
||||
foreach ($modules as $module) {
|
||||
@@ -47,11 +41,7 @@
|
||||
}
|
||||
asort($options);
|
||||
|
||||
print_header("$site->shortname: $str->enrolmentplugins", "$site->fullname",
|
||||
"<a href=\"index.php\">$str->administration</a> ->
|
||||
<a href=\"users.php\">$str->users</a> ->
|
||||
<a href=\"enrol.php?sesskey=$USER->sesskey\">$str->enrolmentplugins</a> ->
|
||||
$str->configuration");
|
||||
admin_externalpage_print_header();
|
||||
|
||||
echo "<form target=\"{$CFG->framename}\" name=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\">";
|
||||
@@ -61,7 +51,7 @@
|
||||
/// Choose an enrolment method
|
||||
echo get_string('chooseenrolmethod').': ';
|
||||
choose_from_menu ($options, "enrol", $enrol, "",
|
||||
"document.location='enrol_config.php?sesskey=$USER->sesskey&enrol='+document.enrolmenu.enrol.options[document.enrolmenu.enrol.selectedIndex].value", "");
|
||||
"document.location='enrol_config.php?enrol='+document.enrolmenu.enrol.options[document.enrolmenu.enrol.selectedIndex].value", "");
|
||||
|
||||
echo "</b></p></div>";
|
||||
|
||||
@@ -82,7 +72,7 @@
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
exit;
|
||||
?>
|
||||
|
||||
+4
-14
@@ -30,24 +30,16 @@
|
||||
// from moodle.org be able to check more and more versions.
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
require_once($CFG->libdir.'/componentlib.class.php');
|
||||
|
||||
admin_externalpage_setup('environment');
|
||||
|
||||
/// Parameters
|
||||
$action = optional_param('action', '', PARAM_ACTION);
|
||||
$version = optional_param('version', '', PARAM_FILE); //
|
||||
|
||||
/// Security checks
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error('You need to be admin to use this page');
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
/// Get some strings
|
||||
$stradmin = get_string('administration');
|
||||
@@ -60,9 +52,7 @@
|
||||
$strmisc = get_string('miscellaneous');
|
||||
|
||||
/// Print the header stuff
|
||||
print_header("$SITE->shortname: $strenvironment", $SITE->fullname,
|
||||
"<a href=\"index.php\">$stradmin</a> -> <a href=\"misc.php\">$strmisc</a> -> "
|
||||
.$strenvironment);
|
||||
admin_externalpage_print_header();
|
||||
|
||||
/// Print the component download link
|
||||
echo '<div class="reportlink"><a href="environment.php?action=updatecomponent&sesskey='.$USER->sesskey.'">'.$strupdate.'</a></div>';
|
||||
@@ -147,5 +137,5 @@
|
||||
echo '</div>';
|
||||
|
||||
/// Print footer
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
|
||||
+5
-14
@@ -3,16 +3,10 @@
|
||||
// Edit text filter settings
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
// check for allowed access
|
||||
require_login();
|
||||
if (!isadmin()) {
|
||||
error( 'Only administrators can use the filters administration page' );
|
||||
}
|
||||
if (!$site = get_site()) {
|
||||
error( 'Site is not defined in filters administration page' );
|
||||
}
|
||||
admin_externalpage_setup('filtermanagement');
|
||||
|
||||
// get parameters
|
||||
$param = new Object;
|
||||
@@ -76,11 +70,8 @@
|
||||
//==============================
|
||||
|
||||
$filtername = ucfirst($filtername);
|
||||
print_header( "$site->shortname: $txt->managefilters", "$site->fullname",
|
||||
"<a href=\"index.php\">$txt->administration</a> -> <a href=\"configure.php\">$txt->configuration</a> " .
|
||||
"-> <a href=\"filters.php\">$txt->managefilters</a> -> $filtername" );
|
||||
|
||||
print_heading( $txt->managefilters );
|
||||
admin_externalpage_print_header();
|
||||
print_heading( $filtername );
|
||||
|
||||
print_simple_box("<center>".get_string("configwarning", "admin")."</center>", "center", "50%");
|
||||
echo "<br />";
|
||||
@@ -104,5 +95,5 @@
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
|
||||
+5
-58
@@ -3,20 +3,13 @@
|
||||
// Edit list of available text filters
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
// defines
|
||||
define('FILTER_TABLE','filter_administration_table');
|
||||
|
||||
// check for allowed access
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error('Only administrators can use the filters administration page');
|
||||
}
|
||||
if (!$site = get_site()) {
|
||||
error('Site is not defined in filters administration page');
|
||||
}
|
||||
admin_externalpage_setup('filtermanagement');
|
||||
|
||||
// get values from page
|
||||
$params = new object();
|
||||
@@ -274,61 +267,15 @@
|
||||
// Display logic
|
||||
//==============================
|
||||
|
||||
print_header("$site->shortname: $txt->managefilters", "$site->fullname",
|
||||
"<a href=\"index.php\">$txt->administration</a> -> <a href=\"configure.php\">$txt->configuration</a> " .
|
||||
"-> $txt->managefilters");
|
||||
admin_externalpage_print_header();
|
||||
|
||||
print_heading_with_help($txt->managefilters, 'filters');
|
||||
|
||||
// print the table of all the filters
|
||||
$table->print_html();
|
||||
|
||||
// print the table for the cache controls
|
||||
print_heading($txt->cachecontrols);
|
||||
print_simple_box_start('center');
|
||||
?>
|
||||
// cache control table has been removed
|
||||
|
||||
<form name="options" id="options" method="post" action="<?php echo $url; ?>" >
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
|
||||
<input type="hidden" name="action" value="config" />
|
||||
<table cellpadding="20">
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php echo $txt->cachetext; ?></td>
|
||||
<td><?php choose_from_menu($options, "cachetext", $CFG->cachetext, "", "", ""); ?></td>
|
||||
<td><?php echo $txt->configcachetext; ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php echo $txt->filteruploadedfiles; ?></td>
|
||||
<td><?php choose_from_menu(array($txt->none,$txt->allfiles,$txt->htmlfilesonly),
|
||||
"filteruploadedfiles", $CFG->filteruploadedfiles,"","",""); ?></td>
|
||||
<td><?php echo $txt->configfilteruploadedfiles; ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php echo $txt->filtermatchoneperpage; ?></td>
|
||||
<td><?php choose_from_menu(array($txt->no,$txt->yes), "filtermatchoneperpage", $CFG->filtermatchoneperpage,"","",""); ?></td>
|
||||
<td><?php echo $txt->configfiltermatchoneperpage; ?></td>
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php echo $txt->filtermatchonepertext; ?></td>
|
||||
<td><?php choose_from_menu(array($txt->no,$txt->yes), "filtermatchonepertext", $CFG->filtermatchonepertext,"","",""); ?></td>
|
||||
<td><?php echo $txt->configfiltermatchonepertext; ?></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td nowrap="nowrap" align="right"><?php echo $txt->filterall; ?></td>
|
||||
<td><?php choose_from_menu(array($txt->no,$txt->yes), "filterall", $CFG->filterall,"","",""); ?></td>
|
||||
<td><?php echo $txt->configfilterall; ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td> </td>
|
||||
<td><input type="submit" value="<?php print_string('savechanges'); ?>" /></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
?>
|
||||
|
||||
+16
-9
@@ -347,11 +347,16 @@
|
||||
|
||||
/// At this point everything is set up and the user is an admin, so print menu
|
||||
|
||||
$stradministration = get_string("administration");
|
||||
print_header("$site->shortname: $stradministration","$site->fullname", "$stradministration");
|
||||
print_simple_box_start('center', '100%', '', 20);
|
||||
print_heading($stradministration);
|
||||
# $stradministration = get_string("administration");
|
||||
# print_header("$site->shortname: $stradministration","$site->fullname", "$stradministration");
|
||||
# print_simple_box_start('center', '100%', '', 20);
|
||||
# print_heading($stradministration);
|
||||
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
admin_externalpage_setup('adminnotifications');
|
||||
admin_externalpage_print_header();
|
||||
echo 'Umm... any notifications should show up here... I hope :)<br /><br />';
|
||||
echo 'Also, I\'m including the old admin menu on this page incase I forgot any links in the new admin structure. It should be removed after. <br /><br />';
|
||||
/// Deprecated database! Warning!!
|
||||
if (!empty($CFG->migrated_to_new_db)) {
|
||||
print_simple_box_start('center','60%');
|
||||
@@ -402,6 +407,7 @@
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
// keeping this old menu here for a little while /*
|
||||
$table->tablealign = "center";
|
||||
$table->align = array ("right", "left");
|
||||
$table->wrap = array ("nowrap", "nowrap");
|
||||
@@ -436,7 +442,6 @@
|
||||
|
||||
$table->data[] = array('<strong><a href="configure.php">'.get_string('configuration').'</a></strong>', $configdata);
|
||||
|
||||
|
||||
$userdata = '<div class="adminlink"><a href="auth.php?sesskey='.$USER->sesskey.'">'.get_string("authentication").
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpauthentication').'</span></div>';
|
||||
$userdata .= '<div class="adminlink"><a href="user.php">'.get_string('edituser').
|
||||
@@ -461,7 +466,7 @@
|
||||
|
||||
|
||||
$table->data[] = array('<strong><a href="courses.php">'.get_string('courses').'</a></strong>', $coursedata);
|
||||
|
||||
|
||||
$miscdata = '<div class="adminlink"><a href="../files/index.php?id='.$site->id.'">'.get_string('sitefiles').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpsitefiles').'</span></div>';
|
||||
$miscdata .= '<div class="adminlink"><a href="stickyblocks.php">'.get_string('stickyblocks','admin').
|
||||
@@ -491,13 +496,13 @@
|
||||
/// The eventual official versions may not look like this
|
||||
if (isset($CFG->portfolio) && file_exists("$CFG->dirroot/$CFG->portfolio")) {
|
||||
$table->data[] = array("<strong><a href=\"../portfolio/\">".get_string('portfolio','portfolio').'</a></
|
||||
trong>',
|
||||
strong>',
|
||||
'<div class="explanation">'.get_string('adminhelpportfolio','portfolio').'</div>');
|
||||
}
|
||||
|
||||
if (isset($CFG->repo) && file_exists("$CFG->dirroot/$CFG->repo")) {
|
||||
$table->data[] = array("<strong><a href=\"../repository/?repoid=1&action=list\">".get_string('repository','
|
||||
epository').'</a></strong>',
|
||||
repository').'</a></strong>',
|
||||
'<div class="explanation">'.get_string('adminhelprepository','repository').'</div>');
|
||||
}
|
||||
|
||||
@@ -505,6 +510,8 @@ epository').'</a></strong>',
|
||||
|
||||
print_table($table);
|
||||
|
||||
// old stuff ends here */
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO REMOVE OR MODIFY THE COPYRIGHT NOTICE BELOW ////
|
||||
$copyrighttext = '<a href="http://moodle.org/">Moodle</a> '.
|
||||
@@ -533,6 +540,6 @@ epository').'</a></strong>',
|
||||
}
|
||||
|
||||
|
||||
print_footer($site);
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
?>
|
||||
|
||||
+9
-29
@@ -33,6 +33,8 @@
|
||||
*/
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
admin_externalpage_setup('langedit');
|
||||
|
||||
define('LANG_SUBMIT_REPEAT', 1); // repeat displaying submit button?
|
||||
define('LANG_SUBMIT_REPEAT_EVERY', 20); // if so, after how many lines?
|
||||
@@ -55,16 +57,6 @@
|
||||
$SESSION->langtranslateintolocal = $uselocal;
|
||||
}
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("You need to be admin to edit this page");
|
||||
}
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Site not defined!");
|
||||
}
|
||||
|
||||
$stradministration = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strlanguage = get_string("language");
|
||||
@@ -118,37 +110,25 @@
|
||||
}
|
||||
|
||||
|
||||
print_header("$site->shortname: $title", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> $navigation",
|
||||
'', '', true, $button);
|
||||
admin_externalpage_print_header();
|
||||
|
||||
if (!$mode) {
|
||||
print_simple_box_start('center','80%');
|
||||
echo '<table summary="" align="center" width="100%"><tr><td width="50%" align="center">';
|
||||
print_string('managelang','admin');
|
||||
echo '</td><td align="center" width="50%">';
|
||||
echo '<div align="center">';
|
||||
print_string('editlang','admin');
|
||||
echo '</td></tr><tr><td>';
|
||||
print_string('lang16notify','admin');
|
||||
echo '<p /><a href="langimport.php">'.get_string('langimport','admin').'</a>';
|
||||
echo '</td><td>';
|
||||
echo '<br />';
|
||||
$currlang = current_language();
|
||||
$langs = get_list_of_languages();
|
||||
echo "<table summary=\"\" align=\"center\"><tr><td align=\"right\">";
|
||||
echo "<b>$strcurrentlanguage:</b>";
|
||||
echo "</td><td>";
|
||||
echo '<br />';
|
||||
echo popup_form ("$CFG->wwwroot/$CFG->admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
|
||||
echo '</td></tr><tr><td colspan="2">';
|
||||
$options["lang"] = $currentlang;
|
||||
//print_single_button("http://moodle.org/download/lang/", $options, get_string("latestlanguagepack"));
|
||||
echo "</td></tr></table>";
|
||||
print_heading("<a href=\"lang.php?mode=missing\">$strmissingstrings</a>");
|
||||
print_heading("<a href=\"lang.php?mode=compare\">$streditstrings</a>");
|
||||
print_heading("<a href=\"langdoc.php\">$stredithelpdocs</a>");
|
||||
echo '</td></tr></table>';
|
||||
echo '</div>';
|
||||
print_simple_box_end();
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -519,7 +499,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
+4
-16
@@ -10,6 +10,8 @@
|
||||
* for intensive testing of this my first contribution
|
||||
*/
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
admin_externalpage_setup('langedit');
|
||||
|
||||
//
|
||||
// Some local configuration
|
||||
@@ -24,16 +26,6 @@
|
||||
|
||||
$currentfile = optional_param('currentfile', 'docs/README.txt', PARAM_PATH);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("You need to be admin to edit this page");
|
||||
}
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Site not defined!");
|
||||
}
|
||||
|
||||
$stradministration = get_string("administration");
|
||||
$strconfiguration = get_string("configuration");
|
||||
$strlanguage = get_string("language");
|
||||
@@ -41,11 +33,7 @@
|
||||
$strthislanguage = get_string("thislanguage");
|
||||
$stredithelpdocs = get_string('edithelpdocs', 'admin');
|
||||
|
||||
print_header("$site->shortname: $stredithelpdocs: $currentfile", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> ->
|
||||
<a href=\"lang.php\">$strlanguage</a> -> $stredithelpdocs",
|
||||
'choosefile.popup', '', true);
|
||||
admin_externalpage_print_header();
|
||||
|
||||
$currentlang = current_language();
|
||||
$langdir = "$CFG->dataroot/lang/$currentlang";
|
||||
@@ -207,7 +195,7 @@ $langdir/$currentfile")."</font></p>";
|
||||
error_reporting($CFG->debug);
|
||||
}
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
+23
-34
@@ -5,6 +5,8 @@
|
||||
///This helps to avoid confusion.
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
admin_externalpage_setup('langimport');
|
||||
|
||||
$mode = optional_param('mode', 0, PARAM_INT); //phase
|
||||
$pack = optional_param('pack', '', PARAM_FILE); //pack to install
|
||||
@@ -17,16 +19,6 @@
|
||||
define('CHANGE_SITE_LANG', 3);
|
||||
define('DELETION_OF_SELECTED_LANG', 4);
|
||||
define('UPDATE_ALL_LANG', 5);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error('You must be an admin');
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site not defined!");
|
||||
}
|
||||
|
||||
$strlang = get_string('langimport','admin');
|
||||
|
||||
@@ -35,14 +27,9 @@
|
||||
$strlanguage = get_string("language");
|
||||
$strthislanguage = get_string("thislanguage");
|
||||
$title = $strlang;
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
print_header("$site->shortname: $title", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"lang.php\">$strlanguage</a> -> $strlang",
|
||||
'', '', true, '');
|
||||
|
||||
print_heading('');
|
||||
|
||||
switch ($mode){
|
||||
|
||||
@@ -284,23 +271,25 @@
|
||||
echo '<p />';
|
||||
|
||||
/// Display option to change site language
|
||||
|
||||
/// Erm... this doesn't seem to work. Plus it's redundant. -vinkmar
|
||||
|
||||
print_string('changesitelang','admin');
|
||||
$sitelanguage = get_record('config','name','lang');
|
||||
echo '<form name="changelangform" action="langimport.php?mode=3" method="POST">';
|
||||
echo '<select name="sitelangconfig">';
|
||||
|
||||
foreach ($installedlangs as $clang =>$ilang) {
|
||||
if ($clang == $sitelanguage->value){
|
||||
echo '<option value="'.$clang.'" selected="selected">'.$ilang.'</option>';
|
||||
} else {
|
||||
echo '<option value="'.$clang.'">'.$ilang.'</option>';
|
||||
}
|
||||
}
|
||||
echo '</select>';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<input type="submit" value="'.get_string('change','admin').'" />';
|
||||
echo '</form>';
|
||||
// print_string('changesitelang','admin');
|
||||
// $sitelanguage = get_record('config','name','lang');
|
||||
// echo '<form name="changelangform" action="langimport.php?mode=3" method="POST">';
|
||||
// echo '<select name="sitelangconfig">';
|
||||
//
|
||||
// foreach ($installedlangs as $clang =>$ilang) {
|
||||
// if ($clang == $sitelanguage->value){
|
||||
// echo '<option value="'.$clang.'" selected="selected">'.$ilang.'</option>';
|
||||
// } else {
|
||||
// echo '<option value="'.$clang.'">'.$ilang.'</option>';
|
||||
// }
|
||||
// }
|
||||
// echo '</select>';
|
||||
// echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
// echo '<input type="submit" value="'.get_string('change','admin').'" />';
|
||||
// echo '</form>';
|
||||
|
||||
/// display to be installed langs here
|
||||
|
||||
@@ -354,7 +343,7 @@
|
||||
|
||||
} //close of main switch
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
/* returns a list of available language packs from a
|
||||
* local copy shipped with standard moodle distro
|
||||
|
||||
+6
-17
@@ -2,14 +2,11 @@
|
||||
// Enables/disables maintenance mode
|
||||
|
||||
require('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error('You need to be admin to use this page');
|
||||
}
|
||||
admin_externalpage_setup('maintenancemode');
|
||||
|
||||
//Check folder exists
|
||||
if (! make_upload_directory(SITEID)) { // Site folder
|
||||
@@ -22,27 +19,19 @@
|
||||
if (confirm_sesskey()) {
|
||||
if ($form->action == "disable") {
|
||||
unlink($filename);
|
||||
redirect('index.php', get_string('sitemaintenanceoff','admin'));
|
||||
redirect('maintenance.php', get_string('sitemaintenanceoff','admin'));
|
||||
} else {
|
||||
$file = fopen($filename, 'w');
|
||||
fwrite($file, stripslashes($form->text));
|
||||
fclose($file);
|
||||
redirect('index.php', get_string('sitemaintenanceon', 'admin'));
|
||||
redirect('maintenance.php', get_string('sitemaintenanceon', 'admin'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Print the header stuff
|
||||
|
||||
$strmaintenance = get_string('sitemaintenancemode', 'admin');
|
||||
$stradmin = get_string('administration');
|
||||
$strconfiguration = get_string('configuration');
|
||||
|
||||
print_header("$SITE->shortname: $strmaintenance", $SITE->fullname,
|
||||
"<a href=\"index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> $strmaintenance");
|
||||
|
||||
print_heading($strmaintenance);
|
||||
admin_externalpage_print_header();
|
||||
|
||||
/// Print the appropriate form
|
||||
|
||||
@@ -74,5 +63,5 @@
|
||||
}
|
||||
}
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
|
||||
+4
-15
@@ -2,16 +2,8 @@
|
||||
// module.php - allows admin to edit all local configuration variables for a module
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only an admin can use this page");
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
admin_externalpage_setup('modulemanagement');
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
@@ -61,10 +53,7 @@
|
||||
// of the page. It is also used to generate the link to the Moodle Docs for this view.
|
||||
$CFG->pagepath = 'mod/' . $module . '/config';
|
||||
|
||||
print_header("$site->shortname: $strmodulename: $strconfiguration", $site->fullname,
|
||||
"<a href=\"index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"modules.php\">$strmanagemodules</a> -> $strmodulename");
|
||||
admin_externalpage_print_header();
|
||||
|
||||
print_heading($strmodulename);
|
||||
|
||||
@@ -75,6 +64,6 @@
|
||||
include("$CFG->dirroot/mod/$module/config.html");
|
||||
print_simple_box_end();
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
?>
|
||||
|
||||
+9
-15
@@ -2,6 +2,8 @@
|
||||
// Allows the admin to manage activity modules
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
admin_externalpage_setup('modulemanagement');
|
||||
require_once('../course/lib.php');
|
||||
|
||||
$show = optional_param('show', '', PARAM_SAFEDIR);
|
||||
@@ -9,16 +11,6 @@
|
||||
$delete = optional_param('delete', '', PARAM_SAFEDIR);
|
||||
$confirm = optional_param('confirm', '', PARAM_BOOL);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only administrators can use this page!");
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
|
||||
/// Print headings
|
||||
|
||||
@@ -33,9 +25,11 @@
|
||||
$stractivities = get_string("activities");
|
||||
$stractivitymodule = get_string("activitymodule");
|
||||
|
||||
print_header("$site->shortname: $strmanagemodules", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> $strmanagemodules");
|
||||
// print_header("$site->shortname: $strmanagemodules", "$site->fullname",
|
||||
// "<a href=\"index.php\">$stradministration</a> -> ".
|
||||
// "<a href=\"configure.php\">$strconfiguration</a> -> $strmanagemodules");
|
||||
|
||||
admin_externalpage_print_header();
|
||||
|
||||
print_heading($strmanagemodules);
|
||||
|
||||
@@ -72,7 +66,7 @@
|
||||
notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename),
|
||||
"modules.php?delete=$delete&confirm=1&sesskey=$USER->sesskey",
|
||||
"modules.php");
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
exit;
|
||||
|
||||
} else { // Delete everything!!
|
||||
@@ -201,6 +195,6 @@
|
||||
|
||||
echo "<br /><br />";
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php // $Id$
|
||||
|
||||
// Places where there's a multilingual issue (i.e. a string is hardcoded when it should be
|
||||
// fetched from current lang) are marked with /*ML*/
|
||||
|
||||
// Two Big Issues
|
||||
// -What do I use as the pageid? Is 1 okay for index.php given that no other pages
|
||||
// in Moodle use this pagelib?
|
||||
// -How do I handle user_is_editing()? I'm sure what I have below isn't... well... "proper".
|
||||
|
||||
require_once($CFG->libdir.'/pagelib.php');
|
||||
|
||||
define('PAGE_ADMIN', 'admin-index');
|
||||
|
||||
page_map_class(PAGE_ADMIN, 'page_admin');
|
||||
|
||||
// $DEFINEDPAGES = array(PAGE_CHAT_VIEW); -- is anything like this needed?
|
||||
|
||||
class page_admin extends page_base {
|
||||
|
||||
var $section;
|
||||
var $pathtosection;
|
||||
var $visiblepathtosection;
|
||||
|
||||
function init_full() {
|
||||
global $CFG, $ADMIN;
|
||||
|
||||
if($this->full_init_done) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fetch the path parameter
|
||||
$this->section = optional_param("section","",PARAM_PATH);
|
||||
|
||||
$this->visiblepathtosection = array();
|
||||
|
||||
// this part is (potentially) processor-intensive... there's gotta be a better way
|
||||
// of handling this
|
||||
if ($this->pathtosection = $ADMIN->path($this->section)) {
|
||||
foreach($this->pathtosection as $element) {
|
||||
if ($pointer = $ADMIN->locate($element)) {
|
||||
array_push($this->visiblepathtosection, $pointer->visiblename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// all done
|
||||
$this->full_init_done = true;
|
||||
}
|
||||
|
||||
function blocks_get_default() {
|
||||
return 'admin_2';
|
||||
}
|
||||
|
||||
// seems reasonable that the only people that can edit blocks on the admin pages
|
||||
// are the admins... but maybe we want a role for this?
|
||||
function user_allowed_editing() {
|
||||
return isadmin();
|
||||
}
|
||||
|
||||
// has to be fixed. i know there's a "proper" way to do this
|
||||
function user_is_editing() {
|
||||
global $USER;
|
||||
return (($_GET["edit"] == 'on') && isadmin());
|
||||
}
|
||||
|
||||
function url_get_path() { // erm.... this has to be based on the current location, right?
|
||||
global $CFG;
|
||||
return $CFG->wwwroot .'/admin/settings.php';
|
||||
}
|
||||
|
||||
function url_get_parameters() { // only handles parameters relevant to the admin pagetype
|
||||
$this->init_full();
|
||||
return array('section' => $this->section);
|
||||
}
|
||||
|
||||
function blocks_get_positions() {
|
||||
return array(BLOCK_POS_LEFT);
|
||||
}
|
||||
|
||||
function blocks_default_position() {
|
||||
return BLOCK_POS_LEFT;
|
||||
}
|
||||
|
||||
// does anything need to be done here?
|
||||
function init_quick($data) {
|
||||
parent::init_quick($data);
|
||||
}
|
||||
|
||||
function print_header() {
|
||||
global $USER, $CFG, $SITE;
|
||||
|
||||
$this->init_full();
|
||||
|
||||
// should this rely on showblocksonmodpages in any way? after all, teachers aren't accessing this...
|
||||
if ($this->user_allowed_editing()) {
|
||||
$buttons = '<table><tr><td><form target="' . $CFG->framename . '" method="get" action="settings.php">'.
|
||||
'<input type="hidden" name="edit" value="'.($this->user_is_editing()?'off':'on').'" />'.
|
||||
'<input type="hidden" name="section" value="'.$this->section.'" />'.
|
||||
'<input type="submit" value="'.get_string($this->user_is_editing()?'blockseditoff':'blocksediton').'" /></form></td>' .
|
||||
'</tr></table>';
|
||||
} else {
|
||||
$buttons = ' ';
|
||||
}
|
||||
|
||||
/*ML*/ print_header("$SITE->shortname: " . implode(": ",$this->visiblepathtosection), $SITE->fullname, implode(" -> ",$this->visiblepathtosection),'', '', true, $buttons, '');
|
||||
}
|
||||
|
||||
function get_type() {
|
||||
return PAGE_ADMIN;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
+19
-14
@@ -3,7 +3,9 @@
|
||||
//testing
|
||||
require_once('../../config.php');
|
||||
|
||||
require_login();
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
admin_externalpage_setup('manageroles');
|
||||
// require_login();
|
||||
|
||||
$roleid = optional_param('roleid', 0, PARAM_INT); // if set, we are editing a role
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
@@ -13,13 +15,13 @@
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
|
||||
if (!isadmin()) {
|
||||
error('Only admins can access this page');
|
||||
}
|
||||
// if (!isadmin()) {
|
||||
// error('Only admins can access this page');
|
||||
// }
|
||||
|
||||
if (!$site = get_site()) {
|
||||
redirect('index.php');
|
||||
}
|
||||
// if (!$site = get_site()) {
|
||||
// redirect('index.php');
|
||||
// }
|
||||
|
||||
$stradministration = get_string('administration');
|
||||
$strmanageroles = get_string('manageroles');
|
||||
@@ -32,11 +34,12 @@
|
||||
$editingstr ='';
|
||||
}
|
||||
|
||||
print_header("$site->shortname: $strmanageroles",
|
||||
"$site->fullname",
|
||||
"<a href=\"../index.php\">$stradministration</a> -> <a href=\"manage.php\">$strmanageroles</a>
|
||||
$editingstr
|
||||
");
|
||||
admin_externalpage_print_header();
|
||||
// print_header("$site->shortname: $strmanageroles",
|
||||
// "$site->fullname",
|
||||
// "<a href=\"../index.php\">$stradministration</a> -> <a href=\"manage.php\">$strmanageroles</a>
|
||||
// $editingstr
|
||||
// ");
|
||||
|
||||
// form processing, editing a role, adding a role or deleting a role
|
||||
if ($action && confirm_sesskey()) {
|
||||
@@ -128,7 +131,8 @@
|
||||
echo ('<input type="hidden" name="confirm" value="1">');
|
||||
echo ('are you sure?');
|
||||
echo ('<input type="submit" value="yes">');
|
||||
print_footer($course);
|
||||
admin_externalpage_print_footer();
|
||||
// print_footer($course);
|
||||
exit;
|
||||
|
||||
// prints confirmation form
|
||||
@@ -205,5 +209,6 @@
|
||||
}
|
||||
|
||||
use_html_editor("description");
|
||||
print_footer($course);
|
||||
admin_externalpage_print_footer();
|
||||
// print_footer($course);
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
|
||||
// for external pages, most of this code is duplicated in the admin_externalpage_print_header()
|
||||
// and admin_externalpage_print_footer() functions... just include adminlib.php!
|
||||
//
|
||||
// lines marked //d at the end are handled (for other pages) by admin_externalpage_print_header()
|
||||
// and admin_externalpage_print_footer()
|
||||
require_once($CFG->libdir . '/blocklib.php'); //d
|
||||
require_once($CFG->dirroot . '/admin/pagelib.php'); //d
|
||||
|
||||
if ($site = get_site()) { //d
|
||||
require_login(); //d
|
||||
} //d
|
||||
|
||||
// Question: what pageid should be used for this?
|
||||
|
||||
define('TEMPORARY_ADMIN_PAGE_ID',26); //d
|
||||
|
||||
define('BLOCK_L_MIN_WIDTH',160); //d
|
||||
define('BLOCK_L_MAX_WIDTH',210); //d
|
||||
|
||||
$pagetype = PAGE_ADMIN; //d
|
||||
$pageclass = 'page_admin'; //d
|
||||
page_map_class($pagetype, $pageclass); //d
|
||||
|
||||
$PAGE = page_create_object($pagetype,TEMPORARY_ADMIN_PAGE_ID); //d
|
||||
|
||||
$PAGE->init_full(); //d
|
||||
|
||||
unset($root); //d
|
||||
|
||||
$root = $ADMIN->locate($PAGE->section); //d
|
||||
|
||||
if (!($root instanceof admin_settingpage)) { //d
|
||||
error('Section does not exist, is invalid, or should not be accessed via this URL.'); //d
|
||||
die; //d
|
||||
} //d
|
||||
|
||||
if (!($root->check_access())) { //d
|
||||
error('Access denied.'); //d
|
||||
die; //d
|
||||
} //d
|
||||
|
||||
// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------
|
||||
|
||||
if ($data = data_submitted()) {
|
||||
if (confirm_sesskey()) {
|
||||
$errors = $root->write_settings((array)$data);
|
||||
if (empty($errors)) {
|
||||
redirect("$CFG->wwwroot/admin/settings.php?section=" . $PAGE->section, get_string('changessaved'),1);
|
||||
} else {
|
||||
error('The following errors occurred when trying to save settings: <br />' . $errors);
|
||||
}
|
||||
} else {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
$pageblocks = blocks_setup($PAGE);
|
||||
|
||||
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH);
|
||||
|
||||
// print header stuff
|
||||
$PAGE->print_header();
|
||||
echo '<table id="layout-table"><tr>';
|
||||
echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
|
||||
echo '</td>';
|
||||
echo '<td id="middle-column" width="*">';
|
||||
echo '<form action="settings.php" method="post" name="mainform">';
|
||||
echo '<input type="hidden" name="section" value="' . $PAGE->section . '" />';
|
||||
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
|
||||
print_simple_box_start('','100%','',5,'generalbox','');
|
||||
|
||||
echo $root->output_html();
|
||||
|
||||
echo '<center><input type="submit" value="Save Changes" /></center>';
|
||||
echo '</form>';
|
||||
print_simple_box_end();
|
||||
echo '</td></tr></table>'; //d
|
||||
|
||||
print_footer(); //d
|
||||
|
||||
?>
|
||||
+10
-19
@@ -1,22 +1,16 @@
|
||||
<?php // $Id$
|
||||
|
||||
// Automatic update of Timezones from a new source
|
||||
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot .'/admin/adminlib.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once($CFG->libdir.'/olson.php');
|
||||
|
||||
admin_externalpage_setup('timezoneimport');
|
||||
|
||||
$ok = optional_param('ok', 0, PARAM_BOOL);
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error('Only administrators can use this page!');
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error('Site isn\'t defined!');
|
||||
}
|
||||
|
||||
/// Print headings
|
||||
|
||||
@@ -25,10 +19,7 @@
|
||||
$strcalendarsettings = get_string('calendarsettings', 'admin');
|
||||
$strimporttimezones = get_string('importtimezones', 'admin');
|
||||
|
||||
print_header("$site->shortname: $strcalendarsettings", "$site->fullname",
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"calendar.php\">$strcalendarsettings</a> -> $strimporttimezones");
|
||||
admin_externalpage_print_header();
|
||||
|
||||
print_heading($strimporttimezones);
|
||||
|
||||
@@ -42,9 +33,9 @@
|
||||
|
||||
$message = get_string("configintrotimezones", 'admin', $message);
|
||||
|
||||
notice_yesno($message, 'timezoneimport.php?ok=1&sesskey='.sesskey(), 'calendar.php');
|
||||
notice_yesno($message, 'timezoneimport.php?ok=1&sesskey='.sesskey(), 'index.php');
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -110,7 +101,7 @@
|
||||
$a->source = $importdone;
|
||||
print_heading(get_string('importtimezonescount', 'admin', $a), '', 3);
|
||||
|
||||
print_continue('calendar.php');
|
||||
print_continue('index.php');
|
||||
|
||||
$timezonelist = array();
|
||||
foreach ($timezones as $timezone) {
|
||||
@@ -131,9 +122,9 @@
|
||||
|
||||
} else {
|
||||
print_heading(get_string('importtimezonesfailed', 'admin'), '', 3);
|
||||
print_continue('calendar.php');
|
||||
print_continue('index.php');
|
||||
}
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
|
||||
?>
|
||||
|
||||
+15
-20
@@ -1,6 +1,11 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../config.php');
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot . '/admin/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('editusers');
|
||||
admin_externalpage_print_header();
|
||||
|
||||
|
||||
$newuser = optional_param('newuser', 0, PARAM_BOOL);
|
||||
$delete = optional_param('delete', 0, PARAM_INT);
|
||||
@@ -106,7 +111,7 @@
|
||||
|
||||
if ($newuser && confirm_sesskey()) { // Create a new user
|
||||
|
||||
if (!has_capability('moodle/user:create', $context)) {
|
||||
if (!has_capability('moodle/user:create', $context->id)) {
|
||||
error('You do not have the required permission to create new users.');
|
||||
}
|
||||
|
||||
@@ -130,7 +135,7 @@
|
||||
|
||||
} else { // List all users for editing
|
||||
|
||||
if (!has_capability('moodle/user:update', $context)) {
|
||||
if (!has_capability('moodle/user:update', $context->id)) {
|
||||
error('You do not have the required permission to edit users.');
|
||||
}
|
||||
|
||||
@@ -143,16 +148,6 @@
|
||||
$strsearch = get_string("search");
|
||||
$strshowallusers = get_string("showallusers");
|
||||
|
||||
if ($firstinitial or $lastinitial or $search or $page) {
|
||||
print_header("$site->shortname: $stredituser", $site->fullname,
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"users.php\">$strusers</a> -> ".
|
||||
"<a href=\"user.php\">$stredituser</a>");
|
||||
} else {
|
||||
print_header("$site->shortname: $stredituser", $site->fullname,
|
||||
"<a href=\"index.php\">$stradministration</a> -> ".
|
||||
"<a href=\"users.php\">$strusers</a> -> $stredituser");
|
||||
}
|
||||
|
||||
if ($confirmuser and confirm_sesskey()) {
|
||||
if (!$user = get_record("user", "id", "$confirmuser")) {
|
||||
@@ -172,7 +167,7 @@
|
||||
|
||||
} else if ($delete and confirm_sesskey()) { // Delete a selected user, after confirmation
|
||||
|
||||
if (!has_capability('moodle/user:delete', $context)) {
|
||||
if (!has_capability('moodle/user:delete', $context->id)) {
|
||||
error('You do not have the required permission to delete a user.');
|
||||
}
|
||||
|
||||
@@ -344,7 +339,7 @@
|
||||
if ($user->id == $USER->id or $user->username == "changeme") {
|
||||
$deletebutton = "";
|
||||
} else {
|
||||
if (has_capability('moodle/user:delete', $context)) {
|
||||
if (has_capability('moodle/user:delete', $context->id)) {
|
||||
$deletebutton = "<a href=\"user.php?delete=$user->id&sesskey=$USER->sesskey\">$strdelete</a>"; } else {
|
||||
$deletebutton ="";
|
||||
}
|
||||
@@ -361,7 +356,7 @@
|
||||
}
|
||||
$fullname = fullname($user, true);
|
||||
|
||||
if (has_capability('moodle/user:edit', $context)) {
|
||||
if (has_capability('moodle/user:edit', $context->id)) {
|
||||
|
||||
$table->data[] = array ("<a href=\"../user/view.php?id=$user->id&course=$site->id\">$fullname</a>",
|
||||
"$user->email",
|
||||
@@ -394,7 +389,7 @@
|
||||
echo "</form>";
|
||||
echo "</td></tr></table>";
|
||||
|
||||
if (has_capability('moodle/user:create', $context)) {
|
||||
if (has_capability('moodle/user:create', $context->id)) {
|
||||
print_heading("<a href=\"user.php?newuser=true&sesskey=$USER->sesskey\">".get_string("addnewuser")."</a>");
|
||||
}
|
||||
if (!empty($table)) {
|
||||
@@ -402,13 +397,13 @@
|
||||
print_paging_bar($usercount, $page, $perpage,
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage".
|
||||
"&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&");
|
||||
if (has_capability('moodle/user:create', $context)) {
|
||||
if (has_capability('moodle/user:create', $context->id)) {
|
||||
print_heading("<a href=\"user.php?newuser=true&sesskey=$USER->sesskey\">".get_string("addnewuser")."</a>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print_footer();
|
||||
admin_externalpage_print_footer();
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user