CRM-20312 add field localisation data to DAO.
[civicrm-core.git] / CRM / Core / DAO / Navigation.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Core/Navigation.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
022785d8 33 * (GenCodeChecksum:50047b21bb89d424e7852ea198e521fc)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_Navigation constructor.
39 */
e501603b
TO
40class CRM_Core_DAO_Navigation extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_navigation';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 *
55 * @var int unsigned
56 */
57 public $id;
58 /**
59 * Which Domain is this navigation item for
60 *
61 * @var int unsigned
62 */
63 public $domain_id;
64 /**
65 * Navigation Title
66 *
67 * @var string
68 */
69 public $label;
70 /**
71 * Internal Name
72 *
73 * @var string
74 */
75 public $name;
76 /**
77 * url in case of custom navigation link
78 *
79 * @var string
80 */
81 public $url;
82 /**
83 * Permission for menu item
84 *
85 * @var string
86 */
87 public $permission;
88 /**
89 * Permission Operator
90 *
91 * @var string
92 */
93 public $permission_operator;
94 /**
95 * Parent navigation item, used for grouping
96 *
97 * @var int unsigned
98 */
99 public $parent_id;
100 /**
101 * Is this navigation item active?
102 *
103 * @var boolean
104 */
105 public $is_active;
106 /**
107 * If separator needs to be added after this menu item
108 *
109 * @var boolean
110 */
111 public $has_separator;
112 /**
113 * Ordering of the navigation items in various blocks.
114 *
115 * @var int
116 */
117 public $weight;
118 /**
f41f0342 119 * Class constructor.
e501603b
TO
120 */
121 function __construct() {
122 $this->__table = 'civicrm_navigation';
123 parent::__construct();
124 }
125 /**
f41f0342 126 * Returns foreign keys and entity references.
e501603b
TO
127 *
128 * @return array
129 * [CRM_Core_Reference_Interface]
130 */
131 static function getReferenceColumns() {
346aaaba
TO
132 if (!isset(Civi::$statics[__CLASS__]['links'])) {
133 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
134 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
135 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_navigation', 'id');
136 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 137 }
346aaaba 138 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
139 }
140 /**
141 * Returns all the column names of this table
142 *
143 * @return array
144 */
145 static function &fields() {
346aaaba
TO
146 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
147 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
148 'id' => array(
149 'name' => 'id',
150 'type' => CRM_Utils_Type::T_INT,
151 'title' => ts('Navigation ID') ,
152 'required' => true,
522a26c9 153 'table_name' => 'civicrm_navigation',
154 'entity' => 'Navigation',
155 'bao' => 'CRM_Core_BAO_Navigation',
e501603b
TO
156 ) ,
157 'domain_id' => array(
158 'name' => 'domain_id',
159 'type' => CRM_Utils_Type::T_INT,
160 'title' => ts('Navigation Domain') ,
161 'description' => 'Which Domain is this navigation item for',
162 'required' => true,
522a26c9 163 'table_name' => 'civicrm_navigation',
164 'entity' => 'Navigation',
165 'bao' => 'CRM_Core_BAO_Navigation',
e501603b
TO
166 'FKClassName' => 'CRM_Core_DAO_Domain',
167 'pseudoconstant' => array(
168 'table' => 'civicrm_domain',
169 'keyColumn' => 'id',
170 'labelColumn' => 'name',
171 )
172 ) ,
173 'label' => array(
174 'name' => 'label',
175 'type' => CRM_Utils_Type::T_STRING,
176 'title' => ts('Navigation Item Label') ,
177 'description' => 'Navigation Title',
178 'maxlength' => 255,
179 'size' => CRM_Utils_Type::HUGE,
522a26c9 180 'table_name' => 'civicrm_navigation',
181 'entity' => 'Navigation',
182 'bao' => 'CRM_Core_BAO_Navigation',
e501603b
TO
183 ) ,
184 'name' => array(
185 'name' => 'name',
186 'type' => CRM_Utils_Type::T_STRING,
187 'title' => ts('Navigation Item Machine Name') ,
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',
e501603b
TO
194 ) ,
195 'url' => array(
196 'name' => 'url',
197 'type' => CRM_Utils_Type::T_STRING,
198 'title' => ts('Url') ,
199 'description' => 'url in case of custom navigation link',
200 'maxlength' => 255,
201 'size' => CRM_Utils_Type::HUGE,
522a26c9 202 'table_name' => 'civicrm_navigation',
203 'entity' => 'Navigation',
204 'bao' => 'CRM_Core_BAO_Navigation',
e501603b
TO
205 ) ,
206 'permission' => array(
207 'name' => 'permission',
208 'type' => CRM_Utils_Type::T_STRING,
209 'title' => ts('Required Permission') ,
210 'description' => 'Permission for menu item',
211 'maxlength' => 255,
212 'size' => CRM_Utils_Type::HUGE,
522a26c9 213 'table_name' => 'civicrm_navigation',
214 'entity' => 'Navigation',
215 'bao' => 'CRM_Core_BAO_Navigation',
e501603b
TO
216 ) ,
217 'permission_operator' => array(
218 'name' => 'permission_operator',
219 'type' => CRM_Utils_Type::T_STRING,
220 'title' => ts('Permission Operator') ,
221 'description' => 'Permission Operator',
222 'maxlength' => 3,
223 'size' => CRM_Utils_Type::FOUR,
522a26c9 224 'table_name' => 'civicrm_navigation',
225 'entity' => 'Navigation',
226 'bao' => 'CRM_Core_BAO_Navigation',
e501603b
TO
227 ) ,
228 'parent_id' => array(
229 'name' => 'parent_id',
230 'type' => CRM_Utils_Type::T_INT,
231 'title' => ts('Navigation parent ID') ,
232 'description' => 'Parent navigation item, used for grouping',
522a26c9 233 'table_name' => 'civicrm_navigation',
234 'entity' => 'Navigation',
235 'bao' => 'CRM_Core_BAO_Navigation',
e501603b
TO
236 'FKClassName' => 'CRM_Core_DAO_Navigation',
237 'pseudoconstant' => array(
238 'table' => 'civicrm_navigation',
e2c44ec0 239 'keyColumn' => 'id',
e501603b 240 'labelColumn' => 'label',
e2c44ec0 241 'nameColumn' => 'name',
e501603b
TO
242 )
243 ) ,
244 'is_active' => array(
245 'name' => 'is_active',
246 'type' => CRM_Utils_Type::T_BOOLEAN,
247 'title' => ts('Is Active') ,
248 'description' => 'Is this navigation item active?',
522a26c9 249 'table_name' => 'civicrm_navigation',
250 'entity' => 'Navigation',
251 'bao' => 'CRM_Core_BAO_Navigation',
e501603b
TO
252 ) ,
253 'has_separator' => array(
254 'name' => 'has_separator',
255 'type' => CRM_Utils_Type::T_BOOLEAN,
256 'title' => ts('Use separator') ,
257 'description' => 'If separator needs to be added after this menu item',
522a26c9 258 'table_name' => 'civicrm_navigation',
259 'entity' => 'Navigation',
260 'bao' => 'CRM_Core_BAO_Navigation',
e501603b
TO
261 ) ,
262 'weight' => array(
263 'name' => 'weight',
264 'type' => CRM_Utils_Type::T_INT,
265 'title' => ts('Order') ,
266 'description' => 'Ordering of the navigation items in various blocks.',
522a26c9 267 'table_name' => 'civicrm_navigation',
268 'entity' => 'Navigation',
269 'bao' => 'CRM_Core_BAO_Navigation',
e501603b
TO
270 ) ,
271 );
346aaaba 272 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 273 }
346aaaba 274 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
275 }
276 /**
bd8e0b14 277 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
278 *
279 * @return array
bd8e0b14 280 * Array(string $name => string $uniqueName).
e501603b
TO
281 */
282 static function &fieldKeys() {
bd8e0b14
TO
283 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
284 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 285 }
bd8e0b14 286 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
287 }
288 /**
289 * Returns the names of this table
290 *
291 * @return string
292 */
293 static function getTableName() {
294 return self::$_tableName;
295 }
296 /**
297 * Returns if this table needs to be logged
298 *
299 * @return boolean
300 */
301 function getLog() {
302 return self::$_log;
303 }
304 /**
305 * Returns the list of fields that can be imported
306 *
307 * @param bool $prefix
308 *
309 * @return array
310 */
311 static function &import($prefix = false) {
60808919
TO
312 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'navigation', $prefix, array());
313 return $r;
e501603b
TO
314 }
315 /**
316 * Returns the list of fields that can be exported
317 *
318 * @param bool $prefix
319 *
320 * @return array
321 */
322 static function &export($prefix = false) {
60808919
TO
323 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'navigation', $prefix, array());
324 return $r;
e501603b
TO
325 }
326}