mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
Merge branch 'w38_MDL-29509_m22_admintool2' of git://github.com/skodak/moodle
This commit is contained in:
commit
01b4e00161
@ -1,32 +0,0 @@
|
||||
<?PHP
|
||||
// dbperformance.php - shows latest ADOdb stats for the current server
|
||||
|
||||
// disable moodle specific debug messages and any errors in output
|
||||
define('NO_DEBUG_DISPLAY', true);
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
error('TODO: rewrite db perf code'); // TODO: rewrite
|
||||
|
||||
|
||||
$topframe = optional_param('topframe', 0, PARAM_BOOL);
|
||||
$bottomframe = optional_param('bottomframe', 0, PARAM_BOOL);
|
||||
$do = optional_param('do', '', PARAM_ALPHA);
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$strdatabaseperformance = get_string("databaseperformance");
|
||||
$stradministration = get_string("administration");
|
||||
$site = get_site();
|
||||
|
||||
if (!empty($topframe)) {
|
||||
$PAGE->set_url('/admin/dbperformance.php');
|
||||
$PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php'));
|
||||
$PAGE->navbar->add($strdatabaseperformance);
|
||||
$PAGE->set_title("$site->shortname: $strdatabaseperformance");
|
||||
$PAGE->set_heading($site->fullname);
|
||||
echo $OUTPUT->header();
|
||||
exit;
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Deletes the moodledata directory, COMPLETELY!!
|
||||
// BE VERY CAREFUL USING THIS!
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('purgemoodledata');
|
||||
|
||||
require_login();
|
||||
|
||||
$sure = optional_param('sure', 0, PARAM_BOOL);
|
||||
$reallysure = optional_param('reallysure', 0, PARAM_BOOL);
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$deletedir = $CFG->dataroot; // The directory to delete!
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading('Purge moodledata');
|
||||
|
||||
if (empty($sure)) {
|
||||
$optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey());
|
||||
|
||||
$formcontinue = new single_button(new moodle_url('delete.php', $optionsyes), get_string('yes'));
|
||||
$formcancel = new single_button('index.php', get_string('no'), 'get');
|
||||
echo $OUTPUT->confirm('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?', $formcontinue, $formcancel);
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!data_submitted() or empty($reallysure)) {
|
||||
$optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey(), 'reallysure'=>'yes');
|
||||
$formcontinue = new single_button(new moodle_url('delete.php', $optionsyes), get_string('yes'));
|
||||
$formcancel = new single_button('index.php', get_string('no'), 'get');
|
||||
echo $OUTPUT->confirm('Are you REALLY REALLY completely sure you want to delete everything inside the directory '.
|
||||
$deletedir .' (this includes all user images, and any other course files that have been created) ?',
|
||||
$formcontinue, $formcancel);
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
print_error('wrongcall', 'error');
|
||||
}
|
||||
|
||||
/// OK, here goes ...
|
||||
|
||||
delete_subdirectories($deletedir);
|
||||
|
||||
echo '<h1 align="center">Done!</h1>';
|
||||
echo $OUTPUT->continue_button($CFG->wwwroot);
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
|
||||
|
||||
function delete_subdirectories($rootdir) {
|
||||
|
||||
$dir = opendir($rootdir);
|
||||
|
||||
while (false !== ($file = readdir($dir))) {
|
||||
if ($file != '.' and $file != '..') {
|
||||
$fullfile = $rootdir .'/'. $file;
|
||||
if (filetype($fullfile) == 'dir') {
|
||||
delete_subdirectories($fullfile);
|
||||
echo 'Deleting '. $fullfile .' ... ';
|
||||
if (rmdir($fullfile)) {
|
||||
echo 'Done.<br />';
|
||||
} else {
|
||||
echo 'FAILED.<br />';
|
||||
}
|
||||
} else {
|
||||
echo 'Deleting '. $fullfile .' ... ';
|
||||
if (unlink($fullfile)) {
|
||||
echo 'Done.<br />';
|
||||
} else {
|
||||
echo 'FAILED.<br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
}
|
||||
|
||||
|
@ -1,74 +0,0 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Language customization report upgrades
|
||||
*
|
||||
* @package report
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david.mudrak@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
function xmldb_report_customlang_upgrade($oldversion) {
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
$result = true;
|
||||
|
||||
/**
|
||||
* Use proper plugin prefix for tables
|
||||
*/
|
||||
if ($oldversion < 2010111200) {
|
||||
if ($dbman->table_exists('customlang')) {
|
||||
$dbman->rename_table(new xmldb_table('customlang'), 'report_customlang');
|
||||
}
|
||||
if ($dbman->table_exists('customlang_components')) {
|
||||
$dbman->rename_table(new xmldb_table('customlang_components'), 'report_customlang_components');
|
||||
}
|
||||
upgrade_plugin_savepoint(true, 2010111200, 'report', 'customlang');
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate the foreign key after the tables rename
|
||||
*/
|
||||
if ($oldversion < 2010111500) {
|
||||
$table = new xmldb_table('report_customlang');
|
||||
$oldkey = new xmldb_key('fk_component', XMLDB_KEY_FOREIGN, array('componentid'), 'customlang_components', array('id'));
|
||||
$newkey = new xmldb_key('fk_component', XMLDB_KEY_FOREIGN, array('componentid'), 'report_customlang_components', array('id'));
|
||||
|
||||
$dbman->drop_key($table, $oldkey);
|
||||
$dbman->add_key($table, $newkey);
|
||||
|
||||
upgrade_plugin_savepoint(true, 2010111500, 'report', 'customlang');
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the version field from integer to varchar
|
||||
*/
|
||||
if ($oldversion < 2011041900) {
|
||||
$table = new xmldb_table('report_customlang_components');
|
||||
$field = new xmldb_field('version', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'name');
|
||||
|
||||
$dbman->change_field_type($table, $field);
|
||||
|
||||
upgrade_plugin_savepoint(true, 2011041900, 'report', 'customlang');
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
.path-admin-report-customlang .langselectorbox,
|
||||
.path-admin-report-customlang fieldset.buttonsbar,
|
||||
.path-admin-report-customlang .menu {
|
||||
margin: 5px auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.path-admin-report-customlang .menu .singlebutton,
|
||||
.path-admin-report-customlang .menu .singlebutton form,
|
||||
.path-admin-report-customlang .menu .singlebutton form div {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
|
||||
.path-admin-report-customlang .mform.filterform {
|
||||
width: 70%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.path-admin-report-customlang .mform.filterform .fitem .fitemtitle {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.path-admin-report-customlang .mform.filterform .fitem .felement {
|
||||
width: 60%;
|
||||
margin-left: 31%;
|
||||
}
|
||||
|
||||
.path-admin-report-customlang #translator {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.path-admin-report-customlang #translator .standard,
|
||||
.path-admin-report-customlang #translator .local {
|
||||
min-width: 35%;
|
||||
}
|
||||
|
||||
.path-admin-report-customlang #translator .customized {
|
||||
background-color: #e7f1c3;
|
||||
}
|
||||
|
||||
.path-admin-report-customlang #translator .customized.outdated {
|
||||
background-color: #f3f2aa;
|
||||
}
|
||||
|
||||
.path-admin-report-customlang #translator .modified {
|
||||
background-color: #ffd3d9;
|
||||
}
|
||||
|
||||
.path-admin-report-customlang #translator .customized.modified {
|
||||
background-color: #d2ebff;
|
||||
}
|
||||
|
||||
.path-admin-report-customlang #translator textarea {
|
||||
width: 100%;
|
||||
min-height: 4em;
|
||||
}
|
||||
|
||||
.path-admin-report-customlang #translator .placeholderinfo {
|
||||
text-align: center;
|
||||
border: 1px dotted #ddd;
|
||||
background-color: #f6f6f6;
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
|
||||
#page-admin-report-customlang-index .continuebutton {
|
||||
margin-top: 1em;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
// spam cleaner
|
||||
$ADMIN->add('reports', new admin_externalpage('reportspamcleaner', get_string('pluginname', 'report_spamcleaner'), "$CFG->wwwroot/$CFG->admin/report/spamcleaner/index.php", 'moodle/site:config'));
|
||||
|
@ -19,6 +19,5 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configtext('allcountrycodes', get_string('allcountrycodes', 'admin'), get_string('configallcountrycodes', 'admin'), '', '/^(?:\w+(?:,\w+)*)?$/'));
|
||||
|
||||
$ADMIN->add('location', $temp);
|
||||
$ADMIN->add('location', new admin_externalpage('timezoneimport', get_string('updatetimezones', 'admin'), "$CFG->wwwroot/$CFG->admin/timezoneimport.php"));
|
||||
|
||||
} // end of speedup
|
||||
|
@ -482,6 +482,13 @@ foreach (get_plugin_list('tool') as $plugin => $plugindir) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Add all admin tools
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_category('tools', get_string('tools', 'admin')));
|
||||
$ADMIN->add('tools', new admin_externalpage('managetools', get_string('toolsmanage', 'admin'),
|
||||
$CFG->wwwroot . '/' . $CFG->admin . '/tools.php'));
|
||||
}
|
||||
|
||||
/// Add all local plugins - must be always last!
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_category('localplugins', get_string('localplugins')));
|
||||
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This file defines settingpages and externalpages in the "unsupported" hidden category, use wisely!
|
||||
|
||||
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('replace', 'Search and replace', $CFG->wwwroot.'/'.$CFG->admin.'/replace.php', 'moodle/site:config', true));
|
||||
|
||||
} // end of speedup
|
@ -19,12 +19,12 @@
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage bloglevelupgrade
|
||||
* @copyright 2011 petr Skoda
|
||||
* @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->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_bloglevelupgrade'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -19,12 +19,12 @@
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage capability
|
||||
* @copyright 2011 petr Skoda
|
||||
* @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->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_capability'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -16,9 +16,9 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Defines the capabilities used by the Language customization admin report
|
||||
* Defines the capabilities used by the Language customization admin tool
|
||||
*
|
||||
* @package report
|
||||
* @package tool
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
$capabilities = array(
|
||||
|
||||
/* allows the user to view the current language customization */
|
||||
'report/customlang:view' => array(
|
||||
'tool/customlang:view' => array(
|
||||
'riskbitmask' => RISK_CONFIG,
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
@ -39,7 +39,7 @@ $capabilities = array(
|
||||
),
|
||||
|
||||
/* allows the user to edit the current language customization */
|
||||
'report/customlang:edit' => array(
|
||||
'tool/customlang:edit' => array(
|
||||
'riskbitmask' => RISK_CONFIG | RISK_XSS,
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
51
admin/tool/customlang/db/install.php
Normal file
51
admin/tool/customlang/db/install.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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 customlang
|
||||
* @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_customlang_install() {
|
||||
global $CFG, $OUTPUT, $DB;
|
||||
|
||||
// this is a hack - this plugin used to live in admin/report/customlang,
|
||||
// we want to remove the orphaned version info and capability
|
||||
// unless there is a new report type with the same name
|
||||
// the original tables can be dropped because they are used for caching only
|
||||
|
||||
if (!file_exists("$CFG->dirroot/report/customlang")) {
|
||||
unset_all_config_for_plugin('report_customlang');
|
||||
capabilities_cleanup('report_customlang');
|
||||
$dbman = $DB->get_manager();
|
||||
$table = new xmldb_table('report_customlang');
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
$table = new xmldb_table('report_customlang_components');
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="admin/report/customlang/db" VERSION="20110419" COMMENT="XMLDB file for Moodle admin/report/customlang"
|
||||
<XMLDB PATH="admin/tool/customlang/db" VERSION="20110925" COMMENT="XMLDB file for Moodle admin/tool/customlang"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
<TABLES>
|
||||
<TABLE NAME="report_customlang" COMMENT="Contains the working checkout of all strings and their customization" NEXT="report_customlang_components">
|
||||
<TABLE NAME="tool_customlang" COMMENT="Contains the working checkout of all strings and their customization" NEXT="tool_customlang_components">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="lang"/>
|
||||
<FIELD NAME="lang" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="The code of the language this string belongs to. Like en, cs or es" PREVIOUS="id" NEXT="componentid"/>
|
||||
@ -20,13 +20,13 @@
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="fk_component"/>
|
||||
<KEY NAME="fk_component" TYPE="foreign" FIELDS="componentid" REFTABLE="report_customlang_components" REFFIELDS="id" PREVIOUS="primary"/>
|
||||
<KEY NAME="fk_component" TYPE="foreign" FIELDS="componentid" REFTABLE="tool_customlang_components" REFFIELDS="id" PREVIOUS="primary"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="uq_lang_component_string" UNIQUE="true" FIELDS="lang, componentid, stringid" COMMENT="For a given language and component, string identifiers must be unique"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
<TABLE NAME="report_customlang_components" COMMENT="Contains the list of all installed plugins that provide their own language pack" PREVIOUS="report_customlang">
|
||||
<TABLE NAME="tool_customlang_components" COMMENT="Contains the list of all installed plugins that provide their own language pack" PREVIOUS="tool_customlang">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="name"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The normalized name of the plugin" PREVIOUS="id" NEXT="version"/>
|
35
admin/tool/customlang/db/upgrade.php
Normal file
35
admin/tool/customlang/db/upgrade.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Language customization report upgrades
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david.mudrak@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -16,29 +15,29 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @package report
|
||||
* @package tool
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/report/customlang/locallib.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/report/customlang/filter_form.php');
|
||||
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/filter_form.php');
|
||||
|
||||
require_login(SITEID, false);
|
||||
require_capability('report/customlang:edit', get_system_context());
|
||||
require_capability('tool/customlang:edit', get_system_context());
|
||||
|
||||
$lng = required_param('lng', PARAM_LANG);
|
||||
$currentpage = optional_param('p', 0, PARAM_INT);
|
||||
$translatorsubmitted = optional_param('translatorsubmitted', 0, PARAM_BOOL);
|
||||
|
||||
$PAGE->set_pagelayout('standard');
|
||||
$PAGE->set_url('/admin/report/customlang/edit.php', array('lng' => $lng));
|
||||
navigation_node::override_active_url(new moodle_url('/admin/report/customlang/index.php'));
|
||||
$PAGE->set_title(get_string('pluginname', 'report_customlang'));
|
||||
$PAGE->set_heading(get_string('pluginname', 'report_customlang'));
|
||||
$PAGE->requires->js_init_call('M.report_customlang.init_editor', array(), true);
|
||||
$PAGE->set_url('/admin/tool/customlang/edit.php', array('lng' => $lng));
|
||||
navigation_node::override_active_url(new moodle_url('/admin/tool/customlang/index.php'));
|
||||
$PAGE->set_title(get_string('pluginname', 'tool_customlang'));
|
||||
$PAGE->set_heading(get_string('pluginname', 'tool_customlang'));
|
||||
$PAGE->requires->js_init_call('M.tool_customlang.init_editor', array(), true);
|
||||
|
||||
if (empty($lng)) {
|
||||
// PARAM_LANG validation failed
|
||||
@ -46,15 +45,15 @@ if (empty($lng)) {
|
||||
}
|
||||
|
||||
// pre-output processing
|
||||
$filter = new report_customlang_filter_form($PAGE->url, null, 'post', '', array('class'=>'filterform'));
|
||||
$filterdata = report_customlang_utils::load_filter($USER);
|
||||
$filter = new tool_customlang_filter_form($PAGE->url, null, 'post', '', array('class'=>'filterform'));
|
||||
$filterdata = tool_customlang_utils::load_filter($USER);
|
||||
$filter->set_data($filterdata);
|
||||
|
||||
if ($filter->is_cancelled()) {
|
||||
redirect($PAGE->url);
|
||||
|
||||
} elseif ($submitted = $filter->get_data()) {
|
||||
report_customlang_utils::save_filter($submitted, $USER);
|
||||
tool_customlang_utils::save_filter($submitted, $USER);
|
||||
redirect(new moodle_url($PAGE->url, array('p'=>0)));
|
||||
}
|
||||
|
||||
@ -66,13 +65,13 @@ if ($translatorsubmitted) {
|
||||
if ($checkin === false) {
|
||||
$nexturl = $PAGE->url;
|
||||
} else {
|
||||
$nexturl = new moodle_url('/admin/report/customlang/index.php', array('action'=>'checkin', 'lng' => $lng, 'sesskey'=>sesskey()));
|
||||
$nexturl = new moodle_url('/admin/tool/customlang/index.php', array('action'=>'checkin', 'lng' => $lng, 'sesskey'=>sesskey()));
|
||||
}
|
||||
|
||||
if (!is_array($strings)) {
|
||||
$strings = array();
|
||||
}
|
||||
$current = $DB->get_records_list('report_customlang', 'id', array_keys($strings));
|
||||
$current = $DB->get_records_list('tool_customlang', 'id', array_keys($strings));
|
||||
$now = time();
|
||||
|
||||
foreach ($strings as $recordid => $customization) {
|
||||
@ -83,7 +82,7 @@ if ($translatorsubmitted) {
|
||||
$current[$recordid]->modified = 1;
|
||||
$current[$recordid]->outdated = 0;
|
||||
$current[$recordid]->timecustomized = null;
|
||||
$DB->update_record('report_customlang', $current[$recordid]);
|
||||
$DB->update_record('tool_customlang', $current[$recordid]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -96,7 +95,7 @@ if ($translatorsubmitted) {
|
||||
$current[$recordid]->modified = 1;
|
||||
$current[$recordid]->outdated = 0;
|
||||
$current[$recordid]->timecustomized = $now;
|
||||
$DB->update_record('report_customlang', $current[$recordid]);
|
||||
$DB->update_record('tool_customlang', $current[$recordid]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -106,17 +105,17 @@ if ($translatorsubmitted) {
|
||||
}
|
||||
if (!empty($updates)) {
|
||||
list($sql, $params) = $DB->get_in_or_equal($updates);
|
||||
$DB->set_field_select('report_customlang', 'outdated', 0, "local IS NOT NULL AND id $sql", $params);
|
||||
$DB->set_field_select('tool_customlang', 'outdated', 0, "local IS NOT NULL AND id $sql", $params);
|
||||
}
|
||||
|
||||
redirect($nexturl);
|
||||
}
|
||||
|
||||
$translator = new report_customlang_translator($PAGE->url, $lng, $filterdata, $currentpage);
|
||||
$translator = new tool_customlang_translator($PAGE->url, $lng, $filterdata, $currentpage);
|
||||
|
||||
// output starts here
|
||||
$output = $PAGE->get_renderer('report_customlang');
|
||||
$paginator = $output->paging_bar($translator->numofrows, $currentpage, report_customlang_translator::PERPAGE, $PAGE->url, 'p');
|
||||
$output = $PAGE->get_renderer('tool_customlang');
|
||||
$paginator = $output->paging_bar($translator->numofrows, $currentpage, tool_customlang_translator::PERPAGE, $PAGE->url, 'p');
|
||||
|
||||
echo $output->header();
|
||||
$filter->display();
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -16,7 +15,7 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @package report
|
||||
* @package tool
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -29,51 +28,51 @@ require_once($CFG->dirroot . '/lib/formslib.php');
|
||||
/**
|
||||
* Form for filtering the strings to customize
|
||||
*/
|
||||
class report_customlang_filter_form extends moodleform {
|
||||
class tool_customlang_filter_form extends moodleform {
|
||||
|
||||
function definition() {
|
||||
$mform = $this->_form;
|
||||
$current = $this->_customdata['current'];
|
||||
|
||||
$mform->addElement('header', 'filtersettings', get_string('filter', 'report_customlang'));
|
||||
$mform->addElement('header', 'filtersettings', get_string('filter', 'tool_customlang'));
|
||||
|
||||
// Component
|
||||
$options = array();
|
||||
foreach (report_customlang_utils::list_components() as $component => $normalized) {
|
||||
foreach (tool_customlang_utils::list_components() as $component => $normalized) {
|
||||
list($type, $plugin) = normalize_component($normalized);
|
||||
if ($type == 'core' and is_null($plugin)) {
|
||||
$plugin = 'moodle';
|
||||
}
|
||||
$options[$type][$normalized] = $component.'.php';
|
||||
}
|
||||
$mform->addElement('selectgroups', 'component', get_string('filtercomponent', 'report_customlang'), $options,
|
||||
$mform->addElement('selectgroups', 'component', get_string('filtercomponent', 'tool_customlang'), $options,
|
||||
array('multiple'=>'multiple', 'size'=>7));
|
||||
|
||||
// Customized only
|
||||
$mform->addElement('advcheckbox', 'customized', get_string('filtercustomized', 'report_customlang'));
|
||||
$mform->addElement('advcheckbox', 'customized', get_string('filtercustomized', 'tool_customlang'));
|
||||
$mform->setType('customized', PARAM_BOOL);
|
||||
$mform->setDefault('customized', 0);
|
||||
|
||||
// Only helps
|
||||
$mform->addElement('advcheckbox', 'helps', get_string('filteronlyhelps', 'report_customlang'));
|
||||
$mform->addElement('advcheckbox', 'helps', get_string('filteronlyhelps', 'tool_customlang'));
|
||||
$mform->setType('helps', PARAM_BOOL);
|
||||
$mform->setDefault('helps', 0);
|
||||
|
||||
// Modified only
|
||||
$mform->addElement('advcheckbox', 'modified', get_string('filtermodified', 'report_customlang'));
|
||||
$mform->addElement('advcheckbox', 'modified', get_string('filtermodified', 'tool_customlang'));
|
||||
$mform->setType('filtermodified', PARAM_BOOL);
|
||||
$mform->setDefault('filtermodified', 0);
|
||||
|
||||
// Substring
|
||||
$mform->addElement('text', 'substring', get_string('filtersubstring', 'report_customlang'));
|
||||
$mform->addElement('text', 'substring', get_string('filtersubstring', 'tool_customlang'));
|
||||
$mform->setType('substring', PARAM_RAW);
|
||||
|
||||
// String identifier
|
||||
$mform->addElement('text', 'stringid', get_string('filterstringid', 'report_customlang'));
|
||||
$mform->addElement('text', 'stringid', get_string('filterstringid', 'tool_customlang'));
|
||||
$mform->setType('stringid', PARAM_STRINGID);
|
||||
|
||||
// Show strings - submit button
|
||||
$mform->addElement('submit', 'submit', get_string('filtershowstrings', 'report_customlang'));
|
||||
$mform->addElement('submit', 'submit', get_string('filtershowstrings', 'tool_customlang'));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -18,7 +17,7 @@
|
||||
/**
|
||||
* Performs checkout of the strings into the translation table
|
||||
*
|
||||
* @package report
|
||||
* @package tool
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -26,81 +25,81 @@
|
||||
|
||||
define('NO_OUTPUT_BUFFERING', true); // progress bar is used here
|
||||
|
||||
require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/report/customlang/locallib.php');
|
||||
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
require_login(SITEID, false);
|
||||
require_capability('report/customlang:view', get_system_context());
|
||||
require_capability('tool/customlang:view', get_system_context());
|
||||
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
$confirm = optional_param('confirm', false, PARAM_BOOL);
|
||||
$lng = optional_param('lng', '', PARAM_LANG);
|
||||
|
||||
admin_externalpage_setup('reportcustomlang');
|
||||
admin_externalpage_setup('toolcustomlang');
|
||||
$langs = get_string_manager()->get_list_of_translations();
|
||||
|
||||
// pre-output actions
|
||||
if ($action === 'checkout') {
|
||||
require_sesskey();
|
||||
require_capability('report/customlang:edit', get_system_context());
|
||||
require_capability('tool/customlang:edit', get_system_context());
|
||||
if (empty($lng)) {
|
||||
print_error('missingparameter');
|
||||
}
|
||||
|
||||
$PAGE->set_cacheable(false); // progress bar is used here
|
||||
$output = $PAGE->get_renderer('report_customlang');
|
||||
$output = $PAGE->get_renderer('tool_customlang');
|
||||
echo $output->header();
|
||||
echo $output->heading(get_string('pluginname', 'report_customlang'));
|
||||
echo $output->heading(get_string('pluginname', 'tool_customlang'));
|
||||
$progressbar = new progress_bar();
|
||||
$progressbar->create(); // prints the HTML code of the progress bar
|
||||
|
||||
// we may need a bit of extra execution time and memory here
|
||||
@set_time_limit(HOURSECS);
|
||||
raise_memory_limit(MEMORY_EXTRA);
|
||||
report_customlang_utils::checkout($lng, $progressbar);
|
||||
tool_customlang_utils::checkout($lng, $progressbar);
|
||||
|
||||
echo $output->continue_button(new moodle_url('/admin/report/customlang/edit.php', array('lng' => $lng)), 'get');
|
||||
echo $output->continue_button(new moodle_url('/admin/tool/customlang/edit.php', array('lng' => $lng)), 'get');
|
||||
echo $output->footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action === 'checkin') {
|
||||
require_sesskey();
|
||||
require_capability('report/customlang:edit', get_system_context());
|
||||
require_capability('tool/customlang:edit', get_system_context());
|
||||
if (empty($lng)) {
|
||||
print_error('missingparameter');
|
||||
}
|
||||
|
||||
if (!$confirm) {
|
||||
$output = $PAGE->get_renderer('report_customlang');
|
||||
$output = $PAGE->get_renderer('tool_customlang');
|
||||
echo $output->header();
|
||||
echo $output->heading(get_string('pluginname', 'report_customlang'));
|
||||
echo $output->heading(get_string('pluginname', 'tool_customlang'));
|
||||
echo $output->heading($langs[$lng], 3);
|
||||
$numofmodified = report_customlang_utils::get_count_of_modified($lng);
|
||||
$numofmodified = tool_customlang_utils::get_count_of_modified($lng);
|
||||
if ($numofmodified != 0) {
|
||||
echo $output->heading(get_string('modifiednum', 'report_customlang', $numofmodified), 3);
|
||||
echo $output->confirm(get_string('confirmcheckin', 'report_customlang'),
|
||||
echo $output->heading(get_string('modifiednum', 'tool_customlang', $numofmodified), 3);
|
||||
echo $output->confirm(get_string('confirmcheckin', 'tool_customlang'),
|
||||
new moodle_url($PAGE->url, array('action'=>'checkin', 'lng'=>$lng, 'confirm'=>1)),
|
||||
new moodle_url($PAGE->url, array('lng'=>$lng)));
|
||||
} else {
|
||||
echo $output->heading(get_string('modifiedno', 'report_customlang', $numofmodified), 3);
|
||||
echo $output->heading(get_string('modifiedno', 'tool_customlang', $numofmodified), 3);
|
||||
echo $output->continue_button(new moodle_url($PAGE->url, array('lng' => $lng)));
|
||||
}
|
||||
echo $output->footer();
|
||||
die();
|
||||
|
||||
} else {
|
||||
report_customlang_utils::checkin($lng);
|
||||
tool_customlang_utils::checkin($lng);
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
}
|
||||
|
||||
$output = $PAGE->get_renderer('report_customlang');
|
||||
$output = $PAGE->get_renderer('tool_customlang');
|
||||
|
||||
// output starts here
|
||||
echo $output->header();
|
||||
echo $output->heading(get_string('pluginname', 'report_customlang'));
|
||||
echo $output->heading(get_string('pluginname', 'tool_customlang'));
|
||||
|
||||
if (empty($lng)) {
|
||||
$s = new single_select($PAGE->url, 'lng', $langs);
|
||||
@ -113,27 +112,27 @@ if (empty($lng)) {
|
||||
|
||||
echo $output->heading($langs[$lng], 3);
|
||||
|
||||
$numofmodified = report_customlang_utils::get_count_of_modified($lng);
|
||||
$numofmodified = tool_customlang_utils::get_count_of_modified($lng);
|
||||
|
||||
if ($numofmodified != 0) {
|
||||
echo $output->heading(get_string('modifiednum', 'report_customlang', $numofmodified), 3);
|
||||
echo $output->heading(get_string('modifiednum', 'tool_customlang', $numofmodified), 3);
|
||||
}
|
||||
|
||||
$menu = array();
|
||||
if (has_capability('report/customlang:edit', get_system_context())) {
|
||||
if (has_capability('tool/customlang:edit', get_system_context())) {
|
||||
$menu['checkout'] = array(
|
||||
'title' => get_string('checkout', 'report_customlang'),
|
||||
'title' => get_string('checkout', 'tool_customlang'),
|
||||
'url' => new moodle_url($PAGE->url, array('action' => 'checkout', 'lng' => $lng)),
|
||||
'method' => 'post',
|
||||
);
|
||||
if ($numofmodified != 0) {
|
||||
$menu['checkin'] = array(
|
||||
'title' => get_string('checkin', 'report_customlang'),
|
||||
'title' => get_string('checkin', 'tool_customlang'),
|
||||
'url' => new moodle_url($PAGE->url, array('action' => 'checkin', 'lng' => $lng)),
|
||||
'method' => 'post',
|
||||
);
|
||||
}
|
||||
}
|
||||
echo $output->render(new report_customlang_menu($menu));
|
||||
echo $output->render(new tool_customlang_menu($menu));
|
||||
|
||||
echo $output->footer();
|
@ -16,9 +16,9 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for Language customization admin report
|
||||
* Strings for Language customization admin tool
|
||||
*
|
||||
* @package report
|
||||
* @package tool
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -16,7 +15,7 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @package report
|
||||
* @package tool
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -16,9 +15,9 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Definition of classes used by language customization admin report
|
||||
* Definition of classes used by language customization admin tool
|
||||
*
|
||||
* @package report
|
||||
* @package tool
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -31,7 +30,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*
|
||||
* All the public methods here are static ones, this class can not be instantiated
|
||||
*/
|
||||
class report_customlang_utils {
|
||||
class tool_customlang_utils {
|
||||
|
||||
/**
|
||||
* Rough number of strings that are being processed during a full checkout.
|
||||
@ -95,7 +94,7 @@ class report_customlang_utils {
|
||||
global $DB;
|
||||
|
||||
// make sure that all components are registered
|
||||
$current = $DB->get_records('report_customlang_components', null, 'name', 'name,version,id');
|
||||
$current = $DB->get_records('tool_customlang_components', null, 'name', 'name,version,id');
|
||||
foreach (self::list_components() as $component) {
|
||||
if (empty($current[$component])) {
|
||||
$record = new stdclass();
|
||||
@ -105,10 +104,10 @@ class report_customlang_utils {
|
||||
} else {
|
||||
$record->version = $version;
|
||||
}
|
||||
$DB->insert_record('report_customlang_components', $record);
|
||||
$DB->insert_record('tool_customlang_components', $record);
|
||||
} elseif ($version = get_component_version($component)) {
|
||||
if (is_null($current[$component]->version) or ($version > $current[$component]->version)) {
|
||||
$DB->set_field('report_customlang_components', 'version', $version, array('id' => $current[$component]->id));
|
||||
$DB->set_field('tool_customlang_components', 'version', $version, array('id' => $current[$component]->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,14 +115,14 @@ class report_customlang_utils {
|
||||
|
||||
// initialize the progress counter - stores the number of processed strings
|
||||
$done = 0;
|
||||
$strinprogress = get_string('checkoutinprogress', 'report_customlang');
|
||||
$strinprogress = get_string('checkoutinprogress', 'tool_customlang');
|
||||
|
||||
// reload components and fetch their strings
|
||||
$stringman = get_string_manager();
|
||||
$components = $DB->get_records('report_customlang_components');
|
||||
$components = $DB->get_records('tool_customlang_components');
|
||||
foreach ($components as $component) {
|
||||
$sql = "SELECT stringid, id, lang, componentid, original, master, local, timemodified, timecustomized, outdated, modified
|
||||
FROM {report_customlang} s
|
||||
FROM {tool_customlang} s
|
||||
WHERE lang = ? AND componentid = ?
|
||||
ORDER BY stringid";
|
||||
$current = $DB->get_records_sql($sql, array($lang, $component->id));
|
||||
@ -167,7 +166,7 @@ class report_customlang_utils {
|
||||
}
|
||||
|
||||
if ($needsupdate) {
|
||||
$DB->update_record('report_customlang', $current[$stringid]);
|
||||
$DB->update_record('tool_customlang', $current[$stringid]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -188,13 +187,13 @@ class report_customlang_utils {
|
||||
$record->timecustomized = null;
|
||||
}
|
||||
|
||||
$DB->insert_record('report_customlang', $record);
|
||||
$DB->insert_record('tool_customlang', $record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_null($progressbar)) {
|
||||
$progressbar->update_full(100, get_string('checkoutdone', 'report_customlang'));
|
||||
$progressbar->update_full(100, get_string('checkoutdone', 'tool_customlang'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,8 +212,8 @@ class report_customlang_utils {
|
||||
|
||||
// get all customized strings from updated components
|
||||
$sql = "SELECT s.*, c.name AS component
|
||||
FROM {report_customlang} s
|
||||
JOIN {report_customlang_components} c ON s.componentid = c.id
|
||||
FROM {tool_customlang} s
|
||||
JOIN {tool_customlang_components} c ON s.componentid = c.id
|
||||
WHERE s.lang = ?
|
||||
AND (s.local IS NOT NULL OR s.modified = 1)
|
||||
ORDER BY componentid, stringid";
|
||||
@ -232,7 +231,7 @@ class report_customlang_utils {
|
||||
self::dump_strings($lang, $component, $strings);
|
||||
}
|
||||
|
||||
$DB->set_field_select('report_customlang', 'modified', 0, 'lang = ?', array($lang));
|
||||
$DB->set_field_select('tool_customlang', 'modified', 0, 'lang = ?', array($lang));
|
||||
$sm = get_string_manager();
|
||||
$sm->reset_caches();
|
||||
}
|
||||
@ -359,7 +358,7 @@ EOF
|
||||
public static function get_count_of_modified($lang) {
|
||||
global $DB;
|
||||
|
||||
return $DB->count_records('report_customlang', array('lang'=>$lang, 'modified'=>1));
|
||||
return $DB->count_records('tool_customlang', array('lang'=>$lang, 'modified'=>1));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -370,12 +369,12 @@ EOF
|
||||
* @param stdclass $persistant storage object
|
||||
*/
|
||||
public static function save_filter(stdclass $data, stdclass $persistant) {
|
||||
if (!isset($persistant->report_customlang_filter)) {
|
||||
$persistant->report_customlang_filter = array();
|
||||
if (!isset($persistant->tool_customlang_filter)) {
|
||||
$persistant->tool_customlang_filter = array();
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
if ($key !== 'submit') {
|
||||
$persistant->report_customlang_filter[$key] = serialize($value);
|
||||
$persistant->tool_customlang_filter[$key] = serialize($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -389,8 +388,8 @@ EOF
|
||||
*/
|
||||
public static function load_filter(stdclass $persistant) {
|
||||
$data = new stdclass();
|
||||
if (isset($persistant->report_customlang_filter)) {
|
||||
foreach ($persistant->report_customlang_filter as $key => $value) {
|
||||
if (isset($persistant->tool_customlang_filter)) {
|
||||
foreach ($persistant->tool_customlang_filter as $key => $value) {
|
||||
$data->{$key} = unserialize($value);
|
||||
}
|
||||
}
|
||||
@ -399,9 +398,9 @@ EOF
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the action menu of the report
|
||||
* Represents the action menu of the tool
|
||||
*/
|
||||
class report_customlang_menu implements renderable {
|
||||
class tool_customlang_menu implements renderable {
|
||||
|
||||
/** @var menu items */
|
||||
protected $items = array();
|
||||
@ -449,7 +448,7 @@ class report_customlang_menu implements renderable {
|
||||
/**
|
||||
* Represents the translation tool
|
||||
*/
|
||||
class report_customlang_translator implements renderable {
|
||||
class tool_customlang_translator implements renderable {
|
||||
|
||||
/** @const int number of rows per page */
|
||||
const PERPAGE = 100;
|
||||
@ -490,8 +489,8 @@ class report_customlang_translator implements renderable {
|
||||
|
||||
$csql = "SELECT COUNT(*)";
|
||||
$fsql = "SELECT s.id, s.*, c.name AS component";
|
||||
$sql = " FROM {report_customlang_components} c
|
||||
JOIN {report_customlang} s ON s.componentid = c.id
|
||||
$sql = " FROM {tool_customlang_components} c
|
||||
JOIN {tool_customlang} s ON s.componentid = c.id
|
||||
WHERE s.lang = :lang
|
||||
AND c.name $insql";
|
||||
|
@ -14,7 +14,7 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @package report
|
||||
* @package tool
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -23,20 +23,20 @@
|
||||
/**
|
||||
* @namespace
|
||||
*/
|
||||
M.report_customlang = M.report_customlang || {};
|
||||
M.tool_customlang = M.tool_customlang || {};
|
||||
|
||||
/**
|
||||
* YUI instance holder
|
||||
*/
|
||||
M.report_customlang.Y = {};
|
||||
M.tool_customlang.Y = {};
|
||||
|
||||
/**
|
||||
* Initialize JS support for the edit.php
|
||||
*
|
||||
* @param {Object} Y YUI instance
|
||||
*/
|
||||
M.report_customlang.init_editor = function(Y) {
|
||||
M.report_customlang.Y = Y;
|
||||
M.tool_customlang.init_editor = function(Y) {
|
||||
M.tool_customlang.Y = Y;
|
||||
|
||||
Y.all('#translator .local textarea').each(function (textarea) {
|
||||
var cell = textarea.get('parentNode');
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -16,9 +15,9 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Output rendering of Language customization admin report
|
||||
* Output rendering of Language customization admin tool
|
||||
*
|
||||
* @package report
|
||||
* @package tool
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -27,16 +26,16 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Rendering methods for the report widgets
|
||||
* Rendering methods for the tool widgets
|
||||
*/
|
||||
class report_customlang_renderer extends plugin_renderer_base {
|
||||
class tool_customlang_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Renders customlang report menu
|
||||
* Renders customlang tool menu
|
||||
*
|
||||
* @return string HTML
|
||||
*/
|
||||
protected function render_report_customlang_menu(report_customlang_menu $menu) {
|
||||
protected function render_tool_customlang_menu(tool_customlang_menu $menu) {
|
||||
$output = '';
|
||||
foreach ($menu->get_items() as $item) {
|
||||
$output .= $this->single_button($item->url, $item->title, $item->method);
|
||||
@ -47,23 +46,23 @@ class report_customlang_renderer extends plugin_renderer_base {
|
||||
/**
|
||||
* Renders customlang translation table
|
||||
*
|
||||
* @param report_customlang_translator $translator
|
||||
* @param tool_customlang_translator $translator
|
||||
* @return string HTML
|
||||
*/
|
||||
protected function render_report_customlang_translator(report_customlang_translator $translator) {
|
||||
protected function render_tool_customlang_translator(tool_customlang_translator $translator) {
|
||||
$output = '';
|
||||
|
||||
if (empty($translator->strings)) {
|
||||
return $this->heading(get_string('nostringsfound', 'report_customlang'), 3);
|
||||
return $this->heading(get_string('nostringsfound', 'tool_customlang'), 3);
|
||||
}
|
||||
|
||||
$table = new html_table();
|
||||
$table->id = 'translator';
|
||||
$table->head = array(
|
||||
get_string('headingcomponent', 'report_customlang'),
|
||||
get_string('headingstringid', 'report_customlang'),
|
||||
get_string('headingstandard', 'report_customlang'),
|
||||
get_string('headinglocal', 'report_customlang'),
|
||||
get_string('headingcomponent', 'tool_customlang'),
|
||||
get_string('headingstringid', 'tool_customlang'),
|
||||
get_string('headingstandard', 'tool_customlang'),
|
||||
get_string('headinglocal', 'tool_customlang'),
|
||||
);
|
||||
|
||||
foreach ($translator->strings as $string) {
|
||||
@ -78,8 +77,8 @@ class report_customlang_renderer extends plugin_renderer_base {
|
||||
$master = html_writer::tag('div', s($string->master), array('class' => 'preformatted'));
|
||||
$minheight = strlen($string->master) / 200;
|
||||
if (preg_match('/\{\$a(->.+)?\}/', $string->master)) {
|
||||
$master .= html_writer::tag('div', $this->help_icon('placeholder', 'report_customlang',
|
||||
get_string('placeholderwarning', 'report_customlang')), array('class' => 'placeholderinfo'));
|
||||
$master .= html_writer::tag('div', $this->help_icon('placeholder', 'tool_customlang',
|
||||
get_string('placeholderwarning', 'tool_customlang')), array('class' => 'placeholderinfo'));
|
||||
}
|
||||
$cells[2] = new html_table_cell($master);
|
||||
$cells[2]->attributes['class'] = 'standard master';
|
||||
@ -93,8 +92,8 @@ class report_customlang_renderer extends plugin_renderer_base {
|
||||
if (!is_null($string->local) and $string->outdated) {
|
||||
$mark = html_writer::empty_tag('input', array('type' => 'checkbox', 'id' => 'update_' . $string->id,
|
||||
'name' => 'updates[]', 'value' => $string->id));
|
||||
$help = $this->help_icon('markinguptodate', 'report_customlang');
|
||||
$mark .= html_writer::tag('label', get_string('markuptodate', 'report_customlang') . $help,
|
||||
$help = $this->help_icon('markinguptodate', 'tool_customlang');
|
||||
$mark .= html_writer::tag('label', get_string('markuptodate', 'tool_customlang') . $help,
|
||||
array('for' => 'update_' . $string->id));
|
||||
$mark = html_writer::tag('div', $mark, array('class' => 'uptodatewrapper'));
|
||||
} else {
|
||||
@ -134,8 +133,8 @@ class report_customlang_renderer extends plugin_renderer_base {
|
||||
$output .= html_writer::start_tag('div');
|
||||
$output .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'translatorsubmitted', 'value'=>1));
|
||||
$output .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=>sesskey()));
|
||||
$save1 = html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'savecontinue', 'value'=>get_string('savecontinue', 'report_customlang')));
|
||||
$save2 = html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'savecheckin', 'value'=>get_string('savecheckin', 'report_customlang')));
|
||||
$save1 = html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'savecontinue', 'value'=>get_string('savecontinue', 'tool_customlang')));
|
||||
$save2 = html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'savecheckin', 'value'=>get_string('savecheckin', 'tool_customlang')));
|
||||
$output .= html_writer::tag('fieldset', $save1.$save2, array('class'=>'buttonsbar'));
|
||||
$output .= html_writer::table($table);
|
||||
$output .= html_writer::tag('fieldset', $save1.$save2, array('class'=>'buttonsbar'));
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -16,7 +15,7 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @package report
|
||||
* @package tool
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -24,4 +23,4 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$ADMIN->add('language', new admin_externalpage('reportcustomlang', get_string('pluginname', 'report_customlang'), "$CFG->wwwroot/$CFG->admin/report/customlang/index.php", 'report/customlang:view'));
|
||||
$ADMIN->add('language', new admin_externalpage('toolcustomlang', get_string('pluginname', 'tool_customlang'), "$CFG->wwwroot/$CFG->admin/tool/customlang/index.php", 'tool/customlang:view'));
|
69
admin/tool/customlang/styles.css
Normal file
69
admin/tool/customlang/styles.css
Normal file
@ -0,0 +1,69 @@
|
||||
.path-admin-tool-customlang .langselectorbox,
|
||||
.path-admin-tool-customlang fieldset.buttonsbar,
|
||||
.path-admin-tool-customlang .menu {
|
||||
margin: 5px auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.path-admin-tool-customlang .menu .singlebutton,
|
||||
.path-admin-tool-customlang .menu .singlebutton form,
|
||||
.path-admin-tool-customlang .menu .singlebutton form div {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
|
||||
.path-admin-tool-customlang .mform.filterform {
|
||||
width: 70%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.path-admin-tool-customlang .mform.filterform .fitem .fitemtitle {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.path-admin-tool-customlang .mform.filterform .fitem .felement {
|
||||
width: 60%;
|
||||
margin-left: 31%;
|
||||
}
|
||||
|
||||
.path-admin-tool-customlang #translator {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.path-admin-tool-customlang #translator .standard,
|
||||
.path-admin-tool-customlang #translator .local {
|
||||
min-width: 35%;
|
||||
}
|
||||
|
||||
.path-admin-tool-customlang #translator .customized {
|
||||
background-color: #e7f1c3;
|
||||
}
|
||||
|
||||
.path-admin-tool-customlang #translator .customized.outdated {
|
||||
background-color: #f3f2aa;
|
||||
}
|
||||
|
||||
.path-admin-tool-customlang #translator .modified {
|
||||
background-color: #ffd3d9;
|
||||
}
|
||||
|
||||
.path-admin-tool-customlang #translator .customized.modified {
|
||||
background-color: #d2ebff;
|
||||
}
|
||||
|
||||
.path-admin-tool-customlang #translator textarea {
|
||||
width: 100%;
|
||||
min-height: 4em;
|
||||
}
|
||||
|
||||
.path-admin-tool-customlang #translator .placeholderinfo {
|
||||
text-align: center;
|
||||
border: 1px dotted #ddd;
|
||||
background-color: #f6f6f6;
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
|
||||
#page-admin-tool-customlang-index .continuebutton {
|
||||
margin-top: 1em;
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -16,7 +15,7 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @package report
|
||||
* @package tool
|
||||
* @subpackage customlang
|
||||
* @copyright 2010 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -24,5 +23,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2011041900;
|
||||
$plugin->requires = 2010120700;
|
||||
$plugin->version = 2011092500;
|
||||
$plugin->requires = 2011092100;
|
||||
$plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage dbtransfer
|
||||
* @copyright 2011 petr Skoda
|
||||
* @copyright 2011 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011091600; // Requires this Moodle version
|
||||
$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_dbtransfer'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage generator
|
||||
* @copyright 2011 petr Skoda
|
||||
* @copyright 2011 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011091600; // Requires this Moodle version
|
||||
$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_generator'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
$maturity = MATURITY_ALPHA; // this version's maturity level
|
||||
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage health
|
||||
* @copyright 2011 petr Skoda
|
||||
* @copyright 2011 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
* Capability overview settings
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage bloglevelupgrade
|
||||
* @subpackage health
|
||||
* @copyright 2011 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
@ -19,14 +19,14 @@
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage health
|
||||
* @copyright 2011 petr Skoda
|
||||
* @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->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
$maturity = MATURITY_ALPHA; // this version's maturity level
|
||||
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage innodb
|
||||
* @copyright 2011 petr Skoda
|
||||
* @copyright 2011 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011091600; // Requires this Moodle version
|
||||
$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_innodb'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011091600; // Requires this Moodle version
|
||||
$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_langimport'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -17,7 +17,7 @@
|
||||
/**
|
||||
* Strings for component 'tool_multilangupgrade', language 'en', branch 'MOODLE_22_STABLE'
|
||||
*
|
||||
* @package report
|
||||
* @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
|
||||
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011091600; // Requires this Moodle version
|
||||
$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_multilangupgrade'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011091600; // Requires this Moodle version
|
||||
$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_profiling'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -5,17 +5,6 @@ With a lot of question attempts, doing the whole conversion on upgrade is very
|
||||
slow. The plugin can help with that in various ways.
|
||||
|
||||
|
||||
To install using git, type this command in the root of your Moodle install
|
||||
git clone git://github.com/timhunt/moodle-local_qeupgradehelper.git local/qeupgradehelper
|
||||
Then add /local/qeupgradehelper to your git ignore.
|
||||
|
||||
Alternatively, download the zip from
|
||||
https://github.com/timhunt/moodle-local_qeupgradehelper/zipball/master
|
||||
unzip it into the local folder, and then rename the new folder to qeupgradehelper.
|
||||
|
||||
|
||||
When installed in a Moodle 2.0 site:
|
||||
|
||||
1. It provies a report of how much data there is to upgrade.
|
||||
|
||||
2. It can extract test-cases from the database. This can help you report bugs
|
@ -19,17 +19,18 @@
|
||||
* Question engine upgrade helper library code that relies on other parts of the
|
||||
* new question engine code.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
require_once($CFG->dirroot . '/question/engine/upgrade/upgradelib.php');
|
||||
|
||||
|
||||
class local_qeupgradehelper_attempt_upgrader extends question_engine_attempt_upgrader {
|
||||
class tool_qeupgradehelper_attempt_upgrader extends question_engine_attempt_upgrader {
|
||||
public $quizid;
|
||||
public $attemptsdone = 0;
|
||||
public $attemptstodo;
|
||||
@ -62,7 +63,7 @@ class local_qeupgradehelper_attempt_upgrader extends question_engine_attempt_upg
|
||||
$a->done = $done;
|
||||
$a->outof = $outof;
|
||||
$this->progressbar->update($done, $outof,
|
||||
get_string('resettingquizattemptsprogress', 'local_qeupgradehelper', $a));
|
||||
get_string('resettingquizattemptsprogress', 'tool_qeupgradehelper', $a));
|
||||
}
|
||||
|
||||
protected function get_resettable_attempts($quiz) {
|
@ -17,14 +17,14 @@
|
||||
/**
|
||||
* Script to upgrade the attempts at a particular quiz, after confirmation.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2010 The Open University
|
||||
* @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(dirname(__FILE__) . '/locallib.php');
|
||||
require_once(dirname(__FILE__) . '/afterupgradelib.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
@ -34,20 +34,20 @@ $confirmed = optional_param('confirmed', false, PARAM_BOOL);
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
local_qeupgradehelper_require_upgraded();
|
||||
tool_qeupgradehelper_require_upgraded();
|
||||
|
||||
admin_externalpage_setup('qeupgradehelper', '', array(),
|
||||
local_qeupgradehelper_url('convertquiz', array('quizid' => $quizid)));
|
||||
$PAGE->navbar->add(get_string('listtodo', 'local_qeupgradehelper'),
|
||||
local_qeupgradehelper_url('listtodo'));
|
||||
$PAGE->navbar->add(get_string('convertattempts', 'local_qeupgradehelper'));
|
||||
tool_qeupgradehelper_url('convertquiz', array('quizid' => $quizid)));
|
||||
$PAGE->navbar->add(get_string('listtodo', 'tool_qeupgradehelper'),
|
||||
tool_qeupgradehelper_url('listtodo'));
|
||||
$PAGE->navbar->add(get_string('convertattempts', 'tool_qeupgradehelper'));
|
||||
|
||||
$renderer = $PAGE->get_renderer('local_qeupgradehelper');
|
||||
$renderer = $PAGE->get_renderer('tool_qeupgradehelper');
|
||||
|
||||
$quizsummary = local_qeupgradehelper_get_quiz($quizid);
|
||||
$quizsummary = tool_qeupgradehelper_get_quiz($quizid);
|
||||
if (!$quizsummary) {
|
||||
print_error('invalidquizid', 'local_qeupgradehelper',
|
||||
local_qeupgradehelper_url('listtodo'));
|
||||
print_error('invalidquizid', 'tool_qeupgradehelper',
|
||||
tool_qeupgradehelper_url('listtodo'));
|
||||
}
|
||||
|
||||
$quizsummary->name = format_string($quizsummary->name);
|
||||
@ -56,18 +56,18 @@ if ($confirmed && data_submitted() && confirm_sesskey()) {
|
||||
// Actually do the conversion.
|
||||
echo $renderer->header();
|
||||
echo $renderer->heading(get_string(
|
||||
'upgradingquizattempts', 'local_qeupgradehelper', $quizsummary));
|
||||
'upgradingquizattempts', 'tool_qeupgradehelper', $quizsummary));
|
||||
|
||||
$upgrader = new local_qeupgradehelper_attempt_upgrader(
|
||||
$upgrader = new tool_qeupgradehelper_attempt_upgrader(
|
||||
$quizsummary->id, $quizsummary->numtoconvert);
|
||||
$upgrader->convert_all_quiz_attempts();
|
||||
|
||||
echo $renderer->heading(get_string('conversioncomplete', 'local_qeupgradehelper'));
|
||||
echo $renderer->heading(get_string('conversioncomplete', 'tool_qeupgradehelper'));
|
||||
echo $renderer->end_of_page_link(
|
||||
new moodle_url('/mod/quiz/report.php', array('q' => $quizsummary->id)),
|
||||
get_string('gotoquizreport', 'local_qeupgradehelper'));
|
||||
echo $renderer->end_of_page_link(local_qeupgradehelper_url('listtodo'),
|
||||
get_string('listtodo', 'local_qeupgradehelper'));
|
||||
get_string('gotoquizreport', 'tool_qeupgradehelper'));
|
||||
echo $renderer->end_of_page_link(tool_qeupgradehelper_url('listtodo'),
|
||||
get_string('listtodo', 'tool_qeupgradehelper'));
|
||||
|
||||
echo $renderer->footer();
|
||||
exit;
|
@ -17,14 +17,14 @@
|
||||
/**
|
||||
* Script to set up cron to complete the upgrade automatically.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2010 The Open University
|
||||
* @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(dirname(__FILE__) . '/locallib.php');
|
||||
require_once(dirname(__FILE__) . '/cronsetup_form.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
@ -33,37 +33,37 @@ require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
admin_externalpage_setup('qeupgradehelper', '', array(),
|
||||
local_qeupgradehelper_url('cronsetup'));
|
||||
$PAGE->navbar->add(get_string('cronsetup', 'local_qeupgradehelper'));
|
||||
tool_qeupgradehelper_url('cronsetup'));
|
||||
$PAGE->navbar->add(get_string('cronsetup', 'tool_qeupgradehelper'));
|
||||
|
||||
$renderer = $PAGE->get_renderer('local_qeupgradehelper');
|
||||
$renderer = $PAGE->get_renderer('tool_qeupgradehelper');
|
||||
|
||||
$form = new local_qeupgradehelper_cron_setup_form(
|
||||
new moodle_url('/local/qeupgradehelper/cronsetup.php'));
|
||||
$form->set_data(get_config('local_qeupgradehelper'));
|
||||
$form = new tool_qeupgradehelper_cron_setup_form(
|
||||
new moodle_url('/admin/tool/qeupgradehelper/cronsetup.php'));
|
||||
$form->set_data(get_config('tool_qeupgradehelper'));
|
||||
|
||||
if ($form->is_cancelled()) {
|
||||
redirect(local_qeupgradehelper_url('index'));
|
||||
redirect(tool_qeupgradehelper_url('index'));
|
||||
|
||||
} else if ($fromform = $form->get_data()) {
|
||||
if ($fromform->cronenabled) {
|
||||
set_config('cronenabled', $fromform->cronenabled, 'local_qeupgradehelper');
|
||||
set_config('starthour', $fromform->starthour, 'local_qeupgradehelper');
|
||||
set_config('stophour', $fromform->stophour, 'local_qeupgradehelper');
|
||||
set_config('procesingtime', $fromform->procesingtime, 'local_qeupgradehelper');
|
||||
set_config('cronenabled', $fromform->cronenabled, 'tool_qeupgradehelper');
|
||||
set_config('starthour', $fromform->starthour, 'tool_qeupgradehelper');
|
||||
set_config('stophour', $fromform->stophour, 'tool_qeupgradehelper');
|
||||
set_config('procesingtime', $fromform->procesingtime, 'tool_qeupgradehelper');
|
||||
|
||||
} else {
|
||||
unset_config('cronenabled', 'local_qeupgradehelper');
|
||||
unset_config('starthour', 'local_qeupgradehelper');
|
||||
unset_config('stophour', 'local_qeupgradehelper');
|
||||
unset_config('procesingtime', 'local_qeupgradehelper');
|
||||
unset_config('cronenabled', 'tool_qeupgradehelper');
|
||||
unset_config('starthour', 'tool_qeupgradehelper');
|
||||
unset_config('stophour', 'tool_qeupgradehelper');
|
||||
unset_config('procesingtime', 'tool_qeupgradehelper');
|
||||
}
|
||||
redirect(local_qeupgradehelper_url('index'));
|
||||
redirect(tool_qeupgradehelper_url('index'));
|
||||
|
||||
}
|
||||
|
||||
echo $renderer->header();
|
||||
echo $renderer->heading(get_string('cronsetup', 'local_qeupgradehelper'));
|
||||
echo $renderer->box(get_string('croninstructions', 'local_qeupgradehelper'));
|
||||
echo $renderer->heading(get_string('cronsetup', 'tool_qeupgradehelper'));
|
||||
echo $renderer->box(get_string('croninstructions', 'tool_qeupgradehelper'));
|
||||
$form->display();
|
||||
echo $renderer->footer();
|
@ -17,7 +17,7 @@
|
||||
/**
|
||||
* Settings form for cronsetup.php.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2011 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -34,23 +34,23 @@ require_once($CFG->libdir . '/formslib.php');
|
||||
* @copyright 2011 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class local_qeupgradehelper_cron_setup_form extends moodleform {
|
||||
class tool_qeupgradehelper_cron_setup_form extends moodleform {
|
||||
public function definition() {
|
||||
$mform = $this->_form;
|
||||
|
||||
$mform->addElement('selectyesno', 'cronenabled',
|
||||
get_string('cronenabled', 'local_qeupgradehelper'));
|
||||
get_string('cronenabled', 'tool_qeupgradehelper'));
|
||||
|
||||
$mform->addElement('select', 'starthour',
|
||||
get_string('cronstarthour', 'local_qeupgradehelper'), range(0, 23));
|
||||
get_string('cronstarthour', 'tool_qeupgradehelper'), range(0, 23));
|
||||
|
||||
$mform->addElement('select', 'stophour',
|
||||
get_string('cronstophour', 'local_qeupgradehelper'),
|
||||
get_string('cronstophour', 'tool_qeupgradehelper'),
|
||||
array_combine(range(1, 24), range(1, 24)));
|
||||
$mform->setDefault('stophour', 24);
|
||||
|
||||
$mform->addElement('duration', 'procesingtime',
|
||||
get_string('cronprocesingtime', 'local_qeupgradehelper'));
|
||||
get_string('cronprocesingtime', 'tool_qeupgradehelper'));
|
||||
$mform->setDefault('procesingtime', 60);
|
||||
|
||||
$mform->disabledIf('starthour', 'cronenabled', 'eq', 0);
|
38
admin/tool/qeupgradehelper/db/install.php
Normal file
38
admin/tool/qeupgradehelper/db/install.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?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 qeupgradehelper
|
||||
* @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_qeupgradehelper_install() {
|
||||
global $CFG;
|
||||
|
||||
// this is a hack - this plugin used to live in local/qeupgradehelper,
|
||||
// we want to remove the orphaned version info and capability
|
||||
// unless there is a local plugin type with the same name
|
||||
|
||||
if (!file_exists("$CFG->dirroot/local/qeupgradehelper")) {
|
||||
unset_all_config_for_plugin('local_qeupgradehelper');
|
||||
}
|
||||
}
|
@ -22,14 +22,14 @@
|
||||
* database from backup, and then use this script to extract the problem case
|
||||
* as a unit test. Then you can fix that unit tests. Then you can repeat the upgrade.)
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2009 The Open University
|
||||
* @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(dirname(__FILE__) . '/locallib.php');
|
||||
require_once(dirname(__FILE__) . '/extracttestcase_form.php');
|
||||
require_once($CFG->libdir . '/questionlib.php');
|
||||
@ -40,31 +40,31 @@ require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
admin_externalpage_setup('qeupgradehelper', '', array(),
|
||||
local_qeupgradehelper_url('extracttestcase'));
|
||||
$PAGE->navbar->add(get_string('extracttestcase', 'local_qeupgradehelper'));
|
||||
tool_qeupgradehelper_url('extracttestcase'));
|
||||
$PAGE->navbar->add(get_string('extracttestcase', 'tool_qeupgradehelper'));
|
||||
|
||||
$renderer = $PAGE->get_renderer('local_qeupgradehelper');
|
||||
$renderer = $PAGE->get_renderer('tool_qeupgradehelper');
|
||||
|
||||
$mform = new local_qeupgradehelper_extract_options_form(
|
||||
new moodle_url('/local/qeupgradehelper/extracttestcase.php'), null, 'get');
|
||||
$mform = new tool_qeupgradehelper_extract_options_form(
|
||||
new moodle_url('/admin/tool/qeupgradehelper/extracttestcase.php'), null, 'get');
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if ($fromform = $mform->get_data()) {
|
||||
$qsid = null;
|
||||
if (!empty($fromform->attemptid) && !empty($fromform->questionid)) {
|
||||
$qsid = local_qeupgradehelper_get_session_id($fromform->attemptid, $fromform->questionid);
|
||||
$qsid = tool_qeupgradehelper_get_session_id($fromform->attemptid, $fromform->questionid);
|
||||
$name = 'qsession' . $qsid;
|
||||
|
||||
} else if (!empty($fromform->statehistory)) {
|
||||
notify('Searching ...', 'notifysuccess');
|
||||
flush();
|
||||
$qsid = local_qeupgradehelper_find_test_case($fromform->behaviour, $fromform->statehistory,
|
||||
$qsid = tool_qeupgradehelper_find_test_case($fromform->behaviour, $fromform->statehistory,
|
||||
$fromform->qtype, $fromform->extratests);
|
||||
$name = 'history' . $fromform->statehistory;
|
||||
}
|
||||
|
||||
if ($qsid) {
|
||||
local_qeupgradehelper_generate_unit_test($qsid, $name);
|
||||
tool_qeupgradehelper_generate_unit_test($qsid, $name);
|
||||
} else {
|
||||
notify('No suitable attempts found.');
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
/**
|
||||
* Settings form for extracttestcase.php.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -34,7 +34,7 @@ require_once($CFG->libdir . '/formslib.php');
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class local_qeupgradehelper_extract_options_form extends moodleform {
|
||||
class tool_qeupgradehelper_extract_options_form extends moodleform {
|
||||
public function definition() {
|
||||
$mform = $this->_form;
|
||||
|
@ -21,13 +21,13 @@
|
||||
* This screen is the main entry-point to the plugin, it gives the admin a list
|
||||
* of options available to them.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2010 The Open University
|
||||
* @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(dirname(__FILE__) . '/locallib.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
|
||||
@ -35,21 +35,21 @@ require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
admin_externalpage_setup('qeupgradehelper');
|
||||
|
||||
$renderer = $PAGE->get_renderer('local_qeupgradehelper');
|
||||
$renderer = $PAGE->get_renderer('tool_qeupgradehelper');
|
||||
|
||||
$actions = array();
|
||||
if (local_qeupgradehelper_is_upgraded()) {
|
||||
$detected = get_string('upgradedsitedetected', 'local_qeupgradehelper');
|
||||
$actions[] = local_qeupgradehelper_action::make('listtodo');
|
||||
$actions[] = local_qeupgradehelper_action::make('listupgraded');
|
||||
$actions[] = local_qeupgradehelper_action::make('extracttestcase');
|
||||
$actions[] = local_qeupgradehelper_action::make('cronsetup');
|
||||
if (tool_qeupgradehelper_is_upgraded()) {
|
||||
$detected = get_string('upgradedsitedetected', 'tool_qeupgradehelper');
|
||||
$actions[] = tool_qeupgradehelper_action::make('listtodo');
|
||||
$actions[] = tool_qeupgradehelper_action::make('listupgraded');
|
||||
$actions[] = tool_qeupgradehelper_action::make('extracttestcase');
|
||||
$actions[] = tool_qeupgradehelper_action::make('cronsetup');
|
||||
|
||||
} else {
|
||||
$detected = get_string('oldsitedetected', 'local_qeupgradehelper');
|
||||
$actions[] = local_qeupgradehelper_action::make('listpreupgrade');
|
||||
$actions[] = local_qeupgradehelper_action::make('extracttestcase');
|
||||
$actions[] = local_qeupgradehelper_action::make('cronsetup');
|
||||
$detected = get_string('oldsitedetected', 'tool_qeupgradehelper');
|
||||
$actions[] = tool_qeupgradehelper_action::make('listpreupgrade');
|
||||
$actions[] = tool_qeupgradehelper_action::make('extracttestcase');
|
||||
$actions[] = tool_qeupgradehelper_action::make('cronsetup');
|
||||
}
|
||||
|
||||
echo $renderer->index_page($detected, $actions);
|
@ -17,7 +17,7 @@
|
||||
/**
|
||||
* Question engine upgrade helper langauge strings.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -19,39 +18,41 @@
|
||||
* Lib functions (cron) to automatically complete the question engine upgrade
|
||||
* if it was not done all at once during the main upgrade.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2011 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
/**
|
||||
* Standard cron function
|
||||
*/
|
||||
function local_qeupgradehelper_cron() {
|
||||
$settings = get_config('local_qeupgradehelper');
|
||||
function tool_qeupgradehelper_cron() {
|
||||
$settings = get_config('tool_qeupgradehelper');
|
||||
if (empty($settings->cronenabled)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mtrace('qeupgradehelper: local_qeupgradehelper_cron() started at '. date('H:i:s'));
|
||||
mtrace('qeupgradehelper: tool_qeupgradehelper_cron() started at '. date('H:i:s'));
|
||||
try {
|
||||
local_qeupgradehelper_process($settings);
|
||||
tool_qeupgradehelper_process($settings);
|
||||
} catch (Exception $e) {
|
||||
mtrace('qeupgradehelper: local_qeupgradehelper_cron() failed with an exception:');
|
||||
mtrace('qeupgradehelper: tool_qeupgradehelper_cron() failed with an exception:');
|
||||
mtrace($e->getMessage());
|
||||
}
|
||||
mtrace('qeupgradehelper: local_qeupgradehelper_cron() finished at ' . date('H:i:s'));
|
||||
mtrace('qeupgradehelper: tool_qeupgradehelper_cron() finished at ' . date('H:i:s'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function does the cron process within the time range according to settings.
|
||||
*/
|
||||
function local_qeupgradehelper_process($settings) {
|
||||
function tool_qeupgradehelper_process($settings) {
|
||||
global $CFG;
|
||||
require_once(dirname(__FILE__) . '/locallib.php');
|
||||
|
||||
if (!local_qeupgradehelper_is_upgraded()) {
|
||||
if (!tool_qeupgradehelper_is_upgraded()) {
|
||||
mtrace('qeupgradehelper: site not yet upgraded. Doing nothing.');
|
||||
return;
|
||||
}
|
||||
@ -70,17 +71,17 @@ function local_qeupgradehelper_process($settings) {
|
||||
mtrace('qeupgradehelper: processing ...');
|
||||
while (time() < $stoptime) {
|
||||
|
||||
$quiz = local_qeupgradehelper_get_quiz_for_upgrade();
|
||||
$quiz = tool_qeupgradehelper_get_quiz_for_upgrade();
|
||||
if (!$quiz) {
|
||||
mtrace('qeupgradehelper: No more quizzes to process. You should probably disable the qeupgradehelper cron settings now.');
|
||||
break; // No more to do;
|
||||
}
|
||||
|
||||
$quizid = $quiz->id;
|
||||
$quizsummary = local_qeupgradehelper_get_quiz($quizid);
|
||||
$quizsummary = tool_qeupgradehelper_get_quiz($quizid);
|
||||
if ($quizsummary) {
|
||||
mtrace(' starting upgrade of attempts at quiz ' . $quizid);
|
||||
$upgrader = new local_qeupgradehelper_attempt_upgrader(
|
||||
$upgrader = new tool_qeupgradehelper_attempt_upgrader(
|
||||
$quizsummary->id, $quizsummary->numtoconvert);
|
||||
$upgrader->convert_all_quiz_attempts();
|
||||
mtrace(' upgrade of quiz ' . $quizid . ' complete.');
|
@ -18,43 +18,43 @@
|
||||
* Script to show all the quizzes in the site with how many attempts they have
|
||||
* that will need to be upgraded.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2010 The Open University
|
||||
* @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(dirname(__FILE__) . '/locallib.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
local_qeupgradehelper_require_not_upgraded();
|
||||
tool_qeupgradehelper_require_not_upgraded();
|
||||
|
||||
admin_externalpage_setup('qeupgradehelper', '', array(), local_qeupgradehelper_url(''));
|
||||
$PAGE->navbar->add(get_string('listpreupgrade', 'local_qeupgradehelper'));
|
||||
admin_externalpage_setup('qeupgradehelper', '', array(), tool_qeupgradehelper_url(''));
|
||||
$PAGE->navbar->add(get_string('listpreupgrade', 'tool_qeupgradehelper'));
|
||||
|
||||
$renderer = $PAGE->get_renderer('local_qeupgradehelper');
|
||||
$renderer = $PAGE->get_renderer('tool_qeupgradehelper');
|
||||
|
||||
$quizzes = new local_qeupgradehelper_pre_upgrade_quiz_list();
|
||||
$quizzes = new tool_qeupgradehelper_pre_upgrade_quiz_list();
|
||||
|
||||
// Look to see if the admin has set things up to only upgrade certain attempts.
|
||||
$partialupgradefile = $CFG->dirroot . '/local/qeupgradehelper/partialupgrade.php';
|
||||
$partialupgradefunction = 'local_qeupgradehelper_get_quizzes_to_upgrade';
|
||||
$partialupgradefile = $CFG->dirroot . '/' . $CFG->admin . '/tool/qeupgradehelper/partialupgrade.php';
|
||||
$partialupgradefunction = 'tool_qeupgradehelper_get_quizzes_to_upgrade';
|
||||
if (is_readable($partialupgradefile)) {
|
||||
include_once($partialupgradefile);
|
||||
if (function_exists($partialupgradefunction)) {
|
||||
$quizzes = new local_qeupgradehelper_pre_upgrade_quiz_list_restricted(
|
||||
$quizzes = new tool_qeupgradehelper_pre_upgrade_quiz_list_restricted(
|
||||
$partialupgradefunction());
|
||||
}
|
||||
}
|
||||
|
||||
$numveryoldattemtps = local_qeupgradehelper_get_num_very_old_attempts();
|
||||
$numveryoldattemtps = tool_qeupgradehelper_get_num_very_old_attempts();
|
||||
|
||||
if ($quizzes->is_empty()) {
|
||||
echo $renderer->simple_message_page(get_string('noquizattempts', 'local_qeupgradehelper'));
|
||||
echo $renderer->simple_message_page(get_string('noquizattempts', 'tool_qeupgradehelper'));
|
||||
|
||||
} else {
|
||||
echo $renderer->quiz_list_page($quizzes, $numveryoldattemtps);
|
@ -18,31 +18,31 @@
|
||||
* Script to show all the quizzes with attempts that still need to be upgraded
|
||||
* after the main upgrade.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2010 The Open University
|
||||
* @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(dirname(__FILE__) . '/locallib.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
local_qeupgradehelper_require_upgraded();
|
||||
tool_qeupgradehelper_require_upgraded();
|
||||
|
||||
admin_externalpage_setup('qeupgradehelper', '', array(),
|
||||
local_qeupgradehelper_url('listtodo'));
|
||||
$PAGE->navbar->add(get_string('listtodo', 'local_qeupgradehelper'));
|
||||
tool_qeupgradehelper_url('listtodo'));
|
||||
$PAGE->navbar->add(get_string('listtodo', 'tool_qeupgradehelper'));
|
||||
|
||||
$renderer = $PAGE->get_renderer('local_qeupgradehelper');
|
||||
$renderer = $PAGE->get_renderer('tool_qeupgradehelper');
|
||||
|
||||
$quizzes = new local_qeupgradehelper_upgradable_quiz_list();
|
||||
$quizzes = new tool_qeupgradehelper_upgradable_quiz_list();
|
||||
|
||||
if ($quizzes->is_empty()) {
|
||||
echo $renderer->simple_message_page(get_string('alreadydone', 'local_qeupgradehelper'));
|
||||
echo $renderer->simple_message_page(get_string('alreadydone', 'tool_qeupgradehelper'));
|
||||
|
||||
} else {
|
||||
echo $renderer->quiz_list_page($quizzes);
|
@ -19,31 +19,31 @@
|
||||
* after the main upgrade. With an option to reset the conversion, so it can be
|
||||
* re-done if necessary.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2010 The Open University
|
||||
* @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(dirname(__FILE__) . '/locallib.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
local_qeupgradehelper_require_upgraded();
|
||||
tool_qeupgradehelper_require_upgraded();
|
||||
|
||||
admin_externalpage_setup('qeupgradehelper', '', array(),
|
||||
local_qeupgradehelper_url('listupgraded'));
|
||||
$PAGE->navbar->add(get_string('listupgraded', 'local_qeupgradehelper'));
|
||||
tool_qeupgradehelper_url('listupgraded'));
|
||||
$PAGE->navbar->add(get_string('listupgraded', 'tool_qeupgradehelper'));
|
||||
|
||||
$renderer = $PAGE->get_renderer('local_qeupgradehelper');
|
||||
$renderer = $PAGE->get_renderer('tool_qeupgradehelper');
|
||||
|
||||
$quizzes = new local_qeupgradehelper_resettable_quiz_list();
|
||||
$quizzes = new tool_qeupgradehelper_resettable_quiz_list();
|
||||
|
||||
if ($quizzes->is_empty()) {
|
||||
echo $renderer->simple_message_page(get_string('nothingupgradedyet', 'local_qeupgradehelper'));
|
||||
echo $renderer->simple_message_page(get_string('nothingupgradedyet', 'tool_qeupgradehelper'));
|
||||
|
||||
} else {
|
||||
echo $renderer->quiz_list_page($quizzes);
|
@ -17,7 +17,7 @@
|
||||
/**
|
||||
* Question engine upgrade helper library code.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* Detect whether this site has been upgraded to the new question engine yet.
|
||||
* @return bool whether the site has been upgraded.
|
||||
*/
|
||||
function local_qeupgradehelper_is_upgraded() {
|
||||
function tool_qeupgradehelper_is_upgraded() {
|
||||
global $CFG, $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
return is_readable($CFG->dirroot . '/question/engine/upgrade/upgradelib.php') &&
|
||||
@ -41,20 +41,20 @@ function local_qeupgradehelper_is_upgraded() {
|
||||
/**
|
||||
* If the site has not yet been upgraded, display an error.
|
||||
*/
|
||||
function local_qeupgradehelper_require_upgraded() {
|
||||
if (!local_qeupgradehelper_is_upgraded()) {
|
||||
throw new moodle_exception('upgradedsiterequired', 'local_qeupgradehelper',
|
||||
local_qeupgradehelper_url('index'));
|
||||
function tool_qeupgradehelper_require_upgraded() {
|
||||
if (!tool_qeupgradehelper_is_upgraded()) {
|
||||
throw new moodle_exception('upgradedsiterequired', 'tool_qeupgradehelper',
|
||||
tool_qeupgradehelper_url('index'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the site has been upgraded, display an error.
|
||||
*/
|
||||
function local_qeupgradehelper_require_not_upgraded() {
|
||||
if (local_qeupgradehelper_is_upgraded()) {
|
||||
throw new moodle_exception('notupgradedsiterequired', 'local_qeupgradehelper',
|
||||
local_qeupgradehelper_url('index'));
|
||||
function tool_qeupgradehelper_require_not_upgraded() {
|
||||
if (tool_qeupgradehelper_is_upgraded()) {
|
||||
throw new moodle_exception('notupgradedsiterequired', 'tool_qeupgradehelper',
|
||||
tool_qeupgradehelper_url('index'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,8 +63,8 @@ function local_qeupgradehelper_require_not_upgraded() {
|
||||
* @param string $script the script name, without .php. E.g. 'index'.
|
||||
* @param array $params URL parameters (optional).
|
||||
*/
|
||||
function local_qeupgradehelper_url($script, $params = array()) {
|
||||
return new moodle_url('/local/qeupgradehelper/' . $script . '.php', $params);
|
||||
function tool_qeupgradehelper_url($script, $params = array()) {
|
||||
return new moodle_url('/admin/tool/qeupgradehelper/' . $script . '.php', $params);
|
||||
}
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ function local_qeupgradehelper_url($script, $params = array()) {
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class local_qeupgradehelper_action {
|
||||
class tool_qeupgradehelper_action {
|
||||
/** @var string the name of this action. */
|
||||
public $name;
|
||||
/** @var moodle_url the URL to launch this action. */
|
||||
@ -99,9 +99,9 @@ class local_qeupgradehelper_action {
|
||||
*/
|
||||
public static function make($shortname, $params = array()) {
|
||||
return new self(
|
||||
get_string($shortname, 'local_qeupgradehelper'),
|
||||
local_qeupgradehelper_url($shortname, $params),
|
||||
get_string($shortname . '_desc', 'local_qeupgradehelper'));
|
||||
get_string($shortname, 'tool_qeupgradehelper'),
|
||||
tool_qeupgradehelper_url($shortname, $params),
|
||||
get_string($shortname . '_desc', 'tool_qeupgradehelper'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ class local_qeupgradehelper_action {
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class local_qeupgradehelper_quiz_list {
|
||||
abstract class tool_qeupgradehelper_quiz_list {
|
||||
public $title;
|
||||
public $intro;
|
||||
public $quizacolheader;
|
||||
@ -124,9 +124,9 @@ abstract class local_qeupgradehelper_quiz_list {
|
||||
|
||||
protected function __construct($title, $intro, $quizacolheader) {
|
||||
global $DB;
|
||||
$this->title = get_string($title, 'local_qeupgradehelper');
|
||||
$this->intro = get_string($intro, 'local_qeupgradehelper');
|
||||
$this->quizacolheader = get_string($quizacolheader, 'local_qeupgradehelper');
|
||||
$this->title = get_string($title, 'tool_qeupgradehelper');
|
||||
$this->intro = get_string($intro, 'tool_qeupgradehelper');
|
||||
$this->quizacolheader = get_string($quizacolheader, 'tool_qeupgradehelper');
|
||||
$this->build_sql();
|
||||
$this->quizlist = $DB->get_records_sql($this->sql);
|
||||
}
|
||||
@ -162,11 +162,11 @@ abstract class local_qeupgradehelper_quiz_list {
|
||||
|
||||
public function get_col_headings() {
|
||||
return array(
|
||||
get_string('quizid', 'local_qeupgradehelper'),
|
||||
get_string('quizid', 'tool_qeupgradehelper'),
|
||||
get_string('course'),
|
||||
get_string('pluginname', 'quiz'),
|
||||
$this->quizacolheader,
|
||||
get_string('questionsessions', 'local_qeupgradehelper'),
|
||||
get_string('questionsessions', 'tool_qeupgradehelper'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ abstract class local_qeupgradehelper_quiz_list {
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class local_qeupgradehelper_upgradable_quiz_list extends local_qeupgradehelper_quiz_list {
|
||||
class tool_qeupgradehelper_upgradable_quiz_list extends tool_qeupgradehelper_quiz_list {
|
||||
public function __construct() {
|
||||
parent::__construct('quizzeswithunconverted', 'listtodointro', 'attemptstoconvert');
|
||||
}
|
||||
@ -221,14 +221,14 @@ class local_qeupgradehelper_upgradable_quiz_list extends local_qeupgradehelper_q
|
||||
|
||||
public function get_col_headings() {
|
||||
$headings = parent::get_col_headings();
|
||||
$headings[] = get_string('action', 'local_qeupgradehelper');
|
||||
$headings[] = get_string('action', 'tool_qeupgradehelper');
|
||||
return $headings;
|
||||
}
|
||||
|
||||
public function get_row($quizinfo) {
|
||||
$row = parent::get_row($quizinfo);
|
||||
$row[] = html_writer::link(local_qeupgradehelper_url('convertquiz', array('quizid' => $quizinfo->id)),
|
||||
get_string('convertquiz', 'local_qeupgradehelper'));
|
||||
$row[] = html_writer::link(tool_qeupgradehelper_url('convertquiz', array('quizid' => $quizinfo->id)),
|
||||
get_string('convertquiz', 'tool_qeupgradehelper'));
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
@ -240,7 +240,7 @@ class local_qeupgradehelper_upgradable_quiz_list extends local_qeupgradehelper_q
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class local_qeupgradehelper_resettable_quiz_list extends local_qeupgradehelper_quiz_list {
|
||||
class tool_qeupgradehelper_resettable_quiz_list extends tool_qeupgradehelper_quiz_list {
|
||||
public function __construct() {
|
||||
parent::__construct('quizzesthatcanbereset', 'listupgradedintro', 'convertedattempts');
|
||||
}
|
||||
@ -253,14 +253,14 @@ class local_qeupgradehelper_resettable_quiz_list extends local_qeupgradehelper_q
|
||||
|
||||
public function get_col_headings() {
|
||||
$headings = parent::get_col_headings();
|
||||
$headings[] = get_string('action', 'local_qeupgradehelper');
|
||||
$headings[] = get_string('action', 'tool_qeupgradehelper');
|
||||
return $headings;
|
||||
}
|
||||
|
||||
public function get_row($quizinfo) {
|
||||
$row = parent::get_row($quizinfo);
|
||||
$row[] = html_writer::link(local_qeupgradehelper_url('resetquiz', array('quizid' => $quizinfo->id)),
|
||||
get_string('resetquiz', 'local_qeupgradehelper'));
|
||||
$row[] = html_writer::link(tool_qeupgradehelper_url('resetquiz', array('quizid' => $quizinfo->id)),
|
||||
get_string('resetquiz', 'tool_qeupgradehelper'));
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
@ -272,7 +272,7 @@ class local_qeupgradehelper_resettable_quiz_list extends local_qeupgradehelper_q
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class local_qeupgradehelper_pre_upgrade_quiz_list extends local_qeupgradehelper_quiz_list {
|
||||
class tool_qeupgradehelper_pre_upgrade_quiz_list extends tool_qeupgradehelper_quiz_list {
|
||||
public function __construct() {
|
||||
parent::__construct('quizzestobeupgraded', 'listpreupgradeintro', 'numberofattempts');
|
||||
}
|
||||
@ -290,7 +290,7 @@ class local_qeupgradehelper_pre_upgrade_quiz_list extends local_qeupgradehelper_
|
||||
* @copyright 2011 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class local_qeupgradehelper_pre_upgrade_quiz_list_restricted extends local_qeupgradehelper_pre_upgrade_quiz_list {
|
||||
class tool_qeupgradehelper_pre_upgrade_quiz_list_restricted extends tool_qeupgradehelper_pre_upgrade_quiz_list {
|
||||
protected $quizids;
|
||||
protected $restrictedtotalquizas = 0;
|
||||
protected $restrictedtotalqas = 0;
|
||||
@ -310,7 +310,7 @@ class local_qeupgradehelper_pre_upgrade_quiz_list_restricted extends local_qeupg
|
||||
|
||||
public function get_col_headings() {
|
||||
$headings = parent::get_col_headings();
|
||||
$headings[] = get_string('includedintheupgrade', 'local_qeupgradehelper');
|
||||
$headings[] = get_string('includedintheupgrade', 'tool_qeupgradehelper');
|
||||
return $headings;
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ class local_qeupgradehelper_pre_upgrade_quiz_list_restricted extends local_qeupg
|
||||
$a = new stdClass();
|
||||
$a->some = $a->some = html_writer::tag('b', $restrictedtotal);
|
||||
$a->total = $fulltotal;
|
||||
return get_string('outof', 'local_qeupgradehelper', $a);
|
||||
return get_string('outof', 'tool_qeupgradehelper', $a);
|
||||
}
|
||||
|
||||
public function get_total_row() {
|
||||
@ -349,7 +349,7 @@ class local_qeupgradehelper_pre_upgrade_quiz_list_restricted extends local_qeupg
|
||||
* List the number of quiz attempts that were never upgraded from 1.4 -> 1.5.
|
||||
* @return int the number of such attempts.
|
||||
*/
|
||||
function local_qeupgradehelper_get_num_very_old_attempts() {
|
||||
function tool_qeupgradehelper_get_num_very_old_attempts() {
|
||||
global $DB;
|
||||
return $DB->count_records_sql('
|
||||
SELECT COUNT(1)
|
||||
@ -366,9 +366,9 @@ function local_qeupgradehelper_get_num_very_old_attempts() {
|
||||
* Get the information about a quiz to be upgraded.
|
||||
* @param integer $quizid the quiz id.
|
||||
* @return object the information about that quiz, as for
|
||||
* {@link local_qeupgradehelper_get_upgradable_quizzes()}.
|
||||
* {@link tool_qeupgradehelper_get_upgradable_quizzes()}.
|
||||
*/
|
||||
function local_qeupgradehelper_get_quiz($quizid) {
|
||||
function tool_qeupgradehelper_get_quiz($quizid) {
|
||||
global $DB;
|
||||
return $DB->get_record_sql("
|
||||
SELECT
|
||||
@ -395,10 +395,10 @@ function local_qeupgradehelper_get_quiz($quizid) {
|
||||
* Get the information about a quiz to be upgraded.
|
||||
* @param integer $quizid the quiz id.
|
||||
* @return object the information about that quiz, as for
|
||||
* {@link local_qeupgradehelper_get_resettable_quizzes()}, but with extra fields
|
||||
* {@link tool_qeupgradehelper_get_resettable_quizzes()}, but with extra fields
|
||||
* totalattempts and resettableattempts.
|
||||
*/
|
||||
function local_qeupgradehelper_get_resettable_quiz($quizid) {
|
||||
function tool_qeupgradehelper_get_resettable_quiz($quizid) {
|
||||
global $DB;
|
||||
return $DB->get_record_sql("
|
||||
SELECT
|
||||
@ -440,7 +440,7 @@ function local_qeupgradehelper_get_resettable_quiz($quizid) {
|
||||
* @param int $questionid a question id.
|
||||
* @return int the question session id.
|
||||
*/
|
||||
function local_qeupgradehelper_get_session_id($attemptid, $questionid) {
|
||||
function tool_qeupgradehelper_get_session_id($attemptid, $questionid) {
|
||||
global $DB;
|
||||
$attempt = $DB->get_record('quiz_attempts', array('id' => $attemptid));
|
||||
if (!$attempt) {
|
||||
@ -458,7 +458,7 @@ function local_qeupgradehelper_get_session_id($attemptid, $questionid) {
|
||||
* @param string $qtype question type.
|
||||
* @return integer question_session.id.
|
||||
*/
|
||||
function local_qeupgradehelper_find_test_case($behaviour, $statehistory, $qtype, $extratests) {
|
||||
function tool_qeupgradehelper_find_test_case($behaviour, $statehistory, $qtype, $extratests) {
|
||||
global $DB;
|
||||
|
||||
$params = array(
|
||||
@ -516,7 +516,7 @@ function local_qeupgradehelper_find_test_case($behaviour, $statehistory, $qtype,
|
||||
* Grab all the data that upgrade will need for upgrading one
|
||||
* attempt at one question from the old DB.
|
||||
*/
|
||||
function local_qeupgradehelper_generate_unit_test($questionsessionid, $namesuffix) {
|
||||
function tool_qeupgradehelper_generate_unit_test($questionsessionid, $namesuffix) {
|
||||
global $DB;
|
||||
|
||||
$qsession = $DB->get_record('question_sessions', array('id' => $questionsessionid));
|
||||
@ -526,9 +526,9 @@ function local_qeupgradehelper_generate_unit_test($questionsessionid, $namesuffi
|
||||
array('attempt' => $qsession->attemptid, 'question' => $qsession->questionid),
|
||||
'seq_number, id');
|
||||
|
||||
$question = local_qeupgradehelper_load_question($qsession->questionid, $quiz->id);
|
||||
$question = tool_qeupgradehelper_load_question($qsession->questionid, $quiz->id);
|
||||
|
||||
if (!local_qeupgradehelper_is_upgraded()) {
|
||||
if (!tool_qeupgradehelper_is_upgraded()) {
|
||||
if (!$quiz->optionflags) {
|
||||
$quiz->preferredbehaviour = 'deferredfeedback';
|
||||
} else if ($quiz->penaltyscheme) {
|
||||
@ -548,16 +548,16 @@ function local_qeupgradehelper_generate_unit_test($questionsessionid, $namesuffi
|
||||
echo '<textarea readonly="readonly" rows="80" cols="120" >' . "
|
||||
public function test_{$question->qtype}_{$quiz->preferredbehaviour}_{$namesuffix}() {
|
||||
";
|
||||
local_qeupgradehelper_display_convert_attempt_input($quiz, $attempt,
|
||||
tool_qeupgradehelper_display_convert_attempt_input($quiz, $attempt,
|
||||
$question, $qsession, $qstates);
|
||||
|
||||
if ($question->qtype == 'random') {
|
||||
list($randombit, $realanswer) = explode('-', reset($qstates)->answer, 2);
|
||||
$newquestionid = substr($randombit, 6);
|
||||
$newquestion = local_qeupgradehelper_load_question($newquestionid);
|
||||
$newquestion = tool_qeupgradehelper_load_question($newquestionid);
|
||||
$newquestion->maxmark = $question->maxmark;
|
||||
|
||||
echo local_qeupgradehelper_format_var('$realquestion', $newquestion);
|
||||
echo tool_qeupgradehelper_format_var('$realquestion', $newquestion);
|
||||
echo ' $this->loader->put_question_in_cache($realquestion);
|
||||
';
|
||||
}
|
||||
@ -598,7 +598,7 @@ function local_qeupgradehelper_generate_unit_test($questionsessionid, $namesuffi
|
||||
</textarea>';
|
||||
}
|
||||
|
||||
function local_qeupgradehelper_format_var($name, $var) {
|
||||
function tool_qeupgradehelper_format_var($name, $var) {
|
||||
$out = var_export($var, true);
|
||||
$out = str_replace('<', '<', $out);
|
||||
$out = str_replace('ADOFetchObj::__set_state(array(', '(object) array(', $out);
|
||||
@ -624,16 +624,16 @@ function local_qeupgradehelper_format_var($name, $var) {
|
||||
return " $name = $out;\n";
|
||||
}
|
||||
|
||||
function local_qeupgradehelper_display_convert_attempt_input($quiz, $attempt,
|
||||
function tool_qeupgradehelper_display_convert_attempt_input($quiz, $attempt,
|
||||
$question, $qsession, $qstates) {
|
||||
echo local_qeupgradehelper_format_var('$quiz', $quiz);
|
||||
echo local_qeupgradehelper_format_var('$attempt', $attempt);
|
||||
echo local_qeupgradehelper_format_var('$question', $question);
|
||||
echo local_qeupgradehelper_format_var('$qsession', $qsession);
|
||||
echo local_qeupgradehelper_format_var('$qstates', $qstates);
|
||||
echo tool_qeupgradehelper_format_var('$quiz', $quiz);
|
||||
echo tool_qeupgradehelper_format_var('$attempt', $attempt);
|
||||
echo tool_qeupgradehelper_format_var('$question', $question);
|
||||
echo tool_qeupgradehelper_format_var('$qsession', $qsession);
|
||||
echo tool_qeupgradehelper_format_var('$qstates', $qstates);
|
||||
}
|
||||
|
||||
function local_qeupgradehelper_load_question($questionid, $quizid) {
|
||||
function tool_qeupgradehelper_load_question($questionid, $quizid) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$question = $DB->get_record_sql('
|
||||
@ -643,7 +643,7 @@ function local_qeupgradehelper_load_question($questionid, $quizid) {
|
||||
WHERE q.id = :questionid AND qqi.quiz = :quizid',
|
||||
array('questionid' => $questionid, 'quizid' => $quizid));
|
||||
|
||||
if (local_qeupgradehelper_is_upgraded()) {
|
||||
if (tool_qeupgradehelper_is_upgraded()) {
|
||||
require_once($CFG->dirroot . '/question/engine/bank.php');
|
||||
$qtype = question_bank::get_qtype($question->qtype, false);
|
||||
} else {
|
||||
@ -660,7 +660,7 @@ function local_qeupgradehelper_load_question($questionid, $quizid) {
|
||||
return $question;
|
||||
}
|
||||
|
||||
function local_qeupgradehelper_get_quiz_for_upgrade() {
|
||||
function tool_qeupgradehelper_get_quiz_for_upgrade() {
|
||||
global $DB;
|
||||
|
||||
return $DB->get_record_sql("SELECT quiz.id
|
@ -28,7 +28,7 @@
|
||||
* display updated information.
|
||||
* 4. Once you are sure that works, you can proceed with the upgrade as usual.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2011 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -44,7 +44,7 @@
|
||||
* have to take steps to upgrade them yourself using the facilities provided by
|
||||
* this plugin.
|
||||
*/
|
||||
//function local_qeupgradehelper_get_quizzes_to_upgrade() {
|
||||
//function tool_qeupgradehelper_get_quizzes_to_upgrade() {
|
||||
// return array(1, 2, 3);
|
||||
//}
|
||||
|
||||
@ -63,9 +63,9 @@
|
||||
* have to take steps to upgrade them yourself using the facilities provided by
|
||||
* this plugin.
|
||||
*/
|
||||
//function local_qeupgradehelper_get_quizzes_to_upgrade() {
|
||||
//function tool_qeupgradehelper_get_quizzes_to_upgrade() {
|
||||
// global $CFG;
|
||||
// $rawids = file($CFG->dirroot . '/local/qeupgradehelper/quiz-ids-to-upgrade.txt');
|
||||
// $rawids = file($CFG->dirroot . '/' . $CFG->admin . '/tool/qeupgradehelper/quiz-ids-to-upgrade.txt');
|
||||
// $cleanids = array();
|
||||
// foreach ($rawids as $id) {
|
||||
// $id = clean_param($id, PARAM_INT);
|
||||
@ -92,7 +92,7 @@
|
||||
* have to take steps to upgrade them yourself using the facilities provided by
|
||||
* this plugin.
|
||||
*/
|
||||
//function local_qeupgradehelper_get_quizzes_to_upgrade() {
|
||||
//function tool_qeupgradehelper_get_quizzes_to_upgrade() {
|
||||
// global $DB;
|
||||
//
|
||||
// $quizmoduleid = $DB->get_field('modules', 'id', array('name' => 'quiz'));
|
@ -17,7 +17,7 @@
|
||||
/**
|
||||
* Defines the renderer for the question engine upgrade helper plugin.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class local_qeupgradehelper_renderer extends plugin_renderer_base {
|
||||
class tool_qeupgradehelper_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Render the index page.
|
||||
@ -44,7 +44,7 @@ class local_qeupgradehelper_renderer extends plugin_renderer_base {
|
||||
public function index_page($detected, array $actions) {
|
||||
$output = '';
|
||||
$output .= $this->header();
|
||||
$output .= $this->heading(get_string('pluginname', 'local_qeupgradehelper'));
|
||||
$output .= $this->heading(get_string('pluginname', 'tool_qeupgradehelper'));
|
||||
$output .= $this->box($detected);
|
||||
$output .= html_writer::start_tag('ul');
|
||||
foreach ($actions as $action) {
|
||||
@ -77,7 +77,7 @@ class local_qeupgradehelper_renderer extends plugin_renderer_base {
|
||||
* @param int $numveryoldattemtps only relevant before upgrade.
|
||||
* @return string html to output.
|
||||
*/
|
||||
public function quiz_list_page(local_qeupgradehelper_quiz_list $quizzes,
|
||||
public function quiz_list_page(tool_qeupgradehelper_quiz_list $quizzes,
|
||||
$numveryoldattemtps = null) {
|
||||
$output = '';
|
||||
$output .= $this->header();
|
||||
@ -99,7 +99,7 @@ class local_qeupgradehelper_renderer extends plugin_renderer_base {
|
||||
$output .= html_writer::table($table);
|
||||
|
||||
if ($numveryoldattemtps) {
|
||||
$output .= $this->box(get_string('veryoldattemtps', 'local_qeupgradehelper',
|
||||
$output .= $this->box(get_string('veryoldattemtps', 'tool_qeupgradehelper',
|
||||
$numveryoldattemtps));
|
||||
}
|
||||
|
||||
@ -116,12 +116,12 @@ class local_qeupgradehelper_renderer extends plugin_renderer_base {
|
||||
public function convert_quiz_are_you_sure($quizsummary) {
|
||||
$output = '';
|
||||
$output .= $this->header();
|
||||
$output .= $this->heading(get_string('areyousure', 'local_qeupgradehelper'));
|
||||
$output .= $this->heading(get_string('areyousure', 'tool_qeupgradehelper'));
|
||||
|
||||
$params = array('quizid' => $quizsummary->id, 'confirmed' => 1, 'sesskey' => sesskey());
|
||||
$output .= $this->confirm(get_string('areyousuremessage', 'local_qeupgradehelper', $quizsummary),
|
||||
new single_button(local_qeupgradehelper_url('convertquiz', $params), get_string('yes')),
|
||||
local_qeupgradehelper_url('listtodo'));
|
||||
$output .= $this->confirm(get_string('areyousuremessage', 'tool_qeupgradehelper', $quizsummary),
|
||||
new single_button(tool_qeupgradehelper_url('convertquiz', $params), get_string('yes')),
|
||||
tool_qeupgradehelper_url('listtodo'));
|
||||
|
||||
$output .= $this->footer();
|
||||
return $output;
|
||||
@ -135,12 +135,12 @@ class local_qeupgradehelper_renderer extends plugin_renderer_base {
|
||||
public function reset_quiz_are_you_sure($quizsummary) {
|
||||
$output = '';
|
||||
$output .= $this->header();
|
||||
$output .= $this->heading(get_string('areyousure', 'local_qeupgradehelper'));
|
||||
$output .= $this->heading(get_string('areyousure', 'tool_qeupgradehelper'));
|
||||
|
||||
$params = array('quizid' => $quizsummary->id, 'confirmed' => 1, 'sesskey' => sesskey());
|
||||
$output .= $this->confirm(get_string('areyousureresetmessage', 'local_qeupgradehelper', $quizsummary),
|
||||
new single_button(local_qeupgradehelper_url('resetquiz', $params), get_string('yes')),
|
||||
local_qeupgradehelper_url('listupgraded'));
|
||||
$output .= $this->confirm(get_string('areyousureresetmessage', 'tool_qeupgradehelper', $quizsummary),
|
||||
new single_button(tool_qeupgradehelper_url('resetquiz', $params), get_string('yes')),
|
||||
tool_qeupgradehelper_url('listupgraded'));
|
||||
|
||||
$output .= $this->footer();
|
||||
return $output;
|
||||
@ -162,7 +162,7 @@ class local_qeupgradehelper_renderer extends plugin_renderer_base {
|
||||
* @return string html to output.
|
||||
*/
|
||||
public function back_to_index() {
|
||||
return $this->end_of_page_link(local_qeupgradehelper_url('index'),
|
||||
get_string('backtoindex', 'local_qeupgradehelper'));
|
||||
return $this->end_of_page_link(tool_qeupgradehelper_url('index'),
|
||||
get_string('backtoindex', 'tool_qeupgradehelper'));
|
||||
}
|
||||
}
|
@ -17,13 +17,13 @@
|
||||
/**
|
||||
* Script to reset the upgrade of attempts at a particular quiz, after confirmation.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2010 The Open University
|
||||
* @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(dirname(__FILE__) . '/locallib.php');
|
||||
require_once(dirname(__FILE__) . '/afterupgradelib.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
@ -33,20 +33,20 @@ $confirmed = optional_param('confirmed', false, PARAM_BOOL);
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
local_qeupgradehelper_require_upgraded();
|
||||
tool_qeupgradehelper_require_upgraded();
|
||||
|
||||
admin_externalpage_setup('qeupgradehelper', '', array(),
|
||||
local_qeupgradehelper_url('resetquiz', array('quizid' => $quizid)));
|
||||
$PAGE->navbar->add(get_string('listupgraded', 'local_qeupgradehelper'),
|
||||
local_qeupgradehelper_url('listtodo'));
|
||||
$PAGE->navbar->add(get_string('resetquiz', 'local_qeupgradehelper'));
|
||||
tool_qeupgradehelper_url('resetquiz', array('quizid' => $quizid)));
|
||||
$PAGE->navbar->add(get_string('listupgraded', 'tool_qeupgradehelper'),
|
||||
tool_qeupgradehelper_url('listtodo'));
|
||||
$PAGE->navbar->add(get_string('resetquiz', 'tool_qeupgradehelper'));
|
||||
|
||||
$renderer = $PAGE->get_renderer('local_qeupgradehelper');
|
||||
$renderer = $PAGE->get_renderer('tool_qeupgradehelper');
|
||||
|
||||
$quizsummary = local_qeupgradehelper_get_resettable_quiz($quizid);
|
||||
$quizsummary = tool_qeupgradehelper_get_resettable_quiz($quizid);
|
||||
if (!$quizsummary) {
|
||||
print_error('invalidquizid', 'local_qeupgradehelper',
|
||||
local_qeupgradehelper_url('listupgraded'));
|
||||
print_error('invalidquizid', 'tool_qeupgradehelper',
|
||||
tool_qeupgradehelper_url('listupgraded'));
|
||||
}
|
||||
|
||||
$quizsummary->name = format_string($quizsummary->name);
|
||||
@ -55,15 +55,15 @@ if ($confirmed && data_submitted() && confirm_sesskey()) {
|
||||
// Actually do the conversion.
|
||||
echo $renderer->header();
|
||||
echo $renderer->heading(get_string(
|
||||
'resettingquizattempts', 'local_qeupgradehelper', $quizsummary));
|
||||
'resettingquizattempts', 'tool_qeupgradehelper', $quizsummary));
|
||||
|
||||
$upgrader = new local_qeupgradehelper_attempt_upgrader(
|
||||
$upgrader = new tool_qeupgradehelper_attempt_upgrader(
|
||||
$quizsummary->id, $quizsummary->resettableattempts);
|
||||
$upgrader->reset_all_resettable_attempts();
|
||||
|
||||
echo $renderer->heading(get_string('resetcomplete', 'local_qeupgradehelper'));
|
||||
echo $renderer->end_of_page_link(local_qeupgradehelper_url('listupgraded'),
|
||||
get_string('listupgraded', 'local_qeupgradehelper'));
|
||||
echo $renderer->heading(get_string('resetcomplete', 'tool_qeupgradehelper'));
|
||||
echo $renderer->end_of_page_link(tool_qeupgradehelper_url('listupgraded'),
|
||||
get_string('listupgraded', 'tool_qeupgradehelper'));
|
||||
|
||||
echo $renderer->footer();
|
||||
exit;
|
@ -17,7 +17,7 @@
|
||||
/**
|
||||
* Adds this plugin to the admin menu.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2011 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -27,6 +27,6 @@ defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
if ($hassiteconfig) { // needs this condition or there is error on login page
|
||||
$ADMIN->add('root', new admin_externalpage('qeupgradehelper',
|
||||
get_string('pluginname', 'local_qeupgradehelper'),
|
||||
new moodle_url('/local/qeupgradehelper/index.php')));
|
||||
get_string('pluginname', 'tool_qeupgradehelper'),
|
||||
new moodle_url('/admin/tool/qeupgradehelper/index.php')));
|
||||
}
|
6
admin/tool/qeupgradehelper/styles.css
Normal file
6
admin/tool/qeupgradehelper/styles.css
Normal file
@ -0,0 +1,6 @@
|
||||
#page-admin-tool-qeupgradehelper-index .dimmed {
|
||||
color: grey;
|
||||
}
|
||||
#page-admin-tool-qeupgradehelper-index .dimmed a {
|
||||
color: #88c;
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
/**
|
||||
* Version details.
|
||||
*
|
||||
* @package local
|
||||
* @package tool
|
||||
* @subpackage qeupgradehelper
|
||||
* @copyright 2011 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -25,5 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2011040400;
|
||||
$plugin->requires = 2010080300;
|
||||
$plugin->version = 2011092500;
|
||||
$plugin->requires = 2011092100;
|
||||
$plugin->component = 'tool_qeupgradehelper'; // Full name of the plugin (used for diagnostics)
|
@ -1,13 +1,35 @@
|
||||
<?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
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage replace
|
||||
* @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('../../../config.php');
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('replace');
|
||||
admin_externalpage_setup('toolreplace');
|
||||
|
||||
$search = optional_param('search', '', PARAM_RAW);
|
||||
$replace = optional_param('replace', '', PARAM_RAW);
|
||||
@ -30,7 +52,7 @@ if (!data_submitted() or !$search or !$replace or !confirm_sesskey() or !$sure)
|
||||
|
||||
echo $OUTPUT->box_start();
|
||||
echo '<div class="mdl-align">';
|
||||
echo '<form action="replace.php" method="post"><div>';
|
||||
echo '<form action="index.php" method="post"><div>';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<div><label for="search">Search whole database for: </label><input id="search" type="text" name="search" size="40" /> (usually previous server URL)</div>';
|
||||
echo '<div><label for="replace">Replace with this string: </label><input type="text" id="replace" name="replace" size="40" /> (usually new server URL)</div>';
|
||||
@ -52,7 +74,7 @@ echo $OUTPUT->notification('Rebuilding course cache...', 'notifysuccess');
|
||||
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();
|
||||
|
26
admin/tool/replace/lang/en/tool_replace.php
Normal file
26
admin/tool/replace/lang/en/tool_replace.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?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_replace', language 'en', branch 'MOODLE_22_STABLE'
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage replace
|
||||
* @copyright 2011 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'DB search and replace';
|
30
admin/tool/replace/settings.php
Normal file
30
admin/tool/replace/settings.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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 unsupported db replace script.
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage replace
|
||||
* @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) {
|
||||
$ADMIN->add('unsupported', new admin_externalpage('toolreplace', get_string('pluginname', 'tool_replace'), $CFG->wwwroot.'/'.$CFG->admin.'/tool/replace/index.php', 'moodle/site:config', true));
|
||||
}
|
32
admin/tool/replace/version.php
Normal file
32
admin/tool/replace/version.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?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 replace
|
||||
* @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 = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_replace'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
|
@ -40,7 +40,7 @@ $reset = optional_param('reset', '', PARAM_RAW);
|
||||
$id = optional_param('id', '', PARAM_INT);
|
||||
|
||||
require_login();
|
||||
admin_externalpage_setup('reportspamcleaner');
|
||||
admin_externalpage_setup('toolspamcleaner');
|
||||
|
||||
// Delete one user
|
||||
if (!empty($del) && confirm_sesskey() && ($id != $USER->id)) {
|
||||
@ -79,14 +79,14 @@ if (!empty($ignore)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$PAGE->requires->js_init_call('M.report_spamcleaner.init', array(me()), true);
|
||||
$PAGE->requires->js_init_call('M.tool_spamcleaner.init', array(me()), true);
|
||||
$strings = Array('spaminvalidresult','spamdeleteallconfirm','spamcannotdelete','spamdeleteconfirm');
|
||||
$PAGE->requires->strings_for_js($strings, 'report_spamcleaner');
|
||||
$PAGE->requires->strings_for_js($strings, 'tool_spamcleaner');
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Print headers and things
|
||||
echo $OUTPUT->box(get_string('spamcleanerintro', 'report_spamcleaner'));
|
||||
echo $OUTPUT->box(get_string('spamcleanerintro', 'tool_spamcleaner'));
|
||||
|
||||
echo $OUTPUT->box_start(); // The forms section at the top
|
||||
|
||||
@ -98,16 +98,16 @@ echo $OUTPUT->box_start(); // The forms section at the top
|
||||
<div>
|
||||
<input type="text" name="keyword" id="keyword_el" value="<?php p($keyword) ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey();?>" />
|
||||
<input type="submit" value="<?php echo get_string('spamsearch', 'report_spamcleaner')?>" />
|
||||
<input type="submit" value="<?php echo get_string('spamsearch', 'tool_spamcleaner')?>" />
|
||||
</div>
|
||||
</form>
|
||||
<p><?php echo get_string('spameg', 'report_spamcleaner');?></p>
|
||||
<p><?php echo get_string('spameg', 'tool_spamcleaner');?></p>
|
||||
|
||||
<hr />
|
||||
|
||||
<form method="post" action="index.php">
|
||||
<div>
|
||||
<input type="submit" name="autodetect" value="<?php echo get_string('spamauto', 'report_spamcleaner');?>" />
|
||||
<input type="submit" name="autodetect" value="<?php echo get_string('spamauto', 'tool_spamcleaner');?>" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -168,7 +168,7 @@ function search_spammers($keywords) {
|
||||
$spamusers_blog = $DB->get_recordset_sql($sql2, $params);
|
||||
|
||||
$keywordlist = implode(', ', $keywords);
|
||||
echo $OUTPUT->box(get_string('spamresult', 'report_spamcleaner').s($keywordlist)).' ...';
|
||||
echo $OUTPUT->box(get_string('spamresult', 'tool_spamcleaner').s($keywordlist)).' ...';
|
||||
|
||||
print_user_list(array($spamusers_desc, $spamusers_blog), $keywords);
|
||||
|
||||
@ -186,7 +186,7 @@ function print_user_list($users_rs, $keywords) {
|
||||
foreach ($users_rs as $rs){
|
||||
foreach ($rs as $user) {
|
||||
if (!$count) {
|
||||
echo '<table border="1" width="100%" id="data-grid"><tr><th> </th><th>'.get_string('user','admin').'</th><th>'.get_string('spamdesc', 'report_spamcleaner').'</th><th>'.get_string('spamoperation', 'report_spamcleaner').'</th></tr>';
|
||||
echo '<table border="1" width="100%" id="data-grid"><tr><th> </th><th>'.get_string('user','admin').'</th><th>'.get_string('spamdesc', 'tool_spamcleaner').'</th><th>'.get_string('spamoperation', 'tool_spamcleaner').'</th></tr>';
|
||||
}
|
||||
$count++;
|
||||
filter_user($user, $keywords, $count);
|
||||
@ -194,12 +194,12 @@ function print_user_list($users_rs, $keywords) {
|
||||
}
|
||||
|
||||
if (!$count) {
|
||||
echo get_string('spamcannotfinduser', 'report_spamcleaner');
|
||||
echo get_string('spamcannotfinduser', 'tool_spamcleaner');
|
||||
|
||||
} else {
|
||||
echo '</table>';
|
||||
echo '<div class="mld-align">
|
||||
<button id="removeall_btn">'.get_string('spamdeleteall', 'report_spamcleaner').'</button>
|
||||
<button id="removeall_btn">'.get_string('spamdeleteall', 'tool_spamcleaner').'</button>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@ function filter_user($user, $keywords, $count) {
|
||||
$image_search = true;
|
||||
}
|
||||
if (isset($user->summary)) {
|
||||
$user->description = '<h3>'.get_string('spamfromblog', 'report_spamcleaner').'</h3>'.$user->summary;
|
||||
$user->description = '<h3>'.get_string('spamfromblog', 'tool_spamcleaner').'</h3>'.$user->summary;
|
||||
unset($user->summary);
|
||||
}
|
||||
if (preg_match('#<img.*src=[\"\']('.$CFG->wwwroot.')#', $user->description, $matches)
|
||||
@ -271,8 +271,8 @@ function print_user_entry($user, $keywords, $count) {
|
||||
|
||||
$html .= '<td align="left">'.format_text($user->description, $user->descriptionformat, array('overflowdiv'=>true)).'</td>';
|
||||
$html .= '<td width="100px" align="center">';
|
||||
$html .= '<button onclick="M.report_spamcleaner.del_user(this,'.$user->id.')">'.get_string('deleteuser', 'admin').'</button><br />';
|
||||
$html .= '<button onclick="M.report_spamcleaner.ignore_user(this,'.$user->id.')">'.get_string('ignore', 'admin').'</button>';
|
||||
$html .= '<button onclick="M.tool_spamcleaner.del_user(this,'.$user->id.')">'.get_string('deleteuser', 'admin').'</button><br />';
|
||||
$html .= '<button onclick="M.tool_spamcleaner.ignore_user(this,'.$user->id.')">'.get_string('ignore', 'admin').'</button>';
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>';
|
||||
return $html;
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -16,11 +15,12 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'report_spamcleaner', language 'en', branch 'MOODLE_20_STABLE'
|
||||
* Strings for component 'tool_spamcleaner', language 'en', branch 'MOODLE_22_STABLE'
|
||||
*
|
||||
* @package report_spamcleaner
|
||||
* @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 spamcleaner
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Spam cleaner';
|
@ -1,12 +1,12 @@
|
||||
M.report_spamcleaner = {
|
||||
M.tool_spamcleaner = {
|
||||
Y: null,
|
||||
row: null,
|
||||
me: null,
|
||||
|
||||
del_all: function() {
|
||||
var context = M.report_spamcleaner;
|
||||
var context = M.tool_spamcleaner;
|
||||
|
||||
var yes = confirm(M.str.report_spamcleaner.spamdeleteallconfirm);
|
||||
var yes = confirm(M.str.tool_spamcleaner.spamdeleteallconfirm);
|
||||
if (yes) {
|
||||
var cfg = {
|
||||
method: "POST",
|
||||
@ -15,7 +15,7 @@ M.report_spamcleaner = {
|
||||
try {
|
||||
var resp = context.Y.JSON.parse(o.responseText);
|
||||
} catch(e) {
|
||||
alert(M.str.report_spamcleaner.spaminvalidresult);
|
||||
alert(M.str.tool_spamcleaner.spaminvalidresult);
|
||||
return;
|
||||
}
|
||||
if (resp == true) {
|
||||
@ -29,14 +29,14 @@ M.report_spamcleaner = {
|
||||
},
|
||||
|
||||
del_user: function(obj, id) {
|
||||
var context = M.report_spamcleaner;
|
||||
var context = M.tool_spamcleaner;
|
||||
|
||||
if (context.Y == null) {
|
||||
// not initialised yet
|
||||
return;
|
||||
}
|
||||
|
||||
var yes = confirm(M.str.report_spamcleaner.spamdeleteconfirm);
|
||||
var yes = confirm(M.str.tool_spamcleaner.spamdeleteconfirm);
|
||||
if (yes) {
|
||||
context.row = obj;
|
||||
var cfg = {
|
||||
@ -46,7 +46,7 @@ M.report_spamcleaner = {
|
||||
try {
|
||||
var resp = context.Y.JSON.parse(o.responseText);
|
||||
} catch(e) {
|
||||
alert(M.str.report_spamcleaner.spaminvalidresult);
|
||||
alert(M.str.tool_spamcleaner.spaminvalidresult);
|
||||
return;
|
||||
}
|
||||
if (context.row) {
|
||||
@ -57,7 +57,7 @@ M.report_spamcleaner = {
|
||||
context.row.parentNode.removeChild(context.row);
|
||||
context.row = null;
|
||||
} else {
|
||||
alert(M.str.report_spamcleaner.spamcannotdelete);
|
||||
alert(M.str.tool_spamcleaner.spamcannotdelete);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -68,7 +68,7 @@ M.report_spamcleaner = {
|
||||
},
|
||||
|
||||
ignore_user: function(obj, id) {
|
||||
var context = M.report_spamcleaner;
|
||||
var context = M.tool_spamcleaner;
|
||||
|
||||
if (context.Y == null) {
|
||||
// not initilised yet
|
||||
@ -83,7 +83,7 @@ M.report_spamcleaner = {
|
||||
try {
|
||||
var resp = context.Y.JSON.parse(o.responseText);
|
||||
} catch(e) {
|
||||
alert(M.str.report_spamcleaner.spaminvalidresult);
|
||||
alert(M.str.tool_spamcleaner.spaminvalidresult);
|
||||
return;
|
||||
}
|
||||
if (context.row) {
|
||||
@ -102,7 +102,7 @@ M.report_spamcleaner = {
|
||||
},
|
||||
|
||||
init: function(Y, me) {
|
||||
var context = M.report_spamcleaner;
|
||||
var context = M.tool_spamcleaner;
|
||||
|
||||
Y.use('json', 'io-base', function (Y) {
|
||||
context.Y = Y;
|
33
admin/tool/spamcleaner/settings.php
Normal file
33
admin/tool/spamcleaner/settings.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?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 spamcleaner.
|
||||
*
|
||||
* For now keep in Reports folder, we should move it elsewhere once we deal with contexts in general reports and navigation
|
||||
*
|
||||
* @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;
|
||||
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('reports', new admin_externalpage('toolspamcleaner', get_string('pluginname', 'tool_spamcleaner'), "$CFG->wwwroot/$CFG->admin/tool/spamcleaner/index.php", 'moodle/site:config'));
|
||||
}
|
||||
|
31
admin/tool/spamcleaner/version.php
Normal file
31
admin/tool/spamcleaner/version.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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 spamcleaner
|
||||
* @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 = 2011092500;
|
||||
$plugin->requires = 2011092100;
|
||||
$plugin->component = 'tool_spamcleaner'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -1,20 +1,41 @@
|
||||
<?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/>.
|
||||
|
||||
// Automatic update of Timezones from a new source
|
||||
/**
|
||||
* Automatic update of Timezones from a new source
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage timezoneimport
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once('../config.php');
|
||||
require_once('../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once($CFG->libdir.'/olson.php');
|
||||
|
||||
admin_externalpage_setup('timezoneimport');
|
||||
admin_externalpage_setup('tooltimezoneimport');
|
||||
|
||||
$ok = optional_param('ok', 0, PARAM_BOOL);
|
||||
|
||||
|
||||
/// Print headings
|
||||
|
||||
$strimporttimezones = get_string('importtimezones', 'admin');
|
||||
$strimporttimezones = get_string('importtimezones', 'tool_timezoneimport');
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
@ -28,9 +49,9 @@
|
||||
$message .= '<a href="'.$CFG->wwwroot.'/lib/timezone.txt">'.$CFG->dirroot.'/lib/timezone.txt</a><br />';
|
||||
$message .= '<br />';
|
||||
|
||||
$message = get_string("configintrotimezones", 'admin', $message);
|
||||
$message = get_string("configintrotimezones", 'tool_timezoneimport', $message);
|
||||
|
||||
echo $OUTPUT->confirm($message, 'timezoneimport.php?ok=1', 'index.php');
|
||||
echo $OUTPUT->confirm($message, 'index.php?ok=1', new moodle_url('/admin/index.php'));
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
@ -92,9 +113,9 @@
|
||||
$a = null;
|
||||
$a->count = count($timezones);
|
||||
$a->source = $importdone;
|
||||
echo $OUTPUT->heading(get_string('importtimezonescount', 'admin', $a), 3);
|
||||
echo $OUTPUT->heading(get_string('importtimezonescount', 'tool_timezoneimport', $a), 3);
|
||||
|
||||
echo $OUTPUT->continue_button('index.php');
|
||||
echo $OUTPUT->continue_button(new moodle_url('/admin/index.php'));
|
||||
|
||||
$timezonelist = array();
|
||||
foreach ($timezones as $timezone) {
|
||||
@ -117,8 +138,8 @@
|
||||
echo $OUTPUT->box_end();
|
||||
|
||||
} else {
|
||||
echo $OUTPUT->heading(get_string('importtimezonesfailed', 'admin'), 3);
|
||||
echo $OUTPUT->continue_button('index.php');
|
||||
echo $OUTPUT->heading(get_string('importtimezonesfailed', 'tool_timezoneimport'), 3);
|
||||
echo $OUTPUT->continue_button(new moodle_url('/admin/index.php'));
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
31
admin/tool/timezoneimport/lang/en/tool_timezoneimport.php
Normal file
31
admin/tool/timezoneimport/lang/en/tool_timezoneimport.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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_timezoneimport', language 'en', branch 'MOODLE_22_STABLE'
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage timezoneimport
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['configintrotimezones'] = 'This page will search for new information about world timezones (including daylight savings time rules) and update your local database with this information. These locations will be checked, in order: {$a} This procedure is generally very safe and can not break normal installations. Do you wish to update your timezones now?';
|
||||
$string['importtimezones'] = 'Update complete list of timezones';
|
||||
$string['importtimezonescount'] = '{$a->count} entries imported from {$a->source}';
|
||||
$string['importtimezonesfailed'] = 'No sources found! (Bad news)';
|
||||
$string['pluginname'] = 'Timezones updater';
|
||||
$string['updatetimezones'] = 'Update timezones';
|
31
admin/tool/timezoneimport/settings.php
Normal file
31
admin/tool/timezoneimport/settings.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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 timezoneimport
|
||||
* @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) {
|
||||
$ADMIN->add('location', new admin_externalpage('tooltimezoneimport', get_string('updatetimezones', 'tool_timezoneimport'), "$CFG->wwwroot/$CFG->admin/tool/timezoneimport/index.php"));
|
||||
}
|
||||
|
31
admin/tool/timezoneimport/version.php
Normal file
31
admin/tool/timezoneimport/version.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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 timezoneimport
|
||||
* @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 = 2011092500;
|
||||
$plugin->requires = 2011092100;
|
||||
$plugin->component = 'tool_timezoneimport'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -23,7 +23,7 @@
|
||||
* @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->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_unittest'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
/**
|
||||
* Strings for component 'tool_unsuproles', language 'en', branch 'MOODLE_22_STABLE'
|
||||
*
|
||||
* @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
|
||||
|
@ -15,7 +15,7 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Link to unsupported roles report
|
||||
* Link to unsupported roles tool
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage unsuproles
|
||||
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011091600; // Requires this Moodle version
|
||||
$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_unsuproles'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011091600; // Requires this Moodle version
|
||||
$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_uploaduser'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011091600; // Requires this Moodle version
|
||||
$plugin->version = 2011092500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011092100; // Requires this Moodle version
|
||||
$plugin->component = 'tool_xmldb'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
134
admin/tools.php
Normal file
134
admin/tools.php
Normal file
@ -0,0 +1,134 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Provides an overview of installed admin tools
|
||||
*
|
||||
* Displays the list of found admin tools, their version (if found) and
|
||||
* a link to delete the admin tool.
|
||||
*
|
||||
* The code is based on admin/localplugins.php by David Mudrak.
|
||||
*
|
||||
* @package admin
|
||||
* @copyright 2011 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($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
admin_externalpage_setup('managetools');
|
||||
|
||||
$delete = optional_param('delete', '', PARAM_PLUGIN);
|
||||
$confirm = optional_param('confirm', '', PARAM_BOOL);
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if (!empty($delete) and confirm_sesskey()) {
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('tools', 'admin'));
|
||||
|
||||
if (!$confirm) {
|
||||
if (get_string_manager()->string_exists('pluginname', 'tool_' . $delete)) {
|
||||
$strpluginname = get_string('pluginname', 'tool_' . $delete);
|
||||
} else {
|
||||
$strpluginname = $delete;
|
||||
}
|
||||
echo $OUTPUT->confirm(get_string('toolsdeleteconfirm', 'admin', $strpluginname),
|
||||
new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1)),
|
||||
$PAGE->url);
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
|
||||
} else {
|
||||
uninstall_plugin('tool', $delete);
|
||||
$a = new stdclass();
|
||||
$a->name = $delete;
|
||||
$pluginlocation = get_plugin_types();
|
||||
$a->directory = $pluginlocation['tool'] . '/' . $delete;
|
||||
echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
|
||||
echo $OUTPUT->continue_button($PAGE->url);
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('tools', 'admin'));
|
||||
|
||||
/// Print the table of all installed tool plugins
|
||||
|
||||
$table = new flexible_table('toolplugins_administration_table');
|
||||
$table->define_columns(array('name', 'version', 'delete'));
|
||||
$table->define_headers(array(get_string('plugin'), get_string('version'), get_string('delete')));
|
||||
$table->define_baseurl($PAGE->url);
|
||||
$table->set_attribute('id', 'toolplugins');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
$table->setup();
|
||||
|
||||
$plugins = array();
|
||||
foreach (get_plugin_list('tool') as $plugin => $plugindir) {
|
||||
if (get_string_manager()->string_exists('pluginname', 'tool_' . $plugin)) {
|
||||
$strpluginname = get_string('pluginname', 'tool_' . $plugin);
|
||||
} else {
|
||||
$strpluginname = $plugin;
|
||||
}
|
||||
$plugins[$plugin] = $strpluginname;
|
||||
}
|
||||
collatorlib::asort($plugins);
|
||||
|
||||
$like = $DB->sql_like('plugin', '?', true, true, false, '|');
|
||||
$params = array('tool|_%');
|
||||
$installed = $DB->get_records_select('config_plugins', "$like AND name = 'version'", $params);
|
||||
$versions = array();
|
||||
foreach ($installed as $config) {
|
||||
$name = preg_replace('/^tool_/', '', $config->plugin);
|
||||
$versions[$name] = $config->value;
|
||||
if (!isset($plugins[$name])) {
|
||||
$plugins[$name] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($plugins as $plugin => $name) {
|
||||
$delete = new moodle_url($PAGE->url, array('delete' => $plugin, 'sesskey' => sesskey()));
|
||||
$delete = html_writer::link($delete, get_string('delete'));
|
||||
|
||||
if (!isset($versions[$plugin])) {
|
||||
if (file_exists("$CFG->dirroot/$CFG->admin/tool/$plugin/version.php")) {
|
||||
// not installed yet
|
||||
$version = '?';
|
||||
} else {
|
||||
// no version info available
|
||||
$version = '-';
|
||||
}
|
||||
} else {
|
||||
$version = $versions[$plugin];
|
||||
if (file_exists("$CFG->dirroot/$CFG->admin/tool/$plugin")) {
|
||||
$version = $versions[$plugin];
|
||||
} else {
|
||||
// somebody removed plugin without uninstall
|
||||
$name = '<span class="notifyproblem">'.$name.' ('.get_string('missingfromdisk').')</span>';
|
||||
$version = $versions[$plugin];
|
||||
}
|
||||
}
|
||||
|
||||
$table->add_data(array($name, $version, $delete));
|
||||
}
|
||||
|
||||
$table->print_html();
|
||||
|
||||
echo $OUTPUT->footer();
|
@ -227,7 +227,6 @@ $string['configintcachemax'] = 'For internal cache only. Maximum number of recor
|
||||
$string['configintro'] = 'On this page you can specify a number of configuration variables that help make Moodle work properly on your server. Don\'t worry too much about it - the defaults will usually work fine and you can always come back to this page later and change these settings.';
|
||||
$string['configintroadmin'] = 'On this page you should configure your main administrator account which will have complete control over the site. Make sure you give it a secure username and password as well as a valid email address. You can create more admin accounts later on.';
|
||||
$string['configintrosite'] = 'This page allows you to configure the front page and name of this new site. You can come back here later to change these settings any time using the Administration menus.';
|
||||
$string['configintrotimezones'] = 'This page will search for new information about world timezones (including daylight savings time rules) and update your local database with this information. These locations will be checked, in order: {$a} This procedure is generally very safe and can not break normal installations. Do you wish to update your timezones now?';
|
||||
$string['configiplookup'] = 'When you click on an IP address (such as 34.12.222.93), such as in the logs, you are shown a map with a best guess of where that IP is located. There are different plugins for this that you can choose from, each has benefits and disadvantages.';
|
||||
$string['configkeeptagnamecase'] = 'Check this if you want tag names to keep the original casing as entered by users who created them';
|
||||
$string['configlang'] = 'Choose a default language for the whole site. Users can override this setting using the language menu or the setting in their personal profile.';
|
||||
@ -574,9 +573,6 @@ $string['choosefiletoedit'] = 'Choose file to edit';
|
||||
$string['iconvrecommended'] = 'Installing the optional ICONV library is highly recommended in order to improve site performance, particularly if your site is supporting non-Latin languages.';
|
||||
$string['iconvrequired'] = 'Installing ICONV extension is required.';
|
||||
$string['ignore'] = 'Ignore';
|
||||
$string['importtimezones'] = 'Update complete list of timezones';
|
||||
$string['importtimezonescount'] = '{$a->count} entries imported from {$a->source}';
|
||||
$string['importtimezonesfailed'] = 'No sources found! (Bad news)';
|
||||
$string['includemoduleuserdata'] = 'Include module user data';
|
||||
$string['incompatibleblocks'] = 'Incompatible blocks';
|
||||
$string['installhijacked'] = 'Installation must be finished from the original IP address, sorry.';
|
||||
@ -939,6 +935,9 @@ $string['timezoneforced'] = 'This is forced by the site administrator';
|
||||
$string['timezoneisforcedto'] = 'Force all users to use';
|
||||
$string['timezonenotforced'] = 'Users can choose their own timezone';
|
||||
$string['tokenizerrecommended'] = 'Installing the optional PHP Tokenizer extension is recommended -- it improves Moodle Networking functionality.';
|
||||
$string['tools'] = 'Admin tools';
|
||||
$string['toolsdeleteconfirm'] = 'You are about to completely delete the admin tool \'{$a}\'. This will completely delete everything in the database associated with this plugin. Are you SURE you want to continue?';
|
||||
$string['toolsmanage'] = 'Manage admin tools';
|
||||
$string['unattendedoperation'] = 'Unattended operation';
|
||||
$string['unbookmarkthispage'] = 'Unbookmark this page';
|
||||
$string['unicoderecommended'] = 'Storing all your data in Unicode (UTF-8) is recommended. New installations should be performed into databases that have their default character set as Unicode. If you are upgrading, you should perform the UTF-8 migration process (see the Admin page).';
|
||||
@ -947,7 +946,6 @@ $string['uninstallplugin'] = 'Uninstall';
|
||||
$string['unsupported'] = 'Unsupported';
|
||||
$string['updateaccounts'] = 'Update existing accounts';
|
||||
$string['updatecomponent'] = 'Update component';
|
||||
$string['updatetimezones'] = 'Update timezones';
|
||||
$string['upgradestart'] = 'Upgrade';
|
||||
$string['upgradeerror'] = 'Unknown error upgrading {$a->plugin} to version {$a->version}, can not continue.';
|
||||
$string['upgradeforumread'] = 'A new feature has been added in Moodle 1.5 to track read/unread forum posts.<br />To use this functionality you need to <a href="{$a}">update your tables</a>.';
|
||||
|
@ -452,6 +452,7 @@ function cron_run() {
|
||||
cron_execute_plugin_type('qtype', 'question types');
|
||||
cron_execute_plugin_type('plagiarism', 'plagiarism plugins');
|
||||
cron_execute_plugin_type('theme', 'themes');
|
||||
cron_execute_plugin_type('tool', 'admin tools');
|
||||
|
||||
// and finally run any local cronjobs, if any
|
||||
if ($locals = get_plugin_list('local')) {
|
||||
|
@ -7297,7 +7297,7 @@ function get_core_subsystems() {
|
||||
'publish' => 'course/publish',
|
||||
'question' => 'question',
|
||||
'rating' => 'rating',
|
||||
'register' => 'admin/registration',
|
||||
'register' => 'admin/registration', //TODO: this is wrong, unfortunately we would need to modify hub code to pass around the correct url
|
||||
'repository' => 'repository',
|
||||
'rss' => 'rss',
|
||||
'role' => $CFG->admin.'/role',
|
||||
|
@ -289,7 +289,6 @@ class plugin_manager {
|
||||
),
|
||||
|
||||
'local' => array(
|
||||
'qeupgradehelper'
|
||||
),
|
||||
|
||||
'message' => array(
|
||||
@ -343,8 +342,7 @@ class plugin_manager {
|
||||
|
||||
'report' => array(
|
||||
'backups', 'configlog', 'courseoverview',
|
||||
'customlang', 'log', 'questioninstances',
|
||||
'security', 'spamcleaner', 'stats'
|
||||
'log', 'questioninstances', 'security', 'stats'
|
||||
),
|
||||
|
||||
'repository' => array(
|
||||
@ -367,9 +365,10 @@ class plugin_manager {
|
||||
),
|
||||
|
||||
'tool' => array(
|
||||
'bloglevelupgrade', 'capability', 'dbtransfer', 'generator',
|
||||
'health', 'innodb', 'langimport', 'multilangupgrade',
|
||||
'profiling', 'unittest', 'uploaduser', 'unsuproles', 'xmldb'
|
||||
'bloglevelupgrade', 'capability', 'customlang', 'dbtransfer', 'generator',
|
||||
'health', 'innodb', 'langimport', 'multilangupgrade', 'profiling',
|
||||
'qeupgradehelper', 'replace', 'spamcleaner', 'timezoneimport', 'unittest',
|
||||
'uploaduser', 'unsuproles', 'xmldb'
|
||||
),
|
||||
|
||||
'webservice' => array(
|
||||
@ -1504,3 +1503,13 @@ class plugintype_mnetservice extends plugintype_base implements plugintype_inter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for admin tool plugins
|
||||
*/
|
||||
class plugintype_tool extends plugintype_base implements plugintype_interface {
|
||||
|
||||
public function get_uninstall_url() {
|
||||
return new moodle_url('/admin/tools.php', array('delete' => $this->name, 'sesskey' => sesskey()));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
#page-admin-local-qeupgradehelper-index .dimmed {
|
||||
color: grey;
|
||||
}
|
||||
#page-admin-local-qeupgradehelper-index .dimmed a {
|
||||
color: #88c;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user