. /** * Renderer for core_grading subsystem * * @package core * @subpackage grading * @copyright 2011 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * Standard HTML output renderer for core_grading subsystem */ class core_grading_renderer extends plugin_renderer_base { /** * Renders the active method selector at the grading method management screen * * @param grading_manager $gradingman * @param moodle_url $targeturl * @return string */ public function management_method_selector(grading_manager $manager, moodle_url $targeturl) { $method = $manager->get_active_method(); $methods = $manager->get_available_methods(false); $methods['none'] = get_string('gradingmethodnone', 'core_grading'); $selector = new single_select(new moodle_url($targeturl, array('sesskey' => sesskey())), 'setmethod', $methods, empty($method) ? 'none' : $method, null, 'activemethodselector'); $selector->set_label(get_string('changeactivemethod', 'core_grading')); $selector->set_help_icon('gradingmethod', 'core_grading'); return $this->output->render($selector); } /** * Renders an action icon at the gradng method management screen * * @param moodle_url $url action URL * @param string $text action text * @param string $icon the name of the icon to use * @return string */ public function management_action_icon(moodle_url $url, $text, $icon) { $img = html_writer::empty_tag('img', array('src' => $this->output->pix_url($icon), 'class' => 'action-icon')); $txt = html_writer::tag('div', $text, array('class' => 'action-text')); return html_writer::link($url, $img . $txt, array('class' => 'action')); } /** * Renders the common information about the form definition * * @param gradingform_controller $controller * @return string */ public function preview_definition_header(gradingform_controller $controller) { $definition = $controller->get_definition(); // todo make this nicer, append the information about the time created/modified etc return $this->output->heading(format_text($definition->name)); } }