From 4d43f77f581bddd4aaf282cda8364848d905e7c0 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Fri, 8 Aug 2014 14:35:16 +0800 Subject: [PATCH] MDL-46570 gradereport_history: Update the logic of button helper method Part of MDL-46191 --- grade/report/history/classes/helper.php | 39 ++++++++++++----------- grade/report/history/lib.php | 41 ------------------------- 2 files changed, 21 insertions(+), 59 deletions(-) diff --git a/grade/report/history/classes/helper.php b/grade/report/history/classes/helper.php index c5e71182586..e6d5777623c 100644 --- a/grade/report/history/classes/helper.php +++ b/grade/report/history/classes/helper.php @@ -35,6 +35,7 @@ defined('MOODLE_INTERNAL') || die; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class helper { + /** * Get an instance of the user select button {@link gradereport_history_user_button}. * @@ -45,34 +46,36 @@ class helper { */ public static function get_user_select_button($courseid, $currentusers = array()) { global $PAGE; - $button = new output\user_button($PAGE->url, get_string('selectuser', 'gradereport_history'), 'get'); + $button = new output\user_button($PAGE->url, get_string('selectusers', 'gradereport_history'), 'get'); $button->class .= ' gradereport_history_plugin'; - $modules = array('moodle-gradereport_history-quickselect', 'moodle-gradereport_history-quickselect-skin'); + $module = array('moodle-gradereport_history-userselector'); $arguments = array( - 'courseid' => $courseid, - 'ajaxurl' => '/grade/report/history/ajax.php', - 'url' => $PAGE->url->out(false), - 'userfullnames' => $currentusers, + 'courseid' => $courseid, + 'ajaxurl' => '/grade/report/history/users_ajax.php', + 'url' => $PAGE->url->out(false), + 'userfullnames' => $currentusers, ); - $function = 'M.gradereport_history.quickselect.init'; - $button->require_yui_module($modules, $function, array($arguments)); + $function = 'Y.M.gradereport_history.UserSelector.init'; + $button->require_yui_module($module, $function, array($arguments)); $button->strings_for_js(array( - 'ajaxoneuserfound', - 'ajaxxusersfound', - 'ajaxnext25', 'errajaxsearch', - 'none', - 'usersearch' - ), 'enrol'); - $button->strings_for_js(array( - 'deselect', - 'selectuser', 'finishselectingusers', + 'foundoneuser', + 'foundnusers', + 'loadmoreusers', + 'selectusers', ), 'gradereport_history'); - $button->strings_for_js('select'); + $button->strings_for_js(array( + 'loading' + ), 'admin'); + $button->strings_for_js(array( + 'noresults', + 'search' + )); return $button; } + } diff --git a/grade/report/history/lib.php b/grade/report/history/lib.php index 95debcc040d..378bff69b07 100644 --- a/grade/report/history/lib.php +++ b/grade/report/history/lib.php @@ -644,45 +644,4 @@ class grade_report_history extends grade_report { return $arrows; } - /** - * Get an instance of the user select button {@link gradereport_history_user_button}. - * - * @param int $courseid course id - * @param array $currentusers List of currently selected users. - * - * @return gradereport_history_user_button the user select button. - */ - public static function get_user_select_button($courseid, $currentusers = array()) { - global $PAGE; - $button = new gradereport_history_user_button($PAGE->url, get_string('selectusers', 'gradereport_history'), 'get'); - $button->class .= ' gradereport_history_plugin'; - - $modules = array('moodle-gradereport_history-userselector'); - $arguments = array( - 'courseid' => $courseid, - 'ajaxurl' => '/grade/report/history/users_ajax.php', - 'url' => $PAGE->url->out(false), - 'userfullnames' => $currentusers, - ); - - $function = 'Y.M.gradereport_history.UserSelector.init'; - $button->require_yui_module($modules, $function, array($arguments)); - $button->strings_for_js(array( - 'errajaxsearch', - 'finishselectingusers', - 'foundoneuser', - 'foundnusers', - 'loadmoreusers', - 'selectusers', - ), 'gradereport_history'); - $button->strings_for_js(array( - 'loading' - ), 'admin'); - $button->strings_for_js(array( - 'noresults', - 'search' - )); - - return $button; - } }