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', '