Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
 * this file contains the event for user suspension
19
 *
20
 * File         suspended.php
21
 * Encoding     UTF-8
22
 * @copyright   Sebsoft.nl
23
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
 
26
namespace tool_usersuspension\event;
27
 
28
defined('MOODLE_INTERNAL') || die;
29
 
30
require_once($CFG->dirroot . '/user/selector/lib.php');
31
 
32
/**
33
 * tool_usersuspension\event\user_suspended
34
 *
35
 * @package     tool_usersuspension
36
 *
37
 * @copyright   Sebsoft.nl
38
 * @author      R.J. van Dongen <rogier@sebsoft.nl>
39
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
40
 */
41
class user_suspended extends \core\event\base {
42
 
43
    /**
44
     * Initialise required event data properties.
45
     */
46
    protected function init() {
47
        $this->data['objecttable'] = 'user';
48
        $this->data['crud'] = 'u';
49
        $this->data['edulevel'] = self::LEVEL_OTHER;
50
    }
51
 
52
    /**
53
     * Returns localised event name.
54
     *
55
     * @return string
56
     */
57
    public static function get_name() {
58
        return get_string('event:user:suspended', 'tool_usersuspension');
59
    }
60
 
61
    /**
62
     * Returns non-localised event description with id's for admin use only.
63
     *
64
     * @return string
65
     */
66
    public function get_description() {
67
        return "The user with id '$this->userid' suspended the user with id '$this->objectid'.";
68
    }
69
 
70
    /**
71
     * Custom validation.
72
     *
73
     * @throws \coding_exception
74
     * @return void
75
     */
76
    protected function validate_data() {
77
        parent::validate_data();
78
 
79
        if (!isset($this->relateduserid)) {
80
            debugging('The \'relateduserid\' value must be specified in the event.', DEBUG_DEVELOPER);
81
            $this->relateduserid = $this->objectid;
82
        }
83
    }
84
 
85
}