Skip to content

Commit 528d7b0

Browse files
Update #86c3a0wce - Patch 4.5.4
1 parent 6dd1f61 commit 528d7b0

File tree

32 files changed

+445
-88
lines changed

32 files changed

+445
-88
lines changed

group/index.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@
6363
$PAGE->requires->js('/group/clientlib.js', true);
6464
$PAGE->requires->js('/group/module.js', true);
6565

66+
// START BSL TWEAK - Handle additional user types
67+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
68+
$isadmin = has_capability('block/dshop:admin', context_system::instance(), $USER);
69+
$students = [];
70+
if (!$isadmin) {
71+
$duser = Dshop_User::getInstance();
72+
$students = $duser->getMyStudents();
73+
}
74+
// END BSL TWEAK.
75+
6676
// Check for multiple/no group errors.
6777
if (!$singlegroup) {
6878
switch($action) {
@@ -98,6 +108,12 @@
98108
$shortroledata->name = html_entity_decode($roledata->name, ENT_QUOTES, 'UTF-8');
99109
$shortroledata->users = array();
100110
foreach ($roledata->users as $member) {
111+
// START BSL TWEAK - Handle additional user types
112+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
113+
if (!isset($students[$member->id]) && !$isadmin) {
114+
continue;
115+
}
116+
// END BSL TWEAK.
101117
$shortmember = new stdClass();
102118
$shortmember->id = $member->id;
103119
$shortmember->name = fullname($member, $viewfullnames);

lib/db/install.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,10 @@
912912
<FIELD NAME="middlename" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Middle name"/>
913913
<FIELD NAME="alternatename" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Alternate name - Useful for three-name countries."/>
914914
<FIELD NAME="moodlenetprofile" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Moodle.net profile information"/>
915+
<!-- TWEAK START LDESIGN. -->
916+
<FIELD NAME="site_id" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
917+
<FIELD NAME="gdpr" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
918+
<!-- TWEAK END LDESIGN. -->
915919
</FIELDS>
916920
<KEYS>
917921
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>

lib/moodlelib.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6150,8 +6150,10 @@ function send_password_change_confirmation_email($user, $resetrecord) {
61506150
$subject = get_string('emailresetconfirmationsubject', '', format_string($site->fullname));
61516151

61526152
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
6153-
return email_to_user($user, $supportuser, $subject, $message);
6154-
6153+
// START BSL TWEAK - Use custom mailer instead. It is impossible to change settings of core one.
6154+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
6155+
return \block_dshop\helper::email_to_user($user, $supportuser, $subject, html_to_text($message), $message);
6156+
// END BSL TWEAK.
61556157
}
61566158

61576159
/**

login/signup.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
*/
2626

2727
require('../config.php');
28+
// START BSL TWEAK - Custom sing up page handling.
29+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
30+
redirect(new moodle_url('/blocks/dshop/register'));
31+
// END BSL TWEAK.
2832
require_once($CFG->dirroot . '/user/editlib.php');
2933
require_once($CFG->libdir . '/authlib.php');
3034
require_once('lib.php');

mod/assign/locallib.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,10 @@ public function update_calendar($coursemoduleid) {
14891489
}
14901490

14911491
$eventtype = ASSIGN_EVENT_TYPE_GRADINGDUE;
1492-
if ($instance->gradingduedate) {
1492+
// START BSL TWEAK - Fix for additional user types.
1493+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
1494+
if (!empty($instance->gradingduedate)) {
1495+
// END BSL TWEAK.
14931496
$event->name = get_string('calendargradingdue', 'assign', $instance->name);
14941497
$event->eventtype = $eventtype;
14951498
$event->timestart = $instance->gradingduedate;
@@ -6601,23 +6604,22 @@ public static function send_assignment_notification($userfrom,
66016604
$eventdata->notification = 1;
66026605
$eventdata->contexturl = $info->url;
66036606
$eventdata->contexturlname = $info->assignment;
6604-
$customdata = [
6605-
'cmid' => $coursemodule->id,
6606-
'instance' => $coursemodule->instance,
6607-
'messagetype' => $messagetype,
6608-
'blindmarking' => $blindmarking,
6609-
'uniqueidforuser' => $uniqueidforuser,
6610-
];
6611-
// Check if the userfrom is real and visible.
6612-
if (!empty($userfrom->id) && core_user::is_real_user($userfrom->id)) {
6613-
$userpicture = new user_picture($userfrom);
6614-
$userpicture->size = 1; // Use f1 size.
6615-
$userpicture->includetoken = $userto->id; // Generate an out-of-session token for the user receiving the message.
6616-
$customdata['notificationiconurl'] = $userpicture->get_url($PAGE)->out(false);
6607+
// START BSL TWEAK - Dshop email handling.
6608+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
6609+
if (has_capability("mod/assign:receivegradernotifications", $context, $userto)) {
6610+
// Check if user want to get notifications.
6611+
$userto->mail_preference = Dshop_Userhelper::getEmailPreference($userto->id, 'assign');
6612+
\block_dshop\helper::email_to_user($userto, $userfrom, $postsubject, $posttext, $posthtml);
6613+
return;
66176614
}
6618-
$eventdata->customdata = $customdata;
66196615

6620-
message_send($eventdata);
6616+
require_once($CFG->dirroot . '/blocks/dshop/class/Helper.php');
6617+
$customer = Dshop_Helper::getMyCustomer($userfrom->id, $coursemodule->course);
6618+
if ($customer) {
6619+
$customer->mail_preference = Dshop_Userhelper::getEmailPreference($customer->id, 'assign');
6620+
\block_dshop\helper::email_to_user($customer, $userfrom, $postsubject, $posttext, $posthtml);
6621+
}
6622+
// END BSL TWEAK.
66216623
}
66226624

66236625
/**

mod/assign/mod_form.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ public function definition() {
248248
$this->apply_admin_defaults();
249249

250250
$this->add_action_buttons();
251+
// START BSL TWEAK - Load dentallect defaults
252+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
253+
$this->set_dentallect_defaults();
254+
// END BSL TWEAK.
251255
}
252256

253257
/**
@@ -406,4 +410,17 @@ public function apply_admin_defaults($datetimeoffsets = []): void {
406410
}
407411
}
408412
}
413+
// START BSL TWEAK - Load dentallect defaults
414+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
415+
public function set_dentallect_defaults() {
416+
$mform =& $this->_form;
417+
$mform->setDefault('requiresubmissionstatement', '1');
418+
$mform->setDefault('attemptreopenmethod', 'untilpass');
419+
$mform->setDefault('grade[modgrade_type]', 'scale');
420+
$mform->setDefault('grade[modgrade_scale]', '4');
421+
$mform->setDefault('gradepass', '2');
422+
$mform->setDefault('completion', '2');
423+
$mform->setDefault('completionusegrade', '1');
424+
}
425+
// END BSL TWEAK.
409426
}

mod/assign/submission_form.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,31 @@ public function definition() {
4444
global $USER;
4545
$mform = $this->_form;
4646
list($assign, $data) = $this->_customdata;
47+
// START BSL TWEAK - Dshop handling of submission forms
48+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
49+
global $DB;
50+
$currentinstanceid = (int)$assign->get_instance()->id;
51+
$sql = "SELECT *
52+
FROM {dshop_assign}
53+
WHERE :assignid = ANY (string_to_array(assign_ids, ',')::int[])";
54+
$params = ['assignid' => $currentinstanceid];
55+
$results = $DB->get_records_sql($sql, $params);
56+
foreach ($results as $result) {
57+
$assigns = explode(',', $result->assign_ids) ?? [];
58+
foreach ($assigns as $assignid) {
59+
if ($currentinstanceid === $assignid) {
60+
continue;
61+
}
62+
if (\block_dshop\assign\assign::has_activity_completion($assignid, $USER->id) == false) {
63+
continue;
64+
}
65+
66+
$mform->addElement('static', 'error', '',
67+
html_writer::div('Waarschuwing! Je hebt deze opdracht reeds ingediend. Door deze opnieuw in te dienen wordt je eerder ingediende opdracht, inclusief beoordeling, gewist op alle plaatsen.', 'alert alert-danger'));
68+
break;
69+
}
70+
}
71+
// END BSL TWEAK.
4772
$instance = $assign->get_instance();
4873
if ($instance->teamsubmission) {
4974
$submission = $assign->get_group_submission($data->userid, 0, true);

mod/feedback/analysis.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@
6464
$mygroupid = groups_get_activity_group($cm, true);
6565
groups_print_activity_menu($cm, $url);
6666

67+
// START BSL TWEAK - Fix for filtering analysis
68+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
69+
$filtering = new \mod_feedback\form\filter_analysis($PAGE->url);
70+
echo '<hr>' . $filtering->render();
71+
// END BSL TWEAK.
6772
// Button "Export to excel".
6873
if (has_capability('mod/feedback:viewreports', $context) && $feedbackstructure->get_items()) {
6974
echo $OUTPUT->container_start('form-buttons');
@@ -93,7 +98,10 @@
9398
foreach ($items as $item) {
9499
$itemobj = feedback_get_item_class($item->typ);
95100
$printnr = ($feedback->autonumbering && $item->itemnr) ? ($item->itemnr . '.') : '';
96-
$itemobj->print_analysed($item, $printnr, $mygroupid);
101+
// START BSL TWEAK - Include additional parameters for analysis
102+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
103+
$itemobj->print_analysed($item, $printnr, $mygroupid, false, $filtering->get_data());
104+
// END BSL TWEAK.
97105
}
98106
} else {
99107
echo $OUTPUT->heading_with_help(get_string('insufficient_responses_for_this_group', 'feedback'),

mod/feedback/analysis_to_excel.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@
2828

2929
$id = required_param('id', PARAM_INT); // Course module id.
3030
$courseid = optional_param('courseid', '0', PARAM_INT);
31-
31+
// START BSL TWEAK - Handle additional analysis parameters
32+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
33+
$from = optional_param('from' , 0 , PARAM_INT);
34+
$till = optional_param('till' , time(), PARAM_INT);
35+
$formdata = (object)['from' => $from, 'till' => $till];
36+
// END BSL TWEAK.
3237
$url = new moodle_url('/mod/feedback/analysis_to_excel.php', array('id' => $id));
3338
if ($courseid) {
3439
$url->param('courseid', $courseid);
@@ -79,6 +84,11 @@
7984
$rowoffset1 = 0;
8085
$worksheet1->write_string($rowoffset1, 0, userdate(time()), $xlsformats->head1);
8186

87+
// START BSL TWEAK - Handle additional analysis parameters
88+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
89+
$completedscount = $feedbackstructure->count_completed_responses($mygroupid , $formdata);
90+
// END BSL TWEAK.
91+
8292
// Get the completeds.
8393
$completedscount = $feedbackstructure->count_completed_responses($mygroupid);
8494
// Write the count of completeds.
@@ -109,7 +119,11 @@
109119
$xlsformats,
110120
$item,
111121
$mygroupid,
112-
$courseid);
122+
$courseid,
123+
// START BSL TWEAK - Handle additional analysis parameters
124+
// Copyright (C) 2024 Springer Media B.V. - All Rights Reserved.
125+
$formdata);
126+
// END BSL TWEAK.
113127
}
114128

115129
$workbook->close();
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
*
19+
*
20+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
21+
*
22+
* @package moodlefreak_dentallect
23+
* @copyright 04/08/2021 Mfreak.nl | LdesignMedia.nl - Luuk Verhoeven
24+
* @author Luuk Verhoeven
25+
**/
26+
27+
namespace mod_feedback\form;
28+
29+
use moodleform;
30+
31+
defined('MOODLE_INTERNAL') || die;
32+
33+
/**
34+
* Filter filter_analysis
35+
*
36+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37+
*
38+
* @package moodlefreak_dentallect
39+
* @copyright 04/08/2021 Mfreak.nl | LdesignMedia.nl - Luuk Verhoeven
40+
* @author Luuk Verhoeven
41+
*/
42+
class filter_analysis extends moodleform {
43+
44+
/**
45+
* Form definition. Abstract method - always override!
46+
*/
47+
protected function definition() {
48+
$mform = &$this->_form;
49+
50+
$mform->addElement('date_time_selector', 'from', get_string('form:from', 'feedback'));
51+
$mform->setDefault('from', strtotime('-10 years'));
52+
53+
$mform->addElement('date_time_selector', 'till', get_string('form:till', 'feedback'));
54+
55+
$this->add_action_buttons(false, get_string('btn:filter', 'feedback'));
56+
}
57+
}

0 commit comments

Comments
 (0)