Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
grade_category Class Reference

grade_category is an object mapped to DB table {prefix}grade_categories More...

Inheritance diagram for grade_category:

Public Member Functions

 aggregate_values ($grade_values, $items)
 Internal function that calculates the aggregated grade for this grade category.
 
 aggregate_values_and_adjust_bounds ($grade_values, $items, & $weights=null, $grademinoverrides=array(), $grademaxoverrides=array())
 Internal function that calculates the aggregated grade and new min/max for this grade category.
 
 apply_default_settings ()
 Applies default settings on this category.
 
 apply_forced_settings ()
 Applies forced settings on this category.
 
 apply_limit_rules (&$grade_values, $items)
 Given an array of grade values (numerical indices) applies droplow or keephigh rules to limit the final array.
 
 can_apply_limit_rules ()
 Returns whether or not we can apply the limit rules.
 
 can_control_visibility ()
 Returns whether the grade object can control the visibility of the grades.
 
 delete ($source=null)
 If parent\delete() is successful, send force_regrading message to parent category.
 
 force_regrading ()
 Marks this grade categories' associated grade item as needing regrading.
 
 generate_grades ($userid=null, ?\core\progress\base $progress=null)
 Generates and saves final grades in associated category grade item.
 
 get_children ($include_category_items=false)
 Fetches and returns all the children categories and/or grade_items belonging to this category.
 
 get_coefstring ($first=true)
 Recursive function to find which weight/extra credit field to use in the grade item form.
 
 get_description ()
 Describe the aggregation settings for this category so the reports make more sense.
 
 get_final ($userid=null)
 Returns the final grade values for this grade category.
 
 get_grade_item ()
 Retrieves this grade categories' associated grade_item from the database.
 
 get_hidden ()
 Check a grade item hidden status.
 
 get_idnumber ()
 Returns the idnumber of the grade categories' associated grade_item.
 
 get_name ($escape=true)
 Returns the most descriptive field for this grade category.
 
 get_parent_category ()
 Uses $this->parent to instantiate and return a grade_category object.
 
 get_record_data ()
 Returns object with fields and values that are defined in database.
 
 get_sortorder ()
 Returns the sortorder of the grade categories' associated grade_item.
 
 insert ($source=null, $isbulkupdate=false)
 In addition to the normal insert() defined in grade_object, this method sets the depth and path for this object, and update the record accordingly.
 
 insert_course_category ($courseid)
 Internal function - used only from fetch_course_category() Normal insert() can not be used for course category.
 
 is_aggregationcoef_used ()
 Returns true if category uses special aggregation coefficient.
 
 is_course_category ()
 Return true if this is the top most category that represents the total course grade.
 
 is_editable ()
 Is grading object editable?
 
 is_extracredit_used ()
 Returns true if category uses extra credit of any kind.
 
 is_hidden ()
 Returns the current hidden state of this grade_item.
 
 is_hiddenuntil ()
 Check grade object hidden status.
 
 is_locked ()
 Returns the locked state/date of the grade categories' associated grade_item.
 
 load_grade_item ()
 Uses get_grade_item() to load or create a grade_item, then saves it as $this->grade_item.
 
 load_optional_fields ()
 Makes sure all the optional fields are loaded.
 
 load_parent_category ()
 Uses $this->parent to instantiate $this->parent_category based on the referenced record in the DB.
 
 move_after_sortorder ($sortorder)
 Move this category after the given sortorder.
 
 pre_regrade_final_grades ()
 Something that should be called before we start regrading the whole course.
 
 qualifies_for_regrading ()
 Compares the values held by this object with those of the matching record in DB, and returns whether or not these differences are sufficient to justify an update of all parent objects.
 
 set_hidden ($hidden, $cascade=false)
 Sets the grade_item's hidden variable and updates the grade_item.
 
 set_locked ($lockedstate, $cascade=false, $refresh=true)
 Sets the grade_item's locked variable and updates the grade_item.
 
 set_parent ($parentid, $source=null)
 Sets this category's parent id.
 
 set_sortorder ($sortorder)
 Sets the sortorder variable for this category.
 
 update ($source=null, $isbulkupdate=false)
 In addition to update() as defined in grade_object, call force_regrading of parent categories, if applicable.
 
 update_from_db ()
 Using this object's id field, fetches the matching record in the DB, and looks at each variable in turn.
 

