Moodle  2.2.1
http://www.collinsharper.com
grade_scale Class Reference
Inheritance diagram for grade_scale:
Collaboration diagram for grade_scale:

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

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


Member Function Documentation

Checks if scale can be deleted.

Returns:
boolean

Definition at line 247 of file grade_scale.php.

Here is the call graph for this function:

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.

Parameters:
mixed$itemsCould be null, a string or an array. The method behaves differently for each case.
Returns:
array The resulting string of scale items or null if the method failed to produce one.

Definition at line 192 of file grade_scale.php.

delete ( source = null)

Deletes this outcome from the database.

Parameters:
string$sourcefrom where was the object deleted (mod/forum, manual, etc.)
Returns:
boolean success

Reimplemented from grade_object.

Definition at line 129 of file grade_scale.php.

Here is the call graph for this function:

static fetch ( params) [static]

Finds and returns a grade_scale instance based on params.

Parameters:
array$paramsassociative arrays varname=>value
Returns:
object grade_scale instance or false if none found.

Reimplemented from grade_object.

Definition at line 86 of file grade_scale.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static fetch_all ( params) [static]

Finds and returns all grade_scale instances based on params.

Parameters:
array$paramsassociative arrays varname=>value
Returns:
array array of grade_scale instances or false if none found.

Reimplemented from grade_object.

Definition at line 97 of file grade_scale.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Static function returning all global scales

Returns:
object

Definition at line 231 of file grade_scale.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static fetch_all_local ( courseid) [static]

Static function returning all local course scales

Returns:
object

Definition at line 239 of file grade_scale.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the formatted grade description with URLs converted

Returns:
string

Definition at line 315 of file grade_scale.php.

Here is the call graph for this function:

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.

Returns:
string name

Definition at line 148 of file grade_scale.php.

Here is the call graph for this function:

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:
float$grade
Returns:
string

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.

Parameters:
string$sourcefrom where was the object inserted (mod/forum, manual, etc.)
Returns:
int PK ID if successful, false otherwise

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.

Returns:
bool

Definition at line 255 of file grade_scale.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
mixed$itemsCould be null, a string or an array. The method behaves differently for each case.
Returns:
array The resulting array of scale items or null if the method failed to produce one.

Definition at line 162 of file grade_scale.php.

update ( source = null)

In addition to update() it also updates grade_outcomes_courses if needed

Parameters:
string$sourcefrom where was the object inserted
Returns:
boolean success

Reimplemented from grade_object.

Definition at line 119 of file grade_scale.php.


Field Documentation

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.

array $scale_items = array()

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.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations