Skip to content

Commit

Permalink
Merge pull request #250 from learnweb/update/m42
Browse files Browse the repository at this point in the history
Update for Moodle 4.2
  • Loading branch information
Laur0r authored May 17, 2023
2 parents 8610a4a + 46da177 commit 972392e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 52 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:

strategy:
matrix:
php: ['8.0']
moodle-branch: ['MOODLE_401_STABLE']
php: ['8.1']
moodle-branch: ['MOODLE_402_STABLE']
database: ['pgsql']

steps:
Expand Down Expand Up @@ -108,8 +108,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.0']
moodle-branch: ['MOODLE_311_STABLE', 'MOODLE_400_STABLE', 'MOODLE_401_STABLE']
php: ['8.0', '8.1']
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE']
database: ['mariadb', 'pgsql']
include:
- php: '7.4'
Expand All @@ -118,6 +118,18 @@ jobs:
- php: '7.4'
moodle-branch: 'MOODLE_39_STABLE'
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_311_STABLE'
database: 'mariadb'
- php: '8.0'
moodle-branch: 'MOODLE_311_STABLE'
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_400_STABLE'
database: 'mariadb'
- php: '8.0'
moodle-branch: 'MOODLE_400_STABLE'
database: 'pgsql'

steps:
- name: Start MariaDB
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/moodle-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
--data-urlencode "altdownloadurl=${ZIPURL}" \
--data-urlencode "releasenotes=${BODY}" \
--data-urlencode "releasenotesformat=4")
echo "::set-output name=response::${RESPONSE}"
echo "response=${RESPONSE}" >> $GITHUB_OUTPUT
- name: Evaluate the response
id: evaluate-response
env:
Expand Down
2 changes: 1 addition & 1 deletion classes/allocations_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct($ratingallocate) {
$this->ratingallocate = $ratingallocate;
if (has_capability('mod/ratingallocate:export_ratings', $ratingallocate->get_context())) {
$download = optional_param('download', '', PARAM_ALPHA);
$this->is_downloading($download, $ratingallocate->ratingallocate->name, 'Testsheet');
$this->is_downloading($download, $ratingallocate->ratingallocate->name . '-allocations', 'allocations');
}
}

Expand Down
5 changes: 3 additions & 2 deletions classes/ratings_and_allocations_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(\mod_ratingallocate_renderer $renderer, $titles, $ra
$this->ratingallocate = $ratingallocate;
if ($downloadable && has_capability('mod/ratingallocate:export_ratings', $ratingallocate->get_context())) {
$download = optional_param('download', '', PARAM_ALPHA);
$this->is_downloading($download, 'Test', 'Testsheet');
$this->is_downloading($download, $ratingallocate->ratingallocate->name . '-ratings_and_allocations', 'ratings_and_allocations');
}

$this->shownames = true;
Expand Down Expand Up @@ -419,7 +419,8 @@ private function print_hidden_user_fields($users) {
*/
private function setup_filter($hidenorating = null, $showallocnecessary = null) {
// Get the filter settings.
$filter = json_decode(get_user_preferences('flextable_' . $this->uniqueid . '_filter'), true);
$settings = get_user_preferences('flextable_' . $this->uniqueid . '_filter');
$filter = $settings ? json_decode($settings, true) : null;

if (!$filter) {
$filter = array(
Expand Down
44 changes: 1 addition & 43 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public function format_text($text) {
* @param $classes string class for the formatting of the notification
*/
public function add_notification($note, $classes = 'notifyproblem') {
array_push($this->notifications, $this->notification($note, $classes));
array_push($this->notifications, $this->notification($note, $classes, false));
}

/**
Expand Down Expand Up @@ -766,48 +766,6 @@ private function get_option_title($rating, strategytemplate $strategy) {
get_string('rating_raw', RATINGALLOCATE_MOD_NAME, $option);
}

/**
* Format the users in the rating table
*/
public function format_user_data($data) {
global $CFG, $USER, $COURSE;

$output = '';
$output .= html_writer::start_tag('div', array('class' => 'ratingallocate_user'));
$output .= html_writer::start_tag('div', array('class' => 'name'));
$output .= fullname($data);
$output .= html_writer::end_tag('div');
$output .= html_writer::start_tag('div', array('class' => 'icons'));
if (has_capability('moodle/user:viewdetails', $this->page->context)) {
$a = array();
$a['href'] = new moodle_url('/user/view.php', array('id' => $data->id, 'course' => $COURSE->id));
$a['title'] = get_string('viewprofile', 'core');
$output .= html_writer::start_tag('a', $a);

$src = array('src' => $this->output->pix_url('i/user'), 'class' => 'icon', 'alt' => get_string('viewprofile', 'core'));
$output .= html_writer::empty_tag('img', $src);

$output .= html_writer::end_tag('a');
}

if ($CFG->messaging && has_capability('moodle/site:sendmessage', $this->page->context) && $data->id != $USER->id) {
$a = array();
$a['href'] = new moodle_url('/message/index.php', array('id' => $data->id));
$a['title'] = get_string('sendmessageto', 'core_message', fullname($data));
$output .= html_writer::start_tag('a', $a);

$src = array('src' => $this->output->pix_url('t/email'), 'class' => 'icon');
$src['alt'] = get_string('sendmessageto', 'core_message', fullname($data));
$output .= html_writer::empty_tag('img', $src);

$output .= html_writer::end_tag('a');
}
$output .= html_writer::end_tag('div');
$output .= html_writer::end_tag('div');

return $output;
}

/**
* Utility function to add a row of data to a table with 2 columns. Modified
* the table param and does not return a value
Expand Down
1 change: 1 addition & 0 deletions tests/behat/mod_form.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Feature: Creating a new rating allocation, where new choices need to
| title | My third choice |
| Description (optional) | Test 3 |
| maxsize | 2 |
And the default editor is set to "textarea"

Scenario: Create a new rating alloation and add an additonal new choice.
Given I add a new choice with the values:
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
$plugin->version = 2023050900; // The current module version (Date: YYYYMMDDXX)
$plugin->requires = 2020061500; // Requires Moodle 3.9+.
$plugin->maturity = MATURITY_STABLE;
$plugin->release = 'v4.0-r1';
$plugin->release = 'v4.2-r1';
$plugin->component = 'mod_ratingallocate'; // To check on upgrade, that module sits in correct place

0 comments on commit 972392e

Please sign in to comment.