Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402] [Versions 402 and 403]
Functions used by gradebook plugins and reports.
Copyright: | 2009 Petr Skoda and Nicolas Connault |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 4054 lines (155 kb) |
Included or required: | 1 time |
Referenced: | 34 times |
Includes or requires: | 0 files |
graded_users_iterator:: (19 methods):
__construct()
init()
next_user()
close()
require_active_enrolment()
allow_user_custom_fields()
_push()
_pop()
print_graded_users_selector()
grade_get_graded_users_select()
hide_natural_aggregation_upgrade_notice()
grade_hide_min_max_grade_upgrade_notice()
grade_upgrade_use_min_max_from_grade_grade()
grade_upgrade_use_min_max_from_grade_item()
hide_aggregatesubcats_upgrade_notice()
hide_gradebook_calculations_freeze_notice()
print_natural_aggregation_upgrade_notice()
grade_get_plugin_info()
get_gradable_users()
grade_plugin_info:: (2 methods):
__construct()
print_grade_page_head()
grade_plugin_return:: (2 methods):
__construct()
grade_plugin_return()
name:: (23 methods):
get_options()
get_return_url()
get_form_fields()
add_mform_elements()
add_url_params()
grade_build_nav()
flatten()
locate_element()
category_collapse()
no_outcomes()
category_grade_last()
fill_levels()
can_output_item()
inject_fillers()
inject_colspans()
locate_element()
exporttoxml()
exporttojson()
get_levels()
get_items()
get_item()
grade_button()
grade_extend_settings()
grade_structure:: (27 methods):
get_element_icon()
get_element_type_string()
get_element_header()
get_activity_link()
get_grade_analysis_url()
get_grade_analysis_icon()
get_grade_analysis_link()
get_grade_action_menu()
get_grade_eid()
get_item_eid()
get_params_for_iconstr()
get_reset_icon()
get_reset_weights_link()
get_delete_link()
get_duplicate_link()
get_edit_icon()
get_edit_link()
get_advanced_grading_link()
get_hiding_icon()
get_hiding_link()
get_locking_icon()
get_locking_link()
get_calculation_icon()
get_edit_calculation_link()
set_grade_status_icons()
get_cell_action_menu()
get_sorting_link()
grade_seq:: (2 methods):
__construct()
grade_seq()
name:: (23 methods):
get_options()
get_return_url()
get_form_fields()
add_mform_elements()
add_url_params()
grade_build_nav()
flatten()
locate_element()
category_collapse()
no_outcomes()
category_grade_last()
fill_levels()
can_output_item()
inject_fillers()
inject_colspans()
locate_element()
exporttoxml()
exporttojson()
get_levels()
get_items()
get_item()
grade_button()
grade_extend_settings()
grade_tree:: (2 methods):
__construct()
grade_tree()
name:: (23 methods):
get_options()
get_return_url()
get_form_fields()
add_mform_elements()
add_url_params()
grade_build_nav()
flatten()
locate_element()
category_collapse()
no_outcomes()
category_grade_last()
fill_levels()
can_output_item()
inject_fillers()
inject_colspans()
locate_element()
exporttoxml()
exporttojson()
get_levels()
get_items()
get_item()
grade_button()
grade_extend_settings()
grade_helper:: (14 methods):
get_lang_string()
get_plugin_strings()
get_aggregation_strings()
get_info_manage_settings()
get_plugins_reports()
get_info_scales()
get_info_outcomes()
get_info_letters()
get_plugins_import()
get_plugins_export()
get_user_field_value()
get_user_profile_fields()
fetch_all_natural_weights_for_course()
reset_caches()
Class: graded_users_iterator - X-Ref
This class iterates over all users that are graded in a course.__construct($course, $grade_items=null, $groupid=0,$sortfield1='lastname', $sortorder1='ASC',$sortfield2='firstname', $sortorder2='ASC') X-Ref |
Constructor param: object $course A course object param: array $grade_items array of grade items, if not specified only user info returned param: int $groupid iterate only group users if present param: string $sortfield1 The first field of the users table by which the array of users will be sorted param: string $sortorder1 The order in which the first sorting field will be sorted (ASC or DESC) param: string $sortfield2 The second field of the users table by which the array of users will be sorted param: string $sortorder2 The order in which the second sorting field will be sorted (ASC or DESC) |
init() X-Ref |
Initialise the iterator return: boolean success |
next_user() X-Ref |
Returns information about the next user return: mixed array of user info, all grades and feedback or null when no more users found |
close() X-Ref |
Close the iterator, do not forget to call this function |
require_active_enrolment($onlyactive = true) X-Ref |
Should all enrolled users be exported or just those with an active enrolment? param: bool $onlyactive True to limit the export to users with an active enrolment |
allow_user_custom_fields($allow = true) X-Ref |
Allow custom fields to be included param: bool $allow Whether to allow custom fields or not return: void |
_push($grade) X-Ref |
Add a grade_grade instance to the grade stack param: grade_grade $grade Grade object return: void |
_pop() X-Ref |
Remove a grade_grade instance from the grade stack return: grade_grade current grade object |
print_graded_users_selector($course, $actionpage, $userid=0, $groupid=0, $includeall=true, $return=false) X-Ref |
Print a selection popup form of the graded users in a course. param: int $course id of the course param: string $actionpage The page receiving the data from the popoup form param: int $userid id of the currently selected user (or 'all' if they are all selected) param: int $groupid id of requested group, 0 means all param: int $includeall bool include all option param: bool $return If true, will return the HTML, otherwise, will print directly return: null |
grade_get_graded_users_select($report, $course, $userid, $groupid, $includeall) X-Ref |
No description |
hide_natural_aggregation_upgrade_notice($courseid) X-Ref |
Hide warning about changed grades during upgrade to 2.8. param: int $courseid The current course id. |
grade_hide_min_max_grade_upgrade_notice($courseid) X-Ref |
Hide warning about changed grades during upgrade from 2.8.0-2.8.6 and 2.9.0. param: int $courseid The current course id. |
grade_upgrade_use_min_max_from_grade_grade($courseid) X-Ref |
Use the grade min and max from the grade_grade. This is reserved for core use after an upgrade. param: int $courseid The current course id. |
grade_upgrade_use_min_max_from_grade_item($courseid) X-Ref |
Use the grade min and max from the grade_item. This is reserved for core use after an upgrade. param: int $courseid The current course id. |
hide_aggregatesubcats_upgrade_notice($courseid) X-Ref |
Hide warning about changed grades during upgrade to 2.8. param: int $courseid The current course id. |
hide_gradebook_calculations_freeze_notice($courseid) X-Ref |
Hide warning about changed grades due to bug fixes param: int $courseid The current course id. |
print_natural_aggregation_upgrade_notice($courseid, $context, $thispage, $return=false) X-Ref |
Print warning about changed grades during upgrade to 2.8. param: int $courseid The current course id. param: context $context The course context. param: string $thispage The relative path for the current page. E.g. /grade/report/user/index.php param: boolean $return return as string return: nothing or string if $return true |
grade_get_plugin_info($courseid, $active_type, $active_plugin) X-Ref |
grade_get_plugin_info param: int $courseid The course id param: string $active_type type of plugin on current page - import, export, report or edit param: string $active_plugin active plugin type - grader, user, cvs, ... return: array |
get_gradable_users(int $courseid, ?int $groupid = null, bool $onlyactiveenrol = false) X-Ref |
Load a valid list of gradable users in a course. param: int $courseid The course ID. param: int|null $groupid The group ID (optional). param: bool $onlyactiveenrol Include only active enrolments. return: array $users A list of enrolled gradable users. |
Class: grade_plugin_info - X-Ref
A simple class containing info about grade plugins.__construct($id, $link, $string, $parent=null) X-Ref |
Constructor param: int $id A unique id for this plugin param: string $link A URL to access this plugin param: string $string The name of this plugin param: object $parent Another grade_plugin_info object, parent of the current one return: void |
print_grade_page_head(int $courseid, string $active_type, ?string $active_plugin = null, $heading = false,bool $return = false, $buttons = false, bool $shownavigation = true, ?string $headerhelpidentifier = null,?string $headerhelpcomponent = null, ?stdClass $user = null, ?action_bar $actionbar = null, $showtitle = true) X-Ref |
Prints the page headers, breadcrumb trail, page heading, (optional) navigation and for any gradebook page. All gradebook pages MUST use these functions in favour of the usual print_header(), print_header_simple(), print_heading() etc. param: int $courseid Course id param: string $active_type The type of the current page (report, settings, param: string|null $active_plugin The plugin of the current page (grader, fullview etc...) param: string|bool $heading The heading of the page. Tries to guess if none is given param: boolean $return Whether to return (true) or echo (false) the HTML generated by this function param: string|bool $buttons Additional buttons to display on the page param: boolean $shownavigation should the gradebook navigation be shown? param: string|null $headerhelpidentifier The help string identifier if required. param: string|null $headerhelpcomponent The component for the help string. param: stdClass|null $user The user object for use with the user context header. param: action_bar|null $actionbar The actions bar which will be displayed on the page if $shownavigation is set param: boolean $showtitle If set to false just show course full name as a title. return: string HTML code or nothing if $return == false |
Class: grade_plugin_return - X-Ref
Utility class used for return tracking when using edit and other forms in grade plugins__construct($params = []) X-Ref |
Constructor param: array $params - associative array with return parameters, if not supplied parameter are taken from _GET or _POST |
grade_plugin_return($params = null) X-Ref |
Old syntax of class constructor. Deprecated in PHP7. |
get_options() X-Ref |
Returns return parameters as options array suitable for buttons. return: array options |
get_return_url($default, $extras=null) X-Ref |
Returns return url param: string $default default url when params not set param: array $extras Extra URL parameters return: string url |
get_form_fields() X-Ref |
Returns string with hidden return tracking form elements. return: string |
add_mform_elements(&$mform) X-Ref |
Add hidden elements into mform param: object &$mform moodle form object return: void |
add_url_params(moodle_url $url) X-Ref |
Add return tracking params into url param: moodle_url $url A URL return: moodle_url with return tracking params |
grade_build_nav($path, $pagename=null, $id=null) X-Ref |
Function central to gradebook for building and printing the navigation (breadcrumb trail). param: string $path The path of the calling script (using __FILE__?) param: string $pagename The language string to use as the last part of the navigation (non-link) param: mixed $id Either a plain integer (assuming the key is 'id') or return: string |
flatten(&$element, $category_grade_last, $nooutcomes) X-Ref |
Static recursive helper - makes the grade_item for category the last children param: array &$element The seed of the recursion param: bool $category_grade_last category grade item is the last child param: bool $nooutcomes Whether or not outcomes should be included return: array |
locate_element($eid) X-Ref |
Parses the array in search of a given eid and returns a element object with information about the element it has found. param: int $eid Gradetree Element ID return: object element |
category_collapse(&$element, $collapsed) X-Ref |
Static recursive helper - removes items from collapsed categories param: array &$element The seed of the recursion param: array $collapsed array of collapsed categories return: void |
no_outcomes(&$element) X-Ref |
Static recursive helper - removes all outcomes param: array &$element The seed of the recursion return: void |
category_grade_last(&$element) X-Ref |
Static recursive helper - makes the grade_item for category the last children param: array &$element The seed of the recursion return: void |
fill_levels(&$levels, &$element, $depth) X-Ref |
Static recursive helper - fills the levels array, useful when accessing tree elements of one level param: array &$levels The levels of the grade tree through which to recurse param: array &$element The seed of the recursion param: int $depth How deep are we? return: void |
can_output_item($element) X-Ref |
Determines whether the grade tree item can be displayed. This is particularly targeted for grade categories that have no total (None) when rendering the grade tree. It checks if the grade tree item is of type 'category', and makes sure that the category, or at least one of children, can be output. param: array $element The grade category element. return: bool True if the grade tree item can be displayed. False, otherwise. |
inject_fillers(&$element, $depth) X-Ref |
Static recursive helper - makes full tree (all leafes are at the same level) param: array &$element The seed of the recursion param: int $depth How deep are we? return: int |
inject_colspans(&$element) X-Ref |
Static recursive helper - add colspan information into categories param: array &$element The seed of the recursion return: int |
locate_element($eid) X-Ref |
Parses the array in search of a given eid and returns a element object with information about the element it has found. param: int $eid Gradetree Element ID return: object element |
exporttoxml($root=null, $tabs="\t") X-Ref |
Returns a well-formed XML representation of the grade-tree using recursion. param: array $root The current element in the recursion. If null, starts at the top of the tree. param: string $tabs The control character to use for tabs return: string $xml |
exporttojson($root=null, $tabs="\t") X-Ref |
Returns a JSON representation of the grade-tree using recursion. param: array $root The current element in the recursion. If null, starts at the top of the tree. param: string $tabs Tab characters used to indent the string nicely for humans to enjoy return: string |
get_levels() X-Ref |
Returns the array of levels return: array |
get_items() X-Ref |
Returns the array of grade items return: array |
get_item($itemid) X-Ref |
Returns a specific Grade Item param: int $itemid The ID of the grade_item object return: grade_item |
grade_button($type, $courseid, $object) X-Ref |
Local shortcut function for creating an edit/delete button for a grade_* object. param: string $type 'edit' or 'delete' param: int $courseid The Course ID param: grade_* $object The grade_* object return: string html |
grade_extend_settings($plugininfo, $courseid) X-Ref |
This method adds settings to the settings block for the grade system and its plugins |
Class: grade_structure - X-Ref
General structure representing grade items in courseget_element_icon(&$element, $spacerifnone=false) X-Ref |
Returns icon of element param: array &$element An array representing an element in the grade_tree param: bool $spacerifnone return spacer if no icon found return: string icon or spacer |
get_element_type_string(array $element) X-Ref |
Returns the string that describes the type of the element. param: array $element An array representing an element in the grade_tree return: string The string that describes the type of the grade element |
get_element_header(array &$element, bool $withlink = false, bool $icon = true,bool $spacerifnone = false, bool $withdescription = false, bool $fulltotal = false,?moodle_url $sortlink = null) X-Ref |
Returns name of element optionally with icon and link param: array &$element An array representing an element in the grade_tree param: bool $withlink Whether or not this header has a link param: bool $icon Whether or not to display an icon with this header param: bool $spacerifnone return spacer if no icon found param: bool $withdescription Show description if defined by this item. param: bool $fulltotal If the item is a category total, returns $categoryname."total" param: moodle_url|null $sortlink Link to sort column. return: string header |
get_activity_link($element) X-Ref |
No description |
get_grade_analysis_url(grade_grade $grade) X-Ref |
Returns URL of a page that is supposed to contain detailed grade analysis At the moment, only activity modules are supported. The method generates link to the module's file grade.php with the parameters id (cmid), itemid, itemnumber, gradeid and userid. If the grade.php does not exist, null is returned. return: moodle_url|null URL or null if unable to construct it |
get_grade_analysis_icon(grade_grade $grade) X-Ref |
Returns an action icon leading to the grade analysis page param: grade_grade $grade return: string |
get_grade_analysis_link(grade_grade $grade) X-Ref |
Returns a link leading to the grade analysis page param: grade_grade $grade return: string|null |
get_grade_action_menu(grade_grade $grade) X-Ref |
Returns an action menu for the grade. param: grade_grade $grade A grade_grade object return: string |
get_grade_eid($grade_grade) X-Ref |
Returns the grade eid - the grade may not exist yet. param: grade_grade $grade_grade A grade_grade object return: string eid |
get_item_eid($grade_item) X-Ref |
Returns the grade_item eid param: grade_item $grade_item A grade_item object return: string eid |
get_params_for_iconstr($element) X-Ref |
Given a grade_tree element, returns an array of parameters used to build an icon for that element. param: array $element An array representing an element in the grade_tree return: array |
get_reset_icon($element, $gpr, $returnactionmenulink = false) X-Ref |
Return a reset icon for the given element. param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object param: bool $returnactionmenulink return the instance of action_menu_link instead of string return: string|action_menu_link |
get_reset_weights_link(array $element, object $gpr) X-Ref |
Returns a link to reset weights for the given element. param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object return: string|null |
get_delete_link(array $element, object $gpr) X-Ref |
Returns a link to delete a given element. param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object return: string|null |
get_duplicate_link(array $element, object $gpr) X-Ref |
Returns a link to duplicate a given element. param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object return: string|null |
get_edit_icon($element, $gpr, $returnactionmenulink = false) X-Ref |
Return edit icon for give element param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object param: bool $returnactionmenulink return the instance of action_menu_link instead of string return: string|action_menu_link |
get_edit_link(array $element, object $gpr) X-Ref |
Returns a link leading to the edit grade/grade item/category page param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object return: string|null |
get_advanced_grading_link(array $element, object $gpr) X-Ref |
Returns link to the advanced grading page param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object return: string|null |
get_hiding_icon($element, $gpr, $returnactionmenulink = false) X-Ref |
Return hiding icon for give element param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object param: bool $returnactionmenulink return the instance of action_menu_link instead of string return: string|action_menu_link |
get_hiding_link(array $element, object $gpr) X-Ref |
Returns a link with url to hide/unhide grade/grade item/grade category param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object return: string|null |
get_locking_icon($element, $gpr) X-Ref |
Return locking icon for given element param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object return: string |
get_locking_link(array $element, object $gpr) X-Ref |
Returns link to lock/unlock grade/grade item/grade category param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object return: string|null |
get_calculation_icon($element, $gpr, $returnactionmenulink = false) X-Ref |
Return calculation icon for given element param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object param: bool $returnactionmenulink return the instance of action_menu_link instead of string return: string|action_menu_link |
get_edit_calculation_link(array $element, object $gpr) X-Ref |
Returns link to edit calculation for a grade item. param: array $element An array representing an element in the grade_tree param: object $gpr A grade_plugin_return object return: string|null |
set_grade_status_icons(array $element) X-Ref |
Sets status icons for the grade. param: array $element array with grade item info return: string status icons container HTML |
get_cell_action_menu(array $element, string $mode, grade_plugin_return $gpr,?moodle_url $baseurl = null) X-Ref |
Returns an action menu for the grade. param: array $element Array with cell info. param: string $mode Mode - gradeitem or user param: grade_plugin_return $gpr param: moodle_url|null $baseurl return: string |
get_sorting_link(moodle_url $sortlink, object $gpr, string $direction = 'asc') X-Ref |
Returns link to sort grade item column param: moodle_url $sortlink A base link for sorting param: object $gpr A grade_plugin_return object param: string $direction Direction od sorting return: string |
__construct($courseid, $category_grade_last=false, $nooutcomes=false) X-Ref |
Constructor, retrieves and stores array of all grade_category and grade_item objects for the given courseid. Full objects are instantiated. Ordering sequence is fixed if needed. param: int $courseid The course id param: bool $category_grade_last category grade item is the last child param: bool $nooutcomes Whether or not outcomes should be included |
grade_seq($courseid, $category_grade_last=false, $nooutcomes=false) X-Ref |
Old syntax of class constructor. Deprecated in PHP7. |
get_options() X-Ref |
Returns return parameters as options array suitable for buttons. return: array options |
get_return_url($default, $extras=null) X-Ref |
Returns return url param: string $default default url when params not set param: array $extras Extra URL parameters return: string url |
get_form_fields() X-Ref |
Returns string with hidden return tracking form elements. return: string |
add_mform_elements(&$mform) X-Ref |
Add hidden elements into mform param: object &$mform moodle form object return: void |
add_url_params(moodle_url $url) X-Ref |
Add return tracking params into url param: moodle_url $url A URL return: moodle_url with return tracking params |
grade_build_nav($path, $pagename=null, $id=null) X-Ref |
Function central to gradebook for building and printing the navigation (breadcrumb trail). param: string $path The path of the calling script (using __FILE__?) param: string $pagename The language string to use as the last part of the navigation (non-link) param: mixed $id Either a plain integer (assuming the key is 'id') or return: string |
flatten(&$element, $category_grade_last, $nooutcomes) X-Ref |
Static recursive helper - makes the grade_item for category the last children param: array &$element The seed of the recursion param: bool $category_grade_last category grade item is the last child param: bool $nooutcomes Whether or not outcomes should be included return: array |
locate_element($eid) X-Ref |
Parses the array in search of a given eid and returns a element object with information about the element it has found. param: int $eid Gradetree Element ID return: object element |
category_collapse(&$element, $collapsed) X-Ref |
Static recursive helper - removes items from collapsed categories param: array &$element The seed of the recursion param: array $collapsed array of collapsed categories return: void |
no_outcomes(&$element) X-Ref |
Static recursive helper - removes all outcomes param: array &$element The seed of the recursion return: void |
category_grade_last(&$element) X-Ref |
Static recursive helper - makes the grade_item for category the last children param: array &$element The seed of the recursion return: void |
fill_levels(&$levels, &$element, $depth) X-Ref |
Static recursive helper - fills the levels array, useful when accessing tree elements of one level param: array &$levels The levels of the grade tree through which to recurse param: array &$element The seed of the recursion param: int $depth How deep are we? return: void |
can_output_item($element) X-Ref |
Determines whether the grade tree item can be displayed. This is particularly targeted for grade categories that have no total (None) when rendering the grade tree. It checks if the grade tree item is of type 'category', and makes sure that the category, or at least one of children, can be output. param: array $element The grade category element. return: bool True if the grade tree item can be displayed. False, otherwise. |
inject_fillers(&$element, $depth) X-Ref |
Static recursive helper - makes full tree (all leafes are at the same level) param: array &$element The seed of the recursion param: int $depth How deep are we? return: int |
inject_colspans(&$element) X-Ref |
Static recursive helper - add colspan information into categories param: array &$element The seed of the recursion return: int |
locate_element($eid) X-Ref |
Parses the array in search of a given eid and returns a element object with information about the element it has found. param: int $eid Gradetree Element ID return: object element |
exporttoxml($root=null, $tabs="\t") X-Ref |
Returns a well-formed XML representation of the grade-tree using recursion. param: array $root The current element in the recursion. If null, starts at the top of the tree. param: string $tabs The control character to use for tabs return: string $xml |
exporttojson($root=null, $tabs="\t") X-Ref |
Returns a JSON representation of the grade-tree using recursion. param: array $root The current element in the recursion. If null, starts at the top of the tree. param: string $tabs Tab characters used to indent the string nicely for humans to enjoy return: string |
get_levels() X-Ref |
Returns the array of levels return: array |
get_items() X-Ref |
Returns the array of grade items return: array |
get_item($itemid) X-Ref |
Returns a specific Grade Item param: int $itemid The ID of the grade_item object return: grade_item |
grade_button($type, $courseid, $object) X-Ref |
Local shortcut function for creating an edit/delete button for a grade_* object. param: string $type 'edit' or 'delete' param: int $courseid The Course ID param: grade_* $object The grade_* object return: string html |
grade_extend_settings($plugininfo, $courseid) X-Ref |
This method adds settings to the settings block for the grade system and its plugins |
Class: grade_tree - X-Ref
This class represents a complete tree of categories, grade_items and final grades,__construct($courseid, $fillers=true, $category_grade_last=false,$collapsed=null, $nooutcomes=false) X-Ref |
Constructor, retrieves and stores a hierarchical array of all grade_category and grade_item objects for the given courseid. Full objects are instantiated. Ordering sequence is fixed if needed. param: int $courseid The Course ID param: bool $fillers include fillers and colspans, make the levels var "rectangular" param: bool $category_grade_last category grade item is the last child param: array $collapsed array of collapsed categories param: bool $nooutcomes Whether or not outcomes should be included |
grade_tree($courseid, $fillers=true, $category_grade_last=false,$collapsed=null, $nooutcomes=false) X-Ref |
Old syntax of class constructor. Deprecated in PHP7. |
get_options() X-Ref |
Returns return parameters as options array suitable for buttons. return: array options |
get_return_url($default, $extras=null) X-Ref |
Returns return url param: string $default default url when params not set param: array $extras Extra URL parameters return: string url |
get_form_fields() X-Ref |
Returns string with hidden return tracking form elements. return: string |
add_mform_elements(&$mform) X-Ref |
Add hidden elements into mform param: object &$mform moodle form object return: void |
add_url_params(moodle_url $url) X-Ref |
Add return tracking params into url param: moodle_url $url A URL return: moodle_url with return tracking params |
grade_build_nav($path, $pagename=null, $id=null) X-Ref |
Function central to gradebook for building and printing the navigation (breadcrumb trail). param: string $path The path of the calling script (using __FILE__?) param: string $pagename The language string to use as the last part of the navigation (non-link) param: mixed $id Either a plain integer (assuming the key is 'id') or return: string |
flatten(&$element, $category_grade_last, $nooutcomes) X-Ref |
Static recursive helper - makes the grade_item for category the last children param: array &$element The seed of the recursion param: bool $category_grade_last category grade item is the last child param: bool $nooutcomes Whether or not outcomes should be included return: array |
locate_element($eid) X-Ref |
Parses the array in search of a given eid and returns a element object with information about the element it has found. param: int $eid Gradetree Element ID return: object element |
category_collapse(&$element, $collapsed) X-Ref |
Static recursive helper - removes items from collapsed categories param: array &$element The seed of the recursion param: array $collapsed array of collapsed categories return: void |
no_outcomes(&$element) X-Ref |
Static recursive helper - removes all outcomes param: array &$element The seed of the recursion return: void |
category_grade_last(&$element) X-Ref |
Static recursive helper - makes the grade_item for category the last children param: array &$element The seed of the recursion return: void |
fill_levels(&$levels, &$element, $depth) X-Ref |
Static recursive helper - fills the levels array, useful when accessing tree elements of one level param: array &$levels The levels of the grade tree through which to recurse param: array &$element The seed of the recursion param: int $depth How deep are we? return: void |
can_output_item($element) X-Ref |
Determines whether the grade tree item can be displayed. This is particularly targeted for grade categories that have no total (None) when rendering the grade tree. It checks if the grade tree item is of type 'category', and makes sure that the category, or at least one of children, can be output. param: array $element The grade category element. return: bool True if the grade tree item can be displayed. False, otherwise. |
inject_fillers(&$element, $depth) X-Ref |
Static recursive helper - makes full tree (all leafes are at the same level) param: array &$element The seed of the recursion param: int $depth How deep are we? return: int |
inject_colspans(&$element) X-Ref |
Static recursive helper - add colspan information into categories param: array &$element The seed of the recursion return: int |
locate_element($eid) X-Ref |
Parses the array in search of a given eid and returns a element object with information about the element it has found. param: int $eid Gradetree Element ID return: object element |
exporttoxml($root=null, $tabs="\t") X-Ref |
Returns a well-formed XML representation of the grade-tree using recursion. param: array $root The current element in the recursion. If null, starts at the top of the tree. param: string $tabs The control character to use for tabs return: string $xml |
exporttojson($root=null, $tabs="\t") X-Ref |
Returns a JSON representation of the grade-tree using recursion. param: array $root The current element in the recursion. If null, starts at the top of the tree. param: string $tabs Tab characters used to indent the string nicely for humans to enjoy return: string |
get_levels() X-Ref |
Returns the array of levels return: array |
get_items() X-Ref |
Returns the array of grade items return: array |
get_item($itemid) X-Ref |
Returns a specific Grade Item param: int $itemid The ID of the grade_item object return: grade_item |
grade_button($type, $courseid, $object) X-Ref |
Local shortcut function for creating an edit/delete button for a grade_* object. param: string $type 'edit' or 'delete' param: int $courseid The Course ID param: grade_* $object The grade_* object return: string html |
grade_extend_settings($plugininfo, $courseid) X-Ref |
This method adds settings to the settings block for the grade system and its plugins |
Class: grade_helper - X-Ref
Grade helper classget_lang_string(string $strcode, ?string $section = null) X-Ref |
First checks the cached language strings, then returns match if found, or uses get_string() to get it from the DB, caches it then returns it. param: string $strcode param: string|null $section Optional language section return: string |
get_plugin_strings() X-Ref |
Gets strings commonly used by the describe plugins report => get_string('view'), scale => get_string('scales'), outcome => get_string('outcomes', 'grades'), letter => get_string('letters', 'grades'), export => get_string('export', 'grades'), import => get_string('import'), settings => get_string('settings') return: array |
get_aggregation_strings() X-Ref |
Gets strings describing the available aggregation methods. return: array |
get_info_manage_settings($courseid) X-Ref |
Get grade_plugin_info object for managing settings if the user can param: int $courseid return: grade_plugin_info[] |
get_plugins_reports($courseid) X-Ref |
Returns an array of plugin reports as grade_plugin_info objects param: int $courseid return: array |
get_info_scales($courseid) X-Ref |
Get information on scales param: int $courseid return: grade_plugin_info |
get_info_outcomes($courseid) X-Ref |
Get information on outcomes param: int $courseid return: grade_plugin_info[]|false |
get_info_letters($courseid) X-Ref |
Get information on letters param: int $courseid return: array |
get_plugins_import($courseid) X-Ref |
Get information import plugins param: int $courseid return: array |
get_plugins_export($courseid) X-Ref |
Get information export plugins param: int $courseid return: array |
get_user_field_value($user, $field) X-Ref |
Returns the value of a field from a user record param: stdClass $user object param: stdClass $field object return: string value of the field |
get_user_profile_fields($courseid, $includecustomfields = false) X-Ref |
Returns an array of user profile fields to be included in export param: int $courseid param: bool $includecustomfields return: array An array of stdClass instances with customid, shortname, datatype, default and fullname fields |
fetch_all_natural_weights_for_course($courseid) X-Ref |
This helper method gets a snapshot of all the weights for a course. It is used as a quick method to see if any wieghts have been automatically adjusted. param: int $courseid return: array of itemid -> aggregationcoef2 |
reset_caches() X-Ref |
Resets all static caches. return: void |