Bulk activity completion manager class.  
 More...
|  | 
|  | __construct ($courseid) | 
|  | manager constructor. 
 | 
|  | 
|  | apply_completion ($data, $updateinstances) | 
|  | Applies completion from the bulk edit form to all selected modules. 
 | 
|  | 
|  | apply_default_completion ($data, $updatecustomrules, string $suffix='') | 
|  | Saves default completion from edit form to all selected module types. 
 | 
|  | 
|  | get_activities ($cmids, $withcompletiondetails=false) | 
|  | Gets the data (context) to be used with the activityinstance template. 
 | 
|  | 
|  | get_activities_and_headings () | 
|  | Gets the data (context) to be used with the bulkactivitycompletion template. 
 | 
|  | 
|  | get_activities_and_resources (bool $includedefaults=true) | 
|  | Gets the course modules for the current course. 
 | 
|  | 
|  | 
| int | $courseid | 
|  | $courseid the course id. 
 | 
|  | 
Bulk activity completion manager class. 
- Copyright
- 2017 Adrian Greeve 
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
◆ __construct()
      
        
          | core_completion\manager::__construct | ( |  | $courseid | ) |  | 
      
 
manager constructor. 
- Parameters
- 
  
    | int | $courseid | the course id. |  
 
 
 
◆ apply_completion()
      
        
          | core_completion\manager::apply_completion | ( |  | $data, | 
        
          |  |  |  | $updateinstances ) | 
      
 
Applies completion from the bulk edit form to all selected modules. 
- Parameters
- 
  
    | stdClass | $data | data received from the core_completion_bulkedit_form |  | bool | $updateinstances | if we need to update the instance tables of the module (i.e. 'assign', 'forum', etc.) - if no module-specific completion rules were added to the form, update of the module table is not needed. |  
 
 
 
◆ apply_completion_cm()
  
  | 
        
          | core_completion\manager::apply_completion_cm | ( | \cm_info | $cm, |  
          |  |  |  | $data, |  
          |  |  |  | $updateinstance ) |  | protected | 
 
Applies new completion rules to one course module. 
- Parameters
- 
  
    | cm_info | $cm |  |  | array | $data |  |  | bool | $updateinstance | if we need to update the instance table of the module (i.e. 'assign', 'forum', etc.) - if no module-specific completion rules were added to the form, update of the module table is not needed. |  
 
- Return values
- 
  
    | bool | if module was updated |  
 
 
 
◆ apply_default_completion()
      
        
          | core_completion\manager::apply_default_completion | ( |  | $data, | 
        
          |  |  |  | $updatecustomrules, | 
        
          |  |  | string | $suffix = '' ) | 
      
 
Saves default completion from edit form to all selected module types. 
- Parameters
- 
  
    | stdClass | $data | data received from the core_completion_bulkedit_form |  | bool | $updatecustomrules | if we need to update the custom rules of the module - if no module-specific completion rules were added to the form, update of the module table is not needed. |  | string | $suffix | the suffix to add to the name of the completion rules. |  
 
 
 
◆ can_edit_bulk_completion()
  
  | 
        
          | static core_completion\manager::can_edit_bulk_completion | ( |  | $courseorid, |  
          |  |  |  | $cm = null ) |  | static | 
 
Checks if current user can edit activity completion. 
- Parameters
- 
  
    | int | stdClass | $courseorid |  |  | cm_info | null | $cm | if specified capability for a given coursemodule will be check, if not specified capability to edit at least one activity is checked. |  
 
 
 
◆ get_activities()
      
        
          | core_completion\manager::get_activities | ( |  | $cmids, | 
        
          |  |  |  | $withcompletiondetails = false ) | 
      
 
Gets the data (context) to be used with the activityinstance template. 
- Parameters
- 
  
    | array | $cmids | list of course module ids |  | bool | $withcompletiondetails | include completion details |  
 
- Return values
- 
  
  
 
 
◆ get_activities_and_headings()
      
        
          | core_completion\manager::get_activities_and_headings | ( |  | ) |  | 
      
 
Gets the data (context) to be used with the bulkactivitycompletion template. 
- Return values
- 
  
    | stdClass | data for use with the bulkactivitycompletion template. |  
 
 
 
◆ get_activities_and_resources()
      
        
          | core_completion\manager::get_activities_and_resources | ( | bool | $includedefaults = true | ) |  | 
      
 
Gets the course modules for the current course. 
- Parameters
- 
  
    | bool | $includedefaults | Whether the default values should be included or not. |  
 
- Return values
- 
  
    | stdClass\$data | containing the modules |  
 
 
 
◆ get_available_completion_options()
  
  | 
        
          | static core_completion\manager::get_available_completion_options | ( | int | $courseid | ) |  |  | static | 
 
Returns an array with the available completion options (url => name) for the current course and user. 
- Parameters
- 
  
    | int | $courseid | The course id. |  
 
- Return values
- 
  
  
 
 
◆ get_available_completion_tabs()
  
  | 
        
          | static core_completion\manager::get_available_completion_tabs | ( |  | $courseorid | ) |  |  | static | 
 
Gets the available completion tabs for the current course and user. 
- Deprecated
- since Moodle 4.0 
- Parameters
- 
  
    | stdClass | int | $courseorid | the course object or id. |  
 
- Return values
- 
  
  
 
 
◆ get_completion_active_rule_descriptions()
  
  | 
        
          | core_completion\manager::get_completion_active_rule_descriptions | ( |  | $moduledata | ) |  |  | protected | 
 
Get the descriptions for all active conditional completion rules for the current module. 
- Parameters
- 
  
    | cm_info | stdClass | $moduledata | either instance of cm_info (with 'customcompletionrules' in customdata) or object with fields ->completion, ->completionview, ->completionexpected, ->completionusegrade and ->customdata['customcompletionrules'] |  
 
- Return values
- 
  
    | array\$activeruledescriptions | an array of strings describing the active completion rules. |  
 
 
 
◆ get_context()
  
  | 
        
          | core_completion\manager::get_context | ( |  | ) |  |  | protected | 
 
Returns current course context or system level for $SITE courseid. 
- Return values
- 
  
    | context | The course based on current courseid or system context. |  
 
 
 
◆ get_default_completion()
  
  | 
        
          | static core_completion\manager::get_default_completion | ( |  | $course, |  
          |  |  |  | $module, |  
          |  |  |  | $flatten = true, |  
          |  |  | string | $suffix = '' ) |  | static | 
 
Returns default completion rules for given module type in the given course. 
- Parameters
- 
  
    | stdClass | $course |  |  | stdClass | $module |  |  | bool | $flatten | if true all module custom completion rules become properties of the same object, otherwise they can be found as array in ->customdata['customcompletionrules'] |  | string | $suffix | the suffix to add to the name of the completion rules. |  
 
- Return values
- 
  
  
 
 
◆ get_module_form()
  
  | 
        
          | static core_completion\manager::get_module_form | ( | string | $modname, |  
          |  |  | stdClass | $course, |  
          |  |  | ?cm_info | $cm = null, |  
          |  |  | string | $suffix = '' ) |  | static | 
 
Return a mod_form of the given module. 
- Parameters
- 
  
    | string | $modname | Module to get the form from. |  | stdClass | $course | Course object. |  | ?cm_info | $cm | cm_info object to use. |  | string | $suffix | The suffix to add to the name of the completion rules. |  
 
- Return values
- 
  
    | ?\moodleform_mod | The moodleform_mod object if everything goes fine. Null otherwise. |  
 
 
 
The documentation for this class was generated from the following file: