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