Merge pull request #19159 from colemanw/api4DynamicJoinFix
[civicrm-core.git] / CRM / Core / DAO / Navigation.php
CommitLineData
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
d31fb4e3 9 * (GenCodeChecksum:ca49dd9232dd72c6e1236488837a30cb)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Navigation entity.
f41f0342 14 */
e501603b 15class 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.
7b66c3b5
AH
125 *
126 * @param bool $plural
127 * Whether to return the plural version of the title.
449c4e6b 128 */
7b66c3b5
AH
129 public static function getEntityTitle($plural = FALSE) {
130 return $plural ? ts('Navigations') : ts('Navigation');
449c4e6b
CW
131 }
132
e501603b 133 /**
f41f0342 134 * Returns foreign keys and entity references.
e501603b
TO
135 *
136 * @return array
137 * [CRM_Core_Reference_Interface]
138 */
c3fc2621 139 public static function getReferenceColumns() {
346aaaba 140 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 141 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
142 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
143 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_navigation', 'id');
346aaaba 144 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 145 }
346aaaba 146 return Civi::$statics[__CLASS__]['links'];
e501603b 147 }
c3fc2621 148
e501603b
TO
149 /**
150 * Returns all the column names of this table
151 *
152 * @return array
153 */
c3fc2621 154 public static function &fields() {
346aaaba 155 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
156 Civi::$statics[__CLASS__]['fields'] = [
157 'id' => [
e501603b
TO
158 'name' => 'id',
159 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
160 'title' => ts('Navigation ID'),
161 'required' => TRUE,
a36434b9 162 'where' => 'civicrm_navigation.id',
522a26c9 163 'table_name' => 'civicrm_navigation',
164 'entity' => 'Navigation',
165 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 166 'localizable' => 0,
a9d0587b 167 'add' => '3.0',
c3fc2621
CW
168 ],
169 'domain_id' => [
e501603b
TO
170 'name' => 'domain_id',
171 'type' => CRM_Utils_Type::T_INT,
c3fc2621 172 'title' => ts('Navigation Domain'),
215b423e 173 'description' => ts('Which Domain is this navigation item for'),
c3fc2621 174 'required' => TRUE,
a36434b9 175 'where' => 'civicrm_navigation.domain_id',
522a26c9 176 'table_name' => 'civicrm_navigation',
177 'entity' => 'Navigation',
178 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 179 'localizable' => 0,
e501603b 180 'FKClassName' => 'CRM_Core_DAO_Domain',
c3fc2621 181 'pseudoconstant' => [
e501603b
TO
182 'table' => 'civicrm_domain',
183 'keyColumn' => 'id',
184 'labelColumn' => 'name',
e6ca0a57 185 ],
a9d0587b 186 'add' => '3.0',
c3fc2621
CW
187 ],
188 'label' => [
e501603b
TO
189 'name' => 'label',
190 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 191 'title' => ts('Navigation Item Label'),
215b423e 192 'description' => ts('Navigation Title'),
e501603b
TO
193 'maxlength' => 255,
194 'size' => CRM_Utils_Type::HUGE,
a36434b9 195 'where' => 'civicrm_navigation.label',
522a26c9 196 'table_name' => 'civicrm_navigation',
197 'entity' => 'Navigation',
198 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 199 'localizable' => 0,
a9d0587b 200 'add' => '3.0',
c3fc2621
CW
201 ],
202 'name' => [
e501603b
TO
203 'name' => 'name',
204 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 205 'title' => ts('Navigation Item Machine Name'),
215b423e 206 'description' => ts('Internal Name'),
e501603b
TO
207 'maxlength' => 255,
208 'size' => CRM_Utils_Type::HUGE,
a36434b9 209 'where' => 'civicrm_navigation.name',
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 'url' => [
e501603b
TO
217 'name' => 'url',
218 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 219 'title' => ts('Url'),
215b423e 220 'description' => ts('url in case of custom navigation link'),
e501603b
TO
221 'maxlength' => 255,
222 'size' => CRM_Utils_Type::HUGE,
a36434b9 223 'where' => 'civicrm_navigation.url',
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 'icon' => [
4926ede8
O
231 'name' => 'icon',
232 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 233 'title' => ts('Icon'),
215b423e 234 'description' => ts('CSS class name for an icon'),
c3fc2621 235 'required' => FALSE,
4926ede8
O
236 'maxlength' => 255,
237 'size' => CRM_Utils_Type::HUGE,
a36434b9 238 'where' => 'civicrm_navigation.icon',
4926ede8
O
239 'default' => 'NULL',
240 'table_name' => 'civicrm_navigation',
241 'entity' => 'Navigation',
242 'bao' => 'CRM_Core_BAO_Navigation',
243 'localizable' => 0,
a9d0587b 244 'add' => '4.7',
c3fc2621
CW
245 ],
246 'permission' => [
e501603b
TO
247 'name' => 'permission',
248 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 249 'title' => ts('Required Permission'),
215b423e 250 'description' => ts('Permission for menu item'),
e501603b
TO
251 'maxlength' => 255,
252 'size' => CRM_Utils_Type::HUGE,
a36434b9 253 'where' => 'civicrm_navigation.permission',
522a26c9 254 'table_name' => 'civicrm_navigation',
255 'entity' => 'Navigation',
256 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 257 'localizable' => 0,
a9d0587b 258 'add' => '3.0',
c3fc2621
CW
259 ],
260 'permission_operator' => [
e501603b
TO
261 'name' => 'permission_operator',
262 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 263 'title' => ts('Permission Operator'),
215b423e 264 'description' => ts('Permission Operator'),
e501603b
TO
265 'maxlength' => 3,
266 'size' => CRM_Utils_Type::FOUR,
a36434b9 267 'where' => 'civicrm_navigation.permission_operator',
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 'parent_id' => [
e501603b
TO
275 'name' => 'parent_id',
276 'type' => CRM_Utils_Type::T_INT,
c3fc2621 277 'title' => ts('Navigation parent ID'),
215b423e 278 'description' => ts('Parent navigation item, used for grouping'),
a36434b9 279 'where' => 'civicrm_navigation.parent_id',
522a26c9 280 'table_name' => 'civicrm_navigation',
281 'entity' => 'Navigation',
282 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 283 'localizable' => 0,
e501603b 284 'FKClassName' => 'CRM_Core_DAO_Navigation',
c3fc2621 285 'pseudoconstant' => [
e501603b 286 'table' => 'civicrm_navigation',
e2c44ec0 287 'keyColumn' => 'id',
e501603b 288 'labelColumn' => 'label',
e2c44ec0 289 'nameColumn' => 'name',
e6ca0a57 290 ],
a9d0587b 291 'add' => '3.0',
c3fc2621
CW
292 ],
293 'is_active' => [
e501603b
TO
294 'name' => 'is_active',
295 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 296 'title' => ts('Is Active'),
215b423e 297 'description' => ts('Is this navigation item active?'),
a36434b9 298 'where' => 'civicrm_navigation.is_active',
522a26c9 299 'table_name' => 'civicrm_navigation',
300 'entity' => 'Navigation',
301 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 302 'localizable' => 0,
a9d0587b 303 'add' => '3.0',
c3fc2621
CW
304 ],
305 'has_separator' => [
e501603b 306 'name' => 'has_separator',
e0674c37
CW
307 'type' => CRM_Utils_Type::T_INT,
308 'title' => ts('Separator'),
309 'description' => ts('Place a separator either before or after this menu item.'),
a36434b9 310 'where' => 'civicrm_navigation.has_separator',
e0674c37 311 'default' => '0',
522a26c9 312 'table_name' => 'civicrm_navigation',
313 'entity' => 'Navigation',
314 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 315 'localizable' => 0,
e0674c37
CW
316 'pseudoconstant' => [
317 'callback' => 'CRM_Core_SelectValues::navigationMenuSeparator',
318 ],
a9d0587b 319 'add' => '3.0',
c3fc2621
CW
320 ],
321 'weight' => [
e501603b
TO
322 'name' => 'weight',
323 'type' => CRM_Utils_Type::T_INT,
c3fc2621 324 'title' => ts('Order'),
215b423e 325 'description' => ts('Ordering of the navigation items in various blocks.'),
a36434b9 326 'where' => 'civicrm_navigation.weight',
522a26c9 327 'table_name' => 'civicrm_navigation',
328 'entity' => 'Navigation',
329 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 330 'localizable' => 0,
a9d0587b 331 'add' => '3.0',
c3fc2621
CW
332 ],
333 ];
346aaaba 334 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 335 }
346aaaba 336 return Civi::$statics[__CLASS__]['fields'];
e501603b 337 }
c3fc2621 338
e501603b 339 /**
bd8e0b14 340 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
341 *
342 * @return array
bd8e0b14 343 * Array(string $name => string $uniqueName).
e501603b 344 */
c3fc2621 345 public static function &fieldKeys() {
bd8e0b14
TO
346 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
347 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 348 }
bd8e0b14 349 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 350 }
c3fc2621 351
e501603b
TO
352 /**
353 * Returns the names of this table
354 *
355 * @return string
356 */
c3fc2621 357 public static function getTableName() {
e501603b
TO
358 return self::$_tableName;
359 }
c3fc2621 360
e501603b
TO
361 /**
362 * Returns if this table needs to be logged
363 *
c3fc2621 364 * @return bool
e501603b 365 */
c3fc2621 366 public function getLog() {
e501603b
TO
367 return self::$_log;
368 }
c3fc2621 369
e501603b
TO
370 /**
371 * Returns the list of fields that can be imported
372 *
373 * @param bool $prefix
374 *
375 * @return array
376 */
c3fc2621
CW
377 public static function &import($prefix = FALSE) {
378 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'navigation', $prefix, []);
60808919 379 return $r;
e501603b 380 }
c3fc2621 381
e501603b
TO
382 /**
383 * Returns the list of fields that can be exported
384 *
385 * @param bool $prefix
386 *
387 * @return array
388 */
c3fc2621
CW
389 public static function &export($prefix = FALSE) {
390 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'navigation', $prefix, []);
60808919 391 return $r;
e501603b 392 }
c3fc2621 393
e7a6b91a
AS
394 /**
395 * Returns the list of indices
c3fc2621
CW
396 *
397 * @param bool $localize
398 *
399 * @return array
e7a6b91a
AS
400 */
401 public static function indices($localize = TRUE) {
c3fc2621 402 $indices = [];
e7a6b91a
AS
403 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
404 }
c3fc2621 405
e501603b 406}