From 5ec8a4f0093492a0f07c6b0a0a614c801228b5c0 Mon Sep 17 00:00:00 2001
From: moodler
Date: Wed, 9 Aug 2006 13:18:33 +0000
Subject: [PATCH] Removed tabs
---
admin/cron.php | 4 +-
admin/health.php | 4 +-
admin/index.php | 14 +-
admin/roles/assign.php | 82 ++++-----
admin/roles/manage.html | 94 +++++-----
admin/roles/manage.php | 358 +++++++++++++++++++--------------------
admin/roles/override.php | 190 ++++++++++-----------
admin/roles/tabs.php | 188 ++++++++++----------
admin/user.php | 24 +--
admin/users.php | 14 +-
admin/utfdbmigrate.php | 100 +++++------
lib/moodlelib.php | 152 ++++++++---------
lib/weblib.php | 4 +-
13 files changed, 614 insertions(+), 614 deletions(-)
diff --git a/admin/cron.php b/admin/cron.php
index 485671a291..92342bc1b0 100644
--- a/admin/cron.php
+++ b/admin/cron.php
@@ -43,9 +43,9 @@
setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, '/');
/// switch to site language and locale
- if (!empty($CFG->courselang)) {
+ if (!empty($CFG->courselang)) {
unset ($CFG->courselang);
- }
+ }
if (!empty($SESSION->lang)) {
unset ($SESSION->lang);
}
diff --git a/admin/health.php b/admin/health.php
index 69b59121db..d5886c8f55 100644
--- a/admin/health.php
+++ b/admin/health.php
@@ -3,8 +3,8 @@
ob_start(); //for whitespace test
require_once('../config.php');
- // extra whitespace test - intentionally breaks cookieless mode
- $extraws = '';
+ // extra whitespace test - intentionally breaks cookieless mode
+ $extraws = '';
while (true) {
$extraws .= ob_get_contents();
if (!@ob_end_clean()) { //
diff --git a/admin/index.php b/admin/index.php
index abdd577c2c..7b855f77bd 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -170,9 +170,9 @@
print_heading($strdatabasechecking);
$db->debug=true;
if (main_upgrade($CFG->version)) {
- if (empty($CFG->rolesactive)) {
- moodle_upgrade_roles_system_17();
- }
+ if (empty($CFG->rolesactive)) {
+ moodle_upgrade_roles_system_17();
+ }
if (!update_capabilities()) {
error('Had trouble upgrading the core capabilities for Roles');
}
@@ -316,9 +316,9 @@
/// Check for valid admin user
require_login();
- $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+ $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
- if (!isadmin()) {
+ if (!isadmin()) {
//if (!has_capability('moodle/site:config', $context->id)) {
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
@@ -469,12 +469,12 @@
/// Optional stuff
if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) {
$miscdata .= '';
+ ' - '.get_string('adminhelpmanagedatabase').' ';
}
/// Hack to show the XMLDB editor
if (file_exists("$CFG->dirroot/$CFG->admin/xmldb")) {
$miscdata .= '';
+ ' - '.get_string('adminhelpxmldbeditor').' ';
}
$table->data[] = array(''.get_string('miscellaneous').' ', $miscdata);
diff --git a/admin/roles/assign.php b/admin/roles/assign.php
index 65b6020eed..c72aa71cfb 100755
--- a/admin/roles/assign.php
+++ b/admin/roles/assign.php
@@ -6,16 +6,16 @@
define("MAX_USERS_PER_PAGE", 5000);
$contextid = required_param('contextid',PARAM_INT); // context id
- $roleid = optional_param('roleid', 0, PARAM_INT); // required role id
+ $roleid = optional_param('roleid', 0, PARAM_INT); // required role id
$add = optional_param('add', 0, PARAM_BOOL);
$remove = optional_param('remove', 0, PARAM_BOOL);
$showall = optional_param('showall', 0, PARAM_BOOL);
$searchtext = optional_param('searchtext', '', PARAM_RAW); // search string
$previoussearch = optional_param('previoussearch', 0, PARAM_BOOL);
- $hidden = optional_param('hidden', 0, PARAM_BOOL); // whether this assignment is hidden
+ $hidden = optional_param('hidden', 0, PARAM_BOOL); // whether this assignment is hidden
$previoussearch = ($searchtext != '') or ($previoussearch) ? 1:0;
- $timestart = optional_param('timestart', 0, PARAM_INT);
- $timeend = optional_param('timened', 0, PARAM_INT);
+ $timestart = optional_param('timestart', 0, PARAM_INT);
+ $timeend = optional_param('timened', 0, PARAM_INT);
if (! $site = get_site()) {
redirect("$CFG->wwwroot/$CFG->admin/index.php");
@@ -26,11 +26,11 @@
}
/* permission check to see whether this user can assign people to this role
- * needs to be:
+ * needs to be:
* 1) has the capability to assign
* 2) not in role_deny_grant
* end of permission checking
- */
+ */
require_login($course->id);
@@ -38,21 +38,21 @@
error("You must be an editing teacher in this course, or an admin");
}
- $strassignusers = get_string('assignusers', 'role');
- $strpotentialusers = get_string('potentialusers', 'role');
- $strexistingusers = get_string('existingusers', 'role');
- $straction = get_string('assignroles', 'role');
- $strcurrentrole = get_string('currentrole', 'role');
- $strcurrentcontext = get_string('currentcontext', 'role');
- $strsearch = get_string('search');
- $strshowall = get_string('showall');
-
- $context = get_record('context', 'id', $contextid);
-
- $currenttab = '';
- $tabsmode = 'assign';
- include_once('tabs.php');
-
+ $strassignusers = get_string('assignusers', 'role');
+ $strpotentialusers = get_string('potentialusers', 'role');
+ $strexistingusers = get_string('existingusers', 'role');
+ $straction = get_string('assignroles', 'role');
+ $strcurrentrole = get_string('currentrole', 'role');
+ $strcurrentcontext = get_string('currentcontext', 'role');
+ $strsearch = get_string('search');
+ $strshowall = get_string('showall');
+
+ $context = get_record('context', 'id', $contextid);
+
+ $currenttab = '';
+ $tabsmode = 'assign';
+ include_once('tabs.php');
+
/// Don't allow restricted teachers to even see this page (because it contains
/// a lot of email addresses and access to all student on the server
@@ -66,9 +66,9 @@
} else {
if ($add and !empty($frm->addselect) and confirm_sesskey()) {
- //$timestart = ????
- // time end = ????
- $timemodified = time();
+ //$timestart = ????
+ // time end = ????
+ $timemodified = time();
foreach ($frm->addselect as $adduser) {
$adduser = clean_param($adduser, PARAM_INT);
if (! role_assign($roleid, $adduser, 0, $contextid, $timestart, $timeend, $hidden)) {
@@ -92,17 +92,17 @@
/// Get all existing students and teachers for this course.
$existinguserarray = array();
- $SQL = "select u.* from {$CFG->prefix}role_assignments r, {$CFG->prefix}user u where contextid = $contextid and roleid = $roleid and u.id = r.userid"; // join now so that we can just use fullname() later
+ $SQL = "select u.* from {$CFG->prefix}role_assignments r, {$CFG->prefix}user u where contextid = $contextid and roleid = $roleid and u.id = r.userid"; // join now so that we can just use fullname() later
if (!$contextusers = get_records_sql($SQL)) {
- $contextusers = array();
+ $contextusers = array();
}
- foreach ($contextusers as $contextuser) {
- $existinguserarray[] = $contextuser->id;
- }
-
- $existinguserlist = implode(',', $existinguserarray);
+ foreach ($contextusers as $contextuser) {
+ $existinguserarray[] = $contextuser->id;
+ }
+
+ $existinguserlist = implode(',', $existinguserarray);
unset($existinguserarray);
/// Get search results excluding any users already in this course
@@ -125,11 +125,11 @@
}
}
-
+
// this needs to check capability too
$role = get_records('role');
foreach ($role as $rolex) {
- $options[$rolex->id] = $rolex->name;
+ $options[$rolex->id] = $rolex->name;
}
// prints a form to swap roles
@@ -137,17 +137,17 @@
print (''.$strcurrentcontext.': '.print_context_name($contextid).' ');
print (' '.$strcurrentrole.': ');
choose_from_menu ($options, 'roleid', $roleid, 'choose', $script='rolesform.submit()');
- print ('
');
-
- if ($roleid) {
+ print ('');
+
+ if ($roleid) {
- print_simple_box_start("center");
-
- include('assign.html');
+ print_simple_box_start("center");
+
+ include('assign.html');
- print_simple_box_end();
+ print_simple_box_end();
- }
+ }
print_footer($course);
?>
diff --git a/admin/roles/manage.html b/admin/roles/manage.html
index ca1e0ca5eb..3094315da9 100755
--- a/admin/roles/manage.html
+++ b/admin/roles/manage.html
@@ -8,56 +8,56 @@
htmleditor, 10, 50, 50, 10, 'description', "$role->description"); ?>
-
-
-
\ No newline at end of file
+
diff --git a/admin/roles/manage.php b/admin/roles/manage.php
index 8cc53666fe..6e0fa3bb03 100755
--- a/admin/roles/manage.php
+++ b/admin/roles/manage.php
@@ -5,15 +5,15 @@
require_login();
- $roleid = optional_param('roleid', 0, PARAM_INT); // if set, we are editting a role
- $action = optional_param('action', '', PARAM_ALPHA);
- $name = optional_param('name', '', PARAM_ALPHA); // new role name
- $description = optional_param('description', '', PARAM_NOTAGS); // new role desc
- $confirm = optional_param('confirm', 0, PARAM_BOOL);
+ $roleid = optional_param('roleid', 0, PARAM_INT); // if set, we are editting a role
+ $action = optional_param('action', '', PARAM_ALPHA);
+ $name = optional_param('name', '', PARAM_ALPHA); // new role name
+ $description = optional_param('description', '', PARAM_NOTAGS); // new role desc
+ $confirm = optional_param('confirm', 0, PARAM_BOOL);
- $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
- $contextid = $sitecontext->id;
-
+ $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
+ $contextid = $sitecontext->id;
+
if (!isadmin()) {
error('Only admins can access this page');
}
@@ -26,188 +26,188 @@
$strmanageroles = get_string('manageroles');
if ($roleid && $action!='delete') {
- $role = get_record('role', 'id', $roleid);
+ $role = get_record('role', 'id', $roleid);
- $edittingstr = '-> '.get_string('editting', $role->name);
+ $edittingstr = '-> '.get_string('editting', $role->name);
} else {
- $edittingstr ='';
+ $edittingstr ='';
}
print_header("$site->shortname: $strmanageroles",
"$site->fullname",
"$stradministration -> $strmanageroles
- $edittingstr
- ");
+ $edittingstr
+ ");
- // form processing, editting a role, adding a role or deleting a role
- if ($action && confirm_sesskey()) {
-
- switch ($action) {
- case 'add':
-
- $newrole = create_role($name, $description);
-
- $ignore = array('roleid', 'sesskey', 'action', 'name', 'description', 'contextid');
-
- $data = data_submitted();
-
- foreach ($data as $capname => $value) {
- if (in_array($capname, $ignore)) {
- continue;
- }
+ // form processing, editting a role, adding a role or deleting a role
+ if ($action && confirm_sesskey()) {
+
+ switch ($action) {
+ case 'add':
+
+ $newrole = create_role($name, $description);
+
+ $ignore = array('roleid', 'sesskey', 'action', 'name', 'description', 'contextid');
+
+ $data = data_submitted();
+
+ foreach ($data as $capname => $value) {
+ if (in_array($capname, $ignore)) {
+ continue;
+ }
- assign_capability($capname, $value, $newrole, $contextid);
-
- }
-
- break;
-
- case 'edit':
-
- $ignore = array('roleid', 'sesskey', 'action', 'name', 'description', 'contextid');
-
- $data = data_submitted();
-
- foreach ($data as $capname => $value) {
- if (in_array($capname, $ignore)) {
- continue;
- }
-
- // edit default caps
- $SQL = "select * from {$CFG->prefix}role_capabilities where
- roleid = $roleid and capability = '$capname' and contextid = $contextid";
-
- $localoverride = get_record_sql($SQL);
-
- if ($localoverride) { // update current overrides
-
- if ($value == 0) { // inherit = delete
-
- unassign_capability($capname, $roleid, $contextid);
-
- } else {
-
- $localoverride->permission = $value;
- $localoverride->timemodified = time();
- $localoverride->modifierid = $USER->id;
- update_record('role_capabilities', $localoverride);
-
- }
-
- } else { // insert a record
-
- assign_capability($capname, $value, $roleid, $contextid);
+ assign_capability($capname, $value, $newrole, $contextid);
+
+ }
+
+ break;
+
+ case 'edit':
+
+ $ignore = array('roleid', 'sesskey', 'action', 'name', 'description', 'contextid');
+
+ $data = data_submitted();
+
+ foreach ($data as $capname => $value) {
+ if (in_array($capname, $ignore)) {
+ continue;
+ }
+
+ // edit default caps
+ $SQL = "select * from {$CFG->prefix}role_capabilities where
+ roleid = $roleid and capability = '$capname' and contextid = $contextid";
+
+ $localoverride = get_record_sql($SQL);
+
+ if ($localoverride) { // update current overrides
+
+ if ($value == 0) { // inherit = delete
+
+ unassign_capability($capname, $roleid, $contextid);
+
+ } else {
+
+ $localoverride->permission = $value;
+ $localoverride->timemodified = time();
+ $localoverride->modifierid = $USER->id;
+ update_record('role_capabilities', $localoverride);
+
+ }
+
+ } else { // insert a record
+
+ assign_capability($capname, $value, $roleid, $contextid);
- }
-
- }
-
- // update normal role settings
-
- $role->id = $roleid;
- $role->name = $name;
- $role->description = $description;
-
- update_record('role', $role);
-
- break;
-
- case 'delete':
- if ($confirm) { // deletes a role
- echo ('deleting...');
-
- // check for depedencies
-
- // delete all associated role-assignments?
- delete_records('role', 'id', $roleid);
-
- } else {
- echo ('');
-
- $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
- $contextid = $sitecontext->id;
-
- // this is the array holding capabilities of this role sorted till this context
- $r_caps = role_context_capabilities($roleid, $sitecontext->id);
-
- // this is the available capabilities assignable in this context
- $capabilities = fetch_context_capabilities($sitecontext->id);
-
- print_simple_box_start();
- include_once('manage.html');
- print_simple_box_end();
-
- } else {
-
- $table->tablealign = "center";
- $table->align = array ("middle", "left");
- $table->wrap = array ("nowrap", "nowrap");
- $table->cellpadding = 5;
- $table->cellspacing = 0;
- $table->width = '40%';
- /*************************
- * List all current roles *
- **************************/
-
- $table->data[] = array('roles', 'description', 'delete');
- foreach ($roles as $role) {
-
- $table->data[] = array(''.$role->name.' ', $role->description, 'delete ');
-
- }
- print_table($table);
-
- echo ('');
+
+ $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
+ $contextid = $sitecontext->id;
+
+ // this is the array holding capabilities of this role sorted till this context
+ $r_caps = role_context_capabilities($roleid, $sitecontext->id);
+
+ // this is the available capabilities assignable in this context
+ $capabilities = fetch_context_capabilities($sitecontext->id);
+
+ print_simple_box_start();
+ include_once('manage.html');
+ print_simple_box_end();
+
+ } else {
+
+ $table->tablealign = "center";
+ $table->align = array ("middle", "left");
+ $table->wrap = array ("nowrap", "nowrap");
+ $table->cellpadding = 5;
+ $table->cellspacing = 0;
+ $table->width = '40%';
+ /*************************
+ * List all current roles *
+ **************************/
+
+ $table->data[] = array('roles', 'description', 'delete');
+ foreach ($roles as $role) {
+
+ $table->data[] = array(''.$role->name.' ', $role->description, 'delete ');
+
+ }
+ print_table($table);
+
+ echo ('');
-
- /**************************************
- * print html for editting overrides *
- **************************************/
+ print ('');
+
+ /**************************************
+ * print html for editting overrides *
+ **************************************/
- if ($roleid) {
-
- // this is the array holding capabilities of this role sorted till this context
- $r_caps = role_context_capabilities($roleid, $contextid);
-
- // this is the available capabilities assignable in this context
- $capabilities = fetch_context_capabilities($contextid);
-
- print_simple_box_start("center");
-
- include_once('override.html');
+ if ($roleid) {
+
+ // this is the array holding capabilities of this role sorted till this context
+ $r_caps = role_context_capabilities($roleid, $contextid);
+
+ // this is the available capabilities assignable in this context
+ $capabilities = fetch_context_capabilities($contextid);
+
+ print_simple_box_start("center");
+
+ include_once('override.html');
- print_simple_box_end();
+ print_simple_box_end();
- }
+ }
- print_footer($course);
+ print_footer($course);
?>
diff --git a/admin/roles/tabs.php b/admin/roles/tabs.php
index 4e5834abd7..c36fee310a 100755
--- a/admin/roles/tabs.php
+++ b/admin/roles/tabs.php
@@ -2,118 +2,118 @@
// this deals with tabs, as well as print_headers for navigation
if ($currenttab != 'update') {
- switch ($context->level) {
-
- case CONTEXT_SYSTEM:
- $stradministration = get_string('administration');
- print_header($site->fullname, "$site->fullname","$stradministration -> $straction");
- break;
-
- case CONTEXT_PERSONAL:
- break;
-
- case CONTEXT_USERID:
- break;
-
- case CONTEXT_COURSECAT:
- $category = get_record('course_categories', 'id', $context->instanceid);
- $strcategories = get_string("categories");
- $strcategory = get_string("category");
- $strcourses = get_string("courses");
- print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
- "wwwroot/course/index.php\">$strcategories -> wwwroot/course/category.php?id=$category->id\">$category->name -> $straction", "", "", true);
- break;
-
- case CONTEXT_COURSE:
- $streditcoursesettings = get_string("editcoursesettings");
-
- $course = get_record('course', 'id', $context->instanceid);
- print_header($streditcoursesettings, "$course->fullname",
- "wwwroot/course/view.php?id=$course->id\">$course->shortname
- -> wwwroot/course/edit.php?id=$course->id\">$streditcoursesettings -> $straction");
- break;
-
- case CONTEXT_GROUP:
- break;
-
- case CONTEXT_MODULE:
- // get module type?
- $cm = get_record('course_modules','id',$context->instanceid);
- $module = get_record('modules','id',$cm->module); //$module->name;
- $course = get_record('course','id',$cm->course);
-
- if (! $form = get_record($module->name, "id", $cm->instance)) {
- error("The required instance of this module doesn't exist");
- }
-
- $strnav = "wwwroot/mod/$module->name/view.php?id=$cm->id\">$form->name ->";
- $fullmodulename = get_string("modulename", $module->name);
- $streditinga = get_string("editinga", "moodle", $fullmodulename);
- $strmodulenameplural = get_string("modulenameplural", $module->name);
-
- if ($module->name == "label") {
- $focuscursor = "";
- } else {
- $focuscursor = "form.name";
- }
-
- print_header_simple($streditinga, '',
- "wwwroot/mod/$module->name/index.php?id=$course->id\">$strmodulenameplural ->
- $strnav wwwroot/course/mod.php?update=$cm->id&sesskey=".sesskey()."\">$streditinga -> $straction", $focuscursor, "", false);
-
- break;
-
- case CONTEXT_BLOCK:
- print_header();
- break;
-
- default:
- error ('This is an unknown context!');
- return false;
-
- }
+ switch ($context->level) {
+
+ case CONTEXT_SYSTEM:
+ $stradministration = get_string('administration');
+ print_header($site->fullname, "$site->fullname","$stradministration -> $straction");
+ break;
+
+ case CONTEXT_PERSONAL:
+ break;
+
+ case CONTEXT_USERID:
+ break;
+
+ case CONTEXT_COURSECAT:
+ $category = get_record('course_categories', 'id', $context->instanceid);
+ $strcategories = get_string("categories");
+ $strcategory = get_string("category");
+ $strcourses = get_string("courses");
+ print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
+ "wwwroot/course/index.php\">$strcategories -> wwwroot/course/category.php?id=$category->id\">$category->name -> $straction", "", "", true);
+ break;
+
+ case CONTEXT_COURSE:
+ $streditcoursesettings = get_string("editcoursesettings");
+
+ $course = get_record('course', 'id', $context->instanceid);
+ print_header($streditcoursesettings, "$course->fullname",
+ "wwwroot/course/view.php?id=$course->id\">$course->shortname
+ -> wwwroot/course/edit.php?id=$course->id\">$streditcoursesettings -> $straction");
+ break;
+
+ case CONTEXT_GROUP:
+ break;
+
+ case CONTEXT_MODULE:
+ // get module type?
+ $cm = get_record('course_modules','id',$context->instanceid);
+ $module = get_record('modules','id',$cm->module); //$module->name;
+ $course = get_record('course','id',$cm->course);
+
+ if (! $form = get_record($module->name, "id", $cm->instance)) {
+ error("The required instance of this module doesn't exist");
+ }
+
+ $strnav = "wwwroot/mod/$module->name/view.php?id=$cm->id\">$form->name ->";
+ $fullmodulename = get_string("modulename", $module->name);
+ $streditinga = get_string("editinga", "moodle", $fullmodulename);
+ $strmodulenameplural = get_string("modulenameplural", $module->name);
+
+ if ($module->name == "label") {
+ $focuscursor = "";
+ } else {
+ $focuscursor = "form.name";
+ }
+
+ print_header_simple($streditinga, '',
+ "wwwroot/mod/$module->name/index.php?id=$course->id\">$strmodulenameplural ->
+ $strnav wwwroot/course/mod.php?update=$cm->id&sesskey=".sesskey()."\">$streditinga -> $straction", $focuscursor, "", false);
+
+ break;
+
+ case CONTEXT_BLOCK:
+ print_header();
+ break;
+
+ default:
+ error ('This is an unknown context!');
+ return false;
+
+ }
}
- // Printing the tabs
+ // Printing the tabs
if ($context->level == CONTEXT_MODULE) { // only show update button if module?
- $toprow[] = new tabobject('update', $CFG->wwwroot.'/course/mod.php?update='.$context->instanceid.'&return=true&sesskey='.sesskey(), get_string('update'));
-
- }
-
- $toprow[] = new tabobject('roles', $CFG->wwwroot.'/admin/roles/assign.php?contextid='.$context->id, get_string('roles'));
+ $toprow[] = new tabobject('update', $CFG->wwwroot.'/course/mod.php?update='.$context->instanceid.'&return=true&sesskey='.sesskey(), get_string('update'));
+
+ }
+
+ $toprow[] = new tabobject('roles', $CFG->wwwroot.'/admin/roles/assign.php?contextid='.$context->id, get_string('roles'));
- if (isset($tabsmode)) {
- $inactive[] = 'roles';
+ if (isset($tabsmode)) {
+ $inactive[] = 'roles';
- $secondrow[] = new tabobject('assign', $CFG->wwwroot.'/admin/roles/assign.php?contextid='.$context->id, get_string('assignroles', 'role'));
+ $secondrow[] = new tabobject('assign', $CFG->wwwroot.'/admin/roles/assign.php?contextid='.$context->id, get_string('assignroles', 'role'));
if ($context->level == CONTEXT_SYSTEM) {
- $secondrow[] = new tabobject('override', '', get_string('overrideroles', 'role'));
+ $secondrow[] = new tabobject('override', '', get_string('overrideroles', 'role'));
} else {
- $secondrow[] = new tabobject('override', $CFG->wwwroot.'/admin/roles/override.php?contextid='.$context->id,
- get_string('overrideroles', 'role'));
+ $secondrow[] = new tabobject('override', $CFG->wwwroot.'/admin/roles/override.php?contextid='.$context->id,
+ get_string('overrideroles', 'role'));
}
-
- if ($tabsmode == 'override') {
- $currenttab = 'override';
- } elseif ($tabsmode == 'assign') {
- $currenttab = 'assign';
- }
-
+
+ if ($tabsmode == 'override') {
+ $currenttab = 'override';
+ } elseif ($tabsmode == 'assign') {
+ $currenttab = 'assign';
+ }
+
} else {
- $inactive[] = '';
+ $inactive[] = '';
}
- if (!empty($secondrow)) {
+ if (!empty($secondrow)) {
$tabs = array($toprow, $secondrow);
} else {
$tabs = array($toprow);
}
- if ($context->level != CONTEXT_SYSTEM) { // do not show tabs otherwise
- print_tabs($tabs, $currenttab, $inactive);
- }
+ if ($context->level != CONTEXT_SYSTEM) { // do not show tabs otherwise
+ print_tabs($tabs, $currenttab, $inactive);
+ }
?>
diff --git a/admin/user.php b/admin/user.php
index 1ac78d8ceb..7da4d14636 100644
--- a/admin/user.php
+++ b/admin/user.php
@@ -20,7 +20,7 @@
$admin = new object();
$teacher = new object();
- $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+ $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
if (! record_exists("user_admins")) { // No admin user yet
@@ -309,9 +309,9 @@
if ($user->id == $USER->id or $user->username == "changeme") {
$deletebutton = "";
} else {
- if (has_capability('moodle/user:delete', $context->id)) {
- $deletebutton = "id&sesskey=$USER->sesskey\">$strdelete "; } else {
- $deletebutton ="";
+ if (has_capability('moodle/user:delete', $context->id)) {
+ $deletebutton = "id&sesskey=$USER->sesskey\">$strdelete "; } else {
+ $deletebutton ="";
}
}
if ($user->lastaccess) {
@@ -328,7 +328,7 @@
if (has_capability('moodle/user:edit', $context->id)) {
- $table->data[] = array ("id&course=$site->id\">$fullname ",
+ $table->data[] = array ("id&course=$site->id\">$fullname ",
"$user->email",
"$user->city",
"$user->country",
@@ -337,15 +337,15 @@
$deletebutton,
$confirmbutton);
} else {
- $table->data[] = array ("id&course=$site->id\">$fullname ",
+ $table->data[] = array ("id&course=$site->id\">$fullname ",
"$user->email",
"$user->city",
"$user->country",
$strlastaccess,
$deletebutton,
$confirmbutton);
-
- }
+
+ }
}
}
@@ -359,16 +359,16 @@
echo "";
echo "";
- if (has_capability('moodle/user:create', $context->id)) {
- print_heading("sesskey\">".get_string("addnewuser")." ");
- }
+ if (has_capability('moodle/user:create', $context->id)) {
+ print_heading("sesskey\">".get_string("addnewuser")." ");
+ }
if (!empty($table)) {
print_table($table);
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->id)) {
- print_heading("sesskey\">".get_string("addnewuser")." ");
+ print_heading("sesskey\">".get_string("addnewuser")." ");
}
}
diff --git a/admin/users.php b/admin/users.php
index 093baf3d69..68d674ee54 100644
--- a/admin/users.php
+++ b/admin/users.php
@@ -11,7 +11,7 @@
if (!$site = get_site()) {
redirect("index.php");
}
- $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+ $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
$stradministration = get_string("administration");
$strusers = get_string("users");
@@ -26,17 +26,17 @@
get_string("adminhelpauthentication"));
if (has_capability('moodle/user:update', $context->id)) {
- $table->data[] = array("".get_string("edituser")." ",
+ $table->data[] = array("".get_string("edituser")." ",
get_string("adminhelpedituser"));
- }
+ }
if (has_capability('moodle/user:create', $context->id)) {
- $table->data[] = array("wwwroot/$CFG->admin/user.php?newuser=true&sesskey=$USER->sesskey\">".get_string("addnewuser")." ",
+ $table->data[] = array("wwwroot/$CFG->admin/user.php?newuser=true&sesskey=$USER->sesskey\">".get_string("addnewuser")." ",
get_string("adminhelpaddnewuser"));
}
-
- if (has_capability('moodle/user:create', $context->id)) {
- $table->data[] = array("wwwroot/$CFG->admin/uploaduser.php?sesskey=$USER->sesskey\">".get_string("uploadusers")." ",
+
+ if (has_capability('moodle/user:create', $context->id)) {
+ $table->data[] = array("wwwroot/$CFG->admin/uploaduser.php?sesskey=$USER->sesskey\">".get_string("uploadusers")." ",
get_string("adminhelpuploadusers"));
}
diff --git a/admin/utfdbmigrate.php b/admin/utfdbmigrate.php
index 065264f598..fa68b9efda 100755
--- a/admin/utfdbmigrate.php
+++ b/admin/utfdbmigrate.php
@@ -8,46 +8,46 @@
require_once($CFG->dirroot.'/course/lib.php');
require_login();
- // decalre once
- global $enc;
-
- $customlang = array();
-
- $enc = array('af' => 'iso-8859-1', 'ar' => 'windows-1256', 'be' => 'windows-1251', 'bg' => 'windows-1251', 'bs' => 'windows-1250', 'ca' => 'iso-8859-1', 'cs' => 'iso-8859-2', 'da' => 'iso-8859-1', 'de' => 'iso-8859-1', 'de_du' => 'iso-8859-1', 'de_utf8' => 'utf-8', 'el' => 'windows-1253', 'en' => 'iso-8859-1', 'en_ja' => 'euc-jp', 'en_us' => 'iso-8859-1', 'en_utf8' => 'utf-8', 'es' => 'iso-8859-1', 'es_ar' => 'iso-8859-1', 'es_es' => 'iso-8859-1', 'es_mx' => 'iso-8859-1', 'et' => 'iso-8859-1', 'eu' => 'iso-8859-1', 'fa' => 'windows-1256', 'fa_utf8' => 'utf-8', 'fi' => 'iso-8859-1', 'fil' => 'iso-8859-15', 'fr' => 'iso-8859-1', 'fr_ca' => 'iso-8859-15', 'ga' => 'iso-8859-1', 'gl' => 'iso-8859-1', 'he' => 'ISO-8859-8-I', 'he_utf8' => 'utf-8', 'hi' => 'iso-8859-1', 'hr' => 'windows-1250', 'hr_utf8' => 'utf-8', 'hu' => 'iso-8859-2', 'id' => 'iso-8859-1', 'is' => 'iso-8859-1', 'it' => 'iso-8859-1', 'ja' => 'EUC-JP', 'ja_utf8' => 'UTF-8', 'ka_utf8' => 'UTF-8', 'km_utf8' => 'UTF-8', 'kn_utf8' => 'utf-8', 'ko' => 'EUC-KR', 'ko_utf8' => 'UTF-8', 'lt' => 'windows-1257', 'lv' => 'ISO-8859-4', 'mi_nt' => 'iso-8859-1', 'mi_tn_utf8' => 'utf-8', 'ms' => 'iso-8859-1', 'nl' => 'iso-8859-1', 'nn' => 'iso-8859-1', 'no' => 'iso-8859-1', 'no_gr' => 'iso-8859-1', 'pl' => 'iso-8859-2', 'pt' => 'iso-8859-1', 'pt_br' => 'iso-8859-1', 'ro' => 'iso-8859-2', 'ru' => 'windows-1251', 'sk' => 'iso-8859-2', 'sl' => 'iso-8859-2', 'sl_utf8' => 'utf-8', 'so' => 'iso-8859-1', 'sq' => 'iso-8859-1', 'sr_utf8' => 'utf-8', 'sv' => 'iso-8859-1', 'th' => 'TIS-620', 'th_utf8' => 'UTF-8', 'tl' => 'iso-8859-15', 'tl_utf8' => 'UTF-8', 'tr' => 'iso-8859-9', 'uk' => 'windows-1251', 'vi_utf8' => 'UTF-8', 'zh_cn' => 'GB18030', 'zh_cn_utf8' => 'UTF-8', 'zh_tw' => 'Big5', 'zh_tw_utf8' => 'UTF-8');
-
- /**************************************
- * Custom lang pack handling *
- **************************************/
-
- // scan list of langs, including customs packs
- $langs = get_list_of_languages();
-
- // foreach lang
- foreach ($langs as $lang => $lang1) {
-
- if (in_array($lang, array_keys($enc))) {
- // if already in array, ignore
- continue;
- }
-
- // if this lang has got a charset
-
- if ($result = get_string_from_file('thischarset',$CFG->dirroot.'/lang/'.$lang.'/moodle.php', "\$resultstring")) {
- eval($result);
- $enc[$lang] = $resultstring;
- } else if ($result = get_string_from_file('parentlanguage',$CFG->dirroot.'/lang/'.$lang.'/moodle.php',"\$resultstring")) {
- // else if there's a parent lang we can use
- eval($result);
- $enc[$lang] = $enc[$resultstring];
- } else {
- notify ('unknown lang pack detected '.$lang);
- }
-
- }
-
- /**************************************
- * End custom lang pack handling *
- **************************************/
+ // decalre once
+ global $enc;
+
+ $customlang = array();
+
+ $enc = array('af' => 'iso-8859-1', 'ar' => 'windows-1256', 'be' => 'windows-1251', 'bg' => 'windows-1251', 'bs' => 'windows-1250', 'ca' => 'iso-8859-1', 'cs' => 'iso-8859-2', 'da' => 'iso-8859-1', 'de' => 'iso-8859-1', 'de_du' => 'iso-8859-1', 'de_utf8' => 'utf-8', 'el' => 'windows-1253', 'en' => 'iso-8859-1', 'en_ja' => 'euc-jp', 'en_us' => 'iso-8859-1', 'en_utf8' => 'utf-8', 'es' => 'iso-8859-1', 'es_ar' => 'iso-8859-1', 'es_es' => 'iso-8859-1', 'es_mx' => 'iso-8859-1', 'et' => 'iso-8859-1', 'eu' => 'iso-8859-1', 'fa' => 'windows-1256', 'fa_utf8' => 'utf-8', 'fi' => 'iso-8859-1', 'fil' => 'iso-8859-15', 'fr' => 'iso-8859-1', 'fr_ca' => 'iso-8859-15', 'ga' => 'iso-8859-1', 'gl' => 'iso-8859-1', 'he' => 'ISO-8859-8-I', 'he_utf8' => 'utf-8', 'hi' => 'iso-8859-1', 'hr' => 'windows-1250', 'hr_utf8' => 'utf-8', 'hu' => 'iso-8859-2', 'id' => 'iso-8859-1', 'is' => 'iso-8859-1', 'it' => 'iso-8859-1', 'ja' => 'EUC-JP', 'ja_utf8' => 'UTF-8', 'ka_utf8' => 'UTF-8', 'km_utf8' => 'UTF-8', 'kn_utf8' => 'utf-8', 'ko' => 'EUC-KR', 'ko_utf8' => 'UTF-8', 'lt' => 'windows-1257', 'lv' => 'ISO-8859-4', 'mi_nt' => 'iso-8859-1', 'mi_tn_utf8' => 'utf-8', 'ms' => 'iso-8859-1', 'nl' => 'iso-8859-1', 'nn' => 'iso-8859-1', 'no' => 'iso-8859-1', 'no_gr' => 'iso-8859-1', 'pl' => 'iso-8859-2', 'pt' => 'iso-8859-1', 'pt_br' => 'iso-8859-1', 'ro' => 'iso-8859-2', 'ru' => 'windows-1251', 'sk' => 'iso-8859-2', 'sl' => 'iso-8859-2', 'sl_utf8' => 'utf-8', 'so' => 'iso-8859-1', 'sq' => 'iso-8859-1', 'sr_utf8' => 'utf-8', 'sv' => 'iso-8859-1', 'th' => 'TIS-620', 'th_utf8' => 'UTF-8', 'tl' => 'iso-8859-15', 'tl_utf8' => 'UTF-8', 'tr' => 'iso-8859-9', 'uk' => 'windows-1251', 'vi_utf8' => 'UTF-8', 'zh_cn' => 'GB18030', 'zh_cn_utf8' => 'UTF-8', 'zh_tw' => 'Big5', 'zh_tw_utf8' => 'UTF-8');
+
+ /**************************************
+ * Custom lang pack handling *
+ **************************************/
+
+ // scan list of langs, including customs packs
+ $langs = get_list_of_languages();
+
+ // foreach lang
+ foreach ($langs as $lang => $lang1) {
+
+ if (in_array($lang, array_keys($enc))) {
+ // if already in array, ignore
+ continue;
+ }
+
+ // if this lang has got a charset
+
+ if ($result = get_string_from_file('thischarset',$CFG->dirroot.'/lang/'.$lang.'/moodle.php', "\$resultstring")) {
+ eval($result);
+ $enc[$lang] = $resultstring;
+ } else if ($result = get_string_from_file('parentlanguage',$CFG->dirroot.'/lang/'.$lang.'/moodle.php',"\$resultstring")) {
+ // else if there's a parent lang we can use
+ eval($result);
+ $enc[$lang] = $enc[$resultstring];
+ } else {
+ notify ('unknown lang pack detected '.$lang);
+ }
+
+ }
+
+ /**************************************
+ * End custom lang pack handling *
+ **************************************/
if (!isadmin()) {
error('Only admins can access this page');
@@ -208,16 +208,16 @@
function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
//pointing to the num of records to process would be
- //useful. And it won't break anything, because the
- //crash system will continue the next time it was
- //executed. Also, the function could return:
- //0 = Some sort of error
- //1 = Finished completelly!
- //2 = Finished limit records
- //(using constants, of course ;-))
- //Then, all those errors, should be converted to
- //mtrace() and return 0. (showing the current
- //table/field/recordid)
+ //useful. And it won't break anything, because the
+ //crash system will continue the next time it was
+ //executed. Also, the function could return:
+ //0 = Some sort of error
+ //1 = Finished completelly!
+ //2 = Finished limit records
+ //(using constants, of course ;-))
+ //Then, all those errors, should be converted to
+ //mtrace() and return 0. (showing the current
+ //table/field/recordid)
global $db, $CFG, $dbtablename, $fieldname, $record, $processedrecords;
$debug = ($CFG->debug > 7);
diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 7195171a82..845344b794 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -1604,7 +1604,7 @@ function require_login($courseid=0, $autologinguest=true, $cm=null) {
notice(get_string('coursehidden'), $CFG->wwwroot .'/');
}
- $context = get_context_instance(CONTEXT_COURSE, $courseid);
+ $context = get_context_instance(CONTEXT_COURSE, $courseid);
if (has_capability('moodle/course:view', $context->id)) {
if (isset($USER->realuser)) { // Make sure the REAL person can also access this course
@@ -2008,21 +2008,21 @@ function isadmin($userid=0) {
global $USER;
static $admins, $nonadmins;
- if (isset($CFG->rolesactive) && $CFG->rolesactive ===1) {
-
- if ($courseid == 0) {
- $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
- } else {
- $context = get_context_instance(CONTEXT_COURSE, $courseid);
- }
-
- if (!$userid) {
- return has_capability('moodle/legacy:admin', $context->id);
- } else {
- return has_capability('moodle/legacy:admin', $context->id, false, $userid);
- }
-
- }
+ if (isset($CFG->rolesactive) && $CFG->rolesactive ===1) {
+
+ if ($courseid == 0) {
+ $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+ } else {
+ $context = get_context_instance(CONTEXT_COURSE, $courseid);
+ }
+
+ if (!$userid) {
+ return has_capability('moodle/legacy:admin', $context->id);
+ } else {
+ return has_capability('moodle/legacy:admin', $context->id, false, $userid);
+ }
+
+ }
if (!isset($admins)) {
$admins = array();
@@ -2067,20 +2067,20 @@ function isteacher($courseid=0, $userid=0, $includeadmin=true) {
/// Is the user able to access this course as a teacher?
global $USER, $CFG;
- if (isset($CFG->rolesactive) && $CFG->rolesactive ===1) { // should be always
-
- if ($courseid == 0) {
- $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
- } else {
- $context = get_context_instance(CONTEXT_COURSE, $courseid);
- }
-
- if (!$userid) {
- return has_capability('moodle/legacy:teacher', $context->id);
- } else {
- return has_capability('moodle/legacy:teacher', $context->id, false, $userid);
- }
- }
+ if (isset($CFG->rolesactive) && $CFG->rolesactive ===1) { // should be always
+
+ if ($courseid == 0) {
+ $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+ } else {
+ $context = get_context_instance(CONTEXT_COURSE, $courseid);
+ }
+
+ if (!$userid) {
+ return has_capability('moodle/legacy:teacher', $context->id);
+ } else {
+ return has_capability('moodle/legacy:teacher', $context->id, false, $userid);
+ }
+ }
// Old code follows, will be removed before 1.7 because it shouldn't run
@@ -2155,22 +2155,22 @@ function isteacherinanycourse($userid=0, $includeadmin=true) {
*/
function isteacheredit($courseid, $userid=0, $ignorestudentview=false) {
global $USER;
-
- if (isset($CFG->rolesactive) && $CFG->rolesactive ===1) {
-
- if ($courseid == 0) {
- $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
- } else {
- $context = get_context_instance(CONTEXT_COURSE, $courseid);
- }
-
- if (!$userid) {
- return has_capability('moodle/legacy:edittingteacher', $context->id);
- } else {
- return has_capability('moodle/legacy:edittingteacher', $context->id, false, $userid);
- }
-
- }
+
+ if (isset($CFG->rolesactive) && $CFG->rolesactive ===1) {
+
+ if ($courseid == 0) {
+ $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+ } else {
+ $context = get_context_instance(CONTEXT_COURSE, $courseid);
+ }
+
+ if (!$userid) {
+ return has_capability('moodle/legacy:edittingteacher', $context->id);
+ } else {
+ return has_capability('moodle/legacy:edittingteacher', $context->id, false, $userid);
+ }
+
+ }
// we can't edit in studentview
if (!empty($USER->studentview) and !$ignorestudentview) {
return false;
@@ -2205,19 +2205,19 @@ function iscreator ($userid=0) {
if (isset($CFG->rolesactive) && $CFG->rolesactive ===1) {
- if ($courseid == 0) {
- $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
- } else {
- $context = get_context_instance(CONTEXT_COURSE, $courseid);
- }
-
- if (!$userid) {
- return has_capability('moodle/legacy:coursecreator', $context->id);
- } else {
- return has_capability('moodle/legacy:coursecreator', $context->id, false, $userid);
- }
-
- }
+ if ($courseid == 0) {
+ $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+ } else {
+ $context = get_context_instance(CONTEXT_COURSE, $courseid);
+ }
+
+ if (!$userid) {
+ return has_capability('moodle/legacy:coursecreator', $context->id);
+ } else {
+ return has_capability('moodle/legacy:coursecreator', $context->id, false, $userid);
+ }
+
+ }
if (empty($USER->id)) {
return false;
}
@@ -2246,22 +2246,22 @@ function iscreator ($userid=0) {
*/
function isstudent($courseid, $userid=0) {
global $USER, $CFG;
-
- if (isset($CFG->rolesactive) && $CFG->rolesactive ===1) {
-
- if ($courseid == 0) {
- $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
- } else {
- $context = get_context_instance(CONTEXT_COURSE, $courseid);
- }
-
- if (!$userid) {
- return has_capability('moodle/legacy:student', $context->id);
- } else {
- return has_capability('moodle/legacy:student', $context->id, false, $userid);
- }
-
- }
+
+ if (isset($CFG->rolesactive) && $CFG->rolesactive ===1) {
+
+ if ($courseid == 0) {
+ $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+ } else {
+ $context = get_context_instance(CONTEXT_COURSE, $courseid);
+ }
+
+ if (!$userid) {
+ return has_capability('moodle/legacy:student', $context->id);
+ } else {
+ return has_capability('moodle/legacy:student', $context->id, false, $userid);
+ }
+
+ }
if (empty($USER->id) and !$userid) {
return false;
@@ -7160,7 +7160,7 @@ function check_dir_exists($dir, $create=false, $recursive=false) {
} else {
umask(0000);
if ($recursive) {
- // PHP 5.0 has recursive mkdir parameter, but 4.x does not :-(
+ // PHP 5.0 has recursive mkdir parameter, but 4.x does not :-(
$dir = str_replace('\\', '/', $dir); //windows compatibility
$dirs = explode('/', $dir);
$dir = array_shift($dirs).'/'; //skip root or drive letter
diff --git a/lib/weblib.php b/lib/weblib.php
index c248e74166..fbb8c57fcc 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -2831,10 +2831,10 @@ function print_user($user, $course, $messageselect=false) {
echo '';
//link to blogs
if ($CFG->bloglevel > 0) {
- echo ''.get_string('blogs','blog').' ';
+ echo ''.get_string('blogs','blog').' ';
}
- if ($isteacher) {
+ if ($isteacher) {
$timemidnight = usergetmidnight(time());
echo ''. $string->activity .' ';
if (!iscreator($user->id) or ($isadmin and !isadmin($user->id))) { // Includes admins
--
2.39.5