From 0610812acaf20053cb56aba7a1dd6e785848734e Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 17 Jul 2007 05:52:42 +0000 Subject: [PATCH] MDL-10438 inline docs added --- grade/lib.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/grade/lib.php b/grade/lib.php index d8b2a7ff63..3a138d973a 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -1,5 +1,14 @@ wwwroot.'/grade/', $menu, 'choosepluginreport', $active, 'choose', '', '', $return, 'self', get_string('selectplugin', 'grades')); } +/** + * Utility class used for return tracking when using edit and other forms from grade plubins + */ class grade_plugin_return { var $type; var $plugin; @@ -102,6 +114,10 @@ class grade_plugin_return { var $userid; var $page; + /** + * Constructor + * @param array $params - associative array with return parameters, if null parameter are taken from _GET or _POST + */ function grade_plugin_return ($params=null) { if (empty($params)) { $this->type = optional_param('gpr_type', null, PARAM_SAFEDIR); @@ -119,6 +135,10 @@ class grade_plugin_return { } } + /** + * Returns return parameters as options array suitable for buttons. + * @return array options + */ function get_options() { if (empty($this->type) or empty($this->plugin)) { return array(); @@ -143,6 +163,11 @@ class grade_plugin_return { return $params; } + /** + * Returns return url + * @param string $default default url when params not set + * @return string url + */ function get_return_url($default) { global $CFG; @@ -176,6 +201,10 @@ class grade_plugin_return { return $url; } + /** + * Returns string with hidden return tracking form elements. + * @return string + */ function get_form_fields() { if (empty($this->type) or empty($this->plugin)) { return ''; @@ -197,6 +226,11 @@ class grade_plugin_return { } } + /** + * Add hidden elements into mform + * @param object $mform moodle form object + * @return void + */ function add_mform_elements(&$mform) { if (empty($this->type) or empty($this->plugin)) { return; @@ -224,6 +258,11 @@ class grade_plugin_return { } } + /** + * Add return tracking params into url + * @param string $url + * @return string $url with erturn tracking params + */ function add_url_params($url) { if (empty($this->type) or empty($this->plugin)) { return $url; -- 2.39.5