Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/admin/tool/qeupgradehelper/renderer.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00027 defined('MOODLE_INTERNAL') || die();
00028 
00029 
00036 class tool_qeupgradehelper_renderer extends plugin_renderer_base {
00037 
00044     public function index_page($detected, array $actions) {
00045         $output = '';
00046         $output .= $this->header();
00047         $output .= $this->heading(get_string('pluginname', 'tool_qeupgradehelper'));
00048         $output .= $this->box($detected);
00049         $output .= html_writer::start_tag('ul');
00050         foreach ($actions as $action) {
00051             $output .= html_writer::tag('li',
00052                     html_writer::link($action->url, $action->name) . ' - ' .
00053                     $action->description);
00054         }
00055         $output .= html_writer::end_tag('ul');
00056         $output .= $this->footer();
00057         return $output;
00058     }
00059 
00065     public function simple_message_page($message) {
00066         $output = '';
00067         $output .= $this->header();
00068         $output .= $this->heading($message);
00069         $output .= $this->back_to_index();
00070         $output .= $this->footer();
00071         return $output;
00072     }
00073 
00080     public function quiz_list_page(tool_qeupgradehelper_quiz_list $quizzes,
00081             $numveryoldattemtps = null) {
00082         $output = '';
00083         $output .= $this->header();
00084         $output .= $this->heading($quizzes->title);
00085         $output .= $this->box($quizzes->intro);
00086 
00087         $table = new html_table();
00088         $table->head = $quizzes->get_col_headings();
00089 
00090         $rowcount = 0;
00091         foreach ($quizzes->quizlist as $quizinfo) {
00092             $table->data[$rowcount] = $quizzes->get_row($quizinfo);
00093             if ($class = $quizzes->get_row_class($quizinfo)) {
00094                 $table->rowclasses[$rowcount] = $class;
00095             }
00096             $rowcount += 1;
00097         }
00098         $table->data[] = $quizzes->get_total_row();
00099         $output .= html_writer::table($table);
00100 
00101         if ($numveryoldattemtps) {
00102             $output .= $this->box(get_string('veryoldattemtps', 'tool_qeupgradehelper',
00103                     $numveryoldattemtps));
00104         }
00105 
00106         $output .= $this->back_to_index();
00107         $output .= $this->footer();
00108         return $output;
00109     }
00110 
00116     public function convert_quiz_are_you_sure($quizsummary) {
00117         $output = '';
00118         $output .= $this->header();
00119         $output .= $this->heading(get_string('areyousure', 'tool_qeupgradehelper'));
00120 
00121         $params = array('quizid' => $quizsummary->id, 'confirmed' => 1, 'sesskey' => sesskey());
00122         $output .= $this->confirm(get_string('areyousuremessage', 'tool_qeupgradehelper', $quizsummary),
00123                 new single_button(tool_qeupgradehelper_url('convertquiz', $params), get_string('yes')),
00124                 tool_qeupgradehelper_url('listtodo'));
00125 
00126         $output .= $this->footer();
00127         return $output;
00128     }
00129 
00135     public function reset_quiz_are_you_sure($quizsummary) {
00136         $output = '';
00137         $output .= $this->header();
00138         $output .= $this->heading(get_string('areyousure', 'tool_qeupgradehelper'));
00139 
00140         $params = array('quizid' => $quizsummary->id, 'confirmed' => 1, 'sesskey' => sesskey());
00141         $output .= $this->confirm(get_string('areyousureresetmessage', 'tool_qeupgradehelper', $quizsummary),
00142                 new single_button(tool_qeupgradehelper_url('resetquiz', $params), get_string('yes')),
00143                 tool_qeupgradehelper_url('listupgraded'));
00144 
00145         $output .= $this->footer();
00146         return $output;
00147     }
00148 
00155     public function end_of_page_link($url, $text) {
00156         return html_writer::tag('div', html_writer::link($url ,$text),
00157                 array('class' => 'mdl-align'));
00158     }
00159 
00164     public function back_to_index() {
00165         return $this->end_of_page_link(tool_qeupgradehelper_url('index'),
00166                 get_string('backtoindex', 'tool_qeupgradehelper'));
00167     }
00168 }
 All Data Structures Namespaces Files Functions Variables Enumerations