mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
82 lines
3.0 KiB
PHP
82 lines
3.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/>.
|
||
|
|
||
|
/**
|
||
|
* Renderer for core_grading subsystem
|
||
|
*
|
||
|
* @package core
|
||
|
* @subpackage grading
|
||
|
* @copyright 2011 David Mudrak <david@moodle.com>
|
||
|
* @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())),
|
||
|
'activemethod', $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));
|
||
|
}
|
||
|
}
|