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