5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/Navigation.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:58328e2bbd1fd9c5f9255596ef0de177)
13 * Database access object for the Navigation entity.
15 class CRM_Core_DAO_Navigation
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '3.0';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_navigation';
27 * Field to show when displaying a record.
31 public static $_labelField = 'label';
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
38 public static $_log = FALSE;
41 * @var int|string|null
42 * (SQL type: int unsigned)
43 * Note that values will be retrieved from the database as a string.
48 * Which Domain is this navigation item for
51 * (SQL type: int unsigned)
52 * Note that values will be retrieved from the database as a string.
60 * (SQL type: varchar(255))
61 * Note that values will be retrieved from the database as a string.
69 * (SQL type: varchar(255))
70 * Note that values will be retrieved from the database as a string.
75 * url in case of custom navigation link
78 * (SQL type: varchar(255))
79 * Note that values will be retrieved from the database as a string.
84 * CSS class name for an icon
87 * (SQL type: varchar(255))
88 * Note that values will be retrieved from the database as a string.
93 * Permission(s) needed to access menu item
96 * (SQL type: varchar(255))
97 * Note that values will be retrieved from the database as a string.
102 * Operator to use if item has more than one permission
105 * (SQL type: varchar(3))
106 * Note that values will be retrieved from the database as a string.
108 public $permission_operator;
111 * Parent navigation item, used for grouping
113 * @var int|string|null
114 * (SQL type: int unsigned)
115 * Note that values will be retrieved from the database as a string.
120 * Is this navigation item active?
123 * (SQL type: tinyint)
124 * Note that values will be retrieved from the database as a string.
129 * Place a separator either before or after this menu item.
131 * @var int|string|null
132 * (SQL type: tinyint)
133 * Note that values will be retrieved from the database as a string.
135 public $has_separator;
138 * Ordering of the navigation items in various blocks.
142 * Note that values will be retrieved from the database as a string.
149 public function __construct() {
150 $this->__table
= 'civicrm_navigation';
151 parent
::__construct();
155 * Returns localized title of this entity.
157 * @param bool $plural
158 * Whether to return the plural version of the title.
160 public static function getEntityTitle($plural = FALSE) {
161 return $plural ?
ts('Navigations') : ts('Navigation');
165 * Returns foreign keys and entity references.
168 * [CRM_Core_Reference_Interface]
170 public static function getReferenceColumns() {
171 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
172 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
173 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
174 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'parent_id', 'civicrm_navigation', 'id');
175 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
177 return Civi
::$statics[__CLASS__
]['links'];
181 * Returns all the column names of this table
185 public static function &fields() {
186 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
187 Civi
::$statics[__CLASS__
]['fields'] = [
190 'type' => CRM_Utils_Type
::T_INT
,
191 'title' => ts('Navigation ID'),
193 'where' => 'civicrm_navigation.id',
194 'table_name' => 'civicrm_navigation',
195 'entity' => 'Navigation',
196 'bao' => 'CRM_Core_BAO_Navigation',
205 'name' => 'domain_id',
206 'type' => CRM_Utils_Type
::T_INT
,
207 'title' => ts('Domain ID'),
208 'description' => ts('Which Domain is this navigation item for'),
210 'where' => 'civicrm_navigation.domain_id',
211 'table_name' => 'civicrm_navigation',
212 'entity' => 'Navigation',
213 'bao' => 'CRM_Core_BAO_Navigation',
215 'FKClassName' => 'CRM_Core_DAO_Domain',
217 'label' => ts("Domain"),
219 'pseudoconstant' => [
220 'table' => 'civicrm_domain',
222 'labelColumn' => 'name',
228 'type' => CRM_Utils_Type
::T_STRING
,
229 'title' => ts('Navigation Item Label'),
230 'description' => ts('Navigation Title'),
232 'size' => CRM_Utils_Type
::HUGE
,
233 'where' => 'civicrm_navigation.label',
234 'table_name' => 'civicrm_navigation',
235 'entity' => 'Navigation',
236 'bao' => 'CRM_Core_BAO_Navigation',
242 'type' => CRM_Utils_Type
::T_STRING
,
243 'title' => ts('Navigation Item Machine Name'),
244 'description' => ts('Internal Name'),
246 'size' => CRM_Utils_Type
::HUGE
,
247 'where' => 'civicrm_navigation.name',
248 'table_name' => 'civicrm_navigation',
249 'entity' => 'Navigation',
250 'bao' => 'CRM_Core_BAO_Navigation',
256 'type' => CRM_Utils_Type
::T_STRING
,
257 'title' => ts('Url'),
258 'description' => ts('url in case of custom navigation link'),
260 'size' => CRM_Utils_Type
::HUGE
,
261 'where' => 'civicrm_navigation.url',
262 'table_name' => 'civicrm_navigation',
263 'entity' => 'Navigation',
264 'bao' => 'CRM_Core_BAO_Navigation',
270 'type' => CRM_Utils_Type
::T_STRING
,
271 'title' => ts('Icon'),
272 'description' => ts('CSS class name for an icon'),
275 'size' => CRM_Utils_Type
::HUGE
,
276 'where' => 'civicrm_navigation.icon',
278 'table_name' => 'civicrm_navigation',
279 'entity' => 'Navigation',
280 'bao' => 'CRM_Core_BAO_Navigation',
285 'name' => 'permission',
286 'type' => CRM_Utils_Type
::T_STRING
,
287 'title' => ts('Required Permission'),
288 'description' => ts('Permission(s) needed to access menu item'),
290 'size' => CRM_Utils_Type
::HUGE
,
291 'where' => 'civicrm_navigation.permission',
292 'table_name' => 'civicrm_navigation',
293 'entity' => 'Navigation',
294 'bao' => 'CRM_Core_BAO_Navigation',
296 'serialize' => self
::SERIALIZE_COMMA
,
299 'permission_operator' => [
300 'name' => 'permission_operator',
301 'type' => CRM_Utils_Type
::T_STRING
,
302 'title' => ts('Permission Operator'),
303 'description' => ts('Operator to use if item has more than one permission'),
305 'size' => CRM_Utils_Type
::FOUR
,
306 'where' => 'civicrm_navigation.permission_operator',
307 'table_name' => 'civicrm_navigation',
308 'entity' => 'Navigation',
309 'bao' => 'CRM_Core_BAO_Navigation',
311 'pseudoconstant' => [
312 'callback' => 'CRM_Core_SelectValues::andOr',
317 'name' => 'parent_id',
318 'type' => CRM_Utils_Type
::T_INT
,
319 'title' => ts('parent ID'),
320 'description' => ts('Parent navigation item, used for grouping'),
321 'where' => 'civicrm_navigation.parent_id',
322 'table_name' => 'civicrm_navigation',
323 'entity' => 'Navigation',
324 'bao' => 'CRM_Core_BAO_Navigation',
326 'FKClassName' => 'CRM_Core_DAO_Navigation',
328 'label' => ts("parent"),
330 'pseudoconstant' => [
331 'table' => 'civicrm_navigation',
333 'labelColumn' => 'label',
334 'nameColumn' => 'name',
339 'name' => 'is_active',
340 'type' => CRM_Utils_Type
::T_BOOLEAN
,
341 'title' => ts('Is Active'),
342 'description' => ts('Is this navigation item active?'),
344 'where' => 'civicrm_navigation.is_active',
346 'table_name' => 'civicrm_navigation',
347 'entity' => 'Navigation',
348 'bao' => 'CRM_Core_BAO_Navigation',
353 'name' => 'has_separator',
354 'type' => CRM_Utils_Type
::T_INT
,
355 'title' => ts('Separator'),
356 'description' => ts('Place a separator either before or after this menu item.'),
357 'where' => 'civicrm_navigation.has_separator',
359 'table_name' => 'civicrm_navigation',
360 'entity' => 'Navigation',
361 'bao' => 'CRM_Core_BAO_Navigation',
363 'pseudoconstant' => [
364 'callback' => 'CRM_Core_SelectValues::navigationMenuSeparator',
370 'type' => CRM_Utils_Type
::T_INT
,
371 'title' => ts('Order'),
372 'description' => ts('Ordering of the navigation items in various blocks.'),
374 'where' => 'civicrm_navigation.weight',
376 'table_name' => 'civicrm_navigation',
377 'entity' => 'Navigation',
378 'bao' => 'CRM_Core_BAO_Navigation',
383 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
385 return Civi
::$statics[__CLASS__
]['fields'];
389 * Return a mapping from field-name to the corresponding key (as used in fields()).
392 * Array(string $name => string $uniqueName).
394 public static function &fieldKeys() {
395 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
396 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
398 return Civi
::$statics[__CLASS__
]['fieldKeys'];
402 * Returns the names of this table
406 public static function getTableName() {
407 return self
::$_tableName;
411 * Returns if this table needs to be logged
415 public function getLog() {
420 * Returns the list of fields that can be imported
422 * @param bool $prefix
426 public static function &import($prefix = FALSE) {
427 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'navigation', $prefix, []);
432 * Returns the list of fields that can be exported
434 * @param bool $prefix
438 public static function &export($prefix = FALSE) {
439 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'navigation', $prefix, []);
444 * Returns the list of indices
446 * @param bool $localize
450 public static function indices($localize = TRUE) {
452 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;