Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Jan 10, 2024
1 parent 36e9da1 commit ae8a50f
Show file tree
Hide file tree
Showing 16 changed files with 250 additions and 250 deletions.
52 changes: 26 additions & 26 deletions classes/course_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function course_section_cm_classes_vsf(cm_info $mod) {
*
* @return string.
*/
public function course_section_cm_text_vsf(cm_info $mod, $vsfavailability = false, $displayoptions = array()) {
public function course_section_cm_text_vsf(cm_info $mod, $vsfavailability = false, $displayoptions = []) {
if (!$mod->is_visible_on_course_page()) {
// Nothing to be displayed to the user.
return '';
Expand All @@ -93,8 +93,8 @@ public function course_section_cm_text_vsf(cm_info $mod, $vsfavailability = fals
if (!empty($availabilityinfo)) {
$availabilityinfo = $this->process_availability($availabilityinfo);
$avcontent .= html_writer::start_tag('span', ['class' => 'vsfai', 'title' => $availabilityinfo['text']]);
$avcontent .= html_writer::empty_tag('img', array('src' => $this->image_url('access_transparent', 'format_vsf'),
'alt' => '', 'role' => 'presentation'));
$avcontent .= html_writer::empty_tag('img', ['src' => $this->image_url('access_transparent', 'format_vsf'),
'alt' => '', 'role' => 'presentation']);
$avcontent .= html_writer::end_tag('span');
}
}
Expand All @@ -104,7 +104,7 @@ public function course_section_cm_text_vsf(cm_info $mod, $vsfavailability = fals
$textclasses .= ' vsfactivity';
$textclasses = trim($textclasses);

$classes = array();
$classes = [];
if ($content) {
// If specified, display extra content after link.
if (!empty($textclasses)) {
Expand All @@ -131,13 +131,13 @@ public function course_section_cm_text_vsf(cm_info $mod, $vsfavailability = fals
}
if ((!empty($availabilityinfo)) && (!empty($availabilityinfo['button']))) {
$output .= html_writer::tag('div', $availabilityinfo['button'],
array('class' => 'mdl-align vsf-button-bottom vsf-aib'));
['class' => 'mdl-align vsf-button-bottom vsf-aib']);
}
}

if ((!$this->moduledescriptiontooltip) && ($mod->showdescription == 1)) {
// Setting 1 means yes.
$modcontent = $mod->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
$modcontent = $mod->get_formatted_content(['overflowdiv' => true, 'noclean' => true]);
$modpic = mb_strpos($modcontent, 'modpic');
if ($modpic !== false) {
$modpicstartstring = mb_substr($modcontent, 0, $modpic);
Expand All @@ -150,7 +150,7 @@ public function course_section_cm_text_vsf(cm_info $mod, $vsfavailability = fals
$output .= html_writer::tag(
'div',
$modcontent,
array('class' => 'vsf-mod-description pt-2')
['class' => 'vsf-mod-description pt-2']
);
}

Expand Down Expand Up @@ -182,7 +182,7 @@ private function process_availability($availabilityinfo) {
$inpaymentlinktag = false;
$currenttag = '';
$lasttag = '';
$processed = array('text' => '', 'button' => '');
$processed = ['text' => '', 'button' => ''];
$avilen = core_text::strlen($availabilityinfo);

for ($charno = 0; $charno < $avilen; $charno++) {
Expand Down Expand Up @@ -247,7 +247,7 @@ private function process_availability($availabilityinfo) {
* @param array $displayoptions
* @return string
*/
public function course_section_cm_vsf($course, &$completioninfo, cm_info $mod, $sectionreturn, $displayoptions = array()) {
public function course_section_cm_vsf($course, &$completioninfo, cm_info $mod, $sectionreturn, $displayoptions = []) {
$output = '';
/* We return empty string (because course module will not be displayed at all)
if:
Expand Down Expand Up @@ -284,7 +284,7 @@ public function course_section_cm_vsf($course, &$completioninfo, cm_info $mod, $

if (!empty($cmname)) {
// Start the div for the activity title, excluding the edit icons.
$output .= html_writer::start_tag('div', array('class' => 'activityinstance'));
$output .= html_writer::start_tag('div', ['class' => 'activityinstance']);
$output .= $cmname;

// Module can put text after the link (e.g. forum unread).
Expand Down Expand Up @@ -322,7 +322,7 @@ public function course_section_cm_vsf($course, &$completioninfo, cm_info $mod, $
* @param array $displayoptions
* @return string
*/
public function vsf_course_section_cm_availability(cm_info $mod, $displayoptions = array()) {
public function vsf_course_section_cm_availability(cm_info $mod, $displayoptions = []) {
global $CFG;
$output = '';
if (!$mod->is_visible_on_course_page()) {
Expand Down Expand Up @@ -416,19 +416,19 @@ public function vsf_availability_info($text, $additionalclasses = '') {
* @return String
*/
public function course_section_cm_list_item_vsf($course, &$completioninfo, cm_info $mod,
$sectionreturn, $displayoptions = array()) {
$sectionreturn, $displayoptions = []) {
$output = '';
static $modulelayout = array(
static $modulelayout = [
1 => 'col-sm-12 col-md-6 col-lg-4 col-xl-2',
2 => 'col-md-12 col-lg-6 col-xl-4'
);
2 => 'col-md-12 col-lg-6 col-xl-4',
];
$ourclasses = ' '.$modulelayout[$course->layoutcolumns].' moduleviewgap';
if ($this->moduleviewbutton) {
$ourclasses .= ' moduleviewgapwithbutton';
}
if ($modulehtml = $this->course_section_cm_vsf($course, $completioninfo, $mod, $sectionreturn, $displayoptions)) {
$modclasses = 'activity '.$mod->modname.' modtype_'.$mod->modname.' '.trim($mod->extraclasses.$ourclasses);
$output .= html_writer::tag('div', $modulehtml, array('class' => $modclasses, 'id' => 'module-' . $mod->id));
$output .= html_writer::tag('div', $modulehtml, ['class' => $modclasses, 'id' => 'module-' . $mod->id]);
}
return $output;
}
Expand All @@ -453,7 +453,7 @@ public function course_section_cm_list_label_item_vsf($course, &$completioninfo,
$output = '';
if ($modulehtml = $this->course_section_label_cm_vsf($course, $completioninfo, $mod, $sectionreturn, $displayoptions)) {
$modclasses = 'activity ' . $mod->modname . ' modtype_' . $mod->modname . ' ' . $mod->extraclasses;
$output .= html_writer::tag('li', $modulehtml, array('class' => $modclasses, 'id' => 'module-' . $mod->id));
$output .= html_writer::tag('li', $modulehtml, ['class' => $modclasses, 'id' => 'module-' . $mod->id]);
}
return $output;
}
Expand Down Expand Up @@ -507,7 +507,7 @@ public function course_section_label_cm_vsf($course, &$completioninfo,
* @param int $displayoptions
* @return void
*/
public function course_section_cm_list_vsf($course, $section, $sectionreturn = null, $displayoptions = array()) {
public function course_section_cm_list_vsf($course, $section, $sectionreturn = null, $displayoptions = []) {
$output = '';
$modinfo = get_fast_modinfo($course);
if (is_object($section)) {
Expand All @@ -524,8 +524,8 @@ public function course_section_cm_list_vsf($course, $section, $sectionreturn = n
$this->moduledescriptiontooltip = true;
}
// Get the list of modules visible to user (excluding the module being moved if there is one).
$moduleshtml = array();
$aftermoduleshtml = array();
$moduleshtml = [];
$aftermoduleshtml = [];
if (!empty($modinfo->sections[$section->section])) {
foreach ($modinfo->sections[$section->section] as $modnumber) {
$mod = $modinfo->cms[$modnumber];
Expand All @@ -544,7 +544,7 @@ public function course_section_cm_list_vsf($course, $section, $sectionreturn = n

$sectionoutput = '';
if (!empty($moduleshtml)) {
$sectionoutput .= html_writer::start_tag('li', array('class' => 'row no-gutters justify-content-center'));
$sectionoutput .= html_writer::start_tag('li', ['class' => 'row no-gutters justify-content-center']);
foreach ($moduleshtml as $modnumber => $modulehtml) {

$sectionoutput .= $modulehtml;
Expand All @@ -559,7 +559,7 @@ public function course_section_cm_list_vsf($course, $section, $sectionreturn = n
}

// Always output the section module list.
$output .= html_writer::tag('ul', $sectionoutput, array('class' => 'moduleview section img-text'));
$output .= html_writer::tag('ul', $sectionoutput, ['class' => 'moduleview section img-text']);

return $output;
}
Expand All @@ -577,13 +577,13 @@ protected function course_section_cm_button(cm_info $mod) {
// Return button.
return html_writer::tag('span',
html_writer::link($mod->url, $mod->get_formatted_name(), $attributes),
array('class' => 'mdl-align px-1 w-100'));
['class' => 'mdl-align px-1 w-100']);
} else {
// Return as disabled text only button.
$this->merge_attributes($attributes, ['class' => 'disabled']);
return html_writer::tag('span',
html_writer::tag('span', $mod->get_formatted_name(), $attributes),
array('class' => 'mdl-align px-1 w-100'));
['class' => 'mdl-align px-1 w-100']);
}
}

Expand All @@ -606,7 +606,7 @@ protected function course_section_cm_image(cm_info $mod) {
$image = html_writer::img($srcurl, $mod->get_formatted_name(),
['class' => $class, 'alt' => ' ', 'role' => 'presentation']);
return html_writer::tag('span',
$image, array('class' => 'mdl-align vsf-icon'));
$image, ['class' => 'mdl-align vsf-icon']);
}

/**
Expand Down Expand Up @@ -642,7 +642,7 @@ protected function get_tooltip_content(cm_info $mod) {
// Setting 0 means no.
return $output;
}
return $mod->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
return $mod->get_formatted_content(['overflowdiv' => true, 'noclean' => true]);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions classes/local/modicon/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ public static function delete_module($modname) {
require_once($CFG->dirroot . '/lib/modinfolib.php');

$cmids = $DB->get_fieldset_sql("SELECT cm.id FROM {course_modules} cm
INNER JOIN {modules} m ON m.id = cm.module WHERE m.name = ?", array(
$modname
));
INNER JOIN {modules} m ON m.id = cm.module WHERE m.name = ?", [
$modname,
]);
$cache = \cache::make('format_vsf', 'modicons');
$cache->delete_many($cmids);
}
Expand All @@ -201,7 +201,7 @@ public static function dump_modicons($cm) {
require_once($CFG->dirroot . '/lib/filelib.php');

$modicon = (object)[
'mod' => $cm->modname
'mod' => $cm->modname,
];
$fs = get_file_storage();

Expand Down
6 changes: 3 additions & 3 deletions classes/local/modicon/overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function export_for_template(\renderer_base $output) {
$rs = (object)[
'context' => $this->context,
'limitmod' => get_string('all'),
'modules' => []
'modules' => [],
];

switch ($this->context->contextlevel) {
Expand All @@ -86,7 +86,7 @@ public function export_for_template(\renderer_base $output) {
$this->mark_class($icons);
$rs->modules[] = (object)[
'cm' => $cm,
'icons' => $icons
'icons' => $icons,
];
break;

Expand All @@ -99,7 +99,7 @@ public function export_for_template(\renderer_base $output) {
$this->mark_class($icons);
$rs->modules[] = (object)[
'cm' => $cm,
'icons' => $icons
'icons' => $icons,
];
}
break;
Expand Down
20 changes: 10 additions & 10 deletions classes/local/modicon/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ public static function add_modules_form_elements(&$mform, $context, $course = nu
require_once($CFG->dirroot . '/course/lib.php');

$maxbytes = 10 * 1024 * 1024;
$options = array(
$options = [
'subdirs' => 0,
'maxbytes' => $maxbytes,
'areamaxbytes' => 10485760,
'maxfiles' => static::MAX_FILES,
'accepted_types' => array('image'),
);
'accepted_types' => ['image'],
];

$modulenames = get_module_types_names(false);
if (empty($course) || empty($course->id) || $course->id == SITEID || $context->contextlevel == CONTEXT_COURSECAT) {
Expand Down Expand Up @@ -140,13 +140,13 @@ public static function store_modules_form_elements(&$mform, $context, $course =
public static function add_cm_form_elements(&$mform, $cm) {
list($course, $cminfo) = get_course_and_cm_from_cmid($cm, $cm->modname);
$maxbytes = 10 * 1024 * 1024;
$options = array(
$options = [
'subdirs' => 0,
'maxbytes' => $maxbytes,
'areamaxbytes' => 10485760,
'maxfiles' => static::MAX_FILES,
'accepted_types' => array('image'),
);
'accepted_types' => ['image'],
];

$key = "cm{$cm->id}";
$elementname = self::get_element_name($key);
Expand Down Expand Up @@ -193,7 +193,7 @@ public static function store_cm_form_elements(&$mform, $cm) {
* @return int
*/
public static function prepare_draftarea($filearea, $itemid, $context, &$draftitemid) {
$options = array('subdirs' => 0, 'maxfiles' => static::MAX_FILES);
$options = ['subdirs' => 0, 'maxfiles' => static::MAX_FILES];
file_prepare_draft_area($draftitemid, $context->id, self::COMPONENT,
$filearea, $itemid, $options);
return $draftitemid;
Expand All @@ -209,7 +209,7 @@ public static function prepare_draftarea($filearea, $itemid, $context, &$draftit
* @return string|null
*/
public static function store_draft_files($filearea, $itemid, $context, $draftitemid) {
$options = array('subdirs' => 0, 'maxfiles' => static::MAX_FILES);
$options = ['subdirs' => 0, 'maxfiles' => static::MAX_FILES];
$text = null;
return file_save_draft_area_files($draftitemid, $context->id, self::COMPONENT,
$filearea, $itemid, $options, $text);
Expand All @@ -226,15 +226,15 @@ public static function get_options($context, $overrideoptions = []) {
global $CFG;
require_once("$CFG->libdir/filelib.php");
require_once("$CFG->dirroot/repository/lib.php");
$defaults = array(
$defaults = [
'mainfile' => '',
'subdirs' => 0,
'maxbytes' => -1,
'maxfiles' => static::MAX_FILES,
'accepted_types' => '*',
'return_types' => FILE_INTERNAL,
'areamaxbytes' => FILE_AREA_MAX_BYTES_UNLIMITED,
'context' => $context);
'context' => $context];

foreach ($overrideoptions as $k => $v) {
$defaults[$k] = $v;
Expand Down
6 changes: 3 additions & 3 deletions classes/output/courseformat/content/cm/controlmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ protected function cm_control_items() {
$editiconurl = new \moodle_url($CFG->wwwroot . '/course/format/vsf/modicon.php', $editiconparams);
$parentcontrols['editicon'] = new \action_menu_link_secondary(
$editiconurl,
new \pix_icon('e/insert_edit_image', '', 'moodle', array('class' => 'iconsmall')),
new \pix_icon('e/insert_edit_image', '', 'moodle', ['class' => 'iconsmall']),
$editicon,
array('class' => 'editing_editcmicon', 'data-action' => 'editcmicon',
'data-keepopen' => true, 'data-sectionreturn' => $sectionreturn)
['class' => 'editing_editcmicon', 'data-action' => 'editcmicon',
'data-keepopen' => true, 'data-sectionreturn' => $sectionreturn]
);

return $parentcontrols;
Expand Down
20 changes: 10 additions & 10 deletions classes/output/courseformat/content/section/controlmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,25 @@ public function section_control_items() {
if ($course->marker == $section->section) { // Show the "light globe" on/off.
$url->param('marker', 0);
$highlightoff = get_string('highlightoff');
$controls['highlight'] = array(
$controls['highlight'] = [
'url' => $url, "icon" => 'i/marked',
'name' => $highlightoff,
'pixattr' => array('class' => ''),
'attr' => array(
'pixattr' => ['class' => ''],
'attr' => [
'class' => 'editing_highlight',
'data-action' => 'removemarker')
);
'data-action' => 'removemarker'],
];
} else {
$url->param('marker', $section->section);
$highlight = get_string('highlight');
$controls['highlight'] = array(
$controls['highlight'] = [
'url' => $url, "icon" => 'i/marker',
'name' => $highlight,
'pixattr' => array('class' => ''),
'attr' => array(
'pixattr' => ['class' => ''],
'attr' => [
'class' => 'editing_highlight',
'data-action' => 'setmarker')
);
'data-action' => 'setmarker'],
];
}
}

Expand Down
Loading

0 comments on commit ae8a50f

Please sign in to comment.