Static Public Member Functions

static aggregation_uses_aggregationcoef ($aggregation)
 Returns true if aggregation uses aggregationcoef.
 
static aggregation_uses_extracredit ($aggregation)
 Returns true if aggregation passed is using extracredit.
 
static build_path ($grade_category)
 Builds this category's path string based on its parents (if any) and its own id number.
 
static clean_record_set ()
 Cleans the cache.
 
static fetch ($params)
 Finds and returns a grade_category instance based on params.
 
static fetch_all ($params)
 Finds and returns all grade_category instances based on params.
 
static fetch_all_helper ($table, $classname, $params)
 Factory method which uses the parameters to retrieve all matching instances from the database.
 
static fetch_course_category ($courseid)
 Return the course level grade_category object.
 
static fetch_course_tree ($courseid, $include_category_items=false)
 Returns tree with all grade_items and categories as elements.
 
static get_default_aggregation_coefficient_values ($aggregationmethod)
 Determine the default aggregation values for a given aggregation method.
 
static set_properties (&$instance, $params)
 Overrides grade_object\set_properties() to add special handling for changes to category aggregation types.
 
static updated_forced_settings ()
 Notification of change in forced category settings.
 

Public Attributes

int $aggregateonlygraded = 0
 Aggregate only graded items $aggregateonlygraded.
 
int $aggregateoutcomes = 0
 Aggregate outcomes together with normal items $aggregateoutcomes.
 
int $aggregation = GRADE_AGGREGATE_SUM
 A constant pointing to one of the predefined aggregation strategies (none, mean, median, sum etc) .
 
array $all_children
 A hierarchical array of all children below this category.
 
array $children
 Array of grade_items or grade_categories nested exactly 1 level below this category $children.
 
string $coefstring = null
 String representing the aggregation coefficient.
 
int $courseid
 The course this category belongs to.
 
int $depth = 0
 The number of parents this category has.
 
int $droplow = 0
 Drop the X lowest items.
 
array $forceable = array('aggregation', 'keephigh', 'droplow', 'aggregateonlygraded', 'aggregateoutcomes')
 List of options which can be "forced" from site settings.
 
string $fullname
 The name of this category.
 
grade_item $grade_item
 An associated grade_item object, with itemtype=category, used to calculate and cache a set of grade values for this category.
 
int $hidden = 0
 0 if visible, 1 always hidden or date not visible until $hidden
 
int $id
 The PK.
 
string $itemtype
 e.g.
 
int $keephigh = 0
 Keep only the X highest items.
 
array $optional_fields = array()
 Array of optional fields with default values - usually long text information that is not always needed.
 
int $parent
 The category this category belongs to (optional).
 
grade_category $parent_category
 The grade_category object referenced by $this->parent (PK).
 
string $path
 Shows the hierarchical path for this category as /1/2/3/ (like course_categories), the last number being this category's autoincrement ID number.
 
array $required_fields
 Array of required table fields, must start with 'id'.
 
int $sortorder
 Temporary sortorder for speedup of children resorting $sortorder.
 
string $table = 'grade_categories'
 The DB table.
 
int $timecreated
 The first time this grade_object was created.
 
int $timemodified
 The last time this grade_object was modified.
 

Protected Member Functions

 add_feedback_files (int $historyid=null)
 Handles adding feedback files in the gradebook.
 
 delete_feedback_files ()
 Handles deleting feedback files in the gradebook.
 
 notify_changed ($deleted)
 Cleans the cache.
 
 update_feedback_files (int $historyid=null)
 Handles updating feedback files in the gradebook.
 

Static Protected Member Functions

static fetch_helper ($table, $classname, $params)
 Factory method which uses the parameters to retrieve matching instances from the database.
 
