Add titles and icons to entities
[civicrm-core.git] / CRM / Core / DAO / Navigation.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/Navigation.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:3819d9a3e40bfbc36a06809c1f4bd98c)
10 */
11
12 /**
13 * Database access object for the Navigation entity.
14 */
15 class CRM_Core_DAO_Navigation extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_navigation';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = FALSE;
30
31 /**
32 * @var int
33 */
34 public $id;
35
36 /**
37 * Which Domain is this navigation item for
38 *
39 * @var int
40 */
41 public $domain_id;
42
43 /**
44 * Navigation Title
45 *
46 * @var string
47 */
48 public $label;
49
50 /**
51 * Internal Name
52 *
53 * @var string
54 */
55 public $name;
56
57 /**
58 * url in case of custom navigation link
59 *
60 * @var string
61 */
62 public $url;
63
64 /**
65 * CSS class name for an icon
66 *
67 * @var string
68 */
69 public $icon;
70
71 /**
72 * Permission for menu item
73 *
74 * @var string
75 */
76 public $permission;
77
78 /**
79 * Permission Operator
80 *
81 * @var string
82 */
83 public $permission_operator;
84
85 /**
86 * Parent navigation item, used for grouping
87 *
88 * @var int
89 */
90 public $parent_id;
91
92 /**
93 * Is this navigation item active?
94 *
95 * @var bool
96 */
97 public $is_active;
98
99 /**
100 * If separator needs to be added after this menu item
101 *
102 * @var bool
103 */
104 public $has_separator;
105
106 /**
107 * Ordering of the navigation items in various blocks.
108 *
109 * @var int
110 */
111 public $weight;
112
113 /**
114 * Class constructor.
115 */
116 public function __construct() {
117 $this->__table = 'civicrm_navigation';
118 parent::__construct();
119 }
120
121 /**
122 * Returns localized title of this entity.
123 */
124 public static function getEntityTitle() {
125 return ts('Navigations');
126 }
127
128 /**
129 * Returns foreign keys and entity references.
130 *
131 * @return array
132 * [CRM_Core_Reference_Interface]
133 */
134 public static function getReferenceColumns() {
135 if (!isset(Civi::$statics[__CLASS__]['links'])) {
136 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
137 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
138 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_navigation', 'id');
139 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
140 }
141 return Civi::$statics[__CLASS__]['links'];
142 }
143
144 /**
145 * Returns all the column names of this table
146 *
147 * @return array
148 */
149 public static function &fields() {
150 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
151 Civi::$statics[__CLASS__]['fields'] = [
152 'id' => [
153 'name' => 'id',
154 'type' => CRM_Utils_Type::T_INT,
155 'title' => ts('Navigation ID'),
156 'required' => TRUE,
157 'where' => 'civicrm_navigation.id',
158 'table_name' => 'civicrm_navigation',
159 'entity' => 'Navigation',
160 'bao' => 'CRM_Core_BAO_Navigation',
161 'localizable' => 0,
162 ],
163 'domain_id' => [
164 'name' => 'domain_id',
165 'type' => CRM_Utils_Type::T_INT,
166 'title' => ts('Navigation Domain'),
167 'description' => ts('Which Domain is this navigation item for'),
168 'required' => TRUE,
169 'where' => 'civicrm_navigation.domain_id',
170 'table_name' => 'civicrm_navigation',
171 'entity' => 'Navigation',
172 'bao' => 'CRM_Core_BAO_Navigation',
173 'localizable' => 0,
174 'FKClassName' => 'CRM_Core_DAO_Domain',
175 'pseudoconstant' => [
176 'table' => 'civicrm_domain',
177 'keyColumn' => 'id',
178 'labelColumn' => 'name',
179 ],
180 ],
181 'label' => [
182 'name' => 'label',
183 'type' => CRM_Utils_Type::T_STRING,
184 'title' => ts('Navigation Item Label'),
185 'description' => ts('Navigation Title'),
186 'maxlength' => 255,
187 'size' => CRM_Utils_Type::HUGE,
188 'where' => 'civicrm_navigation.label',
189 'table_name' => 'civicrm_navigation',
190 'entity' => 'Navigation',
191 'bao' => 'CRM_Core_BAO_Navigation',
192 'localizable' => 0,
193 ],
194 'name' => [
195 'name' => 'name',
196 'type' => CRM_Utils_Type::T_STRING,
197 'title' => ts('Navigation Item Machine Name'),
198 'description' => ts('Internal Name'),
199 'maxlength' => 255,
200 'size' => CRM_Utils_Type::HUGE,
201 'where' => 'civicrm_navigation.name',
202 'table_name' => 'civicrm_navigation',
203 'entity' => 'Navigation',
204 'bao' => 'CRM_Core_BAO_Navigation',
205 'localizable' => 0,
206 ],
207 'url' => [
208 'name' => 'url',
209 'type' => CRM_Utils_Type::T_STRING,
210 'title' => ts('Url'),
211 'description' => ts('url in case of custom navigation link'),
212 'maxlength' => 255,
213 'size' => CRM_Utils_Type::HUGE,
214 'where' => 'civicrm_navigation.url',
215 'table_name' => 'civicrm_navigation',
216 'entity' => 'Navigation',
217 'bao' => 'CRM_Core_BAO_Navigation',
218 'localizable' => 0,
219 ],
220 'icon' => [
221 'name' => 'icon',
222 'type' => CRM_Utils_Type::T_STRING,
223 'title' => ts('Icon'),
224 'description' => ts('CSS class name for an icon'),
225 'required' => FALSE,
226 'maxlength' => 255,
227 'size' => CRM_Utils_Type::HUGE,
228 'where' => 'civicrm_navigation.icon',
229 'default' => 'NULL',
230 'table_name' => 'civicrm_navigation',
231 'entity' => 'Navigation',
232 'bao' => 'CRM_Core_BAO_Navigation',
233 'localizable' => 0,
234 ],
235 'permission' => [
236 'name' => 'permission',
237 'type' => CRM_Utils_Type::T_STRING,
238 'title' => ts('Required Permission'),
239 'description' => ts('Permission for menu item'),
240 'maxlength' => 255,
241 'size' => CRM_Utils_Type::HUGE,
242 'where' => 'civicrm_navigation.permission',
243 'table_name' => 'civicrm_navigation',
244 'entity' => 'Navigation',
245 'bao' => 'CRM_Core_BAO_Navigation',
246 'localizable' => 0,
247 ],
248 'permission_operator' => [
249 'name' => 'permission_operator',
250 'type' => CRM_Utils_Type::T_STRING,
251 'title' => ts('Permission Operator'),
252 'description' => ts('Permission Operator'),
253 'maxlength' => 3,
254 'size' => CRM_Utils_Type::FOUR,
255 'where' => 'civicrm_navigation.permission_operator',
256 'table_name' => 'civicrm_navigation',
257 'entity' => 'Navigation',
258 'bao' => 'CRM_Core_BAO_Navigation',
259 'localizable' => 0,
260 ],
261 'parent_id' => [
262 'name' => 'parent_id',
263 'type' => CRM_Utils_Type::T_INT,
264 'title' => ts('Navigation parent ID'),
265 'description' => ts('Parent navigation item, used for grouping'),
266 'where' => 'civicrm_navigation.parent_id',
267 'table_name' => 'civicrm_navigation',
268 'entity' => 'Navigation',
269 'bao' => 'CRM_Core_BAO_Navigation',
270 'localizable' => 0,
271 'FKClassName' => 'CRM_Core_DAO_Navigation',
272 'pseudoconstant' => [
273 'table' => 'civicrm_navigation',
274 'keyColumn' => 'id',
275 'labelColumn' => 'label',
276 'nameColumn' => 'name',
277 ],
278 ],
279 'is_active' => [
280 'name' => 'is_active',
281 'type' => CRM_Utils_Type::T_BOOLEAN,
282 'title' => ts('Is Active'),
283 'description' => ts('Is this navigation item active?'),
284 'where' => 'civicrm_navigation.is_active',
285 'table_name' => 'civicrm_navigation',
286 'entity' => 'Navigation',
287 'bao' => 'CRM_Core_BAO_Navigation',
288 'localizable' => 0,
289 ],
290 'has_separator' => [
291 'name' => 'has_separator',
292 'type' => CRM_Utils_Type::T_BOOLEAN,
293 'title' => ts('Use separator'),
294 'description' => ts('If separator needs to be added after this menu item'),
295 'where' => 'civicrm_navigation.has_separator',
296 'table_name' => 'civicrm_navigation',
297 'entity' => 'Navigation',
298 'bao' => 'CRM_Core_BAO_Navigation',
299 'localizable' => 0,
300 ],
301 'weight' => [
302 'name' => 'weight',
303 'type' => CRM_Utils_Type::T_INT,
304 'title' => ts('Order'),
305 'description' => ts('Ordering of the navigation items in various blocks.'),
306 'where' => 'civicrm_navigation.weight',
307 'table_name' => 'civicrm_navigation',
308 'entity' => 'Navigation',
309 'bao' => 'CRM_Core_BAO_Navigation',
310 'localizable' => 0,
311 ],
312 ];
313 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
314 }
315 return Civi::$statics[__CLASS__]['fields'];
316 }
317
318 /**
319 * Return a mapping from field-name to the corresponding key (as used in fields()).
320 *
321 * @return array
322 * Array(string $name => string $uniqueName).
323 */
324 public static function &fieldKeys() {
325 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
326 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
327 }
328 return Civi::$statics[__CLASS__]['fieldKeys'];
329 }
330
331 /**
332 * Returns the names of this table
333 *
334 * @return string
335 */
336 public static function getTableName() {
337 return self::$_tableName;
338 }
339
340 /**
341 * Returns if this table needs to be logged
342 *
343 * @return bool
344 */
345 public function getLog() {
346 return self::$_log;
347 }
348
349 /**
350 * Returns the list of fields that can be imported
351 *
352 * @param bool $prefix
353 *
354 * @return array
355 */
356 public static function &import($prefix = FALSE) {
357 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'navigation', $prefix, []);
358 return $r;
359 }
360
361 /**
362 * Returns the list of fields that can be exported
363 *
364 * @param bool $prefix
365 *
366 * @return array
367 */
368 public static function &export($prefix = FALSE) {
369 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'navigation', $prefix, []);
370 return $r;
371 }
372
373 /**
374 * Returns the list of indices
375 *
376 * @param bool $localize
377 *
378 * @return array
379 */
380 public static function indices($localize = TRUE) {
381 $indices = [];
382 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
383 }
384
385 }