| 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:58328e2bbd1fd9c5f9255596ef0de177) |
| 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|string|null |
| 42 | * (SQL type: int unsigned) |
| 43 | * Note that values will be retrieved from the database as a string. |
| 44 | */ |
| 45 | public $id; |
| 46 | |
| 47 | /** |
| 48 | * Which Domain is this navigation item for |
| 49 | * |
| 50 | * @var int|string |
| 51 | * (SQL type: int unsigned) |
| 52 | * Note that values will be retrieved from the database as a string. |
| 53 | */ |
| 54 | public $domain_id; |
| 55 | |
| 56 | /** |
| 57 | * Navigation Title |
| 58 | * |
| 59 | * @var string|null |
| 60 | * (SQL type: varchar(255)) |
| 61 | * Note that values will be retrieved from the database as a string. |
| 62 | */ |
| 63 | public $label; |
| 64 | |
| 65 | /** |
| 66 | * Internal Name |
| 67 | * |
| 68 | * @var string|null |
| 69 | * (SQL type: varchar(255)) |
| 70 | * Note that values will be retrieved from the database as a string. |
| 71 | */ |
| 72 | public $name; |
| 73 | |
| 74 | /** |
| 75 | * url in case of custom navigation link |
| 76 | * |
| 77 | * @var string|null |
| 78 | * (SQL type: varchar(255)) |
| 79 | * Note that values will be retrieved from the database as a string. |
| 80 | */ |
| 81 | public $url; |
| 82 | |
| 83 | /** |
| 84 | * CSS class name for an icon |
| 85 | * |
| 86 | * @var string |
| 87 | * (SQL type: varchar(255)) |
| 88 | * Note that values will be retrieved from the database as a string. |
| 89 | */ |
| 90 | public $icon; |
| 91 | |
| 92 | /** |
| 93 | * Permission(s) needed to access menu item |
| 94 | * |
| 95 | * @var string|null |
| 96 | * (SQL type: varchar(255)) |
| 97 | * Note that values will be retrieved from the database as a string. |
| 98 | */ |
| 99 | public $permission; |
| 100 | |
| 101 | /** |
| 102 | * Operator to use if item has more than one permission |
| 103 | * |
| 104 | * @var string|null |
| 105 | * (SQL type: varchar(3)) |
| 106 | * Note that values will be retrieved from the database as a string. |
| 107 | */ |
| 108 | public $permission_operator; |
| 109 | |
| 110 | /** |
| 111 | * Parent navigation item, used for grouping |
| 112 | * |
| 113 | * @var int|string|null |
| 114 | * (SQL type: int unsigned) |
| 115 | * Note that values will be retrieved from the database as a string. |
| 116 | */ |
| 117 | public $parent_id; |
| 118 | |
| 119 | /** |
| 120 | * Is this navigation item active? |
| 121 | * |
| 122 | * @var bool|string |
| 123 | * (SQL type: tinyint) |
| 124 | * Note that values will be retrieved from the database as a string. |
| 125 | */ |
| 126 | public $is_active; |
| 127 | |
| 128 | /** |
| 129 | * Place a separator either before or after this menu item. |
| 130 | * |
| 131 | * @var int|string|null |
| 132 | * (SQL type: tinyint) |
| 133 | * Note that values will be retrieved from the database as a string. |
| 134 | */ |
| 135 | public $has_separator; |
| 136 | |
| 137 | /** |
| 138 | * Ordering of the navigation items in various blocks. |
| 139 | * |
| 140 | * @var int|string |
| 141 | * (SQL type: int) |
| 142 | * Note that values will be retrieved from the database as a string. |
| 143 | */ |
| 144 | public $weight; |
| 145 | |
| 146 | /** |
| 147 | * Class constructor. |
| 148 | */ |
| 149 | public function __construct() { |
| 150 | $this->__table = 'civicrm_navigation'; |
| 151 | parent::__construct(); |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Returns localized title of this entity. |
| 156 | * |
| 157 | * @param bool $plural |
| 158 | * Whether to return the plural version of the title. |
| 159 | */ |
| 160 | public static function getEntityTitle($plural = FALSE) { |
| 161 | return $plural ? ts('Navigations') : ts('Navigation'); |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * Returns foreign keys and entity references. |
| 166 | * |
| 167 | * @return array |
| 168 | * [CRM_Core_Reference_Interface] |
| 169 | */ |
| 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']); |
| 176 | } |
| 177 | return Civi::$statics[__CLASS__]['links']; |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * Returns all the column names of this table |
| 182 | * |
| 183 | * @return array |
| 184 | */ |
| 185 | public static function &fields() { |
| 186 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 187 | Civi::$statics[__CLASS__]['fields'] = [ |
| 188 | 'id' => [ |
| 189 | 'name' => 'id', |
| 190 | 'type' => CRM_Utils_Type::T_INT, |
| 191 | 'title' => ts('Navigation ID'), |
| 192 | 'required' => TRUE, |
| 193 | 'where' => 'civicrm_navigation.id', |
| 194 | 'table_name' => 'civicrm_navigation', |
| 195 | 'entity' => 'Navigation', |
| 196 | 'bao' => 'CRM_Core_BAO_Navigation', |
| 197 | 'localizable' => 0, |
| 198 | 'html' => [ |
| 199 | 'type' => 'Number', |
| 200 | ], |
| 201 | 'readonly' => TRUE, |
| 202 | 'add' => '3.0', |
| 203 | ], |
| 204 | 'domain_id' => [ |
| 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'), |
| 209 | 'required' => TRUE, |
| 210 | 'where' => 'civicrm_navigation.domain_id', |
| 211 | 'table_name' => 'civicrm_navigation', |
| 212 | 'entity' => 'Navigation', |
| 213 | 'bao' => 'CRM_Core_BAO_Navigation', |
| 214 | 'localizable' => 0, |
| 215 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
| 216 | 'html' => [ |
| 217 | 'label' => ts("Domain"), |
| 218 | ], |
| 219 | 'pseudoconstant' => [ |
| 220 | 'table' => 'civicrm_domain', |
| 221 | 'keyColumn' => 'id', |
| 222 | 'labelColumn' => 'name', |
| 223 | ], |
| 224 | 'add' => '3.0', |
| 225 | ], |
| 226 | 'label' => [ |
| 227 | 'name' => 'label', |
| 228 | 'type' => CRM_Utils_Type::T_STRING, |
| 229 | 'title' => ts('Navigation Item Label'), |
| 230 | 'description' => ts('Navigation Title'), |
| 231 | 'maxlength' => 255, |
| 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', |
| 237 | 'localizable' => 0, |
| 238 | 'add' => '3.0', |
| 239 | ], |
| 240 | 'name' => [ |
| 241 | 'name' => 'name', |
| 242 | 'type' => CRM_Utils_Type::T_STRING, |
| 243 | 'title' => ts('Navigation Item Machine Name'), |
| 244 | 'description' => ts('Internal Name'), |
| 245 | 'maxlength' => 255, |
| 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', |
| 251 | 'localizable' => 0, |
| 252 | 'add' => '3.0', |
| 253 | ], |
| 254 | 'url' => [ |
| 255 | 'name' => 'url', |
| 256 | 'type' => CRM_Utils_Type::T_STRING, |
| 257 | 'title' => ts('Url'), |
| 258 | 'description' => ts('url in case of custom navigation link'), |
| 259 | 'maxlength' => 255, |
| 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', |
| 265 | 'localizable' => 0, |
| 266 | 'add' => '3.0', |
| 267 | ], |
| 268 | 'icon' => [ |
| 269 | 'name' => 'icon', |
| 270 | 'type' => CRM_Utils_Type::T_STRING, |
| 271 | 'title' => ts('Icon'), |
| 272 | 'description' => ts('CSS class name for an icon'), |
| 273 | 'required' => FALSE, |
| 274 | 'maxlength' => 255, |
| 275 | 'size' => CRM_Utils_Type::HUGE, |
| 276 | 'where' => 'civicrm_navigation.icon', |
| 277 | 'default' => NULL, |
| 278 | 'table_name' => 'civicrm_navigation', |
| 279 | 'entity' => 'Navigation', |
| 280 | 'bao' => 'CRM_Core_BAO_Navigation', |
| 281 | 'localizable' => 0, |
| 282 | 'add' => '4.7', |
| 283 | ], |
| 284 | 'permission' => [ |
| 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'), |
| 289 | 'maxlength' => 255, |
| 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', |
| 295 | 'localizable' => 0, |
| 296 | 'serialize' => self::SERIALIZE_COMMA, |
| 297 | 'add' => '3.0', |
| 298 | ], |
| 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'), |
| 304 | 'maxlength' => 3, |
| 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', |
| 310 | 'localizable' => 0, |
| 311 | 'pseudoconstant' => [ |
| 312 | 'callback' => 'CRM_Core_SelectValues::andOr', |
| 313 | ], |
| 314 | 'add' => '3.0', |
| 315 | ], |
| 316 | 'parent_id' => [ |
| 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', |
| 325 | 'localizable' => 0, |
| 326 | 'FKClassName' => 'CRM_Core_DAO_Navigation', |
| 327 | 'html' => [ |
| 328 | 'label' => ts("parent"), |
| 329 | ], |
| 330 | 'pseudoconstant' => [ |
| 331 | 'table' => 'civicrm_navigation', |
| 332 | 'keyColumn' => 'id', |
| 333 | 'labelColumn' => 'label', |
| 334 | 'nameColumn' => 'name', |
| 335 | ], |
| 336 | 'add' => '3.0', |
| 337 | ], |
| 338 | 'is_active' => [ |
| 339 | 'name' => 'is_active', |
| 340 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 341 | 'title' => ts('Is Active'), |
| 342 | 'description' => ts('Is this navigation item active?'), |
| 343 | 'required' => TRUE, |
| 344 | 'where' => 'civicrm_navigation.is_active', |
| 345 | 'default' => '1', |
| 346 | 'table_name' => 'civicrm_navigation', |
| 347 | 'entity' => 'Navigation', |
| 348 | 'bao' => 'CRM_Core_BAO_Navigation', |
| 349 | 'localizable' => 0, |
| 350 | 'add' => '3.0', |
| 351 | ], |
| 352 | 'has_separator' => [ |
| 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', |
| 358 | 'default' => '0', |
| 359 | 'table_name' => 'civicrm_navigation', |
| 360 | 'entity' => 'Navigation', |
| 361 | 'bao' => 'CRM_Core_BAO_Navigation', |
| 362 | 'localizable' => 0, |
| 363 | 'pseudoconstant' => [ |
| 364 | 'callback' => 'CRM_Core_SelectValues::navigationMenuSeparator', |
| 365 | ], |
| 366 | 'add' => '3.0', |
| 367 | ], |
| 368 | 'weight' => [ |
| 369 | 'name' => 'weight', |
| 370 | 'type' => CRM_Utils_Type::T_INT, |
| 371 | 'title' => ts('Order'), |
| 372 | 'description' => ts('Ordering of the navigation items in various blocks.'), |
| 373 | 'required' => TRUE, |
| 374 | 'where' => 'civicrm_navigation.weight', |
| 375 | 'default' => '0', |
| 376 | 'table_name' => 'civicrm_navigation', |
| 377 | 'entity' => 'Navigation', |
| 378 | 'bao' => 'CRM_Core_BAO_Navigation', |
| 379 | 'localizable' => 0, |
| 380 | 'add' => '3.0', |
| 381 | ], |
| 382 | ]; |
| 383 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 384 | } |
| 385 | return Civi::$statics[__CLASS__]['fields']; |
| 386 | } |
| 387 | |
| 388 | /** |
| 389 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 390 | * |
| 391 | * @return array |
| 392 | * Array(string $name => string $uniqueName). |
| 393 | */ |
| 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())); |
| 397 | } |
| 398 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 399 | } |
| 400 | |
| 401 | /** |
| 402 | * Returns the names of this table |
| 403 | * |
| 404 | * @return string |
| 405 | */ |
| 406 | public static function getTableName() { |
| 407 | return self::$_tableName; |
| 408 | } |
| 409 | |
| 410 | /** |
| 411 | * Returns if this table needs to be logged |
| 412 | * |
| 413 | * @return bool |
| 414 | */ |
| 415 | public function getLog() { |
| 416 | return self::$_log; |
| 417 | } |
| 418 | |
| 419 | /** |
| 420 | * Returns the list of fields that can be imported |
| 421 | * |
| 422 | * @param bool $prefix |
| 423 | * |
| 424 | * @return array |
| 425 | */ |
| 426 | public static function &import($prefix = FALSE) { |
| 427 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'navigation', $prefix, []); |
| 428 | return $r; |
| 429 | } |
| 430 | |
| 431 | /** |
| 432 | * Returns the list of fields that can be exported |
| 433 | * |
| 434 | * @param bool $prefix |
| 435 | * |
| 436 | * @return array |
| 437 | */ |
| 438 | public static function &export($prefix = FALSE) { |
| 439 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'navigation', $prefix, []); |
| 440 | return $r; |
| 441 | } |
| 442 | |
| 443 | /** |
| 444 | * Returns the list of indices |
| 445 | * |
| 446 | * @param bool $localize |
| 447 | * |
| 448 | * @return array |
| 449 | */ |
| 450 | public static function indices($localize = TRUE) { |
| 451 | $indices = []; |
| 452 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 453 | } |
| 454 | |
| 455 | } |