static generate_record_set_key ($params)
 Generates a unique key per query.
 
static retrieve_record_set ($params)
 Tries to retrieve a record set from the cache.
 
static set_record_set ($params, $records)
 Sets a result to the records cache, even if there were no results.
 

Protected Attributes

bool $canapplylimitrules
 Static variable storing the result from self::can_apply_limit_rules.
 

Detailed Description

grade_category is an object mapped to DB table {prefix}grade_categories

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

Member Function Documentation

◆ add_feedback_files()

grade_object::add_feedback_files ( int $historyid = null)
protectedinherited

Handles adding feedback files in the gradebook.

Parameters
int | null$historyid

Reimplemented in grade_grade.

◆ aggregate_values()

grade_category::aggregate_values ( $grade_values,
$items )

Internal function that calculates the aggregated grade for this grade category.

Must be public as it is used by grade_grade\get_hiding_affected()

Deprecated
since Moodle 2.8
Parameters
array$grade_valuesAn array of values to be aggregated
array$itemsThe array of grade_items
Return values
floatThe aggregate grade for this grade category

◆ aggregate_values_and_adjust_bounds()

grade_category::aggregate_values_and_adjust_bounds ( $grade_values,
$items,
& $weights = null,
$grademinoverrides = array(),
$grademaxoverrides = array() )

Internal function that calculates the aggregated grade and new min/max for this grade category.

Must be public as it is used by grade_grade\get_hiding_affected()

Parameters
array$grade_valuesAn array of values to be aggregated
array$itemsThe array of grade_items
Since
Moodle 2.6.5, 2.7.2
Parameters
array& $weights If provided, will be filled with the normalized weights for each grade_item as used in the aggregation. Some rules for the weights are:
  1. The weights must add up to 1 (unless there are extra credit)
  2. The contributed points column must add up to the course final grade and this column is calculated from these weights.
array$grademinoverridesUser specific grademin values if different to the grade_item grademin (key is itemid)
array$grademaxoverridesUser specific grademax values if different to the grade_item grademax (key is itemid)
Return values
arraycontaining values for: 'grade' => the new calculated grade 'grademin' => the new calculated min grade for the category 'grademax' => the new calculated max grade for the category

◆ aggregation_uses_aggregationcoef()

static grade_category::aggregation_uses_aggregationcoef ( $aggregation)
static

Returns true if aggregation uses aggregationcoef.

Parameters
int$aggregationAggregation const.
Return values
boolTrue if an aggregation coefficient is being used

◆ aggregation_uses_extracredit()

static grade_category::aggregation_uses_extracredit ( $aggregation)
static

Returns true if aggregation passed is using extracredit.

Parameters
int$aggregationAggregation const.
Return values
boolTrue if extra credit used

◆ apply_default_settings()

grade_category::apply_default_settings ( )

Applies default settings on this category.

Return values
boolTrue if anything changed

◆ apply_forced_settings()

grade_category::apply_forced_settings ( )

Applies forced settings on this category.

Return values
boolTrue if anything changed

◆ apply_limit_rules()

grade_category::apply_limit_rules ( & $grade_values,
$items )

Given an array of grade values (numerical indices) applies droplow or keephigh rules to limit the final array.

Parameters
array$grade_valuesitemid=>$grade_value float
array$itemsgrade item objects
Return values
arrayLimited grades.

◆ build_path()

static grade_category::build_path ( $grade_category)
static

Builds this category's path string based on its parents (if any) and its own id number.

This is typically done just before inserting this object in the DB for the first time, or when a new parent is added or changed. It is a recursive function: once the calling object no longer has a parent, the path is complete.

Parameters
grade_category$grade_categoryA Grade_Category object
Return values
stringThe category's path string

◆ can_apply_limit_rules()

grade_category::can_apply_limit_rules ( )

Returns whether or not we can apply the limit rules.

There are cases where drop lowest or keep highest should not be used at all. This method will determine whether or not this logic can be applied considering the current setup of the category.

Return values
bool

◆ can_control_visibility()

grade_object::can_control_visibility ( )
inherited

