Skip to content

Commit 438bffe

Browse files
committed
Merge branch 'update/M4.4' of github.com:learnweb/moodle-mod_moodleoverflow into feature/limitedanswermode
2 parents f0ff660 + 9bb30d1 commit 438bffe

27 files changed

+173
-128
lines changed

.github/workflows/moodle-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
--data-urlencode "vcstag=${TAGNAME}" \
4343
--data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \
4444
--data-urlencode "altdownloadurl=${ZIPURL}" \
45-
--data-urlencode "releasenotes=${BODY}" \
45+
--data-urlencode "releasenotes=${BODY@Q}" \
4646
--data-urlencode "releasenotesformat=4")
4747
echo "response=${RESPONSE}" >> $GITHUB_OUTPUT
4848
- name: Evaluate the response

backup/moodle2/backup_moodleoverflow_stepslib.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@ protected function define_structure() {
4747
$moodleoverflow = new backup_nested_element('moodleoverflow', ['id'], [
4848
'name', 'intro', 'introformat', 'maxbytes', 'maxattachments',
4949
'forcesubscribe', 'trackingtype', 'timecreated', 'timemodified',
50-
'ratingpreference', 'coursewidereputation', 'allownegativereputation']);
50+
'ratingpreference', 'coursewidereputation', 'allownegativereputation', ]);
5151

5252
// Define each element separated.
5353
$discussions = new backup_nested_element('discussions');
5454
$discussion = new backup_nested_element('discussion', ['id'], [
55-
'name', 'firstpost', 'userid', 'timemodified', 'usermodified', 'timestart']);
55+
'name', 'firstpost', 'userid', 'timemodified', 'usermodified', 'timestart', ]);
5656

5757
$posts = new backup_nested_element('posts');
5858

5959
$post = new backup_nested_element('post', ['id'], [
6060
'parent', 'userid', 'created', 'modified',
61-
'mailed', 'message', 'messageformat', 'attachment']);
61+
'mailed', 'message', 'messageformat', 'attachment', ]);
6262

6363
$ratings = new backup_nested_element('ratings');
6464

6565
$rating = new backup_nested_element('rating', ['id'], [
66-
'userid', 'rating', 'firstrated', 'lastchanged']);
66+
'userid', 'rating', 'firstrated', 'lastchanged', ]);
6767

6868
$discussionsubs = new backup_nested_element('discuss_subs');
6969

@@ -75,18 +75,18 @@ protected function define_structure() {
7575
$subscriptions = new backup_nested_element('subscriptions');
7676

7777
$subscription = new backup_nested_element('subscription', ['id'], [
78-
'userid']);
78+
'userid', ]);
7979

8080
$readposts = new backup_nested_element('readposts');
8181

8282
$read = new backup_nested_element('read', ['id'], [
8383
'userid', 'discussionid', 'postid', 'firstread',
84-
'lastread']);
84+
'lastread', ]);
8585

8686
$tracking = new backup_nested_element('tracking');
8787

8888
$track = new backup_nested_element('track', ['id'], [
89-
'userid']);
89+
'userid', ]);
9090

9191
// Build the tree.
9292
$moodleoverflow->add_child($discussions);

