Merge pull request #13314 from colemanw/dev/core#337
[civicrm-core.git] / CRM / Core / DAO / Dashboard.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/Dashboard.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:52a635955e779405d2eaa2b403c41092)
10 */
11
12 /**
13 * Database access object for the Dashboard entity.
14 */
15 class CRM_Core_DAO_Dashboard extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_dashboard';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 static $_log = FALSE;
30
31 /**
32 * @var int unsigned
33 */
34 public $id;
35
36 /**
37 * Domain for dashboard
38 *
39 * @var int unsigned
40 */
41 public $domain_id;
42
43 /**
44 * Internal name of dashlet.
45 *
46 * @var string
47 */
48 public $name;
49
50 /**
51 * dashlet title
52 *
53 * @var string
54 */
55 public $label;
56
57 /**
58 * url in case of external dashlet
59 *
60 * @var string
61 */
62 public $url;
63
64 /**
65 * Permission for the dashlet
66 *
67 * @var string
68 */
69 public $permission;
70
71 /**
72 * Permission Operator
73 *
74 * @var string
75 */
76 public $permission_operator;
77
78 /**
79 * fullscreen url for dashlet
80 *
81 * @var string
82 */
83 public $fullscreen_url;
84
85 /**
86 * Is this dashlet active?
87 *
88 * @var boolean
89 */
90 public $is_active;
91
92 /**
93 * Is this dashlet reserved?
94 *
95 * @var boolean
96 */
97 public $is_reserved;
98
99 /**
100 * Number of minutes to cache dashlet content in browser localStorage.
101 *
102 * @var int unsigned
103 */
104 public $cache_minutes;
105
106 /**
107 * Class constructor.
108 */
109 public function __construct() {
110 $this->__table = 'civicrm_dashboard';
111 parent::__construct();
112 }
113
114 /**
115 * Returns foreign keys and entity references.
116 *
117 * @return array
118 * [CRM_Core_Reference_Interface]
119 */
120 public static function getReferenceColumns() {
121 if (!isset(Civi::$statics[__CLASS__]['links'])) {
122 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
123 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
124 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
125 }
126 return Civi::$statics[__CLASS__]['links'];
127 }
128
129 /**
130 * Returns all the column names of this table
131 *
132 * @return array
133 */
134 public static function &fields() {
135 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
136 Civi::$statics[__CLASS__]['fields'] = [
137 'id' => [
138 'name' => 'id',
139 'type' => CRM_Utils_Type::T_INT,
140 'title' => ts('DashletID'),
141 'required' => TRUE,
142 'table_name' => 'civicrm_dashboard',
143 'entity' => 'Dashboard',
144 'bao' => 'CRM_Core_BAO_Dashboard',
145 'localizable' => 0,
146 ],
147 'domain_id' => [
148 'name' => 'domain_id',
149 'type' => CRM_Utils_Type::T_INT,
150 'title' => ts('Dashlet Domain'),
151 'description' => ts('Domain for dashboard'),
152 'required' => TRUE,
153 'table_name' => 'civicrm_dashboard',
154 'entity' => 'Dashboard',
155 'bao' => 'CRM_Core_BAO_Dashboard',
156 'localizable' => 0,
157 'FKClassName' => 'CRM_Core_DAO_Domain',
158 'pseudoconstant' => [
159 'table' => 'civicrm_domain',
160 'keyColumn' => 'id',
161 'labelColumn' => 'name',
162 ]
163 ],
164 'name' => [
165 'name' => 'name',
166 'type' => CRM_Utils_Type::T_STRING,
167 'title' => ts('Dashlet Name'),
168 'description' => ts('Internal name of dashlet.'),
169 'maxlength' => 64,
170 'size' => CRM_Utils_Type::BIG,
171 'table_name' => 'civicrm_dashboard',
172 'entity' => 'Dashboard',
173 'bao' => 'CRM_Core_BAO_Dashboard',
174 'localizable' => 0,
175 ],
176 'label' => [
177 'name' => 'label',
178 'type' => CRM_Utils_Type::T_STRING,
179 'title' => ts('Dashlet Title'),
180 'description' => ts('dashlet title'),
181 'maxlength' => 255,
182 'size' => CRM_Utils_Type::HUGE,
183 'table_name' => 'civicrm_dashboard',
184 'entity' => 'Dashboard',
185 'bao' => 'CRM_Core_BAO_Dashboard',
186 'localizable' => 1,
187 ],
188 'url' => [
189 'name' => 'url',
190 'type' => CRM_Utils_Type::T_STRING,
191 'title' => ts('Dashlet URL'),
192 'description' => ts('url in case of external dashlet'),
193 'maxlength' => 255,
194 'size' => CRM_Utils_Type::HUGE,
195 'table_name' => 'civicrm_dashboard',
196 'entity' => 'Dashboard',
197 'bao' => 'CRM_Core_BAO_Dashboard',
198 'localizable' => 0,
199 ],
200 'permission' => [
201 'name' => 'permission',
202 'type' => CRM_Utils_Type::T_STRING,
203 'title' => ts('Dashlet Permission'),
204 'description' => ts('Permission for the dashlet'),
205 'maxlength' => 255,
206 'size' => CRM_Utils_Type::HUGE,
207 'table_name' => 'civicrm_dashboard',
208 'entity' => 'Dashboard',
209 'bao' => 'CRM_Core_BAO_Dashboard',
210 'localizable' => 0,
211 ],
212 'permission_operator' => [
213 'name' => 'permission_operator',
214 'type' => CRM_Utils_Type::T_STRING,
215 'title' => ts('Dashlet Permission Operator'),
216 'description' => ts('Permission Operator'),
217 'maxlength' => 3,
218 'size' => CRM_Utils_Type::FOUR,
219 'table_name' => 'civicrm_dashboard',
220 'entity' => 'Dashboard',
221 'bao' => 'CRM_Core_BAO_Dashboard',
222 'localizable' => 0,
223 ],
224 'fullscreen_url' => [
225 'name' => 'fullscreen_url',
226 'type' => CRM_Utils_Type::T_STRING,
227 'title' => ts('Fullscreen URL'),
228 'description' => ts('fullscreen url for dashlet'),
229 'maxlength' => 255,
230 'size' => CRM_Utils_Type::HUGE,
231 'table_name' => 'civicrm_dashboard',
232 'entity' => 'Dashboard',
233 'bao' => 'CRM_Core_BAO_Dashboard',
234 'localizable' => 0,
235 ],
236 'is_active' => [
237 'name' => 'is_active',
238 'type' => CRM_Utils_Type::T_BOOLEAN,
239 'title' => ts('Is Dashlet Active?'),
240 'description' => ts('Is this dashlet active?'),
241 'default' => '0',
242 'table_name' => 'civicrm_dashboard',
243 'entity' => 'Dashboard',
244 'bao' => 'CRM_Core_BAO_Dashboard',
245 'localizable' => 0,
246 ],
247 'is_reserved' => [
248 'name' => 'is_reserved',
249 'type' => CRM_Utils_Type::T_BOOLEAN,
250 'title' => ts('Is Dashlet Reserved?'),
251 'description' => ts('Is this dashlet reserved?'),
252 'default' => '0',
253 'table_name' => 'civicrm_dashboard',
254 'entity' => 'Dashboard',
255 'bao' => 'CRM_Core_BAO_Dashboard',
256 'localizable' => 0,
257 ],
258 'cache_minutes' => [
259 'name' => 'cache_minutes',
260 'type' => CRM_Utils_Type::T_INT,
261 'title' => ts('Cache Minutes'),
262 'description' => ts('Number of minutes to cache dashlet content in browser localStorage.'),
263 'required' => TRUE,
264 'default' => '60',
265 'table_name' => 'civicrm_dashboard',
266 'entity' => 'Dashboard',
267 'bao' => 'CRM_Core_BAO_Dashboard',
268 'localizable' => 0,
269 ],
270 ];
271 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
272 }
273 return Civi::$statics[__CLASS__]['fields'];
274 }
275
276 /**
277 * Return a mapping from field-name to the corresponding key (as used in fields()).
278 *
279 * @return array
280 * Array(string $name => string $uniqueName).
281 */
282 public static function &fieldKeys() {
283 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
284 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
285 }
286 return Civi::$statics[__CLASS__]['fieldKeys'];
287 }
288
289 /**
290 * Returns the names of this table
291 *
292 * @return string
293 */
294 public static function getTableName() {
295 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
296 }
297
298 /**
299 * Returns if this table needs to be logged
300 *
301 * @return bool
302 */
303 public function getLog() {
304 return self::$_log;
305 }
306
307 /**
308 * Returns the list of fields that can be imported
309 *
310 * @param bool $prefix
311 *
312 * @return array
313 */
314 public static function &import($prefix = FALSE) {
315 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard', $prefix, []);
316 return $r;
317 }
318
319 /**
320 * Returns the list of fields that can be exported
321 *
322 * @param bool $prefix
323 *
324 * @return array
325 */
326 public static function &export($prefix = FALSE) {
327 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard', $prefix, []);
328 return $r;
329 }
330
331 /**
332 * Returns the list of indices
333 *
334 * @param bool $localize
335 *
336 * @return array
337 */
338 public static function indices($localize = TRUE) {
339 $indices = [];
340 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
341 }
342
343 }