Returns whether the grade object can control the visibility of the grades.

Return values
bool

Reimplemented in grade_item.

◆ clean_record_set()

static grade_category::clean_record_set ( )
static

Cleans the cache.

Aggressive deletion to be conservative given the gradebook design. The key is based on the requested params, not easy nor worth to purge selectively.

Return values
void

◆ delete()

grade_category::delete ( $source = null)

If parent\delete() is successful, send force_regrading message to parent category.

Parameters
string$sourcefrom where was the object deleted (mod/forum, manual, etc.)
Return values
boolsuccess

Reimplemented from grade_object.

◆ delete_feedback_files()

grade_object::delete_feedback_files ( )
protectedinherited

Handles deleting feedback files in the gradebook.

Reimplemented in grade_grade.

◆ fetch()

static grade_category::fetch ( $params)
static

Finds and returns a grade_category instance based on params.

Parameters
array$paramsassociative arrays varname=>value
Return values
grade_categoryThe retrieved grade_category instance or false if none found.

Reimplemented from grade_object.

◆ fetch_all()

static grade_category::fetch_all ( $params)
static

Finds and returns all grade_category instances based on params.

Parameters
array$paramsassociative arrays varname=>value
Return values
arrayarray of grade_category insatnces or false if none found.

Reimplemented from grade_object.

◆ fetch_all_helper()

static grade_object::fetch_all_helper ( $table,
$classname,
$params )
staticinherited

Factory method which uses the parameters to retrieve all matching instances from the database.

Parameters
string$tableThe table to retrieve from
string$classnameThe name of the class to instantiate
array$paramsAn array of conditions like $fieldname => $fieldvalue
Return values
array|boolArray of object instances or false if not found

◆ fetch_course_category()

static grade_category::fetch_course_category ( $courseid)
static

Return the course level grade_category object.

Parameters
int$courseidThe Course ID
Return values
grade_categoryReturns the course level grade_category instance

◆ fetch_course_tree()

static grade_category::fetch_course_tree ( $courseid,
$include_category_items = false )
static

Returns tree with all grade_items and categories as elements.

Parameters
int$courseidThe course ID
bool$include_category_itemsas category children
Return values
array

◆ fetch_helper()

static grade_object::fetch_helper ( $table,
$classname,
$params )
staticprotectedinherited

Factory method which uses the parameters to retrieve matching instances from the database.

Parameters
string$tableThe table to retrieve from
string$classnameThe name of the class to instantiate
array$paramsAn array of conditions like $fieldname => $fieldvalue
Return values
mixedAn object instance or false if not found

◆ generate_grades()

grade_category::generate_grades ( $userid = null,
?\core\progress\base $progress = null )

Generates and saves final grades in associated category grade item.

These immediate children must already have their own final grades. The category's aggregation method is used to generate final grades.

Please note that category grade is either calculated or aggregated, not both at the same time.

This method must be used ONLY from grade_item\regrade_final_grades(), because the calculation must be done in correct order!

Steps to follow:

  1. Get final grades from immediate children
  2. Aggregate these grades
  3. Save them in final grades of associated category grade item
Parameters
int$useridThe user ID if final grade generation should be limited to a single user
core\progress\base | null$progressOptional progress indicator
Return values
bool

◆ generate_record_set_key()

static grade_category::generate_record_set_key ( $params)
staticprotected

Generates a unique key per query.

Not unique between grade_object children. self\retrieve_record_set and self\set_record_set will be in charge of selecting the appropriate cache.

Parameters
array$paramsAn array of conditions like $fieldname => $fieldvalue
Return values
string

◆ get_children()

grade_category::get_children ( $include_category_items = false)

Fetches and returns all the children categories and/or grade_items belonging to this category.

By default only returns the immediate children (depth=1), but deeper levels can be requested, as well as all levels (0). The elements are indexed by sort order.

Parameters
bool$include_category_itemsWhether or not to include category grade_items in the children array
Return values
arrayArray of child objects (grade_category and grade_item).

◆ get_coefstring()

grade_category::get_coefstring ( $first = true)

