Merge pull request #11017 from seamuslee001/CRM-21212
[civicrm-core.git] / CRM / Core / DAO / Menu.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Core/Menu.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
b44dc91e 33 * (GenCodeChecksum:78591d8ca17fb4eb39a7123f35399035)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_Menu constructor.
39 */
e501603b
TO
40class CRM_Core_DAO_Menu extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_menu';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 *
55 * @var int unsigned
56 */
57 public $id;
58 /**
59 * Which Domain is this menu item for
60 *
61 * @var int unsigned
62 */
63 public $domain_id;
64 /**
65 * Path Name
66 *
67 * @var string
68 */
69 public $path;
70 /**
71 * Arguments to pass to the url
72 *
73 * @var text
74 */
75 public $path_arguments;
76 /**
77 *
78 * @var string
79 */
80 public $title;
81 /**
82 * Function to call to check access permissions
83 *
84 * @var string
85 */
86 public $access_callback;
87 /**
88 * Arguments to pass to access callback
89 *
90 * @var text
91 */
92 public $access_arguments;
93 /**
94 * function to call for this url
95 *
96 * @var string
97 */
98 public $page_callback;
99 /**
100 * Arguments to pass to page callback
101 *
102 * @var text
103 */
104 public $page_arguments;
105 /**
106 * Breadcrumb for the path.
107 *
108 * @var text
109 */
110 public $breadcrumb;
111 /**
112 * Url where a page should redirected to, if next url not known.
113 *
114 * @var string
115 */
116 public $return_url;
117 /**
118 * Arguments to pass to return_url
119 *
120 * @var string
121 */
122 public $return_url_args;
123 /**
124 * Component that this menu item belongs to
125 *
126 * @var int unsigned
127 */
128 public $component_id;
129 /**
130 * Is this menu item active?
131 *
132 * @var boolean
133 */
134 public $is_active;
135 /**
136 * Is this menu accessible to the public?
137 *
138 * @var boolean
139 */
140 public $is_public;
141 /**
142 * Is this menu exposed to the navigation system?
143 *
144 * @var boolean
145 */
146 public $is_exposed;
147 /**
148 * Should this menu be exposed via SSL if enabled?
149 *
150 * @var boolean
151 */
152 public $is_ssl;
153 /**
154 * Ordering of the menu items in various blocks.
155 *
156 * @var int
157 */
158 public $weight;
159 /**
160 * Drupal menu type.
161 *
162 * @var int
163 */
164 public $type;
165 /**
166 * CiviCRM menu type.
167 *
168 * @var int
169 */
170 public $page_type;
171 /**
172 * skip this url being exposed to breadcrumb
173 *
174 * @var boolean
175 */
176 public $skipBreadcrumb;
b44dc91e
TO
177 /**
178 * All other menu metadata not stored in other fields
179 *
180 * @var text
181 */
182 public $module_data;
e501603b 183 /**
f41f0342 184 * Class constructor.
e501603b
TO
185 */
186 function __construct() {
187 $this->__table = 'civicrm_menu';
188 parent::__construct();
189 }
190 /**
f41f0342 191 * Returns foreign keys and entity references.
e501603b
TO
192 *
193 * @return array
194 * [CRM_Core_Reference_Interface]
195 */
196 static function getReferenceColumns() {
346aaaba
TO
197 if (!isset(Civi::$statics[__CLASS__]['links'])) {
198 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
199 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
200 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id');
201 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 202 }
346aaaba 203 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
204 }
205 /**
206 * Returns all the column names of this table
207 *
208 * @return array
209 */
210 static function &fields() {
346aaaba
TO
211 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
212 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
213 'id' => array(
214 'name' => 'id',
215 'type' => CRM_Utils_Type::T_INT,
216 'title' => ts('Menu ID') ,
217 'required' => true,
522a26c9 218 'table_name' => 'civicrm_menu',
219 'entity' => 'Menu',
220 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 221 'localizable' => 0,
e501603b
TO
222 ) ,
223 'domain_id' => array(
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,
522a26c9 229 'table_name' => 'civicrm_menu',
230 'entity' => 'Menu',
231 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 232 'localizable' => 0,
e501603b
TO
233 'FKClassName' => 'CRM_Core_DAO_Domain',
234 'pseudoconstant' => array(
235 'table' => 'civicrm_domain',
236 'keyColumn' => 'id',
237 'labelColumn' => 'name',
238 )
239 ) ,
240 'path' => array(
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,
522a26c9 247 'table_name' => 'civicrm_menu',
248 'entity' => 'Menu',
249 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 250 'localizable' => 0,
e501603b
TO
251 ) ,
252 'path_arguments' => array(
253 'name' => 'path_arguments',
254 'type' => CRM_Utils_Type::T_TEXT,
255 'title' => ts('Arguments') ,
256 'description' => 'Arguments to pass to the url',
522a26c9 257 'table_name' => 'civicrm_menu',
258 'entity' => 'Menu',
259 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 260 'localizable' => 0,
e501603b
TO
261 ) ,
262 'title' => array(
263 'name' => 'title',
264 'type' => CRM_Utils_Type::T_STRING,
265 'title' => ts('Menu Title') ,
266 'maxlength' => 255,
267 'size' => CRM_Utils_Type::HUGE,
522a26c9 268 'table_name' => 'civicrm_menu',
269 'entity' => 'Menu',
270 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 271 'localizable' => 0,
e501603b
TO
272 ) ,
273 'access_callback' => array(
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,
522a26c9 280 'table_name' => 'civicrm_menu',
281 'entity' => 'Menu',
282 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 283 'localizable' => 0,
e501603b
TO
284 ) ,
285 'access_arguments' => array(
286 'name' => 'access_arguments',
287 'type' => CRM_Utils_Type::T_TEXT,
288 'title' => ts('Access Arguments') ,
289 'description' => 'Arguments to pass to access callback',
522a26c9 290 'table_name' => 'civicrm_menu',
291 'entity' => 'Menu',
292 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 293 'localizable' => 0,
e501603b
TO
294 ) ,
295 'page_callback' => array(
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,
522a26c9 302 'table_name' => 'civicrm_menu',
303 'entity' => 'Menu',
304 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 305 'localizable' => 0,
e501603b
TO
306 ) ,
307 'page_arguments' => array(
308 'name' => 'page_arguments',
309 'type' => CRM_Utils_Type::T_TEXT,
310 'title' => ts('Page Arguments') ,
311 'description' => 'Arguments to pass to page callback',
522a26c9 312 'table_name' => 'civicrm_menu',
313 'entity' => 'Menu',
314 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 315 'localizable' => 0,
e501603b
TO
316 ) ,
317 'breadcrumb' => array(
318 'name' => 'breadcrumb',
319 'type' => CRM_Utils_Type::T_TEXT,
320 'title' => ts('Breadcrumb') ,
321 'description' => 'Breadcrumb for the path.',
522a26c9 322 'table_name' => 'civicrm_menu',
323 'entity' => 'Menu',
324 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 325 'localizable' => 0,
e501603b
TO
326 ) ,
327 'return_url' => array(
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,
522a26c9 334 'table_name' => 'civicrm_menu',
335 'entity' => 'Menu',
336 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 337 'localizable' => 0,
e501603b
TO
338 ) ,
339 'return_url_args' => array(
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,
522a26c9 346 'table_name' => 'civicrm_menu',
347 'entity' => 'Menu',
348 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 349 'localizable' => 0,
e501603b
TO
350 ) ,
351 'component_id' => array(
352 'name' => 'component_id',
353 'type' => CRM_Utils_Type::T_INT,
354 'title' => ts('Component') ,
355 'description' => 'Component that this menu item belongs to',
522a26c9 356 'table_name' => 'civicrm_menu',
357 'entity' => 'Menu',
358 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 359 'localizable' => 0,
e501603b
TO
360 'FKClassName' => 'CRM_Core_DAO_Component',
361 'html' => array(
362 'type' => 'Select',
363 ) ,
364 'pseudoconstant' => array(
365 'table' => 'civicrm_component',
366 'keyColumn' => 'id',
367 'labelColumn' => 'name',
368 )
369 ) ,
370 'is_active' => array(
371 'name' => 'is_active',
372 'type' => CRM_Utils_Type::T_BOOLEAN,
373 'title' => ts('Enabled?') ,
374 'description' => 'Is this menu item active?',
522a26c9 375 'table_name' => 'civicrm_menu',
376 'entity' => 'Menu',
377 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 378 'localizable' => 0,
e501603b
TO
379 ) ,
380 'is_public' => array(
381 'name' => 'is_public',
382 'type' => CRM_Utils_Type::T_BOOLEAN,
383 'title' => ts('Public?') ,
384 'description' => 'Is this menu accessible to the public?',
522a26c9 385 'table_name' => 'civicrm_menu',
386 'entity' => 'Menu',
387 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 388 'localizable' => 0,
e501603b
TO
389 ) ,
390 'is_exposed' => array(
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?',
522a26c9 395 'table_name' => 'civicrm_menu',
396 'entity' => 'Menu',
397 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 398 'localizable' => 0,
e501603b
TO
399 ) ,
400 'is_ssl' => array(
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?',
522a26c9 405 'table_name' => 'civicrm_menu',
406 'entity' => 'Menu',
407 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 408 'localizable' => 0,
e501603b
TO
409 ) ,
410 'weight' => array(
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',
522a26c9 417 'table_name' => 'civicrm_menu',
418 'entity' => 'Menu',
419 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 420 'localizable' => 0,
e501603b
TO
421 ) ,
422 'type' => array(
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',
522a26c9 429 'table_name' => 'civicrm_menu',
430 'entity' => 'Menu',
431 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 432 'localizable' => 0,
e501603b
TO
433 ) ,
434 'page_type' => array(
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',
522a26c9 441 'table_name' => 'civicrm_menu',
442 'entity' => 'Menu',
443 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 444 'localizable' => 0,
e501603b
TO
445 ) ,
446 'skipBreadcrumb' => array(
447 'name' => 'skipBreadcrumb',
448 'type' => CRM_Utils_Type::T_BOOLEAN,
449 'title' => ts('Hide Breadcrumb?') ,
450 'description' => 'skip this url being exposed to breadcrumb',
522a26c9 451 'table_name' => 'civicrm_menu',
452 'entity' => 'Menu',
b44dc91e
TO
453 'bao' => 'CRM_Core_DAO_Menu',
454 'localizable' => 0,
455 ) ,
456 'module_data' => array(
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',
522a26c9 463 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 464 'localizable' => 0,
e501603b
TO
465 ) ,
466 );
346aaaba 467 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 468 }
346aaaba 469 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
470 }
471 /**
bd8e0b14 472 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
473 *
474 * @return array
bd8e0b14 475 * Array(string $name => string $uniqueName).
e501603b
TO
476 */
477 static function &fieldKeys() {
bd8e0b14
TO
478 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
479 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 480 }
bd8e0b14 481 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
482 }
483 /**
484 * Returns the names of this table
485 *
486 * @return string
487 */
488 static function getTableName() {
489 return self::$_tableName;
490 }
491 /**
492 * Returns if this table needs to be logged
493 *
494 * @return boolean
495 */
496 function getLog() {
497 return self::$_log;
498 }
499 /**
500 * Returns the list of fields that can be imported
501 *
502 * @param bool $prefix
503 *
504 * @return array
505 */
506 static function &import($prefix = false) {
60808919
TO
507 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'menu', $prefix, array());
508 return $r;
e501603b
TO
509 }
510 /**
511 * Returns the list of fields that can be exported
512 *
513 * @param bool $prefix
514 *
515 * @return array
516 */
517 static function &export($prefix = false) {
60808919
TO
518 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'menu', $prefix, array());
519 return $r;
e501603b 520 }
e7a6b91a
AS
521 /**
522 * Returns the list of indices
523 */
524 public static function indices($localize = TRUE) {
525 $indices = array(
526 'UI_path_domain_id' => array(
527 'name' => 'UI_path_domain_id',
528 'field' => array(
529 0 => 'path',
530 1 => 'domain_id',
531 ) ,
532 'localizable' => false,
533 'unique' => true,
534 'sig' => 'civicrm_menu::1::path::domain_id',
535 ) ,
536 );
537 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
538 }
e501603b 539}