Skip to content

Commit

Permalink
V311.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Sep 21, 2023
1 parent ae764bd commit eaebaad
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 111 deletions.
42 changes: 7 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,23 @@ 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

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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
53 changes: 0 additions & 53 deletions classes/output/core/course_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.

/**
Expand Down
4 changes: 2 additions & 2 deletions classes/output/core_renderer_toolbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions classes/output/core_user/myprofile/editprofile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions classes/output/core_user/myprofile/editprofile_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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', '<h3>'.get_string('interests').'</h3>');
$mform->addElement('tags', 'interests', get_string('interestslist'),
array('itemtype' => 'user', 'component' => 'core'));
Expand Down
2 changes: 1 addition & 1 deletion classes/output/core_user/myprofile/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions classes/output/mustachesource_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

namespace theme_adaptable\output;

defined('MOODLE_INTERNAL') || die();

/**
* The mustache renderer.
*
Expand Down
6 changes: 3 additions & 3 deletions classes/traits/single_section_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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')));
Expand Down
2 changes: 1 addition & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
8 changes: 4 additions & 4 deletions libs/admin_confightmleditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand All @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion settings/adaptable_admin_setting_configtemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit eaebaad

Please sign in to comment.