|
| can_control_visibility () |
| Returns whether the grade object can control the visibility of the grades. More...
|
|
| can_delete () |
| Checks if scale can be deleted. More...
|
|
| compact_items ($items=NULL) |
| Compacts (implodes) the array of items in $scale_items into a comma-separated string, $scale. More...
|
|
| delete ($source=null) |
| Deletes this scale from the database. More...
|
|
| get_description () |
| Returns the formatted grade description with URLs converted. More...
|
|
| get_hidden () |
| Check a grade item hidden status. More...
|
|
| get_name () |
| Returns the most descriptive field for this object. More...
|
|
| get_nearest_item ($grade) |
| When called on a loaded scale object (with a valid id) and given a float grade between the grademin and grademax, this method returns the scale item that falls closest to the float given (which is usually an average of several grades on a scale). More...
|
|
| get_record_data () |
| Returns object with fields and values that are defined in database. More...
|
|
| insert ($source=null) |
| Records this object in the Database, sets its id to the returned value, and returns that value. More...
|
|
| is_hidden () |
| Returns the current hidden state of this grade_item. More...
|
|
| is_hiddenuntil () |
| Check grade object hidden status. More...
|
|
| is_last_global_scale () |
| Checks if this is the last scale on the site. More...
|
|
| is_used () |
| Returns if scale used anywhere - activities, grade items, outcomes, etc. More...
|
|
| load_items ($items=NULL) |
| Loads the scale's items into the $scale_items array. More...
|
|
| load_optional_fields () |
| Makes sure all the optional fields are loaded. More...
|
|
| set_hidden ($hidden, $cascade=false) |
| Set a grade object hidden status. More...
|
|
| update ($source=null) |
| In addition to update() it also updates grade_outcomes_courses if needed. More...
|
|
| update_from_db () |
| Using this object's id field, fetches the matching record in the DB, and looks at each variable in turn. More...
|
|
|
static | fetch ($params) |
| Finds and returns a grade_scale instance based on params. More...
|
|
static | fetch_all ($params) |
| Finds and returns all grade_scale instances based on params. More...
|
|
static | fetch_all_global () |
| Static function returning all global scales. More...
|
|
static | fetch_all_helper ($table, $classname, $params) |
| Factory method which uses the parameters to retrieve all matching instances from the database. More...
|
|
static | fetch_all_local ($courseid) |
| Static function returning all local course scales. More...
|
|
static | set_properties (&$instance, $params) |
| Given an associated array or object, cycles through each key/variable and assigns the value to the corresponding variable in this object. More...
|
|
|
static | fetch_helper ($table, $classname, $params) |
| Factory method which uses the parameters to retrieve matching instances from the database. More...
|
|
◆ add_feedback_files()
grade_object::add_feedback_files |
( |
int |
$historyid = null | ) |
|
|
protectedinherited |
Handles adding feedback files in the gradebook.
- Parameters
-
Reimplemented in grade_grade.
◆ can_control_visibility()
grade_object::can_control_visibility |
( |
| ) |
|
|
inherited |
Returns whether the grade object can control the visibility of the grades.
- Return values
-
Reimplemented in grade_item.
◆ can_delete()
grade_scale::can_delete |
( |
| ) |
|
Checks if scale can be deleted.
- Return values
-
◆ compact_items()
grade_scale::compact_items |
( |
|
$items = NULL | ) |
|
Compacts (implodes) the array of items in $scale_items into a comma-separated string, $scale.
There are three ways to achieve this:
- No argument given: The $scale_items array is already loaded and imploded to a string of items.
- An array is given and is imploded into a string of items.
- A string of items is given and saved directly as the $scale variable. NOTE: This method is the exact reverse of load_items, and their input/output should be interchangeable. However, because load_items() trims the whitespace around the items, when the string is reconstructed these whitespaces will be missing. This is not an issue, but should be kept in mind when comparing the two strings.
- Parameters
-
mixed | $items | Could be null, a string or an array. The method behaves differently for each case. |
- Return values
-
array | The resulting string of scale items or null if the method failed to produce one. |
◆ delete()
grade_scale::delete |
( |
|
$source = null | ) |
|
Deletes this scale from the database.
- Parameters
-
string | $source | from where was the object deleted (mod/forum, manual, etc.) |
- Return values
-
Reimplemented from grade_object.
◆ fetch()
static grade_scale::fetch |
( |
|
$params | ) |
|
|
static |
Finds and returns a grade_scale instance based on params.
- Parameters
-
array | $params | associative arrays varname=>value |
- Return values
-
Reimplemented from grade_object.
◆ fetch_all()
static grade_scale::fetch_all |
( |
|
$params | ) |
|
|
static |
Finds and returns all grade_scale instances based on params.
- Parameters
-
array | $params | associative arrays varname=>value |
- Return values
-
array | array of grade_scale instances or false if none found. |
Reimplemented from grade_object.
◆ fetch_all_global()
static grade_scale::fetch_all_global |
( |
| ) |
|
|
static |
Static function returning all global scales.
- Return values
-
◆ 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 | $table | The table to retrieve from |
string | $classname | The name of the class to instantiate |
array | $params | An array of conditions like $fieldname => $fieldvalue |
- Return values
-
array|bool | Array of object instances or false if not found |
◆ fetch_all_local()
static grade_scale::fetch_all_local |
( |
|
$courseid | ) |
|
|
static |
Static function returning all local course scales.
- Parameters
-
int | $courseid | The course ID |
- Return values
-
◆ 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 | $table | The table to retrieve from |
string | $classname | The name of the class to instantiate |
array | $params | An array of conditions like $fieldname => $fieldvalue |
- Return values
-
mixed | An object instance or false if not found |
◆ get_description()
grade_scale::get_description |
( |
| ) |
|
Returns the formatted grade description with URLs converted.
- Return values
-
◆ get_hidden()
grade_object::get_hidden |
( |
| ) |
|
|
inherited |
Check a grade item hidden status.
- Return values
-
int | 0 means visible, 1 hidden always, a timestamp means "hidden until" |
Reimplemented in grade_grade.
◆ get_name()
grade_scale::get_name |
( |
| ) |
|
Returns the most descriptive field for this object.
This is a standard method used when we do not know the exact type of an object.
- Return values
-
◆ get_nearest_item()
grade_scale::get_nearest_item |
( |
|
$grade | ) |
|
When called on a loaded scale object (with a valid id) and given a float grade between the grademin and grademax, this method returns the scale item that falls closest to the float given (which is usually an average of several grades on a scale).
If the float falls below 1 but above 0, it will be rounded up to 1.
- Parameters
-
- Return values
-
◆ get_record_data()
grade_object::get_record_data |
( |
| ) |
|
|
inherited |
Returns object with fields and values that are defined in database.
- Return values
-
◆ insert()
grade_scale::insert |
( |
|
$source = null | ) |
|
Records this object in the Database, sets its id to the returned value, and returns that value.
If successful this function also fetches the new object data from database and stores it in object properties.
- Parameters
-
string | $source | from where was the object inserted (mod/forum, manual, etc.) |
- Return values
-
int | PK ID if successful, false otherwise |
Reimplemented from grade_object.
◆ 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
-
Reimplemented in grade_grade.
◆ is_hiddenuntil()
grade_object::is_hiddenuntil |
( |
| ) |
|
|
inherited |
Check grade object hidden status.
- Return values
-
bool | True if a "hidden until" timestamp is set, false if grade object is set to always visible or always hidden. |
Reimplemented in grade_grade.
◆ is_last_global_scale()
grade_scale::is_last_global_scale |
( |
| ) |
|
Checks if this is the last scale on the site.
- Return values
-
◆ is_used()
Returns if scale used anywhere - activities, grade items, outcomes, etc.
- Return values
-
◆ load_items()
grade_scale::load_items |
( |
|
$items = NULL | ) |
|
Loads the scale's items into the $scale_items array.
There are three ways to achieve this:
- No argument given: The $scale string is already loaded and exploded to an array of items.
- A string is given: A comma-separated list of items is exploded into an array of items.
- An array of items is given and saved directly as the array of items for this scale.
- Parameters
-
mixed | $items | Could be null, a string or an array. The method behaves differently for each case. |
- Return values
-
array | The resulting array of scale items or null if the method failed to produce one. |
◆ 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.
◆ notify_changed()
grade_object::notify_changed |
( |
|
$deleted | ) |
|
|
protectedinherited |
Called immediately after the object data has been inserted, updated, or deleted in the database.
Default does nothing, can be overridden to hook in special behaviour.
- Parameters
-
Reimplemented in grade_item, grade_grade, and grade_category.
◆ set_hidden()
grade_object::set_hidden |
( |
|
$hidden, |
|
|
|
$cascade = false |
|
) |
| |
|
inherited |
Set a grade object hidden status.
- Parameters
-
int | $hidden | 0 means visiable, 1 means hidden always, a timestamp means "hidden until" |
bool | $cascade | Ignored |
Reimplemented in grade_item, grade_grade, and grade_category.
◆ set_properties()
static grade_object::set_properties |
( |
& |
$instance, |
|
|
|
$params |
|
) |
| |
|
staticinherited |
Given an associated array or object, cycles through each key/variable and assigns the value to the corresponding variable in this object.
- Parameters
-
stdClass | $instance | The object to set the properties on |
array | $params | An array of properties to set like $propertyname => $propertyvalue |
- Return values
-
array|stdClass | Either an associative array or an object containing property name, property value pairs |
Reimplemented in grade_category.
◆ update()
grade_scale::update |
( |
|
$source = null | ) |
|
In addition to update() it also updates grade_outcomes_courses if needed.
- Parameters
-
string | $source | from where was the object inserted |
- Return values
-
Reimplemented from grade_object.
◆ update_feedback_files()
grade_object::update_feedback_files |
( |
int |
$historyid = null | ) |
|
|
protectedinherited |
Handles updating feedback files in the gradebook.
- Parameters
-
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
-
◆ $courseid
int grade_scale::$courseid |
The course this scale belongs to.
$courseid
◆ $description
string grade_scale::$description |
A description for this scale.
$description
◆ $id
◆ $name
string grade_scale::$name |
The name of the scale.
$name
◆ $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
◆ $required_fields
array grade_scale::$required_fields = array('id', 'courseid', 'userid', 'name', 'scale', 'description', 'descriptionformat', 'timemodified') |
Array of required table fields, must start with 'id'.
$required_fields
◆ $scale
string grade_scale::$scale |
A string representation of the scale items (a comma-separated list).
$scale
◆ $scale_items
array grade_scale::$scale_items = array() |
The items in this scale.
$scale_items
◆ $table
string grade_scale::$table = 'scale' |
◆ $timecreated
int grade_object::$timecreated |
|
inherited |
◆ $timemodified
int grade_object::$timemodified |
|
inherited |
The documentation for this class was generated from the following file: