mirror of
https://github.com/moodle/moodle.git
synced 2025-02-13 20:36:42 +01:00
AMOS BEGIN MOV [action,local_qeupgradehelper],[action,tool_qeupgradehelper] MOV [alreadydone,local_qeupgradehelper],[alreadydone,tool_qeupgradehelper] MOV [areyousure,local_qeupgradehelper],[areyousure,tool_qeupgradehelper] MOV [areyousuremessage,local_qeupgradehelper],[areyousuremessage,tool_qeupgradehelper] MOV [areyousureresetmessage,local_qeupgradehelper],[areyousureresetmessage,tool_qeupgradehelper] MOV [attemptstoconvert,local_qeupgradehelper],[attemptstoconvert,tool_qeupgradehelper] MOV [backtoindex,local_qeupgradehelper],[backtoindex,tool_qeupgradehelper] MOV [conversioncomplete,local_qeupgradehelper],[conversioncomplete,tool_qeupgradehelper] MOV [convertattempts,local_qeupgradehelper],[convertattempts,tool_qeupgradehelper] MOV [convertquiz,local_qeupgradehelper],[convertquiz,tool_qeupgradehelper] MOV [convertedattempts,local_qeupgradehelper],[convertedattempts,tool_qeupgradehelper] MOV [cronenabled,local_qeupgradehelper],[cronenabled,tool_qeupgradehelper] MOV [croninstructions,local_qeupgradehelper],[croninstructions,tool_qeupgradehelper] MOV [cronprocesingtime,local_qeupgradehelper],[cronprocesingtime,tool_qeupgradehelper] MOV [cronsetup,local_qeupgradehelper],[cronsetup,tool_qeupgradehelper] MOV [cronsetup_desc,local_qeupgradehelper],[cronsetup_desc,tool_qeupgradehelper] MOV [cronstarthour,local_qeupgradehelper],[cronstarthour,tool_qeupgradehelper] MOV [cronstophour,local_qeupgradehelper],[cronstophour,tool_qeupgradehelper] MOV [extracttestcase,local_qeupgradehelper],[extracttestcase,tool_qeupgradehelper] MOV [extracttestcase_desc,local_qeupgradehelper],[extracttestcase_desc,tool_qeupgradehelper] MOV [gotoindex,local_qeupgradehelper],[gotoindex,tool_qeupgradehelper] MOV [gotoquizreport,local_qeupgradehelper],[gotoquizreport,tool_qeupgradehelper] MOV [gotoresetlink,local_qeupgradehelper],[gotoresetlink,tool_qeupgradehelper] MOV [includedintheupgrade,local_qeupgradehelper],[includedintheupgrade,tool_qeupgradehelper] MOV [invalidquizid,local_qeupgradehelper],[invalidquizid,tool_qeupgradehelper] MOV [listpreupgrade,local_qeupgradehelper],[listpreupgrade,tool_qeupgradehelper] MOV [listpreupgrade_desc,local_qeupgradehelper],[listpreupgrade_desc,tool_qeupgradehelper] MOV [listpreupgradeintro,local_qeupgradehelper],[listpreupgradeintro,tool_qeupgradehelper] MOV [listtodo,local_qeupgradehelper],[listtodo,tool_qeupgradehelper] MOV [listtodo_desc,local_qeupgradehelper],[listtodo_desc,tool_qeupgradehelper] MOV [listtodointro,local_qeupgradehelper],[listtodointro,tool_qeupgradehelper] MOV [listupgraded,local_qeupgradehelper],[listupgraded,tool_qeupgradehelper] MOV [listupgraded_desc,local_qeupgradehelper],[listupgraded_desc,tool_qeupgradehelper] MOV [listupgradedintro,local_qeupgradehelper],[listupgradedintro,tool_qeupgradehelper] MOV [noquizattempts,local_qeupgradehelper],[noquizattempts,tool_qeupgradehelper] MOV [nothingupgradedyet,local_qeupgradehelper],[nothingupgradedyet,tool_qeupgradehelper] MOV [notupgradedsiterequired,local_qeupgradehelper],[notupgradedsiterequired,tool_qeupgradehelper] MOV [numberofattempts,local_qeupgradehelper],[numberofattempts,tool_qeupgradehelper] MOV [oldsitedetected,local_qeupgradehelper],[oldsitedetected,tool_qeupgradehelper] MOV [outof,local_qeupgradehelper],[outof,tool_qeupgradehelper] MOV [pluginname,local_qeupgradehelper],[pluginname,tool_qeupgradehelper] MOV [pretendupgrade,local_qeupgradehelper],[pretendupgrade,tool_qeupgradehelper] MOV [pretendupgrade_desc,local_qeupgradehelper],[pretendupgrade_desc,tool_qeupgradehelper] MOV [questionsessions,local_qeupgradehelper],[questionsessions,tool_qeupgradehelper] MOV [quizid,local_qeupgradehelper],[quizid,tool_qeupgradehelper] MOV [quizupgrade,local_qeupgradehelper],[quizupgrade,tool_qeupgradehelper] MOV [quizzesthatcanbereset,local_qeupgradehelper],[quizzesthatcanbereset,tool_qeupgradehelper] MOV [quizzestobeupgraded,local_qeupgradehelper],[quizzestobeupgraded,tool_qeupgradehelper] MOV [quizzeswithunconverted,local_qeupgradehelper],[quizzeswithunconverted,tool_qeupgradehelper] MOV [resetquiz,local_qeupgradehelper],[resetquiz,tool_qeupgradehelper] MOV [resetcomplete,local_qeupgradehelper],[resetcomplete,tool_qeupgradehelper] MOV [resettingquizattempts,local_qeupgradehelper],[resettingquizattempts,tool_qeupgradehelper] MOV [resettingquizattemptsprogress,local_qeupgradehelper],[resettingquizattemptsprogress,tool_qeupgradehelper] MOV [upgradingquizattempts,local_qeupgradehelper],[upgradingquizattempts,tool_qeupgradehelper] MOV [upgradedsitedetected,local_qeupgradehelper],[upgradedsitedetected,tool_qeupgradehelper] MOV [upgradedsiterequired,local_qeupgradehelper],[upgradedsiterequired,tool_qeupgradehelper] MOV [veryoldattemtps,local_qeupgradehelper],[veryoldattemtps,tool_qeupgradehelper] AMOS END
169 lines
6.0 KiB
PHP
169 lines
6.0 KiB
PHP
<?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/>.
|
|
|
|
/**
|
|
* Defines the renderer for the question engine upgrade helper plugin.
|
|
*
|
|
* @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();
|
|
|
|
|
|
/**
|
|
* Renderer for the question engine upgrade helper plugin.
|
|
*
|
|
* @copyright 2010 The Open University
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
class tool_qeupgradehelper_renderer extends plugin_renderer_base {
|
|
|
|
/**
|
|
* Render the index page.
|
|
* @param string $detected information about what sort of site was detected.
|
|
* @param array $actions list of actions to show on this page.
|
|
* @return string html to output.
|
|
*/
|
|
public function index_page($detected, array $actions) {
|
|
$output = '';
|
|
$output .= $this->header();
|
|
$output .= $this->heading(get_string('pluginname', 'tool_qeupgradehelper'));
|
|
$output .= $this->box($detected);
|
|
$output .= html_writer::start_tag('ul');
|
|
foreach ($actions as $action) {
|
|
$output .= html_writer::tag('li',
|
|
html_writer::link($action->url, $action->name) . ' - ' .
|
|
$action->description);
|
|
}
|
|
$output .= html_writer::end_tag('ul');
|
|
$output .= $this->footer();
|
|
return $output;
|
|
}
|
|
|
|
/**
|
|
* Render a page that is just a simple message.
|
|
* @param string $message the message to display.
|
|
* @return string html to output.
|
|
*/
|
|
public function simple_message_page($message) {
|
|
$output = '';
|
|
$output .= $this->header();
|
|
$output .= $this->heading($message);
|
|
$output .= $this->back_to_index();
|
|
$output .= $this->footer();
|
|
return $output;
|
|
}
|
|
|
|
/**
|
|
* Render the list of quizzes that still need to be upgraded page.
|
|
* @param array $quizzes of data about quizzes.
|
|
* @param int $numveryoldattemtps only relevant before upgrade.
|
|
* @return string html to output.
|
|
*/
|
|
public function quiz_list_page(tool_qeupgradehelper_quiz_list $quizzes,
|
|
$numveryoldattemtps = null) {
|
|
$output = '';
|
|
$output .= $this->header();
|
|
$output .= $this->heading($quizzes->title);
|
|
$output .= $this->box($quizzes->intro);
|
|
|
|
$table = new html_table();
|
|
$table->head = $quizzes->get_col_headings();
|
|
|
|
$rowcount = 0;
|
|
foreach ($quizzes->quizlist as $quizinfo) {
|
|
$table->data[$rowcount] = $quizzes->get_row($quizinfo);
|
|
if ($class = $quizzes->get_row_class($quizinfo)) {
|
|
$table->rowclasses[$rowcount] = $class;
|
|
}
|
|
$rowcount += 1;
|
|
}
|
|
$table->data[] = $quizzes->get_total_row();
|
|
$output .= html_writer::table($table);
|
|
|
|
if ($numveryoldattemtps) {
|
|
$output .= $this->box(get_string('veryoldattemtps', 'tool_qeupgradehelper',
|
|
$numveryoldattemtps));
|
|
}
|
|
|
|
$output .= $this->back_to_index();
|
|
$output .= $this->footer();
|
|
return $output;
|
|
}
|
|
|
|
/**
|
|
* Render the are-you-sure page to confirm a manual upgrade.
|
|
* @param object $quizsummary data about the quiz to upgrade.
|
|
* @return string html to output.
|
|
*/
|
|
public function convert_quiz_are_you_sure($quizsummary) {
|
|
$output = '';
|
|
$output .= $this->header();
|
|
$output .= $this->heading(get_string('areyousure', 'tool_qeupgradehelper'));
|
|
|
|
$params = array('quizid' => $quizsummary->id, 'confirmed' => 1, 'sesskey' => sesskey());
|
|
$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;
|
|
}
|
|
|
|
/**
|
|
* Render the are-you-sure page to confirm a manual reset.
|
|
* @param object $quizsummary data about the quiz to reset.
|
|
* @return string html to output.
|
|
*/
|
|
public function reset_quiz_are_you_sure($quizsummary) {
|
|
$output = '';
|
|
$output .= $this->header();
|
|
$output .= $this->heading(get_string('areyousure', 'tool_qeupgradehelper'));
|
|
|
|
$params = array('quizid' => $quizsummary->id, 'confirmed' => 1, 'sesskey' => sesskey());
|
|
$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;
|
|
}
|
|
|
|
/**
|
|
* Render a link in a div, such as the 'Back to plugin main page' link.
|
|
* @param $url the link URL.
|
|
* @param $text the link text.
|
|
* @return string html to output.
|
|
*/
|
|
public function end_of_page_link($url, $text) {
|
|
return html_writer::tag('div', html_writer::link($url ,$text),
|
|
array('class' => 'mdl-align'));
|
|
}
|
|
|
|
/**
|
|
* Output a link back to the plugin index page.
|
|
* @return string html to output.
|
|
*/
|
|
public function back_to_index() {
|
|
return $this->end_of_page_link(tool_qeupgradehelper_url('index'),
|
|
get_string('backtoindex', 'tool_qeupgradehelper'));
|
|
}
|
|
}
|