classes/manager/mail_manager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
use context_course;
2828
use context_module;
29+
use core\context\course;
2930
use core_php_time_limit;
3031
use mod_moodleoverflow\anonymous;
3132
use mod_moodleoverflow\output\moodleoverflow_email;
@@ -406,7 +407,7 @@ private static function send_post($userto, $post, array &$coursemodules, array &
406407
['userid' => $dataobject->userid,
407408
'courseid' => $dataobject->courseid,
408409
'forumid' => $dataobject->forumid,
409-
'forumdiscussionid' => $dataobject->forumdiscussionid],
410+
'forumdiscussionid' => $dataobject->forumdiscussionid, ],
410411
'numberofposts, id');
411412
if (is_object($record)) {
412413
$dataset = $record;
@@ -496,8 +497,7 @@ private static function send_post($userto, $post, array &$coursemodules, array &
496497

497498
// Preapare to actually send the post now. Build up the content.
498499
$cleanname = str_replace('"', "'", strip_tags(format_string($moodleoverflow->name)));
499-
$coursecontext = context_course::instance($course->id);
500-
$shortname = format_string($course->shortname, true, ['context' => $coursecontext]);
500+
$shortname = format_string($course->shortname, true, ['context' => context_course::instance($course->id)]);
501501

502502
// Define a header to make mails easier to track.
503503
$emailmessageid = generate_email_messageid('moodlemoodleoverflow' . $moodleoverflow->id);

classes/observer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static function role_assigned(\core\event\role_assigned $event) {
9595
WHERE m.course = :courseid AND m.forcesubscribe = :initial AND mo.name = 'moodleoverflow' AND ms.id IS NULL";
9696
$params = ['courseid' => $context->instanceid,
9797
'userid' => $userid,
98-
'initial' => MOODLEOVERFLOW_INITIALSUBSCRIBE];
98+
'initial' => MOODLEOVERFLOW_INITIALSUBSCRIBE, ];
9999
$moodleoverflows = $DB->get_records_sql($sql, $params);
100100

101101
// Loop through all moodleoverflows.

classes/privacy/data_export_helper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function export_discussion_data($userid, array $mappings) {
5151
FROM {moodleoverflow} mof
5252
INNER JOIN {moodleoverflow_discussions} d ON d.moodleoverflow = mof.id
5353
LEFT JOIN {moodleoverflow_discuss_subs} dsub ON dsub.discussion = d.id
54-
WHERE mof.id ${foruminsql}
54+
WHERE mof.id {$foruminsql}
5555
AND (
5656
d.userid = :discussionuserid OR
5757
d.usermodified = :dmuserid OR
@@ -113,7 +113,7 @@ public static function export_all_posts($userid, array $mappings) {
113113
INNER JOIN {moodleoverflow_posts} p ON p.discussion = d.id
114114
LEFT JOIN {moodleoverflow_read} fr ON fr.postid = p.id
115115
LEFT JOIN {moodleoverflow_ratings} rat ON rat.postid = p.id
116-
WHERE mof.id ${foruminsql} AND
116+
WHERE mof.id {$foruminsql} AND
117117
(
118118
p.userid = :postuserid OR
119119
fr.userid = :readuserid OR

classes/privacy/provider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,22 +324,22 @@ public static function delete_data_for_user(approved_contextlist $contextlist) {
324324

325325
$DB->delete_records('moodleoverflow_read', [
326326
'moodleoverflowid' => $forum->id,
327-
'userid' => $userid]);
327+
'userid' => $userid, ]);
328328

329329
$DB->delete_records('moodleoverflow_subscriptions', [
330330
'moodleoverflow' => $forum->id,
331-
'userid' => $userid]);
331+
'userid' => $userid, ]);
332332

333333
$DB->delete_records('moodleoverflow_discuss_subs', [
334334
'moodleoverflow' => $forum->id,
335-
'userid' => $userid]);
335+
'userid' => $userid, ]);
336336

337337
$DB->delete_records('moodleoverflow_tracking', [
338338
'moodleoverflowid' => $forum->id,
339-
'userid' => $userid]);
339+
'userid' => $userid, ]);
340340
$DB->delete_records('moodleoverflow_grades', [
341341
'moodleoverflowid' => $forum->id,
342-
'userid' => $userid]);
342+
'userid' => $userid, ]);
343343

344344
// Do not delete ratings but reset userid.
345345
$ratingsql = "userid = :userid AND discussionid IN

classes/ratings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static function moodleoverflow_add_rating($moodleoverflow, $postid, $rati
5757
// Is the submitted rating valid?
5858
$possibleratings = [RATING_NEUTRAL, RATING_DOWNVOTE, RATING_UPVOTE, RATING_SOLVED,
5959
RATING_HELPFUL, RATING_REMOVE_DOWNVOTE, RATING_REMOVE_UPVOTE,
60-
RATING_REMOVE_SOLVED, RATING_REMOVE_HELPFUL];
60+
RATING_REMOVE_SOLVED, RATING_REMOVE_HELPFUL, ];
6161
if (!in_array($rating, $possibleratings)) {
6262
throw new moodle_exception('invalidratingid', 'moodleoverflow');
6363
}

