|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00027 defined('MOODLE_INTERNAL') || die(); 00028 00032 class core_grading_renderer extends plugin_renderer_base { 00033 00041 public function management_method_selector(grading_manager $manager, moodle_url $targeturl) { 00042 00043 $method = $manager->get_active_method(); 00044 $methods = $manager->get_available_methods(false); 00045 $methods['none'] = get_string('gradingmethodnone', 'core_grading'); 00046 $selector = new single_select(new moodle_url($targeturl, array('sesskey' => sesskey())), 00047 'setmethod', $methods, empty($method) ? 'none' : $method, null, 'activemethodselector'); 00048 $selector->set_label(get_string('changeactivemethod', 'core_grading')); 00049 $selector->set_help_icon('gradingmethod', 'core_grading'); 00050 00051 return $this->output->render($selector); 00052 } 00053 00062 public function management_action_icon(moodle_url $url, $text, $icon) { 00063 00064 $img = html_writer::empty_tag('img', array('src' => $this->output->pix_url($icon), 'class' => 'action-icon')); 00065 $txt = html_writer::tag('div', $text, array('class' => 'action-text')); 00066 return html_writer::link($url, $img . $txt, array('class' => 'action')); 00067 } 00068 00075 public function management_message($message) { 00076 $this->page->requires->strings_for_js(array('clicktoclose'), 'core_grading'); 00077 $this->page->requires->yui_module('moodle-core_grading-manage', 'M.core_grading.init_manage'); 00078 return $this->output->box(format_string($message).html_writer::tag('span', ''), 'message', 'actionresultmessagebox'); 00079 } 00080 00090 public function pick_action_icon(moodle_url $url, $text, $icon = '', $class = '') { 00091 00092 $img = html_writer::empty_tag('img', array('src' => $this->output->pix_url($icon), 'class' => 'action-icon')); 00093 $txt = html_writer::tag('div', $text, array('class' => 'action-text')); 00094 return html_writer::link($url, $img . $txt, array('class' => 'action '.$class)); 00095 } 00096 }