major whitespace cleanup - fixed trailng whitespace in new files and admin area

This commit is contained in:
skodak
2006-09-20 21:00:45 +00:00
parent 6124048972
commit eef868d17d
154 changed files with 2052 additions and 2052 deletions
+9 -9
View File
@@ -26,7 +26,7 @@
// extract and sanitize the auth key explicitly
$modules = get_list_of_plugins("auth");
if (in_array($config['auth'], $modules)) {
$auth = $config['auth'];
$auth = $config['auth'];
} else {
notify("Error defining the authentication method");
}
@@ -44,10 +44,10 @@
if (preg_match('/^pluginconfig_(.+?)$/', $name, $matches)) {
$plugin = "auth/$auth";
$name = $matches[1];
if (! set_config($name, $value, $plugin)) {
if (! set_config($name, $value, $plugin)) {
notify("Problem saving config $name as $value for plugin $plugin");
}
} else { // normal handling for
} else { // normal handling for
if (! set_config($name, $value)) {
notify("Problem saving config $name as $value");
}
@@ -128,7 +128,7 @@
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 '&nbsp;&nbsp;';
choose_from_menu ($options, "auth", $auth, "","document.location='auth.php?sesskey=$USER->sesskey&auth='+document.authmenu.auth.options[document.authmenu.auth.selectedIndex].value", "");
@@ -150,7 +150,7 @@
require_once("$CFG->dirroot/auth/$auth/config.html");
$CFG->pagepath = 'auth/' . $auth;
echo '<tr><td colspan="3">';
print_heading(get_string('auth_common_settings', 'auth'));
echo '<td/></tr>';
@@ -241,7 +241,7 @@
// Good enough for most auth plugins
// but some may want a custom one if they are offering
// other options
// Note: pluginconfig_ fields have special handling.
// Note: pluginconfig_ fields have special handling.
function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts, $updateopts) {
echo '<tr><td colspan="3">';
@@ -259,9 +259,9 @@ function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts,
'onlogin' => get_string('update_onlogin', 'auth'));
$updateextoptions = array('0' => get_string('update_never', 'auth'),
'1' => get_string('update_onupdate', 'auth'));
$pluginconfig = get_config("auth/$auth");
// helptext is on a field with rowspan
if (empty($helptext)) {
$helptext = '&nbsp;';
@@ -275,7 +275,7 @@ function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts,
}
if(empty($pluginconfig->{"field_updatelocal_$field"})) {
$pluginconfig->{"field_updatelocal_$field"} = '';
}
}
if (empty($pluginconfig->{"field_updateremote_$field"})) {
$pluginconfig->{"field_updateremote_$field"} = '';
}
+4 -4
View File
@@ -23,7 +23,7 @@
//First of all we check that everything is correct
//Check for trailing slash and backslash in backup_sche_destination
if (!empty($backup_sche_destination) and
if (!empty($backup_sche_destination) and
(substr($backup_sche_destination,-1) == "/" or substr($backup_sche_destination,-1) == "\\")) {
$error = true;
$sche_destination_error = get_string("pathslasherror");
@@ -43,7 +43,7 @@
if (isset($a_config[$tocheck])) {
$temp .= "1";
} else {
$temp .= "0";
$temp .= "0";
}
unset($a_config[$tocheck]);
$i++;
@@ -76,7 +76,7 @@
foreach ($courses as $course) {
//We check if the course exists in backup_course
$backup_course = get_record("backup_courses","courseid",$course->id);
//If it doesn't exist, create
//If it doesn't exist, create
if (!$backup_course) {
$temp_backup_course->courseid = $course->id;
$newid = insert_record("backup_courses",$temp_backup_course);
@@ -120,7 +120,7 @@
//Check for required functions...
if (!function_exists('utf8_encode')) {
notify("You need to add XML support to your PHP installation");
}
}
include ("$CFG->dirroot/backup/config.html");
print_simple_box_end();
+3 -3
View File
@@ -9,7 +9,7 @@
require_once($CFG->libdir.'/blocklib.php');
$blockid = required_param('block', PARAM_INT);
if(($blockrecord = blocks_get_record($blockid)) === false) {
error('This block does not exist');
}
@@ -51,11 +51,11 @@
$strconfiguration = get_string('configuration');
$strmanageblocks = get_string('manageblocks');
$strblockname = $block->get_title();
// $CFG->pagepath is used to generate the body and id attributes for the body tag
// of the page. It is also used to generate the link to the Moodle Docs for this view.
$CFG->pagepath = 'block/' . $block->name() . '/config';
admin_externalpage_print_header($adminroot);
+3 -3
View File
@@ -216,15 +216,15 @@
print_heading(get_string('incompatibleblocks', 'admin'));
$table = new flexible_table('admin-blocks-incompatible');
$table->define_columns(array('block', 'delete'));
$table->define_headers(array($strname, $strdelete));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'incompatible');
$table->set_attribute('class', 'generaltable generalbox');
$table->setup();
foreach ($incompatible as $block) {
+1 -1
View File
@@ -64,5 +64,5 @@ function delete_subdirectories($rootdir) {
}
closedir($dir);
}
?>
+2 -2
View File
@@ -7,7 +7,7 @@
$enrol = optional_param('enrol', $CFG->enrol, PARAM_SAFEDIR);
$CFG->pagepath = 'enrol';
$adminroot = admin_get_root();
admin_externalpage_setup('enrolment', $adminroot);
@@ -20,7 +20,7 @@
if ($frm = data_submitted()) {
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
}
if (empty($frm->enable)) {
$frm->enable = array();
}
+5 -5
View File
@@ -4,7 +4,7 @@
require_once("../config.php");
require_once($CFG->libdir.'/adminlib.php');
$adminroot = admin_get_root();
admin_externalpage_setup('enrolment', $adminroot);
@@ -21,7 +21,7 @@
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);
}
@@ -55,8 +55,8 @@
"document.location='enrol_config.php?enrol='+document.enrolmenu.enrol.options[document.enrolmenu.enrol.selectedIndex].value", "");
echo "</b></p></div>";
/// Print current enrolment type description
/// Print current enrolment type description
print_simple_box_start("center", "80%");
print_heading($options[$enrol]);
@@ -65,7 +65,7 @@
print_simple_box_end();
echo "<hr />";
$enrolment->config_form($frm);
echo "<center><p><input type=\"submit\" value=\"".get_string("savechanges")."\"></p></center>\n";
+2 -2
View File
@@ -21,7 +21,7 @@
// $CFG->pagepath is used to generate the body and id attributes for the body tag
// of the page. It is also used to generate the link to the Moodle Docs for this view.
$CFG->pagepath = 'filter/' . $filtername . '/config';
// get translated strings for use on page
$txt = new Object;
$txt->managefilters = get_string( 'managefilters' );
@@ -69,7 +69,7 @@
//==============================
// Display logic
//==============================
$filtername = ucfirst($filtername);
admin_externalpage_print_header($adminroot);
print_heading( $filtername );
+7 -7
View File
@@ -419,7 +419,7 @@ class problem_000010 extends problem_base {
}
function exists() {
if (!$this->is_enabled()) {
return true;
return true;
}
if ($this->status() < 1) {
return true;
@@ -429,7 +429,7 @@ class problem_000010 extends problem_base {
function severity() {
if ($this->is_enabled() and $this->status() == 0) {
return SEVERITY_SIGNIFICANT;
} else {
} else {
return SEVERITY_ANNOYANCE;
}
}
@@ -437,9 +437,9 @@ class problem_000010 extends problem_base {
global $CFG;
$desc = 'Slasharguments are needed for relative linking in uploaded resources:<ul>';
if (!$this->is_enabled()) {
$desc .= '<li>slasharguments are <strong>disabled</strong> in Moodle configuration</li>';
$desc .= '<li>slasharguments are <strong>disabled</strong> in Moodle configuration</li>';
} else {
$desc .= '<li>slasharguments are enabled in Moodle configuration</li>';
$desc .= '<li>slasharguments are enabled in Moodle configuration</li>';
}
if ($this->status() == -1) {
$desc .= '<li>can not run automatic test, you can verify it <a href="'.$CFG->wwwroot.'/file.php/testslasharguments" target="_blank">here</a> manually</li>';
@@ -470,9 +470,9 @@ class problem_000010 extends problem_base {
$solution .= 'Congratulations - everything seems OK now :-D';
}
if ($status < 1) {
$solution .= '<p>IIS:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li><li>do NOT enable AllowPathInfoForScriptMappings !!!</li><li>slasharguments may not work when using ISAPI and PHP 4.3.10 and older</li></ul></p>';
$solution .= '<p>Apache 1:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
$solution .= '<p>Apache 2:<ul><li>you must add <code>AcceptPathInfo on</code> to php.ini or .htaccess</li><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
$solution .= '<p>IIS:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li><li>do NOT enable AllowPathInfoForScriptMappings !!!</li><li>slasharguments may not work when using ISAPI and PHP 4.3.10 and older</li></ul></p>';
$solution .= '<p>Apache 1:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
$solution .= '<p>Apache 2:<ul><li>you must add <code>AcceptPathInfo on</code> to php.ini or .htaccess</li><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
}
return $solution;
}
+21 -21
View File
@@ -386,7 +386,7 @@
blocks_execute_action($page, blocks_get_by_page($page), 'add', (int)$admintree->id, false, false);
if ($admintreeinstance = get_record('block_instance', 'pagetype', $page->type, 'pageid', SITEID, 'blockid', $admintree->id)) {
blocks_execute_action($page, blocks_get_by_page($page), 'moveleft', $admintreeinstance, false, false);
}
}
}
set_config('adminblocks_initialised', 1);
@@ -457,7 +457,7 @@
}
/// Check for any special upgrades that might need to be run
if (!empty($CFG->upgrade)) {
if (!empty($CFG->upgrade)) {
print_simple_box(get_string("upgrade$CFG->upgrade", "admin",
"$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"), "center", '60%');
print_spacer(10,10);
@@ -490,7 +490,7 @@
}
/// Print slightly annoying registration button every six months ;-)
/// You can set the "registered" variable to something far in the future
/// You can set the "registered" variable to something far in the future
/// if you really want to prevent this. eg 9999999999
if (!isset($CFG->registered) || $CFG->registered < (time() - 3600*24*30*6)) {
$options = array();
@@ -512,7 +512,7 @@
$table->cellpadding = 5;
$table->cellspacing = 0;
$table->width = '40%';
$configdata = '<div class="adminlink"><a href="config.php">'.get_string('configvariables', 'admin').
'</a> - <span class="explanation">'.get_string('adminhelpconfigvariables').'</span></div>';
$configdata .= '<div class="adminlink"><a href="site.php">'.get_string('sitesettings').
@@ -537,9 +537,9 @@
'</a> - <span class="explanation">'.get_string('helpcalendarsettings', 'admin').'</span></div>';
$configdata .= '<div class="adminlink"><a href="maintenance.php">'.get_string('sitemaintenancemode', 'admin').
'</a> - <span class="explanation">'.get_string('helpsitemaintenance', 'admin').'</span></div>';
$table->data[] = array('<strong>'.get_string('configuration').'</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').
@@ -554,17 +554,17 @@
$userdata .= '<div class="adminlink"><a href="roles/assign.php?contextid='.$context->id.'">'.
get_string('assignsiteroles').'</a> - <span class="explanation">'.get_string('adminhelpassignsiteroles').
'</span></div>';
$table->data[] = array('<strong>'.get_string('users').'</strong>', $userdata);
$coursedata = '<div class="adminlink"><a href="../course/index.php?edit=on&amp;sesskey='.$USER->sesskey.'">'.get_string('managecourses').
'</a> - <span class="explanation">'.get_string('adminhelpcourses').'</span></div>';
$coursedata .= '<div class="adminlink"><a href="enrol.php?sesskey='.$USER->sesskey.'">'.get_string('enrolmentplugins').
'</a> - <span class="explanation">'.get_string('adminhelpenrolments').'</span></div>';
$table->data[] = array('<strong>'.get_string('courses').'</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').
@@ -586,28 +586,28 @@
$miscdata .= '<div class="adminlink"><a href="xmldb/index.php">'.get_string('xmldbeditor').
'</a> - <span class="explanation">'.get_string('adminhelpxmldbeditor').'</span></div>';
}
$table->data[] = array('<strong>'.get_string('miscellaneous').'</strong>', $miscdata);
/*
/// Hooks for Matt Oquists contrib code for repositories and portfolio.
/*
/// Hooks for Matt Oquists contrib code for repositories and portfolio.
/// 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></
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','
repository').'</a></strong>',
'<div class="explanation">'.get_string('adminhelprepository','repository').'</div>');
}
*/
*/
print_table($table);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
@@ -629,7 +629,7 @@
echo '</div>';
}
if (optional_param('dbmigrate')) { // ??? Is this actually used?
print_simple_box_start('center','60%');
require_once($CFG->dirroot.'/admin/utfdbmigrate.php');
+2 -2
View File
@@ -49,11 +49,11 @@
$strconfiguration = get_string("configuration");
$strmanagemodules = get_string("managemodules");
$strmodulename = get_string("modulename", $module);
// $CFG->pagepath is used to generate the body and id attributes for the body tag
// of the page. It is also used to generate the link to the Moodle Docs for this view.
$CFG->pagepath = 'mod/' . $module . '/config';
admin_externalpage_print_header($adminroot);
print_heading($strmodulename);
+10 -10
View File
@@ -29,9 +29,9 @@
admin_externalpage_print_header($adminroot);
print_heading($stractivities);
$coursesaffected = false;
/// If data submitted, then process and store.
@@ -56,12 +56,12 @@
}
if (!empty($delete) and confirm_sesskey()) {
$strmodulename = get_string("modulename", "$delete");
if (!$confirm) {
notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename),
"modules.php?delete=$delete&amp;confirm=1&amp;sesskey=$USER->sesskey",
notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename),
"modules.php?delete=$delete&amp;confirm=1&amp;sesskey=$USER->sesskey",
"modules.php");
admin_externalpage_print_footer($adminroot);
exit;
@@ -90,7 +90,7 @@
notify("Error occurred while deleting all $strmodulename records in course_modules table");
}
// Then delete all the logs
// Then delete all the logs
if (!delete_records("log", "module", $module->name)) {
notify("Error occurred while deleting all $strmodulename records in log table");
}
@@ -116,10 +116,10 @@
}
}
}
}
}
// Delete the capabilities that were defined by this module
capabilities_cleanup('mod/'.$module->name);
// rebuild_course_cache(); // Because things have changed
$coursesaffected = true;
@@ -128,11 +128,11 @@
notice(get_string("moduledeletefiles", "", $a), "modules.php");
}
}
if ($coursesaffected) {
rebuild_course_cache(); // Because things have changed
}
/// Get and sort the existing modules
+8 -8
View File
@@ -1,7 +1,7 @@
<?PHP // $Id$
// Allows the admin to manage questiontypes
// This page is adapted from modules.php
// This page is not yet in service, the whole plug-in architecture
// for question types is still under construction.
@@ -35,12 +35,12 @@
$strquestions = get_string("questions");
$strquestiontype = get_string("questiontype", 'quiz');
print_header("$site->shortname: $strquestions", "$site->fullname",
print_header("$site->shortname: $strquestions", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> $strquestions");
print_heading($strquestions);
/// If data submitted, then process and store.
@@ -59,12 +59,12 @@
}
if (!empty($delete) and confirm_sesskey()) {
$strqtypename = get_string("qtypename", "qtype_$delete");
if (!$confirm) {
notice_yesno(get_string("qtypedeleteconfirm", "admin", $strqtypename),
"questiontypes.php?delete=$delete&amp;confirm=1&amp;sesskey=$USER->sesskey",
notice_yesno(get_string("qtypedeleteconfirm", "admin", $strqtypename),
"questiontypes.php?delete=$delete&amp;confirm=1&amp;sesskey=$USER->sesskey",
"questiontypes.php");
print_footer();
exit;
@@ -104,7 +104,7 @@
}
}
}
}
}
$a->qtype = $strqtypename;
$a->directory = "$CFG->dirroot/qtype/$delete";
@@ -145,7 +145,7 @@
$count = count_records('quiz_questions', 'qtype', $qtype->id);
$delete = $count ? '' : "<a href=\"questiontypes.php?delete=$qtype->name&amp;sesskey=$USER->sesskey\">$strdelete</a>";
if ($qtype->visible) {
$visible = "<a href=\"questiontypes.php?hide=$qtype->name&amp;sesskey=$USER->sesskey\" title=\"$strhide\">".
"<img src=\"$CFG->pixpath/i/hide.gif\" align=\"middle\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" /></a>";
+8 -8
View File
@@ -28,7 +28,7 @@
$strcourseoverview = get_string('courseoverview');
$strnav = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/index.php">'.get_string('administration').'</a> -> <a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/report.php">'.$strreports.'</a> -> '.$strcourseoverview;
$reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
$tableprefix = $CFG->prefix.'stats_';
@@ -36,7 +36,7 @@
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');
if (empty($earliestday)) $earliestday = time();
if (empty($earliestweek)) $earliestweek = time();
if (empty($earliestmonth)) $earliestmonth = time();
@@ -66,14 +66,14 @@
if (!empty($report) && !empty($time)) {
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
." WHERE timeend >= ".$param->timeafter
." GROUP BY courseid "
.$param->extras
." ORDER BY ".$param->orderby
." LIMIT ".$numcourses;
$courses = get_records_sql($sql);
if (empty($courses)) {
@@ -81,17 +81,17 @@
}
echo '<center><img src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></center>';
$table = new object();
$table->align = array('left','center','center','center');
$table->head = array(get_string('course'),$param->line1);
if (!empty($param->line2)) {
$table->head[] = $param->line2;
$table->head[] = $param->line2;
}
if (!empty($param->line3)) {
$table->head[] = $param->line3;
}
foreach ($courses as $c) {
$a = array();
$a[] = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$c->courseid.'">'.get_field('course','shortname','id',$c->courseid).'</a>';
@@ -107,7 +107,7 @@
}
print_table($table);
}
admin_externalpage_print_footer($adminroot);
?>
+5 -5
View File
@@ -11,7 +11,7 @@
require_login();
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID));
stats_check_uptodate($course->id);
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
@@ -22,13 +22,13 @@
.$param->extras
." ORDER BY ".$param->orderby
." LIMIT ".$numcourses;
$courses = get_records_sql($sql);
if (empty($courses)) {
error(get_string('statsnodata'),$CFG->wwwroot.'/'.$CFG->admin.'/report/course/index.php');
}
$graph = new graph(750,400);
@@ -48,5 +48,5 @@
$graph->y_format['bar1'] = array('colour' => 'blue','bar' => 'fill','legend' => $param->{$param->graphline});
$graph->draw_stack();
?>
+1 -1
View File
@@ -16,7 +16,7 @@
print_heading(get_string('chooselogs') .':');
print_log_selector_form($course);
print_log_selector_form($course);
echo '<br />';
print_heading(get_string('chooselivelogs') .':');
+14 -14
View File
@@ -25,24 +25,24 @@ class ExHtmlReporter extends HtmlReporter {
// Options set when the class is created.
var $showpasses;
// Lang strings. Set in the constructor.
var $strrunonlyfolder;
var $strrunonlyfile;
var $strseparator;
/**
* Constructor.
*
*
* @param bool $showpasses Whether this reporter should output anything for passes.
*/
function ExHtmlReporter($showpasses) {
global $CFG;
$this->HtmlReporter();
$this->showpasses = $showpasses;
$this->strrunonlyfolder = $this->get_string('runonlyfolder');
$this->strrunonlyfile = $this->get_string('runonlyfile');
$this->strseparator = ' <img src="' . $CFG->pixpath . '/a/r_breadcrumb.gif" class="resize" alt="" /> ';
@@ -82,7 +82,7 @@ class ExHtmlReporter extends HtmlReporter {
*/
function _paintPassFail($passorfail, $message) {
global $FULLME, $CFG;
print_simple_box_start('', '100%', '', 5, $passorfail . ' generalbox');
$url = $this->_htmlEntities($this->_stripParameterFromUrl($FULLME, 'path'));
echo '<b class="', $passorfail, '">', $this->get_string($passorfail), '</b>: ';
@@ -102,7 +102,7 @@ class ExHtmlReporter extends HtmlReporter {
print_simple_box_end();
flush();
}
/**
* Called when a notice needs to be output.
*/
@@ -154,25 +154,25 @@ class ExHtmlReporter extends HtmlReporter {
echo $this->get_string('summary', $summarydata);
echo '</div>';
echo '<div class="performanceinfo">',
echo '<div class="performanceinfo">',
$this->get_string('runat', date('<b>d-m-Y H:i T</b>')),
$this->get_string('version', SimpleTestOptions::getVersion()),
'</div>';
}
/**
* Strip a specified parameter from the query string of a URL, if present.
* Adds a separator to the end of the URL, so that a new parameter
* Adds a separator to the end of the URL, so that a new parameter
* can easily be appended. For example (assuming $param = 'frog'):
*
*
* http://example.com/index.php -> http://example.com/index.php?
* http://example.com/index.php?frog=1 -> http://example.com/index.php?
* http://example.com/index.php?toad=1 -> http://example.com/index.php?toad=1&
* http://example.com/index.php?frog=1&toad=1 -> http://example.com/index.php?toad=1&
*
*
* @param string $url the URL to modify.
* @param string $param the parameter to strip from the URL, if present.
*
*
* @return string The modified URL.
*/
function _stripParameterFromUrl($url, $param) {
+1 -1
View File
@@ -57,7 +57,7 @@ class AutoGroupTest extends GroupTest {
if ($file != 'CVS' && !in_array($file_path, $this->ignorefolders)) {
$this->_recurseFolders($file_path);
}
} elseif (preg_match('/simpletest(\/|\\\\)test.*\.php$/', $file_path) ||
} elseif (preg_match('/simpletest(\/|\\\\)test.*\.php$/', $file_path) ||
($this->thorough && preg_match('/simpletest(\/|\\\\)slowtest.*\.php$/', $file_path))) {
$s_count++;
+6 -6
View File
@@ -39,20 +39,20 @@ admin_externalpage_print_header($adminroot);
if (!is_null($path)) {
// Create the group of tests.
$test =& new AutoGroupTest($showsearch, $thorough);
// OU specific. We use the _nonproject folder for stuff we want to
// OU specific. We use the _nonproject folder for stuff we want to
// keep in CVS, but which is not really relevant. It does no harm
// to leave this here.
$test->addIgnoreFolder($CFG->dirroot . '/_nonproject');
// Make the reporter, which is what displays the results.
$reporter = new ExHtmlReporter($showpasses);
if ($showsearch) {
print_heading('Searching for test cases');
}
flush();
// Work out what to test.
if (substr($path, 0, 1) == '/') {
$path = substr($path, 1);
@@ -71,7 +71,7 @@ if (!is_null($path)) {
print_simple_box(get_string('pathdoesnotexist', $langfile, $path), '', '', '', '', 'errorbox');
$ok = false;
}
// If we have something to test, do it.
if ($ok) {
if ($path == $CFG->dirroot) {
+8 -8
View File
@@ -44,12 +44,12 @@
}
require_capability('moodle/site:viewreport', get_context_instance(CONTEXT_COURSE, $course->id));
add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
stats_check_uptodate($course->id);
// $strreports = get_string("reports");
// $strstats = get_string('stats');
//
@@ -60,12 +60,12 @@
// <a href=\"{$CFG->wwwroot}/admin/report.php\">$strreports</a> ->
// $strstats";
// print_header("$course->shortname: $strstats", "$course->fullname",
// print_header("$course->shortname: $strstats", "$course->fullname",
// $crumb, '', '', true, '&nbsp', $menu);
require_once($CFG->dirroot.'/course/report/stats/report.php');
admin_externalpage_print_footer($adminroot);
?>
+16 -16
View File
@@ -1,7 +1,7 @@
<?php
/**
* this page defines what roles can access (grant user that role and override that roles'
* capabilities in different context. For example, we can say that Teachers can only grant
* this page defines what roles can access (grant user that role and override that roles'
* capabilities in different context. For example, we can say that Teachers can only grant
* student role or modify student role's capabilities. Note that you need both the right
* capability moodle/roles:assign or moodle/roles:manage and this database table roles_deny_grant
* to be able to grant roles. If a user has moodle/roles:manage at site level assignment
@@ -21,20 +21,20 @@
$site = get_site();
$stradministration = get_string('administration');
$strmanageroles = get_string('manageroles');
/// form processiong here
/// get all roles
$roles = get_records('role');
if ($grant = data_submitted()) {
foreach ($grant as $grole => $val) {
if ($grole == 'dummy') {
continue;
continue;
}
$string = explode('_', $grole);
$temp[$string[1]][$string[2]] = 1; // if set, means can access
}
@@ -48,7 +48,7 @@
}
} else { //if set, means can access, attempt to remove it from db
delete_records('role_allow_assign', 'roleid', $srole->id, 'allowassign', $trole->id);
}
}
}
}
}
@@ -64,41 +64,41 @@
$table->cellspacing = 0;
$table->width = '90%';
$table->align[] = 'right';
/// get all the roles identifier
foreach ($roles as $role) {
$rolesname[] = format_string($role->name);
$roleids[] = $role->id;
$table->align[] = 'center';
$table->wrap[] = 'nowrap';
}
}
$table->head = array_merge(array(''), $rolesname);
foreach ($roles as $role) {
$beta = get_box_list($role->id, $roleids);
$table->data[] = array_merge(array(format_string($role->name)), $beta);
}
print_simple_box(get_string('configallowassign', 'admin'), 'center');
echo '<form action="allowassign.php" method="post">';
print_table($table);
echo '<div class="singlebutton"><input type="submit" value="'.get_string('savechanges').'"/></div>';
echo '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
echo '</form>';
admin_externalpage_print_footer($adminroot);
function get_box_list($roleid, $arraylist){
foreach ($arraylist as $targetid) {
if (get_record('role_allow_assign', 'roleid', $roleid, 'allowassign', $targetid)) {
$array[] = '<input type="checkbox" name="s_'.$roleid.'_'.$targetid.'" value="1" checked="checked"/>';
} else {
$array[] = '<input type="checkbox" name="s_'.$roleid.'_'.$targetid.'" value="1" />';
$array[] = '<input type="checkbox" name="s_'.$roleid.'_'.$targetid.'" value="1" />';
}
}
return $array;
+15 -15
View File
@@ -1,6 +1,6 @@
<?php
/**
* this page defines what roles can override (override roles in different context. For example,
* this page defines what roles can override (override roles in different context. For example,
* we can say that Admin can override teacher roles in a course
* To be able to override roles. If a user has moodle/roles:overrde at context level
* and be in the roles_allow_override table.
@@ -19,20 +19,20 @@
$site = get_site();
$stradministration = get_string('administration');
$strmanageroles = get_string('manageroles');
/// form processiong here
/// get all roles
$roles = get_records('role');
if ($grant = data_submitted()) {
foreach ($grant as $grole => $val) {
if ($grole == 'dummy') {
continue;
continue;
}
$string = explode('_', $grole);
$temp[$string[1]][$string[2]] = 1; // if set, means can access
}
@@ -46,14 +46,14 @@
}
} else { //if set, means can access, attempt to remove it from db
delete_records('role_allow_override', 'roleid', $srole->id, 'allowoverride', $trole->id);
}
}
}
}
}
/// displaying form here
admin_externalpage_print_header($adminroot);
$currenttab='allowoverride';
require_once('managetabs.php');
@@ -62,24 +62,24 @@
$table->cellspacing = 0;
$table->width = '90%';
$table->align[] = 'right';
/// get all the roles identifier
foreach ($roles as $role) {
$rolesname[] = format_string($role->name);
$roleids[] = $role->id;
$table->align[] = 'center';
$table->wrap[] = 'nowrap';
}
}
$table->head = array_merge(array(''), $rolesname);
foreach ($roles as $role) {
$beta = get_box_list($role->id, $roleids);
$table->data[] = array_merge(array(format_string($role->name)), $beta);
}
print_simple_box(get_string('configallowoverride', 'admin'), 'center');
echo '<form action="allowoverride.php" method="post">';
print_table($table);
echo '<div class="singlebutton"><input type="submit" value="'.get_string('savechanges').'"/></div>';
@@ -90,12 +90,12 @@
// returns array
function get_box_list($roleid, $arraylist){
foreach ($arraylist as $targetid) {
if (get_record('role_allow_override', 'roleid', $roleid, 'allowoverride', $targetid)) {
$array[] = '<input type="checkbox" name="s_'.$roleid.'_'.$targetid.'" value="1" checked="checked"/>';
} else {
$array[] = '<input type="checkbox" name="s_'.$roleid.'_'.$targetid.'" value="1" />';
$array[] = '<input type="checkbox" name="s_'.$roleid.'_'.$targetid.'" value="1" />';
}
}
return $array;
+4 -4
View File
@@ -26,13 +26,13 @@ if ($userid) {
onFocus="document.studentform.add.disabled=true;
document.studentform.remove.disabled=false;
document.studentform.addselect.selectedIndex=-1;" />
<?php
<?php
foreach ($contextusers as $contextuser) {
$fullname = fullname($contextuser, true);
echo "<option value=\"$contextuser->id\">".$fullname.", ".$contextuser->email."</option>\n";
}
?>
</select></td>
<td valign="top">
<br />
@@ -47,7 +47,7 @@ if ($userid) {
document.studentform.remove.disabled=true;
document.studentform.removeselect.selectedIndex=-1;">
<?php
if (!empty($searchusers)) {
echo "<optgroup label=\"$strsearchresults (" . count($searchusers) . ")\">\n";
foreach ($searchusers as $user) {
@@ -73,7 +73,7 @@ if ($userid) {
?>
</select>
<br />
<input type="text" name="searchtext" size="30" value="<?php p($searchtext, true) ?>"
<input type="text" name="searchtext" size="30" value="<?php p($searchtext, true) ?>"
onFocus ="document.studentform.add.disabled=true;
document.studentform.remove.disabled=true;
document.studentform.removeselect.selectedIndex=-1;
+12 -12
View File
@@ -61,14 +61,14 @@
$strshowall = get_string('showall');
$strparticipants = get_string('participants');
/// Make sure this user can assign that role
if ($roleid) {
if (!user_can_assign($context, $roleid)) {
error ('you can not override this role in this context');
}
}
}
if ($userid) {
@@ -85,14 +85,14 @@
print_header("$fullname", "$fullname",
"<a href=\"../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."&course=".$courseid."\">$fullname</a> ->".$straction,
"", "", true, "&nbsp;", navmenu($course));
/// site header
"", "", true, "&nbsp;", navmenu($course));
/// site header
} else {
print_header("$course->fullname: $fullname", "$course->fullname",
"<a href=\"".$CFG->wwwroot."/user/view.php?id=".$userid."&course=".$courseid."\">$fullname</a> -> $straction", "", "", true, "&nbsp;", navmenu($course));
"<a href=\"".$CFG->wwwroot."/user/view.php?id=".$userid."&course=".$courseid."\">$fullname</a> -> $straction", "", "", true, "&nbsp;", navmenu($course));
}
$showroles = 1;
$currenttab = 'assign';
include_once($CFG->dirroot.'/user/tabs.php');
@@ -162,13 +162,13 @@
$existinguserarray = array();
if (!$contextusers = get_role_users($roleid, $context)) {
$contextusers = array();
$contextusers = array();
}
foreach ($contextusers as $contextuser) {
$existinguserarray[] = $contextuser->id;
}
$existinguserlist = implode(',', $existinguserarray);
unset($existinguserarray);
@@ -191,7 +191,7 @@
}
}
if ($roleid) {
/// prints a form to swap roles
echo '<form name="rolesform" action="assign.php" method="post">';
@@ -231,7 +231,7 @@
$table->head = array(get_string('roles', 'role'), get_string('users'));
$table->wrap = array('nowrap', 'nowrap');
$table->align = array('right', 'center');
foreach ($assignableroles as $roleid => $rolename) {
$countusers = 0;
if ($contextusers = get_role_users($roleid, $context)) {
@@ -239,7 +239,7 @@
}
$table->data[] = array('<a href="assign.php?contextid='.$context->id.'&amp;roleid='.$roleid.$userparam.'">'.$rolename.'</a>', $countusers);
}
print_table($table);
}
+6 -6
View File
@@ -18,7 +18,7 @@
<br />
<?php print_string('roledescription', 'role'); ?>:
<?php print_textarea($usehtmleditor, 10, 50, 50, 10, 'description', $role->description); ?>
<p>
<p>
<table>
<tr>
<td><?php print_string('capability','role') ?></td>
@@ -29,17 +29,17 @@
<td><?php print_string('risks','role') ?></td>
</tr>
<?php
<?php
// init these 2
$contextlevel = 0;
$component = '';
foreach ($capabilities as $capability) {
// prints a breaker if component or name or context level
// prints a breaker if component or name or context level
if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
echo ('<tr><td colspan="4"><strong>'.
get_component_string($capability->component, $capability->contextlevel).'</strong></td></tr>');
get_component_string($capability->component, $capability->contextlevel).'</strong></td></tr>');
}
// these 2 are used to see to group same mod/core capabilities together
@@ -78,8 +78,8 @@ foreach ($capabilities as $capability) {
?></td>
</tr>
<?php } ?>
</table>
<?php } ?>
</table>
</p>
<br />
<input type="submit" value="<?php p($submitlabel); ?>" />
+16 -16
View File
@@ -22,9 +22,9 @@
if ($roleid && $action!='delete') {
$role = get_record('role', 'id', $roleid);
$editingstr = '-> '.get_string('editinga', '', $role->name);
$editingstr = '-> '.get_string('editinga', '', $role->name);
} else {
$editingstr ='';
$editingstr ='';
}
admin_externalpage_print_header($adminroot);
@@ -38,14 +38,14 @@
switch ($action) {
case 'add':
$newrole = create_role($name, $shortname, $description);
$newrole = create_role($name, $shortname, $description);
$ignore = array('roleid', 'sesskey', 'action', 'name', 'description', 'contextid');
$data = data_submitted();
foreach ($data as $capname => $value) {
if (in_array($capname, $ignore)) {
if (in_array($capname, $ignore)) {
continue;
}
@@ -62,7 +62,7 @@
$data = data_submitted();
foreach ($data as $capname => $value) {
if (in_array($capname, $ignore)) {
if (in_array($capname, $ignore)) {
continue;
}
@@ -80,7 +80,7 @@
$localoverride->permission = $value;
$localoverride->timemodified = time();
$localoverride->modifierid = $USER->id;
update_record('role_capabilities', $localoverride);
update_record('role_capabilities', $localoverride);
}
} else { // insert a record
assign_capability($capname, $value, $roleid, $sitecontext->id);
@@ -91,7 +91,7 @@
$role->id = $roleid;
$role->name = $name;
$role->description = $description;
$role->description = $description;
if (!update_record('role', $role)) {
error('Could not update role!');
@@ -100,7 +100,7 @@
break;
case 'delete':
if ($confirm) { // deletes a role
if ($confirm) { // deletes a role
// check for depedencies XXX TODO
@@ -116,18 +116,18 @@
echo ('<input type="hidden" name="roleid" value="'.$roleid.'">');
echo ('<input type="hidden" name="sesskey" value="'.sesskey().'">');
echo ('<input type="hidden" name="confirm" value="1">');
notice_yesno(get_string('deleterolesure', 'role'),
notice_yesno(get_string('deleterolesure', 'role'),
'manage.php?action=delete&roleid='.$roleid.'&sesskey='.sesskey().'&confirm=1', 'manage.php');
admin_externalpage_print_footer($adminroot);
exit;
}
break;
break;
/// add possible positioning switch here
default:
break;
break;
}
@@ -140,8 +140,8 @@
if ($roleid) {
$action='edit';
$role = get_record('role', 'id', $roleid);
} else {
$action='add';
} else {
$action='add';
$role->name='';
$role->shortname='';
$role->description='';
@@ -183,8 +183,8 @@
$table->cellspacing = 0;
$table->width = '90%';
$table->head = array(get_string('roles', 'role'),
get_string('description'),
$table->head = array(get_string('roles', 'role'),
get_string('description'),
get_string('delete'));
/*************************
@@ -195,7 +195,7 @@
$table->data[] = array('<a href="manage.php?roleid='.$role->id.'&amp;sesskey='.sesskey().'">'.format_string($role->name).'</a>', format_text($role->description, FORMAT_HTML), '<a href="manage.php?action=delete&roleid='.$role->id.'&sesskey='.sesskey().'">'.$strdelete.'</a>');
}
}
print_table($table);
$options = new object;
+3 -3
View File
@@ -2,13 +2,13 @@
// this page deals with the 2 tabs for manage.php and grant.php
$toprow[] = new tabobject('manage', $CFG->wwwroot.'/admin/roles/manage.php', get_string('manageroles', 'role'));
$toprow[] = new tabobject('allowassign', $CFG->wwwroot.'/admin/roles/allowassign.php', get_string('allowassign', 'role'));
$toprow[] = new tabobject('allowoverride', $CFG->wwwroot.'/admin/roles/allowoverride.php', get_string('allowoverride', 'role'));
$tabs = array($toprow);
print_tabs($tabs, $currenttab);
?>
+20 -20
View File
@@ -1,4 +1,4 @@
<form action="override.php" method="post">
<form action="override.php" method="post">
<input type="hidden" name="contextid" value="<?php p($contextid) ?>">
<input type="hidden" name="roleid" value="<?php p($roleid) ?>">
<?php
@@ -17,22 +17,22 @@ if ($courseid) {
<td><?php print_string('prohibit','role') ?></td>
<td><?php print_string('risks','role') ?></td>
</tr>
<?php
<?php
// init these 2
$contextlevel = 0;
$component = '';
foreach ($capabilities as $capability) {
// prints a breaker if component or name or context level
// prints a breaker if component or name or context level
if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
echo ('<tr><td colspan="5"><b>'.get_component_string($capability->component, $capability->contextlevel).'</b></td></tr>');
echo ('<tr><td colspan="5"><b>'.get_component_string($capability->component, $capability->contextlevel).'</b></td></tr>');
}
// these 2 are used to see to group same mod/core capabilities together
$contextlevel = $capability->contextlevel;
$component = $capability->component;
// check the capability override for this cap, this role in this context
if (isset($localoverrides[$capability->name])) {
$localpermission = $localoverrides[$capability->name]->permission;
@@ -47,41 +47,41 @@ if ($courseid) {
} else {
$isallow = 0;
$isprevent = 0;
$isprohibit = 0;
$isprohibit = 0;
}
$isdisabled = $isprohibit || islegacy($capability->name);
?>
<tr>
<td><?php echo get_capability_string($capability->name); ?></td>
<td align="center">
<input type="radio" name="<?php echo $capability->name; ?>" value="0"
<?php
if ($localpermission == 0) {echo 'checked="checked"';}
<input type="radio" name="<?php echo $capability->name; ?>" value="0"
<?php
if ($localpermission == 0) {echo 'checked="checked"';}
if ($isdisabled) {echo 'disabled="disabled"';}?> />
</td>
<td align="center" <?php if ($isallow) {echo 'class="capcurrent"';} ?>>
<input type="radio" name="<?php echo $capability->name; ?>"
<?php echo ' value="'.CAP_ALLOW.'"';
if ($localpermission == CAP_ALLOW) {echo ' checked="checked"';}
if ($localpermission == CAP_ALLOW) {echo ' checked="checked"';}
if ($isdisabled) {echo ' disabled="disabled"';}?> />
</td>
<td align="center" <?php if ($isprevent) {echo 'class="capcurrent"';} ?>>
<input type="radio" name="<?php echo $capability->name; ?>"
<input type="radio" name="<?php echo $capability->name; ?>"
<?php echo ' value="'.CAP_PREVENT.'"';
if ($localpermission == CAP_PREVENT) {echo ' checked="checked"';}
if ($localpermission == CAP_PREVENT) {echo ' checked="checked"';}
if ($isdisabled) {echo ' disabled="disabled"';}?> />
</td>
<td align="center" <?php if ($isprohibit) {echo 'class="capcurrent"';} ?>>
<input type="radio" name="<?php echo $capability->name; ?>"
<?php echo ' value="'.CAP_PROHIBIT.'"';
if ($localpermission == CAP_PROHIBIT) {echo ' checked="checked"';}
if ($localpermission == CAP_PROHIBIT) {echo ' checked="checked"';}
if ($isdisabled) {echo ' disabled="disabled"';}?> />
</td>
<td><?php
@@ -102,9 +102,9 @@ if ($courseid) {
}
?></td>
</tr>
<?php } ?>
</table>
<?php } ?>
</table>
<br />
<div align="center"><input type="submit" value="<?php print_string('savechanges') ?>" /></div>
</form>
+30 -30
View File
@@ -1,18 +1,18 @@
<?php
require_once("../../config.php");
$contextid = required_param('contextid',PARAM_INT); // context id
$roleid = optional_param('roleid', 0, PARAM_INT); // required role id
$userid = optional_param('userid', 0, PARAM_INT); // needed for user tabs
$courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tabs
if ($courseid) {
$course = get_record('course', 'id', $courseid);
$course = get_record('course', 'id', $courseid);
} else {
$course = $SITE;
}
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
if ($contextid == $sitecontext->id) {
error ('can not override base role capabilities');
@@ -34,34 +34,34 @@
$context = get_record('context', 'id', $contextid);
$overridableroles = get_overridable_roles($context);
/// Make sure this user can override that role
if ($roleid) {
if (!user_can_override($context, $roleid)) {
error ('you can not override this role in this context');
}
}
}
if ($userid) {
$user = get_record('user', 'id', $userid);
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
}
/// Print the header and tabs
if ($context->aggregatelevel == CONTEXT_USER) {
/// course header
if ($course->id != SITEID) {
print_header("$fullname", "$fullname",
"<a href=\"../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."&course=".$course->id."\">$fullname</a> -> $straction",
"", "", true, "&nbsp;", navmenu($course));
/// site header
"", "", true, "&nbsp;", navmenu($course));
/// site header
} else {
print_header("$course->fullname: $fullname", "$course->fullname",
"<a href=\"".$CFG->wwwroot."/user/view.php?id=".$userid."&course=".$course->id."\">$fullname</a> -> $straction", "", "", true, "&nbsp;", navmenu($course));
"<a href=\"".$CFG->wwwroot."/user/view.php?id=".$userid."&course=".$course->id."\">$fullname</a> -> $straction", "", "", true, "&nbsp;", navmenu($course));
}
$showroles = 1;
$currenttab = 'override';
@@ -76,18 +76,18 @@
/// Process incoming role override
if ($data = data_submitted()) {
$localoverrides = get_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id",
$localoverrides = get_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id",
'', 'capability, permission, id');
foreach ($data as $capname => $value) {
if ($capname == 'contextid' || $capname == 'roleid') { // ignore contextid and roleid
continue;
continue;
}
if (isset($localoverrides[$capname])) { // Something exists, so update it
if ($value == CAP_INHERIT) { // inherit = delete
delete_records('role_capabilities', 'roleid', $roleid, 'contextid', $contextid,
delete_records('role_capabilities', 'roleid', $roleid, 'contextid', $contextid,
'capability', $capname);
} else {
$localoverride = new object;
@@ -95,14 +95,14 @@
$localoverride->permission = $value;
$localoverride->timemodified = time();
$localoverride->modifierid = $USER->id;
if (!update_record('role_capabilities', $localoverride)) {
debugging('Could not update a capability!');
}
}
} else { // insert a record
if ($value != CAP_INHERIT) { // Ignore inherits
$override->capability = $capname;
$override->contextid = $contextid;
@@ -140,12 +140,12 @@
} else {
$parentcontext = $context; // site level in override??
}
$r_caps = role_context_capabilities($roleid, $parentcontext);
$localoverrides = get_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id",
$localoverrides = get_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id",
'', 'capability, permission, id');
// Get the capabilities overrideable in this context
if ($capabilities = fetch_context_capabilities($context)) {
print_simple_box_start("center");
@@ -159,7 +159,7 @@
} else { // Print overview table
$userparam = (!empty($userid)) ? '&amp;userid='.$userid : '';
$table->tablealign = 'center';
$table->cellpadding = 5;
$table->cellspacing = 0;
@@ -167,16 +167,16 @@
$table->head = array(get_string('roles', 'role'), get_string('overrides', 'role'));
$table->wrap = array('nowrap', 'nowrap');
$table->align = array('right', 'center');
foreach ($overridableroles as $roleid => $rolename) {
$countusers = 0;
$overridecount = count_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id");
$table->data[] = array('<a href="override.php?contextid='.$context->id.'&amp;roleid='.$roleid.$userparam.'">'.$rolename.'</a>', $overridecount);
}
print_table($table);
}
print_footer($course);
?>
+18 -18
View File
@@ -71,7 +71,7 @@ if ($currenttab != 'update') {
$blockname = print_context_name($context);
$navigation = $blockname. ' -> '.$straction;
switch ($blockinstance->pagetype) {
switch ($blockinstance->pagetype) {
case 'course-view':
if ($course = get_record('course', 'id', $blockinstance->pageid)) {
if ($course->id != SITEID) {
@@ -111,45 +111,45 @@ if ($context->aggregatelevel != CONTEXT_SYSTEM) { // Print tabs for anything
$toprow[] = new tabobject('update', $CFG->wwwroot.'/course/mod.php?update='.
$context->instanceid.'&amp;return=true&amp;sesskey='.sesskey(), get_string('update'));
}
}
$toprow[] = new tabobject('roles', $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.
$context->id, get_string('roles'));
$context->id, get_string('roles'));
if (isset($tabsmode)) {
if (!isset($assignableroles)) {
$assignableroles = get_assignable_roles($context);
$assignableroles = get_assignable_roles($context);
}
if (!isset($overridableroles)) {
$overridableroles = get_overridable_roles($context);
$overridableroles = get_overridable_roles($context);
}
$inactive[] = 'roles';
if (!empty($assignableroles)) {
$secondrow[] = new tabobject('assign',
$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
get_string('assignroles', 'role'),
get_string('showallroles', 'role'),
true);
$secondrow[] = new tabobject('assign',
$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
get_string('assignroles', 'role'),
get_string('showallroles', 'role'),
true);
}
if (!empty($overridableroles)) {
$secondrow[] = new tabobject('override',
if (!empty($overridableroles)) {
$secondrow[] = new tabobject('override',
$CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id,
get_string('overrideroles', 'role'),
get_string('showallroles', 'role'),
true);
get_string('overrideroles', 'role'),
get_string('showallroles', 'role'),
true);
}
if ($tabsmode == 'override') {
$currenttab = 'override';
$currenttab = 'override';
} elseif ($tabsmode == 'assign') {
$currenttab = 'assign';
$currenttab = 'assign';
}
} else {
$inactive[] = '';
$inactive[] = '';
}
if (!empty($secondrow)) {
+5 -5
View File
@@ -7,7 +7,7 @@ require_once($CFG->dirroot.'/'.$CFG->admin.'/pagelib.php');
if ($site = get_site()) {
require_login();
}
}
page_map_class(PAGE_ADMIN, 'page_admin');
@@ -20,7 +20,7 @@ $PAGE->init_extra($section); // hack alert!
$adminediting = optional_param('adminedit', -1, PARAM_BOOL);
$return = optional_param('return','', PARAM_ALPHA);
if (!isset($USER->adminediting)) {
$USER->adminediting = false;
}
@@ -85,11 +85,11 @@ if ($data = data_submitted()) {
if (!empty($SITE->fullname)) {
$pageblocks = blocks_setup($PAGE);
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
BLOCK_L_MAX_WIDTH);
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
BLOCK_R_MAX_WIDTH);
// print header stuff
$PAGE->print_header();
+3 -3
View File
@@ -22,10 +22,10 @@ $temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'
$temp->add(new admin_setting_special_frontpagedesc());
$temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
$temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
$temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'),
$temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'),
get_string('sitesectionhelp','admin'), 1));
$temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'),
'', 3,
$temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'),
'', 3,
array('0' => '0',
'1' => '1',
'2' => '2',
+3 -3
View File
@@ -12,14 +12,14 @@ $temp->add(new admin_setting_configtext('maxbytes', get_string('maxbytes', 'admi
$temp->add(new admin_setting_configcheckbox('messaging', get_string('messaging', 'admin'), get_string('configmessaging','admin'), 1));
$temp->add(new admin_setting_configcheckbox('allowobjectembed', get_string('allowobjectembed', 'admin'), get_string('configallowobjectembed', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('enabletrusttext', get_string('enabletrusttext', 'admin'), get_string('configenabletrusttext', 'admin'), 0));
$temp->add(new admin_setting_configselect('maxeditingtime', get_string('maxeditingtime','admin'), get_string('configmaxeditingtime','admin'), 1800,
$temp->add(new admin_setting_configselect('maxeditingtime', get_string('maxeditingtime','admin'), get_string('configmaxeditingtime','admin'), 1800,
array(60 => get_string('numminutes', '', 1),
300 => get_string('numminutes', '', 5),
900 => get_string('numminutes', '', 15),
1800 => get_string('numminutes', '', 30),
2700 => get_string('numminutes', '', 45),
3600 => get_string('numminutes', '', 60))));
$temp->add(new admin_setting_configselect('fullnamedisplay', get_string('fullnamedisplay', 'admin'), get_string('configfullnamedisplay', 'admin'),
$temp->add(new admin_setting_configselect('fullnamedisplay', get_string('fullnamedisplay', 'admin'), get_string('configfullnamedisplay', 'admin'),
'firstname lastname', array('language' => get_string('language'),
'firstname lastname' => get_string('firstname') . ' + ' . get_string('lastname'),
'lastname firstname' => get_string('lastname') . ' + ' . get_string('firstname'),
@@ -50,7 +50,7 @@ $temp = new admin_settingpage('modulesecurity', get_string('modulesecurity', 'ad
$temp->add(new admin_setting_configselect('restrictmodulesfor', get_string('restrictmodulesfor', 'admin'), get_string('configrestrictmodulesfor', 'admin'), 'none', array('none' => 'No courses',
'all' => 'All courses',
'requested' => 'Requested courses')));
$temp->add(new admin_setting_configcheckbox('restrictbydefault', get_string('restrictbydefault', 'admin'), get_string('configrestrictbydefault', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('restrictbydefault', get_string('restrictbydefault', 'admin'), get_string('configrestrictbydefault', 'admin'), 0));
if (!$options = get_records("modules")) {
$options = array();
}
+28 -28
View File
@@ -4,8 +4,8 @@
// "systempaths" settingpage
$temp = new admin_settingpage('systempaths', get_string('systempaths','admin'));
$temp->add(new admin_setting_configselect('gdversion', get_string('gdversion','admin'), get_string('configgdversion', 'admin'), check_gd_version(), array('0' => get_string('gdnot'),
'1' => get_string('gd1'),
$temp->add(new admin_setting_configselect('gdversion', get_string('gdversion','admin'), get_string('configgdversion', 'admin'), check_gd_version(), array('0' => get_string('gdnot'),
'1' => get_string('gd1'),
'2' => get_string('gd2'))));
$temp->add(new admin_setting_configtext('zip', get_string('pathtozip','admin'), get_string('configzip', 'admin'), '', PARAM_PATH));
$temp->add(new admin_setting_configtext('unzip', get_string('pathtounzip','admin'), get_string('configunzip', 'admin'), '', PARAM_PATH));
@@ -23,29 +23,29 @@ $temp->add(new admin_setting_configtext('smtppass', get_string('smtppass', 'admi
$temp->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'admin'), get_string('confignoreplyaddress', 'admin'), 'noreply@' . $_SERVER['HTTP_HOST'], PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('allowemailaddresses', get_string('allowemailaddresses', 'admin'), get_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('denyemailaddresses', get_string('denyemailaddresses', 'admin'), get_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS));
$temp->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'admin'), get_string('configdigestmailtime', 'admin'), 17, array('00' => '00',
'01' => '01',
'02' => '02',
'03' => '03',
'04' => '04',
'05' => '05',
'06' => '06',
'07' => '07',
'08' => '08',
'09' => '09',
'10' => '10',
'11' => '11',
'12' => '12',
'13' => '13',
'14' => '14',
'15' => '15',
'16' => '16',
'17' => '17',
'18' => '18',
'19' => '19',
'20' => '20',
'21' => '21',
'22' => '22',
$temp->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'admin'), get_string('configdigestmailtime', 'admin'), 17, array('00' => '00',
'01' => '01',
'02' => '02',
'03' => '03',
'04' => '04',
'05' => '05',
'06' => '06',
'07' => '07',
'08' => '08',
'09' => '09',
'10' => '10',
'11' => '11',
'12' => '12',
'13' => '13',
'14' => '14',
'15' => '15',
'16' => '16',
'17' => '17',
'18' => '18',
'19' => '19',
'20' => '20',
'21' => '21',
'22' => '22',
'23' => '23')));
if (!empty($CFG->unicodedb)) { // These options are only available if running under unicodedb
unset($options);
@@ -88,7 +88,7 @@ $ADMIN->add('server', $temp);
$temp = new admin_settingpage('debugging', get_string('debugging', 'admin'));
$temp->add(new admin_setting_special_debug());
$temp->add(new admin_setting_special_perfdebug());
$ADMIN->add('server', $temp);
$ADMIN->add('server', $temp);
// "stats" settingpage
@@ -116,7 +116,7 @@ $temp->add(new admin_setting_configselect('statsmaxruntime', get_string('statsma
60*60*8 => '8 '.get_string('hours') )));
$temp->add(new admin_setting_configtime('statsruntimestarthour', 'statsruntimestartminute', get_string('statsruntimestart', 'admin'), get_string('configstatsruntimestart', 'admin'), array('h' => 0, 'm' => 0)));
$temp->add(new admin_setting_configtext('statsuserthreshold', get_string('statsuserthreshold', 'admin'), get_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
$ADMIN->add('server', $temp);
$ADMIN->add('server', $temp);
// "http" settingpage
@@ -125,7 +125,7 @@ $temp->add(new admin_setting_configtext('framename', get_string('framename', 'ad
$temp->add(new admin_Setting_configcheckbox('slasharguments', get_string('slasharguments', 'admin'), get_string('configslasharguments', 'admin'), 1));
$temp->add(new admin_setting_configtext('proxyhost', get_string('proxyhost', 'admin'), get_string('configproxyhost', 'admin'), '', PARAM_HOST));
$temp->add(new admin_setting_configtext('proxyport', get_string('proxyport', 'admin'), get_string('configproxyport', 'admin'), '', PARAM_INT));
$ADMIN->add('server', $temp);
$ADMIN->add('server', $temp);
$ADMIN->add('server', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID));
+5 -5
View File
@@ -33,17 +33,17 @@ if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW
}
$assignableroles = get_assignable_roles($context);
$temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'),
$temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'),
get_string('confignotloggedinroleid', 'admin'), $guestrole->id, $assignableroles ));
$temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'),
$temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'),
get_string('configdefaultuserroleid', 'admin'), $guestrole->id, $assignableroles));
$temp->add(new admin_setting_configselect('defaultcourseroleid', get_string('defaultcourseroleid', 'admin'),
$temp->add(new admin_setting_configselect('defaultcourseroleid', get_string('defaultcourseroleid', 'admin'),
get_string('configdefaultcourseroleid', 'admin'), $studentrole->id, $assignableroles));
//$temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
//$temp->add(new admin_setting_configcheckbox('allusersaresitestudents', get_string('allusersaresitestudents', 'admin'), get_string('configallusersaresitestudents','admin'), 1));
$temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'),
get_string('confighiddenuserfields', 'admin'), array(),
$temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'),
get_string('confighiddenuserfields', 'admin'), array(),
array('none' => get_string('none'),
'description' => get_string('description'),
'city' => get_string('city'),
+8 -8
View File
@@ -1,6 +1,6 @@
<?php // $Id$
// detects settings that were added during an upgrade, displays a screen for the admin to
// detects settings that were added during an upgrade, displays a screen for the admin to
// modify them, and then processes modifications
require_once('../config.php');
@@ -18,7 +18,7 @@ $newsettingshtml = output_new_settings_by_page(admin_get_root());
// first we deal with the case where there are no new settings to be set
if ($newsettingshtml == '') {
redirect($CFG->wwwroot . '/' . $CFG->admin . '/index.php');
redirect($CFG->wwwroot . '/' . $CFG->admin . '/index.php');
die;
}
@@ -74,7 +74,7 @@ admin_externalpage_print_footer($adminroot);
/**
* Find settings that have not been initialized (e.g. during initial install or an upgrade).
*
*
* Tests each setting's get_setting() method. If the result is NULL, we consider the setting
* to be uninitialized.
*
@@ -90,9 +90,9 @@ function find_new_settings(&$node) {
$return = array_merge($return, find_new_settings($node->children[$entry]));
}
return $return;
}
}
if (is_a($node, 'admin_settingpage')) {
if (is_a($node, 'admin_settingpage')) {
$return = array();
foreach ($node->settings as $setting) {
if ($setting->get_setting() === NULL) {
@@ -117,9 +117,9 @@ function output_new_settings_by_page(&$node) {
$return .= output_new_settings_by_page($node->children[$entry]);
}
return $return;
}
}
if (is_a($node, 'admin_settingpage')) {
if (is_a($node, 'admin_settingpage')) {
$newsettings = array();
foreach ($node->settings as $setting) {
if ($setting->get_setting() === NULL) {
@@ -133,7 +133,7 @@ function output_new_settings_by_page(&$node) {
$return = '<tr><td colspan="2"><strong>' . $node->visiblename . '</strong></td></tr>';
foreach ($newsettings as $newsetting) {
$return .= $newsetting->output_html();
}
}
}
return $return;
}
+7 -7
View File
@@ -34,7 +34,7 @@ Ciao, Eloy Lafuente (stronk7)
2006-07-11 - Important notes
I've just discovered this some seconds ago, in order
I've just discovered this some seconds ago, in order
to test properly the XMLDB classes and editor:
1.- PHP 5 required for now. Will change this soon.
@@ -48,8 +48,8 @@ Ciao, Eloy Lafuente (stronk7)
2006-07-11 - Initial commit
This directory contains the XMLDB classes to be used
under Moodle > 1.7 to store all the DB info in a
This directory contains the XMLDB classes to be used
under Moodle > 1.7 to store all the DB info in a
neutral form (classes dir). Also it contains one simple
interface to edit all those structures.
@@ -58,7 +58,7 @@ under your moodle/admin dir and point your browser (as admin)
to http://your.server/moodle/admin/xmldb
The edition interface isn't completed yet (it laks 3 more forms
to edit fields, keys and indexes) and there isn't any lang file
to edit fields, keys and indexes) and there isn't any lang file
(although I hope everything is really clear).
The edition interface includes one reverse-engineering tool that
@@ -69,10 +69,10 @@ Once the XMLDB format was approved, we'll be able to build all the
"generators" needed in order to use it to create Moodle DB structures
for each RDBMS flavour.
Once the interface was finished (2-3 days from now) related documentation
will be sent to http://docs.moodle.org/en/XML_database_schema in order
Once the interface was finished (2-3 days from now) related documentation
will be sent to http://docs.moodle.org/en/XML_database_schema in order
to comment/modify/approve the final XML format.
All the code is, obviously GPL, with its copyrights and so on...
All the code is, obviously GPL, with its copyrights and so on...
Ciao, Eloy Lafuente (stronk7) :-)
+11 -11
View File
@@ -24,7 +24,7 @@
// //
///////////////////////////////////////////////////////////////////////////
/// This is the main action class. It implements all the basic
/// This is the main action class. It implements all the basic
/// functionalities to be shared by each action.
class XMLDBAction {
@@ -58,11 +58,11 @@ class XMLDBAction {
* Constructor to keep PHP5 happy
*/
function __construct() {
$this->XMLDBAction();
$this->XMLDBAction();
}
/**
* Init method, every subclass will have its own,
/**
* Init method, every subclass will have its own,
* always calling the parent one
*/
function init() {
@@ -73,7 +73,7 @@ class XMLDBAction {
$this->errormsg = NULL;
$this->subaction = NULL;
}
/**
* returns the type of output of the file
*/
@@ -98,14 +98,14 @@ class XMLDBAction {
}
/**
* getPostAtion method, returns the action to launch after executing
* getPostAtion method, returns the action to launch after executing
* another one
*/
function getPostAction() {
return $this->postaction;
}
/**
/**
* getTitle method returns the title of the action (that is part
* of the $str array attribute
*/
@@ -131,18 +131,18 @@ class XMLDBAction {
/**
* main invoke method, it simply sets the postaction attribute
* if possible
* if possible
*/
function invoke() {
global $SESSION;
/// If we are used any dir, save it in the lastused session object
/// Some actions can use it to perform positioning
if ($lastused = optional_param ('dir', NULL, PARAM_PATH)) {
$SESSION->lastused = stripslashes_safe($lastused);
}
$this->postaction = optional_param ('postaction', NULL, PARAM_ALPHAEXT);
/// Avoid being recursive
if ($this->title == $this->postaction) {
@@ -166,7 +166,7 @@ class XMLDBAction {
$result = false;
if (file_exists($actionpath) && is_readable($actionpath)) {
require_once($actionpath);
if ($xmldb_action = new $action) {
if ($xmldb_action = new $action) {
$result = $xmldb_action->invoke();
if ($result) {
if ($xmldb_action->does_generate != ACTION_NONE &&
@@ -24,11 +24,11 @@
// //
///////////////////////////////////////////////////////////////////////////
/// This class will
/// This class will
class create_xml_file extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -75,7 +75,7 @@ class create_xml_file extends XMLDBAction {
$xmlcomment = 'XMLDB file for Moodle ' . dirname($xmlpath);
$xmltable = strtolower(basename(dirname($xmlpath)));
/// Initial contents
$c = '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
$c.= ' <XMLDB PATH="' . $xmlpath . '" VERSION="' . $xmlversion .'" COMMENT="' . $xmlcomment .'">' . "\n";
@@ -28,7 +28,7 @@
class delete_field extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -115,7 +115,7 @@ class delete_field extends XMLDBAction {
/// Recalculate the hash
$structure->calculateHash(true);
/// If the hash has changed from the original one, change the version
/// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
@@ -129,7 +129,7 @@ class delete_field extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class delete_index extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -115,7 +115,7 @@ class delete_index extends XMLDBAction {
/// Recalculate the hash
$structure->calculateHash(true);
/// If the hash has changed from the original one, change the version
/// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
@@ -129,7 +129,7 @@ class delete_index extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class delete_key extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -115,7 +115,7 @@ class delete_key extends XMLDBAction {
/// Recalculate the hash
$structure->calculateHash(true);
/// If the hash has changed from the original one, change the version
/// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
@@ -129,7 +129,7 @@ class delete_key extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class delete_sentence extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -108,7 +108,7 @@ class delete_sentence extends XMLDBAction {
/// Recalculate the hash
$structure->calculateHash(true);
/// If the hash has changed from the original one, change the version
/// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
@@ -122,7 +122,7 @@ class delete_sentence extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class delete_statement extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -104,7 +104,7 @@ class delete_statement extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class delete_table extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -104,7 +104,7 @@ class delete_table extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class delete_xml_file extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -100,7 +100,7 @@ class delete_xml_file extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class edit_field extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -193,7 +193,7 @@ class edit_field extends XMLDBAction {
$this->output = $o;
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
+1 -1
View File
@@ -27,7 +27,7 @@
/// Register the needed events
onload=function() {
onload=function() {
/// Adjust the form on load
transformForm();
@@ -28,7 +28,7 @@
class edit_field_save extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -152,7 +152,7 @@ class edit_field_save extends XMLDBAction {
$length > 0 && $length <= 20)) {
$errors[] = $this->str['integerincorrectlength'];
}
if (!(empty($default) || (is_numeric($default) &&
if (!(empty($default) || (is_numeric($default) &&
!empty($default) &&
intval($default)==floatval($default)))) {
$errors[] = $this->str['defaultincorrect'];
@@ -164,35 +164,35 @@ class edit_field_save extends XMLDBAction {
$length > 0 && $length <= 20)) {
$errors[] = $this->str['numberincorrectlength'];
}
if (!(empty($decimals) || (is_numeric($decimals) &&
!empty($decimals) &&
if (!(empty($decimals) || (is_numeric($decimals) &&
!empty($decimals) &&
intval($decimals)==floatval($decimals) &&
$decimals >= 0 &&
$decimals >= 0 &&
$decimals < $length))) {
$errors[] = $this->str['numberincorrectdecimals'];
}
if (!(empty($default) || (is_numeric($default) &&
if (!(empty($default) || (is_numeric($default) &&
!empty($default)))) {
$errors[] = $this->str['defaultincorrect'];
}
}
/// Float checks
if ($type == XMLDB_TYPE_FLOAT) {
if (!(empty($length) || (is_numeric($length) &&
!empty($length) &&
if (!(empty($length) || (is_numeric($length) &&
!empty($length) &&
intval($length)==floatval($length) &&
$length > 0 &&
$length > 0 &&
$length <= 20))) {
$errors[] = $this->str['floatincorrectlength'];
}
if (!(empty($decimals) || (is_numeric($decimals) &&
!empty($decimals) &&
if (!(empty($decimals) || (is_numeric($decimals) &&
!empty($decimals) &&
intval($decimals)==floatval($decimals) &&
$decimals >= 0 &&
$decimals >= 0 &&
$decimals < $length))) {
$errors[] = $this->str['floatincorrectdecimals'];
}
if (!(empty($default) || (is_numeric($default) &&
if (!(empty($default) || (is_numeric($default) &&
!empty($default)))) {
$errors[] = $this->str['defaultincorrect'];
}
@@ -259,7 +259,7 @@ class edit_field_save extends XMLDBAction {
}
} else {
$enumerr = true;
}
}
if ($enumerr) {
$errors[] = $this->str['enumvaluesincorrect'];
} else {
@@ -283,8 +283,8 @@ class edit_field_save extends XMLDBAction {
$tempfield->setDefault($default);
/// Prepare the output
$site = get_site();
print_header("$site->shortname: XMLDB",
"$site->fullname",
print_header("$site->shortname: XMLDB",
"$site->fullname",
"<a href=\"../index.php\">" . $this->str['administration'] . "</a> -> <a href=\"index.php\">XMLDB</a>");
notice ('<p>' .implode(', ', $errors) . '</p>
<p>' . $tempfield->readableInfo(),
@@ -309,8 +309,8 @@ class edit_field_save extends XMLDBAction {
$next->setChanged(true);
}
}
/// Set comment
/// Set comment
$field->setComment($comment);
/// Set the rest of fields
@@ -323,7 +323,7 @@ class edit_field_save extends XMLDBAction {
$field->setEnum($enum);
$field->setEnumValues($enumvalues);
$field->setDefault($default);
/// If the hash has changed from the old one, change the version
/// and mark the structure as changed
$field->calculateHash(true);
@@ -338,7 +338,7 @@ class edit_field_save extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
}
@@ -28,7 +28,7 @@
class edit_index extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -148,7 +148,7 @@ class edit_index extends XMLDBAction {
$this->output = $o;
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class edit_index_save extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -164,8 +164,8 @@ class edit_index_save extends XMLDBAction {
$tempindex->setFields($fieldsarr);
/// Prepare the output
$site = get_site();
print_header("$site->shortname: XMLDB",
"$site->fullname",
print_header("$site->shortname: XMLDB",
"$site->fullname",
"<a href=\"../index.php\">" . $this->str['administration'] . "</a> -> <a href=\"index.php\">XMLDB</a>");
notice ('<p>' .implode(', ', $errors) . '</p>
<p>' . $tempindex->readableInfo(),
@@ -190,14 +190,14 @@ class edit_index_save extends XMLDBAction {
$next->setChanged(true);
}
}
/// Set comment
/// Set comment
$index->setComment($comment);
/// Set the rest of fields
$index->setUnique($unique);
$index->setFields($fieldsarr);
/// If the hash has changed from the old one, change the version
/// and mark the structure as changed
$index->calculateHash(true);
@@ -212,7 +212,7 @@ class edit_index_save extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
}
@@ -28,7 +28,7 @@
class edit_key extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -160,7 +160,7 @@ class edit_key extends XMLDBAction {
$this->output = $o;
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
+1 -1
View File
@@ -27,7 +27,7 @@
/// Register the needed events
onload=function() {
onload=function() {
/// Adjust the form on load
transformForm();
@@ -28,7 +28,7 @@
class edit_key_save extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -187,11 +187,11 @@ class edit_key_save extends XMLDBAction {
/// Check reftable is not empty
if (empty($reftable)) {
$errors[] = $this->str['noreftablespecified'];
} else
} else
/// Check reffields are not empty
if (empty($reffieldsarr[0])) {
$errors[] = $this->str['noreffieldsspecified'];
} else
} else
/// Check the number of fields is correct
if (count($fieldsarr) != count($reffieldsarr)) {
$errors[] = $this->str['wrongnumberofreffields'];
@@ -240,8 +240,8 @@ class edit_key_save extends XMLDBAction {
}
/// Prepare the output
$site = get_site();
print_header("$site->shortname: XMLDB",
"$site->fullname",
print_header("$site->shortname: XMLDB",
"$site->fullname",
"<a href=\"../index.php\">" . $this->str['administration'] . "</a> -> <a href=\"index.php\">XMLDB</a>");
notice ('<p>' .implode(', ', $errors) . '</p>
<p>' . $tempkey->readableInfo(),
@@ -266,8 +266,8 @@ class edit_key_save extends XMLDBAction {
$next->setChanged(true);
}
}
/// Set comment
/// Set comment
$key->setComment($comment);
/// Set the rest of fields
@@ -278,7 +278,7 @@ class edit_key_save extends XMLDBAction {
$key->setRefTable($reftable);
$key->setRefFields($reffieldsarr);
}
/// If the hash has changed from the old one, change the version
/// and mark the structure as changed
$key->calculateHash(true);
@@ -293,7 +293,7 @@ class edit_key_save extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
}
@@ -28,7 +28,7 @@
class edit_sentence extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -137,12 +137,12 @@ class edit_sentence extends XMLDBAction {
$b .= '&nbsp;<a href="index.php?action=edit_statement&amp;statement=' . urlencode($statementparam) . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a>';
$b .= '</p>';
$o .= $b;
$this->output = $o;
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class edit_sentence_save extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -116,12 +116,12 @@ class edit_sentence_save extends XMLDBAction {
if ($result && count($fields) != count($values)) {
$errors[] = $this->str['wrongnumberoffieldsorvalues'];
}
if (!empty($errors)) {
/// Prepare the output
$site = get_site();
print_header("$site->shortname: XMLDB",
"$site->fullname",
print_header("$site->shortname: XMLDB",
"$site->fullname",
"<a href=\"../index.php\">" . $this->str['administration'] . "</a> -> <a href=\"index.php\">XMLDB</a>");
notice ('<p>' .implode(', ', $errors) . '</p>
<p>' . s($sentence),
@@ -132,7 +132,7 @@ class edit_sentence_save extends XMLDBAction {
/// Continue if we aren't under errors
if (empty($errors)) {
$sentences[$sentenceparam] = $sentence;
/// If the sentence has changed from the old one, change the version
/// and mark the statement and structure as changed
if ($oldsentence != $sentence) {
@@ -143,7 +143,7 @@ class edit_sentence_save extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
}
@@ -28,7 +28,7 @@
class edit_statement extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -138,7 +138,7 @@ class edit_statement extends XMLDBAction {
///$statement->deleteSentence('changeme');
/// Add the fields list
$sentences =& $statement->getSentences();
$sentences =& $statement->getSentences();
if (!empty($sentences)) {
$o .= '<h3 class="main">' . $this->str['sentences'] . '</h3>';
$o .= '<table id="listfields" border="0" align="center" cellpadding="5" cellspacing="1" class="flexible">';
@@ -162,7 +162,7 @@ class edit_statement extends XMLDBAction {
$b .= '<a href="index.php?action=delete_sentence&amp;sentence=' . $key . '&amp;statement=' . urlencode($statement->getName()) . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
$b .= '</td>';
/// Print table row
$o .= '<tr class="r' . $row . '"><td class="table cell">' . $p . $sentence . $b . '</tr>';
$o .= '<tr class="r' . $row . '"><td class="table cell">' . $p . $sentence . $b . '</tr>';
$row = ($row + 1) % 2;
}
$o .= '</table>';
@@ -171,7 +171,7 @@ class edit_statement extends XMLDBAction {
$this->output = $o;
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -29,7 +29,7 @@
class edit_statement_save extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -93,11 +93,11 @@ class edit_statement_save extends XMLDBAction {
}
}
/// Set comment
/// Set comment
$statement->setComment($comment);
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class edit_table extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -167,7 +167,7 @@ class edit_table extends XMLDBAction {
$table->deleteIndex('changeme');
/// Add the fields list
$fields =& $table->getFields();
$fields =& $table->getFields();
if (!empty($fields)) {
$o .= '<h3 class="main">' . $this->str['fields'] . '</h3>';
$o .= '<table id="listfields" border="0" align="center" cellpadding="5" cellspacing="1" class="flexible">';
@@ -197,7 +197,7 @@ class edit_table extends XMLDBAction {
}
$b .= '</td><td class="button cell">';
/// The delete button (if we have more than one and it isn't used
if (count($fields) > 1 &&
if (count($fields) > 1 &&
!$structure->getFieldUses($table->getName(), $field->getName())) {
$b .= '<a href="index.php?action=delete_field&amp;field=' . $field->getName() . '&amp;table=' . $table->getName() . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
} else {
@@ -210,13 +210,13 @@ class edit_table extends XMLDBAction {
/// The readable info
$r = '</td><td class="readableinfo cell">' . $field->readableInfo() . '</td>';
/// Print table row
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_field_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;field=' . $field->getName() . '&amp;table=' . $table->getName() . '&amp;select=edited" target="_blank">' . $field->getName() . '</a>' . $b . $r . '</tr>';
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_field_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;field=' . $field->getName() . '&amp;table=' . $table->getName() . '&amp;select=edited" target="_blank">' . $field->getName() . '</a>' . $b . $r . '</tr>';
$row = ($row + 1) % 2;
}
$o .= '</table>';
}
/// Add the keys list
$keys =& $table->getKeys();
$keys =& $table->getKeys();
if (!empty($keys)) {
$o .= '<h3 class="main">' . $this->str['keys'] . '</h3>';
$o .= '<table id="listkeys" border="0" align="center" cellpadding="5" cellspacing="1" class="flexible">';
@@ -254,13 +254,13 @@ class edit_table extends XMLDBAction {
/// The readable info
$r = '</td><td class="readableinfo cell">' . $key->readableInfo() . '</td>';
/// Print table row
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_key_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;key=' . $key->getName() . '&amp;table=' . $table->getName() . '&amp;select=edited" target="_blank">' . $key->getName() . '</a>' . $b . $r .'</tr>';
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_key_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;key=' . $key->getName() . '&amp;table=' . $table->getName() . '&amp;select=edited" target="_blank">' . $key->getName() . '</a>' . $b . $r .'</tr>';
$row = ($row + 1) % 2;
}
$o .= '</table>';
}
/// Add the indexes list
$indexes =& $table->getIndexes();
$indexes =& $table->getIndexes();
if (!empty($indexes)) {
$o .= '<h3 class="main">' . $this->str['indexes'] . '</h3>';
$o .= '<table id="listindexes" border="0" align="center" cellpadding="5" cellspacing="1" class="flexible">';
@@ -290,7 +290,7 @@ class edit_table extends XMLDBAction {
/// The readable info
$r = '</td><td class="readableinfo cell">' . $index->readableInfo() . '</td>';
/// Print table row
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_index_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;index=' . $index->getName() . '&amp;table=' . $table->getName() . '&amp;select=edited" target="_blank">' . $index->getName() . '</a>' . $b . $r .'</tr>';
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_index_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;index=' . $index->getName() . '&amp;table=' . $table->getName() . '&amp;select=edited" target="_blank">' . $index->getName() . '</a>' . $b . $r .'</tr>';
$row = ($row + 1) % 2;
}
$o .= '</table>';
@@ -299,7 +299,7 @@ class edit_table extends XMLDBAction {
$this->output = $o;
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -29,7 +29,7 @@
class edit_table_save extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -127,11 +127,11 @@ class edit_table_save extends XMLDBAction {
}
}
/// Set comment
/// Set comment
$table->setComment($comment);
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class edit_xml_file extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -155,7 +155,7 @@ class edit_xml_file extends XMLDBAction {
sort($reserved_words);
$reserved_words = array_unique($reserved_words);
/// Add the tables list
$tables =& $structure->getTables();
$tables =& $structure->getTables();
if ($tables) {
$o .= '<h3 class="main">' . $this->str['tables'] . '</h3>';
$o .= '<table id="listtables" border="0" align="center" cellpadding="5" cellspacing="1" class="flexible">';
@@ -194,13 +194,13 @@ class edit_xml_file extends XMLDBAction {
}
$b .= '</td>';
/// Print table row
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_table_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;table=' . $table->getName() . '&amp;select=edited" target="_blank">' . $table->getName() . '</a>' . $b . '</tr>';
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_table_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;table=' . $table->getName() . '&amp;select=edited" target="_blank">' . $table->getName() . '</a>' . $b . '</tr>';
$row = ($row + 1) % 2;
}
$o .= '</table>';
}
///Add the statements list
$statements =& $structure->getStatements();
$statements =& $structure->getStatements();
if ($statements) {
$o .= '<h3 class="main">' . $this->str['statements'] . '</h3>';
$o .= '<table id="liststatements" border="0" align="center" cellpadding="5" cellspacing="1" class="flexible">';
@@ -229,7 +229,7 @@ class edit_xml_file extends XMLDBAction {
$b .= '<a href="index.php?action=delete_statement&amp;statement=' . $statement->getName() . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
$b .= '</td>';
/// Print statement row
$o .= '<tr class="r' . $row . '"><td class="statement cell"><a href="index.php?action=view_statement_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;statement=' . $statement->getName() . '&amp;select=edited" target="_blank">' . $statement->getName() . '</a>' . $b . '</tr>';
$o .= '<tr class="r' . $row . '"><td class="statement cell"><a href="index.php?action=view_statement_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;statement=' . $statement->getName() . '&amp;select=edited" target="_blank">' . $statement->getName() . '</a>' . $b . '</tr>';
$row = ($row + 1) % 2;
}
$o .= '</table>';
@@ -28,7 +28,7 @@
class edit_xml_file_save extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -89,7 +89,7 @@ class edit_xml_file_save extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -24,12 +24,12 @@
// //
///////////////////////////////////////////////////////////////////////////
/// This class will check all the db directories existing under the
/// This class will check all the db directories existing under the
/// current Moodle installation, sending them to the SESSION->dbdirs array
class get_db_directories extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -89,7 +89,7 @@ class get_db_directories extends XMLDBAction {
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
}
}
/// Now, question types (question/type/xxx/db)
if ($plugins = get_list_of_plugins('question/type')) {
foreach ($plugins as $plugin) {
@@ -101,7 +101,7 @@ class get_db_directories extends XMLDBAction {
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
}
}
/// Now, backup/restore stuff (backup/db)
$dbdir = new stdClass;
$dbdir->path = $CFG->dirroot . '/backup/db';
@@ -129,7 +129,7 @@ class get_db_directories extends XMLDBAction {
$XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path); //Update status
}
}
/// Now, enrolment plugins (enrol/xxx/db)
if ($plugins = get_list_of_plugins('enrol', 'db')) {
foreach ($plugins as $plugin) {
@@ -143,7 +143,7 @@ class get_db_directories extends XMLDBAction {
}
/// Sort by key
ksort($XMLDB->dbdirs);
/// Return ok if arrived here
return true;
}
@@ -28,7 +28,7 @@
class load_xml_file extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -28,7 +28,7 @@
class load_xml_files extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -28,7 +28,7 @@
class main_view extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -28,7 +28,7 @@
class move_updown_field extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -119,7 +119,7 @@ class move_updown_field extends XMLDBAction {
/// Table has changed
$table->setChanged(true);
/// Reorder the fields
$table->orderFields($fields);
@@ -135,7 +135,7 @@ class move_updown_field extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class move_updown_index extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -119,7 +119,7 @@ class move_updown_index extends XMLDBAction {
/// Table has changed
$table->setChanged(true);
/// Reorder the indexes
$table->orderIndexes($indexes);
@@ -135,7 +135,7 @@ class move_updown_index extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class move_updown_key extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -119,7 +119,7 @@ class move_updown_key extends XMLDBAction {
/// Table has changed
$table->setChanged(true);
/// Reorder the keys
$table->orderKeys($keys);
@@ -135,7 +135,7 @@ class move_updown_key extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class move_updown_statement extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -112,7 +112,7 @@ class move_updown_statement extends XMLDBAction {
/// Statement has changed
$statement->setChanged(true);
/// Reorder the structure
$structure->orderStatements($statements);
/// Send statements back to structure (the order above break refs)
@@ -129,7 +129,7 @@ class move_updown_statement extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class move_updown_table extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -112,7 +112,7 @@ class move_updown_table extends XMLDBAction {
/// Table has changed
$table->setChanged(true);
/// Reorder the structure
$structure->orderTables($tables);
/// Send tables back to structure (the order above break refs)
@@ -129,7 +129,7 @@ class move_updown_table extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class new_field extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -98,7 +98,7 @@ class new_field extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class new_index extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -97,7 +97,7 @@ class new_index extends XMLDBAction {
$structure->setChanged(true);
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class new_key extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -97,7 +97,7 @@ class new_key extends XMLDBAction {
$structure->setChanged(true);
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -30,7 +30,7 @@
class new_sentence extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -109,7 +109,7 @@ class new_sentence extends XMLDBAction {
$structure->setChanged(true);
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -29,7 +29,7 @@
class new_statement extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -116,7 +116,7 @@ class new_statement extends XMLDBAction {
$this->output = $o;
/// If table, retrofit information and, if everything works,
/// If table, retrofit information and, if everything works,
/// go to the table edit action
} else {
/// Get some params (table is mandatory here)
@@ -150,7 +150,7 @@ class new_statement extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class new_table extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -110,7 +110,7 @@ class new_table extends XMLDBAction {
$structure->addTable($table);
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -24,12 +24,12 @@
// //
///////////////////////////////////////////////////////////////////////////
/// This class will ask and retrofit all the information from one
/// This class will ask and retrofit all the information from one
/// mysql table present in the Moodle DB to one XMLDBTable structure
class new_table_from_mysql extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -120,7 +120,7 @@ class new_table_from_mysql extends XMLDBAction {
$this->output = $o;
/// If table, retrofit information and, if everything works,
/// If table, retrofit information and, if everything works,
/// go to the table edit action
} else {
/// Get some params (table is mandatory here)
@@ -180,7 +180,7 @@ class new_table_from_mysql extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class revert_changes extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -106,7 +106,7 @@ class revert_changes extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class save_xml_file extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -64,7 +64,7 @@ class save_xml_file extends XMLDBAction {
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
/// Get the edited dir
/// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
@@ -102,7 +102,7 @@ class save_xml_file extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -24,11 +24,11 @@
// //
///////////////////////////////////////////////////////////////////////////
/// This class will
/// This class will
class template extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -80,7 +80,7 @@ class template extends XMLDBAction {
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
+2 -2
View File
@@ -29,7 +29,7 @@
class test extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -185,7 +185,7 @@ class test extends XMLDBAction {
$this->output = $o;
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class unload_xml_file extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -86,7 +86,7 @@ class unload_xml_file extends XMLDBAction {
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class view_field_xml extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -28,7 +28,7 @@
class view_index_xml extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -28,7 +28,7 @@
class view_key_xml extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -31,7 +31,7 @@
class view_reserved_words extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -93,7 +93,7 @@ class view_reserved_words extends XMLDBAction {
}
}
$wronguses[] = $this->str['table'] . ' - ' . $table . ' (' . implode(', ',$list_of_db) . ')';
}
$dbfields = $db->MetaColumns($dbtable);
if ($dbfields) {
@@ -142,7 +142,7 @@ class view_reserved_words extends XMLDBAction {
$this->output = $o;
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class view_statement_xml extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -29,7 +29,7 @@
class view_structure_php extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -78,7 +78,7 @@ class view_structure_php extends XMLDBAction {
$structure =& $editeddir->xml_file->getStructure();
}
/// ADD YOUR CODE HERE
$tables =& $structure->getTables();
$table = reset($tables);
$defaulttable = null;
@@ -97,7 +97,7 @@ class view_structure_php extends XMLDBAction {
$o = $b;
/// Calculate the popup of commands
$commands = array('create_table',
$commands = array('create_table',
'drop_table',
'rename_table');
foreach ($commands as $command) {
@@ -136,7 +136,7 @@ class view_structure_php extends XMLDBAction {
$this->output = $o;
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -145,9 +145,9 @@ class view_structure_php extends XMLDBAction {
}
/**
* This function will generate all the PHP code needed to
* This function will generate all the PHP code needed to
* create one table using XMLDB objects and functions
*
*
* @param XMLDBStructure structure object containing all the info
* @param string table table code to be created
* @return string PHP code to be used to create the table
@@ -220,9 +220,9 @@ class view_structure_php extends XMLDBAction {
}
/**
* This function will generate all the PHP code needed to
* This function will generate all the PHP code needed to
* drop one table using XMLDB objects and functions
*
*
* @param XMLDBStructure structure object containing all the info
* @param string table table code to be dropped
* @return string PHP code to be used to drop the table
@@ -258,9 +258,9 @@ class view_structure_php extends XMLDBAction {
}
/**
* This function will generate all the PHP code needed to
* This function will generate all the PHP code needed to
* rename one table using XMLDB objects and functions
*
*
* @param XMLDBStructure structure object containing all the info
* @param string table table code to be renamed
* @return string PHP code to be used to rename the table
@@ -29,7 +29,7 @@
class view_structure_sql extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -123,7 +123,7 @@ class view_structure_sql extends XMLDBAction {
$this->output = $o;
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class view_structure_xml extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -29,7 +29,7 @@
class view_table_php extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -82,7 +82,7 @@ class view_table_php extends XMLDBAction {
/// ADD YOUR CODE HERE
$tableparam = required_param('table', PARAM_PATH);
$table =& $structure->getTable($tableparam);
$fields = $table->getFields();
$field = reset($fields);
@@ -108,7 +108,7 @@ class view_table_php extends XMLDBAction {
$o .= '<h3 class="main">' . $this->str['table'] . ': ' . s($tableparam) . '</h3>';
/// Calculate the popup of commands
$commands = array('add_field',
$commands = array('add_field',
'drop_field',
'rename_field');
foreach ($commands as $command) {
@@ -171,7 +171,7 @@ class view_table_php extends XMLDBAction {
$this->output = $o;
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -180,9 +180,9 @@ class view_table_php extends XMLDBAction {
}
/**
* This function will generate all the PHP code needed to
* This function will generate all the PHP code needed to
* create one field using XMLDB objects and functions
*
*
* @param XMLDBStructure structure object containing all the info
* @param string table table name
* @param string field field name to be created
@@ -224,9 +224,9 @@ class view_table_php extends XMLDBAction {
}
/**
* This function will generate all the PHP code needed to
* This function will generate all the PHP code needed to
* drop one field using XMLDB objects and functions
*
*
* @param XMLDBStructure structure object containing all the info
* @param string table table name
* @param string field field name to be dropped
@@ -267,9 +267,9 @@ class view_table_php extends XMLDBAction {
}
/**
* This function will generate all the PHP code needed to
* This function will generate all the PHP code needed to
* rename one field using XMLDB objects and functions
*
*
* @param XMLDBStructure structure object containing all the info
* @param string table table name
* @param string field field name to be renamed
@@ -33,13 +33,13 @@
/**
* This function disables some elements from the fields/keys/indexes drop down
*/
function disablePopupHeads() {
var popup = document.getElementById("menufieldkeyindex");
var i = popup.length;
while (i--) {
option = popup[i];
if (option.value == "fieldshead" || option.value == "keyshead" || option.value == "indexeshead") {
popup[i].disabled = true;
}
function disablePopupHeads() {
var popup = document.getElementById("menufieldkeyindex");
var i = popup.length;
while (i--) {
option = popup[i];
if (option.value == "fieldshead" || option.value == "keyshead" || option.value == "indexeshead") {
popup[i].disabled = true;
}
}
}
@@ -29,7 +29,7 @@
class view_table_sql extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -128,7 +128,7 @@ class view_table_sql extends XMLDBAction {
$this->output = $o;
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
@@ -28,7 +28,7 @@
class view_table_xml extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -28,7 +28,7 @@
class view_xml extends XMLDBAction {
/**
/**
* Init method, every subclass will have its own
*/
function init() {
@@ -66,7 +66,7 @@ class view_xml extends XMLDBAction {
/// Get the file parameter
$file = required_param('file', PARAM_PATH);
$file = $CFG->dirroot . stripslashes_safe($file);
/// File must be under $CFG->wwwroot and
/// File must be under $CFG->wwwroot and
/// under one db directory (simple protection)
if (substr($file, 0, strlen($CFG->dirroot)) == $CFG->dirroot &&
substr(dirname($file), -2, 2) == 'db') {
+6 -6
View File
@@ -46,7 +46,7 @@
require_once('../../lib/xmldb/classes/XMLDBIndex.class.php');
require_once('../../lib/xmldb/classes/XMLDBStatement.class.php');
/// Add Moodle config script (this is loaded AFTER all the rest
/// Add Moodle config script (this is loaded AFTER all the rest
/// of classes because it starts the SESSION and classes to be
/// stored there MUST be declared before in order to avoid
/// getting "incomplete" objects
@@ -81,7 +81,7 @@
$stradministration = get_string('administration');
/// Body of the script, based on action, we delegate the work
$action = optional_param ('action', 'main_view', PARAM_ALPHAEXT);
$action = optional_param ('action', 'main_view', PARAM_ALPHAEXT);
/// Get the action path and invoke it
$actionsroot = "$CFG->dirroot/$CFG->admin/xmldb/actions";
@@ -98,14 +98,14 @@
/// Based on getDoesGenerate()
switch ($xmldb_action->getDoesGenerate()) {
case ACTION_GENERATE_HTML:
/// Define $CFG->javascript to use our custom javascripts.
/// Define $CFG->javascript to use our custom javascripts.
/// Save the original one to add it from ours. Global too! :-(
global $standard_javascript;
$standard_javascript = $CFG->javascript; // Save original javascript file
$CFG->javascript = $CFG->dirroot.'/admin/xmldb/javascript.php'; //Use our custom javascript code
/// Go with standard header
print_header("$site->shortname: XMLDB",
"$site->fullname",
print_header("$site->shortname: XMLDB",
"$site->fullname",
"<a href=\"../index.php\">$stradministration</a> -> <a href=\"index.php\">XMLDB</a>");
print_heading($xmldb_action->getTitle());
echo $xmldb_action->getOutput();
@@ -126,7 +126,7 @@
error ("Error: wrong action specified ($action)");
}
if ($xmldb_action->getDoesGenerate() != ACTION_GENERATE_XML) {
if ($xmldb_action->getDoesGenerate() != ACTION_GENERATE_XML) {
if (debugging()) {
///print_object($XMLDB);
}
+9 -9
View File
@@ -32,9 +32,9 @@
$block_rss_client_capabilities = array(
'block/rss_client:createprivatefeeds' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -46,9 +46,9 @@ $block_rss_client_capabilities = array(
'admin' => CAP_ALLOW
)
),
'block/rss_client:createsharedfeeds' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -60,9 +60,9 @@ $block_rss_client_capabilities = array(
'admin' => CAP_ALLOW
)
),
'block/rss_client:manageownfeeds' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -74,9 +74,9 @@ $block_rss_client_capabilities = array(
'admin' => CAP_ALLOW
)
),
'block/rss_client:manageanyfeeds' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -88,7 +88,7 @@ $block_rss_client_capabilities = array(
'admin' => CAP_ALLOW
)
)
);
?>
+202 -202
View File
File diff suppressed because it is too large Load Diff
+211 -211
View File
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More