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
 * Contains the content_item class.
19
 *
20
 * @package    core
21
 * @subpackage course
22
 * @copyright  2020 Jake Dallimore <jrhdallimore@gmail.com>
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
namespace core_course\local\entity;
26
 
27
defined('MOODLE_INTERNAL') || die();
28
 
29
/**
30
 * The content_item class.
31
 *
32
 * @copyright  2020 Jake Dallimore <jrhdallimore@gmail.com>
33
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34
 */
35
class content_item {
36
    /** @var int $id the id. */
37
    private $id;
38
 
39
    /** @var string $name the name. */
40
    private $name;
41
 
42
    /** @var title $title the title. */
43
    private $title;
44
 
45
    /** @var \moodle_url $link the url for the content item's setup page (usually mod/edit.php). */
46
    private $link;
47
 
48
    /** @var string $icon an html string containing the icon for this item. */
49
    private $icon;
50
 
51
    /** @var string $help the description/help text for this content item. */
52
    private $help;
53
 
54
    /** @var int $achetype a module archetype, e.g. MOD_ARCHETYPE_RESOURCE, MOD_ARCHETYPE_OTHER. */
55
    private $archetype;
56
 
57
    /** @var string $componentname the name of the component from which this content item originates. */
58
    private $componentname;
59
 
60
    /** @var string $purpose the purpose type of this component. */
61
    private $purpose;
62
 
63
    /** @var bool $branded whether or not this component is branded. */
64
    private $branded;
65
 
66
    /**
67
     * The content_item constructor.
68
     *
69
     * @param int $id Id number.
70
     * @param string $name Name of the item, not human readable.
71
     * @param title $title Human readable title for the item.
72
     * @param \moodle_url $link The URL to the creation page, with any item specific params
73
     * @param string $icon HTML containing the icon for the item
74
     * @param string $help The description of the item.
75
     * @param int $archetype the archetype for the content item (see MOD_ARCHETYPE_X definitions in lib/moodlelib.php).
76
     * @param string $componentname the name of the component/plugin with which this content item is associated.
77
     * @param string $purpose the purpose type of this component.
78
     * @param bool $branded whether or not this item is branded.
79
     */
80
    public function __construct(int $id, string $name, title $title, \moodle_url $link, string $icon, string $help,
81
            int $archetype, string $componentname, string $purpose, bool $branded = false) {
82
        $this->id = $id;
83
        $this->name = $name;
84
        $this->title = $title;
85
        $this->link = $link;
86
        $this->icon = $icon;
87
        $this->help = $help;
88
        $this->archetype = $archetype;
89
        $this->componentname = $componentname;
90
        $this->purpose = $purpose;
91
        $this->branded = $branded;
92
    }
93
 
94
    /**
95
     * Get the name of the component with which this content item is associated.
96
     *
97
     * @return string
98
     */
99
    public function get_component_name(): string {
100
        return $this->componentname;
101
    }
102
 
103
    /**
104
     * Get the help description of this item.
105
     *
106
     * @return string
107
     */
108
    public function get_help(): string {
109
        return $this->help;
110
    }
111
 
112
    /**
113
     * Get the archetype of this item.
114
     *
115
     * @return int
116
     */
117
    public function get_archetype(): int {
118
        return $this->archetype;
119
    }
120
 
121
    /**
122
     * Get the id of this item.
123
     * @return int
124
     */
125
    public function get_id(): int {
126
        return $this->id;
127
    }
128
 
129
    /**
130
     * Get the name of this item.
131
     *
132
     * @return string
133
     */
134
    public function get_name(): string {
135
        return $this->name;
136
    }
137
 
138
    /**
139
     * Get the human readable title of this item.
140
     *
141
     * @return title
142
     */
143
    public function get_title(): title {
144
        return $this->title;
145
    }
146
 
147
    /**
148
     * Get the link to the creation page of this item.
149
     *
150
     * @return \moodle_url
151
     */
152
    public function get_link(): \moodle_url {
153
        return $this->link;
154
    }
155
 
156
    /**
157
     * Get the icon html for this item.
158
     *
159
     * @return string
160
     */
161
    public function get_icon(): string {
162
        return $this->icon;
163
    }
164
 
165
    /**
166
     * Get purpose for this item.
167
     *
168
     * @return string
169
     */
170
    public function get_purpose(): string {
171
        return $this->purpose;
172
    }
173
 
174
    /**
175
     * Whether this item is branded.
176
     *
177
     * @return bool true if this item is branded, false otherwise.
178
     */
179
    public function is_branded(): bool {
180
        return $this->branded;
181
    }
182
}