Recursive function to find which weight/extra credit field to use in the grade item form.

Parameters
string$firstWhether or not this is the first item in the recursion
Return values
string

◆ get_default_aggregation_coefficient_values()

static grade_category::get_default_aggregation_coefficient_values ( $aggregationmethod)
static

Determine the default aggregation values for a given aggregation method.

Parameters
int$aggregationmethodThe aggregation method constant value.
Return values
arrayContaining the keys 'aggregationcoef', 'aggregationcoef2' and 'weightoverride'.

◆ get_description()

grade_category::get_description ( )

Describe the aggregation settings for this category so the reports make more sense.

Return values
stringdescription

◆ get_final()

grade_category::get_final ( $userid = null)

Returns the final grade values for this grade category.

Parameters
int$useridOptional user ID to retrieve a single user's final grade
Return values
mixedAn array of all final_grades (stdClass objects) for this grade_item, or a single final_grade.

◆ get_grade_item()

grade_category::get_grade_item ( )

Retrieves this grade categories' associated grade_item from the database.

If no grade_item exists yet, creates one.

Return values
grade_item

◆ get_hidden()

grade_object::get_hidden ( )
inherited

Check a grade item hidden status.

Return values
int0 means visible, 1 hidden always, a timestamp means "hidden until"

Reimplemented in grade_grade.

◆ get_idnumber()

grade_category::get_idnumber ( )

Returns the idnumber of the grade categories' associated grade_item.

This method is also available in grade_item for cases where the object type is not known.

Return values
stringidnumber

◆ get_name()

grade_category::get_name ( $escape = true)

Returns the most descriptive field for this grade category.

Return values
stringname
Parameters
bool$escapeWhether the returned category name is to be HTML escaped or not.

◆ get_parent_category()

grade_category::get_parent_category ( )

Uses $this->parent to instantiate and return a grade_category object.

Return values
grade_categoryReturns the parent category or null if this category has no parent

◆ get_record_data()

grade_object::get_record_data ( )
inherited

Returns object with fields and values that are defined in database.

Return values
stdClass

◆ get_sortorder()

grade_category::get_sortorder ( )

Returns the sortorder of the grade categories' associated grade_item.

This method is also available in grade_item for cases where the object type is not known.

Return values
intSort order

◆ insert()

grade_category::insert ( $source = null,
$isbulkupdate = false )

In addition to the normal insert() defined in grade_object, this method sets the depth and path for this object, and update the record accordingly.

We do this here instead of in the constructor as they both need to know the record's ID number, which only gets created at insertion time. This method also creates an associated grade_item if this wasn't done during construction.

Parameters
string$sourcefrom where was the object inserted (mod/forum, manual, etc.)
bool$isbulkupdateIf bulk grade update is happening.
Return values
intPK ID if successful, false otherwise

Reimplemented from grade_object.

◆ insert_course_category()

grade_category::insert_course_category ( $courseid)

Internal function - used only from fetch_course_category() Normal insert() can not be used for course category.

Parameters
int$courseidThe course ID
Return values
intThe ID of the new course category

◆ is_aggregationcoef_used()

grade_category::is_aggregationcoef_used ( )

Returns true if category uses special aggregation coefficient.

Return values
boolTrue if an aggregation coefficient is being used

◆ is_course_category()

grade_category::is_course_category ( )

Return true if this is the top most category that represents the total course grade.

Return values
bool

◆ is_editable()

grade_category::is_editable ( )

Is grading object editable?

Return values
bool

◆ is_extracredit_used()

grade_category::is_extracredit_used ( )

Returns true if category uses extra credit of any kind.

Return values
boolTrue if extra credit used

◆ is_hidden()

grade_object::is_hidden ( )
inherited

Returns the current hidden state of this grade_item.

This depends on the grade object hidden setting and the current time if hidden is set to a "hidden until" timestamp

Return values
boolCurrent hidden state

Reimplemented in grade_grade.

◆ is_hiddenuntil()

grade_object::is_hiddenuntil ( )
inherited

Check grade object hidden status.

