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 task to suspend inactive users.
19
 *
20
 * File         mark.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\task\suspend;
27
 
28
use tool_usersuspension\config;
29
 
30
/**
31
 * Description of mark
32
 *
33
 * @package     tool_usersuspension
34
 *
35
 * @copyright   Sebsoft.nl
36
 * @author      R.J. van Dongen <rogier@sebsoft.nl>
37
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38
 */
39
class mark extends \core\task\scheduled_task {
40
 
41
    /**
42
     * Return the localised name for this task
43
     *
44
     * @return string task name
45
     */
46
    public function get_name() {
47
        return get_string('task:mark', 'tool_usersuspension');
48
    }
49
 
50
    /**
51
     * Executes the task
52
     *
53
     * @return void
54
     */
55
    public function execute() {
56
        if (!(bool)config::get('enabled')) {
57
            mtrace(get_string('config:tool:disabled', 'tool_usersuspension'));
58
            return;
59
        }
60
        if (!(bool)config::get('enablesmartdetect')) {
61
            mtrace(get_string('config:smartdetect:disabled', 'tool_usersuspension'));
62
            return;
63
        }
64
        \tool_usersuspension\util::mark_users_to_suspend();
65
        // Now email any users in the warning period.
66
        \tool_usersuspension\util::warn_users_of_suspension();
67
    }
68
 
69
}