Class manager for H5P activity.
More...
|
| __construct (cm_info $coursemodule, stdClass $instance) |
| Class contructor.
|
|
| can_submit (stdClass $user=null) |
| Check if the user has permission to submit a particular h5pactivity for a specific user.
|
|
| can_view_all_attempts (stdClass $user=null) |
| Check if a user can see the activity attempts list.
|
|
| can_view_own_attempts (stdClass $user=null) |
| Check if a user can see own attempts.
|
|
| count_attempts (int $userid=null) |
| Count the activity completed attempts.
|
|
| count_users_attempts () |
| Return an array of all users and it's total attempts.
|
|
| get_active_users_join (bool $allpotentialusers=false, $currentgroup=false) |
| Return the join to collect all activity active users.
|
|
| get_attempt (int $attemptid) |
| Return a single attempt.
|
|
| get_context () |
| Return the current context.
|
|
| get_coursemodule () |
| Return the current cm_info.
|
|
| get_grader () |
| Return the specific grader object for this activity.
|
|
| get_instance () |
| Return the current instance.
|
|
| get_report (int $userid=null, int $attemptid=null, $currentgroup=false) |
| Return the suitable report to show the attempts.
|
|
| get_selected_attempt () |
| Return the selected attempt criteria.
|
|
| get_user_attempts (int $userid) |
| Return an array of all user attempts (including incompleted)
|
|
| get_users_scaled_score (int $userid=0) |
| Return a relation of userid and the valid attempt's scaled score.
|
|
| is_tracking_enabled () |
| Check if tracking is enabled in a particular h5pactivity for a specific user.
|
|
| set_module_viewed (stdClass $course) |
| Trigger module viewed event and set the module viewed for completion.
|
|
|
const | GRADEAVERAGEATTEMPT = 2 |
| Use average attempt results for grading.
|
|
const | GRADEFIRSTATTEMPT = 4 |
| Use first attempt results for grading.
|
|
const | GRADEHIGHESTATTEMPT = 1 |
| Use highest attempt results for grading.
|
|
const | GRADELASTATTEMPT = 3 |
| Use last attempt results for grading.
|
|
const | GRADEMANUAL = 0 |
| No automathic grading using attempt results.
|
|
const | REVIEWCOMPLETION = 1 |
| Participants can review their own attempts when have one attempt completed.
|
|
const | REVIEWNONE = 0 |
| Participants cannot review their own attempts.
|
|
Class manager 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\manager::__construct |
( |
cm_info | $coursemodule, |
|
|
stdClass | $instance ) |
Class contructor.
- Parameters
-
cm_info | $coursemodule | course module info object |
stdClass | $instance | H5Pactivity instance object. |
◆ can_submit()
mod_h5pactivity\local\manager::can_submit |
( |
stdClass | $user = null | ) |
|
Check if the user has permission to submit a particular h5pactivity for a specific user.
- Parameters
-
stdClass | null | $user | user record (default $USER) |
- Return values
-
bool | if the user has permission to submit in this activity |
◆ can_view_all_attempts()
mod_h5pactivity\local\manager::can_view_all_attempts |
( |
stdClass | $user = null | ) |
|
Check if a user can see the activity attempts list.
- Parameters
-
stdClass | null | $user | user record (default $USER) |
- Return values
-
bool | if the user can see the attempts link |
◆ can_view_own_attempts()
mod_h5pactivity\local\manager::can_view_own_attempts |
( |
stdClass | $user = null | ) |
|
Check if a user can see own attempts.
- Parameters
-
stdClass | null | $user | user record (default $USER) |
- Return values
-
bool | if the user can see the own attempts link |
◆ count_attempts()
mod_h5pactivity\local\manager::count_attempts |
( |
int | $userid = null | ) |
|
Count the activity completed attempts.
If no user is provided the method will count all active users attempts. Check get_active_users_join PHPdoc to a more detailed description of "active users".
- Parameters
-
int | null | $userid | optional user id (default null) |
- Return values
-
int | the total amount of attempts |
◆ count_users_attempts()
mod_h5pactivity\local\manager::count_users_attempts |
( |
| ) |
|
Return an array of all users and it's total attempts.
Note: this funciton only returns the list of users with attempts, it does not check all participants.
- Return values
-
array | indexed count userid => total number of attempts |
◆ create_from_coursemodule()
static mod_h5pactivity\local\manager::create_from_coursemodule |
( |
| $coursemodule | ) |
|
|
static |
Create a manager instance from an course_modules record.
- Parameters
-
stdClass | cm_info | $coursemodule | a h5pactivity record |
- Return values
-
◆ create_from_instance()
static mod_h5pactivity\local\manager::create_from_instance |
( |
stdClass | $instance | ) |
|
|
static |
Create a manager instance from an instance record.
- Parameters
-
stdClass | $instance | a h5pactivity record |
- Return values
-
◆ get_active_users_join()
mod_h5pactivity\local\manager::get_active_users_join |
( |
bool | $allpotentialusers = false, |
|
|
| $currentgroup = false ) |
Return the join to collect all activity active users.
The concept of active user is relative to the activity permissions. All users with "mod/h5pactivity:view" are potential users but those with "mod/h5pactivity:reviewattempts" are evaluators and they don't count as valid submitters.
Note that, in general, the active list has the same effect as checking for "mod/h5pactivity:submit" but submit capability cannot be used because is a write capability and does not apply to frozen contexts.
- Since
- Moodle 3.11
- Parameters
-
bool | $allpotentialusers | if true, the join will return all active users, not only the ones with attempts. |
int | bool | $currentgroup | False if groups not used, 0 for all groups, group id (int) to filter by specific group |
- Return values
-
sql_join | the active users attempts join |
◆ get_attempt()
mod_h5pactivity\local\manager::get_attempt |
( |
int | $attemptid | ) |
|
Return a single attempt.
- Parameters
-
int | $attemptid | the attempt id |
- Return values
-
◆ get_context()
mod_h5pactivity\local\manager::get_context |
( |
| ) |
|
Return the current context.
- Return values
-
◆ get_coursemodule()
mod_h5pactivity\local\manager::get_coursemodule |
( |
| ) |
|
Return the current cm_info.
- Return values
-
◆ get_grader()
mod_h5pactivity\local\manager::get_grader |
( |
| ) |
|
Return the specific grader object for this activity.
- Return values
-
◆ get_grading_methods()
static mod_h5pactivity\local\manager::get_grading_methods |
( |
| ) |
|
|
static |
Return the available grading methods.
- Return values
-
string[] | an array "option value" => "option description" |
◆ get_instance()
mod_h5pactivity\local\manager::get_instance |
( |
| ) |
|
Return the current instance.
- Return values
-
stdClass | the instance record |
◆ get_report()
mod_h5pactivity\local\manager::get_report |
( |
int | $userid = null, |
|
|
int | $attemptid = null, |
|
|
| $currentgroup = false ) |
Return the suitable report to show the attempts.
This method controls the access to the different reports the activity have.
- Parameters
-
int | $userid | an opional userid to show |
int | $attemptid | an optional $attemptid to show |
int | bool | $currentgroup | False if groups not used, 0 for all groups, group id (int) to filter by specific group |
- Return values
-
report|null | available report (or null if no report available) |
◆ get_review_modes()
static mod_h5pactivity\local\manager::get_review_modes |
( |
| ) |
|
|
static |
Return the available review modes.
- Return values
-
string[] | an array "option value" => "option description" |
◆ get_selected_attempt()
mod_h5pactivity\local\manager::get_selected_attempt |
( |
| ) |
|
Return the selected attempt criteria.
- Return values
-
string[] | an array "grademethod value", "attempt description" |
◆ get_user_attempts()
mod_h5pactivity\local\manager::get_user_attempts |
( |
int | $userid | ) |
|
Return an array of all user attempts (including incompleted)
- Parameters
-
- Return values
-
◆ get_users_scaled_score()
mod_h5pactivity\local\manager::get_users_scaled_score |
( |
int | $userid = 0 | ) |
|
Return a relation of userid and the valid attempt's scaled score.
The returned elements contain a record of userid, scaled value, attemptid and timemodified. In case the grading method is "GRADEAVERAGEATTEMPT" the attemptid will be zero. In case that tracking is disabled or grading method is "GRADEMANUAL" the method will return null.
- Parameters
-
int | $userid | a specific userid or 0 for all user attempts. |
- Return values
-
array|null | of userid, scaled value and, if exists, the attempt id |
◆ is_tracking_enabled()
mod_h5pactivity\local\manager::is_tracking_enabled |
( |
| ) |
|
Check if tracking is enabled in a particular h5pactivity for a specific user.
- Return values
-
bool | if tracking is enabled in this activity |
◆ set_module_viewed()
mod_h5pactivity\local\manager::set_module_viewed |
( |
stdClass | $course | ) |
|
Trigger module viewed event and set the module viewed for completion.
- Parameters
-
stdClass | $course | course object |
- Return values
-
The documentation for this class was generated from the following file:
- mod/h5pactivity/classes/local/manager.php