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:a26cb263ead3cb0d9bb3f0fda7fbec3c)
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;
46 * Which Domain is this navigation item for
67 * url in case of custom navigation link
74 * CSS class name for an icon
81 * Permission(s) needed to access menu item
88 * Operator to use if item has more than one permission
92 public $permission_operator;
95 * Parent navigation item, used for grouping
102 * Is this navigation item active?
109 * Place a separator either before or after this menu item.
113 public $has_separator;
116 * Ordering of the navigation items in various blocks.
125 public function __construct() {
126 $this->__table
= 'civicrm_navigation';
127 parent
::__construct();
131 * Returns localized title of this entity.
133 * @param bool $plural
134 * Whether to return the plural version of the title.
136 public static function getEntityTitle($plural = FALSE) {
137 return $plural ?
ts('Navigations') : ts('Navigation');
141 * Returns foreign keys and entity references.
144 * [CRM_Core_Reference_Interface]
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']);
153 return Civi
::$statics[__CLASS__
]['links'];
157 * Returns all the column names of this table
161 public static function &fields() {
162 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
163 Civi
::$statics[__CLASS__
]['fields'] = [
166 'type' => CRM_Utils_Type
::T_INT
,
167 'title' => ts('Navigation ID'),
169 'where' => 'civicrm_navigation.id',
170 'table_name' => 'civicrm_navigation',
171 'entity' => 'Navigation',
172 'bao' => 'CRM_Core_BAO_Navigation',
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'),
186 'where' => 'civicrm_navigation.domain_id',
187 'table_name' => 'civicrm_navigation',
188 'entity' => 'Navigation',
189 'bao' => 'CRM_Core_BAO_Navigation',
191 'FKClassName' => 'CRM_Core_DAO_Domain',
193 'label' => ts("Domain"),
195 'pseudoconstant' => [
196 'table' => 'civicrm_domain',
198 'labelColumn' => 'name',
204 'type' => CRM_Utils_Type
::T_STRING
,
205 'title' => ts('Navigation Item Label'),
206 'description' => ts('Navigation Title'),
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',
218 'type' => CRM_Utils_Type
::T_STRING
,
219 'title' => ts('Navigation Item Machine Name'),
220 'description' => ts('Internal Name'),
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',
232 'type' => CRM_Utils_Type
::T_STRING
,
233 'title' => ts('Url'),
234 'description' => ts('url in case of custom navigation link'),
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',
246 'type' => CRM_Utils_Type
::T_STRING
,
247 'title' => ts('Icon'),
248 'description' => ts('CSS class name for an icon'),
251 'size' => CRM_Utils_Type
::HUGE
,
252 'where' => 'civicrm_navigation.icon',
254 'table_name' => 'civicrm_navigation',
255 'entity' => 'Navigation',
256 'bao' => 'CRM_Core_BAO_Navigation',
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'),
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',
272 'serialize' => self
::SERIALIZE_COMMA
,
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'),
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',
287 'pseudoconstant' => [
288 'callback' => 'CRM_Core_SelectValues::andOr',
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',
302 'FKClassName' => 'CRM_Core_DAO_Navigation',
304 'label' => ts("parent"),
306 'pseudoconstant' => [
307 'table' => 'civicrm_navigation',
309 'labelColumn' => 'label',
310 'nameColumn' => 'name',
315 'name' => 'is_active',
316 'type' => CRM_Utils_Type
::T_BOOLEAN
,
317 'title' => ts('Is Active'),
318 'description' => ts('Is this navigation item active?'),
320 'where' => 'civicrm_navigation.is_active',
322 'table_name' => 'civicrm_navigation',
323 'entity' => 'Navigation',
324 'bao' => 'CRM_Core_BAO_Navigation',
329 'name' => 'has_separator',
330 'type' => CRM_Utils_Type
::T_INT
,
331 'title' => ts('Separator'),
332 'description' => ts('Place a separator either before or after this menu item.'),
333 'where' => 'civicrm_navigation.has_separator',
335 'table_name' => 'civicrm_navigation',
336 'entity' => 'Navigation',
337 'bao' => 'CRM_Core_BAO_Navigation',
339 'pseudoconstant' => [
340 'callback' => 'CRM_Core_SelectValues::navigationMenuSeparator',
346 'type' => CRM_Utils_Type
::T_INT
,
347 'title' => ts('Order'),
348 'description' => ts('Ordering of the navigation items in various blocks.'),
350 'where' => 'civicrm_navigation.weight',
352 'table_name' => 'civicrm_navigation',
353 'entity' => 'Navigation',
354 'bao' => 'CRM_Core_BAO_Navigation',
359 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
361 return Civi
::$statics[__CLASS__
]['fields'];
365 * Return a mapping from field-name to the corresponding key (as used in fields()).
368 * Array(string $name => string $uniqueName).
370 public static function &fieldKeys() {
371 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
372 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
374 return Civi
::$statics[__CLASS__
]['fieldKeys'];
378 * Returns the names of this table
382 public static function getTableName() {
383 return self
::$_tableName;
387 * Returns if this table needs to be logged
391 public function getLog() {
396 * Returns the list of fields that can be imported
398 * @param bool $prefix
402 public static function &import($prefix = FALSE) {
403 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'navigation', $prefix, []);
408 * Returns the list of fields that can be exported
410 * @param bool $prefix
414 public static function &export($prefix = FALSE) {
415 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'navigation', $prefix, []);
420 * Returns the list of indices
422 * @param bool $localize
426 public static function indices($localize = TRUE) {
428 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;