Merge pull request #11657 from eileenmcnaughton/more_speed
[civicrm-core.git] / CRM / Core / DAO / Menu.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Core/Menu.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:78591d8ca17fb4eb39a7123f35399035)
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 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 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 'table_name' => 'civicrm_menu',
219 'entity' => 'Menu',
220 'bao' => 'CRM_Core_DAO_Menu',
221 'localizable' => 0,
222 ],
223 'domain_id' => [
224 'name' => 'domain_id',
225 'type' => CRM_Utils_Type::T_INT,
226 'title' => ts('Domain'),
227 'description' => 'Which Domain is this menu item for',
228 'required' => TRUE,
229 'table_name' => 'civicrm_menu',
230 'entity' => 'Menu',
231 'bao' => 'CRM_Core_DAO_Menu',
232 'localizable' => 0,
233 'FKClassName' => 'CRM_Core_DAO_Domain',
234 'pseudoconstant' => [
235 'table' => 'civicrm_domain',
236 'keyColumn' => 'id',
237 'labelColumn' => 'name',
238 ]
239 ],
240 'path' => [
241 'name' => 'path',
242 'type' => CRM_Utils_Type::T_STRING,
243 'title' => ts('Path'),
244 'description' => 'Path Name',
245 'maxlength' => 255,
246 'size' => CRM_Utils_Type::HUGE,
247 'table_name' => 'civicrm_menu',
248 'entity' => 'Menu',
249 'bao' => 'CRM_Core_DAO_Menu',
250 'localizable' => 0,
251 ],
252 'path_arguments' => [
253 'name' => 'path_arguments',
254 'type' => CRM_Utils_Type::T_TEXT,
255 'title' => ts('Arguments'),
256 'description' => 'Arguments to pass to the url',
257 'table_name' => 'civicrm_menu',
258 'entity' => 'Menu',
259 'bao' => 'CRM_Core_DAO_Menu',
260 'localizable' => 0,
261 ],
262 'title' => [
263 'name' => 'title',
264 'type' => CRM_Utils_Type::T_STRING,
265 'title' => ts('Menu Title'),
266 'maxlength' => 255,
267 'size' => CRM_Utils_Type::HUGE,
268 'table_name' => 'civicrm_menu',
269 'entity' => 'Menu',
270 'bao' => 'CRM_Core_DAO_Menu',
271 'localizable' => 0,
272 ],
273 'access_callback' => [
274 'name' => 'access_callback',
275 'type' => CRM_Utils_Type::T_STRING,
276 'title' => ts('Access Callback'),
277 'description' => 'Function to call to check access permissions',
278 'maxlength' => 255,
279 'size' => CRM_Utils_Type::HUGE,
280 'table_name' => 'civicrm_menu',
281 'entity' => 'Menu',
282 'bao' => 'CRM_Core_DAO_Menu',
283 'localizable' => 0,
284 ],
285 'access_arguments' => [
286 'name' => 'access_arguments',
287 'type' => CRM_Utils_Type::T_TEXT,
288 'title' => ts('Access Arguments'),
289 'description' => 'Arguments to pass to access callback',
290 'table_name' => 'civicrm_menu',
291 'entity' => 'Menu',
292 'bao' => 'CRM_Core_DAO_Menu',
293 'localizable' => 0,
294 ],
295 'page_callback' => [
296 'name' => 'page_callback',
297 'type' => CRM_Utils_Type::T_STRING,
298 'title' => ts('Page Callback'),
299 'description' => 'function to call for this url',
300 'maxlength' => 255,
301 'size' => CRM_Utils_Type::HUGE,
302 'table_name' => 'civicrm_menu',
303 'entity' => 'Menu',
304 'bao' => 'CRM_Core_DAO_Menu',
305 'localizable' => 0,
306 ],
307 'page_arguments' => [
308 'name' => 'page_arguments',
309 'type' => CRM_Utils_Type::T_TEXT,
310 'title' => ts('Page Arguments'),
311 'description' => 'Arguments to pass to page callback',
312 'table_name' => 'civicrm_menu',
313 'entity' => 'Menu',
314 'bao' => 'CRM_Core_DAO_Menu',
315 'localizable' => 0,
316 ],
317 'breadcrumb' => [
318 'name' => 'breadcrumb',
319 'type' => CRM_Utils_Type::T_TEXT,
320 'title' => ts('Breadcrumb'),
321 'description' => 'Breadcrumb for the path.',
322 'table_name' => 'civicrm_menu',
323 'entity' => 'Menu',
324 'bao' => 'CRM_Core_DAO_Menu',
325 'localizable' => 0,
326 ],
327 'return_url' => [
328 'name' => 'return_url',
329 'type' => CRM_Utils_Type::T_STRING,
330 'title' => ts('Return Url'),
331 'description' => 'Url where a page should redirected to, if next url not known.',
332 'maxlength' => 255,
333 'size' => CRM_Utils_Type::HUGE,
334 'table_name' => 'civicrm_menu',
335 'entity' => 'Menu',
336 'bao' => 'CRM_Core_DAO_Menu',
337 'localizable' => 0,
338 ],
339 'return_url_args' => [
340 'name' => 'return_url_args',
341 'type' => CRM_Utils_Type::T_STRING,
342 'title' => ts('Return Url Args'),
343 'description' => 'Arguments to pass to return_url',
344 'maxlength' => 255,
345 'size' => CRM_Utils_Type::HUGE,
346 'table_name' => 'civicrm_menu',
347 'entity' => 'Menu',
348 'bao' => 'CRM_Core_DAO_Menu',
349 'localizable' => 0,
350 ],
351 'component_id' => [
352 'name' => 'component_id',
353 'type' => CRM_Utils_Type::T_INT,
354 'title' => ts('Component'),
355 'description' => 'Component that this menu item belongs to',
356 'table_name' => 'civicrm_menu',
357 'entity' => 'Menu',
358 'bao' => 'CRM_Core_DAO_Menu',
359 'localizable' => 0,
360 'FKClassName' => 'CRM_Core_DAO_Component',
361 'html' => [
362 'type' => 'Select',
363 ],
364 'pseudoconstant' => [
365 'table' => 'civicrm_component',
366 'keyColumn' => 'id',
367 'labelColumn' => 'name',
368 ]
369 ],
370 'is_active' => [
371 'name' => 'is_active',
372 'type' => CRM_Utils_Type::T_BOOLEAN,
373 'title' => ts('Enabled?'),
374 'description' => 'Is this menu item active?',
375 'table_name' => 'civicrm_menu',
376 'entity' => 'Menu',
377 'bao' => 'CRM_Core_DAO_Menu',
378 'localizable' => 0,
379 ],
380 'is_public' => [
381 'name' => 'is_public',
382 'type' => CRM_Utils_Type::T_BOOLEAN,
383 'title' => ts('Public?'),
384 'description' => 'Is this menu accessible to the public?',
385 'table_name' => 'civicrm_menu',
386 'entity' => 'Menu',
387 'bao' => 'CRM_Core_DAO_Menu',
388 'localizable' => 0,
389 ],
390 'is_exposed' => [
391 'name' => 'is_exposed',
392 'type' => CRM_Utils_Type::T_BOOLEAN,
393 'title' => ts('Exposed?'),
394 'description' => 'Is this menu exposed to the navigation system?',
395 'table_name' => 'civicrm_menu',
396 'entity' => 'Menu',
397 'bao' => 'CRM_Core_DAO_Menu',
398 'localizable' => 0,
399 ],
400 'is_ssl' => [
401 'name' => 'is_ssl',
402 'type' => CRM_Utils_Type::T_BOOLEAN,
403 'title' => ts('Use SSL?'),
404 'description' => 'Should this menu be exposed via SSL if enabled?',
405 'table_name' => 'civicrm_menu',
406 'entity' => 'Menu',
407 'bao' => 'CRM_Core_DAO_Menu',
408 'localizable' => 0,
409 ],
410 'weight' => [
411 'name' => 'weight',
412 'type' => CRM_Utils_Type::T_INT,
413 'title' => ts('Order'),
414 'description' => 'Ordering of the menu items in various blocks.',
415 'required' => TRUE,
416 'default' => '1',
417 'table_name' => 'civicrm_menu',
418 'entity' => 'Menu',
419 'bao' => 'CRM_Core_DAO_Menu',
420 'localizable' => 0,
421 ],
422 'type' => [
423 'name' => 'type',
424 'type' => CRM_Utils_Type::T_INT,
425 'title' => ts('Type'),
426 'description' => 'Drupal menu type.',
427 'required' => TRUE,
428 'default' => '1',
429 'table_name' => 'civicrm_menu',
430 'entity' => 'Menu',
431 'bao' => 'CRM_Core_DAO_Menu',
432 'localizable' => 0,
433 ],
434 'page_type' => [
435 'name' => 'page_type',
436 'type' => CRM_Utils_Type::T_INT,
437 'title' => ts('Page Type'),
438 'description' => 'CiviCRM menu type.',
439 'required' => TRUE,
440 'default' => '1',
441 'table_name' => 'civicrm_menu',
442 'entity' => 'Menu',
443 'bao' => 'CRM_Core_DAO_Menu',
444 'localizable' => 0,
445 ],
446 'skipBreadcrumb' => [
447 'name' => 'skipBreadcrumb',
448 'type' => CRM_Utils_Type::T_BOOLEAN,
449 'title' => ts('Hide Breadcrumb?'),
450 'description' => 'skip this url being exposed to breadcrumb',
451 'table_name' => 'civicrm_menu',
452 'entity' => 'Menu',
453 'bao' => 'CRM_Core_DAO_Menu',
454 'localizable' => 0,
455 ],
456 'module_data' => [
457 'name' => 'module_data',
458 'type' => CRM_Utils_Type::T_TEXT,
459 'title' => ts('Other menu data'),
460 'description' => 'All other menu metadata not stored in other fields',
461 'table_name' => 'civicrm_menu',
462 'entity' => 'Menu',
463 'bao' => 'CRM_Core_DAO_Menu',
464 'localizable' => 0,
465 ],
466 ];
467 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
468 }
469 return Civi::$statics[__CLASS__]['fields'];
470 }
471
472 /**
473 * Return a mapping from field-name to the corresponding key (as used in fields()).
474 *
475 * @return array
476 * Array(string $name => string $uniqueName).
477 */
478 public static function &fieldKeys() {
479 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
480 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
481 }
482 return Civi::$statics[__CLASS__]['fieldKeys'];
483 }
484
485 /**
486 * Returns the names of this table
487 *
488 * @return string
489 */
490 public static function getTableName() {
491 return self::$_tableName;
492 }
493
494 /**
495 * Returns if this table needs to be logged
496 *
497 * @return bool
498 */
499 public function getLog() {
500 return self::$_log;
501 }
502
503 /**
504 * Returns the list of fields that can be imported
505 *
506 * @param bool $prefix
507 *
508 * @return array
509 */
510 public static function &import($prefix = FALSE) {
511 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'menu', $prefix, []);
512 return $r;
513 }
514
515 /**
516 * Returns the list of fields that can be exported
517 *
518 * @param bool $prefix
519 *
520 * @return array
521 */
522 public static function &export($prefix = FALSE) {
523 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'menu', $prefix, []);
524 return $r;
525 }
526
527 /**
528 * Returns the list of indices
529 *
530 * @param bool $localize
531 *
532 * @return array
533 */
534 public static function indices($localize = TRUE) {
535 $indices = [
536 'UI_path_domain_id' => [
537 'name' => 'UI_path_domain_id',
538 'field' => [
539 0 => 'path',
540 1 => 'domain_id',
541 ],
542 'localizable' => FALSE,
543 'unique' => TRUE,
544 'sig' => 'civicrm_menu::1::path::domain_id',
545 ],
546 ];
547 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
548 }
549
550 }