|
Moodle
2.2.1
http://www.collinsharper.com
|


Public Member Functions | |
| insert ($source=null) | |
| update ($source=null) | |
| delete ($source=null) | |
| get_name () | |
| load_items ($items=NULL) | |
| compact_items ($items=NULL) | |
| get_nearest_item ($grade) | |
| fetch_all_global () | |
| can_delete () | |
| is_used () | |
| get_description () | |
Static Public Member Functions | |
| static | fetch ($params) |
| static | fetch_all ($params) |
| static | fetch_all_local ($courseid) |
Data Fields | |
| $table = 'scale' | |
| $required_fields = array('id', 'courseid', 'userid', 'name', 'scale', 'description', 'descriptionformat', 'timemodified') | |
| $courseid | |
| $userid | |
| $name | |
| $scale_items = array() | |
| $scale | |
| $description | |
Class representing a grade scale. It is responsible for handling its DB representation, modifying and returning its metadata.
Definition at line 34 of file grade_scale.php.
| can_delete | ( | ) |
Checks if scale can be deleted.
Definition at line 247 of file grade_scale.php.

| 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: 1. No argument given: The $scale_items array is already loaded and imploded to a string of items. 2. An array is given and is imploded into a string of items. 3. 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.
| mixed | $items | Could be null, a string or an array. The method behaves differently for each case. |
Definition at line 192 of file grade_scale.php.
| delete | ( | $ | source = null | ) |
Deletes this outcome from the database.
| string | $source | from where was the object deleted (mod/forum, manual, etc.) |
Reimplemented from grade_object.
Definition at line 129 of file grade_scale.php.

| static fetch | ( | $ | params | ) | [static] |
Finds and returns a grade_scale instance based on params.
| array | $params | associative arrays varname=>value |
Reimplemented from grade_object.
Definition at line 86 of file grade_scale.php.


| static fetch_all | ( | $ | params | ) | [static] |
Finds and returns all grade_scale instances based on params.
| array | $params | associative arrays varname=>value |
Reimplemented from grade_object.
Definition at line 97 of file grade_scale.php.


| fetch_all_global | ( | ) |
Static function returning all global scales
Definition at line 231 of file grade_scale.php.


| static fetch_all_local | ( | $ | courseid | ) | [static] |
Static function returning all local course scales
Definition at line 239 of file grade_scale.php.


| get_description | ( | ) |
Returns the formatted grade description with URLs converted
Definition at line 315 of file grade_scale.php.

| 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.
Definition at line 148 of file grade_scale.php.

| 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.
| float | $grade |
Definition at line 212 of file grade_scale.php.
| 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.
| string | $source | from where was the object inserted (mod/forum, manual, etc.) |
Reimplemented from grade_object.
Definition at line 108 of file grade_scale.php.
| is_used | ( | ) |
Returns if scale used anywhere - activities, grade items, outcomes, etc.
Definition at line 255 of file grade_scale.php.


| load_items | ( | $ | items = NULL | ) |
Loads the scale's items into the $scale_items array. There are three ways to achieve this: 1. No argument given: The $scale string is already loaded and exploded to an array of items. 2. A string is given: A comma-separated list of items is exploded into an array of items. 3. An array of items is given and saved directly as the array of items for this scale.
| mixed | $items | Could be null, a string or an array. The method behaves differently for each case. |
Definition at line 162 of file grade_scale.php.
| update | ( | $ | source = null | ) |
In addition to update() it also updates grade_outcomes_courses if needed
| string | $source | from where was the object inserted |
Reimplemented from grade_object.
Definition at line 119 of file grade_scale.php.
| int $courseid |
The course this scale belongs to.
Definition at line 51 of file grade_scale.php.
| string $description |
A description for this scale.
Definition at line 77 of file grade_scale.php.
| string $name |
The name of the scale.
Definition at line 59 of file grade_scale.php.
| array $required_fields = array('id', 'courseid', 'userid', 'name', 'scale', 'description', 'descriptionformat', 'timemodified') |
Array of required table fields, must start with 'id'.
Reimplemented from grade_object.
Definition at line 45 of file grade_scale.php.
| string $scale |
A string representation of the scale items (a comma-separated list).
Definition at line 71 of file grade_scale.php.
The items in this scale.
Definition at line 65 of file grade_scale.php.
| string $table = 'scale' |
DB Table (used by grade_object).
Reimplemented from grade_object.
Definition at line 39 of file grade_scale.php.
Definition at line 53 of file grade_scale.php.