Class providing an API for the user report building and displaying.
More...
|
| __construct ($courseid, $gpr, $context, $userid, $viewasuser=null) |
| Constructor.
|
|
| calculate_averages () |
| Builds the grade item averages.
|
|
| fill_contributions_column ($element) |
| This function is called after the table has been built and the aggregationhints have been collected.
|
|
| fill_table () |
|
| 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.
|
|
| inject_rowspans (&$element) |
| Recurses through a tree of elements setting the rowspan property on each element.
|
|
| print_table ($return=false) |
| Prints or returns the HTML from the flexitable.
|
|
| process_action ($target, $action) |
| Processes a single action against a category, grade_item or grade.
|
|
array | process_data ($data) |
| Processes the data sent by the form (grades and feedbacks).
|
|
| set_pref ($pref, $pref_value='default', $itemid=null) |
| Uses set_user_preferences() to update the value of a user preference.
|
|
| setup_table () |
| Prepares the headers and attributes of the flexitable.
|
|
| setup_users () |
| Sets up this report's user criteria to restrict the selection of users to display.
|
|
| viewed () |
| Trigger the grade_report_viewed event.
|
|
|
| $baseurl |
|
| $canviewhidden |
|
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.
|
|
int | $decimals = 2 |
| Decimal points to use for values in the report, default 2.
|
|
| $evenodd |
|
object | $gpr |
| Grade plugin return tracking object.
|
|
string | $gradebookroles |
| The roles for this report.
|
|
array | $gradeitemsdata = array() |
| An array containing the grade items data for external usage (web services, ajax, etc...)
|
|
string | $group_selector |
| A HTML select element used to select the current group.
|
|
int | $groupmode |
| Current course group mode $groupmode.
|
|
| $gseq |
| Flat structure similar to grade tree.
|
|
grade_tree | $gtree |
| The grade tree structure.
|
|
array | $lang_strings = array() |
| Array of cached language strings (using get_string() all the time takes a long time!).
|
|
| $maxdepth |
|
int | $page |
| Current page (for paging).
|
|
| $pbarurl |
|
array | $prefs = array() |
| User preferences related to this report.
|
|
int | $rangedecimals = 0 |
| The number of decimal places to round range to, default 0.
|
|
false | $showaverage = false |
| Show average grades in the report, default false.
|
|
bool | $showcontributiontocoursetotal = true |
| Show the calculated contribution to the course total column.
|
|
bool | $showfeedback = true |
| Show grade feedback in the report, default true.
|
|
bool | $showgrade = true |
| Show grades in the report, default true.
|
|
| $showhiddenitems |
| Show hidden items even when user does not have required cap.
|
|
bool | $showlettergrade = false |
| Show letter grades in the report, default false.
|
|
| $showpercentage |
| show grade percentages
|
|
| $showrange = true |
| Show range.
|
|
| $showrank |
| show student ranks
|
|
| $showtotalsifcontainhidden |
|
bool | $showweight = true |
| Show grade weighting in the report, default true.
|
|
| $switch |
|
object | $table |
| A flexitable to hold the data.
|
|
array | $tablecolumns = array() |
| An array of table columns.
|
|
type | $tabledata = array() |
| An array containing rows of data for the table.
|
|
array | $tableheaders = array() |
| An array of table headers.
|
|
object | $user |
| The 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 ($direction='move', $sortlink=null) |
| Returns an arrow icon inside an tag, for the purpose of sorting a column.
|
|
| setup_groups () |
| Sets up this object's group variables, mainly to restrict the selection of users to display.
|
|
|
array | $aggregationhints = array() |
| An array that collects the aggregationhints for every grade_item.
|
|
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.
|
|
course_modinfo | $modinfo = null |
| The modinfo object to be used.
|
|
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.
|
|
boolean | $viewasuser = false |
| View as user.
|
|
Class providing an API for the user report building and displaying.
@uses grade_report
◆ __construct()
grade_report_user::__construct |
( |
|
$courseid, |
|
|
|
$gpr, |
|
|
|
$context, |
|
|
|
$userid, |
|
|
|
$viewasuser = null |
|
) |
| |
Constructor.
Sets local copies of user preferences and initialises grade_tree.
- Parameters
-
int | $courseid | |
object | $gpr | grade plugin return tracking object |
string | $context | |
int | $userid | The id of the user |
bool | $viewasuser | Set this to true when the current user is a mentor/parent of the targetted user. |
◆ 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' |
◆ fill_contributions_column()
grade_report_user::fill_contributions_column |
( |
|
$element | ) |
|
This function is called after the table has been built and the aggregationhints have been collected.
We need this info to walk up the list of parents of each grade_item.
- Parameters
-
$element | - An array containing the table data for the current row. |
◆ 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.
- 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 |
( |
|
$direction = 'move' , |
|
|
|
$sortlink = null |
|
) |
| |
|
protectedinherited |
Returns an arrow icon inside an tag, for the purpose of sorting a column.
- Parameters
-
◆ inject_rowspans()
grade_report_user::inject_rowspans |
( |
& |
$element | ) |
|
Recurses through a tree of elements setting the rowspan property on each element.
- Parameters
-
array | $element | Either the top element or, during recursion, the current element |
- Return values
-
int | The number of elements processed |
◆ print_table()
grade_report_user::print_table |
( |
|
$return = false | ) |
|
Prints or returns the HTML from the flexitable.
- Parameters
-
bool | $return | Whether or not to return the data instead of printing it directly. |
- Return values
-
◆ process_action()
grade_report_user::process_action |
( |
|
$target, |
|
|
|
$action |
|
) |
| |
Processes a single action against a category, grade_item or grade.
- Parameters
-
string | $target | Sortorder |
string | $action | Which action to take (edit, delete etc...) |
- Return values
-
Reimplemented from grade_report.
◆ process_data()
array grade_report_user::process_data |
( |
|
$data | ) |
|
Processes the data sent by the form (grades and feedbacks).
$data
- Return values
-
bool | Success or Failure (array of errors). |
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
-
◆ supports_mygrades()
static grade_report::supports_mygrades |
( |
| ) |
|
|
staticinherited |
◆ viewed()
grade_report_user::viewed |
( |
| ) |
|
Trigger the grade_report_viewed event.
- Since
- Moodle 2.9
◆ $aggregationhints
array grade_report_user::$aggregationhints = array() |
|
protected |
An array that collects the aggregationhints for every grade_item.
The hints contain grade, grademin, grademax status, weight and parent.
◆ $context
◆ $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
◆ $decimals
int grade_report_user::$decimals = 2 |
Decimal points to use for values in the report, default 2.
◆ $gpr
object grade_report::$gpr |
|
inherited |
Grade plugin return tracking object.
$gpr
◆ $gradebookroles
string grade_report::$gradebookroles |
|
inherited |
The roles for this report.
$gradebookroles
◆ $gradeitemsdata
array grade_report_user::$gradeitemsdata = array() |
An array containing the grade items data for external usage (web services, ajax, etc...)
◆ $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
The grade tree structure.
◆ $lang_strings
array grade_report::$lang_strings = array() |
|
inherited |
Array of cached language strings (using get_string() all the time takes a long time!).
$lang_strings
◆ $page
Current page (for paging).
$page
◆ $prefs
array grade_report::$prefs = array() |
|
inherited |
User preferences related to this report.
$prefs
◆ $rangedecimals
int grade_report_user::$rangedecimals = 0 |
The number of decimal places to round range to, default 0.
◆ $showfeedback
bool grade_report_user::$showfeedback = true |
Show grade feedback in the report, default true.
◆ $showgrade
bool grade_report_user::$showgrade = true |
Show grades in the report, default true.
◆ $showlettergrade
bool grade_report_user::$showlettergrade = false |
Show letter grades in the report, default false.
◆ $table
object grade_report_user::$table |
A flexitable to hold the data.
$table
◆ $tablecolumns
array grade_report_user::$tablecolumns = array() |
An array of table columns.
◆ $tableheaders
array grade_report_user::$tableheaders = array() |
An array of table headers.
◆ $user
object grade_report_user::$user |
◆ $userwheresql
string grade_report::$userwheresql |
|
protectedinherited |
An SQL constraint to append to the queries used by this object to build the report.
$userwheresql
◆ $viewasuser
boolean grade_report_user::$viewasuser = false |
|
protected |
View as user.
When this is set to true, the visibility checks, and capability checks will be applied to the user whose grades are being displayed. This is very useful when a mentor/parent is viewing the report of their mentee because they need to have access to the same information, but not more, not less.
The documentation for this class was generated from the following file: