Merge pull request #9680 from h-c-c/CRM-19881
[civicrm-core.git] / CRM / Core / DAO / Dashboard.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/Dashboard.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
522a26c9 33 * (GenCodeChecksum:3e0b2bd066d83876c81d84a574f29fe1)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_Dashboard constructor.
39 */
e501603b
TO
40class CRM_Core_DAO_Dashboard 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_dashboard';
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 * Domain for dashboard
60 *
61 * @var int unsigned
62 */
63 public $domain_id;
64 /**
65 * Internal name of dashlet.
66 *
67 * @var string
68 */
69 public $name;
70 /**
71 * dashlet title
72 *
73 * @var string
74 */
75 public $label;
76 /**
77 * url in case of external dashlet
78 *
79 * @var string
80 */
81 public $url;
82 /**
83 * Permission for the dashlet
84 *
85 * @var string
86 */
87 public $permission;
88 /**
89 * Permission Operator
90 *
91 * @var string
92 */
93 public $permission_operator;
e501603b
TO
94 /**
95 * fullscreen url for dashlet
96 *
97 * @var string
98 */
99 public $fullscreen_url;
e501603b
TO
100 /**
101 * Is this dashlet active?
102 *
103 * @var boolean
104 */
105 public $is_active;
106 /**
107 * Is this dashlet reserved?
108 *
109 * @var boolean
110 */
111 public $is_reserved;
112 /**
bf7df0ec 113 * Number of minutes to cache dashlet content in browser localStorage.
e501603b 114 *
bf7df0ec 115 * @var int unsigned
e501603b 116 */
bf7df0ec 117 public $cache_minutes;
e501603b 118 /**
f41f0342 119 * Class constructor.
e501603b
TO
120 */
121 function __construct() {
122 $this->__table = 'civicrm_dashboard';
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 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 136 }
346aaaba 137 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
138 }
139 /**
140 * Returns all the column names of this table
141 *
142 * @return array
143 */
144 static function &fields() {
346aaaba
TO
145 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
146 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
147 'id' => array(
148 'name' => 'id',
149 'type' => CRM_Utils_Type::T_INT,
150 'title' => ts('DashletID') ,
151 'required' => true,
522a26c9 152 'table_name' => 'civicrm_dashboard',
153 'entity' => 'Dashboard',
154 'bao' => 'CRM_Core_BAO_Dashboard',
e501603b
TO
155 ) ,
156 'domain_id' => array(
157 'name' => 'domain_id',
158 'type' => CRM_Utils_Type::T_INT,
159 'title' => ts('Dashlet Domain') ,
160 'description' => 'Domain for dashboard',
161 'required' => true,
522a26c9 162 'table_name' => 'civicrm_dashboard',
163 'entity' => 'Dashboard',
164 'bao' => 'CRM_Core_BAO_Dashboard',
e501603b
TO
165 'FKClassName' => 'CRM_Core_DAO_Domain',
166 'pseudoconstant' => array(
167 'table' => 'civicrm_domain',
168 'keyColumn' => 'id',
169 'labelColumn' => 'name',
170 )
171 ) ,
172 'name' => array(
173 'name' => 'name',
174 'type' => CRM_Utils_Type::T_STRING,
175 'title' => ts('Dashlet Name') ,
176 'description' => 'Internal name of dashlet.',
177 'maxlength' => 64,
178 'size' => CRM_Utils_Type::BIG,
522a26c9 179 'table_name' => 'civicrm_dashboard',
180 'entity' => 'Dashboard',
181 'bao' => 'CRM_Core_BAO_Dashboard',
e501603b
TO
182 ) ,
183 'label' => array(
184 'name' => 'label',
185 'type' => CRM_Utils_Type::T_STRING,
186 'title' => ts('Dashlet Title') ,
187 'description' => 'dashlet title',
188 'maxlength' => 255,
189 'size' => CRM_Utils_Type::HUGE,
522a26c9 190 'table_name' => 'civicrm_dashboard',
191 'entity' => 'Dashboard',
192 'bao' => 'CRM_Core_BAO_Dashboard',
e501603b
TO
193 ) ,
194 'url' => array(
195 'name' => 'url',
196 'type' => CRM_Utils_Type::T_STRING,
197 'title' => ts('Dashlet URL') ,
198 'description' => 'url in case of external dashlet',
199 'maxlength' => 255,
200 'size' => CRM_Utils_Type::HUGE,
522a26c9 201 'table_name' => 'civicrm_dashboard',
202 'entity' => 'Dashboard',
203 'bao' => 'CRM_Core_BAO_Dashboard',
e501603b
TO
204 ) ,
205 'permission' => array(
206 'name' => 'permission',
207 'type' => CRM_Utils_Type::T_STRING,
208 'title' => ts('Dashlet Permission') ,
209 'description' => 'Permission for the dashlet',
210 'maxlength' => 255,
211 'size' => CRM_Utils_Type::HUGE,
522a26c9 212 'table_name' => 'civicrm_dashboard',
213 'entity' => 'Dashboard',
214 'bao' => 'CRM_Core_BAO_Dashboard',
e501603b
TO
215 ) ,
216 'permission_operator' => array(
217 'name' => 'permission_operator',
218 'type' => CRM_Utils_Type::T_STRING,
219 'title' => ts('Dashlet Permission Operator') ,
220 'description' => 'Permission Operator',
221 'maxlength' => 3,
222 'size' => CRM_Utils_Type::FOUR,
522a26c9 223 'table_name' => 'civicrm_dashboard',
224 'entity' => 'Dashboard',
225 'bao' => 'CRM_Core_BAO_Dashboard',
e501603b 226 ) ,
e501603b
TO
227 'fullscreen_url' => array(
228 'name' => 'fullscreen_url',
229 'type' => CRM_Utils_Type::T_STRING,
230 'title' => ts('Fullscreen URL') ,
231 'description' => 'fullscreen url for dashlet',
232 'maxlength' => 255,
233 'size' => CRM_Utils_Type::HUGE,
522a26c9 234 'table_name' => 'civicrm_dashboard',
235 'entity' => 'Dashboard',
236 'bao' => 'CRM_Core_BAO_Dashboard',
e501603b 237 ) ,
e501603b
TO
238 'is_active' => array(
239 'name' => 'is_active',
240 'type' => CRM_Utils_Type::T_BOOLEAN,
241 'title' => ts('Is Dashlet Active?') ,
242 'description' => 'Is this dashlet active?',
522a26c9 243 'table_name' => 'civicrm_dashboard',
244 'entity' => 'Dashboard',
245 'bao' => 'CRM_Core_BAO_Dashboard',
e501603b
TO
246 ) ,
247 'is_reserved' => array(
248 'name' => 'is_reserved',
249 'type' => CRM_Utils_Type::T_BOOLEAN,
250 'title' => ts('Is Dashlet Reserved?') ,
251 'description' => 'Is this dashlet reserved?',
522a26c9 252 'table_name' => 'civicrm_dashboard',
253 'entity' => 'Dashboard',
254 'bao' => 'CRM_Core_BAO_Dashboard',
e501603b 255 ) ,
bf7df0ec
CW
256 'cache_minutes' => array(
257 'name' => 'cache_minutes',
e501603b 258 'type' => CRM_Utils_Type::T_INT,
bf7df0ec
CW
259 'title' => ts('Cache Minutes') ,
260 'description' => 'Number of minutes to cache dashlet content in browser localStorage.',
261 'required' => true,
262 'default' => '60',
522a26c9 263 'table_name' => 'civicrm_dashboard',
264 'entity' => 'Dashboard',
265 'bao' => 'CRM_Core_BAO_Dashboard',
e501603b
TO
266 ) ,
267 );
346aaaba 268 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 269 }
346aaaba 270 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
271 }
272 /**
bd8e0b14 273 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
274 *
275 * @return array
bd8e0b14 276 * Array(string $name => string $uniqueName).
e501603b
TO
277 */
278 static function &fieldKeys() {
bd8e0b14
TO
279 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
280 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 281 }
bd8e0b14 282 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
283 }
284 /**
285 * Returns the names of this table
286 *
287 * @return string
288 */
289 static function getTableName() {
290 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
291 }
292 /**
293 * Returns if this table needs to be logged
294 *
295 * @return boolean
296 */
297 function getLog() {
298 return self::$_log;
299 }
300 /**
301 * Returns the list of fields that can be imported
302 *
303 * @param bool $prefix
304 *
305 * @return array
306 */
307 static function &import($prefix = false) {
60808919
TO
308 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard', $prefix, array());
309 return $r;
e501603b
TO
310 }
311 /**
312 * Returns the list of fields that can be exported
313 *
314 * @param bool $prefix
315 *
316 * @return array
317 */
318 static function &export($prefix = false) {
60808919
TO
319 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard', $prefix, array());
320 return $r;
e501603b
TO
321 }
322}