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

Public Member Functions

 __construct ($params=NULL, $fetch=true)
 load_optional_fields ()
 update ($source=null)
 delete ($source=null)
 get_record_data ()
 insert ($source=null)
 update_from_db ()
 notify_changed ($deleted)
 is_hidden ()
 is_hiddenuntil ()
 get_hidden ()
 set_hidden ($hidden, $cascade=false)

Static Public Member Functions

static fetch ($params)
static fetch_all ($params)
static fetch_all_helper ($table, $classname, $params)
static set_properties (&$instance, $params)

Data Fields

 $table
 $required_fields = array('id', 'timecreated', 'timemodified', 'hidden')
 $optional_fields = array()
 $id
 $timecreated
 $timemodified
 $hidden = 0

Static Protected Member Functions

static fetch_helper ($table, $classname, $params)

Detailed Description

An abstract object that holds methods and attributes common to all grade_* objects defined here.

Definition at line 31 of file grade_object.php.


Constructor & Destructor Documentation

__construct ( params = NULL,
fetch = true 
)

Constructor. Optionally (and by default) attempts to fetch corresponding row from DB.

Parameters:
array$paramsan array with required parameters for this grade object.
boolean$fetchWhether to fetch corresponding row from DB or not, optional fields might not be defined if false used

Definition at line 77 of file grade_object.php.

Here is the call graph for this function:


Member Function Documentation

delete ( source = null)

Deletes this object from the database.

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

Reimplemented in grade_item, grade_category, grade_scale, and grade_outcome.

Definition at line 241 of file grade_object.php.

Here is the call graph for this function:

static fetch ( params) [static]

Finds and returns a grade_object instance based on params. abstract

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

Reimplemented in grade_grade, grade_item, grade_category, grade_outcome, and grade_scale.

Definition at line 122 of file grade_object.php.

Here is the caller graph for this function:

static fetch_all ( params) [static]

Finds and returns all grade_object instances based on params. abstract

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

Reimplemented in grade_grade, grade_item, grade_category, grade_outcome, and grade_scale.

Definition at line 133 of file grade_object.php.

static fetch_all_helper ( table,
classname,
params 
) [static]

Factory method - uses the parameters to retrieve all matching instances from the DB. final protected

Returns:
mixed array of object instances or false if not found

Definition at line 159 of file grade_object.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static fetch_helper ( table,
classname,
params 
) [static, protected]

Factory method - uses the parameters to retrieve matching instance from the DB. final protected

Returns:
mixed object instance or false if not found

Definition at line 142 of file grade_object.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Check grade item hidden status.

Returns:
int 0 means visible, 1 hidden always, timestamp hidden until

Reimplemented in grade_grade.

Definition at line 392 of file grade_object.php.

Here is the caller graph for this function:

Returns object with fields and values that are defined in database

Definition at line 273 of file grade_object.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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 in grade_grade, grade_item, grade_category, grade_outcome, and grade_scale.

Definition at line 295 of file grade_object.php.

Here is the call graph for this function:

is_hidden ( )

Returns the hidden state of this grade_item

Returns:
boolean hidden state

Reimplemented in grade_grade.

Definition at line 376 of file grade_object.php.

Here is the caller graph for this function:

Check grade hidden status. Uses data from both grade item and grade.

Returns:
boolean true if hiddenuntil, false if not

Reimplemented in grade_grade.

Definition at line 384 of file grade_object.php.

Makes sure all the optional fields are loaded. If id present (==instance exists in db) fetches data from db. Defaults are used for new instances.

Definition at line 101 of file grade_object.php.

notify_changed ( deleted)

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:
bool$deleted

Reimplemented in grade_grade.

Definition at line 369 of file grade_object.php.

Here is the caller graph for this function:

set_hidden ( hidden,
cascade = false 
)

Reimplemented in grade_category, grade_item, and grade_grade.

Definition at line 396 of file grade_object.php.

Here is the call graph for this function:

static set_properties ( &$  instance,
params 
) [static]

Given an associated array or object, cycles through each key/variable and assigns the value to the corresponding variable in this object. final

Reimplemented in grade_category.

Definition at line 353 of file grade_object.php.

Here is the caller graph for this function:

update ( source = null)

Updates this object in the Database, based on its object variables. ID must be set.

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

Reimplemented in grade_grade, grade_item, grade_category, grade_outcome, and grade_scale.

Definition at line 210 of file grade_object.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Definition at line 332 of file grade_object.php.

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

int $hidden = 0

0 if visible, 1 always hidden or date not visible until

Reimplemented in grade_grade.

Definition at line 69 of file grade_object.php.

int $id

The PK.

Definition at line 51 of file grade_object.php.

array $optional_fields = array()

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);

Reimplemented in grade_grade.

Definition at line 45 of file grade_object.php.

array $required_fields = array('id', 'timecreated', 'timemodified', 'hidden')

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

Reimplemented in grade_category, grade_item, grade_outcome, grade_scale, and grade_grade.

Definition at line 38 of file grade_object.php.

Reimplemented in grade_category, grade_outcome, grade_scale, grade_item, and grade_grade.

Definition at line 32 of file grade_object.php.

int $timecreated

The first time this grade_object was created.

Reimplemented in grade_grade.

Definition at line 57 of file grade_object.php.

int $timemodified

The last time this grade_object was modified.

Reimplemented in grade_grade.

Definition at line 63 of file grade_object.php.


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