Update has_separator field in civicrm_navigation
[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
e0674c37 9 * (GenCodeChecksum:8d6052b04bcd4a7bdfff07ecfa14e60b)
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 {
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 99 /**
e0674c37 100 * Place a separator either before or after this menu item.
e501603b 101 *
e0674c37 102 * @var int
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 291 'name' => 'has_separator',
e0674c37
CW
292 'type' => CRM_Utils_Type::T_INT,
293 'title' => ts('Separator'),
294 'description' => ts('Place a separator either before or after this menu item.'),
a36434b9 295 'where' => 'civicrm_navigation.has_separator',
e0674c37 296 'default' => '0',
522a26c9 297 'table_name' => 'civicrm_navigation',
298 'entity' => 'Navigation',
299 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 300 'localizable' => 0,
e0674c37
CW
301 'pseudoconstant' => [
302 'callback' => 'CRM_Core_SelectValues::navigationMenuSeparator',
303 ],
c3fc2621
CW
304 ],
305 'weight' => [
e501603b
TO
306 'name' => 'weight',
307 'type' => CRM_Utils_Type::T_INT,
c3fc2621 308 'title' => ts('Order'),
215b423e 309 'description' => ts('Ordering of the navigation items in various blocks.'),
a36434b9 310 'where' => 'civicrm_navigation.weight',
522a26c9 311 'table_name' => 'civicrm_navigation',
312 'entity' => 'Navigation',
313 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 314 'localizable' => 0,
c3fc2621
CW
315 ],
316 ];
346aaaba 317 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 318 }
346aaaba 319 return Civi::$statics[__CLASS__]['fields'];
e501603b 320 }
c3fc2621 321
e501603b 322 /**
bd8e0b14 323 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
324 *
325 * @return array
bd8e0b14 326 * Array(string $name => string $uniqueName).
e501603b 327 */
c3fc2621 328 public static function &fieldKeys() {
bd8e0b14
TO
329 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
330 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 331 }
bd8e0b14 332 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 333 }
c3fc2621 334
e501603b
TO
335 /**
336 * Returns the names of this table
337 *
338 * @return string
339 */
c3fc2621 340 public static function getTableName() {
e501603b
TO
341 return self::$_tableName;
342 }
c3fc2621 343
e501603b
TO
344 /**
345 * Returns if this table needs to be logged
346 *
c3fc2621 347 * @return bool
e501603b 348 */
c3fc2621 349 public function getLog() {
e501603b
TO
350 return self::$_log;
351 }
c3fc2621 352
e501603b
TO
353 /**
354 * Returns the list of fields that can be imported
355 *
356 * @param bool $prefix
357 *
358 * @return array
359 */
c3fc2621
CW
360 public static function &import($prefix = FALSE) {
361 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'navigation', $prefix, []);
60808919 362 return $r;
e501603b 363 }
c3fc2621 364
e501603b
TO
365 /**
366 * Returns the list of fields that can be exported
367 *
368 * @param bool $prefix
369 *
370 * @return array
371 */
c3fc2621
CW
372 public static function &export($prefix = FALSE) {
373 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'navigation', $prefix, []);
60808919 374 return $r;
e501603b 375 }
c3fc2621 376
e7a6b91a
AS
377 /**
378 * Returns the list of indices
c3fc2621
CW
379 *
380 * @param bool $localize
381 *
382 * @return array
e7a6b91a
AS
383 */
384 public static function indices($localize = TRUE) {
c3fc2621 385 $indices = [];
e7a6b91a
AS
386 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
387 }
c3fc2621 388
e501603b 389}