MDL-10870 All files updated to new build_navigation() method.

This commit is contained in:
nicolasconnault 2007-08-17 07:25:47 +00:00
parent d8c684de7e
commit f1af7aaaf5
14 changed files with 125 additions and 91 deletions

View file

@ -18,9 +18,11 @@
$stradministration = get_string("administration");
$site = get_site();
$navigation = build_navigation(array(
array('name'=>$stradministration, 'link'=>'index.php', 'type'=>'misc'),
array('name'=>$strdatabaseperformance, 'link'=>null, 'type'=>'misc')));
if (!empty($topframe)) {
print_header("$site->shortname: $strdatabaseperformance", "$site->fullname",
"<a $CFG->frametarget href=\"index.php\">$stradministration</a> -> Database performance");
print_header("$site->shortname: $strdatabaseperformance", "$site->fullname", $navigation);
exit;
}

View file

@ -129,7 +129,8 @@
error_reporting($CFG->debug);
if (empty($agreelicense)) {
$strlicense = get_string('license');
print_header($strlicense, $strlicense, $strlicense, "", "", false, "&nbsp;", "&nbsp;");
$navigation = build_navigation(array(array('name'=>$strlicense, 'link'=>null, 'type'=>'misc')));
print_header($strlicense, $strlicense, $navigation, "", "", false, "&nbsp;", "&nbsp;");
print_heading("<a href=\"http://moodle.org\">Moodle</a> - Modular Object-Oriented Dynamic Learning Environment");
print_heading(get_string('copyrightnotice'));
print_box(text_to_html(get_string('gpl')), 'copyrightnotice');
@ -141,7 +142,8 @@
}
if (empty($confirmrelease)) {
$strcurrentrelease = get_string("currentrelease");
print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, "&nbsp;", "&nbsp;");
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, "&nbsp;", "&nbsp;");
print_heading("Moodle $release");
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'generalbox boxaligncenter boxwidthwide');
echo '<form action="index.php"><div>';
@ -157,7 +159,8 @@
$strdatabasesetup = get_string("databasesetup");
$strdatabasesuccess = get_string("databasesuccess");
print_header($strdatabasesetup, $strdatabasesetup, $strdatabasesetup,
$navigation = build_navigation(array(array('name'=>$strdatabasesetup, 'link'=>null, 'type'=>'misc')));
print_header($strdatabasesetup, $strdatabasesetup, $navigation,
"", upgrade_get_javascript(), false, "&nbsp;", "&nbsp;");
/// return to original debugging level
$CFG->debug = $origdebug;
@ -167,13 +170,13 @@
/// Both old .sql files and new install.xml are supported
/// But we prioritise install.xml (XMLDB) if present
change_db_encoding(); // first try to change db encoding to utf8
if (!setup_is_unicodedb()) {
// If could not convert successfully, throw error, and prevent installation
print_error('unicoderequired', 'admin');
print_error('unicoderequired', 'admin');
}
$status = false;
if (file_exists("$CFG->libdir/db/install.xml")) {
$status = install_from_xmldb_file("$CFG->libdir/db/install.xml"); //New method
@ -267,7 +270,8 @@
}
if (empty($confirmupgrade)) {
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
$navigation = build_navigation(array(array('name'=>$strdatabasechecking, 'link'=>null, 'type'=>'misc')));
print_header($strdatabasechecking, $stradministration, $navigation,
"", "", false, "&nbsp;", "&nbsp;");
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=1', 'index.php');
@ -275,14 +279,15 @@
} else if (empty($confirmrelease)){
$strcurrentrelease = get_string("currentrelease");
print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, "&nbsp;", "&nbsp;");
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, "&nbsp;", "&nbsp;");
print_heading("Moodle $release");
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'));
require_once($CFG->libdir.'/environmentlib.php');
print_heading(get_string('environment', 'admin'));
if (!check_moodle_environment($release, $environment_results, true)) {
notice_yesno(get_string('environmenterrorupgrade', 'admin'),
notice_yesno(get_string('environmenterrorupgrade', 'admin'),
'index.php?confirmupgrade=1&confirmrelease=1', 'index.php');
} else {
notify(get_string('environmentok', 'admin'), 'notifysuccess');
@ -300,7 +305,8 @@
die;
} else {
$strdatabasesuccess = get_string("databasesuccess");
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
$navigation = build_navigation(array(array('name'=>$strdatabasesuccess, 'link'=>null, 'type'=>'misc')));
print_header($strdatabasechecking, $stradministration, $navigation,
"", upgrade_get_javascript(), false, "&nbsp;", "&nbsp;");
/// return to original debugging level
@ -309,7 +315,7 @@
upgrade_log_start();
/// Upgrade current language pack if we can
upgrade_language_pack();
upgrade_language_pack();
print_heading($strdatabasechecking);
$db->debug=true;
@ -337,7 +343,7 @@
}
// update core events
events_update_definition();
require_once($CFG->libdir.'/statslib.php');
if (!stats_upgrade_for_roles_wrapper()) {
notify('Couldn\'t upgrade the stats tables to use the new roles system');

View file

@ -1,7 +1,10 @@
<?php
print_header("$site->shortname: $strmnetsettings", "$site->fullname",
'<a href="'.$CFG->wwwroot.'/admin/index.php">'.$stradministration.'</a> -> '.
'<a href="'.$CFG->wwwroot.'/admin/mnet/index.php">'.get_string('mnetsettings', 'mnet').'</a> -> Delete host');
$navlinks = array();
$navlinks[] = array('name' => $stradministration, 'link' => $CFG->wwwroot.'/admin/index.php', 'type' => 'misc');
$navlinks[] = array('name' => get_string('mnetsettings', 'mnet'), 'link' => $CFG->wwwroot.'/admin/mnet/index.php', 'type' => 'misc');
$navlinks[] = array('name' => get_string('deletehost', 'mnet'), 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$site->shortname: $strmnetsettings", "$site->fullname", $navigation);
print_heading(get_string('mnetsettings', 'mnet'));
?>

View file

@ -33,9 +33,11 @@
$stradministration = get_string("administration");
$strregistration = get_string("registration");
$strregistrationinfo = get_string("registrationinfo");
print_header("$site->shortname: $strregistration", $site->fullname,
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strregistration");
$navlinks = array();
$navlinks[] = array('name' => $stradministration, 'link' => "../$CFG->admin/index.php", 'type' => 'misc');
$navlinks[] = array('name' => $strregistration, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$site->shortname: $strregistration", $site->fullname, $navigation);
print_heading($strregistration);
@ -63,12 +65,12 @@
echo '<div class="fitemtitle"><label>URL</label></div>';
echo '<div class="felement ftext">'.$CFG->wwwroot.'</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label>'.get_string("currentversion").'</label></div>';
echo '<div class="felement ftext">'."$CFG->release ($CFG->version)".'</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="sitename">'.get_string("fullsitename").'</label></div>';
echo '<div class="felement ftext">';
@ -103,7 +105,7 @@
unset($options);
echo '</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label>'.get_string("statistics")."<br />(".get_string("notpublic").')'.'</label></div>';
echo '<div class="felement ftext">';
@ -119,7 +121,7 @@
echo '<br />';
// total number of role assignments
$count = count_records('role_assignments');
$count = count_records('role_assignments');
echo get_string('roleassignments', 'role').": ".$count;
echo "<input type=\"hidden\" name=\"roleassignments\" value=\"$count\" />\n";
echo '<br />';
@ -127,13 +129,13 @@
// first find all distinct roles with mod/course:update
// please change the name and strings to something appropriate to reflect the new data collected
$sql = "SELECT COUNT(DISTINCT u.id)
FROM {$CFG->prefix}role_capabilities rc,
FROM {$CFG->prefix}role_capabilities rc,
{$CFG->prefix}role_assignments ra,
{$CFG->prefix}user u
WHERE (rc.capability = 'moodle/course:update' or rc.capability='moodle/site:doanything')
AND rc.roleid = ra.roleid
AND u.id = ra.userid";
$count = count_records_sql($sql);
echo get_string("teachers").": ".$count;
echo "<input type=\"hidden\" name=\"courseupdaters\" value=\"$count\" />\n";
@ -154,7 +156,7 @@
echo "<input type=\"hidden\" name=\"resources\" value=\"$count\" />\n";
echo '</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="adminname">'.get_string("administrator").'</label></div>';
echo '<div class="felement ftext">';

View file

@ -90,7 +90,7 @@
$timeformat = get_string('strftimedate');
$today = time();
$today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0);
$basemenu[0] = get_string('startdate') . ' (' . userdate($course->startdate, $timeformat) . ')';
if ($course->enrollable != 2 || ($course->enrolstartdate == 0 || $course->enrolstartdate <= $today) && ($course->enrolenddate == 0 || $course->enrolenddate > $today)) {
$basemenu[3] = get_string('today') . ' (' . userdate($today, $timeformat) . ')' ;
@ -103,7 +103,7 @@
$basemenu[5] = get_string('courseenrolenddate') . ' (' . userdate($course->enrolenddate, $timeformat) . ')';
}
}
/// Make sure this user can assign that role
if ($roleid) {
@ -122,16 +122,22 @@
if ($context->contextlevel == CONTEXT_USER) {
/// course header
$navlinks = array();
if ($courseid != SITEID) {
print_header("$fullname", "$fullname",
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
<a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">$strparticipants</a> -> <a href=\"$CFG->wwwroot/user/view.php?id=$userid&amp;course=$courseid\">$fullname</a> ->".$straction,
"", "", true, "&nbsp;", navmenu($course));
$navlinks[] = array('name' => $course->shortname, 'link' => "$CFG->wwwroot/course/view.php?id=$course->id", 'type' => 'course');
$navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'misc');
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&amp;course=$courseid", 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$fullname", "$fullname", $navigation, "", "", true, "&nbsp;", navmenu($course));
/// site header
} else {
print_header("$course->fullname: $fullname", $course->fullname,
"<a href=\"$CFG->wwwroot/user/view.php?id=$userid&amp;course=$courseid\">$fullname</a> -> $straction", "", "", true, "&nbsp;", navmenu($course));
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&amp;course=$courseid", 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$course->fullname: $fullname", $course->fullname, $navigation, "", "", true, "&nbsp;", navmenu($course));
}
$showroles = 1;
@ -190,7 +196,7 @@
$timestart = $course->enrolenddate;
break;
}
if($extendperiod > 0) {
$timeend = $timestart + $extendperiod;
} else {
@ -251,7 +257,7 @@
if ($context->contextlevel==CONTEXT_SYSTEM) {
print_box(get_string('globalroleswarning', 'role'));
}
if ($roleid) { /// prints a form to swap roles
/// Get all existing participants in this context.

View file

@ -100,8 +100,8 @@
continue;
}
if (isset($localoverrides[$capname])) {
// Something exists, so update it
if (isset($localoverrides[$capname])) {
// Something exists, so update it
assign_capability($capname, $value, $roleid, $context->id, true);
} else { // insert a record
if ($value != CAP_INHERIT) { // Ignore inherits
@ -116,18 +116,22 @@
/// Print the header and tabs
if ($context->contextlevel == CONTEXT_USER) {
$navlinks = array();
/// course header
if ($course->id != SITEID) {
print_header("$fullname", "$fullname",
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
<a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">$strparticipants</a> -> <a href=\"$CFG->wwwroot/user/view.php?id=$userid&amp;course=$course->id\">$fullname</a> -> $straction",
"", "", true, "&nbsp;", navmenu($course));
$navlinks[] = array('name' => $course->shortname, 'link' => "$CFG->wwwroot/course/view.php?id=$course->id", 'type' => 'course');
$navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'misc');
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&amp;course=$courseid", 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$fullname", "$fullname", $navigation, "", "", true, "&nbsp;", navmenu($course));
/// site header
} else {
print_header("$course->fullname: $fullname", $course->fullname,
"<a href=\"$CFG->wwwroot/user/view.php?id=$userid&amp;course=$course->id\">$fullname</a> -> $straction", "", "", true, "&nbsp;", navmenu($course));
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&amp;course=$courseid", 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$course->fullname: $fullname", $course->fullname, $navigation, "", "", true, "&nbsp;", navmenu($course));
}
$showroles = 1;
$currenttab = 'override';

View file

@ -13,7 +13,10 @@ if ($currenttab != 'update') {
case CONTEXT_SYSTEM:
$stradministration = get_string('administration');
print_header($SITE->fullname, "$SITE->fullname","<a href=\"../index.php\">$stradministration</a> -> $straction");
$navlinks[] = array('name' => $stradministration, 'link' => '../index.php', 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($SITE->fullname, "$SITE->fullname", $navigation);
break;
case CONTEXT_PERSONAL:

View file

@ -1,20 +1,20 @@
<?PHP // $Id$
require_once('../config.php');
require_once($CFG->dirroot.'/my/pagelib.php');
require_once($CFG->dirroot.'/lib/pagelib.php');
require_once($CFG->dirroot.'/lib/blocklib.php');
if (!empty($THEME->customcorners)) {
require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
}
$pt = optional_param('pt', null, PARAM_SAFEDIR); //alhanumeric and -
$pagetypes = array(PAGE_MY_MOODLE => array('id' => PAGE_MY_MOODLE,
'lib' => '/my/pagelib.php',
'name' => get_string('mymoodle','admin')),
PAGE_COURSE_VIEW => array('id' => PAGE_COURSE_VIEW,
PAGE_COURSE_VIEW => array('id' => PAGE_COURSE_VIEW,
'lib' => '/lib/pagelib.php',
'name' => get_string('stickyblockscourseview','admin'))
// ... more?
@ -27,29 +27,33 @@
}
require_login();
require_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID));
// first thing to do is print the dropdown menu
$strtitle = get_string('stickyblocks','admin');
$strheading = get_string('adminhelpstickyblocks');
if (!empty($pt)) {
require_once($CFG->dirroot.$pagetypes[$pt]['lib']);
define('ADMIN_STICKYBLOCKS',$pt);
$PAGE = page_create_object($pt, SITEID);
$blocks = blocks_setup($PAGE,BLOCKS_PINNED_TRUE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($blocks[BLOCK_POS_LEFT]), 210);
print_header($strtitle,$strtitle,'<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/index.php">'.
get_string('administration').'</a> -> '.$strtitle);
$navlinks = array(array('name' => get_string('administration'),
'link' => "$CFG->wwwroot/$CFG->admin/index.php",
'type' => 'misc'));
$navlinks[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($strtitle,$strtitle,$navigation);
echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
echo '<tr valign="top">';
@ -60,7 +64,7 @@
echo '</td>';
echo '<td valign="top" id="middle-column">';
if (!empty($THEME->customcorners)) print_custom_corners_start();
} else {
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('stickyblocks');

View file

@ -13,7 +13,7 @@
$strusers = get_string("users");
$strall = get_string("all");
print_header($strtimezone, $strtimezone, $strtimezone);
print_header($strtimezone, $strtimezone, build_navigation(array(array('name' => $strtimezone, 'link' => null, 'type' => 'misc'))));
print_heading("");