Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
gradereport_singleview Class Reference

This class is the main class that must be implemented by a grade report plugin. More...

Inheritance diagram for gradereport_singleview:
grade_report

Public Member Functions

 __construct ($courseid, $gpr, $context, $itemtype, $itemid, $unused=null)
 Constructor for this report. More...
 
 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. More...
 
 get_numusers ($groups=true, $users=false)
 Fetches and returns a count of all the users that will be shown on this page. More...
 
 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. More...
 
 output ()
 Build the html for the screen. More...
 
 process_action ($target, $action)
 Unused - abstract function declared in the parent class. More...
 
 process_data ($data)
 Process data from a form submission. More...
 
 set_pref ($pref, $pref_value='default', $itemid=null)
 Uses set_user_preferences() to update the value of a user preference. More...
 
 setup_users ()
 Sets up this report's user criteria to restrict the selection of users to display.
 

Static Public Member Functions

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. More...
 

Public Attributes

string $baseurl
 base url for sorting by first/last name. More...
 
context $context
 The context. More...
 
object $course
 The course. More...
 
int $courseid
 The courseid. More...
 
int $currentgroup
 The current group being displayed. More...
 
string $currentgroupname
 The current groupname being displayed. More...
 
object $gpr
 Grade plugin return tracking object. More...
 
string $gradebookroles
 The roles for this report. More...
 
string $group_selector
 A HTML select element used to select the current group. More...
 
int $groupmode
 Current course group mode $groupmode.
 
grade_tree $gtree
 The grade_tree object. More...
 
array $lang_strings = array()
 Array of cached language strings (using get_string() all the time takes a long time!). More...
 
int $page
 Current page (for paging). More...
 
string $pbarurl
 base url for paging. More...
 
array $prefs = array()
 User preferences related to this report. More...
 

Protected Member Functions

 blank_hidden_total ($courseid, $course_item, $finalgrade)
 Optionally blank out course/category totals if they contain any hidden items. More...
 
 blank_hidden_total_and_adjust_bounds ($courseid, $course_item, $finalgrade)
 Optionally blank out course/category totals if they contain any hidden items. More...
 
 get_sort_arrow ($direction='move', $sortlink=null)
 Returns an arrow icon inside an tag, for the purpose of sorting a column. More...
 
 setup_groups ()
 Sets up this object's group variables, mainly to restrict the selection of users to display.
 

Protected Attributes

string $groupsql
 An SQL fragment used to add linking information to the group tables. More...
 
string $groupwheresql
 An SQL constraint to append to the queries used by this object to build the report. More...
 
array $groupwheresql_params = array()
 The ordered params for $groupwheresql $groupwheresql_params.
 
string $userwheresql
 An SQL constraint to append to the queries used by this object to build the report. More...
 
array $userwheresql_params = array()
 The ordered params for $userwheresql $userwheresql_params.
 

Detailed Description

This class is the main class that must be implemented by a grade report plugin.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

gradereport_singleview::__construct (   $courseid,
  $gpr,
  $context,
  $itemtype,
  $itemid,
  $unused = null 
)

Constructor for this report.

Creates the appropriate screen class based on itemtype.

Parameters
int$courseidThe course id.
object$gprgrade plugin return tracking object
context_course$context
string$itemtypeShould be user, select or grade
int$itemidThe id of the user or grade item
string$unusedUsed to be group id but that was removed and this is now unused.

Member Function Documentation

◆ 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$courseidthe course id
string$course_iteman instance of grade_item
string$finalgradethe grade for the course_item
Return values
stringThe 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$courseidthe course id
string$course_iteman instance of grade_item
string$finalgradethe grade for the course_item
Return values
array[]containing values for 'grade', 'grademax', 'grademin', 'aggregationstatus' and 'aggregationweight'

◆ 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$sectionOptional language section
Return values
string

◆ 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$groupsinclude groups limit
boolean$usersinclude users limit - default false, used for searching purposes
Return values
intCount of users

◆ 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$prefThe name of the preference (do not include the grade_report_ prefix)
int$objectidAn optional itemid or categoryid to check for a more fine-grained preference
Return values
mixedThe 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
string$direction
moodle_url$sortlink

◆ output()

gradereport_singleview::output ( )

Build the html for the screen.

Return values
stringHTML to display

◆ process_action()

gradereport_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::process_data (   $data)

Process data from a form submission.

Delegated to the current screen.

Parameters
array$dataThe data from the form
Return values
arrayList 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$prefThe name of the preference.
mixed$pref_valueThe value of the preference.
int$itemidAn optional itemid to which the preference will be assigned
Return values
boolSuccess or failure.

◆ valid_screens()

static gradereport_singleview::valid_screens ( )
static

Return the list of valid screens, used to validate the input.

Return values
arrayList of screens.

Member Data Documentation

◆ $baseurl

string grade_report::$baseurl
inherited

base url for sorting by first/last name.

$baseurl

◆ $context

context grade_report::$context
inherited

The context.

$context

◆ $course

object grade_report::$course
inherited

The course.

$course

◆ $courseid

int grade_report::$courseid
inherited

The courseid.

$courseid

◆ $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

grade_tree grade_report::$gtree
inherited

The grade_tree object.

$gtree

◆ $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

int grade_report::$page
inherited

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

◆ $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: