• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ewallah / moodle-report_growth / 14515571975

17 Apr 2025 12:24PM UTC coverage: 93.787% (-4.4%) from 98.22%
14515571975

push

github

rdebleu
CoversClass

317 of 338 relevant lines covered (93.79%)

30.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/classes/event/report_viewed.php
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
 * The growth report viewed event.
19
 *
20
 * @package   report_growth
21
 * @copyright eWallah (www.eWallah.net)
22
 * @author    Renaat Debleu <info@eWallah.net>
23
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
namespace report_growth\event;
26

27
/**
28
 * The growth report viewed event.
29
 *
30
 * @package   report_growth
31
 * @copyright eWallah (www.eWallah.net)
32
 * @author    Renaat Debleu <info@eWallah.net>
33
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34
 */
35
class report_viewed extends \core\event\base {
36
    /**
37
     * Init method.
38
     *
39
     * @return void
40
     */
41
    protected function init() {
42
        $this->data['crud'] = 'r';
×
43
        $this->data['edulevel'] = self::LEVEL_OTHER;
×
44
    }
45

46
    /**
47
     * Return localised event name.
48
     *
49
     * @return string
50
     */
51
    public static function get_name() {
52
        return get_string('eventreportviewed', 'report_growth');
×
53
    }
54

55
    /**
56
     * Returns description of what happened.
57
     *
58
     * @return string
59
     */
60
    public function get_description() {
61
        $tab = $this->other['tab'];
×
62
        $str = "The user with id '$this->userid' viewed tab '$tab' of the ";
×
63
        switch ($this->contextlevel) {
×
64
            case CONTEXT_COURSE:
×
65
                return $str . "growth report for the course with id '$this->courseid'.";
×
66
            case CONTEXT_COURSECAT:
×
67
                return $str . "growth report for the category with id '$this->contextinstanceid'.";
×
68
            default:
69
                return $str . "global growth report.";
×
70
        }
71
    }
72

73
    /**
74
     * Returns relevant URL.
75
     *
76
     * @return \moodle_url
77
     */
78
    public function get_url() {
79
        $params = ['p' => $this->other['tab']];
×
80
        if ($this->contextlevel == CONTEXT_COURSE || $this->contextlevel == CONTEXT_COURSECAT) {
×
81
            $params['contextid'] = $this->contextid;
×
82
        }
83
        return new \moodle_url('/report/growth/index.php', $params);
×
84
    }
85
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc