Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
85.71% covered (warning)
85.71%
6 / 7
75.00% covered (warning)
75.00%
3 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
student_contacted
85.71% covered (warning)
85.71%
6 / 7
75.00% covered (warning)
75.00%
3 / 4
4.05
0.00% covered (danger)
0.00%
0 / 1
 init
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 get_name
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 get_description
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 get_objectid_mapping
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
16
17/**
18 * Event student_contacted.
19 *
20 * @package    local_atrisk
21 * @copyright  2026 DevLMS <contact@devlms.com>
22 * @license    https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25namespace local_atrisk\event;
26
27/**
28 * At-risk student contacted.
29 *
30 * @package    local_atrisk
31 * @copyright  2026 DevLMS <contact@devlms.com>
32 * @license    https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
33 */
34class student_contacted extends \core\event\base {
35    /**
36     * Init.
37     */
38    protected function init() {
39        $this->data['crud'] = 'c';
40        $this->data['edulevel'] = self::LEVEL_OTHER;
41        $this->data['objecttable'] = 'local_atrisk_contact';
42    }
43
44    /**
45     * Name.
46     *
47     * @return string
48     */
49    public static function get_name() {
50        return get_string('event_student_contacted', 'local_atrisk');
51    }
52
53    /**
54     * Description.
55     *
56     * @return string
57     */
58    public function get_description() {
59        return "The user with id '$this->userid' recorded contacting the at-risk student with id " .
60            "'$this->relateduserid' about the course with id '$this->courseid'.";
61    }
62
63    /**
64     * Object id mapping for restore: contacts are not backed up.
65     *
66     * @return array
67     */
68    public static function get_objectid_mapping() {
69        return ['db' => 'local_atrisk_contact', 'restore' => \core\event\base::NOT_MAPPED];
70    }
71}