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 | |
2562d09a | 9 | * (GenCodeChecksum:2b9fb139d42e95f23ebc1fe7b055c546) |
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 | ], | |
1fe423d6 | 177 | 'readonly' => TRUE, |
a9d0587b | 178 | 'add' => '3.0', |
c3fc2621 CW |
179 | ], |
180 | 'domain_id' => [ | |
e501603b TO |
181 | 'name' => 'domain_id', |
182 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 183 | 'title' => ts('Domain ID'), |
215b423e | 184 | 'description' => ts('Which Domain is this navigation item for'), |
c3fc2621 | 185 | 'required' => TRUE, |
a36434b9 | 186 | 'where' => 'civicrm_navigation.domain_id', |
522a26c9 | 187 | 'table_name' => 'civicrm_navigation', |
188 | 'entity' => 'Navigation', | |
189 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 190 | 'localizable' => 0, |
e501603b | 191 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
2cbbebe8 A |
192 | 'html' => [ |
193 | 'label' => ts("Domain"), | |
194 | ], | |
c3fc2621 | 195 | 'pseudoconstant' => [ |
e501603b TO |
196 | 'table' => 'civicrm_domain', |
197 | 'keyColumn' => 'id', | |
198 | 'labelColumn' => 'name', | |
e6ca0a57 | 199 | ], |
a9d0587b | 200 | 'add' => '3.0', |
c3fc2621 CW |
201 | ], |
202 | 'label' => [ | |
e501603b TO |
203 | 'name' => 'label', |
204 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 205 | 'title' => ts('Navigation Item Label'), |
215b423e | 206 | 'description' => ts('Navigation Title'), |
e501603b TO |
207 | 'maxlength' => 255, |
208 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 209 | 'where' => 'civicrm_navigation.label', |
522a26c9 | 210 | 'table_name' => 'civicrm_navigation', |
211 | 'entity' => 'Navigation', | |
212 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 213 | 'localizable' => 0, |
a9d0587b | 214 | 'add' => '3.0', |
c3fc2621 CW |
215 | ], |
216 | 'name' => [ | |
e501603b TO |
217 | 'name' => 'name', |
218 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 219 | 'title' => ts('Navigation Item Machine Name'), |
215b423e | 220 | 'description' => ts('Internal Name'), |
e501603b TO |
221 | 'maxlength' => 255, |
222 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 223 | 'where' => 'civicrm_navigation.name', |
522a26c9 | 224 | 'table_name' => 'civicrm_navigation', |
225 | 'entity' => 'Navigation', | |
226 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 227 | 'localizable' => 0, |
a9d0587b | 228 | 'add' => '3.0', |
c3fc2621 CW |
229 | ], |
230 | 'url' => [ | |
e501603b TO |
231 | 'name' => 'url', |
232 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 233 | 'title' => ts('Url'), |
215b423e | 234 | 'description' => ts('url in case of custom navigation link'), |
e501603b TO |
235 | 'maxlength' => 255, |
236 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 237 | 'where' => 'civicrm_navigation.url', |
522a26c9 | 238 | 'table_name' => 'civicrm_navigation', |
239 | 'entity' => 'Navigation', | |
240 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 241 | 'localizable' => 0, |
a9d0587b | 242 | 'add' => '3.0', |
c3fc2621 CW |
243 | ], |
244 | 'icon' => [ | |
4926ede8 O |
245 | 'name' => 'icon', |
246 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 247 | 'title' => ts('Icon'), |
215b423e | 248 | 'description' => ts('CSS class name for an icon'), |
c3fc2621 | 249 | 'required' => FALSE, |
4926ede8 O |
250 | 'maxlength' => 255, |
251 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 252 | 'where' => 'civicrm_navigation.icon', |
4926ede8 O |
253 | 'default' => 'NULL', |
254 | 'table_name' => 'civicrm_navigation', | |
255 | 'entity' => 'Navigation', | |
256 | 'bao' => 'CRM_Core_BAO_Navigation', | |
257 | 'localizable' => 0, | |
a9d0587b | 258 | 'add' => '4.7', |
c3fc2621 CW |
259 | ], |
260 | 'permission' => [ | |
e501603b TO |
261 | 'name' => 'permission', |
262 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 263 | 'title' => ts('Required Permission'), |
215b423e | 264 | 'description' => ts('Permission for menu item'), |
e501603b TO |
265 | 'maxlength' => 255, |
266 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 267 | 'where' => 'civicrm_navigation.permission', |
522a26c9 | 268 | 'table_name' => 'civicrm_navigation', |
269 | 'entity' => 'Navigation', | |
270 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 271 | 'localizable' => 0, |
a9d0587b | 272 | 'add' => '3.0', |
c3fc2621 CW |
273 | ], |
274 | 'permission_operator' => [ | |
e501603b TO |
275 | 'name' => 'permission_operator', |
276 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 277 | 'title' => ts('Permission Operator'), |
215b423e | 278 | 'description' => ts('Permission Operator'), |
e501603b TO |
279 | 'maxlength' => 3, |
280 | 'size' => CRM_Utils_Type::FOUR, | |
a36434b9 | 281 | 'where' => 'civicrm_navigation.permission_operator', |
522a26c9 | 282 | 'table_name' => 'civicrm_navigation', |
283 | 'entity' => 'Navigation', | |
284 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 285 | 'localizable' => 0, |
a9d0587b | 286 | 'add' => '3.0', |
c3fc2621 CW |
287 | ], |
288 | 'parent_id' => [ | |
e501603b TO |
289 | 'name' => 'parent_id', |
290 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 291 | 'title' => ts('parent ID'), |
215b423e | 292 | 'description' => ts('Parent navigation item, used for grouping'), |
a36434b9 | 293 | 'where' => 'civicrm_navigation.parent_id', |
522a26c9 | 294 | 'table_name' => 'civicrm_navigation', |
295 | 'entity' => 'Navigation', | |
296 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 297 | 'localizable' => 0, |
e501603b | 298 | 'FKClassName' => 'CRM_Core_DAO_Navigation', |
2cbbebe8 A |
299 | 'html' => [ |
300 | 'label' => ts("parent"), | |
301 | ], | |
c3fc2621 | 302 | 'pseudoconstant' => [ |
e501603b | 303 | 'table' => 'civicrm_navigation', |
e2c44ec0 | 304 | 'keyColumn' => 'id', |
e501603b | 305 | 'labelColumn' => 'label', |
e2c44ec0 | 306 | 'nameColumn' => 'name', |
e6ca0a57 | 307 | ], |
a9d0587b | 308 | 'add' => '3.0', |
c3fc2621 CW |
309 | ], |
310 | 'is_active' => [ | |
e501603b TO |
311 | 'name' => 'is_active', |
312 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 313 | 'title' => ts('Is Active'), |
215b423e | 314 | 'description' => ts('Is this navigation item active?'), |
a36434b9 | 315 | 'where' => 'civicrm_navigation.is_active', |
522a26c9 | 316 | 'table_name' => 'civicrm_navigation', |
317 | 'entity' => 'Navigation', | |
318 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 319 | 'localizable' => 0, |
a9d0587b | 320 | 'add' => '3.0', |
c3fc2621 CW |
321 | ], |
322 | 'has_separator' => [ | |
e501603b | 323 | 'name' => 'has_separator', |
e0674c37 CW |
324 | 'type' => CRM_Utils_Type::T_INT, |
325 | 'title' => ts('Separator'), | |
326 | 'description' => ts('Place a separator either before or after this menu item.'), | |
a36434b9 | 327 | 'where' => 'civicrm_navigation.has_separator', |
e0674c37 | 328 | 'default' => '0', |
522a26c9 | 329 | 'table_name' => 'civicrm_navigation', |
330 | 'entity' => 'Navigation', | |
331 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 332 | 'localizable' => 0, |
e0674c37 CW |
333 | 'pseudoconstant' => [ |
334 | 'callback' => 'CRM_Core_SelectValues::navigationMenuSeparator', | |
335 | ], | |
a9d0587b | 336 | 'add' => '3.0', |
c3fc2621 CW |
337 | ], |
338 | 'weight' => [ | |
e501603b TO |
339 | 'name' => 'weight', |
340 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 341 | 'title' => ts('Order'), |
215b423e | 342 | 'description' => ts('Ordering of the navigation items in various blocks.'), |
a36434b9 | 343 | 'where' => 'civicrm_navigation.weight', |
522a26c9 | 344 | 'table_name' => 'civicrm_navigation', |
345 | 'entity' => 'Navigation', | |
346 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 347 | 'localizable' => 0, |
a9d0587b | 348 | 'add' => '3.0', |
c3fc2621 CW |
349 | ], |
350 | ]; | |
346aaaba | 351 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 352 | } |
346aaaba | 353 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 354 | } |
c3fc2621 | 355 | |
e501603b | 356 | /** |
bd8e0b14 | 357 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
358 | * |
359 | * @return array | |
bd8e0b14 | 360 | * Array(string $name => string $uniqueName). |
e501603b | 361 | */ |
c3fc2621 | 362 | public static function &fieldKeys() { |
bd8e0b14 TO |
363 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
364 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 365 | } |
bd8e0b14 | 366 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 367 | } |
c3fc2621 | 368 | |
e501603b TO |
369 | /** |
370 | * Returns the names of this table | |
371 | * | |
372 | * @return string | |
373 | */ | |
c3fc2621 | 374 | public static function getTableName() { |
e501603b TO |
375 | return self::$_tableName; |
376 | } | |
c3fc2621 | 377 | |
e501603b TO |
378 | /** |
379 | * Returns if this table needs to be logged | |
380 | * | |
c3fc2621 | 381 | * @return bool |
e501603b | 382 | */ |
c3fc2621 | 383 | public function getLog() { |
e501603b TO |
384 | return self::$_log; |
385 | } | |
c3fc2621 | 386 | |
e501603b TO |
387 | /** |
388 | * Returns the list of fields that can be imported | |
389 | * | |
390 | * @param bool $prefix | |
391 | * | |
392 | * @return array | |
393 | */ | |
c3fc2621 CW |
394 | public static function &import($prefix = FALSE) { |
395 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'navigation', $prefix, []); | |
60808919 | 396 | return $r; |
e501603b | 397 | } |
c3fc2621 | 398 | |
e501603b TO |
399 | /** |
400 | * Returns the list of fields that can be exported | |
401 | * | |
402 | * @param bool $prefix | |
403 | * | |
404 | * @return array | |
405 | */ | |
c3fc2621 CW |
406 | public static function &export($prefix = FALSE) { |
407 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'navigation', $prefix, []); | |
60808919 | 408 | return $r; |
e501603b | 409 | } |
c3fc2621 | 410 | |
e7a6b91a AS |
411 | /** |
412 | * Returns the list of indices | |
c3fc2621 CW |
413 | * |
414 | * @param bool $localize | |
415 | * | |
416 | * @return array | |
e7a6b91a AS |
417 | */ |
418 | public static function indices($localize = TRUE) { | |
c3fc2621 | 419 | $indices = []; |
e7a6b91a AS |
420 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
421 | } | |
c3fc2621 | 422 | |
e501603b | 423 | } |