Merge pull request #10549 from jitendrapurohit/CRM-20761
[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
e7a6b91a 33 * (GenCodeChecksum:d8e5fdbc1e7295d660e44d94a81db6e7)
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;
177 /**
f41f0342 178 * Class constructor.
e501603b
TO
179 */
180 function __construct() {
181 $this->__table = 'civicrm_menu';
182 parent::__construct();
183 }
184 /**
f41f0342 185 * Returns foreign keys and entity references.
e501603b
TO
186 *
187 * @return array
188 * [CRM_Core_Reference_Interface]
189 */
190 static function getReferenceColumns() {
346aaaba
TO
191 if (!isset(Civi::$statics[__CLASS__]['links'])) {
192 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
193 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
194 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id');
195 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 196 }
346aaaba 197 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
198 }
199 /**
200 * Returns all the column names of this table
201 *
202 * @return array
203 */
204 static function &fields() {
346aaaba
TO
205 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
206 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
207 'id' => array(
208 'name' => 'id',
209 'type' => CRM_Utils_Type::T_INT,
210 'title' => ts('Menu ID') ,
211 'required' => true,
522a26c9 212 'table_name' => 'civicrm_menu',
213 'entity' => 'Menu',
214 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 215 'localizable' => 0,
e501603b
TO
216 ) ,
217 'domain_id' => array(
218 'name' => 'domain_id',
219 'type' => CRM_Utils_Type::T_INT,
220 'title' => ts('Domain') ,
221 'description' => 'Which Domain is this menu item for',
222 'required' => true,
522a26c9 223 'table_name' => 'civicrm_menu',
224 'entity' => 'Menu',
225 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 226 'localizable' => 0,
e501603b
TO
227 'FKClassName' => 'CRM_Core_DAO_Domain',
228 'pseudoconstant' => array(
229 'table' => 'civicrm_domain',
230 'keyColumn' => 'id',
231 'labelColumn' => 'name',
232 )
233 ) ,
234 'path' => array(
235 'name' => 'path',
236 'type' => CRM_Utils_Type::T_STRING,
237 'title' => ts('Path') ,
238 'description' => 'Path Name',
239 'maxlength' => 255,
240 'size' => CRM_Utils_Type::HUGE,
522a26c9 241 'table_name' => 'civicrm_menu',
242 'entity' => 'Menu',
243 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 244 'localizable' => 0,
e501603b
TO
245 ) ,
246 'path_arguments' => array(
247 'name' => 'path_arguments',
248 'type' => CRM_Utils_Type::T_TEXT,
249 'title' => ts('Arguments') ,
250 'description' => 'Arguments to pass to the url',
522a26c9 251 'table_name' => 'civicrm_menu',
252 'entity' => 'Menu',
253 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 254 'localizable' => 0,
e501603b
TO
255 ) ,
256 'title' => array(
257 'name' => 'title',
258 'type' => CRM_Utils_Type::T_STRING,
259 'title' => ts('Menu Title') ,
260 'maxlength' => 255,
261 'size' => CRM_Utils_Type::HUGE,
522a26c9 262 'table_name' => 'civicrm_menu',
263 'entity' => 'Menu',
264 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 265 'localizable' => 0,
e501603b
TO
266 ) ,
267 'access_callback' => array(
268 'name' => 'access_callback',
269 'type' => CRM_Utils_Type::T_STRING,
270 'title' => ts('Access Callback') ,
271 'description' => 'Function to call to check access permissions',
272 'maxlength' => 255,
273 'size' => CRM_Utils_Type::HUGE,
522a26c9 274 'table_name' => 'civicrm_menu',
275 'entity' => 'Menu',
276 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 277 'localizable' => 0,
e501603b
TO
278 ) ,
279 'access_arguments' => array(
280 'name' => 'access_arguments',
281 'type' => CRM_Utils_Type::T_TEXT,
282 'title' => ts('Access Arguments') ,
283 'description' => 'Arguments to pass to access callback',
522a26c9 284 'table_name' => 'civicrm_menu',
285 'entity' => 'Menu',
286 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 287 'localizable' => 0,
e501603b
TO
288 ) ,
289 'page_callback' => array(
290 'name' => 'page_callback',
291 'type' => CRM_Utils_Type::T_STRING,
292 'title' => ts('Page Callback') ,
293 'description' => 'function to call for this url',
294 'maxlength' => 255,
295 'size' => CRM_Utils_Type::HUGE,
522a26c9 296 'table_name' => 'civicrm_menu',
297 'entity' => 'Menu',
298 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 299 'localizable' => 0,
e501603b
TO
300 ) ,
301 'page_arguments' => array(
302 'name' => 'page_arguments',
303 'type' => CRM_Utils_Type::T_TEXT,
304 'title' => ts('Page Arguments') ,
305 'description' => 'Arguments to pass to page callback',
522a26c9 306 'table_name' => 'civicrm_menu',
307 'entity' => 'Menu',
308 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 309 'localizable' => 0,
e501603b
TO
310 ) ,
311 'breadcrumb' => array(
312 'name' => 'breadcrumb',
313 'type' => CRM_Utils_Type::T_TEXT,
314 'title' => ts('Breadcrumb') ,
315 'description' => 'Breadcrumb for the path.',
522a26c9 316 'table_name' => 'civicrm_menu',
317 'entity' => 'Menu',
318 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 319 'localizable' => 0,
e501603b
TO
320 ) ,
321 'return_url' => array(
322 'name' => 'return_url',
323 'type' => CRM_Utils_Type::T_STRING,
324 'title' => ts('Return Url') ,
325 'description' => 'Url where a page should redirected to, if next url not known.',
326 'maxlength' => 255,
327 'size' => CRM_Utils_Type::HUGE,
522a26c9 328 'table_name' => 'civicrm_menu',
329 'entity' => 'Menu',
330 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 331 'localizable' => 0,
e501603b
TO
332 ) ,
333 'return_url_args' => array(
334 'name' => 'return_url_args',
335 'type' => CRM_Utils_Type::T_STRING,
336 'title' => ts('Return Url Args') ,
337 'description' => 'Arguments to pass to return_url',
338 'maxlength' => 255,
339 'size' => CRM_Utils_Type::HUGE,
522a26c9 340 'table_name' => 'civicrm_menu',
341 'entity' => 'Menu',
342 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 343 'localizable' => 0,
e501603b
TO
344 ) ,
345 'component_id' => array(
346 'name' => 'component_id',
347 'type' => CRM_Utils_Type::T_INT,
348 'title' => ts('Component') ,
349 'description' => 'Component that this menu item belongs to',
522a26c9 350 'table_name' => 'civicrm_menu',
351 'entity' => 'Menu',
352 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 353 'localizable' => 0,
e501603b
TO
354 'FKClassName' => 'CRM_Core_DAO_Component',
355 'html' => array(
356 'type' => 'Select',
357 ) ,
358 'pseudoconstant' => array(
359 'table' => 'civicrm_component',
360 'keyColumn' => 'id',
361 'labelColumn' => 'name',
362 )
363 ) ,
364 'is_active' => array(
365 'name' => 'is_active',
366 'type' => CRM_Utils_Type::T_BOOLEAN,
367 'title' => ts('Enabled?') ,
368 'description' => 'Is this menu item active?',
522a26c9 369 'table_name' => 'civicrm_menu',
370 'entity' => 'Menu',
371 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 372 'localizable' => 0,
e501603b
TO
373 ) ,
374 'is_public' => array(
375 'name' => 'is_public',
376 'type' => CRM_Utils_Type::T_BOOLEAN,
377 'title' => ts('Public?') ,
378 'description' => 'Is this menu accessible to the public?',
522a26c9 379 'table_name' => 'civicrm_menu',
380 'entity' => 'Menu',
381 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 382 'localizable' => 0,
e501603b
TO
383 ) ,
384 'is_exposed' => array(
385 'name' => 'is_exposed',
386 'type' => CRM_Utils_Type::T_BOOLEAN,
387 'title' => ts('Exposed?') ,
388 'description' => 'Is this menu exposed to the navigation system?',
522a26c9 389 'table_name' => 'civicrm_menu',
390 'entity' => 'Menu',
391 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 392 'localizable' => 0,
e501603b
TO
393 ) ,
394 'is_ssl' => array(
395 'name' => 'is_ssl',
396 'type' => CRM_Utils_Type::T_BOOLEAN,
397 'title' => ts('Use SSL?') ,
398 'description' => 'Should this menu be exposed via SSL if enabled?',
522a26c9 399 'table_name' => 'civicrm_menu',
400 'entity' => 'Menu',
401 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 402 'localizable' => 0,
e501603b
TO
403 ) ,
404 'weight' => array(
405 'name' => 'weight',
406 'type' => CRM_Utils_Type::T_INT,
407 'title' => ts('Order') ,
408 'description' => 'Ordering of the menu items in various blocks.',
409 'required' => true,
410 'default' => '1',
522a26c9 411 'table_name' => 'civicrm_menu',
412 'entity' => 'Menu',
413 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 414 'localizable' => 0,
e501603b
TO
415 ) ,
416 'type' => array(
417 'name' => 'type',
418 'type' => CRM_Utils_Type::T_INT,
419 'title' => ts('Type') ,
420 'description' => 'Drupal menu type.',
421 'required' => true,
422 'default' => '1',
522a26c9 423 'table_name' => 'civicrm_menu',
424 'entity' => 'Menu',
425 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 426 'localizable' => 0,
e501603b
TO
427 ) ,
428 'page_type' => array(
429 'name' => 'page_type',
430 'type' => CRM_Utils_Type::T_INT,
431 'title' => ts('Page Type') ,
432 'description' => 'CiviCRM menu type.',
433 'required' => true,
434 'default' => '1',
522a26c9 435 'table_name' => 'civicrm_menu',
436 'entity' => 'Menu',
437 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 438 'localizable' => 0,
e501603b
TO
439 ) ,
440 'skipBreadcrumb' => array(
441 'name' => 'skipBreadcrumb',
442 'type' => CRM_Utils_Type::T_BOOLEAN,
443 'title' => ts('Hide Breadcrumb?') ,
444 'description' => 'skip this url being exposed to breadcrumb',
522a26c9 445 'table_name' => 'civicrm_menu',
446 'entity' => 'Menu',
447 'bao' => 'CRM_Core_DAO_Menu',
6a7e5e5d 448 'localizable' => 0,
e501603b
TO
449 ) ,
450 );
346aaaba 451 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 452 }
346aaaba 453 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
454 }
455 /**
bd8e0b14 456 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
457 *
458 * @return array
bd8e0b14 459 * Array(string $name => string $uniqueName).
e501603b
TO
460 */
461 static function &fieldKeys() {
bd8e0b14
TO
462 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
463 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 464 }
bd8e0b14 465 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
466 }
467 /**
468 * Returns the names of this table
469 *
470 * @return string
471 */
472 static function getTableName() {
473 return self::$_tableName;
474 }
475 /**
476 * Returns if this table needs to be logged
477 *
478 * @return boolean
479 */
480 function getLog() {
481 return self::$_log;
482 }
483 /**
484 * Returns the list of fields that can be imported
485 *
486 * @param bool $prefix
487 *
488 * @return array
489 */
490 static function &import($prefix = false) {
60808919
TO
491 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'menu', $prefix, array());
492 return $r;
e501603b
TO
493 }
494 /**
495 * Returns the list of fields that can be exported
496 *
497 * @param bool $prefix
498 *
499 * @return array
500 */
501 static function &export($prefix = false) {
60808919
TO
502 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'menu', $prefix, array());
503 return $r;
e501603b 504 }
e7a6b91a
AS
505 /**
506 * Returns the list of indices
507 */
508 public static function indices($localize = TRUE) {
509 $indices = array(
510 'UI_path_domain_id' => array(
511 'name' => 'UI_path_domain_id',
512 'field' => array(
513 0 => 'path',
514 1 => 'domain_id',
515 ) ,
516 'localizable' => false,
517 'unique' => true,
518 'sig' => 'civicrm_menu::1::path::domain_id',
519 ) ,
520 );
521 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
522 }
e501603b 523}