Skip to content

Commit

Permalink
Fixed the code and doc checker issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
vasanthlmsace committed Feb 26, 2024
1 parent 2db590d commit 5f077ec
Show file tree
Hide file tree
Showing 18 changed files with 264 additions and 116 deletions.
2 changes: 1 addition & 1 deletion amd/build/courseindex/placeholder.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/designer_section.min.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion amd/src/designer_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
* @param {int} contextId
* @param {array} popupActivities
* @param {bool} videoTime
* @param {bool} issubpanel
*/
let DesignerSection = function(courseId, contextId, popupActivities, videoTime, issubpanel) {
var self = this;
Expand Down Expand Up @@ -107,7 +108,8 @@

DesignerSection.prototype.SectionController = ".designer #section-designer-action .dropdown-menu a";

DesignerSection.prototype.SectionSubmenuSwitcher = ".designer .section_action_menu .dropdown-subpanel a[data-value=section-designer-action] + .dropdown-menu a"
DesignerSection.prototype.SectionSubmenuSwitcher
= ".designer .section_action_menu .dropdown-subpanel a[data-value=section-designer-action] + .dropdown-menu a";

DesignerSection.prototype.RestrictInfo = ".designer .designer-section-content .call-action-block";

Expand Down
10 changes: 10 additions & 0 deletions classes/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ public static function is_mod_completed($mod) {
return false;
}

/**
* Check the section able to complete.
*
* @param [object] $section
* @param [object] $course
* @param [object] $modinfo
* @param boolean $onlyrelative
* @return boolean
*/
public static function is_vaild_section_completed($section, $course, $modinfo, $onlyrelative = false) {

$completioninfo = new \completion_info($course);
Expand Down Expand Up @@ -152,6 +161,7 @@ public static function is_vaild_section_completed($section, $course, $modinfo, $
* @param stdclass $course Course instance record.
* @param \Course_modinfo $modinfo Course mod info.
* @param bool $result True to only for REsult, False for current progress.
* @param bool $onlyrelative
* @return bool|array Result of section completion or Current progress data.
*/
public static function is_section_completed($section, $course, $modinfo, $result = false, $onlyrelative = false) {
Expand Down
84 changes: 84 additions & 0 deletions classes/output/courseformat/content/cm/controlmenu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Contains the default cm controls output class.
*
* @package format_designer
* @copyright 2021 bdecent gmbh <https://bdecent.de>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace format_designer\output\courseformat\content\cm;

use core_courseformat\output\local\content\cm\controlmenu as controlmenu_base;
use action_menu;
use action_menu_link;

/**
* Base class to render cm controls.
*
* @package format_designer
* @copyright 2021 bdecent gmbh <https://bdecent.de>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class controlmenu extends controlmenu_base {

/**
* Generate the aciton menu element.
*
* This method is public in case some block needs to modify the menu before output it.
* @param \renderer_base $output typically, the renderer that's calling this function
* @return aciton_menu the activity action menu
*/
public function get_action_menu(\renderer_base $output): ?action_menu {

if (!empty($this->menu)) {
return $this->menu;
}

$mod = $this->mod;

$controls = $this->cm_control_items();

if (empty($controls) || (isset($mod->get_course()->coursedisplay) &&
$mod->get_course()->coursedisplay== COURSE_DISPLAY_MULTIPAGE)) {
return null;
}

// Convert control array into an action_menu.
$menu = new action_menu();
$menu->set_kebab_trigger(get_string('edit'));
$menu->attributes['class'] .= ' section-cm-edit-actions commands';

// Prioritise the menu ahead of all other actions.
$menu->prioritise = true;

$ownerselector = $displayoptions['ownerselector'] ?? '#module-' . $mod->id;
$menu->set_owner_selector($ownerselector);

foreach ($controls as $control) {
if ($control instanceof action_menu_link) {
$control->add_class('cm-edit-action');
}
$menu->add($control);
}

$this->menu = $menu;

return $menu;
}
}
2 changes: 1 addition & 1 deletion classes/output/courseformat/content/section/cmlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function render_section_content($output, $htmlparse = false) {
$mod = $modinfo->cms[$modnumber];
// Check module state in deletionprogress.
// If the old non-ajax move is necessary, we do not print the selected cm.
if (($showmovehere && $USER->activitycopy == $mod->id)) {
if (($showmovehere && $USER->activitycopy == $mod->id)) {
continue;
}
if ($mod->is_visible_on_course_page()) {
Expand Down
11 changes: 6 additions & 5 deletions classes/output/courseformat/content/section/controlmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function section_control_items() {
'Section Layout',
$this->get_choice_list($section),
['data-value' => 'section-designer-action'],
new pix_icon('t/hide', '', 'moodle', array('class' => 'iconsmall'))
new pix_icon('t/hide', '', 'moodle', ['class' => 'iconsmall'])
);
}

Expand Down Expand Up @@ -359,6 +359,7 @@ public function section_control_items() {

/**
* Get the availability choice list.
* @param object $section
* @return choicelist
*/
public function get_choice_list($section): choicelist {
Expand All @@ -373,6 +374,7 @@ public function get_choice_list($section): choicelist {

/**
* Create a choice list for the dropdown.
* @param object $section
* @return choicelist the choice list
*/
protected function create_choice_list($section): choicelist {
Expand Down Expand Up @@ -402,10 +404,9 @@ protected function create_choice_list($section): choicelist {
}


/**
/**
* Get the data for the option.
* @param string $name the name of the option
* @param string $action the state action of the option
* @param string $value the value of the option
* @return array
*/
private function get_option_data(string $value): array {
Expand All @@ -418,7 +419,7 @@ private function get_option_data(string $value): array {
'extras' => [
'data-option' => 'sectiontype',
'data-value' => $value,
]
],
];
}

Expand Down
5 changes: 3 additions & 2 deletions classes/output/courseformat/content/section/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*/
class header extends \core_courseformat\output\local\content\section\header {

/**
/**
* Export this data so it can be used as the context for a mustache template.
*
* @param renderer_base $output typically, the renderer that's calling this function
Expand Down Expand Up @@ -102,7 +102,8 @@ public function export_for_template(\renderer_base $output): stdClass {

$bodyclasses = explode(" ", $PAGE->bodyclasses);

if (!$format->get_section_number() || !in_array('format-designer-single-section', $bodyclasses)) {
if ((!$format->get_section_number() || !in_array('format-designer-single-section', $bodyclasses))
&& class_exists('core_courseformat\output\local\content\bulkedittoggler')) {
$data->sectionbulk = true;
}

Expand Down
Loading

0 comments on commit 5f077ec

Please sign in to comment.