xml/templates/dao.tpl - Centralize export() / import() logic
[civicrm-core.git] / CRM / Core / DAO / Dashboard.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
30 *
31 * Generated from xml/schema/CRM/Core/Dashboard.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:b5c91969a65943ff6daf8c43a9bd0fe4)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_Dashboard extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_dashboard';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = false;
83 /**
84 *
85 * @var int unsigned
86 */
87 public $id;
88 /**
89 * Domain for dashboard
90 *
91 * @var int unsigned
92 */
93 public $domain_id;
94 /**
95 * Internal name of dashlet.
96 *
97 * @var string
98 */
99 public $name;
100 /**
101 * dashlet title
102 *
103 * @var string
104 */
105 public $label;
106 /**
107 * url in case of external dashlet
108 *
109 * @var string
110 */
111 public $url;
112 /**
113 * Permission for the dashlet
114 *
115 * @var string
116 */
117 public $permission;
118 /**
119 * Permission Operator
120 *
121 * @var string
122 */
123 public $permission_operator;
124 /**
125 * column no for this dashlet
126 *
127 * @var boolean
128 */
129 public $column_no;
130 /**
131 * Is Minimized?
132 *
133 * @var boolean
134 */
135 public $is_minimized;
136 /**
137 * fullscreen url for dashlet
138 *
139 * @var string
140 */
141 public $fullscreen_url;
142 /**
143 * Is Fullscreen?
144 *
145 * @var boolean
146 */
147 public $is_fullscreen;
148 /**
149 * Is this dashlet active?
150 *
151 * @var boolean
152 */
153 public $is_active;
154 /**
155 * Is this dashlet reserved?
156 *
157 * @var boolean
158 */
159 public $is_reserved;
160 /**
161 * Ordering of the dashlets.
162 *
163 * @var int
164 */
165 public $weight;
166 /**
167 * class constructor
168 *
169 * @return civicrm_dashboard
170 */
171 function __construct() {
172 $this->__table = 'civicrm_dashboard';
173 parent::__construct();
174 }
175 /**
176 * Returns foreign keys and entity references
177 *
178 * @return array
179 * [CRM_Core_Reference_Interface]
180 */
181 static function getReferenceColumns() {
182 if (!self::$_links) {
183 self::$_links = static ::createReferenceColumns(__CLASS__);
184 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
185 }
186 return self::$_links;
187 }
188 /**
189 * Returns all the column names of this table
190 *
191 * @return array
192 */
193 static function &fields() {
194 if (!(self::$_fields)) {
195 self::$_fields = array(
196 'id' => array(
197 'name' => 'id',
198 'type' => CRM_Utils_Type::T_INT,
199 'title' => ts('DashletID') ,
200 'required' => true,
201 ) ,
202 'domain_id' => array(
203 'name' => 'domain_id',
204 'type' => CRM_Utils_Type::T_INT,
205 'title' => ts('Dashlet Domain') ,
206 'description' => 'Domain for dashboard',
207 'required' => true,
208 'FKClassName' => 'CRM_Core_DAO_Domain',
209 'pseudoconstant' => array(
210 'table' => 'civicrm_domain',
211 'keyColumn' => 'id',
212 'labelColumn' => 'name',
213 )
214 ) ,
215 'name' => array(
216 'name' => 'name',
217 'type' => CRM_Utils_Type::T_STRING,
218 'title' => ts('Dashlet Name') ,
219 'description' => 'Internal name of dashlet.',
220 'maxlength' => 64,
221 'size' => CRM_Utils_Type::BIG,
222 ) ,
223 'label' => array(
224 'name' => 'label',
225 'type' => CRM_Utils_Type::T_STRING,
226 'title' => ts('Dashlet Title') ,
227 'description' => 'dashlet title',
228 'maxlength' => 255,
229 'size' => CRM_Utils_Type::HUGE,
230 ) ,
231 'url' => array(
232 'name' => 'url',
233 'type' => CRM_Utils_Type::T_STRING,
234 'title' => ts('Dashlet URL') ,
235 'description' => 'url in case of external dashlet',
236 'maxlength' => 255,
237 'size' => CRM_Utils_Type::HUGE,
238 ) ,
239 'permission' => array(
240 'name' => 'permission',
241 'type' => CRM_Utils_Type::T_STRING,
242 'title' => ts('Dashlet Permission') ,
243 'description' => 'Permission for the dashlet',
244 'maxlength' => 255,
245 'size' => CRM_Utils_Type::HUGE,
246 ) ,
247 'permission_operator' => array(
248 'name' => 'permission_operator',
249 'type' => CRM_Utils_Type::T_STRING,
250 'title' => ts('Dashlet Permission Operator') ,
251 'description' => 'Permission Operator',
252 'maxlength' => 3,
253 'size' => CRM_Utils_Type::FOUR,
254 ) ,
255 'column_no' => array(
256 'name' => 'column_no',
257 'type' => CRM_Utils_Type::T_BOOLEAN,
258 'title' => ts('Dashlet Column') ,
259 'description' => 'column no for this dashlet',
260 ) ,
261 'is_minimized' => array(
262 'name' => 'is_minimized',
263 'type' => CRM_Utils_Type::T_BOOLEAN,
264 'title' => ts('Minimize Dashlet?') ,
265 'description' => 'Is Minimized?',
266 ) ,
267 'fullscreen_url' => array(
268 'name' => 'fullscreen_url',
269 'type' => CRM_Utils_Type::T_STRING,
270 'title' => ts('Fullscreen URL') ,
271 'description' => 'fullscreen url for dashlet',
272 'maxlength' => 255,
273 'size' => CRM_Utils_Type::HUGE,
274 ) ,
275 'is_fullscreen' => array(
276 'name' => 'is_fullscreen',
277 'type' => CRM_Utils_Type::T_BOOLEAN,
278 'title' => ts('Is Fullscreen?') ,
279 'description' => 'Is Fullscreen?',
280 'default' => '1',
281 ) ,
282 'is_active' => array(
283 'name' => 'is_active',
284 'type' => CRM_Utils_Type::T_BOOLEAN,
285 'title' => ts('Is Dashlet Active?') ,
286 'description' => 'Is this dashlet active?',
287 ) ,
288 'is_reserved' => array(
289 'name' => 'is_reserved',
290 'type' => CRM_Utils_Type::T_BOOLEAN,
291 'title' => ts('Is Dashlet Reserved?') ,
292 'description' => 'Is this dashlet reserved?',
293 ) ,
294 'weight' => array(
295 'name' => 'weight',
296 'type' => CRM_Utils_Type::T_INT,
297 'title' => ts('Order') ,
298 'description' => 'Ordering of the dashlets.',
299 ) ,
300 );
301 }
302 return self::$_fields;
303 }
304 /**
305 * Returns an array containing, for each field, the arary key used for that
306 * field in self::$_fields.
307 *
308 * @return array
309 */
310 static function &fieldKeys() {
311 if (!(self::$_fieldKeys)) {
312 self::$_fieldKeys = array(
313 'id' => 'id',
314 'domain_id' => 'domain_id',
315 'name' => 'name',
316 'label' => 'label',
317 'url' => 'url',
318 'permission' => 'permission',
319 'permission_operator' => 'permission_operator',
320 'column_no' => 'column_no',
321 'is_minimized' => 'is_minimized',
322 'fullscreen_url' => 'fullscreen_url',
323 'is_fullscreen' => 'is_fullscreen',
324 'is_active' => 'is_active',
325 'is_reserved' => 'is_reserved',
326 'weight' => 'weight',
327 );
328 }
329 return self::$_fieldKeys;
330 }
331 /**
332 * Returns the names of this table
333 *
334 * @return string
335 */
336 static function getTableName() {
337 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
338 }
339 /**
340 * Returns if this table needs to be logged
341 *
342 * @return boolean
343 */
344 function getLog() {
345 return self::$_log;
346 }
347 /**
348 * Returns the list of fields that can be imported
349 *
350 * @param bool $prefix
351 *
352 * @return array
353 */
354 static function &import($prefix = false) {
355 if (!(self::$_import)) {
356 self::$_import = array();
357 $fields = self::fields();
358 foreach($fields as $name => $field) {
359 if (CRM_Utils_Array::value('import', $field)) {
360 if ($prefix) {
361 self::$_import['dashboard'] = & $fields[$name];
362 } else {
363 self::$_import[$name] = & $fields[$name];
364 }
365 }
366 }
367 }
368 return self::$_import;
369 }
370 /**
371 * Returns the list of fields that can be exported
372 *
373 * @param bool $prefix
374 *
375 * @return array
376 */
377 static function &export($prefix = false) {
378 if (!(self::$_export)) {
379 self::$_export = array();
380 $fields = self::fields();
381 foreach($fields as $name => $field) {
382 if (CRM_Utils_Array::value('export', $field)) {
383 if ($prefix) {
384 self::$_export['dashboard'] = & $fields[$name];
385 } else {
386 self::$_export[$name] = & $fields[$name];
387 }
388 }
389 }
390 }
391 return self::$_export;
392 }
393}