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