Skip to content

Commit

Permalink
Coding style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Dec 23, 2023
1 parent c9d1662 commit 3f5f45e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion amd/build/local/content/actions.min.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions amd/src/local/content/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export default class extends BaseComponent {
removeOnClose: true,
})
.then(modal => {
// eslint-disable-next-line promise/no-nesting
Templates.render('format_flexsections/local/content/movesection', data).
then((body) => {
modal.setBody(body);
Expand Down Expand Up @@ -248,6 +249,7 @@ export default class extends BaseComponent {
removeOnClose: true,
})
.then(modal => {
// eslint-disable-next-line promise/no-nesting
Templates.render('format_flexsections/local/content/movecm', data).
then((body) => {
modal.setBody(body);
Expand Down
12 changes: 6 additions & 6 deletions classes/courseformat/stateactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class stateactions extends \core_courseformat\stateactions {
/**
* Moving a section
*
* @param \core_courseformat\stateupdates $updates
* @param stateupdates $updates
* @param stdClass $course
* @param array $ids
* @param int|null $targetsectionid if positive number, move AFTER this section under the same parent
Expand All @@ -43,7 +43,7 @@ class stateactions extends \core_courseformat\stateactions {
* @param int|null $targetcmid
* @return void
*/
public function section_move(\core_courseformat\stateupdates $updates, stdClass $course, array $ids,
public function section_move(stateupdates $updates, stdClass $course, array $ids,
?int $targetsectionid = null, ?int $targetcmid = null): void {
$this->validate_sections($course, $ids, __FUNCTION__);

Expand Down Expand Up @@ -137,7 +137,7 @@ public function section_mergeup(
?int $targetcmid = null
): void {
if (!$targetsectionid) {
throw new \moodle_exception("Action section_mergeup requires targetsectionid");
throw new moodle_exception("Action section_mergeup requires targetsectionid");
}

$coursecontext = context_course::instance($course->id);
Expand All @@ -150,7 +150,7 @@ public function section_mergeup(
$this->validate_sections($course, [$targetsectionid], __FUNCTION__);
$targetsection = $modinfo->get_section_info_by_id($targetsectionid, MUST_EXIST);
if (!$targetsection->parent) {
throw new \moodle_exception("Action section_mergeup can't merge top level parentless sections");
throw new moodle_exception("Action section_mergeup can't merge top level parentless sections");
}

$format->mergeup_section($targetsection);
Expand Down Expand Up @@ -291,14 +291,14 @@ public function section_add_subsection(\core_courseformat\stateupdates $updates,
/**
* Adding a subsection as the first child of the parent
*
* @param \core_courseformat\stateupdates $updates
* @param stateupdates $updates
* @param stdClass $course
* @param array $ids not used
* @param int|null $targetsectionid parent section id
* @param int|null $targetcmid not used
* @return void
*/
public function section_insert_subsection(\core_courseformat\stateupdates $updates, stdClass $course, array $ids,
public function section_insert_subsection(stateupdates $updates, stdClass $course, array $ids,
?int $targetsectionid = null, ?int $targetcmid = null): void {
require_capability('moodle/course:update', context_course::instance($course->id));
/** @var \format_flexsections $format */
Expand Down
1 change: 1 addition & 0 deletions classes/output/courseformat/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function get_template_name(\renderer_base $renderer): string {
* @return \stdClass data context for a mustache template
*/
public function export_for_template(\renderer_base $output) {
/** @var \stdClass $data */
$data = parent::export_for_template($output);

// If we are on course view page for particular section.
Expand Down
10 changes: 5 additions & 5 deletions classes/output/courseformat/content/section/controlmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function section_control_items() {
if (has_capability('moodle/course:update', $coursecontext) && $section->section &&
$sectiondepth < $format->get_max_section_depth() &&
(!$section->collapsed || $section->section == $this->format->get_viewed_section())) {
$addsubsectionurl = new \moodle_url($url, ['addchildsection' => $section->section]);
$addsubsectionurl = new moodle_url($url, ['addchildsection' => $section->section]);
$controls['addsubsection'] = [
'url' => $addsubsectionurl,
'icon' => 't/add',
Expand All @@ -84,7 +84,7 @@ public function section_control_items() {
}

if ($section->section && has_capability('moodle/course:setcurrentsection', $coursecontext)) {
$markerurl = new \moodle_url($url);
$markerurl = new moodle_url($url);
if ($course->marker == $section->section) { // Show the "light globe" on/off.
$markerurl->param('marker', 0);
$highlightoff = get_string('highlightoff');
Expand Down Expand Up @@ -116,7 +116,7 @@ public function section_control_items() {

if ($section->section && has_capability('moodle/course:update', $coursecontext) &&
$section->section != $this->format->get_viewed_section()) {
$collapseurl = new \moodle_url($url, ['switchcollapsed' => $section->section]);
$collapseurl = new moodle_url($url, ['switchcollapsed' => $section->section]);
$attrs = [
'data-action-flexsections' => 'sectionSwitchCollapsed',
'class' => 'editing_collapsed',
Expand All @@ -143,7 +143,7 @@ public function section_control_items() {

if ($section->parent && has_capability('moodle/course:update', $coursecontext) &&
$section->section != $this->format->get_viewed_section()) {
$mergeupurl = new \moodle_url($url, ['mergeup' => $section->section]);
$mergeupurl = new moodle_url($url, ['mergeup' => $section->section]);
$controls['mergeup'] = [
'url' => $mergeupurl,
'icon' => 'mergeup',
Expand Down Expand Up @@ -213,7 +213,7 @@ public function section_control_items() {
* @param renderer_base $output typically, the renderer that's calling this function
* @return array data context for a mustache template
*/
public function export_for_template(\renderer_base $output): stdClass {
public function export_for_template(renderer_base $output): stdClass {

$section = $this->section;

Expand Down
1 change: 1 addition & 0 deletions format.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable camelcase */
// Javascript functions for Flexible sections course format.

// This is no longer used but there are errors in console if this file is missing.
Expand Down

0 comments on commit 3f5f45e

Please sign in to comment.