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