An abstract object that holds methods and attributes common to all grade_* objects defined here.
More...
|
| __construct ($params=NULL, $fetch=true) |
| Constructor.
|
|
| can_control_visibility () |
| Returns whether the grade object can control the visibility of the grades.
|
|
| delete ($source=null) |
| Deletes this object from the database.
|
|
| get_hidden () |
| Check a grade item hidden status.
|
|
| get_record_data () |
| Returns object with fields and values that are defined in database.
|
|
| insert ($source=null, $isbulkupdate=false) |
| Records this object in the Database, sets its id to the returned value, and returns that value.
|
|
| is_hidden () |
| Returns the current hidden state of this grade_item.
|
|
| is_hiddenuntil () |
| Check grade object hidden status.
|
|
| load_optional_fields () |
| Makes sure all the optional fields are loaded.
|
|
| set_hidden ($hidden, $cascade=false) |
| Set a grade object hidden status.
|
|
| update ($source=null, $isbulkupdate=false) |
| Updates this object in the Database, based on its object variables.
|
|
| update_from_db () |
| Using this object's id field, fetches the matching record in the DB, and looks at each variable in turn.
|
|
|
static | fetch ($params) |
| Finds and returns a grade_object instance based on params.
|
|
static | fetch_all ($params) |
| Finds and returns all grade_object 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 | 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.
|
|
|
int | $hidden = 0 |
| 0 if visible, 1 always hidden or date not visible until $hidden
|
|
int | $id |
| The PK.
|
|
array | $optional_fields = array() |
| Array of optional fields with default values - usually long text information that is not always needed.
|
|
array | $required_fields = array('id', 'timecreated', 'timemodified', 'hidden') |
| Array of required table fields, must start with 'id'.
|
|
string | $table |
| The database table this grade object is stored in $table.
|
|
int | $timecreated |
| The first time this grade_object was created.
|
|
int | $timemodified |
| The last time this grade_object was modified.
|
|
|
| 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) |
| Called immediately after the object data has been inserted, updated, or deleted in the database.
|
|
| update_feedback_files (int $historyid=null) |
| Handles updating feedback files in the gradebook.
|
|
|
static | fetch_helper ($table, $classname, $params) |
| Factory method which uses the parameters to retrieve matching instances from the database.
|
|
An abstract object that holds methods and attributes common to all grade_* objects defined here.
- Copyright
- 2006 Nicolas Connault
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
grade_object::__construct |
( |
| $params = NULL, |
|
|
| $fetch = true ) |
Constructor.
Optionally (and by default) attempts to fetch corresponding row from the database
- Parameters
-
array | $params | An array with required parameters for this grade object. |
bool | $fetch | Whether to fetch corresponding row from the database or not, optional fields might not be defined if false used |
Reimplemented in grade_item.
◆ add_feedback_files()
grade_object::add_feedback_files |
( |
int | $historyid = null | ) |
|
|
protected |
Handles adding feedback files in the gradebook.
- Parameters
-
Reimplemented in grade_grade.
◆ can_control_visibility()
grade_object::can_control_visibility |
( |
| ) |
|
Returns whether the grade object can control the visibility of the grades.
- Return values
-
Reimplemented in grade_item.
◆ delete()
grade_object::delete |
( |
| $source = null | ) |
|
◆ delete_feedback_files()
grade_object::delete_feedback_files |
( |
| ) |
|
|
protected |
Handles deleting feedback files in the gradebook.
Reimplemented in grade_grade.
◆ fetch()
static grade_object::fetch |
( |
| $params | ) |
|
|
static |
◆ fetch_all()
static grade_object::fetch_all |
( |
| $params | ) |
|
|
static |
◆ fetch_all_helper()
static grade_object::fetch_all_helper |
( |
| $table, |
|
|
| $classname, |
|
|
| $params ) |
|
static |
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_helper()
static grade_object::fetch_helper |
( |
| $table, |
|
|
| $classname, |
|
|
| $params ) |
|
staticprotected |
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_hidden()
grade_object::get_hidden |
( |
| ) |
|
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_record_data()
grade_object::get_record_data |
( |
| ) |
|
Returns object with fields and values that are defined in database.
- Return values
-
◆ insert()
grade_object::insert |
( |
| $source = null, |
|
|
| $isbulkupdate = false ) |
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.) |
string | $isbulkupdate | If bulk grade update is happening. |
- Return values
-
int | The new grade object ID if successful, false otherwise |
Reimplemented in grade_category, grade_item, grade_outcome, and grade_scale.
◆ is_hidden()
grade_object::is_hidden |
( |
| ) |
|
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 |
( |
| ) |
|
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.
◆ load_optional_fields()
grade_object::load_optional_fields |
( |
| ) |
|
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 | ) |
|
|
protected |
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_category, and grade_item.
◆ set_hidden()
grade_object::set_hidden |
( |
| $hidden, |
|
|
| $cascade = false ) |
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_category, grade_grade, and grade_item.
◆ set_properties()
static grade_object::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.
- Parameters
-
grade_object | $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_object::update |
( |
| $source = null, |
|
|
| $isbulkupdate = false ) |
Updates this object in the Database, based on its object variables.
ID must be set.
- Parameters
-
string | $source | from where was the object updated (mod/forum, manual, etc.) |
bool | $isbulkupdate | If bulk grade update is happening. |
- Return values
-
Reimplemented in grade_category, grade_grade, grade_item, grade_outcome, and grade_scale.
◆ update_feedback_files()
grade_object::update_feedback_files |
( |
int | $historyid = null | ) |
|
|
protected |
Handles updating feedback files in the gradebook.
- Parameters
-
Reimplemented in grade_grade.
◆ update_from_db()
grade_object::update_from_db |
( |
| ) |
|
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
-
◆ $id
◆ $optional_fields
array grade_object::$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); $optional_fields
◆ $required_fields
array grade_object::$required_fields = array('id', 'timecreated', 'timemodified', 'hidden') |
Array of required table fields, must start with 'id'.
$required_fields
◆ $timecreated
int grade_object::$timecreated |
◆ $timemodified
int grade_object::$timemodified |
The documentation for this class was generated from the following file: