MDL-58138 completion: Assorted linting fixes.

Part of MDL-58138 epic
This commit is contained in:
Jake Dallimore 2017-03-21 15:09:56 +08:00
parent 8db355c58f
commit b17ee68202
8 changed files with 68 additions and 39 deletions

View file

@ -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');
}

View file

@ -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);
}

View file

@ -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');
}

View file

@ -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;

View file

@ -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}}