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