This class is the main class that must be implemented by a grade report plugin.
More...
|
| __construct (int $courseid, object $gpr, context_course $context, string $itemtype, ?int $itemid, ?string $unused=null) |
| Constructor for this report.
|
|
| bulk_actions_menu (renderer_base $output) |
| Adds bulk actions menu.
|
|
| get_lang_string ($strcode, $section=null) |
| 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.
|
|
| get_numusers ($groups=true, $users=false) |
| Fetches and returns a count of all the users that will be shown on this page.
|
|
| get_pref ($pref, $objectid=null) |
| Given the name of a user preference (without grade_report_ prefix), locally saves then returns the value of that preference.
|
|
| item_types () |
| Get grade item type names in a course to use in filter dropdown.
|
|
| output () |
| Build the html for the screen.
|
|
| process_action ($target, $action) |
| Unused - abstract function declared in the parent class.
|
|
| process_data ($data) |
| Process data from a form submission.
|
|
| set_pref ($pref, $pref_value='default', $itemid=null) |
| Uses set_user_preferences() to update the value of a user preference.
|
|
| setup_users () |
| Sets up this report's user criteria to restrict the selection of users to display.
|
|
| ungraded_counts () |
| Get ungraded grade items info and sum of all grade items in a course.
|
|
|
static | calculate_average (grade_item $gradeitem, array $info) |
| Calculate average grade for a given grade item.
|
|
static | get_additional_context (context_course $context, int $courseid, array $element, grade_plugin_return $gpr, string $mode, stdClass $templatecontext, bool $otherplugins=false) |
| Add additional links specific to plugin.
|
|
static | get_gradable_users (int $courseid, ?int $groupid=null) |
| Load a valid list of gradable users in a course.
|
|
static | supports_mygrades () |
| Shows support for being used as a 'Grades' report.
|
|
static | valid_screens () |
| Return the list of valid screens, used to validate the input.
|
|
|
string | $baseurl |
| base url for sorting by first/last name.
|
|
context | $context |
| The context.
|
|
object | $course |
| The course.
|
|
int | $courseid |
| The courseid.
|
|
int | $currentgroup |
| The current group being displayed.
|
|
string | $currentgroupname |
| The current groupname being displayed.
|
|
object | $gpr |
| Grade plugin return tracking object.
|
|
string | $gradebookroles |
| The roles for this report.
|
|
string | $group_selector |
| A HTML select element used to select the current group.
|
|
int | $groupmode |
| Current course group mode $groupmode.
|
|
grade_tree | $gtree |
| The grade_tree object.
|
|
string null string | $itemselector = null |
| $itemselector The raw HTML of the item selector based on the selected single view item type.
|
|
int | $page |
| Current page (for paging).
|
|
string | $pbarurl |
| base url for paging.
|
|
array | $prefs = array() |
| User preferences related to this report.
|
|
gradereport_singleview local screen screen | $screen |
| screen type.
|
|
array | $showtotalsifcontainhidden = [] |
| show course/category totals if they contain hidden items $showtotalsifcontainhidden
|
|
stdClass | $user |
| To store user data $user.
|
|
|
| blank_hidden_total ($courseid, $course_item, $finalgrade) |
| Optionally blank out course/category totals if they contain any hidden items.
|
|
| blank_hidden_total_and_adjust_bounds ($courseid, $course_item, $finalgrade) |
| Optionally blank out course/category totals if they contain any hidden items.
|
|
| get_sort_arrow (string $direction='down', ?moodle_url $sortlink=null) |
| Returns an arrow icon inside an tag, for the purpose of sorting a column.
|
|
| get_users_search_sql (array $mappings, array $userfields) |
| Prepare SQL where clause and associated parameters for any user searching being performed.
|
|
| setup_groups () |
| Sets up this object's group variables, mainly to restrict the selection of users to display.
|
|
| setup_item_selector (string $itemtype, ?int $itemid) |
| Function used to set the appropriate item selector (raw HTML) based on the selected single view item type.
|
|
|
static | groups_course_menu (stdClass $course, moodle_url $urlroot) |
| Ideally we should move this function to the base class and call it from the setup_groups in the base class, so all reports would automatically use it.
|
|
|
string | $groupsql |
| An SQL fragment used to add linking information to the group tables.
|
|
string | $groupwheresql |
| An SQL constraint to append to the queries used by this object to build the report.
|
|
array | $groupwheresql_params = array() |
| The ordered params for $groupwheresql $groupwheresql_params.
|
|
string | $preferences_page |
| To store a link to preferences page $preferences_page.
|
|
int int | $userid = -1 |
| If the user is wanting to show only one particular user their id will be placed here.
|
|
string string | $usersearch = '' |
| If the user is wanting to search for a particular user within searchable fields their needle will be placed here.
|
|
string | $userwheresql |
| An SQL constraint to append to the queries used by this object to build the report.
|
|
array | $userwheresql_params = array() |
| The ordered params for $userwheresql $userwheresql_params.
|
|
This class is the main class that must be implemented by a grade report plugin.
- Copyright
- 2014 Moodle Pty Ltd (http://moodle.com)
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
gradereport_singleview\report\singleview::__construct |
( |
int | $courseid, |
|
|
object | $gpr, |
|
|
context_course | $context, |
|
|
string | $itemtype, |
|
|
?int | $itemid, |
|
|
?string | $unused = null ) |
Constructor for this report.
Creates the appropriate screen class based on itemtype.
- Parameters
-
int | $courseid | The course id. |
object | $gpr | grade plugin return tracking object |
context_course | $context | |
string | $itemtype | Should be user, select or grade |
int | null | $itemid | The id of the user or grade item |
string | null | $unused | Used to be group id but that was removed and this is now unused. |
◆ blank_hidden_total()
grade_report::blank_hidden_total |
( |
| $courseid, |
|
|
| $course_item, |
|
|
| $finalgrade ) |
|
protectedinherited |
Optionally blank out course/category totals if they contain any hidden items.
- Deprecated
- since Moodle 2.8 - Call blank_hidden_total_and_adjust_bounds instead.
- Parameters
-
string | $courseid | the course id |
string | $course_item | an instance of grade_item |
string | $finalgrade | the grade for the course_item |
- Return values
-
string | The new final grade |
◆ blank_hidden_total_and_adjust_bounds()
grade_report::blank_hidden_total_and_adjust_bounds |
( |
| $courseid, |
|
|
| $course_item, |
|
|
| $finalgrade ) |
|
protectedinherited |
Optionally blank out course/category totals if they contain any hidden items.
- Parameters
-
string | $courseid | the course id |
string | $course_item | an instance of grade_item |
string | $finalgrade | the grade for the course_item |
- Return values
-
array[] | containing values for 'grade', 'grademax', 'grademin', 'aggregationstatus' and 'aggregationweight' |
◆ bulk_actions_menu()
gradereport_singleview\report\singleview::bulk_actions_menu |
( |
renderer_base | $output | ) |
|
Adds bulk actions menu.
- Parameters
-
- Return values
-
◆ calculate_average()
static grade_report::calculate_average |
( |
grade_item | $gradeitem, |
|
|
array | $info ) |
|
staticinherited |
Calculate average grade for a given grade item.
Based on calculate_averages function from grade/report/user/lib.php
- Parameters
-
grade_item | $gradeitem | Grade item |
array | $info | Ungraded grade items counts and report preferences. |
- Return values
-
array | Average grade and meancount. |
◆ get_additional_context()
static grade_report::get_additional_context |
( |
context_course | $context, |
|
|
int | $courseid, |
|
|
array | $element, |
|
|
grade_plugin_return | $gpr, |
|
|
string | $mode, |
|
|
stdClass | $templatecontext, |
|
|
bool | $otherplugins = false ) |
|
staticinherited |
Add additional links specific to plugin.
- Parameters
-
context_course | $context | Course context |
int | $courseid | Course ID |
array | $element | An array representing an element in the grade_tree |
grade_plugin_return | $gpr | A grade_plugin_return object |
string | $mode | Mode (user or grade item) |
stdClass | $templatecontext | Template context |
bool | $otherplugins | If we need to insert links to other plugins |
- Return values
-
?stdClass | Updated template context |
◆ get_gradable_users()
static grade_report::get_gradable_users |
( |
int | $courseid, |
|
|
?int | $groupid = null ) |
|
staticinherited |
Load a valid list of gradable users in a course.
- Parameters
-
int | $courseid | The course ID. |
int | null | $groupid | The group ID (optional). |
- Return values
-
array | A list of enrolled gradable users. |
◆ get_lang_string()
grade_report::get_lang_string |
( |
| $strcode, |
|
|
| $section = null ) |
|
inherited |
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.
- Deprecated
- since 4.2
- Todo
- MDL-77307 This will be deleted in Moodle 4.6.
- Parameters
-
string | $strcode | |
string | $section | Optional language section |
- Return values
-
◆ get_numusers()
grade_report::get_numusers |
( |
| $groups = true, |
|
|
| $users = false ) |
|
inherited |
Fetches and returns a count of all the users that will be shown on this page.
- Parameters
-
boolean | $groups | include groups limit |
boolean | $users | include users limit - default false, used for searching purposes |
- Return values
-
◆ get_pref()
grade_report::get_pref |
( |
| $pref, |
|
|
| $objectid = null ) |
|
inherited |
Given the name of a user preference (without grade_report_ prefix), locally saves then returns the value of that preference.
If the preference has already been fetched before, the saved value is returned. If the preference is not set at the User level, the $CFG equivalent is given (site default). Can be called statically, but then doesn't benefit from caching
- Parameters
-
string | $pref | The name of the preference (do not include the grade_report_ prefix) |
int | $objectid | An optional itemid or categoryid to check for a more fine-grained preference |
- Return values
-
mixed | The value of the preference |
◆ get_sort_arrow()
grade_report::get_sort_arrow |
( |
string | $direction = 'down', |
|
|
?moodle_url | $sortlink = null ) |
|
protectedinherited |
Returns an arrow icon inside an tag, for the purpose of sorting a column.
- Parameters
-
◆ get_users_search_sql()
grade_report::get_users_search_sql |
( |
array | $mappings, |
|
|
array | $userfields ) |
|
protectedinherited |
Prepare SQL where clause and associated parameters for any user searching being performed.
This mostly came from core_user\table\participants_search with some slight modifications four our use case.
- Parameters
-
array | $mappings | Array of field mappings (fieldname => SQL code for the value) |
array | $userfields | An array that we cast from user profile fields to search within. |
- Return values
-
array | SQL query data in the format ['where' => '', 'params' => []]. |
◆ groups_course_menu()
static gradereport_singleview\report\singleview::groups_course_menu |
( |
stdClass | $course, |
|
|
moodle_url | $urlroot ) |
|
staticprotected |
Ideally we should move this function to the base class and call it from the setup_groups in the base class, so all reports would automatically use it.
- Parameters
-
- Return values
-
◆ item_types()
grade_report::item_types |
( |
| ) |
|
|
inherited |
Get grade item type names in a course to use in filter dropdown.
- Return values
-
◆ output()
gradereport_singleview\report\singleview::output |
( |
| ) |
|
Build the html for the screen.
- Return values
-
◆ process_action()
gradereport_singleview\report\singleview::process_action |
( |
| $target, |
|
|
| $action ) |
Unused - abstract function declared in the parent class.
- Parameters
-
string | $target | |
string | $action | |
Reimplemented from grade_report.
◆ process_data()
gradereport_singleview\report\singleview::process_data |
( |
| $data | ) |
|
Process data from a form submission.
Delegated to the current screen.
- Parameters
-
array | $data | The data from the form |
- Return values
-
array|object | List of warnings |
Reimplemented from grade_report.
◆ set_pref()
grade_report::set_pref |
( |
| $pref, |
|
|
| $pref_value = 'default', |
|
|
| $itemid = null ) |
|
inherited |
Uses set_user_preferences() to update the value of a user preference.
If 'default' is given as the value, the preference will be removed in favour of a higher-level preference.
- Parameters
-
string | $pref | The name of the preference. |
mixed | $pref_value | The value of the preference. |
int | $itemid | An optional itemid to which the preference will be assigned |
- Return values
-
◆ setup_groups()
gradereport_singleview\report\singleview::setup_groups |
( |
| ) |
|
|
protected |
Sets up this object's group variables, mainly to restrict the selection of users to display.
Reimplemented from grade_report.
◆ setup_item_selector()
gradereport_singleview\report\singleview::setup_item_selector |
( |
string | $itemtype, |
|
|
?int | $itemid ) |
|
protected |
Function used to set the appropriate item selector (raw HTML) based on the selected single view item type.
- Parameters
-
string | $itemtype | The single view item type. |
int | null | $itemid | The item ID. |
◆ supports_mygrades()
static grade_report::supports_mygrades |
( |
| ) |
|
|
staticinherited |
◆ ungraded_counts()
grade_report::ungraded_counts |
( |
| ) |
|
|
inherited |
Get ungraded grade items info and sum of all grade items in a course.
Based on calculate_averages function from grade/report/user/lib.php
- Return values
-
array | Ungraded grade items counts with report preferences. |
◆ valid_screens()
static gradereport_singleview\report\singleview::valid_screens |
( |
| ) |
|
|
static |
Return the list of valid screens, used to validate the input.
- Return values
-
◆ $baseurl
string grade_report::$baseurl |
|
inherited |
base url for sorting by first/last name.
$baseurl
◆ $context
context grade_report::$context |
|
inherited |
◆ $course
object grade_report::$course |
|
inherited |
◆ $courseid
int grade_report::$courseid |
|
inherited |
◆ $currentgroup
int grade_report::$currentgroup |
|
inherited |
The current group being displayed.
$currentgroup
◆ $currentgroupname
string grade_report::$currentgroupname |
|
inherited |
The current groupname being displayed.
$currentgroupname
◆ $gpr
object grade_report::$gpr |
|
inherited |
Grade plugin return tracking object.
$gpr
◆ $gradebookroles
string grade_report::$gradebookroles |
|
inherited |
The roles for this report.
$gradebookroles
◆ $group_selector
string grade_report::$group_selector |
|
inherited |
A HTML select element used to select the current group.
$group_selector
◆ $groupsql
string grade_report::$groupsql |
|
protectedinherited |
An SQL fragment used to add linking information to the group tables.
$groupsql
◆ $groupwheresql
string grade_report::$groupwheresql |
|
protectedinherited |
An SQL constraint to append to the queries used by this object to build the report.
$groupwheresql
◆ $gtree
◆ $page
Current page (for paging).
$page
◆ $pbarurl
string grade_report::$pbarurl |
|
inherited |
base url for paging.
$pbarurl
◆ $prefs
array grade_report::$prefs = array() |
|
inherited |
User preferences related to this report.
$prefs
◆ $userid
int int grade_report::$userid = -1 |
|
protectedinherited |
If the user is wanting to show only one particular user their id will be placed here.
$userid
◆ $usersearch
string string grade_report::$usersearch = '' |
|
protectedinherited |
If the user is wanting to search for a particular user within searchable fields their needle will be placed here.
$usersearch
◆ $userwheresql
string grade_report::$userwheresql |
|
protectedinherited |
An SQL constraint to append to the queries used by this object to build the report.
$userwheresql
The documentation for this class was generated from the following file: