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