classes/subscriptions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public static function get_unsubscribable_moodleoverflows() {
438438
WHERE m.forcesubscribe <> :forcesubscribe AND ms.id IS NOT NULL AND cm.course $coursesql";
439439
$params = ['modulename' => 'moodleoverflow',
440440
'userid' => $USER->id,
441-
'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE];
441+
'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE, ];
442442
$mergedparams = array_merge($courseparams, $params);
443443
$moodleoverflows = $DB->get_recordset_sql($sql, $mergedparams);
444444

@@ -670,7 +670,7 @@ public static function subscribe_user($userid, $moodleoverflow, $context, $userr
670670
$params = [
671671
'userid' => $userid,
672672
'moodleoverflowid' => $moodleoverflow->id,
673-
'preference' => self::MOODLEOVERFLOW_DISCUSSION_UNSUBSCRIBED];
673+
'preference' => self::MOODLEOVERFLOW_DISCUSSION_UNSUBSCRIBED, ];
674674
$where = 'userid = :userid AND moodleoverflow = :moodleoverflowid AND preference <> :preference';
675675
$DB->delete_records_select('moodleoverflow_discuss_subs', $where, $params);
676676

classes/tables/userstats_table.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ public function __construct($uniqueid, $courseid, $moodleoverflow, $url) {
7676
'forumactivity',
7777
'courseactivity',
7878
'forumreputation',
79-
'coursereputation']);
79+
'coursereputation', ]);
8080
$this->define_baseurl($url);
8181
$this->define_headers([get_string('fullnameuser'),
8282
get_string('userstatsupvotes', 'moodleoverflow'),
8383
get_string('userstatsdownvotes', 'moodleoverflow'),
8484
(get_string('userstatsforumactivity', 'moodleoverflow') . $this->helpactivity->object),
8585
(get_string('userstatscourseactivity', 'moodleoverflow') . $this->helpactivity->object),
8686
get_string('userstatsforumreputation', 'moodleoverflow'),
87-
get_string('userstatscoursereputation', 'moodleoverflow')]);
87+
get_string('userstatscoursereputation', 'moodleoverflow'), ]);
8888
$this->get_table_data();
8989
$this->sortable(true, 'coursereputation', SORT_DESC);
9090
$this->no_sorting('username');
@@ -281,7 +281,7 @@ public function set_helpactivity() {
281281
'tabindex' => '0',
282282
'data-content' => '<div class=&quot;no-overflow&quot;><p>' .
283283
get_string('helpamountofactivity', 'moodleoverflow') .
284-
'</p> </div>'];
284+
'</p> </div>', ];
285285

286286
$this->helpactivity->object = \html_writer::span($this->helpactivity->icon,
287287
$this->helpactivity->class,
@@ -360,10 +360,10 @@ public function col_coursereputation($row) {
360360
*/
361361
private function badge_render($number) {
362362
if ($number > 0) {
363-
return \html_writer::tag('h5', \html_writer::start_span('badge badge-success') .
363+
return \html_writer::tag('h5', \html_writer::start_span('badge bg-success') .
364364
$number . \html_writer::end_span());
365365
} else {
366-
return \html_writer::tag('h5', \html_writer::start_span('badge badge-warning') .
366+
return \html_writer::tag('h5', \html_writer::start_span('badge bg-warning') .
367367
$number . \html_writer::end_span());
368368
}
369369
}

classes/task/send_daily_mail.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ public function execute() {
5656
$mail = [];
5757
// Fill the $mail array.
5858
foreach ($userdata as $row) {
59-
$currentcourse = $DB->get_record('course', array('id' => $row->courseid), 'fullname, id');
59+
$currentcourse = $DB->get_record('course', ['id' => $row->courseid], 'fullname, id');
6060
// Check if the user is enrolled in the course, if not, go to the next row.
6161
if (!is_enrolled(\context_course::instance($row->courseid), $user->userid, '', true)) {
6262
continue;
6363
}
6464

65-
$currentforum = $DB->get_record('moodleoverflow', array('id' => $row->forumid), 'name, id');
65+
$currentforum = $DB->get_record('moodleoverflow', ['id' => $row->forumid], 'name, id');
6666
$coursemoduleid = get_coursemodule_from_instance('moodleoverflow', $row->forumid);
6767
$discussion = $DB->get_record('moodleoverflow_discussions', ['id' => $row->forumdiscussionid], 'name, id');
6868
$unreadposts = $row->numberofposts;

0 commit comments

Comments
 (0)