Commit | Line | Data |
---|---|---|
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 | |
4926ede8 | 33 | * (GenCodeChecksum:53624a8994290c1d2ae8f4158c89d3b2) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Core_DAO_Navigation constructor. | |
39 | */ | |
e501603b TO |
40 | class 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; | |
4926ede8 O |
82 | /** |
83 | * CSS class name for an icon | |
84 | * | |
85 | * @var string | |
86 | */ | |
87 | public $icon; | |
e501603b TO |
88 | /** |
89 | * Permission for menu item | |
90 | * | |
91 | * @var string | |
92 | */ | |
93 | public $permission; | |
94 | /** | |
95 | * Permission Operator | |
96 | * | |
97 | * @var string | |
98 | */ | |
99 | public $permission_operator; | |
100 | /** | |
101 | * Parent navigation item, used for grouping | |
102 | * | |
103 | * @var int unsigned | |
104 | */ | |
105 | public $parent_id; | |
106 | /** | |
107 | * Is this navigation item active? | |
108 | * | |
109 | * @var boolean | |
110 | */ | |
111 | public $is_active; | |
112 | /** | |
113 | * If separator needs to be added after this menu item | |
114 | * | |
115 | * @var boolean | |
116 | */ | |
117 | public $has_separator; | |
118 | /** | |
119 | * Ordering of the navigation items in various blocks. | |
120 | * | |
121 | * @var int | |
122 | */ | |
123 | public $weight; | |
124 | /** | |
f41f0342 | 125 | * Class constructor. |
e501603b TO |
126 | */ |
127 | function __construct() { | |
128 | $this->__table = 'civicrm_navigation'; | |
129 | parent::__construct(); | |
130 | } | |
131 | /** | |
f41f0342 | 132 | * Returns foreign keys and entity references. |
e501603b TO |
133 | * |
134 | * @return array | |
135 | * [CRM_Core_Reference_Interface] | |
136 | */ | |
137 | static function getReferenceColumns() { | |
346aaaba TO |
138 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
139 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
140 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); | |
141 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_navigation', 'id'); | |
142 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 143 | } |
346aaaba | 144 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
145 | } |
146 | /** | |
147 | * Returns all the column names of this table | |
148 | * | |
149 | * @return array | |
150 | */ | |
151 | static function &fields() { | |
346aaaba TO |
152 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
153 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
154 | 'id' => array( |
155 | 'name' => 'id', | |
156 | 'type' => CRM_Utils_Type::T_INT, | |
157 | 'title' => ts('Navigation ID') , | |
158 | 'required' => true, | |
522a26c9 | 159 | 'table_name' => 'civicrm_navigation', |
160 | 'entity' => 'Navigation', | |
161 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 162 | 'localizable' => 0, |
e501603b TO |
163 | ) , |
164 | 'domain_id' => array( | |
165 | 'name' => 'domain_id', | |
166 | 'type' => CRM_Utils_Type::T_INT, | |
167 | 'title' => ts('Navigation Domain') , | |
168 | 'description' => 'Which Domain is this navigation item for', | |
169 | 'required' => true, | |
522a26c9 | 170 | 'table_name' => 'civicrm_navigation', |
171 | 'entity' => 'Navigation', | |
172 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 173 | 'localizable' => 0, |
e501603b TO |
174 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
175 | 'pseudoconstant' => array( | |
176 | 'table' => 'civicrm_domain', | |
177 | 'keyColumn' => 'id', | |
178 | 'labelColumn' => 'name', | |
179 | ) | |
180 | ) , | |
181 | 'label' => array( | |
182 | 'name' => 'label', | |
183 | 'type' => CRM_Utils_Type::T_STRING, | |
184 | 'title' => ts('Navigation Item Label') , | |
185 | 'description' => 'Navigation Title', | |
186 | 'maxlength' => 255, | |
187 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 188 | 'table_name' => 'civicrm_navigation', |
189 | 'entity' => 'Navigation', | |
190 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 191 | 'localizable' => 0, |
e501603b TO |
192 | ) , |
193 | 'name' => array( | |
194 | 'name' => 'name', | |
195 | 'type' => CRM_Utils_Type::T_STRING, | |
196 | 'title' => ts('Navigation Item Machine Name') , | |
197 | 'description' => 'Internal Name', | |
198 | 'maxlength' => 255, | |
199 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 200 | 'table_name' => 'civicrm_navigation', |
201 | 'entity' => 'Navigation', | |
202 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 203 | 'localizable' => 0, |
e501603b TO |
204 | ) , |
205 | 'url' => array( | |
206 | 'name' => 'url', | |
207 | 'type' => CRM_Utils_Type::T_STRING, | |
208 | 'title' => ts('Url') , | |
209 | 'description' => 'url in case of custom navigation link', | |
210 | 'maxlength' => 255, | |
211 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 212 | 'table_name' => 'civicrm_navigation', |
213 | 'entity' => 'Navigation', | |
214 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 215 | 'localizable' => 0, |
e501603b | 216 | ) , |
4926ede8 O |
217 | 'icon' => array( |
218 | 'name' => 'icon', | |
219 | 'type' => CRM_Utils_Type::T_STRING, | |
220 | 'title' => ts('Icon') , | |
221 | 'description' => 'CSS class name for an icon', | |
222 | 'required' => false, | |
223 | 'maxlength' => 255, | |
224 | 'size' => CRM_Utils_Type::HUGE, | |
225 | 'default' => 'NULL', | |
226 | 'table_name' => 'civicrm_navigation', | |
227 | 'entity' => 'Navigation', | |
228 | 'bao' => 'CRM_Core_BAO_Navigation', | |
229 | 'localizable' => 0, | |
230 | ) , | |
e501603b TO |
231 | 'permission' => array( |
232 | 'name' => 'permission', | |
233 | 'type' => CRM_Utils_Type::T_STRING, | |
234 | 'title' => ts('Required Permission') , | |
235 | 'description' => 'Permission for menu item', | |
236 | 'maxlength' => 255, | |
237 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 238 | 'table_name' => 'civicrm_navigation', |
239 | 'entity' => 'Navigation', | |
240 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 241 | 'localizable' => 0, |
e501603b TO |
242 | ) , |
243 | 'permission_operator' => array( | |
244 | 'name' => 'permission_operator', | |
245 | 'type' => CRM_Utils_Type::T_STRING, | |
246 | 'title' => ts('Permission Operator') , | |
247 | 'description' => 'Permission Operator', | |
248 | 'maxlength' => 3, | |
249 | 'size' => CRM_Utils_Type::FOUR, | |
522a26c9 | 250 | 'table_name' => 'civicrm_navigation', |
251 | 'entity' => 'Navigation', | |
252 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 253 | 'localizable' => 0, |
e501603b TO |
254 | ) , |
255 | 'parent_id' => array( | |
256 | 'name' => 'parent_id', | |
257 | 'type' => CRM_Utils_Type::T_INT, | |
258 | 'title' => ts('Navigation parent ID') , | |
259 | 'description' => 'Parent navigation item, used for grouping', | |
522a26c9 | 260 | 'table_name' => 'civicrm_navigation', |
261 | 'entity' => 'Navigation', | |
262 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 263 | 'localizable' => 0, |
e501603b TO |
264 | 'FKClassName' => 'CRM_Core_DAO_Navigation', |
265 | 'pseudoconstant' => array( | |
266 | 'table' => 'civicrm_navigation', | |
e2c44ec0 | 267 | 'keyColumn' => 'id', |
e501603b | 268 | 'labelColumn' => 'label', |
e2c44ec0 | 269 | 'nameColumn' => 'name', |
e501603b TO |
270 | ) |
271 | ) , | |
272 | 'is_active' => array( | |
273 | 'name' => 'is_active', | |
274 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
275 | 'title' => ts('Is Active') , | |
276 | 'description' => 'Is this navigation item active?', | |
522a26c9 | 277 | 'table_name' => 'civicrm_navigation', |
278 | 'entity' => 'Navigation', | |
279 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 280 | 'localizable' => 0, |
e501603b TO |
281 | ) , |
282 | 'has_separator' => array( | |
283 | 'name' => 'has_separator', | |
284 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
285 | 'title' => ts('Use separator') , | |
286 | 'description' => 'If separator needs to be added after this menu item', | |
522a26c9 | 287 | 'table_name' => 'civicrm_navigation', |
288 | 'entity' => 'Navigation', | |
289 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 290 | 'localizable' => 0, |
e501603b TO |
291 | ) , |
292 | 'weight' => array( | |
293 | 'name' => 'weight', | |
294 | 'type' => CRM_Utils_Type::T_INT, | |
295 | 'title' => ts('Order') , | |
296 | 'description' => 'Ordering of the navigation items in various blocks.', | |
522a26c9 | 297 | 'table_name' => 'civicrm_navigation', |
298 | 'entity' => 'Navigation', | |
299 | 'bao' => 'CRM_Core_BAO_Navigation', | |
6a7e5e5d | 300 | 'localizable' => 0, |
e501603b TO |
301 | ) , |
302 | ); | |
346aaaba | 303 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 304 | } |
346aaaba | 305 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
306 | } |
307 | /** | |
bd8e0b14 | 308 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
309 | * |
310 | * @return array | |
bd8e0b14 | 311 | * Array(string $name => string $uniqueName). |
e501603b TO |
312 | */ |
313 | static function &fieldKeys() { | |
bd8e0b14 TO |
314 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
315 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 316 | } |
bd8e0b14 | 317 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
318 | } |
319 | /** | |
320 | * Returns the names of this table | |
321 | * | |
322 | * @return string | |
323 | */ | |
324 | static function getTableName() { | |
325 | return self::$_tableName; | |
326 | } | |
327 | /** | |
328 | * Returns if this table needs to be logged | |
329 | * | |
330 | * @return boolean | |
331 | */ | |
332 | function getLog() { | |
333 | return self::$_log; | |
334 | } | |
335 | /** | |
336 | * Returns the list of fields that can be imported | |
337 | * | |
338 | * @param bool $prefix | |
339 | * | |
340 | * @return array | |
341 | */ | |
342 | static function &import($prefix = false) { | |
60808919 TO |
343 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'navigation', $prefix, array()); |
344 | return $r; | |
e501603b TO |
345 | } |
346 | /** | |
347 | * Returns the list of fields that can be exported | |
348 | * | |
349 | * @param bool $prefix | |
350 | * | |
351 | * @return array | |
352 | */ | |
353 | static function &export($prefix = false) { | |
60808919 TO |
354 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'navigation', $prefix, array()); |
355 | return $r; | |
e501603b | 356 | } |
e7a6b91a AS |
357 | /** |
358 | * Returns the list of indices | |
359 | */ | |
360 | public static function indices($localize = TRUE) { | |
361 | $indices = array(); | |
362 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; | |
363 | } | |
e501603b | 364 | } |