echo 'Moodle requires the iconv PHP extension. Please install or enable the iconv extension.';
die();
}
-if (iconv('UTF-8', 'UTF-8//IGNORE', 'abc') !== 'abc') {
- // known to be broken in mid-2011 MAMP installations
- echo 'Broken iconv PHP extension detected, installation/upgrade can not continue.';
- die();
-}
define('NO_OUTPUT_BUFFERING', true);
array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
$availableupdatesfetch = $updateschecker->get_last_timefetched();
+$buggyiconvnomb = (!function_exists('mb_convert_encoding') and @iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€');
+//check if the site is registered on Moodle.org
+$registered = $DB->count_records('registration_hubs', array('huburl' => HUB_MOODLEORGHUBURL, 'confirmed' => 1));
+
admin_externalpage_setup('adminnotifications');
if ($fetchupdates) {
$output = $PAGE->get_renderer('core', 'admin');
echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
- $cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch);
+ $cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
+ $registered);
// The authorization code generated by the authorization server.
$code = required_param('code', PARAM_RAW);
// The state parameter we've given (used in moodle as a redirect url).
-$state = required_param('state', PARAM_URL);
+$state = required_param('state', PARAM_LOCALURL);
-redirect(new moodle_url($state, array('code' => $code)));
+$redirecturl = new moodle_url($state);
+$params = $redirecturl->params();
+
+if (isset($params['sesskey']) and confirm_sesskey($params['sesskey'])) {
+ $redirecturl->param('oauth2code', $code);
+ redirect($redirecturl);
+} else {
+ print_error('invalidsesskey');
+}
$token = optional_param('token', '', PARAM_TEXT);
$error = optional_param('error', '', PARAM_ALPHANUM);
-admin_externalpage_setup('registrationindex');
+admin_externalpage_setup('registrationhubs');
if (!empty($error) and $error == 'urlalreadyexist') {
throw new moodle_exception('urlalreadyregistered', 'hub',
$geolocation = get_config('hub', 'site_geolocation_' . $cleanhuburl);
$contactable = get_config('hub', 'site_contactable_' . $cleanhuburl);
$emailalert = get_config('hub', 'site_emailalert_' . $cleanhuburl);
+ $emailalert = ($emailalert === 0) ? 0 : 1;
$coursesnumber = get_config('hub', 'site_coursesnumber_' . $cleanhuburl);
$usersnumber = get_config('hub', 'site_usersnumber_' . $cleanhuburl);
$roleassignmentsnumber = get_config('hub', 'site_roleassignmentsnumber_' . $cleanhuburl);
$mform->setType('description', PARAM_TEXT);
$mform->addHelpButton('description', 'sitedesc', 'hub');
- $mform->addElement('static', 'urlstring', get_string('siteurl', 'hub'), $CFG->wwwroot);
- $mform->addHelpButton('urlstring', 'siteurl', 'hub');
-
$languages = get_string_manager()->get_list_of_languages();
collatorlib::asort($languages);
$mform->addElement('select', 'language', get_string('sitelang', 'hub'),
$mform->addHelpButton('language', 'sitelang', 'hub');
$mform->setDefault('language', $language);
- $mform->addElement('static', 'versionstring', get_string('siteversion', 'hub'), $CFG->version);
- $mform->addElement('hidden', 'moodleversion', $CFG->version);
- $mform->setType('moodleversion', PARAM_INT);
- $mform->addHelpButton('versionstring', 'siteversion', 'hub');
-
- $mform->addElement('static', 'releasestring', get_string('siterelease', 'hub'), $CFG->release);
- $mform->addElement('hidden', 'moodlerelease', $CFG->release);
- $mform->setType('moodlerelease', PARAM_TEXT);
- $mform->addHelpButton('releasestring', 'siterelease', 'hub');
-
$mform->addElement('textarea', 'address', get_string('postaladdress', 'hub'),
array('rows' => 4, 'cols' => 41));
$mform->setType('address', PARAM_TEXT);
//TODO site logo
$mform->addElement('hidden', 'imageurl', ''); //TODO: temporary
$mform->setType('imageurl', PARAM_URL);
+
+ $mform->addElement('static', 'urlstring', get_string('siteurl', 'hub'), $CFG->wwwroot);
+ $mform->addHelpButton('urlstring', 'siteurl', 'hub');
+
+ $mform->addElement('static', 'versionstring', get_string('siteversion', 'hub'), $CFG->version);
+ $mform->addElement('hidden', 'moodleversion', $CFG->version);
+ $mform->setType('moodleversion', PARAM_INT);
+ $mform->addHelpButton('versionstring', 'siteversion', 'hub');
+
+ $mform->addElement('static', 'releasestring', get_string('siterelease', 'hub'), $CFG->release);
+ $mform->addElement('hidden', 'moodlerelease', $CFG->release);
+ $mform->setType('moodlerelease', PARAM_TEXT);
+ $mform->addHelpButton('releasestring', 'siterelease', 'hub');
+
/// Display statistic that are going to be retrieve by the hub
$coursecount = $DB->count_records('course') - 1;
$usercount = $DB->count_records('user', array('deleted' => 0));
+++ /dev/null
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
-/*
- * @package moodle
- * @subpackage registration
- * @author Jerome Mouneyrac <jerome@mouneyrac.com>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
- *
- * Thsi page displays a hub selector or a hub URL + password. Then it will redirect to
- * the site registration form (with the selected hub as parameter)
-*/
-
-require('../../config.php');
-
-require_once($CFG->libdir.'/adminlib.php');
-require_once($CFG->dirroot.'/' . $CFG->admin . '/registration/forms.php');
-
-admin_externalpage_setup('registrationselector');
-
-$hubselectorform = new hub_selector_form();
-$fromform = $hubselectorform->get_data();
-
-//// Redirect to the registration form if an URL has been choosen ////
-
-$selectedhuburl = optional_param('publichub', false, PARAM_URL);
-$unlistedhuburl = optional_param('unlistedurl', false, PARAM_TEXT);
-$password = optional_param('password', '', PARAM_RAW);
-
-if (!empty($unlistedhuburl)) {
- if (clean_param($unlistedhuburl, PARAM_URL) !== '') {
- $huburl = $unlistedhuburl;
- }
-} else if (!empty($selectedhuburl)) {
- $huburl = $selectedhuburl;
-}
-
-
-//redirect
-if (!empty($huburl) and confirm_sesskey()) {
- $hubname = optional_param(clean_param($huburl, PARAM_ALPHANUMEXT), '', PARAM_TEXT);
- $params = array('sesskey' => sesskey(), 'huburl' => $huburl,
- 'password' => $password, 'hubname' => $hubname);
- redirect(new moodle_url($CFG->wwwroot."/" . $CFG->admin . "/registration/register.php",
- $params));
-}
-
-
-//// OUTPUT ////
-
-echo $OUTPUT->header();
-echo $OUTPUT->heading(get_string('registeron', 'hub'), 3, 'main');
-$hubselectorform->display();
-echo $OUTPUT->footer();
\ No newline at end of file
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
*
- * On this page the administrator select if he wants to register on Moodle.org or
- * a specific hub
+ * On this page the administrator selects which hub he wants to register,
+ * except for MOOCH. Admins can register with MOOCH with the top admin menu "Registration" link.
+ * On this page the administrator can also unregister from any hubs, including MOOCH.
*/
require('../../config.php');
require_once($CFG->dirroot . '/course/publish/lib.php');
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
-admin_externalpage_setup('registrationindex');
+admin_externalpage_setup('registrationhubs');
$renderer = $PAGE->get_renderer('core', 'register');
}
}
-echo $OUTPUT->header();
-
-//do not check sesskey if confirm = false because this script is linked into email message
-if (!empty($errormessage)) {
- echo $OUTPUT->notification(get_string('unregistrationerror', 'hub', $errormessage));
-}
if (empty($cancel) and $unregistration and !$confirm) {
+
+ echo $OUTPUT->header();
+
+ //do not check sesskey if confirm = false because this script is linked into email message
+ if (!empty($errormessage)) {
+ echo $OUTPUT->notification(get_string('unregistrationerror', 'hub', $errormessage));
+ }
+
$hub = $registrationmanager->get_registeredhub($huburl);
echo $OUTPUT->heading(get_string('unregisterfrom', 'hub', $hub->hubname), 3, 'main');
if ($cleanregdata) {
$siteunregistrationform = new site_unregistration_form('',
array('huburl' => $huburl, 'hubname' => $hub->hubname));
}
+
$siteunregistrationform->display();
} else {
$registeredonmoodleorg = false;
$registeredonmoodleorg = true;
}
- echo $OUTPUT->heading(get_string('registeron', 'hub'), 3, 'main');
- echo $renderer->registrationselector($registeredonmoodleorg);
+ // load the hub selector form
+ $hubselectorform = new hub_selector_form();
+ $fromform = $hubselectorform->get_data();
+ $selectedhuburl = optional_param('publichub', false, PARAM_URL);
+ $unlistedhuburl = optional_param('unlistedurl', false, PARAM_TEXT);
+ $password = optional_param('password', '', PARAM_RAW);
+ $registeringhuburl = null;
+ if (!empty($unlistedhuburl)) {
+ if (clean_param($unlistedhuburl, PARAM_URL) !== '') {
+ $registeringhuburl = $unlistedhuburl;
+ }
+ } else if (!empty($selectedhuburl)) {
+ $registeringhuburl = $selectedhuburl;
+ }
+
+ // a hub has been selected, redirect to the hub registration page
+ if (empty($cancel) and !empty($registeringhuburl) and confirm_sesskey()) {
+ $hubname = optional_param(clean_param($registeringhuburl, PARAM_ALPHANUMEXT), '', PARAM_TEXT);
+ $params = array('sesskey' => sesskey(), 'huburl' => $registeringhuburl,
+ 'password' => $password, 'hubname' => $hubname);
+ redirect(new moodle_url($CFG->wwwroot . "/" . $CFG->admin . "/registration/register.php",
+ $params));
+ }
+
+ echo $OUTPUT->header();
+
+ //check if the site is registered on Moodle.org and display a message about registering on MOOCH
+ $registered = $DB->count_records('registration_hubs', array('huburl' => HUB_MOODLEORGHUBURL, 'confirmed' => 1));
+ if (empty($registered)) {
+ $warningmsg = get_string('registermoochtips', 'hub');
+ $warningmsg .= $renderer->single_button(new moodle_url('register.php', array('huburl' => HUB_MOODLEORGHUBURL
+ , 'hubname' => 'Moodle.org')), get_string('register', 'admin'));
+ echo $renderer->box($warningmsg, 'buttons mdl-align generalbox adminwarning');
+ }
+
+ //do not check sesskey if confirm = false because this script is linked into email message
+ if (!empty($errormessage)) {
+ echo $OUTPUT->notification(get_string('unregistrationerror', 'hub', $errormessage));
+ }
+
+ echo $OUTPUT->heading(get_string('registerwith', 'hub'));
+
+ $hubselectorform->display();
if (extension_loaded('xmlrpc')) {
$hubs = $registrationmanager->get_registered_on_hubs();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
*
- * This page displays the site registration form.
+ * This page displays the site registration form for Moodle.org/MOOCH or for a different hub.
* It handles redirection to the hub to continue the registration workflow process.
* It also handles update operation by web service.
*/
require_once($CFG->dirroot . '/webservice/lib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
-admin_externalpage_setup('registrationindex');
-
$huburl = required_param('huburl', PARAM_URL);
$huburl = rtrim($huburl, "/");
+
+if ($huburl == HUB_MOODLEORGHUBURL) { // register to Moodle.org
+ admin_externalpage_setup('registrationmoodleorg');
+} else { //register to a hub
+ admin_externalpage_setup('registrationhub');
+}
+
$password = optional_param('password', '', PARAM_TEXT);
$hubname = optional_param('hubname', '', PARAM_TEXT);
-if (!confirm_sesskey()) {
- throw new moodle_exception('missingparameter');
-}
$registrationmanager = new registration_manager();
echo $error;
}
+//some Moodle.org resitration explanation
+if ($huburl == HUB_MOODLEORGHUBURL) {
+ echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'admin'));
+ $renderer = $PAGE->get_renderer('core', 'register');
+ echo $renderer->moodleorg_registration_message();
+}
+
$siteregistrationform->display();
echo $OUTPUT->footer();
*/
class core_register_renderer extends plugin_renderer_base {
+ /**
+ * Display Moodle.org registration message about benefit to register on Moodle.org
+ *
+ * @return string
+ */
+ public function moodleorg_registration_message() {
+ $moodleorgurl = html_writer::link('http://moodle.org', 'Moodle.org');
+ $moodleorgstatsurl = html_writer::link('http://moodle.org/stats', get_string('statsmoodleorg', 'admin'));
+ $moochurl = html_writer::link(HUB_MOODLEORGHUBURL, 'MOOCH');
+ $moodleorgregmsg = get_string('registermoodleorg', 'admin', $moodleorgurl);
+ $items = array(get_string('registermoodleorgli1', 'admin'),
+ get_string('registermoodleorgli2', 'admin', $moodleorgstatsurl),
+ get_string('registermoodleorgli3', 'admin', $moochurl));
+ $moodleorgregmsg .= html_writer::alist($items);
+ return $moodleorgregmsg;
+ }
+
/**
* Display a box message confirming a site registration (add or update)
* @param string $confirmationmessage
return $this->output->box($message);
}
- /**
- * Display the page to register on Moodle.org or on a specific hub
- */
- public function registrationselector($updatemoodleorg = false) {
- global $CFG;
- $table = new html_table();
- $table->head = array(get_string('moodleorg', 'hub'), get_string('specifichub', 'hub'));
- $table->size = array('50%', '50%');
- //$table->attributes['class'] = 'registerindextable';
- //Moodle.org information cell
- $moodleorgcell = get_string('moodleorgregistrationdetail', 'hub');
- $moodleorgcell .= html_writer::empty_tag('br') . html_writer::empty_tag('br');
- $moodleorgcell = html_writer::tag('div', $moodleorgcell, array('class' => 'justifytext'));
-
- //Specific hub information cell
- $specifichubcell = get_string('specifichubregistrationdetail', 'hub');
- $specifichubcell .= html_writer::empty_tag('br') . html_writer::empty_tag('br');
- $specifichubcell = html_writer::tag('div', $specifichubcell, array('class' => 'justifytext'));
-
- //add information cells
- $cells = array($moodleorgcell, $specifichubcell);
- $row = new html_table_row($cells);
- $table->data[] = $row;
-
- //Moodle.org button cell
- $registeronmoodleorgurl = new moodle_url("/" . $CFG->admin . "/registration/register.php",
- array('sesskey' => sesskey(), 'huburl' => HUB_MOODLEORGHUBURL
- , 'hubname' => 'Moodle.org'));
- $registeronmoodleorgbutton = new single_button($registeronmoodleorgurl,
- $updatemoodleorg ? get_string('updatesite', 'hub', 'Moodle.org') : get_string('registeronmoodleorg', 'hub'));
- $registeronmoodleorgbutton->class = 'centeredbutton';
- $registeronmoodleorgbuttonhtml = $this->output->render($registeronmoodleorgbutton);
- $moodleorgcell = $registeronmoodleorgbuttonhtml;
-
- //Specific hub button cell
- $registeronspecifichuburl = new moodle_url("/" . $CFG->admin . "/registration/hubselector.php",
- array('sesskey' => sesskey()));
- $registeronspecifichubbutton = new single_button($registeronspecifichuburl,
- get_string('registeronspecifichub', 'hub'));
- $registeronspecifichubbutton->class = 'centeredbutton';
- $registeronspecifichubbuttonhtml = $this->output->render($registeronspecifichubbutton);
- $specifichubcell = $registeronspecifichubbuttonhtml;
-
- //add button cells
- $cells = array($moodleorgcell, $specifichubcell);
- $row = new html_table_row($cells);
- $table->data[] = $row;
-
- return html_writer::table($table);
- }
-
/**
* Display the listing of registered on hub
*/
$hubname = optional_param('hubname', '', PARAM_TEXT);
$token = optional_param('token', '', PARAM_TEXT);
-admin_externalpage_setup('registrationindex');
+admin_externalpage_setup('registrationhubs');
//check that we are waiting a confirmation from this hub, and check that the token is correct
$registrationmanager = new registration_manager();
* @param bool $cronoverdue warn cron not running
* @param bool $dbproblems warn db has problems
* @param bool $maintenancemode warn in maintenance mode
+ * @param bool $buggyiconvnomb warn iconv problems
* @param array|null $availableupdates array of available_update_info objects or null
* @param int|null $availableupdatesfetch timestamp of the most recent updates fetch or null (unknown)
*
* @return string HTML to output.
*/
public function admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
- $cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch) {
+ $cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch,
+ $buggyiconvnomb, $registered) {
global $CFG;
$output = '';
$output .= empty($CFG->disableupdatenotifications) ? $this->available_updates($availableupdates, $availableupdatesfetch) : '';
$output .= $this->insecure_dataroot_warning($insecuredataroot);
$output .= $this->display_errors_warning($errorsdisplayed);
+ $output .= $this->buggy_iconv_warning($buggyiconvnomb);
$output .= $this->cron_overdue_warning($cronoverdue);
$output .= $this->db_problems($dbproblems);
$output .= $this->maintenance_mode_warning($maintenancemode);
+ $output .= $this->registration_warning($registered);
//////////////////////////////////////////////////////////////////////////////////////////////////
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
return $this->warning(get_string('displayerrorswarning', 'admin'));
}
+ /**
+ * Render an appropriate message if iconv is buggy and mbstring missing.
+ * @param bool $buggyiconvnomb
+ * @return string HTML to output.
+ */
+ protected function buggy_iconv_warning($buggyiconvnomb) {
+ if (!$buggyiconvnomb) {
+ return '';
+ }
+
+ return $this->warning(get_string('warningiconvbuggy', 'admin'));
+ }
+
/**
* Render an appropriate message if cron has not been run recently.
* @param bool $cronoverdue
return $updateinfo;
}
+ /**
+ * Display a warning about not being registered on Moodle.org if necesary.
+ *
+ * @param boolean $registered true if the site is registered on Moodle.org
+ * @return string HTML to output.
+ */
+ protected function registration_warning($registered) {
+
+ if (!$registered) {
+
+ $registerbutton = $this->single_button(new moodle_url('registration/register.php',
+ array('huburl' => HUB_MOODLEORGHUBURL, 'hubname' => 'Moodle.org')),
+ get_string('register', 'admin'));
+
+ return $this->warning( get_string('registrationwarning', 'admin')
+ . ' ' . $this->help_icon('registration', 'admin') . $registerbutton );
+ }
+
+ return '';
+ }
+
/**
* Helper method to render the information about the available Moodle update
*
$pagename = 'repositoryinstancenew';
}
-admin_externalpage_setup($pagename, '', null, new moodle_url('/admin/repositoryinstances.php'));
+admin_externalpage_setup($pagename, '', null, new moodle_url('/admin/repositoryinstance.php'));
require_capability('moodle/site:config', $context);
$baseurl = new moodle_url("/$CFG->admin/repositoryinstance.php", array('sesskey'=>sesskey()));
$temp->add(new admin_setting_configcheckbox('enablegroupmembersonly', new lang_string('enablegroupmembersonly', 'admin'), new lang_string('configenablegroupmembersonly', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('dndallowtextandlinks', new lang_string('dndallowtextandlinks', 'admin'), new lang_string('configdndallowtextandlinks', 'admin'), 0));
+ // The CSS optimiser setting. When changed we need to reset the theme caches in order to ensure they are regenerated through the optimiser.
+ $enablecssoptimiser = new admin_setting_configcheckbox('enablecssoptimiser', new lang_string('enablecssoptimiser','admin'), new lang_string('enablecssoptimiser_desc','admin'), 0);
+ $enablecssoptimiser->set_updatedcallback('theme_reset_all_caches');
+ $temp->add($enablecssoptimiser);
$ADMIN->add('experimental', $temp);
$ADMIN->add('server', $temp);
-$ADMIN->add('server', new admin_externalpage('adminregistration', new lang_string('registration','admin'), "$CFG->wwwroot/$CFG->admin/registration/index.php"));
+$ADMIN->add('server', new admin_externalpage('adminregistration', new lang_string('hubs', 'admin'),
+ "$CFG->wwwroot/$CFG->admin/registration/index.php"));
// "update notifications" settingpage
if (empty($CFG->disableupdatenotifications)) {
$checkbox->set_affects_modinfo(true);
$optionalsubsystems->add(new admin_setting_configcheckbox('enableplagiarism', new lang_string('enableplagiarism','plagiarism'), new lang_string('configenableplagiarism','plagiarism'), 0));
-
- $optionalsubsystems->add(new admin_setting_configcheckbox('enablecssoptimiser', new lang_string('enablecssoptimiser','admin'), new lang_string('enablecssoptimiser_desc','admin'), 0));
}
$ADMIN->add('root', new admin_externalpage('adminnotifications', new lang_string('notifications'), "$CFG->wwwroot/$CFG->admin/index.php"));
-$ADMIN->add('root', new admin_externalpage('registrationindex', new lang_string('registration','admin'),
- "$CFG->wwwroot/$CFG->admin/registration/index.php"));
-$ADMIN->add('root', new admin_externalpage('registration', new lang_string('registeron','hub'),
+$ADMIN->add('root', new admin_externalpage('registrationmoodleorg', new lang_string('registration', 'admin'),
+ "$CFG->wwwroot/$CFG->admin/registration/register.php?huburl=" . HUB_MOODLEORGHUBURL . "&hubname=Moodle.org"));
+$ADMIN->add('root', new admin_externalpage('registrationhub', new lang_string('registerwith', 'hub'),
"$CFG->wwwroot/$CFG->admin/registration/register.php", 'moodle/site:config', true));
-$ADMIN->add('root', new admin_externalpage('registrationselector', new lang_string('registeron','hub'),
- "$CFG->wwwroot/$CFG->admin/registration/hubselector.php", 'moodle/site:config', true));
+$ADMIN->add('root', new admin_externalpage('registrationhubs', new lang_string('hubs', 'admin'),
+ "$CFG->wwwroot/$CFG->admin/registration/index.php", 'moodle/site:config', true));
$ADMIN->add('root', new admin_externalpage('siteregistrationconfirmed',
new lang_string('registrationconfirmed', 'hub'),
$CFG->wwwroot."/".$CFG->admin."/registration/confirmregistration.php", 'moodle/site:config', true));
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2012050300;
-$plugin->requires = 2012050300;
+$plugin->version = 2012061700;
+$plugin->requires = 2012061700;
$plugin->component = 'tool_assignmentupgrade';
-$plugin->dependencies = array('mod_assign' => 2012050300);
+$plugin->dependencies = array('mod_assign' => 2012061700);
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_bloglevelupgrade'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_capability'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500;
-$plugin->requires = 2011092100;
+$plugin->version = 2012061700;
+$plugin->requires = 2012061700;
$plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_dbtransfer'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_generator'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_innodb'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_langimport'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_multilangupgrade'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2012040500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2012040500; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_phpunit'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_profiling'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500;
-$plugin->requires = 2011092100;
+$plugin->version = 2012061700;
+$plugin->requires = 2012061700;
$plugin->component = 'tool_qeupgradehelper'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_replace'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500;
-$plugin->requires = 2011092100;
+$plugin->version = 2012061700;
+$plugin->requires = 2012061700;
$plugin->component = 'tool_spamcleaner'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500;
-$plugin->requires = 2011092100;
+$plugin->version = 2012061700;
+$plugin->requires = 2012061700;
$plugin->component = 'tool_timezoneimport'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_unittest'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_unsuproles'; // Full name of the plugin (used for diagnostics)
// array of all valid fields for validation
$STD_FIELDS = array('id', 'firstname', 'lastname', 'username', 'email',
'city', 'country', 'lang', 'timezone', 'mailformat',
- 'maildisplay', 'maildigest', 'htmleditor', 'ajax', 'autosubscribe',
+ 'maildisplay', 'maildigest', 'htmleditor', 'autosubscribe',
'institution', 'department', 'idnumber', 'skype',
'msn', 'aim', 'yahoo', 'icq', 'phone1', 'phone2', 'address',
'url', 'description', 'descriptionformat', 'password',
$mform->setType('htmleditor', PARAM_INT);
}
- if (empty($CFG->enableajax)) {
- $mform->addElement('static', 'ajax', get_string('ajaxuse'), get_string('ajaxno'));
- } else {
- $choices = array( 0 => get_string('ajaxno'), 1 => get_string('ajaxyes'));
- $mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
- $mform->setDefault('ajax', 1);
- }
- $mform->setAdvanced('ajax');
-
$mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
$mform->setType('city', PARAM_MULTILANG);
if (empty($CFG->defaultcity)) {
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2011092100; // Requires this Moodle version
+$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'tool_uploaduser'; // Full name of the plugin (used for diagnostics)
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* Main xmldb action class. It implements all the basic
* functionalities to be shared by each action.
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class XMLDBAction {
- var $does_generate; //Type of value returned by the invoke method
- //ACTION_GENERATE_HTML have contents to show
- //set by each specialized invoke
+ /** @var bool Type of value returned by the invoke method, ACTION_GENERATE_HTML have contents to show, set by each specialized invoke*/
+ protected $does_generate;
- var $title; //Title of the Action (class name, by default)
- //set by parent init automatically
+ /** @var string Title of the Action (class name, by default), set by parent init automatically*/
+ protected $title;
- var $str; //Strings used by the action
- //set by each specialized init, calling loadStrings
+ /** @var string Strings used by the action set by each specialized init, calling loadStrings*/
+ protected $str;
- var $output; //Output of the action
- //set by each specialized invoke, get with getOutput
+ /** @var string Output of the action, set by each specialized invoke, get with getOutput*/
+ protected $output;
- var $errormsg; //Last Error produced. Check when any invoke returns false
- //get with getError
+ /** @var string Last Error produced. Check when any invoke returns false, get with getError*/
+ protected $errormsg;
- var $postaction; //Action to execute at the end of the invoke script
+ /** @var string Action to execute at the end of the invoke script*/
+ protected $postaction;
- var $sesskey_protected; // Actions must be protected by sesskey mechanism
+ /** @var bool Actions must be protected by sesskey mechanism*/
+ protected $sesskey_protected;
/**
- * Constructor to keep PHP5 happy
+ * Constructor
*/
function __construct() {
$this->init();
}
/**
- * returns the type of output of the file
+ * Returns the type of output of the file
+ * @return bool
*/
function getDoesGenerate() {
return $this->does_generate;
/**
* getError method, returns the last error string.
* Used if the invoke() methods returns false
+ * @return string
*/
function getError() {
return $this->errormsg;
/**
* getOutput method, returns the output generated by the action.
* Used after execution of the invoke() methods if they return true
+ * @return string
*/
function getOutput() {
return $this->output;
/**
* getPostAction method, returns the action to launch after executing
* another one
+ * @return string
*/
function getPostAction() {
return $this->postaction;
/**
* getTitle method returns the title of the action (that is part
* of the $str array attribute
+ * @return string
*/
function getTitle() {
return $this->str['title'];
/**
* loadStrings method, loads the required strings specified in the
* array parameter
+ * @params array $strings
*/
function loadStrings($strings) {
// Load some commonly used strings
/**
* launch method, used to easily call invoke methods between actions
+ * @param string $action
+ * @return mixed
*/
function launch($action) {
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2008 onwards Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* This is a base class for the various actions that interate over all the
* tables and check some aspect of their definition.
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2008 onwards Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class XMLDBCheckAction extends XMLDBAction {
/**
- * This string is displayed with a yes/no choice before the report is run.
+ * @var string This string is displayed with a yes/no choice before the report is run.
* You must set this to the name of a lang string in xmldb.php before calling init.
*/
protected $introstr = '';
// Iterate over $XMLDB->dbdirs, loading their XML data to memory
if ($XMLDB->dbdirs) {
- $dbdirs =& $XMLDB->dbdirs;
+ $dbdirs = $XMLDB->dbdirs;
$o='<ul>';
foreach ($dbdirs as $dbdir) {
// Only if the directory exists
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* reporting about the ones not physically implemented as BIGINTs
* and providing one SQL script to fix all them. MDL-11038
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* match those specified in the xml specs
* and providing one SQL script to fix all them.
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* Each 0 in that column will violate the foreign key, but we ignore them.
* If you want a strict check performed, then add &strict=1 to the URL.
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* with the physical DB implementation, reporting about all the missing
* indexes to be created to be 100% ok.
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package xmldb-editor
+ * @package tool_xmldb
* @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* them by changing to cross-db (CHAR) length semantics.
* See MDL-29322 for more details.
*
- * @package xmldb-editor
+ * @package tool_xmldb
* @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* This class will delete completely one field
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
- $dbdir =& $XMLDB->dbdirs[$dirpath];
- $editeddir =& $XMLDB->editeddirs[$dirpath];
+ $dbdir = $XMLDB->dbdirs[$dirpath];
+ $editeddir = $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
- $structure =& $editeddir->xml_file->getStructure();
+ $structure = $editeddir->xml_file->getStructure();
// Move adjacent fields prev and next attributes
- $tables =& $structure->getTables();
- $table =& $structure->getTable($tableparam);
- $fields =& $table->getFields();
- $field =& $table->getField($fieldparam);
+ $tables = $structure->getTables();
+ $table = $structure->getTable($tableparam);
+ $fields = $table->getFields();
+ $field = $table->getField($fieldparam);
if ($field->getPrevious()) {
- $prev =& $table->getField($field->getPrevious());
+ $prev = $table->getField($field->getPrevious());
$prev->setNext($field->getNext());
}
if ($field->getNext()) {
- $next =& $table->getField($field->getNext());
+ $next = $table->getField($field->getNext());
$next->setPrevious($field->getPrevious());
}
// Remove the field
// If the hash has changed from the original one, change the version
// and mark the structure as changed
- $origstructure =& $dbdir->xml_file->getStructure();
+ $origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* This class will delete completely one index
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
- $dbdir =& $XMLDB->dbdirs[$dirpath];
- $editeddir =& $XMLDB->editeddirs[$dirpath];
+ $dbdir = $XMLDB->dbdirs[$dirpath];
+ $editeddir = $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
- $structure =& $editeddir->xml_file->getStructure();
+ $structure = $editeddir->xml_file->getStructure();
// Move adjacent indexes prev and next attributes
- $tables =& $structure->getTables();
- $table =& $structure->getTable($tableparam);
- $indexes =& $table->getIndexes();
- $index =& $table->getIndex($indexparam);
+ $tables = $structure->getTables();
+ $table = $structure->getTable($tableparam);
+ $indexes = $table->getIndexes();
+ $index = $table->getIndex($indexparam);
if ($index->getPrevious()) {
- $prev =& $table->getIndex($index->getPrevious());
+ $prev = $table->getIndex($index->getPrevious());
$prev->setNext($index->getNext());
}
if ($index->getNext()) {
- $next =& $table->getIndex($index->getNext());
+ $next = $table->getIndex($index->getNext());
$next->setPrevious($index->getPrevious());
}
// Remove the index
// If the hash has changed from the original one, change the version
// and mark the structure as changed
- $origstructure =& $dbdir->xml_file->getStructure();
+ $origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* This class will delete completely one key
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
- $dbdir =& $XMLDB->dbdirs[$dirpath];
- $editeddir =& $XMLDB->editeddirs[$dirpath];
+ $dbdir = $XMLDB->dbdirs[$dirpath];
+ $editeddir = $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
- $structure =& $editeddir->xml_file->getStructure();
+ $structure = $editeddir->xml_file->getStructure();
// Move adjacent keys prev and next attributes
- $tables =& $structure->getTables();
- $table =& $structure->getTable($tableparam);
- $keys =& $table->getKeys();
- $key =& $table->getKey($keyparam);
+ $tables = $structure->getTables();
+ $table = $structure->getTable($tableparam);
+ $keys = $table->getKeys();
+ $key = $table->getKey($keyparam);
if ($key->getPrevious()) {
- $prev =& $table->getKey($key->getPrevious());
+ $prev = $table->getKey($key->getPrevious());
$prev->setNext($key->getNext());
}
if ($key->getNext()) {
- $next =& $table->getKey($key->getNext());
+ $next = $table->getKey($key->getNext());
$next->setPrevious($key->getPrevious());
}
// Remove the key
// If the hash has changed from the original one, change the version
// and mark the structure as changed
- $origstructure =& $dbdir->xml_file->getStructure();
+ $origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* This class will delete completely one table
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
- $dbdir =& $XMLDB->dbdirs[$dirpath];
- $editeddir =& $XMLDB->editeddirs[$dirpath];
+ $dbdir = $XMLDB->dbdirs[$dirpath];
+ $editeddir = $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
- $structure =& $editeddir->xml_file->getStructure();
+ $structure = $editeddir->xml_file->getStructure();
// Remove the table
$structure->deleteTable($tableparam);
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* This class will delete completely one XML file
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Get the original dir and delete the xml file
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
- $dbdir =& $XMLDB->dbdirs[$dirpath];
+ $dbdir = $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
@unlink($dirpath . '/install.xml');
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* This class will provide the interface for all the edit field actions
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
- $dbdir =& $XMLDB->dbdirs[$dirpath];
+ $dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
- $editeddir =& $XMLDB->editeddirs[$dirpath];
- $structure =& $editeddir->xml_file->getStructure();
+ $editeddir = $XMLDB->editeddirs[$dirpath];
+ $structure = $editeddir->xml_file->getStructure();
}
// Fetch request data
$tableparam = required_param('table', PARAM_CLEAN);
- if (!$table =& $structure->getTable($tableparam)) {
+ if (!$table = $structure->getTable($tableparam)) {
$this->errormsg = 'Wrong table specified: ' . $tableparam;
return false;
}
$fieldparam = required_param('field', PARAM_CLEAN);
- if (!$field =& $table->getField($fieldparam)) {
+ if (!$field = $table->getField($fieldparam)) {
// Arriving here from a name change, looking for the new field name
$fieldparam = required_param('name', PARAM_CLEAN);
- $field =& $table->getField($fieldparam);
+ $field = $table->getField($fieldparam);
}
- $dbdir =& $XMLDB->dbdirs[$dirpath];
- $origstructure =& $dbdir->xml_file->getStructure();
+ $dbdir = $XMLDB->dbdirs[$dirpath];
+ $origstructure = $dbdir->xml_file->getStructure();
$o = ''; // Output starts
XMLDB_TYPE_CHAR => $field->getXMLDBTypeName(XMLDB_TYPE_CHAR),
XMLDB_TYPE_TEXT => $field->getXMLDBTypeName(XMLDB_TYPE_TEXT),
XMLDB_TYPE_BINARY => $field->getXMLDBTypeName(XMLDB_TYPE_BINARY));
- // If current field isnt float, delete such column type to avoid its creation from the interface
+ // If current field isn't float, delete such column type to avoid its creation from the interface
// Note that float fields are supported completely but it's possible than in a next future
- // we delete them completely from Moodle DB, using, exlusively, number(x,y) types
+ // we delete them completely from Moodle DB, using, exclusively, number(x,y) types
if ($field->getType() != XMLDB_TYPE_FLOAT) {
unset ($typeoptions[XMLDB_TYPE_FLOAT]);
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* This class verifies all the data introduced when editing a field for correctness,
* performing changes / displaying errors depending of the results.
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$default = optional_param('default', NULL, PARAM_PATH);
$default = trim($default);
- $editeddir =& $XMLDB->editeddirs[$dirpath];
- $structure =& $editeddir->xml_file->getStructure();
- $table =& $structure->getTable($tableparam);
- $field =& $table->getField($fieldparam);
+ $editeddir = $XMLDB->editeddirs[$dirpath];
+ $structure = $editeddir->xml_file->getStructure();
+ $table = $structure->getTable($tableparam);
+ $field = $table->getField($fieldparam);
$oldhash = $field->getHash();
$errors = array(); // To store all the errors found
if ($fieldparam != $name) {
$field->setName($name);
if ($field->getPrevious()) {
- $prev =& $table->getField($field->getPrevious());
+ $prev = $table->getField($field->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($field->getNext()) {
- $next =& $table->getField($field->getNext());
+ $next = $table->getField($field->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* This class will provide the interface for all the edit index actions
*
- * @package xmldb-editor
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
- $dbdir =& $XMLDB->dbdirs[$dirpath];
+ $dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
- $editeddir =& $XMLDB->editeddirs[$dirpath];
- $structure =& $editeddir->xml_file->getStructure();
+ $editeddir = $XMLDB->editeddirs[$dirpath];
+ $structure = $editeddir->xml_file->getStructure();
}
// Fetch request data
$tableparam = required_param('table', PARAM_CLEAN);
- if (!$table =& $structure->getTable($tableparam)) {
+ if (!$table = $structure->getTable($tableparam)) {
$this->errormsg = 'Wrong table specified: ' . $tableparam;
return false;
}
$indexparam = required_param('index', PARAM_CLEAN);
- if (!$index =& $table->getIndex($indexparam)) {
+ if (!$index = $table->getIndex($indexparam)) {
// Arriving here from a name change, looking for the new key name
$indexparam = required_param('name', PARAM_CLEAN);
- $index =& $table->getIndex($indexparam);
+ $index = $table->getIndex($indexparam);
}
- $dbdir =& $XMLDB->dbdirs[$dirpath];
- $origstructure =& $dbdir->xml_file->getStructure();
+ $dbdir = $XMLDB->dbdirs[$dirpath];
+ $origstructure = $dbdir->xml_file->getStructure();
// Add the main form
$o = '<form id="form" action="index.php" method="post">';
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* This class verifies all the data introduced when editing an index for correctness,
* performing changes / displaying errors depending of the results.
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$fields = required_param('fields', PARAM_CLEAN);
$fields = str_replace(' ', '', trim(strtolower($fields)));
- $editeddir =& $XMLDB->editeddirs[$dirpath];
- $structure =& $editeddir->xml_file->getStructure();
- $table =& $structure->getTable($tableparam);
- $index =& $table->getIndex($indexparam);
+ $editeddir = $XMLDB->editeddirs[$dirpath];
+ $structure = $editeddir->xml_file->getStructure();
+ $table = $structure->getTable($tableparam);
+ $index = $table->getIndex($indexparam);
$oldhash = $index->getHash();
$errors = array(); // To store all the errors found
if ($indexparam != $name) {
$index->setName($name);
if ($index->getPrevious()) {
- $prev =& $table->getIndex($index->getPrevious());
+ $prev = $table->getIndex($index->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($index->getNext()) {
- $next =& $table->getIndex($index->getNext());
+ $next = $table->getIndex($index->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* This class will provide the interface for all the edit key actions
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
- $dbdir =& $XMLDB->dbdirs[$dirpath];
+ $dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
- $editeddir =& $XMLDB->editeddirs[$dirpath];
- $structure =& $editeddir->xml_file->getStructure();
+ $editeddir = $XMLDB->editeddirs[$dirpath];
+ $structure = $editeddir->xml_file->getStructure();
}
// Fetch request data
$tableparam = required_param('table', PARAM_CLEAN);
- if (!$table =& $structure->getTable($tableparam)) {
+ if (!$table = $structure->getTable($tableparam)) {
$this->errormsg = 'Wrong table specified: ' . $tableparam;
return false;
}
$keyparam = required_param('key', PARAM_CLEAN);
- if (!$key =& $table->getKey($keyparam)) {
+ if (!$key = $table->getKey($keyparam)) {
// Arriving here from a name change, looking for the new key name
$keyparam = required_param('name', PARAM_CLEAN);
- $key =& $table->getKey($keyparam);
+ $key = $table->getKey($keyparam);
}
- $dbdir =& $XMLDB->dbdirs[$dirpath];
- $origstructure =& $dbdir->xml_file->getStructure();
+ $dbdir = $XMLDB->dbdirs[$dirpath];
+ $origstructure = $dbdir->xml_file->getStructure();
// Add the main form
$o = '<form id="form" action="index.php" method="post">';
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* This class verifies all the data introduced when editing a key for correctness,
* performing changes / displaying errors depending of the results.
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$reffields = str_replace(' ', '', trim(strtolower($reffields)));
}
- $editeddir =& $XMLDB->editeddirs[$dirpath];
- $structure =& $editeddir->xml_file->getStructure();
- $table =& $structure->getTable($tableparam);
- $key =& $table->getKey($keyparam);
+ $editeddir = $XMLDB->editeddirs[$dirpath];
+ $structure = $editeddir->xml_file->getStructure();
+ $table = $structure->getTable($tableparam);
+ $key = $table->getKey($keyparam);
$oldhash = $key->getHash();
$errors = array(); // To store all the errors found
// Continue if we aren't under errors
if (empty($errors)) {
// If there is one name change, do it, changing the prev and next
- // atributes of the adjacent fields
+ // attributes of the adjacent fields
if ($keyparam != $name) {
$key->setName($name);
if ($key->getPrevious()) {
- $prev =& $table->getKey($key->getPrevious());
+ $prev = $table->getKey($key->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($key->getNext()) {
- $next =& $table->getKey($key->getNext());
+ $next = $table->getKey($key->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* can be invoked, plus links to PHP code generator, view SQL, rearrange
* elements and so on.
*
- * @package tool
- * @subpackage xmldb
+ * @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
- $dbdir =& $XMLDB->dbdirs[$dirpath];
+ $dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
}
if (!empty($XMLDB->editeddirs)) {
- $editeddir =& $XMLDB->editeddirs[$dirpath];
- $structure =& $editeddir->xml_file->getStructure();
+ $editeddir = $XMLDB->editeddirs[$dirpath];
+ $structure = $editeddir->xml_file->getStructure();
}
$tableparam = required_param('table', PARAM_CLEAN);
- if (!$table =& $structure->getTable($tableparam)) {
+ if (!$table = $structure->getTable($tableparam)) {
// Arriving here from a name change, looking for the new table name
$tableparam = required_param('name', PARAM_CLEAN);
- $table =& $structure->getTable($tableparam);
+ $table = $structure->getTable($tableparam);
}
- $dbdir =& $XMLDB->dbdirs[$dirpath];
- $origstructure =& $dbdir->xml_file->getStructure();
+ $dbdir = $XMLDB->dbdirs[$dirpath];
+ $origstructure = $dbdir->xml_file->getStructure();
// Add the main form
$o = '<form id="form" action="index.php" method="post">';
$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" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
$o .= '</table>';
}
// Add the keys list
- $keys =& $table->getKeys();
+ $keys = $table->getKeys();
if (!empty($keys)) {
$o .= '<h3 class="main">' . $this->str['keys'] . '</h3>';