Merge pull request #14274 from seamuslee001/protected_fields_dao
[civicrm-core.git] / CRM / Core / DAO / Menu.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/Menu.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:7e990a38897543a3f411792e0ba47f90)
10 */
11
12 /**
13 * Database access object for the Menu entity.
14 */
15 class CRM_Core_DAO_Menu extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_menu';
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 unsigned
33 */
34 public $id;
35
36 /**
37 * Which Domain is this menu item for
38 *
39 * @var int unsigned
40 */
41 public $domain_id;
42
43 /**
44 * Path Name
45 *
46 * @var string
47 */
48 public $path;
49
50 /**
51 * Arguments to pass to the url
52 *
53 * @var text
54 */
55 public $path_arguments;
56
57 /**
58 * @var string
59 */
60 public $title;
61
62 /**
63 * Function to call to check access permissions
64 *
65 * @var string
66 */
67 public $access_callback;
68
69 /**
70 * Arguments to pass to access callback
71 *
72 * @var text
73 */
74 public $access_arguments;
75
76 /**
77 * function to call for this url
78 *
79 * @var string
80 */
81 public $page_callback;
82
83 /**
84 * Arguments to pass to page callback
85 *
86 * @var text
87 */
88 public $page_arguments;
89
90 /**
91 * Breadcrumb for the path.
92 *
93 * @var text
94 */
95 public $breadcrumb;
96
97 /**
98 * Url where a page should redirected to, if next url not known.
99 *
100 * @var string
101 */
102 public $return_url;
103
104 /**
105 * Arguments to pass to return_url
106 *
107 * @var string
108 */
109 public $return_url_args;
110
111 /**
112 * Component that this menu item belongs to
113 *
114 * @var int unsigned
115 */
116 public $component_id;
117
118 /**
119 * Is this menu item active?
120 *
121 * @var boolean
122 */
123 public $is_active;
124
125 /**
126 * Is this menu accessible to the public?
127 *
128 * @var boolean
129 */
130 public $is_public;
131
132 /**
133 * Is this menu exposed to the navigation system?
134 *
135 * @var boolean
136 */
137 public $is_exposed;
138
139 /**
140 * Should this menu be exposed via SSL if enabled?
141 *
142 * @var boolean
143 */
144 public $is_ssl;
145
146 /**
147 * Ordering of the menu items in various blocks.
148 *
149 * @var int
150 */
151 public $weight;
152
153 /**
154 * Drupal menu type.
155 *
156 * @var int
157 */
158 public $type;
159
160 /**
161 * CiviCRM menu type.
162 *
163 * @var int
164 */
165 public $page_type;
166
167 /**
168 * skip this url being exposed to breadcrumb
169 *
170 * @var boolean
171 */
172 public $skipBreadcrumb;
173
174 /**
175 * All other menu metadata not stored in other fields
176 *
177 * @var text
178 */
179 public $module_data;
180
181 /**
182 * Class constructor.
183 */
184 public function __construct() {
185 $this->__table = 'civicrm_menu';
186 parent::__construct();
187 }
188
189 /**
190 * Returns foreign keys and entity references.
191 *
192 * @return array
193 * [CRM_Core_Reference_Interface]
194 */
195 public static function getReferenceColumns() {
196 if (!isset(Civi::$statics[__CLASS__]['links'])) {
197 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
198 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
199 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'component_id', 'civicrm_component', 'id');
200 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
201 }
202 return Civi::$statics[__CLASS__]['links'];
203 }
204
205 /**
206 * Returns all the column names of this table
207 *
208 * @return array
209 */
210 public static function &fields() {
211 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
212 Civi::$statics[__CLASS__]['fields'] = [
213 'id' => [
214 'name' => 'id',
215 'type' => CRM_Utils_Type::T_INT,
216 'title' => ts('Menu ID'),
217 'required' => TRUE,
218 'where' => 'civicrm_menu.id',
219 'table_name' => 'civicrm_menu',
220 'entity' => 'Menu',
221 'bao' => 'CRM_Core_DAO_Menu',
222 'localizable' => 0,
223 ],
224 'domain_id' => [
225 'name' => 'domain_id',
226 'type' => CRM_Utils_Type::T_INT,
227 'title' => ts('Domain'),
228 'description' => ts('Which Domain is this menu item for'),
229 'required' => TRUE,
230 'where' => 'civicrm_menu.domain_id',
231 'table_name' => 'civicrm_menu',
232 'entity' => 'Menu',
233 'bao' => 'CRM_Core_DAO_Menu',
234 'localizable' => 0,
235 'FKClassName' => 'CRM_Core_DAO_Domain',
236 'pseudoconstant' => [
237 'table' => 'civicrm_domain',
238 'keyColumn' => 'id',
239 'labelColumn' => 'name',
240 ]
241 ],
242 'path' => [
243 'name' => 'path',
244 'type' => CRM_Utils_Type::T_STRING,
245 'title' => ts('Path'),
246 'description' => ts('Path Name'),
247 'maxlength' => 255,
248 'size' => CRM_Utils_Type::HUGE,
249 'where' => 'civicrm_menu.path',
250 'table_name' => 'civicrm_menu',
251 'entity' => 'Menu',
252 'bao' => 'CRM_Core_DAO_Menu',
253 'localizable' => 0,
254 ],
255 'path_arguments' => [
256 'name' => 'path_arguments',
257 'type' => CRM_Utils_Type::T_TEXT,
258 'title' => ts('Arguments'),
259 'description' => ts('Arguments to pass to the url'),
260 'where' => 'civicrm_menu.path_arguments',
261 'table_name' => 'civicrm_menu',
262 'entity' => 'Menu',
263 'bao' => 'CRM_Core_DAO_Menu',
264 'localizable' => 0,
265 ],
266 'title' => [
267 'name' => 'title',
268 'type' => CRM_Utils_Type::T_STRING,
269 'title' => ts('Menu Title'),
270 'maxlength' => 255,
271 'size' => CRM_Utils_Type::HUGE,
272 'where' => 'civicrm_menu.title',
273 'table_name' => 'civicrm_menu',
274 'entity' => 'Menu',
275 'bao' => 'CRM_Core_DAO_Menu',
276 'localizable' => 0,
277 ],
278 'access_callback' => [
279 'name' => 'access_callback',
280 'type' => CRM_Utils_Type::T_STRING,
281 'title' => ts('Access Callback'),
282 'description' => ts('Function to call to check access permissions'),
283 'maxlength' => 255,
284 'size' => CRM_Utils_Type::HUGE,
285 'where' => 'civicrm_menu.access_callback',
286 'table_name' => 'civicrm_menu',
287 'entity' => 'Menu',
288 'bao' => 'CRM_Core_DAO_Menu',
289 'localizable' => 0,
290 ],
291 'access_arguments' => [
292 'name' => 'access_arguments',
293 'type' => CRM_Utils_Type::T_TEXT,
294 'title' => ts('Access Arguments'),
295 'description' => ts('Arguments to pass to access callback'),
296 'where' => 'civicrm_menu.access_arguments',
297 'table_name' => 'civicrm_menu',
298 'entity' => 'Menu',
299 'bao' => 'CRM_Core_DAO_Menu',
300 'localizable' => 0,
301 ],
302 'page_callback' => [
303 'name' => 'page_callback',
304 'type' => CRM_Utils_Type::T_STRING,
305 'title' => ts('Page Callback'),
306 'description' => ts('function to call for this url'),
307 'maxlength' => 255,
308 'size' => CRM_Utils_Type::HUGE,
309 'where' => 'civicrm_menu.page_callback',
310 'table_name' => 'civicrm_menu',
311 'entity' => 'Menu',
312 'bao' => 'CRM_Core_DAO_Menu',
313 'localizable' => 0,
314 ],
315 'page_arguments' => [
316 'name' => 'page_arguments',
317 'type' => CRM_Utils_Type::T_TEXT,
318 'title' => ts('Page Arguments'),
319 'description' => ts('Arguments to pass to page callback'),
320 'where' => 'civicrm_menu.page_arguments',
321 'table_name' => 'civicrm_menu',
322 'entity' => 'Menu',
323 'bao' => 'CRM_Core_DAO_Menu',
324 'localizable' => 0,
325 ],
326 'breadcrumb' => [
327 'name' => 'breadcrumb',
328 'type' => CRM_Utils_Type::T_TEXT,
329 'title' => ts('Breadcrumb'),
330 'description' => ts('Breadcrumb for the path.'),
331 'where' => 'civicrm_menu.breadcrumb',
332 'table_name' => 'civicrm_menu',
333 'entity' => 'Menu',
334 'bao' => 'CRM_Core_DAO_Menu',
335 'localizable' => 0,
336 ],
337 'return_url' => [
338 'name' => 'return_url',
339 'type' => CRM_Utils_Type::T_STRING,
340 'title' => ts('Return Url'),
341 'description' => ts('Url where a page should redirected to, if next url not known.'),
342 'maxlength' => 255,
343 'size' => CRM_Utils_Type::HUGE,
344 'where' => 'civicrm_menu.return_url',
345 'table_name' => 'civicrm_menu',
346 'entity' => 'Menu',
347 'bao' => 'CRM_Core_DAO_Menu',
348 'localizable' => 0,
349 ],
350 'return_url_args' => [
351 'name' => 'return_url_args',
352 'type' => CRM_Utils_Type::T_STRING,
353 'title' => ts('Return Url Args'),
354 'description' => ts('Arguments to pass to return_url'),
355 'maxlength' => 255,
356 'size' => CRM_Utils_Type::HUGE,
357 'where' => 'civicrm_menu.return_url_args',
358 'table_name' => 'civicrm_menu',
359 'entity' => 'Menu',
360 'bao' => 'CRM_Core_DAO_Menu',
361 'localizable' => 0,
362 ],
363 'component_id' => [
364 'name' => 'component_id',
365 'type' => CRM_Utils_Type::T_INT,
366 'title' => ts('Component'),
367 'description' => ts('Component that this menu item belongs to'),
368 'where' => 'civicrm_menu.component_id',
369 'table_name' => 'civicrm_menu',
370 'entity' => 'Menu',
371 'bao' => 'CRM_Core_DAO_Menu',
372 'localizable' => 0,
373 'FKClassName' => 'CRM_Core_DAO_Component',
374 'html' => [
375 'type' => 'Select',
376 ],
377 'pseudoconstant' => [
378 'table' => 'civicrm_component',
379 'keyColumn' => 'id',
380 'labelColumn' => 'name',
381 ]
382 ],
383 'is_active' => [
384 'name' => 'is_active',
385 'type' => CRM_Utils_Type::T_BOOLEAN,
386 'title' => ts('Enabled?'),
387 'description' => ts('Is this menu item active?'),
388 'where' => 'civicrm_menu.is_active',
389 'table_name' => 'civicrm_menu',
390 'entity' => 'Menu',
391 'bao' => 'CRM_Core_DAO_Menu',
392 'localizable' => 0,
393 ],
394 'is_public' => [
395 'name' => 'is_public',
396 'type' => CRM_Utils_Type::T_BOOLEAN,
397 'title' => ts('Public?'),
398 'description' => ts('Is this menu accessible to the public?'),
399 'where' => 'civicrm_menu.is_public',
400 'table_name' => 'civicrm_menu',
401 'entity' => 'Menu',
402 'bao' => 'CRM_Core_DAO_Menu',
403 'localizable' => 0,
404 ],
405 'is_exposed' => [
406 'name' => 'is_exposed',
407 'type' => CRM_Utils_Type::T_BOOLEAN,
408 'title' => ts('Exposed?'),
409 'description' => ts('Is this menu exposed to the navigation system?'),
410 'where' => 'civicrm_menu.is_exposed',
411 'table_name' => 'civicrm_menu',
412 'entity' => 'Menu',
413 'bao' => 'CRM_Core_DAO_Menu',
414 'localizable' => 0,
415 ],
416 'is_ssl' => [
417 'name' => 'is_ssl',
418 'type' => CRM_Utils_Type::T_BOOLEAN,
419 'title' => ts('Use SSL?'),
420 'description' => ts('Should this menu be exposed via SSL if enabled?'),
421 'where' => 'civicrm_menu.is_ssl',
422 'table_name' => 'civicrm_menu',
423 'entity' => 'Menu',
424 'bao' => 'CRM_Core_DAO_Menu',
425 'localizable' => 0,
426 ],
427 'weight' => [
428 'name' => 'weight',
429 'type' => CRM_Utils_Type::T_INT,
430 'title' => ts('Order'),
431 'description' => ts('Ordering of the menu items in various blocks.'),
432 'required' => TRUE,
433 'where' => 'civicrm_menu.weight',
434 'default' => '1',
435 'table_name' => 'civicrm_menu',
436 'entity' => 'Menu',
437 'bao' => 'CRM_Core_DAO_Menu',
438 'localizable' => 0,
439 ],
440 'type' => [
441 'name' => 'type',
442 'type' => CRM_Utils_Type::T_INT,
443 'title' => ts('Type'),
444 'description' => ts('Drupal menu type.'),
445 'required' => TRUE,
446 'where' => 'civicrm_menu.type',
447 'default' => '1',
448 'table_name' => 'civicrm_menu',
449 'entity' => 'Menu',
450 'bao' => 'CRM_Core_DAO_Menu',
451 'localizable' => 0,
452 ],
453 'page_type' => [
454 'name' => 'page_type',
455 'type' => CRM_Utils_Type::T_INT,
456 'title' => ts('Page Type'),
457 'description' => ts('CiviCRM menu type.'),
458 'required' => TRUE,
459 'where' => 'civicrm_menu.page_type',
460 'default' => '1',
461 'table_name' => 'civicrm_menu',
462 'entity' => 'Menu',
463 'bao' => 'CRM_Core_DAO_Menu',
464 'localizable' => 0,
465 ],
466 'skipBreadcrumb' => [
467 'name' => 'skipBreadcrumb',
468 'type' => CRM_Utils_Type::T_BOOLEAN,
469 'title' => ts('Hide Breadcrumb?'),
470 'description' => ts('skip this url being exposed to breadcrumb'),
471 'where' => 'civicrm_menu.skipBreadcrumb',
472 'table_name' => 'civicrm_menu',
473 'entity' => 'Menu',
474 'bao' => 'CRM_Core_DAO_Menu',
475 'localizable' => 0,
476 ],
477 'module_data' => [
478 'name' => 'module_data',
479 'type' => CRM_Utils_Type::T_TEXT,
480 'title' => ts('Other menu data'),
481 'description' => ts('All other menu metadata not stored in other fields'),
482 'where' => 'civicrm_menu.module_data',
483 'table_name' => 'civicrm_menu',
484 'entity' => 'Menu',
485 'bao' => 'CRM_Core_DAO_Menu',
486 'localizable' => 0,
487 ],
488 ];
489 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
490 }
491 return Civi::$statics[__CLASS__]['fields'];
492 }
493
494 /**
495 * Return a mapping from field-name to the corresponding key (as used in fields()).
496 *
497 * @return array
498 * Array(string $name => string $uniqueName).
499 */
500 public static function &fieldKeys() {
501 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
502 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
503 }
504 return Civi::$statics[__CLASS__]['fieldKeys'];
505 }
506
507 /**
508 * Returns the names of this table
509 *
510 * @return string
511 */
512 public static function getTableName() {
513 return self::$_tableName;
514 }
515
516 /**
517 * Returns if this table needs to be logged
518 *
519 * @return bool
520 */
521 public function getLog() {
522 return self::$_log;
523 }
524
525 /**
526 * Returns the list of fields that can be imported
527 *
528 * @param bool $prefix
529 *
530 * @return array
531 */
532 public static function &import($prefix = FALSE) {
533 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'menu', $prefix, []);
534 return $r;
535 }
536
537 /**
538 * Returns the list of fields that can be exported
539 *
540 * @param bool $prefix
541 *
542 * @return array
543 */
544 public static function &export($prefix = FALSE) {
545 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'menu', $prefix, []);
546 return $r;
547 }
548
549 /**
550 * Returns the list of indices
551 *
552 * @param bool $localize
553 *
554 * @return array
555 */
556 public static function indices($localize = TRUE) {
557 $indices = [
558 'UI_path_domain_id' => [
559 'name' => 'UI_path_domain_id',
560 'field' => [
561 0 => 'path',
562 1 => 'domain_id',
563 ],
564 'localizable' => FALSE,
565 'unique' => TRUE,
566 'sig' => 'civicrm_menu::1::path::domain_id',
567 ],
568 ];
569 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
570 }
571
572 }