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
 * Role view matrix.
19
 *
20
 * @package    core_role
21
 * @copyright  2016 onwards Andrew Hancox <andrewdchancox@googlemail.com>
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
defined('MOODLE_INTERNAL') || die();
26
 
27
/**
28
 * Subclass of role_allow_role_page for the Allow views tab.
29
 *
30
 * @package    core_role
31
 * @copyright  2016 onwards Andrew Hancox <andrewdchancox@googlemail.com>
32
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
33
 */
34
class core_role_allow_view_page extends core_role_allow_role_page {
35
    /** @var array */
36
    protected $allowedtargetroles;
37
 
38
    /**
39
     * core_role_allow_view_page constructor.
40
     */
41
    public function __construct() {
42
        parent::__construct('role_allow_view', 'allowview');
43
    }
44
 
45
 
46
    /**
47
     * Allow from role to view target role.
48
     * @param int $fromroleid
49
     * @param int $targetroleid
50
     */
51
    protected function set_allow($fromroleid, $targetroleid) {
52
        core_role_set_view_allowed($fromroleid, $targetroleid);
53
    }
54
 
55
    /**
56
     * Get tool tip for cell.
57
     * @param stdClass $fromrole
58
     * @param stdClass $targetrole
59
     * @return string
60
     */
61
    protected function get_cell_tooltip($fromrole, $targetrole) {
62
        $a = new stdClass;
63
        $a->fromrole = $fromrole->localname;
64
        $a->targetrole = $targetrole->localname;
65
        return get_string('allowroletoview', 'core_role', $a);
66
    }
67
 
68
    /**
69
     * Get intro text for role allow view page.
70
     * @return string
71
     * @throws \coding_exception
72
     */
73
    public function get_intro_text() {
74
        return get_string('configallowview', 'core_admin');
75
    }
76
 
77
    protected function get_eventclass() {
78
        return \core\event\role_allow_view_updated::class;
79
    }
80
}