Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/Navigation.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
2cbbebe8 | 9 | * (GenCodeChecksum:0368c5b759a02711050f5e940f64ca16) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Navigation entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_Navigation extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '3.0'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_navigation'; |
c3fc2621 | 25 | |
8ab43c93 CW |
26 | /** |
27 | * Field to show when displaying a record. | |
28 | * | |
29 | * @var string | |
30 | */ | |
31 | public static $_labelField = 'label'; | |
32 | ||
e501603b | 33 | /** |
f41f0342 | 34 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 35 | * |
c3fc2621 | 36 | * @var bool |
e501603b | 37 | */ |
fa45b5b9 | 38 | public static $_log = FALSE; |
c3fc2621 | 39 | |
e501603b | 40 | /** |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Which Domain is this navigation item for | |
47 | * | |
e6ca0a57 | 48 | * @var int |
e501603b TO |
49 | */ |
50 | public $domain_id; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Navigation Title | |
54 | * | |
55 | * @var string | |
56 | */ | |
57 | public $label; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Internal Name | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $name; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * url in case of custom navigation link | |
68 | * | |
69 | * @var string | |
70 | */ | |
71 | public $url; | |
c3fc2621 | 72 | |
4926ede8 O |
73 | /** |
74 | * CSS class name for an icon | |
75 | * | |
76 | * @var string | |
77 | */ | |
78 | public $icon; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * Permission for menu item | |
82 | * | |
83 | * @var string | |
84 | */ | |
85 | public $permission; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * Permission Operator | |
89 | * | |
90 | * @var string | |
91 | */ | |
92 | public $permission_operator; | |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * Parent navigation item, used for grouping | |
96 | * | |
e6ca0a57 | 97 | * @var int |
e501603b TO |
98 | */ |
99 | public $parent_id; | |
c3fc2621 | 100 | |
e501603b TO |
101 | /** |
102 | * Is this navigation item active? | |
103 | * | |
e6ca0a57 | 104 | * @var bool |
e501603b TO |
105 | */ |
106 | public $is_active; | |
c3fc2621 | 107 | |
e501603b | 108 | /** |
e0674c37 | 109 | * Place a separator either before or after this menu item. |
e501603b | 110 | * |
e0674c37 | 111 | * @var int |
e501603b TO |
112 | */ |
113 | public $has_separator; | |
c3fc2621 | 114 | |
e501603b TO |
115 | /** |
116 | * Ordering of the navigation items in various blocks. | |
117 | * | |
118 | * @var int | |
119 | */ | |
120 | public $weight; | |
c3fc2621 | 121 | |
e501603b | 122 | /** |
f41f0342 | 123 | * Class constructor. |
e501603b | 124 | */ |
c3fc2621 | 125 | public function __construct() { |
e501603b TO |
126 | $this->__table = 'civicrm_navigation'; |
127 | parent::__construct(); | |
128 | } | |
c3fc2621 | 129 | |
449c4e6b CW |
130 | /** |
131 | * Returns localized title of this entity. | |
7b66c3b5 AH |
132 | * |
133 | * @param bool $plural | |
134 | * Whether to return the plural version of the title. | |
449c4e6b | 135 | */ |
7b66c3b5 AH |
136 | public static function getEntityTitle($plural = FALSE) { |
137 | return $plural ? ts('Navigations') : ts('Navigation'); | |
449c4e6b CW |
138 | } |
139 | ||
e501603b | 140 | /** |
f41f0342 | 141 | * Returns foreign keys and entity references. |
e501603b TO |
142 | * |
143 | * @return array | |
144 | * [CRM_Core_Reference_Interface] | |
145 | */ | |
c3fc2621 | 146 | public static function getReferenceColumns() { |
346aaaba | 147 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 148 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
149 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); |
150 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_navigation', 'id'); | |
346aaaba | 151 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 152 | } |
346aaaba | 153 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 154 | } |
c3fc2621 | 155 | |
e501603b TO |
156 | /** |
157 | * Returns all the column names of this table | |
158 | * | |
159 | * @return array | |
160 | */ | |
c3fc2621 | 161 | public static function &fields() { |
346aaaba | 162 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
163 | Civi::$statics[__CLASS__]['fields'] = [ |
164 | 'id' => [ | |
e501603b TO |
165 | 'name' => 'id', |
166 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
167 | 'title' => ts('Navigation ID'), |
168 | 'required' => TRUE, | |
a36434b9 | 169 | 'where' => 'civicrm_navigation.id', |
522a26c9 | 170 | 'table_name' => 'civicrm_navigation', |
171 | 'entity' => 'Navigation', | |
172 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 173 | 'localizable' => 0, |
2cbbebe8 A |
174 | 'html' => [ |
175 | 'type' => 'Number', | |
176 | ], | |
a9d0587b | 177 | 'add' => '3.0', |
c3fc2621 CW |
178 | ], |
179 | 'domain_id' => [ | |
e501603b TO |
180 | 'name' => 'domain_id', |
181 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 182 | 'title' => ts('Domain ID'), |
215b423e | 183 | 'description' => ts('Which Domain is this navigation item for'), |
c3fc2621 | 184 | 'required' => TRUE, |
a36434b9 | 185 | 'where' => 'civicrm_navigation.domain_id', |
522a26c9 | 186 | 'table_name' => 'civicrm_navigation', |
187 | 'entity' => 'Navigation', | |
188 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 189 | 'localizable' => 0, |
e501603b | 190 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
2cbbebe8 A |
191 | 'html' => [ |
192 | 'label' => ts("Domain"), | |
193 | ], | |
c3fc2621 | 194 | 'pseudoconstant' => [ |
e501603b TO |
195 | 'table' => 'civicrm_domain', |
196 | 'keyColumn' => 'id', | |
197 | 'labelColumn' => 'name', | |
e6ca0a57 | 198 | ], |
a9d0587b | 199 | 'add' => '3.0', |
c3fc2621 CW |
200 | ], |
201 | 'label' => [ | |
e501603b TO |
202 | 'name' => 'label', |
203 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 204 | 'title' => ts('Navigation Item Label'), |
215b423e | 205 | 'description' => ts('Navigation Title'), |
e501603b TO |
206 | 'maxlength' => 255, |
207 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 208 | 'where' => 'civicrm_navigation.label', |
522a26c9 | 209 | 'table_name' => 'civicrm_navigation', |
210 | 'entity' => 'Navigation', | |
211 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 212 | 'localizable' => 0, |
a9d0587b | 213 | 'add' => '3.0', |
c3fc2621 CW |
214 | ], |
215 | 'name' => [ | |
e501603b TO |
216 | 'name' => 'name', |
217 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 218 | 'title' => ts('Navigation Item Machine Name'), |
215b423e | 219 | 'description' => ts('Internal Name'), |
e501603b TO |
220 | 'maxlength' => 255, |
221 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 222 | 'where' => 'civicrm_navigation.name', |
522a26c9 | 223 | 'table_name' => 'civicrm_navigation', |
224 | 'entity' => 'Navigation', | |
225 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 226 | 'localizable' => 0, |
a9d0587b | 227 | 'add' => '3.0', |
c3fc2621 CW |
228 | ], |
229 | 'url' => [ | |
e501603b TO |
230 | 'name' => 'url', |
231 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 232 | 'title' => ts('Url'), |
215b423e | 233 | 'description' => ts('url in case of custom navigation link'), |
e501603b TO |
234 | 'maxlength' => 255, |
235 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 236 | 'where' => 'civicrm_navigation.url', |
522a26c9 | 237 | 'table_name' => 'civicrm_navigation', |
238 | 'entity' => 'Navigation', | |
239 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 240 | 'localizable' => 0, |
a9d0587b | 241 | 'add' => '3.0', |
c3fc2621 CW |
242 | ], |
243 | 'icon' => [ | |
4926ede8 O |
244 | 'name' => 'icon', |
245 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 246 | 'title' => ts('Icon'), |
215b423e | 247 | 'description' => ts('CSS class name for an icon'), |
c3fc2621 | 248 | 'required' => FALSE, |
4926ede8 O |
249 | 'maxlength' => 255, |
250 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 251 | 'where' => 'civicrm_navigation.icon', |
4926ede8 O |
252 | 'default' => 'NULL', |
253 | 'table_name' => 'civicrm_navigation', | |
254 | 'entity' => 'Navigation', | |
255 | 'bao' => 'CRM_Core_BAO_Navigation', | |
256 | 'localizable' => 0, | |
a9d0587b | 257 | 'add' => '4.7', |
c3fc2621 CW |
258 | ], |
259 | 'permission' => [ | |
e501603b TO |
260 | 'name' => 'permission', |
261 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 262 | 'title' => ts('Required Permission'), |
215b423e | 263 | 'description' => ts('Permission for menu item'), |
e501603b TO |
264 | 'maxlength' => 255, |
265 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 266 | 'where' => 'civicrm_navigation.permission', |
522a26c9 | 267 | 'table_name' => 'civicrm_navigation', |
268 | 'entity' => 'Navigation', | |
269 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 270 | 'localizable' => 0, |
a9d0587b | 271 | 'add' => '3.0', |
c3fc2621 CW |
272 | ], |
273 | 'permission_operator' => [ | |
e501603b TO |
274 | 'name' => 'permission_operator', |
275 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 276 | 'title' => ts('Permission Operator'), |
215b423e | 277 | 'description' => ts('Permission Operator'), |
e501603b TO |
278 | 'maxlength' => 3, |
279 | 'size' => CRM_Utils_Type::FOUR, | |
a36434b9 | 280 | 'where' => 'civicrm_navigation.permission_operator', |
522a26c9 | 281 | 'table_name' => 'civicrm_navigation', |
282 | 'entity' => 'Navigation', | |
283 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 284 | 'localizable' => 0, |
a9d0587b | 285 | 'add' => '3.0', |
c3fc2621 CW |
286 | ], |
287 | 'parent_id' => [ | |
e501603b TO |
288 | 'name' => 'parent_id', |
289 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 290 | 'title' => ts('parent ID'), |
215b423e | 291 | 'description' => ts('Parent navigation item, used for grouping'), |
a36434b9 | 292 | 'where' => 'civicrm_navigation.parent_id', |
522a26c9 | 293 | 'table_name' => 'civicrm_navigation', |
294 | 'entity' => 'Navigation', | |
295 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 296 | 'localizable' => 0, |
e501603b | 297 | 'FKClassName' => 'CRM_Core_DAO_Navigation', |
2cbbebe8 A |
298 | 'html' => [ |
299 | 'label' => ts("parent"), | |
300 | ], | |
c3fc2621 | 301 | 'pseudoconstant' => [ |
e501603b | 302 | 'table' => 'civicrm_navigation', |
e2c44ec0 | 303 | 'keyColumn' => 'id', |
e501603b | 304 | 'labelColumn' => 'label', |
e2c44ec0 | 305 | 'nameColumn' => 'name', |
e6ca0a57 | 306 | ], |
a9d0587b | 307 | 'add' => '3.0', |
c3fc2621 CW |
308 | ], |
309 | 'is_active' => [ | |
e501603b TO |
310 | 'name' => 'is_active', |
311 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 312 | 'title' => ts('Is Active'), |
215b423e | 313 | 'description' => ts('Is this navigation item active?'), |
a36434b9 | 314 | 'where' => 'civicrm_navigation.is_active', |
522a26c9 | 315 | 'table_name' => 'civicrm_navigation', |
316 | 'entity' => 'Navigation', | |
317 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 318 | 'localizable' => 0, |
a9d0587b | 319 | 'add' => '3.0', |
c3fc2621 CW |
320 | ], |
321 | 'has_separator' => [ | |
e501603b | 322 | 'name' => 'has_separator', |
e0674c37 CW |
323 | 'type' => CRM_Utils_Type::T_INT, |
324 | 'title' => ts('Separator'), | |
325 | 'description' => ts('Place a separator either before or after this menu item.'), | |
a36434b9 | 326 | 'where' => 'civicrm_navigation.has_separator', |
e0674c37 | 327 | 'default' => '0', |
522a26c9 | 328 | 'table_name' => 'civicrm_navigation', |
329 | 'entity' => 'Navigation', | |
330 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 331 | 'localizable' => 0, |
e0674c37 CW |
332 | 'pseudoconstant' => [ |
333 | 'callback' => 'CRM_Core_SelectValues::navigationMenuSeparator', | |
334 | ], | |
a9d0587b | 335 | 'add' => '3.0', |
c3fc2621 CW |
336 | ], |
337 | 'weight' => [ | |
e501603b TO |
338 | 'name' => 'weight', |
339 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 340 | 'title' => ts('Order'), |
215b423e | 341 | 'description' => ts('Ordering of the navigation items in various blocks.'), |
a36434b9 | 342 | 'where' => 'civicrm_navigation.weight', |
522a26c9 | 343 | 'table_name' => 'civicrm_navigation', |
344 | 'entity' => 'Navigation', | |
345 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 346 | 'localizable' => 0, |
a9d0587b | 347 | 'add' => '3.0', |
c3fc2621 CW |
348 | ], |
349 | ]; | |
346aaaba | 350 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 351 | } |
346aaaba | 352 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 353 | } |
c3fc2621 | 354 | |
e501603b | 355 | /** |
bd8e0b14 | 356 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
357 | * |
358 | * @return array | |
bd8e0b14 | 359 | * Array(string $name => string $uniqueName). |
e501603b | 360 | */ |
c3fc2621 | 361 | public static function &fieldKeys() { |
bd8e0b14 TO |
362 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
363 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 364 | } |
bd8e0b14 | 365 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 366 | } |
c3fc2621 | 367 | |
e501603b TO |
368 | /** |
369 | * Returns the names of this table | |
370 | * | |
371 | * @return string | |
372 | */ | |
c3fc2621 | 373 | public static function getTableName() { |
e501603b TO |
374 | return self::$_tableName; |
375 | } | |
c3fc2621 | 376 | |
e501603b TO |
377 | /** |
378 | * Returns if this table needs to be logged | |
379 | * | |
c3fc2621 | 380 | * @return bool |
e501603b | 381 | */ |
c3fc2621 | 382 | public function getLog() { |
e501603b TO |
383 | return self::$_log; |
384 | } | |
c3fc2621 | 385 | |
e501603b TO |
386 | /** |
387 | * Returns the list of fields that can be imported | |
388 | * | |
389 | * @param bool $prefix | |
390 | * | |
391 | * @return array | |
392 | */ | |
c3fc2621 CW |
393 | public static function &import($prefix = FALSE) { |
394 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'navigation', $prefix, []); | |
60808919 | 395 | return $r; |
e501603b | 396 | } |
c3fc2621 | 397 | |
e501603b TO |
398 | /** |
399 | * Returns the list of fields that can be exported | |
400 | * | |
401 | * @param bool $prefix | |
402 | * | |
403 | * @return array | |
404 | */ | |
c3fc2621 CW |
405 | public static function &export($prefix = FALSE) { |
406 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'navigation', $prefix, []); | |
60808919 | 407 | return $r; |
e501603b | 408 | } |
c3fc2621 | 409 | |
e7a6b91a AS |
410 | /** |
411 | * Returns the list of indices | |
c3fc2621 CW |
412 | * |
413 | * @param bool $localize | |
414 | * | |
415 | * @return array | |
e7a6b91a AS |
416 | */ |
417 | public static function indices($localize = TRUE) { | |
c3fc2621 | 418 | $indices = []; |
e7a6b91a AS |
419 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
420 | } | |
c3fc2621 | 421 | |
e501603b | 422 | } |