Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 35... Línea 35...
35
    const ROOT_LEVEL     = 1;
35
    const ROOT_LEVEL     = 1;
36
    const COURSE_LEVEL   = 5;
36
    const COURSE_LEVEL   = 5;
37
    const SECTION_LEVEL  = 9;
37
    const SECTION_LEVEL  = 9;
38
    const ACTIVITY_LEVEL = 13;
38
    const ACTIVITY_LEVEL = 13;
Línea -... Línea 39...
-
 
39
 
-
 
40
    /** @var int the subsection level. */
-
 
41
    const SUBSECTION_LEVEL = 17;
-
 
42
 
-
 
43
    /** @var int the activity inside a subsection level. */
-
 
44
    const SUBACTIVITY_LEVEL = 21;
39
 
45
 
40
    /** @var int Level of the setting, eg {@link self::ROOT_LEVEL} */
46
    /** @var int Level of the setting, eg {@link self::ROOT_LEVEL} */
Línea 41... Línea 47...
41
    protected $level;
47
    protected $level;
42
 
48
 
Línea 62... Línea 68...
62
     * @param int $type
68
     * @param int $type
63
     * @param string $label
69
     * @param string $label
64
     * @param array $attributes
70
     * @param array $attributes
65
     * @param array $options
71
     * @param array $options
66
     */
72
     */
67
    public function make_ui($type, $label, array $attributes = null, array $options = null) {
73
    public function make_ui($type, $label, ?array $attributes = null, ?array $options = null) {
68
        $this->uisetting = backup_setting_ui::make($this, $type, $label, $attributes, $options);
74
        $this->uisetting = backup_setting_ui::make($this, $type, $label, $attributes, $options);
69
        if (is_array($options) || is_object($options)) {
75
        if (is_array($options) || is_object($options)) {
70
            $options = (array)$options;
76
            $options = (array)$options;
71
            switch (get_class($this->uisetting)) {
77
            switch (get_class($this->uisetting)) {
72
                case 'backup_setting_ui_radio' :
78
                case 'backup_setting_ui_radio' :
Línea 94... Línea 100...
94
        if (!($dependentsetting instanceof backup_setting)) {
100
        if (!($dependentsetting instanceof backup_setting)) {
95
            throw new backup_setting_exception('invalid_backup_setting_parameter');
101
            throw new backup_setting_exception('invalid_backup_setting_parameter');
96
        }
102
        }
97
        // Check the dependency level is >= current level
103
        // Check the dependency level is >= current level
98
        if ($dependentsetting->get_level() < $this->level) {
104
        if ($dependentsetting->get_level() < $this->level) {
99
            throw new backup_setting_exception('cannot_add_upper_level_dependency');
105
            throw new backup_setting_exception('cannot_add_upper_level_dependency', [
-
 
106
                $dependentsetting->get_level(),
-
 
107
                $dependentsetting->get_name(),
-
 
108
                $this->level,
-
 
109
                $this->get_name(),
-
 
110
            ]);
100
        }
111
        }
101
        parent::add_dependency($dependentsetting, $type, $options);
112
        parent::add_dependency($dependentsetting, $type, $options);
102
    }
113
    }
Línea 103... Línea 114...
103
 
114