Merge pull request #10549 from jitendrapurohit/CRM-20761
[civicrm-core.git] / CRM / Core / DAO / Navigation.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Core/Navigation.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:50047b21bb89d424e7852ea198e521fc)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Core_DAO_Navigation constructor.
39 */
40 class CRM_Core_DAO_Navigation extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_navigation';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 /**
119 * Class constructor.
120 */
121 function __construct() {
122 $this->__table = 'civicrm_navigation';
123 parent::__construct();
124 }
125 /**
126 * Returns foreign keys and entity references.
127 *
128 * @return array
129 * [CRM_Core_Reference_Interface]
130 */
131 static function getReferenceColumns() {
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']);
137 }
138 return Civi::$statics[__CLASS__]['links'];
139 }
140 /**
141 * Returns all the column names of this table
142 *
143 * @return array
144 */
145 static function &fields() {
146 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
147 Civi::$statics[__CLASS__]['fields'] = array(
148 'id' => array(
149 'name' => 'id',
150 'type' => CRM_Utils_Type::T_INT,
151 'title' => ts('Navigation ID') ,
152 'required' => true,
153 'table_name' => 'civicrm_navigation',
154 'entity' => 'Navigation',
155 'bao' => 'CRM_Core_BAO_Navigation',
156 'localizable' => 0,
157 ) ,
158 'domain_id' => array(
159 'name' => 'domain_id',
160 'type' => CRM_Utils_Type::T_INT,
161 'title' => ts('Navigation Domain') ,
162 'description' => 'Which Domain is this navigation item for',
163 'required' => true,
164 'table_name' => 'civicrm_navigation',
165 'entity' => 'Navigation',
166 'bao' => 'CRM_Core_BAO_Navigation',
167 'localizable' => 0,
168 'FKClassName' => 'CRM_Core_DAO_Domain',
169 'pseudoconstant' => array(
170 'table' => 'civicrm_domain',
171 'keyColumn' => 'id',
172 'labelColumn' => 'name',
173 )
174 ) ,
175 'label' => array(
176 'name' => 'label',
177 'type' => CRM_Utils_Type::T_STRING,
178 'title' => ts('Navigation Item Label') ,
179 'description' => 'Navigation Title',
180 'maxlength' => 255,
181 'size' => CRM_Utils_Type::HUGE,
182 'table_name' => 'civicrm_navigation',
183 'entity' => 'Navigation',
184 'bao' => 'CRM_Core_BAO_Navigation',
185 'localizable' => 0,
186 ) ,
187 'name' => array(
188 'name' => 'name',
189 'type' => CRM_Utils_Type::T_STRING,
190 'title' => ts('Navigation Item Machine Name') ,
191 'description' => 'Internal Name',
192 'maxlength' => 255,
193 'size' => CRM_Utils_Type::HUGE,
194 'table_name' => 'civicrm_navigation',
195 'entity' => 'Navigation',
196 'bao' => 'CRM_Core_BAO_Navigation',
197 'localizable' => 0,
198 ) ,
199 'url' => array(
200 'name' => 'url',
201 'type' => CRM_Utils_Type::T_STRING,
202 'title' => ts('Url') ,
203 'description' => 'url in case of custom navigation link',
204 'maxlength' => 255,
205 'size' => CRM_Utils_Type::HUGE,
206 'table_name' => 'civicrm_navigation',
207 'entity' => 'Navigation',
208 'bao' => 'CRM_Core_BAO_Navigation',
209 'localizable' => 0,
210 ) ,
211 'permission' => array(
212 'name' => 'permission',
213 'type' => CRM_Utils_Type::T_STRING,
214 'title' => ts('Required Permission') ,
215 'description' => 'Permission for menu item',
216 'maxlength' => 255,
217 'size' => CRM_Utils_Type::HUGE,
218 'table_name' => 'civicrm_navigation',
219 'entity' => 'Navigation',
220 'bao' => 'CRM_Core_BAO_Navigation',
221 'localizable' => 0,
222 ) ,
223 'permission_operator' => array(
224 'name' => 'permission_operator',
225 'type' => CRM_Utils_Type::T_STRING,
226 'title' => ts('Permission Operator') ,
227 'description' => 'Permission Operator',
228 'maxlength' => 3,
229 'size' => CRM_Utils_Type::FOUR,
230 'table_name' => 'civicrm_navigation',
231 'entity' => 'Navigation',
232 'bao' => 'CRM_Core_BAO_Navigation',
233 'localizable' => 0,
234 ) ,
235 'parent_id' => array(
236 'name' => 'parent_id',
237 'type' => CRM_Utils_Type::T_INT,
238 'title' => ts('Navigation parent ID') ,
239 'description' => 'Parent navigation item, used for grouping',
240 'table_name' => 'civicrm_navigation',
241 'entity' => 'Navigation',
242 'bao' => 'CRM_Core_BAO_Navigation',
243 'localizable' => 0,
244 'FKClassName' => 'CRM_Core_DAO_Navigation',
245 'pseudoconstant' => array(
246 'table' => 'civicrm_navigation',
247 'keyColumn' => 'id',
248 'labelColumn' => 'label',
249 'nameColumn' => 'name',
250 )
251 ) ,
252 'is_active' => array(
253 'name' => 'is_active',
254 'type' => CRM_Utils_Type::T_BOOLEAN,
255 'title' => ts('Is Active') ,
256 'description' => 'Is this navigation item active?',
257 'table_name' => 'civicrm_navigation',
258 'entity' => 'Navigation',
259 'bao' => 'CRM_Core_BAO_Navigation',
260 'localizable' => 0,
261 ) ,
262 'has_separator' => array(
263 'name' => 'has_separator',
264 'type' => CRM_Utils_Type::T_BOOLEAN,
265 'title' => ts('Use separator') ,
266 'description' => 'If separator needs to be added after this menu item',
267 'table_name' => 'civicrm_navigation',
268 'entity' => 'Navigation',
269 'bao' => 'CRM_Core_BAO_Navigation',
270 'localizable' => 0,
271 ) ,
272 'weight' => array(
273 'name' => 'weight',
274 'type' => CRM_Utils_Type::T_INT,
275 'title' => ts('Order') ,
276 'description' => 'Ordering of the navigation items in various blocks.',
277 'table_name' => 'civicrm_navigation',
278 'entity' => 'Navigation',
279 'bao' => 'CRM_Core_BAO_Navigation',
280 'localizable' => 0,
281 ) ,
282 );
283 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
284 }
285 return Civi::$statics[__CLASS__]['fields'];
286 }
287 /**
288 * Return a mapping from field-name to the corresponding key (as used in fields()).
289 *
290 * @return array
291 * Array(string $name => string $uniqueName).
292 */
293 static function &fieldKeys() {
294 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
295 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
296 }
297 return Civi::$statics[__CLASS__]['fieldKeys'];
298 }
299 /**
300 * Returns the names of this table
301 *
302 * @return string
303 */
304 static function getTableName() {
305 return self::$_tableName;
306 }
307 /**
308 * Returns if this table needs to be logged
309 *
310 * @return boolean
311 */
312 function getLog() {
313 return self::$_log;
314 }
315 /**
316 * Returns the list of fields that can be imported
317 *
318 * @param bool $prefix
319 *
320 * @return array
321 */
322 static function &import($prefix = false) {
323 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'navigation', $prefix, array());
324 return $r;
325 }
326 /**
327 * Returns the list of fields that can be exported
328 *
329 * @param bool $prefix
330 *
331 * @return array
332 */
333 static function &export($prefix = false) {
334 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'navigation', $prefix, array());
335 return $r;
336 }
337 /**
338 * Returns the list of indices
339 */
340 public static function indices($localize = TRUE) {
341 $indices = array();
342 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
343 }
344 }