+++ /dev/null
-<?php
-
-if (!defined('MOODLE_INTERNAL')) {
- die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
-}
-
-require_once $CFG->libdir.'/formslib.php';
-
-class database_export_form extends moodleform {
-
- function definition() {
- $mform = $this->_form;
-
- $mform->addElement('header', 'database', get_string('dbexport', 'dbtransfer'));
- $mform->addElement('textarea', 'description', get_string('description'), array('rows'=>5, 'cols'=>60));
-
- $this->add_action_buttons(false, get_string('exportdata', 'dbtransfer'));
- }
-}
+++ /dev/null
-<?php
-
-require('../../config.php');
-require_once('lib.php');
-require_once('database_export_form.php');
-
-require_login();
-admin_externalpage_setup('dbexport');
-
-//create form
-$form = new database_export_form();
-
-if ($data = $form->get_data()) {
- dbtransfer_export_xml_database($data->description, $DB);
- die;
-}
-
-echo $OUTPUT->header();
-// TODO: add some more info here
-$form->display();
-echo $OUTPUT->footer();
+++ /dev/null
-<?php
-
-require('../../config.php');
-require_once('lib.php');
-require_once('database_transfer_form.php');
-
-require_login();
-admin_externalpage_setup('dbtransfer');
-
-// Create the form
-$form = new database_transfer_form();
-
-// If we have valid input.
-if ($data = $form->get_data()) {
- // Connect to the other database.
- list($dbtype, $dblibrary) = explode('/', $data->driver);
- $targetdb = moodle_database::get_driver_instance($dbtype, $dblibrary);
- if (!$targetdb->connect($data->dbhost, $data->dbuser, $data->dbpass, $data->dbname, $data->prefix, null)) {
- throw new dbtransfer_exception('notargetconectexception', null, "$CFG->wwwroot/$CFG->admin/dbtransfer/");
- }
- if ($targetdb->get_tables()) {
- throw new dbtransfer_exception('targetdatabasenotempty', null, "$CFG->wwwroot/$CFG->admin/dbtransfer/");
- }
-
- // Start output.
- echo $OUTPUT->header();
- $data->dbtype = $dbtype;
- echo $OUTPUT->heading(get_string('transferringdbto', 'dbtransfer', $data));
-
- // Do the transfer.
- $feedback = new html_list_progress_trace();
- dbtransfer_transfer_database($DB, $targetdb, $feedback);
- $feedback->finished();
-
- // Finish up.
- echo $OUTPUT->notification(get_string('success'), 'notifysuccess');
- echo $OUTPUT->continue_button("$CFG->wwwroot/$CFG->admin/");
- echo $OUTPUT->footer();
- die;
-}
-
-// Otherwise display the settings form.
-echo $OUTPUT->header();
-echo $OUTPUT->heading(get_string('transferdbtoserver', 'dbtransfer'));
-echo '<p>', get_string('transferdbintro', 'dbtransfer'), "</p>\n\n";
-$form->display();
-echo $OUTPUT->footer();
print_upgrade_reload('index.php?confirmupgrade=1');
} else {
echo $OUTPUT->notification(get_string('environmentok', 'admin'), 'notifysuccess');
- if (empty($CFG->skiplangupgrade)) {
+ if (empty($CFG->skiplangupgrade) and current_language() !== 'en') {
echo $OUTPUT->box_start('generalbox', 'notice');
print_string('langpackwillbeupdated', 'admin');
echo $OUTPUT->box_end();
echo $OUTPUT->box(get_string('cronwarning', 'admin').' '.$helpbutton, 'generalbox adminwarning');
}
-// Hidden bloglevel upgrade
-$showbloglevelupgrade = ($CFG->bloglevel == BLOG_COURSE_LEVEL || $CFG->bloglevel == BLOG_GROUP_LEVEL) && empty($CFG->bloglevel_upgrade_complete);
-if ($showbloglevelupgrade) {
- echo $OUTPUT->box(get_string('bloglevelupgradenotice', 'admin'), 'generalbox adminwarning');
-}
-
// diagnose DB, especially the sloppy MyISAM tables
$diagnose = $DB->diagnose();
if ($diagnose !== NULL) {
+++ /dev/null
-<?php
-
- require_once('../config.php');
- require_once($CFG->libdir.'/adminlib.php');
-
- admin_externalpage_setup('toinodb');
-
- $confirm = optional_param('confirm', 0, PARAM_BOOL);
-
- require_login();
-
- require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
-
- echo $OUTPUT->header();
- echo $OUTPUT->heading('Convert all MySQL tables from MYISAM to InnoDB');
-
- if ($DB->get_dbfamily() != 'mysql') {
- notice('This function is for MySQL databases only!', 'index.php');
- }
-
- if (data_submitted() and $confirm and confirm_sesskey()) {
-
- echo $OUTPUT->notification('Please be patient and wait for this to complete...', 'notifysuccess');
-
- if ($tables = $DB->get_tables()) {
- $DB->set_debug(true);
- foreach ($tables as $table) {
- $fulltable = $DB->get_prefix().$table;
- $DB->change_database_structure("ALTER TABLE $fulltable TYPE=INNODB");
- }
- $DB->set_debug(false);
- }
- echo $OUTPUT->notification('... done.', 'notifysuccess');
- echo $OUTPUT->continue_button('index.php');
- echo $OUTPUT->footer();
-
- } else {
- $optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
- $formcontinue = new single_button(new moodle_url('/admin/innodb.php', $optionsyes), get_string('yes'));
- $formcancel = new single_button(new moodle_url('/admin/index.php'), get_string('no'), 'get');
- echo $OUTPUT->confirm('Are you sure you want convert all your tables to the InnoDB format?', $formcontinue, $formcancel);
- echo $OUTPUT->footer();
- }
-
-
<?php
- // index.php - scheduled backup logs
+// 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/>.
- require_once('../../../config.php');
- require_once($CFG->libdir.'/adminlib.php');
- require_once($CFG->dirroot.'/backup/lib.php');
+/**
+ * A report to display the outcome of scheduled backups
+ *
+ * @package report
+ * @subpackage backups
+ * @copyright 2007 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
- $courseid = optional_param('courseid', 0, PARAM_INT);
+require_once('../../../config.php');
+require_once($CFG->libdir.'/adminlib.php');
+require_once($CFG->dirroot.'/backup/lib.php');
- admin_externalpage_setup('reportbackups');
- echo $OUTPUT->header();
+admin_externalpage_setup('reportbackups');
-/// Automated backups aren't active by the site admin
- $backup_config = backup_get_config();
- if (empty($backup_config->backup_auto_active)) {
- echo $OUTPUT->notification(get_string('automatedbackupsinactive', 'backup'));
- }
-
-/// Get needed strings
- $backuploglaststatus = get_string("backuploglaststatus");
- $backuplogdetailed = get_string("backuplogdetailed");
- $stradmin = get_string("administration");
- $strconfiguration = get_string("configuration");
- $strbackup = get_string("backup");
- $strbackupdetails = get_string("backupdetails");
- $strlogs = get_string("logs");
- $strftimedatetime = get_string("strftimerecent");
- $strftimetime = get_string("strftimetime").":%S";
- $strerror = get_string("error");
- $strok = get_string("ok");
- $strunfinished = get_string("unfinished");
- $strskipped = get_string("skipped");
- $strcourse = get_string("course");
- $strtimetaken = get_string("timetaken","quiz");
- $strstatus = get_string("status");
- $strnext = get_string("backupnext");
+$table = new html_table;
+$table->head = array(
+ get_string("course"),
+ get_string("timetaken", "quiz"),
+ get_string("status"),
+ get_string("backupnext")
+);
+$table->headspan = array(1, 3, 1, 1);
+$table->attributes = array('class' => 'generaltable backup-report');
+$table->data = array();
-/// Decide when to show last execution logs or detailed logs
-/// Lastlog view
- if (!$courseid) {
- echo $OUTPUT->heading($backuploglaststatus);
- echo $OUTPUT->box_start();
- /// Now, get every record from backup_courses
- $courses = $DB->get_records("backup_courses");
+$strftimedatetime = get_string("strftimerecent");
+$strerror = get_string("error");
+$strok = get_string("ok");
+$strunfinished = get_string("unfinished");
+$strskipped = get_string("skipped");
- if (!$courses) {
- echo $OUTPUT->notification(get_string('nologsfound'));
- } else {
- echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
- //Print table header
- echo "<tr>";
- echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strcourse</font></td>";
- echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\"><font size=\"3\">$strtimetaken</font></td>";
- echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strstatus</font></td>";
- echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strnext</font></td></tr>";
- foreach ($courses as $course) {
- /// Get the course shortname
- $coursename = $DB->get_field ("course", "fullname", array("id"=>$course->courseid));
- if ($coursename) {
- echo "<tr>";
- echo "<td nowrap=\"nowrap\"><font size=\"2\"><a href=\"index.php?courseid=$course->courseid\">".$coursename."</a></font></td>";
- echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->laststarttime,$strftimedatetime)."</font></td>";
- echo "<td nowrap=\"nowrap\"><font size=\"2\"> - </font></td>";
- echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->lastendtime,$strftimedatetime)."</font></td>";
- if ($course->laststatus == 1) {
- echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strok."</font></td>";
- } else if ($course->laststatus == 2) {
- echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strunfinished."</font></td>";
- } else if ($course->laststatus == 3) {
- echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strskipped."</font></td>";
- } else {
- echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strerror."</font></td>";
- }
- echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->nextstarttime,$strftimedatetime)."</font></td>";
- echo "</tr>";
- }
- }
- echo "</table>";
- }
- echo $OUTPUT->box_end();
-/// Detailed View !!
- } else {
- echo $OUTPUT->heading($backuplogdetailed);
+list($select, $join) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
+$sql = "SELECT bc.*, c.fullname $select
+ FROM {backup_courses} bc
+ JOIN {course} c ON c.id = bc.courseid
+ $join";
+$rs = $DB->get_recordset_sql($sql);
+foreach ($rs as $backuprow) {
- $coursename = $DB->get_field("course", "fullname", array("id"=>"$courseid"));
- echo $OUTPUT->heading("$strcourse: $coursename");
+ // Cache the course context
+ context_instance_preload($backuprow);
- echo $OUTPUT->box_start();
+ // Prepare a cell to display the status of the entry
+ if ($backuprow->laststatus == 1) {
+ $status = $strok;
+ $statusclass = 'backup-ok'; // Green
+ } else if ($backuprow->laststatus == 2) {
+ $status = $strunfinished;
+ $statusclass = 'backup-unfinished'; // Red
+ } else if ($backuprow->laststatus == 3) {
+ $status = $strskipped;
+ $statusclass = 'backup-skipped'; // Green
+ } else {
+ $status = $strerror;
+ $statusclass = 'backup-error'; // Red
+ }
+ $status = new html_table_cell($status);
+ $status->attributes = array('class' => $statusclass);
- /// First, me get all the distinct backups for that course in backup_log
- $executions = $DB->get_records_sql("SELECT DISTINCT laststarttime
- FROM {backup_log}
- WHERE courseid = ? AND backuptype = ?
- ORDER BY laststarttime DESC", array($courseid,'scheduledbackup'));
+ // Create the row and add it to the table
+ $cells = array(
+ format_string($backuprow->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $backuprow->courseid))),
+ userdate($backuprow->laststarttime, $strftimedatetime),
+ '-',
+ userdate($backuprow->lastendtime, $strftimedatetime),
+ $status,
+ userdate($backuprow->nextstarttime, $strftimedatetime)
+ );
+ $table->data[] = new html_table_row($cells);
+}
+$rs->close();
- /// Iterate over backup executions
- if (!$executions) {
- echo $OUTPUT->notification(get_string('nologsfound'));
- } else {
- echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
- foreach($executions as $execution) {
- echo "<tr>";
- echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\">";
- echo $OUTPUT->box(userdate($execution->laststarttime));
- echo "</td>";
- echo "</tr>";
- $logs = $DB->get_records_sql("SELECT *
- FROM {backup_log}
- WHERE courseid = ? AND laststarttime = ? AND backuptype = ?
- ORDER BY id", array($courseid, $execution->laststarttime,'scheduledbackup'));
- if ($logs) {
- foreach ($logs as $log) {
- echo "<tr>";
- echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($log->time,$strftimetime)."</font></td>";
- $log->info = str_replace("- ERROR!!","- <font color=\"red\">ERROR!!</font>",$log->info);
- $log->info = str_replace("- OK","- <font color=\"green\">OK</font>",$log->info);
- echo "<td nowrap=\"nowrap\"><font size=\"2\">".str_replace(" "," ",$log->info)."</font></td>";
- echo "</tr>";
- }
- }
- }
- echo "</table>";
- }
- echo $OUTPUT->box_end();
- }
+// Check if we have any results and if not add a no records notification
+if (empty($table->data)) {
+ $cell = new html_table_cell($OUTPUT->notification(get_string('nologsfound')));
+ $cell->colspan = 6;
+ $table->data[] = new html_table_row(array($cell));
+}
- echo $OUTPUT->footer();
+$automatedbackupsenabled = get_config('backup', 'backup_auto_active');
+// Display the backup report
+echo $OUTPUT->header();
+echo $OUTPUT->heading(get_string("backuploglaststatus"));
+echo $OUTPUT->box_start();
+if (empty($automatedbackupsenabled)) {
+ // Automated backups aren't active, display a notification.
+ // Not we don't stop because of this as perhaps scheduled backups are being run
+ // automatically, or were enabled in the page.
+ echo $OUTPUT->notification(get_string('automatedbackupsinactive', 'backup'));
+}
+echo html_writer::table($table);
+echo $OUTPUT->box_end();
+echo $OUTPUT->footer();
\ No newline at end of file
<?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/>.
+
+/**
+ * Settings for the backups report
+ *
+ * @package report
+ * @subpackage backups
+ * @copyright 2007 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
defined('MOODLE_INTERNAL') || die;
+++ /dev/null
-<?php
-
-defined('MOODLE_INTERNAL') || die;
-
-$ADMIN->add('roles', new admin_externalpage('reportcapability', get_string('pluginname', 'report_capability'), "$CFG->wwwroot/$CFG->admin/report/capability/index.php",'moodle/role:manage'));
+++ /dev/null
-<?php
-
-defined('MOODLE_INTERNAL') || die;
-
-// profiling report, added to development
-if (extension_loaded('xhprof') && function_exists('xhprof_enable') && (!empty($CFG->profilingenabled) || !empty($CFG->earlyprofilingenabled))) {
- $ADMIN->add('development', new admin_externalpage('reportprofiling', get_string('pluginname', 'report_profiling'), "$CFG->wwwroot/$CFG->admin/report/profiling/index.php", 'moodle/site:config'));
-}
+++ /dev/null
-/* report_profiling styles */
-
-.path-admin-report-profiling .profilingruntable .label {
- font-weight: bold;
-}
-.path-admin-report-profiling .profiling_worse {
- color: red;
-}
-.path-admin-report-profiling .profiling_better {
- color: green;
-}
-.path-admin-report-profiling .profiling_same {
- color: dimgrey;
-}
-.path-admin-report-profiling .profiling_important,
-.path-admin-report-profiling .flexible .referencerun {
- font-weight: bold;
-}
-.path-admin-report-profiling .flexible .r1 .cell {
- background-color: whitesmoke;
-}
-.path-admin-report-profiling .flexible {
- margin-left:auto;
- margin-right:auto
-}
+++ /dev/null
-<?php
-
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-$capabilities = array(
-
- 'report/unittest:view' => array(
- 'riskbitmask' => RISK_DATALOSS,
- 'captype' => 'read',
- 'contextlevel' => CONTEXT_SYSTEM,
- 'archetypes' => array(
- 'manager' => CAP_ALLOW
- ),
-
- 'clonepermissionsfrom' => 'moodle/site:config',
- )
-);
+++ /dev/null
-<?php
-
-defined('MOODLE_INTERNAL') || die;
-
-if ($hassiteconfig) {
- $ADMIN->add('development', new admin_externalpage('reportsimpletest', get_string('simpletest', 'admin'), "$CFG->wwwroot/$CFG->admin/report/unittest/index.php",'report/unittest:view'));
- $ADMIN->add('development', new admin_externalpage('reportdbtest', get_string('dbtest', 'admin'), "$CFG->wwwroot/$CFG->admin/report/unittest/dbtest.php",'report/unittest:view'));
-}
+++ /dev/null
-<?PHP
-
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-$plugin->version = 2010090501;
-$plugin->requires = 2010090501;
-
$ADMIN->add('experimental', $temp);
- // DB transfer related pages
- $ADMIN->add('experimental', new admin_externalpage('dbtransfer', get_string('dbtransfer', 'dbtransfer'), $CFG->wwwroot.'/'.$CFG->admin.'/dbtransfer/index.php', 'moodle/site:config', true));
- $ADMIN->add('experimental', new admin_externalpage('dbexport', get_string('dbexport', 'dbtransfer'), $CFG->wwwroot.'/'.$CFG->admin.'/dbtransfer/dbexport.php', 'moodle/site:config', true));
-
// "debugging" settingpage
$temp = new admin_settingpage('debugging', get_string('debugging', 'admin'));
$temp->add(new admin_setting_special_debug());
}
- // XMLDB editor
- $ADMIN->add('development', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), "$CFG->wwwroot/$CFG->admin/xmldb/"));
-
-
// Web service test clients DO NOT COMMIT : THE EXTERNAL WEB PAGE IS NOT AN ADMIN PAGE !!!!!
$ADMIN->add('development', new admin_externalpage('testclient', get_string('testclient', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/testclient.php"));
$ADMIN->add('language', $temp);
- $ADMIN->add('language', new admin_externalpage('langimport', get_string('langpacks', 'admin'), "$CFG->wwwroot/$CFG->admin/langimport.php"));
-
- // Hidden multilang upgrade page.
- $ADMIN->add('language', new admin_externalpage('multilangupgrade', get_string('multilangupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/multilangupgrade.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted)));
-
} // end of speedup
$ADMIN->add('reports', new admin_externalpage('report'.$plugin, $reportname, $www_path, 'moodle/site:viewreports'));
}
+// Now add various admin tools
+foreach (get_plugin_list('tool') as $plugin => $plugindir) {
+ $settings_path = "$plugindir/settings.php";
+ if (file_exists($settings_path)) {
+ include($settings_path);
+ }
+}
/// Add all local plugins - must be always last!
if ($hassiteconfig) {
$ADMIN->add('server', new admin_externalpage('adminregistration', get_string('registration','admin'), "$CFG->wwwroot/$CFG->admin/registration/index.php"));
-$ADMIN->add('root', new admin_externalpage('bloglevelupgrade', get_string('bloglevelupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/blocklevelupgrade.php', 'moodle/site:config', true));
} // end of speedup
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$ADMIN->add('unsupported', new admin_externalpage('purgemoodledata', 'Purge moodledata', $CFG->wwwroot.'/'.$CFG->admin.'/delete.php', 'moodle/site:config', true));
- $ADMIN->add('unsupported', new admin_externalpage('healthcenter', get_string('healthcenter'), $CFG->wwwroot.'/'.$CFG->admin.'/health.php', 'moodle/site:config', true));
- $ADMIN->add('unsupported', new admin_externalpage('toinodb', 'Convert to InnoDB', $CFG->wwwroot.'/'.$CFG->admin.'/innodb.php', 'moodle/site:config', true));
$ADMIN->add('unsupported', new admin_externalpage('replace', 'Search and replace', $CFG->wwwroot.'/'.$CFG->admin.'/replace.php', 'moodle/site:config', true));
} // end of speedup
$ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role')));
if ($hassiteconfig
- or has_capability('moodle/site:uploadusers', $systemcontext)
or has_capability('moodle/user:create', $systemcontext)
or has_capability('moodle/user:update', $systemcontext)
or has_capability('moodle/user:delete', $systemcontext)
$ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
$ADMIN->add('accounts', new admin_externalpage('userbulk', get_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
$ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
- $ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers', 'admin'), "$CFG->wwwroot/$CFG->admin/uploaduser.php", 'moodle/site:uploadusers'));
- $ADMIN->add('accounts', new admin_externalpage('uploadpictures', get_string('uploadpictures','admin'), "$CFG->wwwroot/$CFG->admin/uploadpicture.php", 'moodle/site:uploadusers'));
$ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
$ADMIN->add('accounts', new admin_externalpage('cohorts', get_string('cohorts', 'cohort'), $CFG->wwwroot . '/cohort/index.php', array('moodle/cohort:manage', 'moodle/cohort:view')));
--- /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/>.
+
+/**
+ * Post installation and migration code.
+ *
+ * @package tool
+ * @subpackage bloglevelupgrade
+ * @copyright 2011 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+function xmldb_tool_bloglevelupgrade_install() {
+ global $CFG, $OUTPUT;
+
+ // this is a hack - admins were long ago instructed to upgrade blog levels,
+ // the problem is that blog is not supposed to be course level activity!!
+
+ if (!empty($CFG->bloglevel_upgrade_complete)) {
+ // somebody already upgrades, we do not need this any more
+ unset_config('bloglevel_upgrade_complete');
+ return;
+ }
+
+ if (!isset($CFG->bloglevel)) {
+ // fresh install?
+ return;
+ }
+
+ if (($CFG->bloglevel == BLOG_COURSE_LEVEL || $CFG->bloglevel == BLOG_GROUP_LEVEL)) {
+ // inform admins that some settings require attention after upgrade
+ $site = get_site();
+
+ $a = new StdClass;
+ $a->sitename = $site->fullname;
+ $a->fixurl = "$CFG->wwwroot/$CFG->admin/tool/bloglevelupgrade/index.php";
+
+ $subject = get_string('bloglevelupgrade', 'tool_bloglevelupgrade');
+ $description = get_string('bloglevelupgradedescription', 'tool_bloglevelupgrade', $a);
+
+ // can not use messaging here because it is not configured yet!
+ upgrade_log(UPGRADE_LOG_NOTICE, null, $subject, $description);
+ set_config('tool_bloglevelupgrade_pending', 1);
+
+ echo $OUTPUT->notification($description);
+ }
+}
+
+
<?php
- /// Create "blog" forums in each course and copy blog entries from these courses' participants in these forums
+// 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/>.
+
+/**
+ * Create "blog" forums in each course and copy blog entries from these courses' participants in these forums
+ *
+ * @package tool
+ * @subpackage bloglevelupgrade
+ * @copyright 2009 Nicolas Connault
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
define('NO_OUTPUT_BUFFERING', true);
-require_once('../config.php');
+require('../../../config.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->dirroot.'/blog/lib.php');
require_once($CFG->dirroot.'/mod/forum/lib.php');
require_once($CFG->libdir.'/adminlib.php');
-admin_externalpage_setup('bloglevelupgrade');
+admin_externalpage_setup('toolbloglevelupgrade');
$PAGE->set_pagelayout('maintenance');
$go = optional_param('go', 0, PARAM_BOOL);
echo $OUTPUT->header();
-echo $OUTPUT->heading(get_string('bloglevelupgrade', 'admin'));
+echo $OUTPUT->heading(get_string('pluginname', 'tool_bloglevelupgrade'));
-$strbloglevelupgrade = get_string('bloglevelupgradeinfo', 'admin');
+$strbloglevelupgrade = get_string('bloglevelupgradeinfo', 'tool_bloglevelupgrade');
if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form
$optionsyes = array('go'=>1, 'sesskey'=>sesskey());
- echo $OUTPUT->confirm($strbloglevelupgrade, new moodle_url('bloglevelupgrade.php', $optionsyes), 'index.php');
+ echo $OUTPUT->confirm($strbloglevelupgrade, new moodle_url('/admin/tool/bloglevelupgrade/index.php', $optionsyes), new moodle_url('/admin/index.php'));
echo $OUTPUT->footer();
die;
}
// whose enrolled students have written blog entries, copy these entries in that forum and switch off blogs at site level
if ($CFG->bloglevel == BLOG_COURSE_LEVEL || $CFG->bloglevel == BLOG_GROUP_LEVEL) {
- $pbar = new progress_bar('bloglevelupgrade', 500, true);
+ $pbar = new progress_bar('toolbloglevelupgrade', 500, true);
$bloggers = $DB->get_records_sql("SELECT userid FROM {post} WHERE module = 'blog' GROUP BY userid");
require_once($CFG->dirroot.'/mod/forum/lib.php');
}
$a->userscount = $i . '/' . count($bloggers);
- $pbar->update($i, count($bloggers), get_string('bloglevelupgradeprogress', 'admin', $a));
+ $pbar->update($i, count($bloggers), get_string('bloglevelupgradeprogress', 'tool_bloglevelupgrade', $a));
$i++;
}
}
// END OF LOOP
// set conversion flag - switches to new plugin automatically
-set_config('bloglevel_upgrade_complete', 1);
+unset_config('tool_bloglevelupgrade_pending');
// Finally switch bloglevel to 0 (disabled)
set_config('bloglevel', 0);
rebuild_course_cache();
echo $OUTPUT->notification('...finished', 'notifysuccess');
-echo $OUTPUT->continue_button('index.php');
+echo $OUTPUT->continue_button(new moodle_url('/admin/index.php'));
echo $OUTPUT->footer();
die;
--- /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/>.
+
+/**
+ * Strings for component 'tool_bloglevelupgrade', language 'en', branch 'MOODLE_22_STABLE'
+ *
+ * @package tool
+ * @subpackage bloglevelupgrade
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['bloglevelupgradedescription'] = '<p>This site has recently been upgraded to Moodle 2.0.</p>
+<p>Blog visibility was simplified in 2.0, but your site still uses one of the old visibility types. </p>
+<p>To preserve the course-based or group-based visibility of the blog entries on your site, you need to run the following upgrade script, which will create a special "blog" type forum in each course whose enrolled users have posted blog entries, and will copy these blog entries in this special forum. </p>
+<p>Blogs will then be entirely switched off at the site level. No blog entries will be deleted in the process.</p>
+<p>You can run the script by visiting <a href="{$a->fixurl}">the blog level upgrade page</a>.</p>';
+$string['bloglevelupgradeinfo'] = 'Blog visibility was simplified in 2.0, but your site still uses one of the old visibility types. To preserve the course-based or group-based visibility of the blog entries on your site, the following upgrade script will create a special "blog" type forum in each course whose enrolled users have posted blog entries, and will copy these blog entries in this special forum. Blogs will then be entirely switched off at the site level. No blog entries will be deleted in the process.';
+$string['bloglevelupgradeprogress'] = 'Conversion progress: {$a->userscount} users reviewed, {$a->blogcount} entries converted.';
+$string['pluginname'] = 'Blog visibility upgrade';
--- /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/>.
+
+/**
+ * Capability overview settings
+ *
+ * @package tool
+ * @subpackage bloglevelupgrade
+ * @copyright 2011 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+if ($hassiteconfig) {
+ $ADMIN->add('root', new admin_externalpage('toolbloglevelupgrade', get_string('pluginname', 'tool_bloglevelupgrade'), $CFG->wwwroot.'/'.$CFG->admin.'/tool/bloglevelupgrade/index.php', 'moodle/site:config', empty($CFG->tool_bloglevelupgrade_pending)));
+}
--- /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/>.
+
+/**
+ * Version details.
+ *
+ * @package tool
+ * @subpackage bloglevelupgrade
+ * @copyright 2011 petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011091600; // Requires this Moodle version
+$plugin->component = 'tool_bloglevelupgrade'; // Full name of the plugin (used for diagnostics)
<?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/>.
+
/**
* For a given capability, show what permission it has for every role, and
* everywhere that it is overridden.
*
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package roles
+ * @package tool
+ * @subpackage capability
+ * @copyright 2008 Tim Hunt
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-/** */
-require_once(dirname(__FILE__).'/../../../config.php');
+require_once(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
// Check permissions.
}
// Include the required JavaScript.
-$PAGE->requires->js_init_call('M.report_capability.init', array(get_string('search')));
+$PAGE->requires->js_init_call('M.tool_capability.init', array(get_string('search')));
// Log.
-add_to_log(SITEID, "admin", "report capability", "report/capability/index.php?capability=$capability", $capability);
+add_to_log(SITEID, "admin", "tool capability", "tool/capability/index.php?capability=$capability", $capability);
// Print the header.
-admin_externalpage_setup('reportcapability');
+admin_externalpage_setup('toolcapability');
echo $OUTPUT->header();
// Prepare the list of capabilities to choose from
// Print the settings form.
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
-echo '<form method="get" action="." id="settingsform"><div>';
-echo $OUTPUT->heading(get_string('reportsettings', 'report_capability'));
-echo '<p id="intro">', get_string('intro', 'report_capability') , '</p>';
-echo '<p><label for="menucapability"> ' . get_string('capabilitylabel', 'report_capability') . '</label></p>';
+echo '<form method="get" action="" id="settingsform"><div>';
+echo $OUTPUT->heading(get_string('reportsettings', 'tool_capability'));
+echo '<p id="intro">', get_string('intro', 'tool_capability') , '</p>';
+echo '<p><label for="menucapability"> ' . get_string('capabilitylabel', 'tool_capability') . '</label></p>';
echo html_writer::select($capabilitychoices, 'capability', $capability, array(''=>'choose'), array('size'=>10));
-echo '<p><label for="menuroles"> ' . get_string('roleslabel', 'report_capability') . '</label></p>';
+echo '<p><label for="menuroles"> ' . get_string('roleslabel', 'tool_capability') . '</label></p>';
echo html_writer::select($rolechoices, 'roles[]', $selectedroleids, false, array('size'=>10, 'multiple'=>'multiple'));
-echo '<p><input type="submit" id="settingssubmit" value="' . get_string('getreport', 'report_capability') . '" /></p>';
+echo '<p><input type="submit" id="settingssubmit" value="' . get_string('getreport', 'tool_capability') . '" /></p>';
echo '</div></form>';
echo $OUTPUT->box_end();
}
// Print the report heading.
- echo $OUTPUT->heading(get_string('reportforcapability', 'report_capability', get_capability_string($capability)), 2, 'main', 'report');
+ echo $OUTPUT->heading(get_string('reportforcapability', 'tool_capability', get_capability_string($capability)), 2, 'main', 'report');
if (count($cleanedroleids) != count($allroles)) {
$rolenames = array();
foreach ($cleanedroleids as $roleid) {
$rolenames[] = $allroles[$roleid]->name;
}
- echo '<p>', get_string('forroles', 'report_capability', implode(', ', $rolenames)), '</p>';
+ echo '<p>', get_string('forroles', 'tool_capability', implode(', ', $rolenames)), '</p>';
}
// Now, recursively print the contexts, and the role information.
// make changes.
if ($contextid == get_system_context()->id) {
$url = "$CFG->wwwroot/$CFG->admin/roles/manage.php";
- $title = get_string('changeroles', 'report_capability');
+ $title = get_string('changeroles', 'tool_capability');
} else {
$url = "$CFG->wwwroot/$CFG->admin/roles/override.php?contextid=$contextid";
- $title = get_string('changeoverrides', 'report_capability');
+ $title = get_string('changeoverrides', 'tool_capability');
}
echo '<h3><a href="' . $url . '" title="' . $title . '">', print_context_name($contexts[$contextid]), '</a></h3>';
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Strings for component 'report_capability', language 'en', branch 'MOODLE_20_STABLE'
+ * Strings for component 'tool_capability', language 'en', branch 'MOODLE_22_STABLE'
*
- * @package report_capability
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package tool
+ * @subpackage capability
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['capabilitylabel'] = 'Capability:';
-$string['capabilityreport'] = 'Capability report';
+$string['capabilityreport'] = 'Capability overview';
$string['forroles'] = 'For roles {$a}';
-$string['getreport'] = 'Get the report';
+$string['getreport'] = 'Get the overview';
$string['changeoverrides'] = 'Change overrides in this context';
$string['changeroles'] = 'Change role definitions';
$string['intro'] = 'This report shows, for a particular capability, what permission that capability has in the definition of every role (or a selection of roles), and everywhere in the site where that capability is overridden.';
-$string['pluginname'] = 'Capability report';
+$string['pluginname'] = 'Capability overview';
$string['reportforcapability'] = 'Report for capability \'{$a}\'';
$string['reportsettings'] = 'Report settings';
$string['roleslabel'] = 'Roles:';
-M.report_capability = {
+M.tool_capability = {
select: null,
input: null,
button: null,
init: function(Y, strsearch) {
- var context = M.report_capability;
+ var context = M.tool_capability;
// Find the form controls.
context.select = document.getElementById('menucapability');
},
typed: function() {
- var context = M.report_capability;
+ var context = M.tool_capability;
var filtertext = context.input.value;
var options = context.select.options;
},
validate: function() {
- var context = M.report_capability;
+ var context = M.tool_capability;
context.button.disabled = (context.select.value == '');
}
}
\ No newline at end of file
--- /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/>.
+
+/**
+ * Capability overview settings
+ *
+ * @package tool
+ * @subpackage capability
+ * @copyright 2008 Tim Hunt
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+$ADMIN->add('roles', new admin_externalpage('toolcapability', get_string('pluginname', 'tool_capability'), "$CFG->wwwroot/$CFG->admin/tool/capability/index.php",'moodle/role:manage'));
--- /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/>.
+
+/**
+ * Version details.
+ *
+ * @package tool
+ * @subpackage capability
+ * @copyright 2011 petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011091600; // Requires this Moodle version
+$plugin->component = 'tool_capability'; // Full name of the plugin (used for diagnostics)
--- /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/>.
+
+/**
+ * Transfer form
+ *
+ * @package tool
+ * @subpackage dbtransfer
+ * @copyright 2008 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+require_once $CFG->libdir.'/formslib.php';
+
+class database_export_form extends moodleform {
+
+ function definition() {
+ $mform = $this->_form;
+
+ $mform->addElement('header', 'database', get_string('dbexport', 'tool_dbtransfer'));
+ $mform->addElement('textarea', 'description', get_string('description'), array('rows'=>5, 'cols'=>60));
+
+ $this->add_action_buttons(false, get_string('exportdata', 'tool_dbtransfer'));
+ }
+}
<?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/>.
-if (!defined('MOODLE_INTERNAL')) {
- die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
-}
+/**
+ * Transfer form
+ *
+ * @package tool
+ * @subpackage dbtransfer
+ * @copyright 2008 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
require_once $CFG->libdir.'/formslib.php';
function definition() {
$mform = $this->_form;
- $mform->addElement('header', 'database', get_string('dbtransfer', 'dbtransfer'));
+ $mform->addElement('header', 'database', get_string('dbtransfer', 'tool_dbtransfer'));
$supported = array (
'mysqli/native',
$mform->addRule('dbpass', get_string('required'), 'required', null);
$mform->addRule('prefix', get_string('required'), 'required', null);
- $this->add_action_buttons(false, get_string('transferdata', 'dbtransfer'));
+ $this->add_action_buttons(false, get_string('transferdata', 'tool_dbtransfer'));
}
}
--- /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/>.
+
+/**
+ * Export
+ *
+ * @package tool
+ * @subpackage dbtransfer
+ * @copyright 2008 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+define('NO_OUTPUT_BUFFERING', true);
+
+require('../../../config.php');
+require_once('locallib.php');
+require_once('database_export_form.php');
+
+require_login();
+admin_externalpage_setup('tooldbexport');
+
+//create form
+$form = new database_export_form();
+
+if ($data = $form->get_data()) {
+ dbtransfer_export_xml_database($data->description, $DB);
+ die;
+}
+
+echo $OUTPUT->header();
+// TODO: add some more info here
+$form->display();
+echo $OUTPUT->footer();
--- /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/>.
+
+/**
+ * Transfer tool
+ *
+ * @package tool
+ * @subpackage dbtransfer
+ * @copyright 2008 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+define('NO_OUTPUT_BUFFERING', true);
+
+require('../../../config.php');
+require_once('locallib.php');
+require_once('database_transfer_form.php');
+
+require_login();
+admin_externalpage_setup('tooldbtransfer');
+
+// Create the form
+$form = new database_transfer_form();
+
+// If we have valid input.
+if ($data = $form->get_data()) {
+ // Connect to the other database.
+ list($dbtype, $dblibrary) = explode('/', $data->driver);
+ $targetdb = moodle_database::get_driver_instance($dbtype, $dblibrary);
+ if (!$targetdb->connect($data->dbhost, $data->dbuser, $data->dbpass, $data->dbname, $data->prefix, null)) {
+ throw new dbtransfer_exception('notargetconectexception', null, "$CFG->wwwroot/$CFG->admin/tool/dbtransfer/");
+ }
+ if ($targetdb->get_tables()) {
+ throw new dbtransfer_exception('targetdatabasenotempty', null, "$CFG->wwwroot/$CFG->admin/tool/dbtransfer/");
+ }
+
+ // Start output.
+ echo $OUTPUT->header();
+ $data->dbtype = $dbtype;
+ echo $OUTPUT->heading(get_string('transferringdbto', 'tool_dbtransfer', $data));
+
+ // Do the transfer.
+ $feedback = new html_list_progress_trace();
+ dbtransfer_transfer_database($DB, $targetdb, $feedback);
+ $feedback->finished();
+
+ // Finish up.
+ echo $OUTPUT->notification(get_string('success'), 'notifysuccess');
+ echo $OUTPUT->continue_button("$CFG->wwwroot/$CFG->admin/");
+ echo $OUTPUT->footer();
+ die;
+}
+
+// Otherwise display the settings form.
+echo $OUTPUT->header();
+echo $OUTPUT->heading(get_string('transferdbtoserver', 'tool_dbtransfer'));
+echo '<p>', get_string('transferdbintro', 'tool_dbtransfer'), "</p>\n\n";
+$form->display();
+echo $OUTPUT->footer();
--- /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/>.
+
+/**
+ * Strings for component 'tool_generator', language 'en', branch 'MOODLE_22_STABLE'
+ *
+ * @package tool
+ * @subpackage dbtransfer
+ * @copyright 2011 petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['dbexport'] = 'Database transfer';
+$string['dbtransfer'] = 'Database export';
+$string['exportdata'] = 'Export data';
+$string['notargetconectexception'] = 'Can not connect target database, sorry.';
+$string['pluginname'] = 'Database transfer';
+$string['transferdata'] = 'Transfer data';
+$string['transferdbintro'] = 'This script will transfer the entire contents of this database to another database server.';
+$string['transferdbtoserver'] = 'Transfer this Moodle database to another server';
+$string['transferringdbto'] = 'Transferring this database to {$a->dbtype} database {$a->dbname} on {$a->dbhost}';
+
<?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/>.
+/**
+ * Export db content to file.
+ *
+ * @package tool
+ * @subpackage dbtransfer
+ * @copyright 2008 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
/*
TODO:
- exporting to server file >2GB fails in 32bit operating systems - needs warning
- - we may run out of disk space exporting to srever file - we must verify the file is not truncated; read from the end of file?
+ - we may run out of disk space exporting to server file - we must verify the file is not truncated; read from the end of file?
- when sending file >4GB - FAT32 limit, Apache limit, browser limit - needs warning
- there must be some form of progress bar during export, transfer - new tracking class could be passed around
- command line operation - could work around some 2G/4G limits in PHP; useful for cron full backups
--- /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/>.
+
+/**
+ * Link to InnoDB conversion tool
+ *
+ * @package tool
+ * @subpackage dbtransfer
+ * @copyright 2011 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+if ($hassiteconfig) {
+ // DB transfer related pages
+ $ADMIN->add('experimental', new admin_externalpage('tooldbtransfer', get_string('dbtransfer', 'tool_dbtransfer'), $CFG->wwwroot.'/'.$CFG->admin.'/tool/dbtransfer/index.php', 'moodle/site:config', true));
+ $ADMIN->add('experimental', new admin_externalpage('tooldbexport', get_string('dbexport', 'tool_dbtransfer'), $CFG->wwwroot.'/'.$CFG->admin.'/tool/dbtransfer/dbexport.php', 'moodle/site:config', true));
+}
\ No newline at end of file
--- /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/>.
+
+/**
+ * Version details.
+ *
+ * @package tool
+ * @subpackage dbtransfer
+ * @copyright 2008 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011091600; // Requires this Moodle version
+$plugin->component = 'tool_dbtransfer'; // Full name of the plugin (used for diagnostics)
--- /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/>.
+
+/**
+ * Random course generator CLI interface.
+ *
+ * @package tool
+ * @subpackage generator
+ * @copyright 2009 Nicolas Connault
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+define('CLI_SCRIPT', true);
+
+require(dirname(__FILE__) . '/../../../../config.php');
+require_once(dirname(__FILE__) . '/../locallib.php');
+
+if (!debugging('', DEBUG_DEVELOPER)) {
+ echo("This script is for developers only!!!\n");
+ exit(1);
+}
+
+$generator = new generator_cli($argv, $argc);
+$generator->generate_data();
--- /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/>.
+
+/**
+ * Random course generator.
+ *
+ * @package tool
+ * @subpackage generator
+ * @copyright 2009 Nicolas Connault
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require(dirname(__FILE__) . '/../../../config.php');
+require_once('locallib.php');
+
+
+require_login();
+$systemcontext = get_context_instance(CONTEXT_SYSTEM);
+require_capability('moodle/site:config', $systemcontext);
+if (!is_siteadmin()) {
+ error('Only for admins');
+}
+
+if (!debugging('', DEBUG_DEVELOPER)) {
+ error('This script is for developers only!!!');
+}
+
+$PAGE->set_url('/admin/tool/generator/index.php');
+$PAGE->set_context(get_system_context());
+$PAGE->set_pagelayout('base');
+$generator = new generator_web();
+$generator->setup();
+$generator->display();
+$generator->generate_data();
+$generator->complete();
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Strings for component 'report_unittest', language 'en', branch 'MOODLE_20_STABLE'
+ * Strings for component 'tool_generator', language 'en', branch 'MOODLE_22_STABLE'
*
- * @package report_unittest
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package tool
+ * @subpackage generator
+ * @copyright 2011 petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['pluginname'] = 'Unit tests';
-$string['unittest:view'] = 'Execute unit tests';
+$string['pluginname'] = 'Random course generator';
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
/**
* Random course generator. By Nicolas Connault and friends.
*
- * To use go to .../admin/generator.php?web_interface=1 in your browser.
- *
- * @package generator
- * @copyright 2009 Nicolas Connault
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package tool
+ * @subpackage generator
+ * @copyright 2009 Nicolas Connault
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once(dirname(__FILE__).'/../config.php');
+defined('MOODLE_INTERNAL') || die();
+
require_once($CFG->libdir . '/formslib.php');
require_once($CFG->dirroot .'/course/lib.php');
require_once($CFG->libdir .'/filelib.php');
$help .= " -{$argument->short},$paddingstr1--{$argument->long}$equal$paddingstr2{$argument->help}\n";
}
- $help .= "\nEmail nicolas@moodle.com for any suggestions or bug reports.\n";
+ $help .= "\nUse http://tracker.moodle.org for any suggestions or bug reports.\n";
if ($argc == 1 || in_array($settings[1], array('--help', '-help', '-h', '-?'))) {
echo $help;
echo "Invalid username or password!{$this->eolchar}";
die();
}
- complete_user_login($user);
- $systemcontext = get_context_instance(CONTEXT_SYSTEM);
-
- if (!is_siteadmin($user->id)) {//TODO: add some proper access control check here!!
+ if (!is_siteadmin($user)) {//TODO: add some proper access control check here!!
echo "You do not have administration privileges on this Moodle site. "
."These are required for running the generation script.{$this->eolchar}";
die();
}
+ complete_user_login($user);
}
parent::generate_data();
global $CFG;
$this->mform = new generator_form();
- $this->do_generation = optional_param('do_generation', false, PARAM_BOOL);
-
if ($data = $this->mform->get_data(false)) {
+ $this->do_generation = optional_param('do_generation', false, PARAM_BOOL);
foreach ($this->settings as $setting) {
if (isset($data->{$setting->long})) {
$this->set($setting->long, $data->{$setting->long});
}
}
+ } else {
+ $this->do_generation = false;
}
}
}
}
-
-if (CLI_SCRIPT) {
- $generator = new generator_cli($argv, $argc);
- $generator->generate_data();
-} elseif (strstr($_SERVER['REQUEST_URI'], 'generator.php')) {
- require_login();
- $systemcontext = get_context_instance(CONTEXT_SYSTEM);
- require_capability('moodle/site:config', $systemcontext);
-
- $PAGE->set_url('/admin/generator.php');
- $PAGE->set_pagelayout('base');
- $generator = new generator_web();
- $generator->setup();
- $generator->display();
- $generator->generate_data();
- $generator->complete();
-} else {
- $generator = new generator_silent();
-}
--- /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/>.
+
+/**
+ * Version details.
+ *
+ * @package tool
+ * @subpackage generator
+ * @copyright 2009 Nicolas Connault
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011091600; // Requires this Moodle version
+$plugin->component = 'tool_generator'; // Full name of the plugin (used for diagnostics)
+
+$maturity = MATURITY_ALPHA; // this version's maturity level
<?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/>.
+
+/**
+ * Strings for component 'tool_health', language 'en', branch 'MOODLE_22_STABLE'
+ *
+ * @package tool
+ * @subpackage health
+ * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
ob_start(); //for whitespace test
- require_once('../config.php');
+ require('../../../config.php');
// extra whitespace test - intentionally breaks cookieless mode
$extraws = '';
require_once($CFG->libdir.'/adminlib.php');
- admin_externalpage_setup('healthcenter');
+ admin_externalpage_setup('toolhealth');
define('SEVERITY_NOTICE', 'notice');
define('SEVERITY_ANNOYANCE', 'annoyance');
echo $OUTPUT->header();
-echo <<<STYLES
-<style type="text/css">
-div#healthnoproblemsfound {
- width: 60%;
- margin: auto;
- padding: 1em;
- border: 1px black solid;
- -moz-border-radius: 6px;
-}
-dl.healthissues {
- width: 60%;
- margin: auto;
-}
-dl.critical dt, dl.critical dd {
- background-color: #a71501;
-}
-dl.significant dt, dl.significant dd {
- background-color: #d36707;
-}
-dl.annoyance dt, dl.annoyance dd {
- background-color: #dba707;
-}
-dl.notice dt, dl.notice dd {
- background-color: #e5db36;
-}
-dt.solution, dd.solution, div#healthnoproblemsfound {
- background-color: #5BB83E !important;
-}
-dl.healthissues dt, dl.healthissues dd {
- margin: 0px;
- padding: 1em;
- border: 1px black solid;
-}
-dl.healthissues dt {
- font-weight: bold;
- border-bottom: none;
- padding-bottom: 0.5em;
-}
-dl.healthissues dd {
- border-top: none;
- padding-top: 0.5em;
- margin-bottom: 10px;
-}
-dl.healthissues dd form {
- margin-top: 0.5em;
- text-align: right;
-}
-form#healthformreturn {
- text-align: center;
- margin: 2em;
-}
-dd.solution p {
- padding: 0px;
- margin: 1em 0px;
-}
-dd.solution li {
- margin-top: 1em;
-}
-
-</style>
-STYLES;
-
if(strpos($solution, 'problem_') === 0 && class_exists($solution)) {
health_print_solution($solution);
}
function health_find_problems() {
global $OUTPUT;
- echo $OUTPUT->heading(get_string('healthcenter'));
+ echo $OUTPUT->heading(get_string('pluginname', 'tool_health'));
$issues = array(
SEVERITY_CRITICAL => array(),
for($i = 1; $i < 1000000; ++$i) {
$classname = sprintf('problem_%06d', $i);
if(!class_exists($classname)) {
- break;
+ continue;
}
$problem = new $classname;
+
if($problem->exists()) {
$severity = $problem->severity();
$issues[$severity][$classname] = array(
if($problems == 0) {
echo '<div id="healthnoproblemsfound">';
- echo get_string('healthnoproblemsfound');
+ echo get_string('healthnoproblemsfound', 'tool_health');
echo '</div>';
}
else {
- echo $OUTPUT->heading(get_string('healthproblemsdetected'));
+ echo $OUTPUT->heading(get_string('healthproblemsdetected', 'tool_health'));
$severities = array(SEVERITY_CRITICAL, SEVERITY_SIGNIFICANT, SEVERITY_ANNOYANCE, SEVERITY_NOTICE);
foreach($severities as $severity) {
if(!empty($issues[$severity])) {
foreach($issues[$severity] as $classname => $data) {
echo '<dt id="'.$classname.'">'.$data['title'].'</dt>';
echo '<dd>'.$data['description'];
- echo '<form action="health.php#solution" method="get">';
+ echo '<form action="index.php#solution" method="get">';
echo '<input type="hidden" name="solution" value="'.$classname.'" /><input type="submit" value="'.get_string('viewsolution').'" />';
echo '</form></dd>';
}
'solution' => $problem->solution()
);
- echo $OUTPUT->heading(get_string('healthcenter'));
- echo $OUTPUT->heading(get_string('healthproblemsolution'));
+ echo $OUTPUT->heading(get_string('pluginname', 'tool_health'));
+ echo $OUTPUT->heading(get_string('healthproblemsolution', 'tool_health'));
echo '<dl class="healthissues '.$data['severity'].'">';
echo '<dt>'.$data['title'].'</dt>';
echo '<dd>'.$data['description'].'</dd>';
- echo '<dt id="solution" class="solution">'.get_string('healthsolution').'</dt>';
+ echo '<dt id="solution" class="solution">'.get_string('healthsolution', 'tool_health').'</dt>';
echo '<dd class="solution">'.$data['solution'].'</dd></dl>';
- echo '<form id="healthformreturn" action="health.php#'.$classname.'" method="get">';
- echo '<input type="submit" value="'.get_string('healthreturntomain').'" />';
+ echo '<form id="healthformreturn" action="index.php#'.$classname.'" method="get">';
+ echo '<input type="submit" value="'.get_string('healthreturntomain', 'tool_health').'" />';
echo '</form>';
}
detect unsupported characters in $CFG->wwwroot - see bug Bug #6091 - relative vs absolute path during backup/restore process
*/
-
-
--- /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/>.
+
+/**
+ * Strings for component 'tool_health', language 'en', branch 'MOODLE_22_STABLE'
+ *
+ * @package tool
+ * @subpackage health
+ * @copyright 2011 petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['healthnoproblemsfound'] = 'There is no health problem found!';
+$string['healthproblemsdetected'] = 'Health problems detected!';
+$string['healthproblemsolution'] = 'Health problem solution';
+$string['healthreturntomain'] = 'Continue';
+$string['healthsolution'] = 'Solution';
+$string['pluginname'] = 'Health center';
--- /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/>.
+
+/**
+ * Capability overview settings
+ *
+ * @package tool
+ * @subpackage bloglevelupgrade
+ * @copyright 2011 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+if ($hassiteconfig) {
+ $ADMIN->add('unsupported', new admin_externalpage('toolhealth', get_string('pluginname', 'tool_health'), $CFG->wwwroot.'/'.$CFG->admin.'/tool/health/index.php', 'moodle/site:config', true));
+}
--- /dev/null
+
+.path-admin-tool-health div#healthnoproblemsfound {
+ width: 60%;
+ margin: auto;
+ padding: 1em;
+ border: 1px black solid;
+ -moz-border-radius: 6px;
+}
+.path-admin-tool-health dl.healthissues {
+ width: 60%;
+ margin: auto;
+}
+.path-admin-tool-health dl.critical dt,
+.path-admin-tool-health dl.critical dd {
+ background-color: #a71501;
+}
+.path-admin-tool-health dl.significant dt,
+.path-admin-tool-health dl.significant dd {
+ background-color: #d36707;
+}
+.path-admin-tool-health dl.annoyance dt,
+.path-admin-tool-health dl.annoyance dd {
+ background-color: #dba707;
+}
+.path-admin-tool-health dl.notice dt,
+.path-admin-tool-health dl.notice dd {
+ background-color: #e5db36;
+}
+.path-admin-tool-health dt.solution,
+.path-admin-tool-health dd.solution,
+.path-admin-tool-health div#healthnoproblemsfound {
+ background-color: #5BB83E !important;
+}
+.path-admin-tool-health dl.healthissues dt,
+.path-admin-tool-health dl.healthissues dd {
+ margin: 0px;
+ padding: 1em;
+ border: 1px black solid;
+}
+.path-admin-tool-health dl.healthissues dt {
+ font-weight: bold;
+ border-bottom: none;
+ padding-bottom: 0.5em;
+}
+.path-admin-tool-health dl.healthissues dd {
+ border-top: none;
+ padding-top: 0.5em;
+ margin-bottom: 10px;
+}
+.path-admin-tool-health dl.healthissues dd form {
+ margin-top: 0.5em;
+ text-align: right;
+}
+.path-admin-tool-health form#healthformreturn {
+ text-align: center;
+ margin: 2em;
+}
+.path-admin-tool-health dd.solution p {
+ padding: 0px;
+ margin: 1em 0px;
+}
+.path-admin-tool-health dd.solution li {
+ margin-top: 1em;
+}
+
--- /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/>.
+
+/**
+ * Version details.
+ *
+ * @package tool
+ * @subpackage health
+ * @copyright 2011 petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011091600; // Requires this Moodle version
+$plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics)
+
+$maturity = MATURITY_ALPHA; // this version's maturity level
--- /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/>.
+
+/**
+ * InnoDB conversion tool.
+ *
+ * @package tool
+ * @subpackage innodb
+ * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+define('NO_OUTPUT_BUFFERING', true);
+
+require_once('../../../config.php');
+require_once($CFG->libdir.'/adminlib.php');
+
+admin_externalpage_setup('toolinnodb');
+
+$confirm = optional_param('confirm', 0, PARAM_BOOL);
+
+require_login();
+require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+
+echo $OUTPUT->header();
+echo $OUTPUT->heading('Convert all MySQL tables from MYISAM to InnoDB');
+
+if ($DB->get_dbfamily() != 'mysql') {
+ notice('This function is for MySQL databases only!', new moodle_url('/admin/'));
+}
+
+if (data_submitted() and $confirm and confirm_sesskey()) {
+
+ echo $OUTPUT->notification('Please be patient and wait for this to complete...', 'notifysuccess');
+
+ if ($tables = $DB->get_tables()) {
+ $DB->set_debug(true);
+ foreach ($tables as $table) {
+ $fulltable = $DB->get_prefix().$table;
+ $DB->change_database_structure("ALTER TABLE $fulltable TYPE=INNODB");
+ }
+ $DB->set_debug(false);
+ }
+ echo $OUTPUT->notification('... done.', 'notifysuccess');
+ echo $OUTPUT->continue_button(new moodle_url('/admin/'));
+ echo $OUTPUT->footer();
+
+} else {
+ $optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
+ $formcontinue = new single_button(new moodle_url('/admin/tool/innodb/index.php', $optionsyes), get_string('yes'));
+ $formcancel = new single_button(new moodle_url('/admin/'), get_string('no'), 'get');
+ echo $OUTPUT->confirm('Are you sure you want convert all your tables to the InnoDB format?', $formcontinue, $formcancel);
+ echo $OUTPUT->footer();
+}
+
+
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Plugin version info
+ * Strings for component 'tool_generator', language 'en', branch 'MOODLE_22_STABLE'
*
- * @package report
- * @subpackage unsuproles
- * @copyright 2010 Petr Skoda {@link http://skodak.org}
+ * @package tool
+ * @subpackage innodb
+ * @copyright 2011 petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-defined('MOODLE_INTERNAL') || die;
-
-$plugin->version = 2010071800;
+$string['pluginname'] = 'Convert to InnoDB';
--- /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/>.
+
+/**
+ * Link to InnoDB conversion tool
+ *
+ * @package tool
+ * @subpackage innodb
+ * @copyright 2010 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+if ($hassiteconfig) {
+ $ADMIN->add('unsupported', new admin_externalpage('toolinnodb', 'Convert to InnoDB', $CFG->wwwroot.'/'.$CFG->admin.'/tool/innodb/index.php', 'moodle/site:config', true));
+}
--- /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/>.
+
+/**
+ * Version details.
+ *
+ * @package tool
+ * @subpackage innodb
+ * @copyright 2011 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011091600; // Requires this Moodle version
+$plugin->component = 'tool_innodb'; // Full name of the plugin (used for diagnostics)
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
* and meta info.
* Locally, language packs are saved into $CFG->dataroot/lang/
*
- * @package core
- * @copyright 2005 Yu Zhang
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package tool
+ * @subpackage langimport
+ * @copyright 2005 Yu Zhang
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once(dirname(dirname(__FILE__)).'/config.php');
+require(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/componentlib.class.php');
-admin_externalpage_setup('langimport');
+admin_externalpage_setup('toollangimport');
if (!empty($CFG->skiplangupgrade)) {
echo $OUTPUT->header();
- echo $OUTPUT->box(get_string('langimportdisabled', 'admin'));
+ echo $OUTPUT->box(get_string('langimportdisabled', 'tool_langimport'));
echo $OUTPUT->footer();
die;
}
$a = new stdClass();
$a->url = $installer->lang_pack_url($langcode);
$a->dest = $CFG->dataroot.'/lang';
- print_error('remotedownloaderror', 'error', 'langimport.php', $a);
+ print_error('remotedownloaderror', 'error', 'index.php', $a);
break;
case lang_installer::RESULT_INSTALLED:
- $notice_ok[] = get_string('langpackinstalled', 'admin', $langcode);
+ $notice_ok[] = get_string('langpackinstalled', 'tool_langimport', $langcode);
break;
case lang_installer::RESULT_UPTODATE:
- $notice_ok[] = get_string('langpackuptodate', 'admin', $langcode);
+ $notice_ok[] = get_string('langpackuptodate', 'tool_langimport', $langcode);
break;
}
}
} else if (!$confirm and confirm_sesskey()) {
echo $OUTPUT->header();
- echo $OUTPUT->confirm(get_string('uninstallconfirm', 'admin', $uninstalllang),
- 'langimport.php?mode='.DELETION_OF_SELECTED_LANG.'&uninstalllang='.$uninstalllang.'&confirm=1',
- 'langimport.php');
+ echo $OUTPUT->confirm(get_string('uninstallconfirm', 'tool_langimport', $uninstalllang),
+ 'index.php?mode='.DELETION_OF_SELECTED_LANG.'&uninstalllang='.$uninstalllang.'&confirm=1',
+ 'index.php');
echo $OUTPUT->footer();
die;
$rm2 = remove_dir($dest2);
}
if ($rm1 or $rm2) {
- $notice_ok[] = get_string('langpackremoved','admin');
+ $notice_ok[] = get_string('langpackremoved', 'tool_langimport');
} else { //nothing deleted, possibly due to permission error
$notice_error[] = 'An error has occurred, language pack is not completely uninstalled, please check file permissions';
}
$updateablelangs = array();
foreach ($currentlangs as $clang) {
if (!array_key_exists($clang, $md5array)) {
- $notice_ok[] = get_string('langpackupdateskipped', 'admin', $clang);
+ $notice_ok[] = get_string('langpackupdateskipped', 'tool_langimport', $clang);
continue;
}
$dest1 = $CFG->dataroot.'/lang/'.$clang;
$a = new stdClass();
$a->url = $installer->lang_pack_url($langcode);
$a->dest = $CFG->dataroot.'/lang';
- print_error('remotedownloaderror', 'error', 'langimport.php', $a);
+ print_error('remotedownloaderror', 'error', 'index.php', $a);
break;
case lang_installer::RESULT_INSTALLED:
$updated = true;
- $notice_ok[] = get_string('langpackinstalled', 'admin', $langcode);
+ $notice_ok[] = get_string('langpackinstalled', 'tool_langimport', $langcode);
break;
case lang_installer::RESULT_UPTODATE:
- $notice_ok[] = get_string('langpackuptodate', 'admin', $langcode);
+ $notice_ok[] = get_string('langpackuptodate', 'tool_langimport', $langcode);
break;
}
}
if ($updated) {
- $notice_ok[] = get_string('langupdatecomplete','admin');
+ $notice_ok[] = get_string('langupdatecomplete', 'tool_langimport');
} else {
- $notice_ok[] = get_string('nolangupdateneeded','admin');
+ $notice_ok[] = get_string('nolangupdateneeded', 'tool_langimport');
}
unset($installer);
get_string_manager()->reset_caches();
echo $OUTPUT->header();
-echo $OUTPUT->heading(get_string('langimport', 'admin'));
+echo $OUTPUT->heading(get_string('langimport', 'tool_langimport'));
$installedlangs = get_string_manager()->get_list_of_translations(true);
$remote = false;
$availablelangs = array();
echo $OUTPUT->box_start();
- print_string('remotelangnotavailable', 'admin', $CFG->dataroot.'/lang/');
+ print_string('remotelangnotavailable', 'tool_langimport', $CFG->dataroot.'/lang/');
echo $OUTPUT->box_end();
}
$a->parent = $alang[2].' ('.$shortlang.')';
}
}
- $info = get_string('missinglangparent', 'admin', $a);
+ $info = get_string('missinglangparent', 'tool_langimport', $a);
echo $OUTPUT->notification($info, 'notifyproblem');
}
}
echo html_writer::start_tag('tr');
// list of installed languages
-$url = new moodle_url('/admin/langimport.php', array('mode' => DELETION_OF_SELECTED_LANG));
+$url = new moodle_url('/admin/tool/langimport/index.php', array('mode' => DELETION_OF_SELECTED_LANG));
echo html_writer::start_tag('td', array('valign' => 'top'));
echo html_writer::start_tag('form', array('id' => 'uninstallform', 'action' => $url->out(), 'method' => 'post'));
echo html_writer::start_tag('fieldset');
-echo html_writer::label(get_string('installedlangs','admin'), 'uninstalllang');
+echo html_writer::label(get_string('installedlangs', 'tool_langimport'), 'uninstalllang');
echo html_writer::empty_tag('br');
echo html_writer::select($installedlangs, 'uninstalllang', '', false, array('size' => 15));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
echo html_writer::empty_tag('br');
-echo html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('uninstall','admin')));
+echo html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('uninstall', 'tool_langimport')));
echo html_writer::end_tag('fieldset');
echo html_writer::end_tag('form');
if ($remote) {
- $url = new moodle_url('/admin/langimport.php', array('mode' => UPDATE_ALL_LANG));
+ $url = new moodle_url('/admin/tool/langimport/index.php', array('mode' => UPDATE_ALL_LANG));
echo html_writer::start_tag('form', array('id' => 'updateform', 'action' => $url->out(), 'method' => 'post'));
- echo html_writer::tag('fieldset', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('updatelangs','admin'))));
+ echo html_writer::tag('fieldset', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('updatelangs','tool_langimport'))));
echo html_writer::end_tag('form');
}
echo html_writer::end_tag('td');
}
if (!empty($options)) {
echo html_writer::start_tag('td', array('valign' => 'top'));
- $url = new moodle_url('/admin/langimport.php', array('mode' => INSTALLATION_OF_SELECTED_LANG));
+ $url = new moodle_url('/admin/tool/langimport/index.php', array('mode' => INSTALLATION_OF_SELECTED_LANG));
echo html_writer::start_tag('form', array('id' => 'installform', 'action' => $url->out(), 'method' => 'post'));
echo html_writer::start_tag('fieldset');
echo html_writer::label(get_string('availablelangs','install'), 'pack');
echo html_writer::select($options, 'pack[]', '', false, array('size' => 15, 'multiple' => 'multiple'));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
echo html_writer::empty_tag('br');
- echo html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('install','admin')));
+ echo html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('install','tool_langimport')));
echo html_writer::end_tag('fieldset');
echo html_writer::end_tag('form');
echo html_writer::end_tag('td');
--- /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/>.
+
+/**
+ * Strings for component 'tool_langimport', language 'en', branch 'MOODLE_22_STABLE'
+ *
+ * @package tool
+ * @subpackage langimport
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['install'] = 'Install selected language pack';
+$string['installedlangs'] = 'Installed language packs';
+$string['langimport'] = 'Language import utility';
+$string['langimportdisabled'] = 'Language import feature has been disabled. You have to update your language packs manually at the file-system level.';
+$string['langpackinstalled'] = 'Language pack {$a} was successfully installed';
+$string['langpackremoved'] = 'Language pack was uninstalled';
+$string['langpackupdateskipped'] = 'Update of {$a} language pack skipped';
+$string['langpackuptodate'] = 'Language pack {$a} is up-to-date';
+$string['langupdatecomplete'] = 'Language pack update completed';
+$string['missinglangparent'] = 'Missing parent language <em>{$a->parent}</em> of <em>{$a->lang}</em>.';
+$string['nolangupdateneeded'] = 'All your language packs are up to date, no update is needed';
+$string['pluginname'] = 'Language packs';
+$string['remotelangnotavailable'] = 'Because Moodle can not connect to download.moodle.org, we are unable to do language pack installation automatically. Please download the appropriate zip file(s) from http://download.moodle.org, copy them to your {$a} directory and unzip them manually.';
+$string['uninstall'] = 'Uninstall selected language pack';
+$string['uninstallconfirm'] = 'You are about to completely uninstall language pack {$a}, are you sure?';
+$string['updatelangs'] = 'Update all installed language packs';
+
--- /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/>.
+
+/**
+ * Utility lang import functions.
+ *
+ * @package tool
+ * @subpackage langimport
+ * @copyright 2011 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+/**
+ * Called during upgrade, we need up-to-date lang pack
+ * because it may be used during upgrade...
+ *
+ * @param string $lang
+ * @return void
+ */
+function tool_langimport_preupgrade_update($lang) {
+ global $CFG, $OUTPUT;
+ require_once($CFG->libdir.'/componentlib.class.php');
+
+ echo $OUTPUT->heading(get_string('langimport', 'tool_langimport').': '.$lang);
+
+ @mkdir ($CFG->tempdir.'/'); //make it in case it's a fresh install, it might not be there
+ @mkdir ($CFG->dataroot.'/lang/');
+
+ $installer = new lang_installer($lang);
+ $results = $installer->run();
+ foreach ($results as $langcode => $langstatus) {
+ switch ($langstatus) {
+ case lang_installer::RESULT_DOWNLOADERROR:
+ echo $OUTPUT->notification($langcode . '.zip');
+ break;
+ case lang_installer::RESULT_INSTALLED:
+ echo $OUTPUT->notification(get_string('langpackinstalled', 'tool_langimport', $langcode), 'notifysuccess');
+ break;
+ case lang_installer::RESULT_UPTODATE:
+ echo $OUTPUT->notification(get_string('langpackuptodate', 'tool_langimport', $langcode), 'notifysuccess');
+ break;
+ }
+ }
+}
--- /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/>.
+
+/**
+ * Lang import
+ *
+ * @package tool
+ * @subpackage langimport
+ * @copyright 2011 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+if ($hassiteconfig) {
+ $ADMIN->add('language', new admin_externalpage('toollangimport', get_string('pluginname', 'tool_langimport'), "$CFG->wwwroot/$CFG->admin/tool/langimport/index.php"));
+}
+
--- /dev/null
+
+#page-admin-tool-langimport-index .generalbox table {margin:auto;width:100%;}
+
+#page-admin-tool-langimport-index .generalbox,
+#page-admin-tool-langimport-index .generalbox table {text-align: center;}
--- /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/>.
+
+/**
+ * Version details.
+ *
+ * @package tool
+ * @subpackage langimport
+ * @copyright 2011 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011091600; // Requires this Moodle version
+$plugin->component = 'tool_langimport'; // Full name of the plugin (used for diagnostics)
<?php
- /// Search and replace strings throughout all texts in the whole database
+// 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/>.
+
+/**
+ * Search and replace strings throughout all texts in the whole database.
+ *
+ * Unfortunately it was a bad idea to use spans for multilang because it
+ * can not support nesting. Hopefully this will get thrown away soon....
+ *
+ * @package tool
+ * @subpackage multilangupgrade
+ * @copyright 2006 Petr Skoda (http://skodak.org)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
define('NO_OUTPUT_BUFFERING', true);
-require_once('../config.php');
+require('../../../config.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->libdir.'/adminlib.php');
-admin_externalpage_setup('multilangupgrade');
+admin_externalpage_setup('toolmultilangupgrade');
$go = optional_param('go', 0, PARAM_BOOL);
###################################################################
echo $OUTPUT->header();
-echo $OUTPUT->heading(get_string('multilangupgrade', 'admin'));
+echo $OUTPUT->heading(get_string('pluginname', 'tool_multilangupgrade'));
-$strmultilangupgrade = get_String('multilangupgradeinfo', 'admin');
+$strmultilangupgrade = get_String('multilangupgradeinfo', 'tool_multilangupgrade');
if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form
$optionsyes = array('go'=>1, 'sesskey'=>sesskey());
- echo $OUTPUT->confirm($strmultilangupgrade, new moodle_url('multilangupgrade.php', $optionsyes), 'index.php');
+ echo $OUTPUT->confirm($strmultilangupgrade, new moodle_url('/admin/tool/multilangupgrade/index.php', $optionsyes), new moodle_url('/admin/'));
echo $OUTPUT->footer();
die;
}
echo '<strong>Progress:</strong>';
$i = 0;
-$skiptables = array('config', 'user_students', 'user_teachers');
+$skiptables = array('config', 'block_instances', 'sessions'); // we can not process tables with serialised data here
foreach ($tables as $table) {
if (strpos($table,'pma') === 0) { // Not our tables
rebuild_course_cache();
echo $OUTPUT->notification('...finished', 'notifysuccess');
-echo $OUTPUT->continue_button('index.php');
+echo $OUTPUT->continue_button(new moodle_url('/admin/'));
echo $OUTPUT->footer();
die;
--- /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/>.
+
+/**
+ * Strings for component 'tool_multilangupgrade', language 'en', branch 'MOODLE_22_STABLE'
+ *
+ * @package report
+ * @subpackage multilangupgrade
+ * @copyright 2011 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['multilangupgradeinfo'] = 'The multilang filter syntax was changed in 1.8, <lang> tag is not supported any more. <br /><br />Example: <span lang="en" class="multilang">Hello!</span><span lang="es" class="multilang">Hola!</span><br /><br /><strong>Do you want to upgrade the syntax in all existing texts now?</strong>';
+$string['pluginname'] = 'Multilang upgrade';
--- /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/>.
+
+/**
+ * Link to multilang upgrade script.
+ *
+ * @package tool
+ * @subpackage multilangupgrade
+ * @copyright 2011 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+if ($hassiteconfig) {
+ // Hidden multilang upgrade page - show in settings root to get more attention.
+ $ADMIN->add('root', new admin_externalpage('toolmultilangupgrade', get_string('pluginname', 'tool_multilangupgrade'), $CFG->wwwroot.'/'.$CFG->admin.'/tool/multilangupgrade/index.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted)));
+}
--- /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/>.
+
+/**
+ * Plugin version info
+ *
+ * @package tool
+ * @subpackage multilangupgrade
+ * @copyright 2011 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+defined('MOODLE_INTERNAL') || die;
+
+$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011091600; // Requires this Moodle version
+$plugin->component = 'tool_multilangupgrade'; // Full name of the plugin (used for diagnostics)
+
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package core
+ * Profiling tool.
+ *
+ * @package tool
* @subpackage profiling
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
// TODO: Move all the DB stuff to profiling_db_xxxx() function in xhprof_moodle.php
-require_once(dirname(__FILE__).'/../../../config.php');
+// TODO: it is wrong when core lib references ANY plugin lang strings, maybe more login could be moved here (skodak)
+
+require_once(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir . '/xhprof/xhprof_moodle.php');
$dbfields = 'runid, url, totalexecutiontime, totalcputime, ' .
'totalcalls, totalmemory, runreference, runcomment, timecreated';
-admin_externalpage_setup('reportprofiling');
+admin_externalpage_setup('toolprofiling');
// Always add listurl if available
if ($listurl) {
- $listurlnav = new moodle_url('/admin/report/profiling/index.php', array('listurl' => $listurl));
+ $listurlnav = new moodle_url('/admin/tool/profiling/index.php', array('listurl' => $listurl));
$PAGE->navbar->add($listurl, $listurlnav);
}
// No run found for script, warn and exit
if (!$run) {
- notice(get_string('cannotfindanyrunforurl', 'report_profiling', $script), 'index.php');
+ notice(get_string('cannotfindanyrunforurl', 'tool_profiling', $script), 'index.php');
}
// Check if there is any previous run marked as reference one
'timecreated DESC', 'runid', 0, 1);
$prevrunid = $prevreferences ? reset($prevreferences)->runid : false;
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
- $header = get_string('lastrunof', 'report_profiling', $script);
+ $header = get_string('lastrunof', 'tool_profiling', $script);
echo $OUTPUT->heading($header);
$table = profiling_print_run($run, $prevrunid);
echo $table;
$run2 = $runtemp;
}
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
- $header = get_string('differencesbetween2runsof', 'report_profiling', $run1->url);
+ $header = get_string('differencesbetween2runsof', 'tool_profiling', $run1->url);
echo $OUTPUT->heading($header);
$table = profiling_print_rundiff($run1, $run2);
echo $table;
// No run found for runid, warn and exit
if (!$run) {
- notice(get_string('cannotfindanyrunforrunid', 'report_profiling', $runid), 'index.php');
+ notice(get_string('cannotfindanyrunforrunid', 'tool_profiling', $runid), 'index.php');
}
// Check if there is any previous run marked as reference one
'timecreated DESC', 'runid', 0, 1);
$prevrunid = $prevreferences ? reset($prevreferences)->runid : false;
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
- $header = get_string('summaryof', 'report_profiling', $run->url);
+ $header = get_string('summaryof', 'tool_profiling', $run->url);
echo $OUTPUT->heading($header);
$table = profiling_print_run($run, $prevrunid);
echo $table;
// The flexitable that will root listings
$table = new xhprof_table_sql('profiling-list-table');
- $baseurl = $CFG->wwwroot . '/admin/report/profiling/index.php';
+ $baseurl = $CFG->wwwroot . '/admin/tool/profiling/index.php';
// Check if we are listing all or some URL ones
$sqlconditions = '';
$sqlparams = array();
if (!isset($listurl)) {
- $header = get_string('pluginname', 'report_profiling');
+ $header = get_string('pluginname', 'tool_profiling');
$sqlconditions = '1 = 1';
$table->set_listurlmode(false);
} else {
- $header = get_string('profilingrunsfor', 'report_profiling', $listurl);
+ $header = get_string('profilingrunsfor', 'tool_profiling', $listurl);
$sqlconditions = 'url = :url';
$sqlparams['url'] = $listurl;
$table->set_listurlmode(true);
'url', 'timecreated', 'totalexecutiontime', 'totalcputime',
'totalcalls', 'totalmemory', 'runcomment');
$headers = array(
- get_string('url'), get_string('date'), get_string('executiontime', 'report_profiling'),
- get_string('cputime', 'report_profiling'), get_string('calls', 'report_profiling'),
- get_string('memory', 'report_profiling'), get_string('comment', 'report_profiling'));
+ get_string('url'), get_string('date'), get_string('executiontime', 'tool_profiling'),
+ get_string('cputime', 'tool_profiling'), get_string('calls', 'tool_profiling'),
+ get_string('memory', 'tool_profiling'), get_string('comment', 'tool_profiling'));
$table->define_columns($columns);
$table->define_headers($headers);
$table->sortable(true, 'timecreated', SORT_DESC);
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Strings for component 'report_profiling', language 'en', branch 'MOODLE_20_STABLE'
+ * Strings for component 'tool_profiling', language 'en', branch 'MOODLE_22_STABLE'
*
- * @package report_profiling
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package tool
+ * @subpackage profiling
+ * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['calls'] = 'Function calls';
--- /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/>.
+
+/**
+ * Profiling tool settings.
+ *
+ * @package tool
+ * @subpackage profiling
+ * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+// profiling tool, added to development
+if (extension_loaded('xhprof') && function_exists('xhprof_enable') && (!empty($CFG->profilingenabled) || !empty($CFG->earlyprofilingenabled))) {
+ $ADMIN->add('development', new admin_externalpage('toolprofiling', get_string('pluginname', 'tool_profiling'), "$CFG->wwwroot/$CFG->admin/tool/profiling/index.php", 'moodle/site:config'));
+}
--- /dev/null
+/* tool_profiling styles */
+
+.path-admin-tool-profiling .profilingruntable .label {
+ font-weight: bold;
+}
+.path-admin-tool-profiling .profiling_worse {
+ color: red;
+}
+.path-admin-tool-profiling .profiling_better {
+ color: green;
+}
+.path-admin-tool-profiling .profiling_same {
+ color: dimgrey;
+}
+.path-admin-tool-profiling .profiling_important,
+.path-admin-tool-profiling .flexible .referencerun {
+ font-weight: bold;
+}
+.path-admin-tool-profiling .flexible .r1 .cell {
+ background-color: whitesmoke;
+}
+.path-admin-tool-profiling .flexible {
+ margin-left:auto;
+ margin-right:auto
+}
--- /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/>.
+
+/**
+ * Version details.
+ *
+ * @package tool
+ * @subpackage profiling
+ * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011091600; // Requires this Moodle version
+$plugin->component = 'tool_profiling'; // Full name of the plugin (used for diagnostics)
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
* Syntax: coveragefile.php/path/to/file/file.html
* coveragefile.php?file=path/to/file/file.html
*
- * @package moodlecore
- * @subpackage simpletestcoverage
+ * @package tool
+ * @subpackage unittest
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// disable moodle specific debug messages and any errors in output
define('NO_DEBUG_DISPLAY', true);
-require_once(dirname(__FILE__) . '/../../../config.php');
+require(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir . '/filelib.php');
// basic security, require login + require site config cap
require_login();
-require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+require_capability('tool/unittest:execute', get_context_instance(CONTEXT_SYSTEM));
// get file requested
$relativepath = get_file_argument();
--- /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/>.
+
+/**
+ * Unitest caps.
+ *
+ * @package tool
+ * @subpackage unittest
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$capabilities = array(
+
+ // Note: do not add managers here, unittests are dangerous and not intended for production sites!!!
+
+ 'tool/unittest:execute' => array(
+ 'riskbitmask' => RISK_DATALOSS,
+ 'captype' => 'write', // it writes into database, really!
+ 'contextlevel' => CONTEXT_SYSTEM,
+ 'archetypes' => array(
+ )
+ )
+);
--- /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/>.
+
+/**
+ * Post installation and migration code.
+ *
+ * @package tool
+ * @subpackage unittest
+ * @copyright 2011 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+function xmldb_tool_unittest_install() {
+ global $CFG;
+
+ // this is a hack - this plugin used to live in admin/report/unittest,
+ // we want to remove the orphaned version info and capability
+ // unless there is a new report type with the same name
+
+ if (!file_exists("$CFG->dirroot/report/unittest")) {
+ unset_all_config_for_plugin('report_unittest');
+ capabilities_cleanup('report_unittest');
+ }
+}
<?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/>.
+
/**
* Run database functional tests.
- * @package SimpleTestEx
+ *
+ * @package tool
+ * @subpackage unittest
+ * @copyright 2008 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
-require_once(dirname(__FILE__).'/../../../config.php');
+require(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
-require_once($CFG->libdir.'/simpletestcoveragelib.php');
+require_once('simpletestlib.php');
+require_once('simpletestcoveragelib.php');
require_once('ex_simple_test.php');
require_once('ex_reporter.php');
$selected = optional_param_array('selected', array(), PARAM_INT);
// Print the header and check access.
-admin_externalpage_setup('reportdbtest');
+admin_externalpage_setup('tooldbtest');
echo $OUTPUT->header();
global $UNITTEST;
echo '<form method="post" action="dbtest.php">';
echo '<div>';
echo $OUTPUT->heading("Run functional database tests"); // TODO: localise
-echo '<p>'.html_writer::checkbox('showpasses', 1, $showpasses, get_string('showpasses', 'simpletest')).'</p>';
+echo '<p>'.html_writer::checkbox('showpasses', 1, $showpasses, get_string('showpasses', 'tool_unittest')).'</p>';
if (moodle_coverage_recorder::can_run_codecoverage()) {
- echo '<p>'.html_writer::checkbox('codecoverage', 1, $codecoverage, get_string('codecoverageanalysis', 'simpletest')).'</p>';
+ echo '<p>'.html_writer::checkbox('codecoverage', 1, $codecoverage, get_string('codecoverageanalysis', 'tool_unittest')).'</p>';
} else {
- echo '<p>'; print_string('codecoveragedisabled', 'simpletest'); echo '<input type="hidden" name="codecoverage" value="0" /></p>';
+ echo '<p>'; print_string('codecoveragedisabled', 'tool_unittest'); echo '<input type="hidden" name="codecoverage" value="0" /></p>';
}
echo '<p><strong>'."Databases:".'</strong></p>';
echo '<ul>';
$CFG->func_test_db_2 = array("native", "mssql", "localhost", "moodleuser", "password", "moodle", "test", null);
</pre>
<p>where order of parameters is: dblibrary, dbtype, dbhost, dbuser, dbpass, dbname, prefix, dboptions</p>';
-echo '<p><input type="submit" value="' . get_string('runtests', 'simpletest') . '" /></p>';
+echo '<p><input type="submit" value="' . get_string('runtests', 'tool_unittest') . '" /></p>';
echo '</div>';
echo '</form>';
echo $OUTPUT->box_end();
<?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/>.
+
/**
* A SimpleTest report format for Moodle.
*
- * @copyright © 2006 The Open University
- * @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package SimpleTestEx
+ * @package tool
+ * @subpackage unittest
+ * @copyright © 2006 The Open University
+ * @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if (!defined('MOODLE_INTERNAL')) {
foreach ($stacktrace as $frame) {
if (empty($frame['file']) || (strpos($frame['file'], 'simpletestlib') === false &&
strpos($frame['file'], 'simpletestcoveragelib') === false
- && strpos($frame['file'], 'report/unittest') === false)) {
+ && strpos($frame['file'], 'tool/unittest') === false)) {
$filteredstacktrace[] = $frame;
$interestinglines += 1;
$dotsadded = false;
* Look up a lang string in the appropriate file.
*/
function get_string($identifier, $a = NULL) {
- return get_string($identifier, 'simpletest', $a);
+ return get_string($identifier, 'tool_unittest', $a);
}
}
<?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/>.
+
/**
* A SimpleTest GroupTest that automatically finds all the
* test files in a directory tree according to certain rules.
*
- * @copyright © 2006 The Open University
- * @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package SimpleTestEx
+ * @package tool
+ * @subpackage unittest
+ * @copyright © 2006 The Open University
+ * @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if (!defined('MOODLE_INTERNAL')) {
<?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/>.
+
/**
* Run the unit tests.
*
- * @copyright © 2006 The Open University
- * @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package SimpleTestEx
+ * @package tool
+ * @subpackage unittest
+ * @copyright © 2006 The Open University
+ * @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
-require_once(dirname(__FILE__).'/../../../config.php');
+require(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
-require_once($CFG->libdir.'/simpletestcoveragelib.php');
+require_once('simpletestlib.php');
+require_once('simpletestcoveragelib.php');
require_once('ex_simple_test.php');
require_once('ex_reporter.php');
$codecoverage = optional_param('codecoverage', false, PARAM_BOOL);
$showsearch = optional_param('showsearch', false, PARAM_BOOL);
-admin_externalpage_setup('reportsimpletest', '', array('showpasses'=>$showpasses, 'showsearch'=>$showsearch));
+admin_externalpage_setup('toolsimpletest', '', array('showpasses'=>$showpasses, 'showsearch'=>$showsearch));
$unittest = true;
define('TIME_ALLOWED_PER_UNIT_TEST', 60);
// Print the header.
-$strtitle = get_string('unittests', 'simpletest');
+$strtitle = get_string('unittests', 'tool_unittest');
if (!is_null($path)) {
//trim so user doesn't get an error if they include a space on the end of the path (ie by pasting path)
} else if (is_dir($path)){
$test->findTestFiles($path);
} else {
- echo $OUTPUT->box(get_string('pathdoesnotexist', 'simpletest', $path), 'errorbox');
+ echo $OUTPUT->box(get_string('pathdoesnotexist', 'tool_unittest', $path), 'errorbox');
$ok = false;
}
// If we have something to test, do it.
if ($ok) {
if ($path == $CFG->dirroot) {
- $title = get_string('moodleunittests', 'simpletest', get_string('all', 'simpletest'));
+ $title = get_string('moodleunittests', 'tool_unittest', get_string('all', 'tool_unittest'));
} else {
- $title = get_string('moodleunittests', 'simpletest', $displaypath);
+ $title = get_string('moodleunittests', 'tool_unittest', $displaypath);
}
echo $OUTPUT->heading($title);
$test->run($reporter);
}
- $formheader = get_string('retest', 'simpletest');
+ $formheader = get_string('retest', 'tool_unittest');
} else {
$displaypath = '';
echo $OUTPUT->header();
- $formheader = get_string('rununittests', 'simpletest');
+ $formheader = get_string('rununittests', 'tool_unittest');
}
// Print the form for adjusting options.
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
echo $OUTPUT->heading($formheader);
echo '<form method="get" action="index.php">';
echo '<fieldset class="invisiblefieldset">';
-echo '<p>'.html_writer::checkbox('showpasses', 1, $showpasses, get_string('showpasses', 'simpletest')).'</p>';
-echo '<p>'.html_writer::checkbox('showsearch', 1, $showsearch, get_string('showsearch', 'simpletest')).'</p>';
+echo '<p>'.html_writer::checkbox('showpasses', 1, $showpasses, get_string('showpasses', 'tool_unittest')).'</p>';
+echo '<p>'.html_writer::checkbox('showsearch', 1, $showsearch, get_string('showsearch', 'tool_unittest')).'</p>';
if (moodle_coverage_recorder::can_run_codecoverage()) {
- echo '<p>'.html_writer::checkbox('codecoverage', 1, $codecoverage, get_string('codecoverageanalysis', 'simpletest')).'</p>';
+ echo '<p>'.html_writer::checkbox('codecoverage', 1, $codecoverage, get_string('codecoverageanalysis', 'tool_unittest')).'</p>';
} else {
- echo '<p>'; print_string('codecoveragedisabled', 'simpletest'); echo '<input type="hidden" name="codecoverage" value="0" /></p>';
+ echo '<p>'; print_string('codecoveragedisabled', 'tool_unittest'); echo '<input type="hidden" name="codecoverage" value="0" /></p>';
}
echo '<p>';
- echo '<label for="path">', get_string('onlytest', 'simpletest'), '</label> ';
+ echo '<label for="path">', get_string('onlytest', 'tool_unittest'), '</label> ';
echo '<input type="text" id="path" name="path" value="', $displaypath, '" size="40" />';
echo '</p>';
-echo '<input type="submit" value="' . get_string('runtests', 'simpletest') . '" />';
+echo '<input type="submit" value="' . get_string('runtests', 'tool_unittest') . '" />';
echo '</fieldset>';
echo '</form>';
echo $OUTPUT->box_end();
+$otherpages = array();
+$otherpages['PDF lib test'] = new moodle_url('/admin/tool/unittest/other/pdflibtestpage.php');
+if (debugging('', DEBUG_DEVELOPER)) {
+ $otherpages['TODO checker'] = new moodle_url('/admin/tool/unittest/other/todochecker.php');
+}
+
+// print list of extra test pages that are not simpletests,
+// not everything there is good enough to show to our users
+if ($otherpages) {
+ echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
+ echo $OUTPUT->heading(get_string('othertestpages', 'tool_unittest'));
+ echo '<ul>';
+ foreach ($otherpages as $name=>$url) {
+ echo '<li>'.html_writer::link($url, $name).'</li>';
+ }
+ echo '</ul>';
+ echo $OUTPUT->box_end();
+}
+
+
// Print link to latest code coverage for this report type
if (is_null($path) || !$codecoverage) {
moodle_coverage_reporter::print_link_to_latest('unittest');
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Strings for component 'simpletest', language 'en', branch 'MOODLE_20_STABLE'
+ * Strings for component 'tool_unittest', language 'en', branch 'MOODLE_22_STABLE'
+ *
+ * This file contains strings that were previously located in lang/en/simpletest.php
*
- * @package simpletest
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package tool
+ * @subpackage unittest
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['addconfigprefix'] = 'Add prefix to config file';
$CFG->unittestprefix = \'tst_\' // Change tst_ to a prefix of your choice, different from $CFG->prefix';
$string['coveredlines'] = 'Covered lines';
$string['coveredpercentage'] = 'Overall code coverage';
+$string['dbtest'] = 'Functional DB tests';
$string['deletingnoninsertedrecord'] = 'Trying to delete a record that was not inserted by these unit tests (id {$a->id} in table {$a->table}).';
$string['deletingnoninsertedrecords'] = 'Trying to delete records that were not inserted by these unit tests (from table {$a->table}).';
$string['droptesttables'] = 'Drop test tables';
$string['moodleunittests'] = 'Moodle unit tests: {$a}';
$string['notice'] = 'Notice';
$string['onlytest'] = 'Only run tests in';
+$string['othertestpages'] = 'Other test pages';
$string['pass'] = 'Pass';
$string['pathdoesnotexist'] = 'The path \'{$a}\' does not exist.';
+$string['pluginname'] = 'Unit tests';
$string['prefix'] = 'Unit test tables prefix';
$string['prefixnotset'] = 'The unit test database table prefix is not configured. Fill and submit this form to add it to config.php.';
$string['reinstalltesttables'] = 'Reinstall test tables';
$string['totallines'] = 'Total lines';
$string['uncaughtexception'] = 'Uncaught exception [{$a->getMessage()}] in [{$a->getFile()}:{$a->getLine()}] TESTS ABORTED.';
$string['uncoveredlines'] = 'Uncovered lines';
+$string['unittest:execute'] = 'Execute unit tests';
$string['unittestprefixsetting'] = 'Unit test prefix: <strong>{$a->unittestprefix}</strong> (Edit config.php to modify this).';
$string['unittests'] = 'Unit tests';
$string['updatingnoninsertedrecord'] = 'Trying to update a record that was not inserted by these unit tests (id {$a->id} in table {$a->table}).';
<?php
-
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.org //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
+// 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/>.
/**
+ * Run the unit tests.
+ *
* A simple test script that sets up test data in the database then
* measures performance of filter_get_active_in_context.
*
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package moodlecore
- *//** */
+ * @copyright 2009 Tim Hunt
+ * @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
-require_once(dirname(__FILE__) . '/../../config.php');
+require(dirname(__FILE__) . '/../../../../config.php');
require_once($CFG->libdir . '/ddllib.php');
require_login();
$syscontext = get_context_instance(CONTEXT_SYSTEM);
-require_capability('moodle/site:config', $syscontext);
+require_capability('tool/unittest:execute', $syscontext);
-$baseurl = $CFG->wwwroot . '/lib/simpletest/filtersettingsperformancetester.php';
+$baseurl = new moodle_url('/admin/tool/unittest/other/filtersettingsperformancetester.php');
$title = 'filter_get_active_in_context performance test';
-$PAGE->set_url('/lib/simpletest/filtersettingsperformancetester.php');
+$PAGE->set_url($baseurl);
+$PAGE->set_context($syscontext);
$PAGE->navbar->add($title);
$PAGE->set_title($title);
$PAGE->set_heading($title);
switch (optional_param('action', '', PARAM_ACTION)) {
case 'setup':
+ require_sesskey();
if ($issetup == 0) {
foreach ($requiredtables as $table) {
$dbman->install_one_table_from_xmldb_file($CFG->dirroot . '/lib/db/install.xml', $table);
break;
case 'teardown':
+ require_sesskey();
foreach ($requiredtables as $tablename) {
$table = new xmldb_table($tablename);
if ($dbman->table_exists($table)) {
break;
case 'test':
+ require_sesskey();
if ($issetup != count($requiredtables)) {
echo $OUTPUT->notification('Something is wrong, please delete the test tables and try again.');
} else {
echo $OUTPUT->container_start();
-$aurl = new moodle_url($baseurl, array('action' => 'setup'));
+$aurl = new moodle_url($baseurl, array('action' => 'setup', 'sesskey'=>sesskey()));
echo $OUTPUT->single_button($aurl, 'Set up test tables', 'get', array('disabled'=>($issetup > 0)));
-$aurl = new moodle_url($baseurl, array('action' => 'teardown'));
+$aurl = new moodle_url($baseurl, array('action' => 'teardown', 'sesskey'=>sesskey()));
echo $OUTPUT->single_button($aurl, 'Drop test tables', 'get', array('disabled'=>($issetup == 0)));
-$aurl = new moodle_url($baseurl, array('action' => 'test'));
+$aurl = new moodle_url($baseurl, array('action' => 'test', 'sesskey'=>sesskey()));
echo $OUTPUT->single_button($aurl, 'Run tests', 'get', array('disabled'=>($issetup != count($requiredtables))));
echo $OUTPUT->container_end();
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
/**
* Pruduces a sample PDF using lib/pdflib.php
*
- * @package moodlecore
+ * @package tool
+ * @subpackage unittest
* @copyright 2009 David Mudrak <david.mudrak@gmail.com>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
+require(dirname(__FILE__) . '/../../../../config.php');
require_once($CFG->libdir . '/pdflib.php');
require_login();
$context = get_context_instance(CONTEXT_SYSTEM);
-require_capability('moodle/site:config', $context);
+require_capability('tool/unittest:execute', $context);
$getpdf = optional_param('getpdf', 0, PARAM_INT);
$fontfamily = optional_param('fontfamily', PDF_DEFAULT_FONT, PARAM_ALPHA); // to be configurable
$doc->SetTitle('Moodle PDF library test');
$doc->SetAuthor('Moodle ' . $CFG->release);
- $doc->SetCreator('lib/simpletest/pdflibtestpage.php');
+ $doc->SetCreator('admin/tool/unittest/pdflibtestpage.php');
$doc->SetKeywords('Moodle, PDF');
$doc->SetSubject('This has been generated by Moodle as its PDF library test page');
$doc->SetMargins(15, 30);
exit();
}
-$PAGE->set_url('/lib/simpletest/pdflibtestpage.php');
+$PAGE->set_url('/admin/tool/unittest/other/pdflibtestpage.php');
$PAGE->set_context($context);
$PAGE->set_title('PDF library test');
$PAGE->set_heading('PDF library test');
// extra security
session_write_close();
- $return_url = "$CFG->wwwroot/$CFG->admin/report/unittest/test_tables.php";
+ $return_url = "$CFG->wwwroot/$CFG->admin/tool/unittest/test_tables.php";
// Temporarily override $DB and $CFG for a fresh install on the unit test prefix
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
*
* As required by http://docs.moodle.org/dev/Coding_style.
*
- * http://docs.moodle.org/dev/Coding_style
- * @package moodlecore
- * @copyright 2009 Tim Hunt
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package tool
+ * @subpackage unittest
+ * @copyright 2009 Tim Hunt
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once(dirname(__FILE__) . '/../../config.php');
-require_once($CFG->libdir . '/simpletestlib.php');
+
+require(dirname(__FILE__) . '/../../../../config.php');
+require_once('../simpletestlib.php');
require_login();
$context = get_context_instance(CONTEXT_SYSTEM);
-require_capability('moodle/site:config', $context);
+require_capability('tool/unittest:execute', $context);
-$PAGE->set_url('/lib/simpletest/todochecker.php');
+$PAGE->set_url('/admin/tool/todochecker.php');
$PAGE->set_context($context);
$PAGE->set_title('To-do checker');
$PAGE->set_heading('To-do checker');
--- /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/>.
+
+/**
+ * Unittest settings
+ *
+ * @package tool
+ * @subpackage unittest
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
+defined('MOODLE_INTERNAL') || die;
+
+$ADMIN->add('development', new admin_externalpage('toolsimpletest', get_string('pluginname', 'tool_unittest'), "$CFG->wwwroot/$CFG->admin/tool/unittest/index.php", 'tool/unittest:execute'));
+$ADMIN->add('development', new admin_externalpage('tooldbtest', get_string('dbtest', 'tool_unittest'), "$CFG->wwwroot/$CFG->admin/tool/unittest/dbtest.php", 'tool/unittest:execute'));
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
* ones, provide code coverage analysis to already existing tests. Also there are some
* utility functions designed to make the coverage control easier.
*
- * @package core
- * @subpackage simpletestcoverage
+ * @package tool
+ * @subpackage unittest
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Includes
*/
-require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir.'/tablelib.php');
-require_once($CFG->libdir . '/simpletestlib.php');
-require_once($CFG->dirroot . '/' . $CFG->admin . '/report/unittest/ex_simple_test.php');
+require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/unittest/simpletestlib.php');
+require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/unittest/ex_simple_test.php');
require_once($CFG->libdir . '/spikephpcoverage/src/CoverageRecorder.php');
require_once($CFG->libdir . '/spikephpcoverage/src/reporter/HtmlCoverageReporter.php');
$table->id = 'codecoveragetable_' . $type;
$table->rowclasses = array('label', 'value');
$table->data = array(
- array(get_string('date') , userdate($data->time)),
- array(get_string('files') , format_float($data->totalfiles, 0)),
- array(get_string('totallines', 'simpletest') , format_float($data->totalln, 0)),
- array(get_string('executablelines', 'simpletest') , format_float($data->totalcoveredln + $data->totaluncoveredln, 0)),
- array(get_string('coveredlines', 'simpletest') , format_float($data->totalcoveredln, 0)),
- array(get_string('uncoveredlines', 'simpletest') , format_float($data->totaluncoveredln, 0)),
- array(get_string('coveredpercentage', 'simpletest'), format_float($data->totalpercentage, 2) . '%')
+ array(get_string('date') , userdate($data->time)),
+ array(get_string('files') , format_float($data->totalfiles, 0)),
+ array(get_string('totallines', 'tool_unittest') , format_float($data->totalln, 0)),
+ array(get_string('executablelines', 'tool_unittest') , format_float($data->totalcoveredln + $data->totaluncoveredln, 0)),
+ array(get_string('coveredlines', 'tool_unittest') , format_float($data->totalcoveredln, 0)),
+ array(get_string('uncoveredlines', 'tool_unittest') , format_float($data->totaluncoveredln, 0)),
+ array(get_string('coveredpercentage', 'tool_unittest'), format_float($data->totalpercentage, 2) . '%')
);
- $url = $CFG->wwwroot . '/admin/report/unittest/coveragefile.php/' . $type . '/index.html';
+ $url = $CFG->wwwroot . '/'.$CFG->admin.'/tool/unittest/coveragefile.php/' . $type . '/index.html';
$result .= $OUTPUT->heading($data->title, 3, 'main codecoverageheading');
$result .= $OUTPUT->heading('<a href="' . $url . '" onclick="javascript:window.open(' . "'" . $url . "'" . ');return false;"' .
- ' title="">' . get_string('codecoveragecompletereport', 'simpletest') . '</a>', 4, 'main codecoveragelink');
+ ' title="">' . get_string('codecoveragecompletereport', 'tool_unittest') . '</a>', 4, 'main codecoveragelink');
$result .= html_writer::table($table);
return $OUTPUT->box($result, 'generalbox boxwidthwide boxaligncenter codecoveragebox', '', true);
$info->files = format_float($data->totalfiles, 0);
$info->percentage = format_float($data->totalpercentage, 2) . '%';
- $strlatestreport = get_string('codecoveragelatestreport', 'simpletest');
- $strlatestdetails = get_string('codecoveragelatestdetails', 'simpletest', $info);
+ $strlatestreport = get_string('codecoveragelatestreport', 'tool_unittest');
+ $strlatestdetails = get_string('codecoveragelatestdetails', 'tool_unittest', $info);
// return one link to latest complete report
$result = '';
- $url = $CFG->wwwroot . '/admin/report/unittest/coveragefile.php/' . $type . '/index.html';
+ $url = $CFG->wwwroot . '/'.$CFG->admin.'/tool/unittest/coveragefile.php/' . $type . '/index.html';
$result .= $OUTPUT->heading('<a href="' . $url . '" onclick="javascript:window.open(' . "'" . $url . "'" . ');return false;"' .
' title="">' . $strlatestreport . '</a>', 3, 'main codecoveragelink');
$result .= $OUTPUT->heading($strlatestdetails, 4, 'main codecoveragedetails');
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
* Major Contirbutors
* - T.J.Hunt@open.ac.uk
*
- * @package core
- * @subpackage simpletestex
+ * @package tool
+ * @subpackage unittest
* @copyright © 2006 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Includes
*/
-require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir . '/simpletestlib/simpletest.php');
require_once($CFG->libdir . '/simpletestlib/unit_tester.php');
require_once($CFG->libdir . '/simpletestlib/expectation.php');
foreach ($parsererrors as $key => $message) {
$parsererrors[$key] = $message->message;
}
- return 'Could not parse XML [' . $html . '] errors were [' .
+ return 'Could not parse XML [' . $html . '] errors were [' .
implode('], [', $parsererrors) . ']';
}
return $this->customMessage($html);
if (!file_put_contents($this->pkfile, $tabledata)) {
$a = new stdClass();
$a->filename = $this->pkfile;
- throw new moodle_exception('testtablescsvfileunwritable', 'simpletest', '', $a);
+ throw new moodle_exception('testtablescsvfileunwritable', 'tool_unittest', '', $a);
}
}
}
} else {
$a = new stdClass();
$a->filename = $this->pkfile;
- throw new moodle_exception('testtablescsvfilemissing', 'simpletest', '', $a);
+ throw new moodle_exception('testtablescsvfilemissing', 'tool_unittest', '', $a);
return false;
}
}
global $CFG, $DB;
UnitTestDB::$real_db = clone($DB);
if (empty($CFG->unittestprefix)) {
- print_error("prefixnotset", 'simpletest');
+ print_error("prefixnotset", 'tool_unittest');
}
if (empty(UnitTestDB::$DB)) {
$manager = UnitTestDB::$DB->get_manager();
if (!$manager->table_exists('user')) {
- print_error('tablesnotsetup', 'simpletest');
+ print_error('tablesnotsetup', 'tool_unittest');
}
$DB = new UnitTestDB();
$a = new stdClass();
$a->id = $dataobject->id;
$a->table = $table;
- throw new moodle_exception('updatingnoninsertedrecord', 'simpletest', '', $a);
+ throw new moodle_exception('updatingnoninsertedrecord', 'tool_unittest', '', $a);
} else {
return UnitTestDB::$DB->update_record($table, $dataobject, $bulk);
}
if ($proceed_with_delete) {
return UnitTestDB::$DB->delete_records($table, $conditions);
} else {
- throw new moodle_exception('deletingnoninsertedrecord', 'simpletest', '', $a);
+ throw new moodle_exception('deletingnoninsertedrecord', 'tool_unittest', '', $a);
}
}
if ($proceed_with_delete) {
return UnitTestDB::$DB->delete_records_select($table, $select, $params);
} else {
- throw new moodle_exception('deletingnoninsertedrecord', 'simpletest', '', $a);
+ throw new moodle_exception('deletingnoninsertedrecord', 'tool_unittest', '', $a);
}
}
--- /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/>.
+
+/**
+ * Unittest version info
+ *
+ * @package tool
+ * @subpackage unittest
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011091600; // Requires this Moodle version
+$plugin->component = 'tool_unittest'; // Full name of the plugin (used for diagnostics)
+
--- /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/>.
+
+/**
+ * Post installation and migration code.
+ *
+ * @package tool
+ * @subpackage unsuproles
+ * @copyright 2011 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+function xmldb_tool_unsuproles_install() {
+ global $CFG;
+
+ // this is a hack - this plugin used to live in admin/report/unsuproles,
+ // we want to remove the orphaned version info unless there is a new
+ // report type with the same name
+
+ if (!file_exists("$CFG->dirroot/report/report_unsuproles")) {
+ unset_all_config_for_plugin('report_unsuproles');
+ }
+}
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
* Report of unsupported role assignments,
* unsupported role assignments can be dropped from here.
*
- * @package report
+ * @package tool
* @subpackage unsuproles
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once(dirname(__FILE__).'/../../../config.php');
+require_once(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
$action = optional_param('action', '', PARAM_ACTION);
$syscontext = get_context_instance(CONTEXT_SYSTEM);
require_login();
-admin_externalpage_setup('reportunsuproles'); // checks permissions specified in settings.php
+admin_externalpage_setup('toolunsuproles'); // checks permissions specified in settings.php
if ($action === 'delete') {
$contextlevel = required_param('contextlevel', PARAM_INT);
$yesurl = new moodle_url($PAGE->url, array('roleid'=>$roleid, 'contextlevel'=>$contextlevel, 'action'=>'delete', 'confirm'=>1, 'sesskey'=>sesskey()));
$levelname = get_contextlevel_name($contextlevel);
$rolename = format_string($role->name);
- $message = get_string('confirmdelete', 'report_unsuproles', array('level'=>$levelname, 'role'=>$rolename));
+ $message = get_string('confirmdelete', 'tool_unsuproles', array('level'=>$levelname, 'role'=>$rolename));
echo $OUTPUT->confirm($message, $yesurl, $PAGE->url);
echo $OUTPUT->footer();
die();
echo $OUTPUT->header();
-echo $OUTPUT->heading(get_string('pluginname', 'report_unsuproles'));
+echo $OUTPUT->heading(get_string('pluginname', 'tool_unsuproles'));
$sql = "SELECT r.id AS roleid, c.contextlevel, r.sortorder, COUNT(ra.id) AS racount
FROM {role} r
$rs->close();
if (!$problems) {
- echo $OUTPUT->notification(get_string('noprolbems', 'report_unsuproles'), 'notifysuccess');
+ echo $OUTPUT->notification(get_string('noprolbems', 'tool_unsuproles'), 'notifysuccess');
} else {
$roles = get_all_roles();
$data = array();
$data[] = array($levelname, $rolename, $count, implode(' ', $edit));
}
$table = new html_table();
- $table->head = array(get_string('contextlevel', 'report_unsuproles'), get_string('role'), get_string('count', 'report_unsuproles'), get_string('edit'));
+ $table->head = array(get_string('contextlevel', 'tool_unsuproles'), get_string('role'), get_string('count', 'tool_unsuproles'), get_string('edit'));
$table->size = array('40%', '40%', '10%', '10%');
$table->align = array('left', 'left', 'center', 'center');
$table->width = '90%';
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Strings for component 'report_unsuproles', language 'en', branch 'MOODLE_20_STABLE'
+ * Strings for component 'tool_unsuproles', language 'en', branch 'MOODLE_22_STABLE'
*
* @package report
* @subpackage unsuproles
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
/**
* Link to unsupported roles report
*
- * @package report
+ * @package tool
* @subpackage unsuproles
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
defined('MOODLE_INTERNAL') || die;
if ($hassiteconfig) {
- $ADMIN->add('roles', new admin_externalpage('reportunsuproles', get_string('pluginname', 'report_unsuproles'), "$CFG->wwwroot/$CFG->admin/report/unsuproles/index.php"), array('moodle/site:config', 'moodle/role:assign'));
+ $ADMIN->add('roles', new admin_externalpage('toolunsuproles', get_string('pluginname', 'tool_unsuproles'), "$CFG->wwwroot/$CFG->admin/tool/unsuproles/index.php"), array('moodle/site:config', 'moodle/role:assign'));
}
--- /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/>.
+
+/**
+ * Plugin version info
+ *
+ * @package tool
+ * @subpackage unsuproles
+ * @copyright 2010 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+defined('MOODLE_INTERNAL') || die;
+
+$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011091600; // Requires this Moodle version
+$plugin->component = 'tool_unsuproles'; // Full name of the plugin (used for diagnostics)
+
/**
* Bulk user registration script from a comma separated file
*
- * @package core
- * @subpackage admin
+ * @package tool
+ * @subpackage uploaduser
* @copyright 2004 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require('../config.php');
+require('../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/csvlib.class.php');
require_once($CFG->dirroot.'/user/profile/lib.php');
require_once($CFG->dirroot.'/group/lib.php');
require_once($CFG->dirroot.'/cohort/lib.php');
-require_once('uploaduserlib.php');
-require_once('uploaduser_form.php');
+require_once('locallib.php');
+require_once('user_form.php');
$iid = optional_param('iid', '', PARAM_INT);
$previewrows = optional_param('previewrows', 10, PARAM_INT);
raise_memory_limit(MEMORY_HUGE);
require_login();
-admin_externalpage_setup('uploadusers');
+admin_externalpage_setup('tooluploaduser');
require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM));
-$struserrenamed = get_string('userrenamed', 'admin');
+$struserrenamed = get_string('userrenamed', 'tool_uploaduser');
$strusernotrenamedexists = get_string('usernotrenamedexists', 'error');
$strusernotrenamedmissing = get_string('usernotrenamedmissing', 'error');
$strusernotrenamedoff = get_string('usernotrenamedoff', 'error');
$strusernotrenamedadmin = get_string('usernotrenamedadmin', 'error');
-$struserupdated = get_string('useraccountupdated', 'admin');
+$struserupdated = get_string('useraccountupdated', 'tool_uploaduser');
$strusernotupdated = get_string('usernotupdatederror', 'error');
$strusernotupdatednotexists = get_string('usernotupdatednotexists', 'error');
$strusernotupdatedadmin = get_string('usernotupdatedadmin', 'error');
-$struseruptodate = get_string('useraccountuptodate', 'admin');
+$struseruptodate = get_string('useraccountuptodate', 'tool_uploaduser');
$struseradded = get_string('newuser');
$strusernotadded = get_string('usernotaddedregistered', 'error');
$strusernotaddederror = get_string('usernotaddederror', 'error');
-$struserdeleted = get_string('userdeleted', 'admin');
+$struserdeleted = get_string('userdeleted', 'tool_uploaduser');
$strusernotdeletederror = get_string('usernotdeletederror', 'error');
$strusernotdeletedmissing = get_string('usernotdeletedmissing', 'error');
$strusernotdeletedoff = get_string('usernotdeletedoff', 'error');
$strinvalidpasswordpolicy = get_string('invalidpasswordpolicy', 'error');
$errorstr = get_string('error');
-$returnurl = new moodle_url('/admin/uploaduser.php');
+$returnurl = new moodle_url('/admin/tool/uploaduser/index.php');
$bulknurl = new moodle_url('/admin/user/user_bulk.php');
$today = time();
} else {
echo $OUTPUT->header();
- echo $OUTPUT->heading_with_help(get_string('uploadusers', 'admin'), 'uploadusers', 'admin');
+ echo $OUTPUT->heading_with_help(get_string('uploadusers', 'tool_uploaduser'), 'uploadusers', 'tool_uploaduser');
$mform1->display();
echo $OUTPUT->footer();
} else if ($formdata = $mform2->get_data()) {
// Print the header
echo $OUTPUT->header();
- echo $OUTPUT->heading(get_string('uploadusersresult', 'admin'));
+ echo $OUTPUT->heading(get_string('uploadusersresult', 'tool_uploaduser'));
$optype = $formdata->uutype;
if ($createpasswords) {
$user->password = 'to be generated';
$upt->track('password', '', 'normal', false);
- $upt->track('password', get_string('uupasswordcron', 'admin'), 'warning', false);
+ $upt->track('password', get_string('uupasswordcron', 'tool_uploaduser'), 'warning', false);
} else {
$upt->track('password', '', 'normal', false);
$upt->track('password', get_string('missingfield', 'error', 'password'), 'error');
echo $OUTPUT->box_start('boxwidthnarrow boxaligncenter generalbox', 'uploadresults');
echo '<p>';
if ($optype != UU_USER_UPDATE) {
- echo get_string('userscreated', 'admin').': '.$usersnew.'<br />';
+ echo get_string('userscreated', 'tool_uploaduser').': '.$usersnew.'<br />';
}
if ($optype == UU_USER_UPDATE or $optype == UU_USER_ADD_UPDATE) {
- echo get_string('usersupdated', 'admin').': '.$usersupdated.'<br />';
+ echo get_string('usersupdated', 'tool_uploaduser').': '.$usersupdated.'<br />';
}
if ($allowdeletes) {
- echo get_string('usersdeleted', 'admin').': '.$deletes.'<br />';
- echo get_string('deleteerrors', 'admin').': '.$deleteerrors.'<br />';
+ echo get_string('usersdeleted', 'tool_uploaduser').': '.$deletes.'<br />';
+ echo get_string('deleteerrors', 'tool_uploaduser').': '.$deleteerrors.'<br />';
}
if ($allowrenames) {
- echo get_string('usersrenamed', 'admin').': '.$renames.'<br />';
- echo get_string('renameerrors', 'admin').': '.$renameerrors.'<br />';
+ echo get_string('usersrenamed', 'tool_uploaduser').': '.$renames.'<br />';
+ echo get_string('renameerrors', 'tool_uploaduser').': '.$renameerrors.'<br />';
}
if ($usersskipped) {
- echo get_string('usersskipped', 'admin').': '.$usersskipped.'<br />';
+ echo get_string('usersskipped', 'tool_uploaduser').': '.$usersskipped.'<br />';
}
- echo get_string('usersweakpassword', 'admin').': '.$weakpasswords.'<br />';
- echo get_string('errors', 'admin').': '.$userserrors.'</p>';
+ echo get_string('usersweakpassword', 'tool_uploaduser').': '.$weakpasswords.'<br />';
+ echo get_string('errors', 'tool_uploaduser').': '.$userserrors.'</p>';
echo $OUTPUT->box_end();
if ($bulk) {
// Print the header
echo $OUTPUT->header();
-echo $OUTPUT->heading(get_string('uploaduserspreview', 'admin'));
+echo $OUTPUT->heading(get_string('uploaduserspreview', 'tool_uploaduser'));
// NOTE: this is JUST csv processing preview, we must not prevent import from here if there is something in the file!!
// this was intended for validation of csv formatting and encoding, not filtering the data!!!!
$table->id = "uupreview";
$table->attributes['class'] = 'generaltable';
$table->tablealign = 'center';
-$table->summary = get_string('uploaduserspreview', 'admin');
+$table->summary = get_string('uploaduserspreview', 'tool_uploaduser');
$table->head = array();
$table->data = $data;
-$table->head[] = get_string('uucsvline', 'admin');
+$table->head[] = get_string('uucsvline', 'tool_uploaduser');
foreach ($filecolumns as $column) {
$table->head[] = $column;
}
--- /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/>.
+
+/**
+ * Strings for component 'tool_uploaduser', language 'en', branch 'MOODLE_22_STABLE'
+ *
+ * @package tool
+ * @subpackage uploaduser
+ * @copyright 2011 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['allowdeletes'] = 'Allow deletes';
+$string['allowrenames'] = 'Allow renames';
+$string['csvdelimiter'] = 'CSV delimiter';
+$string['defaultvalues'] = 'Default values';
+$string['deleteerrors'] = 'Delete errors';
+$string['encoding'] = 'Encoding';
+$string['errors'] = 'Errors';
+$string['nochanges'] = 'No changes';
+$string['pluginname'] = 'User upload';
+$string['renameerrors'] = 'Rename errors';
+$string['requiredtemplate'] = 'Required. You may use template syntax here (%l = lastname, %f = firstname, %u = username). See help for details and examples.';
+$string['rowpreviewnum'] = 'Preview rows';
+$string['uploadpicture_baduserfield'] = 'The user attribute specified is not valid. Please, try again.';
+$string['uploadpicture_cannotmovezip'] = 'Cannot move zip file to temporary directory.';
+$string['uploadpicture_cannotprocessdir'] = 'Cannot process unzipped files.';
+$string['uploadpicture_cannotsave'] = 'Cannot save picture for user {$a}. Check original picture file.';
+$string['uploadpicture_cannotunzip'] = 'Cannot unzip pictures file.';
+$string['uploadpicture_invalidfilename'] = 'Picture file {$a} has invalid characters in its name. Skipping.';
+$string['uploadpicture_overwrite'] = 'Overwrite existing user pictures?';
+$string['uploadpicture_userfield'] = 'User attribute to use to match pictures:';
+$string['uploadpicture_usernotfound'] = 'User with a \'{$a->userfield}\' value of \'{$a->uservalue}\' does not exist. Skipping.';
+$string['uploadpicture_userskipped'] = 'Skipping user {$a} (already has a picture).';
+$string['uploadpicture_userupdated'] = 'Picture updated for user {$a}.';
+$string['uploadpictures'] = 'Upload user pictures';
+$string['uploadpictures_help'] = 'User pictures can be uploaded as a zip file of image files. The image files should be named chosen-user-attribute.extension, for example user1234.jpg for a user with username user1234.';
+$string['uploadusers'] = 'Upload users';
+$string['uploadusers_help'] = 'Users may be uploaded (and optionally enrolled in courses) via text file. The format of the file should be as follows:
+
+* Each line of the file contains one record
+* Each record is a series of data separated by commas (or other delimiters)
+* The first record contains a list of fieldnames defining the format of the rest of the file
+* Required fieldnames are username, password, firstname, lastname, email';
+$string['uploaduserspreview'] = 'Upload users preview';
+$string['uploadusersresult'] = 'Upload users results';
+$string['useraccountupdated'] = 'User updated';
+$string['useraccountuptodate'] = 'User up-to-date';
+$string['userdeleted'] = 'User deleted';
+$string['userrenamed'] = 'User renamed';
+$string['userscreated'] = 'Users created';
+$string['usersdeleted'] = 'Users deleted';
+$string['usersrenamed'] = 'Users renamed';
+$string['usersskipped'] = 'Users skipped';
+$string['usersupdated'] = 'Users updated';
+$string['usersweakpassword'] = 'Users having a weak password';
+$string['uubulk'] = 'Select for bulk operations';
+$string['uubulkall'] = 'All users';
+$string['uubulknew'] = 'New users';
+$string['uubulkupdated'] = 'Updated users';
+$string['uucsvline'] = 'CSV line';
+$string['uulegacy1role'] = '(Original Student) typeN=1';
+$string['uulegacy2role'] = '(Original Teacher) typeN=2';
+$string['uulegacy3role'] = '(Original Non-editing teacher) typeN=3';
+$string['uunoemailduplicates'] = 'Prevent email address duplicates';
+$string['uuoptype'] = 'Upload type';
+$string['uuoptype_addinc'] = 'Add all, append number to usernames if needed';
+$string['uuoptype_addnew'] = 'Add new only, skip existing users';
+$string['uuoptype_addupdate'] = 'Add new and update existing users';
+$string['uuoptype_update'] = 'Update existing users only';
+$string['uupasswordcron'] = 'Generated in cron';
+$string['uupasswordnew'] = 'New user password';
+$string['uupasswordold'] = 'Existing user password';
+$string['uustandardusernames'] = 'Standardise usernames';
+$string['uuupdateall'] = 'Override with file and defaults';
+$string['uuupdatefromfile'] = 'Override with file';
+$string['uuupdatemissing'] = 'Fill in missing from file and defaults';
+$string['uuupdatetype'] = 'Existing user details';
+$string['uuusernametemplate'] = 'Username template';
/**
* Bulk user registration functions
*
- * @package core
- * @subpackage admin
+ * @package tool
+ * @subpackage uploaduser
* @copyright 2004 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
*/
public function start() {
$ci = 0;
- echo '<table id="uuresults" class="generaltable boxaligncenter flexible-wrap" summary="'.get_string('uploadusersresult', 'admin').'">';
+ echo '<table id="uuresults" class="generaltable boxaligncenter flexible-wrap" summary="'.get_string('uploadusersresult', 'tool_uploaduser').'">';
echo '<tr class="heading r0">';
echo '<th class="header c'.$ci++.'" scope="col">'.get_string('status').'</th>';
- echo '<th class="header c'.$ci++.'" scope="col">'.get_string('uucsvline', 'admin').'</th>';
+ echo '<th class="header c'.$ci++.'" scope="col">'.get_string('uucsvline', 'tool_uploaduser').'</th>';
echo '<th class="header c'.$ci++.'" scope="col">ID</th>';
echo '<th class="header c'.$ci++.'" scope="col">'.get_string('username').'</th>';
echo '<th class="header c'.$ci++.'" scope="col">'.get_string('firstname').'</th>';
<?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/>.
-///////////////////////////////////////////////////////////////////////////
-// //
-// Copyright (C) 2007 Inaki Arenaza //
-// //
-// Based on .../admin/uploaduser.php and .../lib/gdlib.php //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-require_once('../config.php');
+/**
+ * Bulk upload of user pictures
+ *
+ * Based on .../admin/uploaduser.php and .../lib/gdlib.php
+ *
+ * @package tool
+ * @subpackage uploaduser
+ * @copyright (C) 2007 Inaki Arenaza
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require('../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/gdlib.php');
-require_once('uploadpicture_form.php');
+require_once('picture_form.php');
define ('PIX_FILE_UPDATED', 0);
define ('PIX_FILE_ERROR', 1);
define ('PIX_FILE_SKIPPED', 2);
-admin_externalpage_setup('uploadpictures');
+admin_externalpage_setup('tooluploaduserpictures');
require_login();
$strfile = get_string('file');
$struser = get_string('user');
-$strusersupdated = get_string('usersupdated', 'admin');
-$struploadpictures = get_string('uploadpictures','admin');
+$strusersupdated = get_string('usersupdated', 'tool_uploaduser');
+$struploadpictures = get_string('uploadpictures','tool_uploaduser');
$userfields = array (
0 => 'username',
/// Print the header
echo $OUTPUT->header();
-echo $OUTPUT->heading_with_help($struploadpictures, 'uploadpictures', 'admin');
+echo $OUTPUT->heading_with_help($struploadpictures, 'uploadpictures', 'tool_uploaduser');
$mform = new admin_uploadpicture_form(null, $userfields);
if ($formdata = $mform->get_data()) {
if (!array_key_exists($userfield, $userfields)) {
- echo $OUTPUT->notification(get_string('uploadpicture_baduserfield','admin'));
+ echo $OUTPUT->notification(get_string('uploadpicture_baduserfield', 'tool_uploaduser'));
} else {
// Large files are likely to take their time and memory. Let PHP know
// that we'll take longer, and that the process should be recycled soon
$dstfile = $zipdir.'/images.zip';
if (!$mform->save_file('userpicturesfile', $dstfile, true)) {
- echo $OUTPUT->notification(get_string('uploadpicture_cannotmovezip','admin'));
+ echo $OUTPUT->notification(get_string('uploadpicture_cannotmovezip', 'tool_uploaduser'));
@remove_dir($zipdir);
} else {
$fp = get_file_packer('application/zip');
$unzipresult = $fp->extract_to_pathname($dstfile, $zipdir);
if (!$unzipresult) {
- echo $OUTPUT->notification(get_string('uploadpicture_cannotunzip','admin'));
+ echo $OUTPUT->notification(get_string('uploadpicture_cannotunzip', 'tool_uploaduser'));
@remove_dir($zipdir);
} else {
// We don't need the zip file any longer, so delete it to make
// Finally remove the temporary directory with all the user images and print some stats.
remove_dir($zipdir);
- echo $OUTPUT->notification(get_string('usersupdated', 'admin') . ": " . $results['updated']);
- echo $OUTPUT->notification(get_string('errors', 'admin') . ": " . $results['errors']);
+ echo $OUTPUT->notification(get_string('usersupdated', 'tool_uploaduser') . ": " . $results['updated'], 'notifysuccess');
+ echo $OUTPUT->notification(get_string('errors', 'tool_uploaduser') . ": " . $results['errors'], ($results['errors'] ? 'notifyproblem' : 'notifysuccess'));
echo '<hr />';
}
}
function process_directory ($dir, $userfield, $overwrite, &$results) {
global $OUTPUT;
if(!($handle = opendir($dir))) {
- echo $OUTPUT->notification(get_string('uploadpicture_cannotprocessdir','admin'));
+ echo $OUTPUT->notification(get_string('uploadpicture_cannotprocessdir', 'tool_uploaduser'));
return;
}
$a = new stdClass();
$a->userfield = clean_param($userfield, PARAM_CLEANHTML);
$a->uservalue = clean_param($uservalue, PARAM_CLEANHTML);
- echo $OUTPUT->notification(get_string('uploadpicture_usernotfound', 'admin', $a));
+ echo $OUTPUT->notification(get_string('uploadpicture_usernotfound', 'tool_uploaduser', $a));
return PIX_FILE_ERROR;
}
$haspicture = $DB->get_field('user', 'picture', array('id'=>$user->id));
if ($haspicture && !$overwrite) {
- echo $OUTPUT->notification(get_string('uploadpicture_userskipped', 'admin', $user->username));
+ echo $OUTPUT->notification(get_string('uploadpicture_userskipped', 'tool_uploaduser', $user->username));
return PIX_FILE_SKIPPED;
}
if (my_save_profile_image($user->id, $file)) {
$DB->set_field('user', 'picture', 1, array('id'=>$user->id));
- echo $OUTPUT->notification(get_string('uploadpicture_userupdated', 'admin', $user->username));
+ echo $OUTPUT->notification(get_string('uploadpicture_userupdated', 'tool_uploaduser', $user->username), 'notifysuccess');
return PIX_FILE_UPDATED;
} else {
- echo $OUTPUT->notification(get_string('uploadpicture_cannotsave', 'admin', $user->username));
+ echo $OUTPUT->notification(get_string('uploadpicture_cannotsave', 'tool_uploaduser', $user->username));
return PIX_FILE_ERROR;
}
}
--- /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/>.
+
+/**
+ * Bulk user picture upload form
+ *
+ * @package tool
+ * @subpackage uploaduser
+ * @copyright (C) 2007 Inaki Arenaza
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+require_once $CFG->libdir.'/formslib.php';
+
+class admin_uploadpicture_form extends moodleform {
+ function definition (){
+ global $CFG, $USER;
+
+ $mform =& $this->_form;
+
+ $mform->addElement('header', 'settingsheader', get_string('upload'));
+
+
+ $options = array();
+ $options['accepted_types'] = array('archive');
+ $mform->addElement('filepicker', 'userpicturesfile', get_string('file'), 'size="40"', $options);
+ $mform->addRule('userpicturesfile', null, 'required');
+
+ $choices =& $this->_customdata;
+ $mform->addElement('select', 'userfield', get_string('uploadpicture_userfield', 'tool_uploaduser'), $choices);
+ $mform->setType('userfield', PARAM_INT);
+
+ $choices = array( 0 => get_string('no'), 1 => get_string('yes') );
+ $mform->addElement('select', 'overwritepicture', get_string('uploadpicture_overwrite', 'tool_uploaduser'), $choices);
+ $mform->setType('overwritepicture', PARAM_INT);
+
+ $this->add_action_buttons(false, get_string('uploadpictures', 'tool_uploaduser'));
+ }
+}
+
--- /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/>.
+
+/**
+ * Link to CSV user upload
+ *
+ * @package tool
+ * @subpackage uploaduser
+ * @copyright 2010 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+if (has_capability('moodle/site:uploadusers', $systemcontext)) {
+ $ADMIN->add('accounts', new admin_externalpage('tooluploaduser', get_string('uploadusers', 'tool_uploaduser'), "$CFG->wwwroot/$CFG->admin/tool/uploaduser/index.php", 'moodle/site:uploadusers'));
+ $ADMIN->add('accounts', new admin_externalpage('tooluploaduserpictures', get_string('uploadpictures','tool_uploaduser'), "$CFG->wwwroot/$CFG->admin/tool/uploaduser/picture.php", 'moodle/site:uploadusers'));
+}
/**
* Bulk user upload forms
*
- * @package core
- * @subpackage admin
+ * @package tool
+ * @subpackage uploaduser
* @copyright 2007 Dan Poltawski
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Upload a file CVS file with user information.
*
- * @package core
- * @subpackage admin
* @copyright 2007 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$mform->addRule('userfile', null, 'required');
$choices = csv_import_reader::get_delimiter_list();
- $mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'admin'), $choices);
+ $mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_uploaduser'), $choices);
if (array_key_exists('cfg', $choices)) {
$mform->setDefault('delimiter_name', 'cfg');
} else if (get_string('listsep', 'langconfig') == ';') {
$textlib = textlib_get_instance();
$choices = $textlib->get_encodings();
- $mform->addElement('select', 'encoding', get_string('encoding', 'admin'), $choices);
+ $mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
$mform->setDefault('encoding', 'UTF-8');
$choices = array('10'=>10, '20'=>20, '100'=>100, '1000'=>1000, '100000'=>100000);
- $mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'admin'), $choices);
+ $mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'tool_uploaduser'), $choices);
$mform->setType('previewrows', PARAM_INT);
- $this->add_action_buttons(false, get_string('uploadusers', 'admin'));
+ $this->add_action_buttons(false, get_string('uploadusers', 'tool_uploaduser'));
}
}
/**
* Specify user upload details
*
- * @package core
- * @subpackage admin
* @copyright 2007 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// upload settings and file
$mform->addElement('header', 'settingsheader', get_string('settings'));
- $choices = array(UU_USER_ADDNEW => get_string('uuoptype_addnew', 'admin'),
- UU_USER_ADDINC => get_string('uuoptype_addinc', 'admin'),
- UU_USER_ADD_UPDATE => get_string('uuoptype_addupdate', 'admin'),
- UU_USER_UPDATE => get_string('uuoptype_update', 'admin'));
- $mform->addElement('select', 'uutype', get_string('uuoptype', 'admin'), $choices);
+ $choices = array(UU_USER_ADDNEW => get_string('uuoptype_addnew', 'tool_uploaduser'),
+ UU_USER_ADDINC => get_string('uuoptype_addinc', 'tool_uploaduser'),
+ UU_USER_ADD_UPDATE => get_string('uuoptype_addupdate', 'tool_uploaduser'),
+ UU_USER_UPDATE => get_string('uuoptype_update', 'tool_uploaduser'));
+ $mform->addElement('select', 'uutype', get_string('uuoptype', 'tool_uploaduser'), $choices);
$choices = array(0 => get_string('infilefield', 'auth'), 1 => get_string('createpasswordifneeded', 'auth'));
- $mform->addElement('select', 'uupasswordnew', get_string('uupasswordnew', 'admin'), $choices);
+ $mform->addElement('select', 'uupasswordnew', get_string('uupasswordnew', 'tool_uploaduser'), $choices);
$mform->setDefault('uupasswordnew', 1);
$mform->disabledIf('uupasswordnew', 'uutype', 'eq', UU_USER_UPDATE);
- $choices = array(UU_UPDATE_NOCHANGES => get_string('nochanges', 'admin'),
- UU_UPDATE_FILEOVERRIDE => get_string('uuupdatefromfile', 'admin'),
- UU_UPDATE_ALLOVERRIDE => get_string('uuupdateall', 'admin'),
- UU_UPDATE_MISSING => get_string('uuupdatemissing', 'admin'));
- $mform->addElement('select', 'uuupdatetype', get_string('uuupdatetype', 'admin'), $choices);
+ $choices = array(UU_UPDATE_NOCHANGES => get_string('nochanges', 'tool_uploaduser'),
+ UU_UPDATE_FILEOVERRIDE => get_string('uuupdatefromfile', 'tool_uploaduser'),
+ UU_UPDATE_ALLOVERRIDE => get_string('uuupdateall', 'tool_uploaduser'),
+ UU_UPDATE_MISSING => get_string('uuupdatemissing', 'tool_uploaduser'));
+ $mform->addElement('select', 'uuupdatetype', get_string('uuupdatetype', 'tool_uploaduser'), $choices);
$mform->setDefault('uuupdatetype', UU_UPDATE_NOCHANGES);
$mform->disabledIf('uuupdatetype', 'uutype', 'eq', UU_USER_ADDNEW);
$mform->disabledIf('uuupdatetype', 'uutype', 'eq', UU_USER_ADDINC);
- $choices = array(0 => get_string('nochanges', 'admin'), 1 => get_string('update'));
- $mform->addElement('select', 'uupasswordold', get_string('uupasswordold', 'admin'), $choices);
+ $choices = array(0 => get_string('nochanges', 'tool_uploaduser'), 1 => get_string('update'));
+ $mform->addElement('select', 'uupasswordold', get_string('uupasswordold', 'tool_uploaduser'), $choices);
$mform->setDefault('uupasswordold', 0);
$mform->disabledIf('uupasswordold', 'uutype', 'eq', UU_USER_ADDNEW);
$mform->disabledIf('uupasswordold', 'uutype', 'eq', UU_USER_ADDINC);
$mform->disabledIf('uupasswordold', 'uuupdatetype', 'eq', 0);
$mform->disabledIf('uupasswordold', 'uuupdatetype', 'eq', 3);
- $choices = array(UU_PWRESET_WEAK => get_string('usersweakpassword', 'admin'),
+ $choices = array(UU_PWRESET_WEAK => get_string('usersweakpassword', 'tool_uploaduser'),
UU_PWRESET_NONE => get_string('none'),
UU_PWRESET_ALL => get_string('all'));
if (empty($CFG->passwordpolicy)) {
$mform->addElement('select', 'uuforcepasswordchange', get_string('forcepasswordchange', 'core'), $choices);
- $mform->addElement('selectyesno', 'uuallowrenames', get_string('allowrenames', 'admin'));
+ $mform->addElement('selectyesno', 'uuallowrenames', get_string('allowrenames', 'tool_uploaduser'));
$mform->setDefault('uuallowrenames', 0);
$mform->disabledIf('uuallowrenames', 'uutype', 'eq', UU_USER_ADDNEW);
$mform->disabledIf('uuallowrenames', 'uutype', 'eq', UU_USER_ADDINC);
- $mform->addElement('selectyesno', 'uuallowdeletes', get_string('allowdeletes', 'admin'));
+ $mform->addElement('selectyesno', 'uuallowdeletes', get_string('allowdeletes', 'tool_uploaduser'));
$mform->setDefault('uuallowdeletes', 0);
$mform->disabledIf('uuallowdeletes', 'uutype', 'eq', UU_USER_ADDNEW);
$mform->disabledIf('uuallowdeletes', 'uutype', 'eq', UU_USER_ADDINC);
- $mform->addElement('selectyesno', 'uunoemailduplicates', get_string('uunoemailduplicates', 'admin'));
+ $mform->addElement('selectyesno', 'uunoemailduplicates', get_string('uunoemailduplicates', 'tool_uploaduser'));
$mform->setDefault('uunoemailduplicates', 1);
- $mform->addElement('selectyesno', 'uustandardusernames', get_string('uustandardusernames', 'admin'));
+ $mform->addElement('selectyesno', 'uustandardusernames', get_string('uustandardusernames', 'tool_uploaduser'));
$mform->setDefault('uustandardusernames', 1);
$choices = array(UU_BULK_NONE => get_string('no'),
- UU_BULK_NEW => get_string('uubulknew', 'admin'),
- UU_BULK_UPDATED => get_string('uubulkupdated', 'admin'),
- UU_BULK_ALL => get_string('uubulkall', 'admin'));
- $mform->addElement('select', 'uubulk', get_string('uubulk', 'admin'), $choices);
+ UU_BULK_NEW => get_string('uubulknew', 'tool_uploaduser'),
+ UU_BULK_UPDATED => get_string('uubulkupdated', 'tool_uploaduser'),
+ UU_BULK_ALL => get_string('uubulkall', 'tool_uploaduser'));
+ $mform->addElement('select', 'uubulk', get_string('uubulk', 'tool_uploaduser'), $choices);
$mform->setDefault('uubulk', 0);
// roles selection
$choices = uu_allowed_roles(true);
- $mform->addElement('select', 'uulegacy1', get_string('uulegacy1role', 'admin'), $choices);
+ $mform->addElement('select', 'uulegacy1', get_string('uulegacy1role', 'tool_uploaduser'), $choices);
if ($studentroles = get_archetype_roles('student')) {
foreach ($studentroles as $role) {
if (isset($choices[$role->id])) {
unset($studentroles);
}
- $mform->addElement('select', 'uulegacy2', get_string('uulegacy2role', 'admin'), $choices);
+ $mform->addElement('select', 'uulegacy2', get_string('uulegacy2role', 'tool_uploaduser'), $choices);
if ($editteacherroles = get_archetype_roles('editingteacher')) {
foreach ($editteacherroles as $role) {
if (isset($choices[$role->id])) {
unset($editteacherroles);
}
- $mform->addElement('select', 'uulegacy3', get_string('uulegacy3role', 'admin'), $choices);
+ $mform->addElement('select', 'uulegacy3', get_string('uulegacy3role', 'tool_uploaduser'), $choices);
if ($teacherroles = get_archetype_roles('teacher')) {
foreach ($teacherroles as $role) {
if (isset($choices[$role->id])) {
}
// default values
- $mform->addElement('header', 'defaultheader', get_string('defaultvalues', 'admin'));
+ $mform->addElement('header', 'defaultheader', get_string('defaultvalues', 'tool_uploaduser'));
- $mform->addElement('text', 'username', get_string('uuusernametemplate', 'admin'), 'size="20"');
- $mform->addRule('username', get_string('requiredtemplate', 'admin'), 'required', null, 'client');
+ $mform->addElement('text', 'username', get_string('uuusernametemplate', 'tool_uploaduser'), 'size="20"');
+ $mform->addRule('username', get_string('requiredtemplate', 'tool_uploaduser'), 'required', null, 'client');
$mform->disabledIf('username', 'uutype', 'eq', UU_USER_ADD_UPDATE);
$mform->disabledIf('username', 'uutype', 'eq', UU_USER_UPDATE);
$mform->addElement('hidden', 'previewrows');
$mform->setType('previewrows', PARAM_INT);
- $this->add_action_buttons(true, get_string('uploadusers', 'admin'));
+ $this->add_action_buttons(true, get_string('uploadusers', 'tool_uploaduser'));
$this->set_data($data);
}
}
if (!in_array('email', $columns) and empty($data['email'])) {
- $errors['email'] = get_string('requiredtemplate', 'admin');
+ $errors['email'] = get_string('requiredtemplate', 'tool_uploaduser');
}
}
--- /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/>.
+
+/**
+ * Plugin version info
+ *
+ * @package tool
+ * @subpackage uploaduser
+ * @copyright 2011 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+defined('MOODLE_INTERNAL') || die;
+
+$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011091600; // Requires this Moodle version
+$plugin->component = 'tool_uploaduser'; // Full name of the plugin (used for diagnostics)
+
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package xmldb-editor
- * @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
+ * @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 xmldb-editor
- * @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
+ * @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 {
*/
function loadStrings($strings) {
/// Load some commonly used strings
- if (get_string_manager()->string_exists($this->title, 'xmldb')) {
- $this->str['title'] = get_string($this->title, 'xmldb');
+ if (get_string_manager()->string_exists($this->title, 'tool_xmldb')) {
+ $this->str['title'] = get_string($this->title, 'tool_xmldb');
} else {
$this->str['title'] = $this->title;
}
global $CFG;
/// Get the action path and invoke it
- $actionsroot = "$CFG->dirroot/$CFG->admin/xmldb/actions";
+ $actionsroot = "$CFG->dirroot/$CFG->admin/tool/xmldb/actions";
$actionclass = $action . '.class.php';
$actionpath = "$actionsroot/$action/$actionclass";
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package xmldb-editor
- * @copyright 2008 onwards Tim Hunt
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package tool
+ * @subpackage 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 xmldb-editor
- * @copyright 2008 onwards Tim Hunt
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package tool
+ * @subpackage xmldb
+ * @copyright 2008 onwards Tim Hunt
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class XMLDBCheckAction extends XMLDBAction {
/**
/// Get needed strings
$this->loadStrings(array(
- $this->introstr => 'xmldb',
+ $this->introstr => 'tool_xmldb',
'ok' => '',
- 'wrong' => 'xmldb',
- 'table' => 'xmldb',
- 'field' => 'xmldb',
- 'searchresults' => 'xmldb',
- 'completelogbelow' => 'xmldb',
+ 'wrong' => 'tool_xmldb',
+ 'table' => 'tool_xmldb',
+ 'field' => 'tool_xmldb',
+ 'searchresults' => 'tool_xmldb',
+ 'completelogbelow' => 'tool_xmldb',
'yes' => '',
'no' => '',
'error' => '',
- 'back' => 'xmldb'
+ 'back' => 'tool_xmldb'
));
}
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package xmldb-editor
- * @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
+ * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* and providing one SQL script to fix all them. Also, under MySQL,
* it performs one check of signed bigints. MDL-11038
*
- * @package xmldb-editor
- * @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
+ * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class check_bigints extends XMLDBCheckAction {
private $correct_type;
/// Get needed strings
$this->loadStrings(array(
- 'wrongints' => 'xmldb',
- 'nowrongintsfound' => 'xmldb',
- 'yeswrongintsfound' => 'xmldb',
- 'mysqlextracheckbigints' => 'xmldb',
+ 'wrongints' => 'tool_xmldb',
+ 'nowrongintsfound' => 'tool_xmldb',
+ 'yeswrongintsfound' => 'tool_xmldb',
+ 'mysqlextracheckbigints' => 'tool_xmldb',
));
/// Correct fields must be type bigint for MySQL and int8 for PostgreSQL
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package xmldb-editor
- * @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
+ * @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 xmldb-editor
- * @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
+ * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class check_defaults extends XMLDBCheckAction {
/// Get needed strings
$this->loadStrings(array(
- 'wrongdefaults' => 'xmldb',
- 'nowrongdefaultsfound' => 'xmldb',
- 'yeswrongdefaultsfound' => 'xmldb',
- 'expected' => 'xmldb',
- 'actual' => 'xmldb',
+ 'wrongdefaults' => 'tool_xmldb',
+ 'nowrongdefaultsfound' => 'tool_xmldb',
+ 'yeswrongdefaultsfound' => 'tool_xmldb',
+ 'expected' => 'tool_xmldb',
+ 'actual' => 'tool_xmldb',
));
}
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package xmldb-editor
- * @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
+ * @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 xmldb-editor
- * @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
+ * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class check_foreign_keys extends XMLDBCheckAction {
/// Get needed strings
$this->loadStrings(array(
- 'key' => 'xmldb',
- 'violatedforeignkeys' => 'xmldb',
- 'noviolatedforeignkeysfound' => 'xmldb',
- 'violatedforeignkeysfound' => 'xmldb',
- 'violations' => 'xmldb',
+ 'key' => 'tool_xmldb',
+ 'violatedforeignkeys' => 'tool_xmldb',
+ 'noviolatedforeignkeysfound' => 'tool_xmldb',
+ 'violatedforeignkeysfound' => 'tool_xmldb',
+ 'violations' => 'tool_xmldb',
));
}
$violation->tablename = $violation->table->getName();
$violation->keyname = $violation->key->getName();
- $r.= ' <li>' .get_string('fkviolationdetails', 'xmldb', $violation) .
+ $r.= ' <li>' .get_string('fkviolationdetails', 'tool_xmldb', $violation) .
'<pre>' . s($violation->sql) . '; ' . s($violation->sqlparams) . '</pre></li>';
}
$r.= ' </ul>';
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package xmldb-editor
- * @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
+ * @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 xmldb-editor
- * @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
+ * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class check_indexes extends XMLDBCheckAction {
/// Get needed strings
$this->loadStrings(array(
- 'missing' => 'xmldb',
- 'key' => 'xmldb',
- 'index' => 'xmldb',
- 'missingindexes' => 'xmldb',
- 'nomissingindexesfound' => 'xmldb',
- 'yesmissingindexesfound' => 'xmldb',
+ 'missing' => 'tool_xmldb',
+ 'key' => 'tool_xmldb',
+ 'index' => 'tool_xmldb',
+ 'missingindexes' => 'tool_xmldb',
+ 'nomissingindexesfound' => 'tool_xmldb',
+ 'yesmissingindexesfound' => 'tool_xmldb',
));
}
<?php
-
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
-// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-/// This class will
+// 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 tool
+ * @subpackage 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