mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-58138 completion: Assorted linting fixes.
Part of MDL-58138 epic
This commit is contained in:
parent
8db355c58f
commit
b17ee68202
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -32,6 +31,7 @@ use cm_info;
|
||||
use tabobject;
|
||||
use lang_string;
|
||||
use moodle_url;
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
/**
|
||||
* Bulk activity completion manager class
|
||||
@ -43,8 +43,15 @@ use moodle_url;
|
||||
*/
|
||||
class manager {
|
||||
|
||||
/**
|
||||
* @var int $courseid the course id.
|
||||
*/
|
||||
protected $courseid;
|
||||
|
||||
/**
|
||||
* manager constructor.
|
||||
* @param int $courseid the course id.
|
||||
*/
|
||||
public function __construct($courseid) {
|
||||
$this->courseid = $courseid;
|
||||
}
|
||||
@ -185,6 +192,11 @@ class manager {
|
||||
return $activeruledescriptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the course modules for the current course.
|
||||
*
|
||||
* @return stdClass $data containing the modules
|
||||
*/
|
||||
public function get_activities_and_resources() {
|
||||
global $DB, $OUTPUT, $CFG;
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
@ -238,7 +250,9 @@ class manager {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stdClass|int $courseorid
|
||||
* Gets the available completion tabs for the current course and user.
|
||||
*
|
||||
* @param stdClass|int $courseorid the course object or id.
|
||||
* @return tabobject[]
|
||||
*/
|
||||
public static function get_available_completion_tabs($courseorid) {
|
||||
|
@ -173,37 +173,42 @@ class core_completion_bulk_update_testcase extends advanced_testcase {
|
||||
*/
|
||||
public function bulk_form_submit_multiple_provider() {
|
||||
return [
|
||||
'Several modules with the same module type (choice)' =>
|
||||
[['modulenames' => ['choice', 'choice', 'choice'],
|
||||
'submitdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1],
|
||||
'validatedata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1],
|
||||
'cmdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC],
|
||||
'instancedata' => [
|
||||
['completionsubmit' => 1],
|
||||
['completionsubmit' => 1],
|
||||
['completionsubmit' => 1],
|
||||
]]],
|
||||
'Several modules with different module type' =>
|
||||
[['modulenames' => ['choice', 'forum'],
|
||||
'Several modules with the same module type (choice)' => [
|
||||
[
|
||||
'modulenames' => ['choice', 'choice', 'choice'],
|
||||
'submitdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1],
|
||||
'validatedata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1],
|
||||
'cmdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC],
|
||||
'instancedata' => [['completionsubmit' => 1], ['completionsubmit' => 1], ['completionsubmit' => 1]]
|
||||
]
|
||||
],
|
||||
'Several modules with different module type' => [
|
||||
[
|
||||
'modulenames' => ['choice', 'forum'],
|
||||
'submitdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1],
|
||||
'validatedata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1],
|
||||
'cmdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC],
|
||||
'instancedata' => null]],
|
||||
'Setting manual completion (completionview shoud be ignored)' =>
|
||||
[['modulenames' => ['scorm', 'forum', 'label', 'assign'],
|
||||
'instancedata' => null
|
||||
]
|
||||
],
|
||||
'Setting manual completion (completionview shoud be ignored)' => [
|
||||
[
|
||||
'modulenames' => ['scorm', 'forum', 'label', 'assign'],
|
||||
'submitdata' => ['completion' => COMPLETION_TRACKING_MANUAL, 'completionview' => 1],
|
||||
'validatedata' => [],
|
||||
'cmdata' => ['completion' => COMPLETION_TRACKING_MANUAL, 'completionview' => 0],
|
||||
'instancedata' => null]],
|
||||
'If at least one module does not support completionsubmit it can\'t be set' =>
|
||||
[['modulenames' => ['survey', 'wiki'],
|
||||
'instancedata' => null
|
||||
]
|
||||
],
|
||||
'If at least one module does not support completionsubmit it can\'t be set' => [
|
||||
[
|
||||
'modulenames' => ['survey', 'wiki'],
|
||||
'submitdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1, 'completionsubmit' => 1],
|
||||
'validatedata' => [],
|
||||
'cmdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1],
|
||||
'instancedata' => [
|
||||
['completionsubmit' => 0],
|
||||
[]
|
||||
]]],
|
||||
'instancedata' => [['completionsubmit' => 0], []]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -28,13 +27,13 @@ require_once(__DIR__.'/../config.php');
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->libdir.'/completionlib.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
$id = required_param('id', PARAM_INT); // Course id.
|
||||
$cmids = optional_param_array('cmid', [], PARAM_INT);
|
||||
|
||||
// Perform some basic access control checks.
|
||||
if ($id) {
|
||||
|
||||
if($id == SITEID){
|
||||
if ($id == SITEID) {
|
||||
// Don't allow editing of 'site course' using this form.
|
||||
print_error('cannoteditsiteform');
|
||||
}
|
||||
|
@ -35,6 +35,13 @@ require_once($CFG->dirroot.'/course/renderer.php');
|
||||
*/
|
||||
class core_course_bulk_activity_completion_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Render the navigation tabs for the completion page.
|
||||
*
|
||||
* @param int|stdClass $courseorid the course object or id.
|
||||
* @param String $page the tab to focus.
|
||||
* @return string html
|
||||
*/
|
||||
public function navigation($courseorid, $page) {
|
||||
$tabs = core_completion\manager::get_available_completion_tabs($courseorid);
|
||||
if (count($tabs) > 1) {
|
||||
@ -44,11 +51,22 @@ class core_course_bulk_activity_completion_renderer extends plugin_renderer_base
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render the bulk completion tab.
|
||||
*
|
||||
* @param Array|stdClass $data the context data to pass to the template.
|
||||
* @return bool|string
|
||||
*/
|
||||
public function bulkcompletion($data) {
|
||||
return parent::render_from_template('core_course/bulkactivitycompletion', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the default completion tab.
|
||||
*
|
||||
* @param Array|stdClass $data the context data to pass to the template.
|
||||
* @return bool|string
|
||||
*/
|
||||
public function defaultcompletion($data) {
|
||||
return parent::render_from_template('core_course/defaultactivitycompletion', $data);
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -33,7 +32,7 @@ $id = required_param('id', PARAM_INT); // Course id.
|
||||
// Perform some basic access control checks.
|
||||
if ($id) {
|
||||
|
||||
if($id == SITEID){
|
||||
if ($id == SITEID) {
|
||||
// Don't allow editing of 'site course' using this form.
|
||||
print_error('cannoteditsiteform');
|
||||
}
|
||||
|
@ -560,8 +560,7 @@ class dndupload_ajax_processor {
|
||||
protected function create_course_module() {
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot.'/course/modlib.php');
|
||||
list($module, $context, $cw, $cm, $data) =
|
||||
prepare_new_moduleinfo_data($this->course, $this->module->name, $this->section);
|
||||
list($module, $context, $cw, $cm, $data) = prepare_new_moduleinfo_data($this->course, $this->module->name, $this->section);
|
||||
|
||||
$data->coursemodule = $data->id = add_course_module($data);
|
||||
$this->cm = $data;
|
||||
|
@ -60,9 +60,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="topics">
|
||||
|
||||
{{#sections}}
|
||||
|
||||
<div class="topic-section m-b-1">
|
||||
<div class="row m-b-1">
|
||||
<div class="col-sm-12">
|
||||
@ -72,9 +70,7 @@
|
||||
</div>
|
||||
{{> core_course/activityinstance}}
|
||||
</div>
|
||||
|
||||
{{/sections}}
|
||||
|
||||
</div>
|
||||
<input type="hidden" name="id" value="{{courseid}}" />
|
||||
<input type="hidden" name="sesskey" value="{{sesskey}}" />
|
||||
@ -105,7 +101,5 @@ require([
|
||||
$(this).prop('checked', checked);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
{{/js}}
|
@ -4210,7 +4210,8 @@ class settings_navigation extends navigation_node {
|
||||
if ($adminoptions->editcompletion) {
|
||||
// Add the course completion settings link
|
||||
$url = new moodle_url('/course/completion.php', array('id' => $course->id));
|
||||
$coursenode->add(get_string('coursecompletion', 'completion'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/settings', ''));
|
||||
$coursenode->add(get_string('coursecompletion', 'completion'), $url, self::TYPE_SETTING, null, null,
|
||||
new pix_icon('i/settings', ''));
|
||||
}
|
||||
|
||||
if (!$adminoptions->update && $adminoptions->tags) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user