diff --git a/grade/report/history/classes/user_button.php b/grade/report/history/classes/output/user_button.php similarity index 91% rename from grade/report/history/classes/user_button.php rename to grade/report/history/classes/output/user_button.php index e73bc28a7ac..6fc6df9674c 100644 --- a/grade/report/history/classes/user_button.php +++ b/grade/report/history/classes/output/user_button.php @@ -23,6 +23,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +namespace gradereport_history\output; + defined('MOODLE_INTERNAL') || die; /** @@ -34,7 +36,7 @@ defined('MOODLE_INTERNAL') || die; * @author Adam Olley * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class gradereport_history_user_button extends single_button { +class user_button extends \single_button implements \renderable { /** * An array containing JS YUI modules required by this button @@ -57,11 +59,11 @@ class gradereport_history_user_button extends single_button { /** * Initialises the new select_user_button. * - * @param moodle_url $url + * @param \moodle_url $url * @param string $label The text to display in the button * @param string $method Either post or get */ - public function __construct(moodle_url $url, $label, $method = 'post') { + public function __construct(\moodle_url $url, $label, $method = 'post') { static $count = 0; // The number of select user buttons already created. $count ++; parent::__construct($url, $label, $method); @@ -79,7 +81,7 @@ class gradereport_history_user_button extends single_button { * @param bool $ondomready If true the call is postponed until the DOM is finished loading */ public function require_yui_module($modules, $function, array $arguments = null, $galleryversion = null, $ondomready = false) { - $js = new stdClass; + $js = new \stdClass; $js->modules = (array)$modules; $js->function = $function; $js->arguments = $arguments; @@ -97,7 +99,7 @@ class gradereport_history_user_button extends single_button { * @param array $module A module definition */ public function require_js_init_call($function, array $extraarguments = null, $ondomready = false, array $module = null) { - $js = new stdClass; + $js = new \stdClass; $js->function = $function; $js->extraarguments = $extraarguments; $js->ondomready = $ondomready; @@ -108,12 +110,12 @@ class gradereport_history_user_button extends single_button { /** * Requires strings for JS that will be loaded when the button is used. * - * @param array|stdClass $identifiers + * @param array|\stdClass $identifiers * @param string $component * @param mixed $a */ public function strings_for_js($identifiers, $component = 'moodle', $a = null) { - $string = new stdClass; + $string = new \stdClass; $string->identifiers = (array)$identifiers; $string->component = $component; $string->a = $a; @@ -123,9 +125,9 @@ class gradereport_history_user_button extends single_button { /** * Initialises the JS that is required by this button. * - * @param moodle_page $page + * @param \moodle_page $page */ - public function initialise_js(moodle_page $page) { + public function initialise_js(\moodle_page $page) { foreach ($this->jsyuimodules as $js) { $page->requires->yui_module($js->modules, $js->function, $js->arguments, $js->galleryversion, $js->ondomready); } diff --git a/grade/report/history/index.php b/grade/report/history/index.php index cf5205355f3..f97be104ac1 100644 --- a/grade/report/history/index.php +++ b/grade/report/history/index.php @@ -108,7 +108,7 @@ $filters['userfullnames'] = implode(',', $names); // Now that we have the names, reinitialise the button so its able to control them. $button = grade_report_history::get_user_select_button($course->id, $names); -$userbutton = $output->render_select_user_button($button); +$userbutton = $output->render($button); $params = array('course' => $course, 'itemids' => $itemids, 'graders' => $graders, 'userbutton' => $userbutton); $mform = new gradereport_history_filter_form(null, $params); $mform->set_data($filters); diff --git a/grade/report/history/renderer.php b/grade/report/history/renderer.php index 756f58f54e0..f01ad98412b 100644 --- a/grade/report/history/renderer.php +++ b/grade/report/history/renderer.php @@ -39,11 +39,11 @@ class gradereport_history_renderer extends plugin_renderer_base { /** * Render for the select user button. * - * @param gradereport_history_user_button $button instance of gradereport_history_user_button to render + * @param user_button $button instance of gradereport_history_user_button to render * * @return string HTML to display */ - public function render_select_user_button(gradereport_history_user_button $button) { + public function render_user_button(user_button $button) { $attributes = array('type' => 'button', 'class' => 'selectortrigger', 'value' => $button->label,