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