Merge pull request #14274 from seamuslee001/protected_fields_dao
[civicrm-core.git] / CRM / Core / DAO / Dashboard.php
... / ...
CommitLineData
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:fdacca439eb8001e43e3bb4a24465d0e)
10 */
11
12/**
13 * Database access object for the Dashboard entity.
14 */
15class CRM_Core_DAO_Dashboard extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public 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 public 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 'where' => 'civicrm_dashboard.id',
143 'table_name' => 'civicrm_dashboard',
144 'entity' => 'Dashboard',
145 'bao' => 'CRM_Core_BAO_Dashboard',
146 'localizable' => 0,
147 ],
148 'domain_id' => [
149 'name' => 'domain_id',
150 'type' => CRM_Utils_Type::T_INT,
151 'title' => ts('Dashlet Domain'),
152 'description' => ts('Domain for dashboard'),
153 'required' => TRUE,
154 'where' => 'civicrm_dashboard.domain_id',
155 'table_name' => 'civicrm_dashboard',
156 'entity' => 'Dashboard',
157 'bao' => 'CRM_Core_BAO_Dashboard',
158 'localizable' => 0,
159 'FKClassName' => 'CRM_Core_DAO_Domain',
160 'pseudoconstant' => [
161 'table' => 'civicrm_domain',
162 'keyColumn' => 'id',
163 'labelColumn' => 'name',
164 ]
165 ],
166 'name' => [
167 'name' => 'name',
168 'type' => CRM_Utils_Type::T_STRING,
169 'title' => ts('Dashlet Name'),
170 'description' => ts('Internal name of dashlet.'),
171 'maxlength' => 64,
172 'size' => CRM_Utils_Type::BIG,
173 'where' => 'civicrm_dashboard.name',
174 'table_name' => 'civicrm_dashboard',
175 'entity' => 'Dashboard',
176 'bao' => 'CRM_Core_BAO_Dashboard',
177 'localizable' => 0,
178 ],
179 'label' => [
180 'name' => 'label',
181 'type' => CRM_Utils_Type::T_STRING,
182 'title' => ts('Dashlet Title'),
183 'description' => ts('dashlet title'),
184 'maxlength' => 255,
185 'size' => CRM_Utils_Type::HUGE,
186 'where' => 'civicrm_dashboard.label',
187 'table_name' => 'civicrm_dashboard',
188 'entity' => 'Dashboard',
189 'bao' => 'CRM_Core_BAO_Dashboard',
190 'localizable' => 1,
191 ],
192 'url' => [
193 'name' => 'url',
194 'type' => CRM_Utils_Type::T_STRING,
195 'title' => ts('Dashlet URL'),
196 'description' => ts('url in case of external dashlet'),
197 'maxlength' => 255,
198 'size' => CRM_Utils_Type::HUGE,
199 'where' => 'civicrm_dashboard.url',
200 'table_name' => 'civicrm_dashboard',
201 'entity' => 'Dashboard',
202 'bao' => 'CRM_Core_BAO_Dashboard',
203 'localizable' => 0,
204 ],
205 'permission' => [
206 'name' => 'permission',
207 'type' => CRM_Utils_Type::T_STRING,
208 'title' => ts('Dashlet Permission'),
209 'description' => ts('Permission for the dashlet'),
210 'maxlength' => 255,
211 'size' => CRM_Utils_Type::HUGE,
212 'where' => 'civicrm_dashboard.permission',
213 'table_name' => 'civicrm_dashboard',
214 'entity' => 'Dashboard',
215 'bao' => 'CRM_Core_BAO_Dashboard',
216 'localizable' => 0,
217 ],
218 'permission_operator' => [
219 'name' => 'permission_operator',
220 'type' => CRM_Utils_Type::T_STRING,
221 'title' => ts('Dashlet Permission Operator'),
222 'description' => ts('Permission Operator'),
223 'maxlength' => 3,
224 'size' => CRM_Utils_Type::FOUR,
225 'where' => 'civicrm_dashboard.permission_operator',
226 'table_name' => 'civicrm_dashboard',
227 'entity' => 'Dashboard',
228 'bao' => 'CRM_Core_BAO_Dashboard',
229 'localizable' => 0,
230 ],
231 'fullscreen_url' => [
232 'name' => 'fullscreen_url',
233 'type' => CRM_Utils_Type::T_STRING,
234 'title' => ts('Fullscreen URL'),
235 'description' => ts('fullscreen url for dashlet'),
236 'maxlength' => 255,
237 'size' => CRM_Utils_Type::HUGE,
238 'where' => 'civicrm_dashboard.fullscreen_url',
239 'table_name' => 'civicrm_dashboard',
240 'entity' => 'Dashboard',
241 'bao' => 'CRM_Core_BAO_Dashboard',
242 'localizable' => 0,
243 ],
244 'is_active' => [
245 'name' => 'is_active',
246 'type' => CRM_Utils_Type::T_BOOLEAN,
247 'title' => ts('Is Dashlet Active?'),
248 'description' => ts('Is this dashlet active?'),
249 'where' => 'civicrm_dashboard.is_active',
250 'default' => '0',
251 'table_name' => 'civicrm_dashboard',
252 'entity' => 'Dashboard',
253 'bao' => 'CRM_Core_BAO_Dashboard',
254 'localizable' => 0,
255 ],
256 'is_reserved' => [
257 'name' => 'is_reserved',
258 'type' => CRM_Utils_Type::T_BOOLEAN,
259 'title' => ts('Is Dashlet Reserved?'),
260 'description' => ts('Is this dashlet reserved?'),
261 'where' => 'civicrm_dashboard.is_reserved',
262 'default' => '0',
263 'table_name' => 'civicrm_dashboard',
264 'entity' => 'Dashboard',
265 'bao' => 'CRM_Core_BAO_Dashboard',
266 'localizable' => 0,
267 ],
268 'cache_minutes' => [
269 'name' => 'cache_minutes',
270 'type' => CRM_Utils_Type::T_INT,
271 'title' => ts('Cache Minutes'),
272 'description' => ts('Number of minutes to cache dashlet content in browser localStorage.'),
273 'required' => TRUE,
274 'where' => 'civicrm_dashboard.cache_minutes',
275 'default' => '60',
276 'table_name' => 'civicrm_dashboard',
277 'entity' => 'Dashboard',
278 'bao' => 'CRM_Core_BAO_Dashboard',
279 'localizable' => 0,
280 ],
281 ];
282 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
283 }
284 return Civi::$statics[__CLASS__]['fields'];
285 }
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 public 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 /**
301 * Returns the names of this table
302 *
303 * @return string
304 */
305 public static function getTableName() {
306 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
307 }
308
309 /**
310 * Returns if this table needs to be logged
311 *
312 * @return bool
313 */
314 public function getLog() {
315 return self::$_log;
316 }
317
318 /**
319 * Returns the list of fields that can be imported
320 *
321 * @param bool $prefix
322 *
323 * @return array
324 */
325 public static function &import($prefix = FALSE) {
326 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard', $prefix, []);
327 return $r;
328 }
329
330 /**
331 * Returns the list of fields that can be exported
332 *
333 * @param bool $prefix
334 *
335 * @return array
336 */
337 public static function &export($prefix = FALSE) {
338 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard', $prefix, []);
339 return $r;
340 }
341
342 /**
343 * Returns the list of indices
344 *
345 * @param bool $localize
346 *
347 * @return array
348 */
349 public static function indices($localize = TRUE) {
350 $indices = [];
351 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
352 }
353
354}