Class attempt for H5P activity.
More...
|
static | delete_all_attempts (stdClass $cm, stdClass $user=null) |
| Wipe all attempt data for specific course_module and an optional user.
|
|
static | delete_attempt (attempt $attempt) |
| Delete a specific attempt.
|
|
static | last_attempt (stdClass $user, stdClass $cm) |
| Get the last user attempt in a specific H5P activity.
|
|
static | new_attempt (stdClass $user, stdClass $cm) |
| Create a new user attempt in a specific H5P activity.
|
|
Class attempt for H5P activity.
- Since
- Moodle 3.9
- Copyright
- 2020 Ferran Recio ferra.nosp@m.n@mo.nosp@m.odle..nosp@m.com
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
mod_h5pactivity\local\attempt::__construct |
( |
stdClass | $record | ) |
|
Create a new attempt object.
- Parameters
-
stdClass | $record | the h5pactivity_attempts record |
◆ count_results()
mod_h5pactivity\local\attempt::count_results |
( |
| ) |
|
Return de number of results stored in this attempt.
- Return values
-
int | the number of results stored in this attempt. |
◆ delete_all_attempts()
static mod_h5pactivity\local\attempt::delete_all_attempts |
( |
stdClass | $cm, |
|
|
stdClass | $user = null ) |
|
static |
Wipe all attempt data for specific course_module and an optional user.
- Parameters
-
stdClass | $cm | a course_module record |
stdClass | $user | a user record |
◆ delete_attempt()
static mod_h5pactivity\local\attempt::delete_attempt |
( |
attempt | $attempt | ) |
|
|
static |
Delete a specific attempt.
- Parameters
-
attempt | $attempt | the attempt object to delete |
◆ get_attempt()
mod_h5pactivity\local\attempt::get_attempt |
( |
| ) |
|
Return the attempt number.
- Return values
-
◆ get_completion()
mod_h5pactivity\local\attempt::get_completion |
( |
| ) |
|
Return the attempt completion.
- Return values
-
int|null | the completion value |
◆ get_duration()
mod_h5pactivity\local\attempt::get_duration |
( |
| ) |
|
Return the attempt duration.
- Return values
-
int|null | the duration value |
◆ get_h5pactivityid()
mod_h5pactivity\local\attempt::get_h5pactivityid |
( |
| ) |
|
Return the attempt H5P activity ID.
- Return values
-
◆ get_id()
mod_h5pactivity\local\attempt::get_id |
( |
| ) |
|
Return the attempt ID.
- Return values
-
◆ get_maxscore()
mod_h5pactivity\local\attempt::get_maxscore |
( |
| ) |
|
Return the attempt maxscore.
- Return values
-
◆ get_rawscore()
mod_h5pactivity\local\attempt::get_rawscore |
( |
| ) |
|
Return the attempt rawscore.
- Return values
-
◆ get_results()
mod_h5pactivity\local\attempt::get_results |
( |
| ) |
|
Return all results stored in this attempt.
- Return values
-
stdClass[] | results records. |
◆ get_scaled()
mod_h5pactivity\local\attempt::get_scaled |
( |
| ) |
|
Return the attempt scaled.
- Return values
-
◆ get_scoreupdated()
mod_h5pactivity\local\attempt::get_scoreupdated |
( |
| ) |
|
Return if the attempt has been modified.
Note: adding a result only add track information unless the statement does not specify subcontent. In this case this will update also the statement.
- Return values
-
bool | if the attempt score have been modified |
◆ get_success()
mod_h5pactivity\local\attempt::get_success |
( |
| ) |
|
Return the attempt success.
- Return values
-
int|null | the success value |
◆ get_timecreated()
mod_h5pactivity\local\attempt::get_timecreated |
( |
| ) |
|
Return the attempt H5P timecreated.
- Return values
-
int | the attempt timecreated |
◆ get_timemodified()
mod_h5pactivity\local\attempt::get_timemodified |
( |
| ) |
|
Return the attempt H5P timemodified.
- Return values
-
int | the attempt timemodified |
◆ get_userid()
mod_h5pactivity\local\attempt::get_userid |
( |
| ) |
|
Return the attempt user ID.
- Return values
-
◆ last_attempt()
static mod_h5pactivity\local\attempt::last_attempt |
( |
stdClass | $user, |
|
|
stdClass | $cm ) |
|
static |
Get the last user attempt in a specific H5P activity.
If no previous attempt exists, it generates a new one.
- Parameters
-
stdClass | $user | a user record |
stdClass | $cm | a course_module record |
- Return values
-
attempt|null | a new attempt object or null if some problem accured |
◆ new_attempt()
static mod_h5pactivity\local\attempt::new_attempt |
( |
stdClass | $user, |
|
|
stdClass | $cm ) |
|
static |
Create a new user attempt in a specific H5P activity.
- Parameters
-
stdClass | $user | a user record |
stdClass | $cm | a course_module record |
- Return values
-
attempt|null | a new attempt object or null if fail |
◆ save()
mod_h5pactivity\local\attempt::save |
( |
| ) |
|
Update the current attempt record into DB.
- Return values
-
bool | true if update is succesful |
◆ save_statement()
mod_h5pactivity\local\attempt::save_statement |
( |
statement | $statement, |
|
|
string | $subcontent = '' ) |
Save a new result statement into the attempt.
It also updates the rawscore and maxscore if necessary.
- Parameters
-
statement | $statement | the xAPI statement object |
string | $subcontent | = '' optional subcontent identifier |
- Return values
-
bool | if it can save the statement into db |
◆ set_completion()
mod_h5pactivity\local\attempt::set_completion |
( |
?int | $completion | ) |
|
Set the attempt completion.
- Parameters
-
int | null | $completion | the attempt completion |
◆ set_duration()
mod_h5pactivity\local\attempt::set_duration |
( |
?int | $duration | ) |
|
Set the attempt duration.
- Parameters
-
int | null | $duration | the attempt duration |
◆ set_score()
mod_h5pactivity\local\attempt::set_score |
( |
?int | $rawscore, |
|
|
?int | $maxscore ) |
Set the attempt score.
- Parameters
-
int | null | $rawscore | the attempt rawscore |
int | null | $maxscore | the attempt maxscore |
◆ set_success()
mod_h5pactivity\local\attempt::set_success |
( |
?int | $success | ) |
|
Set the attempt success.
- Parameters
-
int | null | $success | the attempt success |
The documentation for this class was generated from the following file:
- mod/h5pactivity/classes/local/attempt.php