Merge pull request #12056 from eileenmcnaughton/pcp
[civicrm-core.git] / CRM / Core / DAO / Navigation.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/Navigation.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
4926ede8 9 * (GenCodeChecksum:53624a8994290c1d2ae8f4158c89d3b2)
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 */
22 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 */
c3fc2621
CW
29 static $_log = FALSE;
30
e501603b 31 /**
e501603b
TO
32 * @var int unsigned
33 */
34 public $id;
c3fc2621 35
e501603b
TO
36 /**
37 * Which Domain is this navigation item for
38 *
39 * @var int unsigned
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 *
88 * @var int unsigned
89 */
90 public $parent_id;
c3fc2621 91
e501603b
TO
92 /**
93 * Is this navigation item active?
94 *
95 * @var boolean
96 */
97 public $is_active;
c3fc2621 98
e501603b
TO
99 /**
100 * If separator needs to be added after this menu item
101 *
102 * @var boolean
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
e501603b 121 /**
f41f0342 122 * Returns foreign keys and entity references.
e501603b
TO
123 *
124 * @return array
125 * [CRM_Core_Reference_Interface]
126 */
c3fc2621 127 public static function getReferenceColumns() {
346aaaba
TO
128 if (!isset(Civi::$statics[__CLASS__]['links'])) {
129 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
c3fc2621
CW
130 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
131 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_navigation', 'id');
346aaaba 132 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 133 }
346aaaba 134 return Civi::$statics[__CLASS__]['links'];
e501603b 135 }
c3fc2621 136
e501603b
TO
137 /**
138 * Returns all the column names of this table
139 *
140 * @return array
141 */
c3fc2621 142 public static function &fields() {
346aaaba 143 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
144 Civi::$statics[__CLASS__]['fields'] = [
145 'id' => [
e501603b
TO
146 'name' => 'id',
147 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
148 'title' => ts('Navigation ID'),
149 'required' => TRUE,
522a26c9 150 'table_name' => 'civicrm_navigation',
151 'entity' => 'Navigation',
152 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 153 'localizable' => 0,
c3fc2621
CW
154 ],
155 'domain_id' => [
e501603b
TO
156 'name' => 'domain_id',
157 'type' => CRM_Utils_Type::T_INT,
c3fc2621 158 'title' => ts('Navigation Domain'),
e501603b 159 'description' => 'Which Domain is this navigation item for',
c3fc2621 160 'required' => TRUE,
522a26c9 161 'table_name' => 'civicrm_navigation',
162 'entity' => 'Navigation',
163 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 164 'localizable' => 0,
e501603b 165 'FKClassName' => 'CRM_Core_DAO_Domain',
c3fc2621 166 'pseudoconstant' => [
e501603b
TO
167 'table' => 'civicrm_domain',
168 'keyColumn' => 'id',
169 'labelColumn' => 'name',
c3fc2621
CW
170 ]
171 ],
172 'label' => [
e501603b
TO
173 'name' => 'label',
174 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 175 'title' => ts('Navigation Item Label'),
e501603b
TO
176 'description' => 'Navigation Title',
177 'maxlength' => 255,
178 'size' => CRM_Utils_Type::HUGE,
522a26c9 179 'table_name' => 'civicrm_navigation',
180 'entity' => 'Navigation',
181 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 182 'localizable' => 0,
c3fc2621
CW
183 ],
184 'name' => [
e501603b
TO
185 'name' => 'name',
186 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 187 'title' => ts('Navigation Item Machine Name'),
e501603b
TO
188 'description' => 'Internal Name',
189 'maxlength' => 255,
190 'size' => CRM_Utils_Type::HUGE,
522a26c9 191 'table_name' => 'civicrm_navigation',
192 'entity' => 'Navigation',
193 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 194 'localizable' => 0,
c3fc2621
CW
195 ],
196 'url' => [
e501603b
TO
197 'name' => 'url',
198 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 199 'title' => ts('Url'),
e501603b
TO
200 'description' => 'url in case of custom navigation link',
201 'maxlength' => 255,
202 'size' => CRM_Utils_Type::HUGE,
522a26c9 203 'table_name' => 'civicrm_navigation',
204 'entity' => 'Navigation',
205 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 206 'localizable' => 0,
c3fc2621
CW
207 ],
208 'icon' => [
4926ede8
O
209 'name' => 'icon',
210 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 211 'title' => ts('Icon'),
4926ede8 212 'description' => 'CSS class name for an icon',
c3fc2621 213 'required' => FALSE,
4926ede8
O
214 'maxlength' => 255,
215 'size' => CRM_Utils_Type::HUGE,
216 'default' => 'NULL',
217 'table_name' => 'civicrm_navigation',
218 'entity' => 'Navigation',
219 'bao' => 'CRM_Core_BAO_Navigation',
220 'localizable' => 0,
c3fc2621
CW
221 ],
222 'permission' => [
e501603b
TO
223 'name' => 'permission',
224 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 225 'title' => ts('Required Permission'),
e501603b
TO
226 'description' => 'Permission for menu item',
227 'maxlength' => 255,
228 'size' => CRM_Utils_Type::HUGE,
522a26c9 229 'table_name' => 'civicrm_navigation',
230 'entity' => 'Navigation',
231 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 232 'localizable' => 0,
c3fc2621
CW
233 ],
234 'permission_operator' => [
e501603b
TO
235 'name' => 'permission_operator',
236 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 237 'title' => ts('Permission Operator'),
e501603b
TO
238 'description' => 'Permission Operator',
239 'maxlength' => 3,
240 'size' => CRM_Utils_Type::FOUR,
522a26c9 241 'table_name' => 'civicrm_navigation',
242 'entity' => 'Navigation',
243 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 244 'localizable' => 0,
c3fc2621
CW
245 ],
246 'parent_id' => [
e501603b
TO
247 'name' => 'parent_id',
248 'type' => CRM_Utils_Type::T_INT,
c3fc2621 249 'title' => ts('Navigation parent ID'),
e501603b 250 'description' => 'Parent navigation item, used for grouping',
522a26c9 251 'table_name' => 'civicrm_navigation',
252 'entity' => 'Navigation',
253 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 254 'localizable' => 0,
e501603b 255 'FKClassName' => 'CRM_Core_DAO_Navigation',
c3fc2621 256 'pseudoconstant' => [
e501603b 257 'table' => 'civicrm_navigation',
e2c44ec0 258 'keyColumn' => 'id',
e501603b 259 'labelColumn' => 'label',
e2c44ec0 260 'nameColumn' => 'name',
c3fc2621
CW
261 ]
262 ],
263 'is_active' => [
e501603b
TO
264 'name' => 'is_active',
265 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 266 'title' => ts('Is Active'),
e501603b 267 'description' => 'Is this navigation item active?',
522a26c9 268 'table_name' => 'civicrm_navigation',
269 'entity' => 'Navigation',
270 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 271 'localizable' => 0,
c3fc2621
CW
272 ],
273 'has_separator' => [
e501603b
TO
274 'name' => 'has_separator',
275 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 276 'title' => ts('Use separator'),
e501603b 277 'description' => 'If separator needs to be added after this menu item',
522a26c9 278 'table_name' => 'civicrm_navigation',
279 'entity' => 'Navigation',
280 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 281 'localizable' => 0,
c3fc2621
CW
282 ],
283 'weight' => [
e501603b
TO
284 'name' => 'weight',
285 'type' => CRM_Utils_Type::T_INT,
c3fc2621 286 'title' => ts('Order'),
e501603b 287 'description' => 'Ordering of the navigation items in various blocks.',
522a26c9 288 'table_name' => 'civicrm_navigation',
289 'entity' => 'Navigation',
290 'bao' => 'CRM_Core_BAO_Navigation',
6a7e5e5d 291 'localizable' => 0,
c3fc2621
CW
292 ],
293 ];
346aaaba 294 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 295 }
346aaaba 296 return Civi::$statics[__CLASS__]['fields'];
e501603b 297 }
c3fc2621 298
e501603b 299 /**
bd8e0b14 300 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
301 *
302 * @return array
bd8e0b14 303 * Array(string $name => string $uniqueName).
e501603b 304 */
c3fc2621 305 public static function &fieldKeys() {
bd8e0b14
TO
306 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
307 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 308 }
bd8e0b14 309 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 310 }
c3fc2621 311
e501603b
TO
312 /**
313 * Returns the names of this table
314 *
315 * @return string
316 */
c3fc2621 317 public static function getTableName() {
e501603b
TO
318 return self::$_tableName;
319 }
c3fc2621 320
e501603b
TO
321 /**
322 * Returns if this table needs to be logged
323 *
c3fc2621 324 * @return bool
e501603b 325 */
c3fc2621 326 public function getLog() {
e501603b
TO
327 return self::$_log;
328 }
c3fc2621 329
e501603b
TO
330 /**
331 * Returns the list of fields that can be imported
332 *
333 * @param bool $prefix
334 *
335 * @return array
336 */
c3fc2621
CW
337 public static function &import($prefix = FALSE) {
338 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'navigation', $prefix, []);
60808919 339 return $r;
e501603b 340 }
c3fc2621 341
e501603b
TO
342 /**
343 * Returns the list of fields that can be exported
344 *
345 * @param bool $prefix
346 *
347 * @return array
348 */
c3fc2621
CW
349 public static function &export($prefix = FALSE) {
350 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'navigation', $prefix, []);
60808919 351 return $r;
e501603b 352 }
c3fc2621 353
e7a6b91a
AS
354 /**
355 * Returns the list of indices
c3fc2621
CW
356 *
357 * @param bool $localize
358 *
359 * @return array
e7a6b91a
AS
360 */
361 public static function indices($localize = TRUE) {
c3fc2621 362 $indices = [];
e7a6b91a
AS
363 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
364 }
c3fc2621 365
e501603b 366}