Return values
boolTrue if a "hidden until" timestamp is set, false if grade object is set to always visible or always hidden.

Reimplemented in grade_grade.

◆ is_locked()

grade_category::is_locked ( )

Returns the locked state/date of the grade categories' associated grade_item.

This method is also available in grade_item, for cases where the object type is not known.

Return values
bool

◆ load_grade_item()

grade_category::load_grade_item ( )

Uses get_grade_item() to load or create a grade_item, then saves it as $this->grade_item.

Return values
grade_item

◆ load_optional_fields()

grade_object::load_optional_fields ( )
inherited

Makes sure all the optional fields are loaded.

If id present, meaning the instance exists in the database, then data will be fetched from the database. Defaults are used for new instances.

◆ load_parent_category()

grade_category::load_parent_category ( )

Uses $this->parent to instantiate $this->parent_category based on the referenced record in the DB.

Return values
grade_categoryThe parent category

◆ move_after_sortorder()

grade_category::move_after_sortorder ( $sortorder)

Move this category after the given sortorder.

Does not change the parent

Parameters
int$sortorderto place after.
Return values
void

◆ notify_changed()

grade_category::notify_changed ( $deleted)
protected

Cleans the cache.

We invalidate them all so it can be completely reloaded.

Being conservative here, if there is a new grade_category we purge them, the important part is that this is not purged when there are no changes in grade_categories.

Parameters
bool$deleted
Return values
void

Reimplemented from grade_object.

◆ pre_regrade_final_grades()

grade_category::pre_regrade_final_grades ( )

Something that should be called before we start regrading the whole course.

Return values
void

◆ qualifies_for_regrading()

grade_category::qualifies_for_regrading ( )

Compares the values held by this object with those of the matching record in DB, and returns whether or not these differences are sufficient to justify an update of all parent objects.

This assumes that this object has an ID number and a matching record in DB. If not, it will return false.

Return values
bool

◆ retrieve_record_set()

static grade_category::retrieve_record_set ( $params)
staticprotected

Tries to retrieve a record set from the cache.

Parameters
array$paramsThe query params
Return values
grade_object[]|boolAn array of grade_objects or false if not found.

◆ set_hidden()

grade_category::set_hidden ( $hidden,
$cascade = false )

Sets the grade_item's hidden variable and updates the grade_item.

Overrides grade_item\set_hidden() to add cascading of the hidden value to grade items in this grade category

Parameters
int$hidden0 mean always visible, 1 means always hidden and a number > 1 is a timestamp to hide until
bool$cascadeapply to child objects too

Reimplemented from grade_object.

◆ set_locked()

grade_category::set_locked ( $lockedstate,
$cascade = false,
$refresh = true )

Sets the grade_item's locked variable and updates the grade_item.

Calls set_locked() on the categories' grade_item

Parameters
int$lockedstate0, 1 or a timestamp int(10) after which date the item will be locked.
bool$cascadelock/unlock child objects too
bool$refreshrefresh grades when unlocking
Return values
boolsuccess if category locked (not all children mayb be locked though)

◆ set_parent()

grade_category::set_parent ( $parentid,
$source = null )

Sets this category's parent id.

Parameters
int$parentidThe ID of the category that is the new parent to $this
string$sourceFrom where was the object updated (mod/forum, manual, etc.)
Return values
boolsuccess

◆ set_properties()

static grade_category::set_properties ( & $instance,
$params )
static

Overrides grade_object\set_properties() to add special handling for changes to category aggregation types.

Parameters
grade_category$instancethe object to set the properties on
array | stdClass$paramsEither an associative array or an object containing property name, property value pairs

Reimplemented from grade_object.

◆ set_record_set()

static grade_category::set_record_set ( $params,
$records )
staticprotected

Sets a result to the records cache, even if there were no results.

Parameters
string$paramsThe query params
grade_object[] | bool$recordsAn array of grade_objects or false if there are no records matching the $key filters
Return values
void

◆ set_sortorder()

grade_category::set_sortorder ( $sortorder)

Sets the sortorder variable for this category.

