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