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]
Definition of the grader report class
Copyright: | 2007 Nicolas Connault |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 2111 lines (93 kb) |
Included or required: | 0 times |
Referenced: | 3 times |
Includes or requires: | 0 files |
grade_report_grader:: (32 methods):
__construct()
process_data()
setup_sortitemid()
load_users()
get_allgradeitems()
load_final_grades()
get_toggles_html()
print_toggle()
get_left_rows()
get_right_rows()
get_grade_table()
get_left_icons_row()
get_left_range_row()
get_left_avg_row()
get_right_icons_row()
get_right_range_row()
get_right_avg_row()
get_course_header()
get_icons()
get_collapsing_icon()
process_action()
filter_collapsed_categories()
get_collapsed_preferences()
set_collapsed_preferences()
do_process_action()
get_sort_arrows()
get_students_per_page()
get_category_view_mode_link()
get_hide_show_link()
get_default_sortable()
get_cell_display_class()
gradereport_grader_get_report_link()
Class: grade_report_grader - X-Ref
Class providing an API for the grader report building and displaying.__construct($courseid, $gpr, $context, $page=null, $sortitemid=null, string $sort = '') X-Ref |
Constructor. Sets local copies of user preferences and initialises grade_tree. param: int $courseid param: object $gpr grade plugin return tracking object param: string $context param: int $page The current page being viewed (when report is paged) param: int $sortitemid The id of the grade_item by which to sort the table param: string $sort Sorting direction |
process_data($data) X-Ref |
Processes the data sent by the form (grades). Caller is responsible for all access control checks param: array $data form submission (with magic quotes) return: array empty array if success, array of warnings if something fails. |
setup_sortitemid(string $sort = '') X-Ref |
Setting the sort order, this depends on last state all this should be in the new table class that we might need to use for displaying grades. param: string $sort sorting direction |
load_users(bool $allusers = false) X-Ref |
pulls out the userids of the users to be display, and sorts them param: bool $allusers If we are getting the users within the report, we want them all irrespective of paging. |
get_allgradeitems() X-Ref |
Load all grade items. |
load_final_grades() X-Ref |
we supply the userids in this query, and get all the grades pulls out all the grades, this does not need to worry about paging |
get_toggles_html() X-Ref |
Gets html toggle |
print_toggle($type) X-Ref |
Prints html toggle param: unknown $type |
get_left_rows($displayaverages) X-Ref |
Builds and returns the rows that will make up the left part of the grader report This consists of student names and icons, links to user reports and id numbers, as well as header cells for these columns. It also includes the fillers required for the categories displayed on the right side of the report. param: boolean $displayaverages whether to display average rows in the table return: array Array of html_table_row objects |
get_right_rows(bool $displayaverages) X-Ref |
Builds and returns the rows that will make up the right part of the grader report param: boolean $displayaverages whether to display average rows in the table return: array Array of html_table_row objects |
get_grade_table($displayaverages = false) X-Ref |
Depending on the style of report (fixedstudents vs traditional one-table), arranges the rows of data in one or two tables, and returns the output of these tables in HTML param: boolean $displayaverages whether to display average rows in the table return: string HTML |
get_left_icons_row($rows=array() X-Ref |
Builds and return the row of icons for the left side of the report. It only has one cell that says "Controls" param: array $rows The Array of rows for the left part of the report param: int $colspan The number of columns this cell has to span return: array Array of rows for the left part of the report |
get_left_range_row($rows=array() X-Ref |
Builds and return the header for the row of ranges, for the left part of the grader report. param: array $rows The Array of rows for the left part of the report param: int $colspan The number of columns this cell has to span return: array Array of rows for the left part of the report |
get_left_avg_row($rows=array() X-Ref |
Builds and return the headers for the rows of averages, for the left part of the grader report. param: array $rows The Array of rows for the left part of the report param: int $colspan The number of columns this cell has to span param: bool $groupavg If true, returns the row for group averages, otherwise for overall averages return: array Array of rows for the left part of the report |
get_right_icons_row($rows=array() X-Ref |
Builds and return the row of icons when editing is on, for the right part of the grader report. param: array $rows The Array of rows for the right part of the report return: array Array of rows for the right part of the report |
get_right_range_row($rows=array() X-Ref |
Builds and return the row of ranges for the right part of the grader report. param: array $rows The Array of rows for the right part of the report return: array Array of rows for the right part of the report |
get_right_avg_row($rows=array() X-Ref |
Builds and return the row of averages for the right part of the grader report. param: array $rows Whether to return only group averages or all averages. param: bool $grouponly Whether to return only group averages or all averages. return: array Array of rows for the right part of the report |
get_course_header($element) X-Ref |
Given element category, create a collapsible icon and course header. param: array $element return: string HTML |
get_icons($element) X-Ref |
Given a grade_category, grade_item or grade_grade, this function figures out the state of the object and builds then returns a div with the icons needed for the grader report. param: array $element return: string HTML |
get_collapsing_icon($element) X-Ref |
Given a category element returns collapsing +/- icon if available |
process_action($target, $action) X-Ref |
Processes a single action against a category, grade_item or grade. param: string $target eid ({type}{id}, e.g. c4 for category4) param: string $action Which action to take (edit, delete etc...) return: |
filter_collapsed_categories($courseid, $collapsed) X-Ref |
From the list of categories that this user prefers to collapse choose ones that belong to the current course. This function serves two purposes. Mainly it helps migrating from user preference style when all courses were stored in one preference. Also it helps to remove the settings for categories that were removed if the array for one course grows too big. param: int $courseid param: array $collapsed return: array |
get_collapsed_preferences($courseid) X-Ref |
Returns the list of categories that this user wants to collapse or display aggregatesonly This method also migrates on request from the old format of storing user preferences when they were stored in one preference for all courses causing DB error when trying to insert very big value. param: int $courseid return: array |
set_collapsed_preferences($courseid, $collapsed) X-Ref |
Sets the list of categories that user wants to see collapsed in user preferences This method may filter or even trim the list if it does not fit in DB field. param: int $courseid param: array $collapsed |
do_process_action($target, $action, $courseid = null) X-Ref |
Processes a single action against a category, grade_item or grade. param: string $target eid ({type}{id}, e.g. c4 for category4) param: string $action Which action to take (edit, delete etc...) param: int $courseid affected course. return: |
get_sort_arrows(array $extrafields = []) X-Ref |
Refactored function for generating HTML of sorting links with matching arrows. Returns an array with 'studentname' and 'idnumber' as keys, with HTML ready to inject into a table header cell. param: array $extrafields Array of extra fields being displayed, such as return: array An associative array of HTML sorting links+arrows |
get_students_per_page() X-Ref |
Returns the maximum number of students to be displayed on each page return: int The maximum number of students to display per page |
get_category_view_mode_link(moodle_url $url, string $title, string $action, bool $active = false) X-Ref |
Returns link to change category view mode. param: moodle_url $url Url to grader report page param: string $title Menu item title param: string $action View mode to change to param: bool $active Whether link is active in dropdown return: string|null |
get_hide_show_link() X-Ref |
Return the link to allow the field to collapse from the users view. return: string Dropdown menu link that'll trigger the collapsing functionality. |
get_default_sortable() X-Ref |
Return the base report link with some default sorting applied. return: string |
get_cell_display_class(grade_item $item) X-Ref |
Return class used for text alignment. param: grade_item $item Can be grade item or grade return: string class name used for text alignment |
gradereport_grader_get_report_link(context_course $context, int $courseid,array $element, grade_plugin_return $gpr, string $mode, ?stdClass $templatecontext) X-Ref |
Adds report specific context variable param: context_course $context Course context param: int $courseid Course ID param: array $element An array representing an element in the grade_tree param: grade_plugin_return $gpr A grade_plugin_return object param: string $mode Not used param: stdClass|null $templatecontext Template context return: stdClass|null |