This method is also available in grade_item, for cases where the object type is not know.

Parameters
int$sortorderThe sortorder to assign to this category

◆ update()

grade_category::update ( $source = null,
$isbulkupdate = false )

In addition to update() as defined in grade_object, call force_regrading of parent categories, if applicable.

Parameters
string$sourcefrom where was the object updated (mod/forum, manual, etc.)
bool$isbulkupdateIf bulk grade update is happening.
Return values
boolsuccess

Reimplemented from grade_object.

◆ update_feedback_files()

grade_object::update_feedback_files ( int $historyid = null)
protectedinherited

Handles updating feedback files in the gradebook.

Parameters
int | null$historyid

Reimplemented in grade_grade.

◆ update_from_db()

grade_object::update_from_db ( )
inherited

Using this object's id field, fetches the matching record in the DB, and looks at each variable in turn.

If the DB has different data, the db's data is used to update the object. This is different from the update() function, which acts on the DB record based on the object.

Return values
boolTrue if successful

◆ updated_forced_settings()

static grade_category::updated_forced_settings ( )
static

Notification of change in forced category settings.

Causes all course and category grade items to be marked as needing to be updated

Member Data Documentation

◆ $aggregation

int grade_category::$aggregation = GRADE_AGGREGATE_SUM

A constant pointing to one of the predefined aggregation strategies (none, mean, median, sum etc) .

$aggregation

◆ $all_children

array grade_category::$all_children

A hierarchical array of all children below this category.

This is stored separately from $children because it is more memory-intensive and may not be used as often. $all_children

◆ $coefstring

string grade_category::$coefstring = null

String representing the aggregation coefficient.

Variable is used as cache. $coefstring

◆ $courseid

int grade_category::$courseid

The course this category belongs to.

$courseid

◆ $depth

int grade_category::$depth = 0

The number of parents this category has.

$depth

◆ $droplow

int grade_category::$droplow = 0

Drop the X lowest items.

$droplow

◆ $forceable

array grade_category::$forceable = array('aggregation', 'keephigh', 'droplow', 'aggregateonlygraded', 'aggregateoutcomes')

List of options which can be "forced" from site settings.

$forceable

◆ $fullname

string grade_category::$fullname

The name of this category.

$fullname

◆ $grade_item

grade_item grade_category::$grade_item

An associated grade_item object, with itemtype=category, used to calculate and cache a set of grade values for this category.

$grade_item

◆ $id

int grade_object::$id
inherited

The PK.

$id

◆ $itemtype

string grade_category::$itemtype

e.g.

'category', 'course' and 'mod', 'blocks', 'import', etc... $itemtype

◆ $keephigh

int grade_category::$keephigh = 0

Keep only the X highest items.

$keephigh

◆ $optional_fields

array grade_object::$optional_fields = array()
inherited

Array of optional fields with default values - usually long text information that is not always needed.

If you want to create an instance without optional fields use: new grade_object($only_required_fields, false); $optional_fields

◆ $parent

int grade_category::$parent

The category this category belongs to (optional).

$parent

◆ $parent_category

grade_category grade_category::$parent_category

The grade_category object referenced by $this->parent (PK).

$parent_category

◆ $path

string grade_category::$path

Shows the hierarchical path for this category as /1/2/3/ (like course_categories), the last number being this category's autoincrement ID number.

$path

◆ $required_fields

array grade_category::$required_fields
Initial value:
= array('id', 'courseid', 'parent', 'depth', 'path', 'fullname', 'aggregation',
'keephigh', 'droplow', 'aggregateonlygraded', 'aggregateoutcomes',
'timecreated', 'timemodified', 'hidden')

Array of required table fields, must start with 'id'.

$required_fields

◆ $table

string grade_category::$table = 'grade_categories'

The DB table.

$table

◆ $timecreated

int grade_object::$timecreated
inherited

The first time this grade_object was created.

$timecreated

◆ $timemodified

int grade_object::$timemodified
inherited

The last time this grade_object was modified.

$timemodified


The documentation for this class was generated from the following file: