diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 761043d..58866b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,19 +7,13 @@ jobs: runs-on: ubuntu-22.04 services: - postgres: - image: postgres:9.6 - env: - POSTGRES_USER: 'postgres' - POSTGRES_HOST_AUTH_METHOD: 'trust' - ports: - - 5432:5432 - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 mariadb: - image: mariadb:10.5 + image: mariadb:10.6 env: MYSQL_USER: 'root' MYSQL_ALLOW_EMPTY_PASSWORD: "true" + MYSQL_CHARACTER_SET_SERVER: "utf8mb4" + MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci" ports: - 3306:3306 options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3 @@ -27,31 +21,9 @@ jobs: strategy: fail-fast: false matrix: - include: - - php: 7.3 - moodle-branch: 'MOODLE_311_STABLE' - database: pgsql - - php: 7.3 - moodle-branch: 'MOODLE_311_STABLE' - database: mariadb - - php: 7.4 - moodle-branch: 'MOODLE_311_STABLE' - database: pgsql - - php: 7.4 - moodle-branch: 'MOODLE_311_STABLE' - database: mariadb - - php: 8.0 - # The following line is only needed if you're going to run php8 jobs and your - # plugin needs xmlrpc services. - extensions: xmlrpc-beta - moodle-branch: MOODLE_311_STABLE - database: pgsql - - php: 8.0 - # The following line is only needed if you're going to run php8 jobs and your - # plugin needs xmlrpc services. - extensions: xmlrpc-beta - moodle-branch: MOODLE_311_STABLE - database: mariadb + php: ['7.4', '8.0'] + moodle-branch: ['MOODLE_311_STABLE'] + database: [mariadb] steps: - name: Check out repository code @@ -69,7 +41,7 @@ jobs: - name: Initialise moodle-plugin-ci run: | - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3 + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4 echo $(cd ci/bin; pwd) >> $GITHUB_PATH echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH sudo locale-gen en_AU.UTF-8 diff --git a/Changes.md b/Changes.md index 0cfc623..d6835b8 100644 --- a/Changes.md +++ b/Changes.md @@ -1,3 +1,7 @@ +Change Log in version 311.1.6 (2021081011) +========================================== +1. Fix 'Front Page Course Limited to 20' - ref: https://moodle.org/mod/forum/discuss.php?d=450609. + Change Log in version 311.1.5 (2021081010) ========================================== 1. Add new 'dimmedtextcolor' setting for the 'dimmed_text' CSS class - #290. diff --git a/classes/output/core/course_renderer.php b/classes/output/core/course_renderer.php index bedf66d..265712f 100644 --- a/classes/output/core/course_renderer.php +++ b/classes/output/core/course_renderer.php @@ -347,59 +347,6 @@ protected function coursecat_coursebox_content(coursecat_helper $chelper, $cours return $content; } - /** - * Frontpage course list - * - * @return string - */ - public function frontpage_my_courses() { - global $CFG, $DB; - $output = ''; - if (!isloggedin() or isguestuser()) { - return ''; - } - // Calls a core renderer method (render_mycourses) to get list of a user's current courses that they are enrolled on. - $sortedcourses = $this->render_mycourses(); - - if (!empty($sortedcourses) || !empty($rcourses) || !empty($rhosts)) { - $chelper = new coursecat_helper(); - if (count($sortedcourses) > $CFG->frontpagecourselimit) { - // There are more enrolled courses than we can display, display link to 'My courses'. - $totalcount = count($sortedcourses); - $courses = array_slice($sortedcourses, 0, $CFG->frontpagecourselimit, true); - $chelper->set_courses_display_options(array( - 'viewmoreurl' => new moodle_url('/my/'), - 'viewmoretext' => new lang_string('mycourses') - )); - } else { - // All enrolled courses are displayed, display link to 'All courses' if there are more courses in system. - $chelper->set_courses_display_options(array( - 'viewmoreurl' => new moodle_url('/course/index.php'), - 'viewmoretext' => new lang_string('fulllistofcourses') - )); - $totalcount = $DB->count_records('course') - 1; - } - $chelper->set_show_courses(self::COURSECAT_SHOW_COURSES_EXPANDED)->set_attributes( - array('class' => 'frontpage-course-list-enrolled')); - $output .= $this->coursecat_courses($chelper, $sortedcourses, $totalcount); - - if (!empty($rcourses)) { - $output .= html_writer::start_tag('div', array('class' => 'courses')); - foreach ($rcourses as $course) { - $output .= $this->frontpage_remote_course($course); - } - $output .= html_writer::end_tag('div'); - } else if (!empty($rhosts)) { - $output .= html_writer::start_tag('div', array('class' => 'courses')); - foreach ($rhosts as $host) { - $output .= $this->frontpage_remote_host($host); - } - $output .= html_writer::end_tag('div'); - } - } - return $output; - } - // New methods added for activity styling below. Adapted from snap theme by Moodleroooms. /** diff --git a/classes/output/core_renderer_toolbox.php b/classes/output/core_renderer_toolbox.php index 5d0665e..f622401 100644 --- a/classes/output/core_renderer_toolbox.php +++ b/classes/output/core_renderer_toolbox.php @@ -472,7 +472,7 @@ protected function block_annotation(block_contents $bc) { * @param block_contents $bc A block_contents object */ public function init_block_hider_js(block_contents $bc) { - if (!empty($bc->attributes['id']) and $bc->collapsible != block_contents::NOT_HIDEABLE) { + if (!empty($bc->attributes['id']) && $bc->collapsible != block_contents::NOT_HIDEABLE) { $config = new stdClass; $config->id = $bc->attributes['id']; $config->title = strip_tags($bc->title); @@ -3094,7 +3094,7 @@ protected function render_tabtree(\tabtree $tabtree) { * @return string HTML fragment */ protected function render_tabobject(\tabobject $tab) { - if ($tab->selected or $tab->activated) { + if ($tab->selected || $tab->activated) { return html_writer::tag('li', html_writer::tag('a', $tab->text, array('class' => 'nav-link active')), array('class' => 'nav-item')); } else if ($tab->inactive) { diff --git a/classes/output/core_user/myprofile/editprofile.php b/classes/output/core_user/myprofile/editprofile.php index d875c0c..db9892f 100644 --- a/classes/output/core_user/myprofile/editprofile.php +++ b/classes/output/core_user/myprofile/editprofile.php @@ -160,7 +160,7 @@ public static function process_form($redirect = true, $editprofile = null) { $usernew->confirmed = 1; $usernew->timecreated = time(); if ($authplugin->is_internal()) { - if ($createpassword or empty($usernew->newpassword)) { + if ($createpassword || empty($usernew->newpassword)) { $usernew->password = ''; } else { $usernew->password = hash_internal_user_password($usernew->newpassword); @@ -170,7 +170,7 @@ public static function process_form($redirect = true, $editprofile = null) { } $usernew->id = user_create_user($usernew, false, false); - if (!$authplugin->is_internal() and $authplugin->can_change_password() and !empty($usernew->newpassword)) { + if (!$authplugin->is_internal() && $authplugin->can_change_password() && !empty($usernew->newpassword)) { if (!$authplugin->user_update_password($usernew, $usernew->newpassword)) { // Do not stop here, we need to finish user creation. debugging(get_string('cannotupdatepasswordonextauth', '', '', $usernew->auth), DEBUG_NONE); @@ -207,7 +207,7 @@ public static function process_form($redirect = true, $editprofile = null) { } // Force logout if user just suspended. - if (isset($usernew->suspended) and $usernew->suspended and !$user->suspended) { + if (isset($usernew->suspended) && $usernew->suspended && !$user->suspended) { \core\session\manager::kill_user_sessions($user->id); } } @@ -255,7 +255,7 @@ public static function process_form($redirect = true, $editprofile = null) { if ($user->id == $USER->id) { // Override old $USER session variable. foreach ((array)$usernew as $variable => $value) { - if ($variable === 'description' or $variable === 'password') { + if ($variable === 'description' || $variable === 'password') { // These are not set for security nad perf reasons. continue; } diff --git a/classes/output/core_user/myprofile/editprofile_form.php b/classes/output/core_user/myprofile/editprofile_form.php index f5ddd39..e506c19 100644 --- a/classes/output/core_user/myprofile/editprofile_form.php +++ b/classes/output/core_user/myprofile/editprofile_form.php @@ -112,13 +112,13 @@ public function definition_after_data() { } } - if ($user and is_mnet_remote_user($user)) { + if ($user && is_mnet_remote_user($user)) { // Only local accounts can be suspended. if ($mform->elementExists('suspended')) { $mform->removeElement('suspended'); } } - if ($user and ($user->id == $USER->id or is_siteadmin($user))) { + if ($user && ($user->id == $USER->id || is_siteadmin($user))) { // Prevent self and admin mess ups. if ($mform->elementExists('suspended')) { $mform->hardFreeze('suspended'); @@ -200,7 +200,7 @@ public function editprofile_definition(&$mform, $editoroptions, $filemanageropti $mform->setDefault('city', $CFG->defaultcity); } - if (\core_tag_tag::is_enabled('core', 'user') and empty($USER->newadminuser)) { + if (\core_tag_tag::is_enabled('core', 'user') && empty($USER->newadminuser)) { $mform->addElement('static', 'moodle_interests', '

'.get_string('interests').'

'); $mform->addElement('tags', 'interests', get_string('interestslist'), array('itemtype' => 'user', 'component' => 'core')); diff --git a/classes/output/core_user/myprofile/renderer.php b/classes/output/core_user/myprofile/renderer.php index d1dd9db..5f2e56e 100644 --- a/classes/output/core_user/myprofile/renderer.php +++ b/classes/output/core_user/myprofile/renderer.php @@ -586,7 +586,7 @@ protected function userprofilefields() { if ((!empty($customcoursesubtitleprofilefield)) && ($formfield->field->shortname == $customcoursesubtitleprofilefield)) { continue; } - if ($formfield->is_visible() and !$formfield->is_empty()) { + if ($formfield->is_visible() && !$formfield->is_empty()) { $node = new node('customfields', 'custom_field_' . $formfield->field->shortname, format_string($formfield->field->name), null, null, $formfield->display_data()); $customfieldscat->add_node($node); diff --git a/classes/output/mustachesource_renderer.php b/classes/output/mustachesource_renderer.php index 152a2ee..0970640 100644 --- a/classes/output/mustachesource_renderer.php +++ b/classes/output/mustachesource_renderer.php @@ -24,8 +24,6 @@ namespace theme_adaptable\output; -defined('MOODLE_INTERNAL') || die(); - /** * The mustache renderer. * diff --git a/classes/traits/single_section_page.php b/classes/traits/single_section_page.php index 5dba8c6..e72cd4e 100644 --- a/classes/traits/single_section_page.php +++ b/classes/traits/single_section_page.php @@ -124,7 +124,7 @@ protected function print_single_section_page_content($course, $sections, $mods, echo $this->course_activity_clipboard($course, $displaysection); if ($showsectionzero) { $thissection = $modinfo->get_section_info(0); - if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) { + if ($thissection->summary || !empty($modinfo->sections[0]) || $PAGE->user_is_editing()) { echo $this->start_section_list(); echo $this->section_header($thissection, $course, true, $displaysection); echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection); @@ -236,7 +236,7 @@ protected function section_nav_selection_content($course, $sections, $displaysec $numsections = $this->get_num_sections($course); while ($section <= $numsections) { $thissection = $modinfo->get_section_info($section); - $showsection = $thissection->uservisible or !$course->hiddensections; + $showsection = $thissection->uservisible || !$course->hiddensections; if (($showsection) && ($section != $displaysection) && ($url = course_get_url($course, $section))) { $sectionmenu[$url->out(false)] = $this->shorten_string(get_section_name($course, $section)); } @@ -303,7 +303,7 @@ protected function get_nav_links_content($course, $sections, $sectionno, $buffer // FIXME: This is really evil and should by using the navigation API. $course = course_get_format($course)->get_course(); $canviewhidden = has_capability('moodle/course:viewhiddensections', context_course::instance($course->id)) - or !$course->hiddensections; + || !$course->hiddensections; $links = array('previous' => html_writer::tag('div', '', array('class' => 'previous_section prevnext')), 'next' => html_writer::tag('div', '', array('class' => 'next_section prevnext'))); diff --git a/lib.php b/lib.php index 30d11e7..ec8a9fa 100644 --- a/lib.php +++ b/lib.php @@ -718,7 +718,7 @@ function theme_adaptable_get_course_activities() { foreach ($modinfo->cms as $cm) { // Exclude activities which are not visible or have no link (=label). - if (!$cm->uservisible or !$cm->has_view()) { + if (!$cm->uservisible || !$cm->has_view()) { continue; } if (array_key_exists($cm->modname, $modfullnames)) { diff --git a/libs/admin_confightmleditor.php b/libs/admin_confightmleditor.php index 34f6664..f9ad0e7 100644 --- a/libs/admin_confightmleditor.php +++ b/libs/admin_confightmleditor.php @@ -68,7 +68,7 @@ public function __construct($name, $visiblename, $description, $defaultsetting, $this->rows = $rows; $this->cols = $cols; $this->filearea = $filearea; - $this->nosave = (during_initial_install() or CLI_SCRIPT); + $this->nosave = (during_initial_install() || CLI_SCRIPT); parent::__construct($name, $visiblename, $description, $defaultsetting, $paramtype); editors_head_setup(); } @@ -112,7 +112,7 @@ public function output_html($data, $query='') { $default = $this->get_defaultsetting(); $defaultinfo = $default; - if (!is_null($default) and $default !== '') { + if (!is_null($default) && $default !== '') { $defaultinfo = "\n".$default; } @@ -196,7 +196,7 @@ public function write_setting($data) { return ''; } - if ($this->paramtype === PARAM_INT and $data === '') { + if ($this->paramtype === PARAM_INT && $data === '') { // ... do not complain if '' used instead of 0 ! $data = 0; } @@ -215,7 +215,7 @@ public function write_setting($data) { } $draftitemidname = sprintf('%s_draftitemid', $this->get_full_name()); - if (PHPUNIT_TEST or !isset($_REQUEST[$draftitemidname])) { + if (PHPUNIT_TEST || !isset($_REQUEST[$draftitemidname])) { $draftitemid = 0; } else { $draftitemid = $_REQUEST[$draftitemidname]; diff --git a/settings/adaptable_admin_setting_configtemplate.php b/settings/adaptable_admin_setting_configtemplate.php index 507aeb0..d8176b3 100644 --- a/settings/adaptable_admin_setting_configtemplate.php +++ b/settings/adaptable_admin_setting_configtemplate.php @@ -76,7 +76,7 @@ public function output_html($data, $query='') { $default = $this->get_defaultsetting(); $defaultinfo = $default; - if (!is_null($default) and $default !== '') { + if (!is_null($default) && $default !== '') { $defaultinfo = "\n".$default; } diff --git a/version.php b/version.php index 8b55eb8..eb123a3 100644 --- a/version.php +++ b/version.php @@ -32,14 +32,14 @@ $plugin->component = 'theme_adaptable'; // Adaptable version date (YYYYMMDDrr where rr is the release number). -$plugin->version = 2021081010; +$plugin->version = 2021081011; $plugin->requires = 2021051700.00; // 3.11 (Build: 20210517). $plugin->supported = array(311, 311); // Adaptable version using SemVer (https://semver.org). -$plugin->release = '311.1.5'; +$plugin->release = '311.1.6'; // Adaptable maturity (do not use ALPHA or BETA versions in production sites). $plugin->maturity = MATURITY_STABLE;