Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Public Member Functions | |
config_form_display (&$mform, $data=null) | |
Add appropriate form elements to the critieria form. More... | |
delete () | |
Deletes this object from the database. More... | |
get_details ($completion) | |
Return criteria progress details for display in reports. More... | |
get_icon ($alt, array $attributes=null) | |
Return pix_icon for display in reports. More... | |
get_record_data () | |
Returns object with fields and values that are defined in database. More... | |
get_status ($completion) | |
Return criteria status text for display in reports. More... | |
get_title () | |
Return criteria title for display in reports. More... | |
get_title_detailed () | |
Return a more detailed criteria title for display in reports. More... | |
get_type_title () | |
Return criteria type title for display in reports. More... | |
insert () | |
Records this object in the Database, sets its id to the returned value, and returns that value. More... | |
is_pending ($completion) | |
Return true if the criteria's current status is different to what is sorted in the database, e.g. More... | |
load_optional_fields () | |
Makes sure all the optional fields are loaded. More... | |
notify_changed ($deleted) | |
Called immediately after the object data has been inserted, updated, or deleted in the database. More... | |
review ($completion, $mark=true) | |
Review this criteria and decide if the user has completed. More... | |
update () | |
Updates this object in the Database, based on its object variables. More... | |
update_config (&$data) | |
Update the criteria information stored in the database. 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 Public Member Functions | |
static | factory ($params) |
Factory method for creating correct class object. More... | |
static | fetch ($params) |
Finds and returns a data_object instance based on params. More... | |
static | fetch_all ($params) |
Finds and returns all data_object instances based on params. More... | |
static | fetch_all_helper ($table, $classname, $params) |
Factory method - uses the parameters to retrieve all matching instances from the DB. 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... | |
Public Attributes | |
int | $course |
int | $criteriatype |
Criteria type One of the COMPLETION_CRITERIA_TYPE_* constants. | |
int | $date |
Date of course completion (for date criteria) This is a timestamp value. | |
int | $enrolperiod |
Period after enrolment completion will be triggered (for period criteria) The value here is the number of days as an int. | |
float | $gradepass |
int | $id |
string | $module |
int | $moduleinstance |
array | $optional_fields = array() |
Array of optional fields with default values - usually long text information that is not always needed. More... | |
array | $required_fields = array('id', 'course', 'criteriatype', 'module', 'moduleinstance', 'courseinstance', 'enrolperiod', 'timeend', 'gradepass', 'role') |
Array of required table fields, must start with 'id'. More... | |
int | $role |
string | $table = 'course_completion_criteria' |
Array | $unique_fields = array() |
Static Protected Member Functions | |
static | fetch_helper ($table, $classname, $params) |
Factory method - uses the parameters to retrieve matching instance from the DB. More... | |
|
abstract |
Add appropriate form elements to the critieria form.
moodleform | $mform | Moodle forms object |
mixed | $data | optional Any additional data that can be used to set default values in the form |
void |
Reimplemented in completion_criteria_unenrol, completion_criteria_self, completion_criteria_role, completion_criteria_grade, completion_criteria_duration, completion_criteria_date, completion_criteria_course, and completion_criteria_activity.
|
inherited |
Deletes this object from the database.
bool | success |
|
static |
Factory method for creating correct class object.
array | $params | associative arrays varname=>value |
completion_criteria |
|
staticinherited |
Finds and returns a data_object instance based on params.
This function MUST be overridden by all deriving classes.
array | $params | associative arrays varname => value |
coding_exception | This function MUST be overridden |
data_object | instance of data_object or false if none found. |
Reimplemented in completion_criteria_unenrol, completion_criteria_self, completion_criteria_role, completion_criteria_grade, completion_criteria_duration, completion_criteria_date, completion_criteria_course, completion_criteria_activity, completion_criteria_completion, completion_completion, and completion_aggregation.
|
static |
Finds and returns all data_object instances based on params.
array | $params | associative arrays varname=>value |
array | array of data_object insatnces or false if none found. |
Reimplemented from data_object.
|
staticinherited |
Factory method - uses the parameters to retrieve all matching instances from the DB.
@final
string | $table | The table name to fetch from |
string | $classname | The class that you want the result instantiated as |
array | $params | Any params required to select the desired row |
mixed | array of object instances or false if not found |
|
staticprotectedinherited |
Factory method - uses the parameters to retrieve matching instance from the DB.
@final
string | $table | The table name to fetch from |
string | $classname | The class that you want the result instantiated as |
array | $params | Any params required to select the desired row |
object | Instance of $classname or false. |
|
abstract |
Return criteria progress details for display in reports.
completion_completion | $completion | The user's completion record |
array |
Reimplemented in completion_criteria_unenrol, completion_criteria_self, completion_criteria_role, completion_criteria_grade, completion_criteria_duration, completion_criteria_date, completion_criteria_course, and completion_criteria_activity.
completion_criteria::get_icon | ( | $alt, | |
array | $attributes = null |
||
) |
Return pix_icon for display in reports.
string | $alt | The alt text to use for the icon |
array | $attributes | html attributes |
pix_icon |
Reimplemented in completion_criteria_unenrol, completion_criteria_self, completion_criteria_grade, completion_criteria_date, and completion_criteria_activity.
|
inherited |
Returns object with fields and values that are defined in database.
stdClass |
completion_criteria::get_status | ( | $completion | ) |
Return criteria status text for display in reports.
completion_completion | $completion | The user's completion record |
string |
Reimplemented in completion_criteria_grade, completion_criteria_duration, and completion_criteria_date.
|
abstract |
Return criteria title for display in reports.
string |
Reimplemented in completion_criteria_unenrol, completion_criteria_self, completion_criteria_role, completion_criteria_grade, completion_criteria_duration, completion_criteria_date, completion_criteria_course, and completion_criteria_activity.
|
abstract |
Return a more detailed criteria title for display in reports.
string |
Reimplemented in completion_criteria_unenrol, completion_criteria_self, completion_criteria_role, completion_criteria_grade, completion_criteria_duration, completion_criteria_date, completion_criteria_course, and completion_criteria_activity.
|
abstract |
Return criteria type title for display in reports.
string |
Reimplemented in completion_criteria_unenrol, completion_criteria_self, completion_criteria_role, completion_criteria_grade, completion_criteria_duration, completion_criteria_date, completion_criteria_course, and completion_criteria_activity.
|
inherited |
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.
int | PK ID if successful, false otherwise |
completion_criteria::is_pending | ( | $completion | ) |
Return true if the criteria's current status is different to what is sorted in the database, e.g.
pending an update
completion_completion | $completion | The user's criteria completion record |
bool |
|
inherited |
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.
|
inherited |
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.
bool | $deleted | Set this to true if it has been deleted. |
|
abstract |
Review this criteria and decide if the user has completed.
object | $completion | The user's completion record |
boolean | $mark | Optionally set false to not save changes to database |
boolean |
Reimplemented in completion_criteria_unenrol, completion_criteria_grade, completion_criteria_duration, completion_criteria_date, completion_criteria_course, and completion_criteria_activity.
|
staticinherited |
Given an associated array or object, cycles through each key/variable and assigns the value to the corresponding variable in this object.
@final
data_object | $instance | |
array | $params |
|
inherited |
Updates this object in the Database, based on its object variables.
ID must be set.
bool | success |
|
abstract |
Update the criteria information stored in the database.
array | $data | Form data |
void |
Reimplemented in completion_criteria_unenrol, completion_criteria_self, completion_criteria_role, completion_criteria_grade, completion_criteria_duration, completion_criteria_date, completion_criteria_course, and completion_criteria_activity.
|
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.
bool | True for success, false otherwise. |
|
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 data_object($only_required_fields, false);
array completion_criteria::$required_fields = array('id', 'course', 'criteriatype', 'module', 'moduleinstance', 'courseinstance', 'enrolperiod', 'timeend', 'gradepass', 'role') |
Array of required table fields, must start with 'id'.
Defaults to id, course, criteriatype, module, moduleinstane, courseinstance, enrolperiod, timeend, gradepass, role