Merge pull request #20368 from eileenmcnaughton/cc
[civicrm-core.git] / CRM / Contact / DAO / DashboardContact.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Contact/DashboardContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
88c31c05 9 * (GenCodeChecksum:61c7e21d25723963142a22bca0a4840e)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the DashboardContact entity.
f41f0342 14 */
e501603b 15class CRM_Contact_DAO_DashboardContact extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.1';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_dashboard_contact';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b 33 /**
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Dashboard ID
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $dashboard_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Contact ID
47 *
e6ca0a57 48 * @var int
e501603b
TO
49 */
50 public $contact_id;
c3fc2621 51
e501603b
TO
52 /**
53 * column no for this widget
54 *
756d2540 55 * @var int
e501603b
TO
56 */
57 public $column_no;
c3fc2621 58
e501603b
TO
59 /**
60 * Is this widget active?
61 *
e6ca0a57 62 * @var bool
e501603b
TO
63 */
64 public $is_active;
c3fc2621 65
e501603b
TO
66 /**
67 * Ordering of the widgets.
68 *
69 * @var int
70 */
71 public $weight;
c3fc2621 72
e501603b 73 /**
f41f0342 74 * Class constructor.
e501603b 75 */
c3fc2621 76 public function __construct() {
e501603b
TO
77 $this->__table = 'civicrm_dashboard_contact';
78 parent::__construct();
79 }
c3fc2621 80
449c4e6b
CW
81 /**
82 * Returns localized title of this entity.
7b66c3b5
AH
83 *
84 * @param bool $plural
85 * Whether to return the plural version of the title.
449c4e6b 86 */
7b66c3b5
AH
87 public static function getEntityTitle($plural = FALSE) {
88 return $plural ? ts('Dashboard Contacts') : ts('Dashboard Contact');
449c4e6b
CW
89 }
90
e501603b 91 /**
f41f0342 92 * Returns foreign keys and entity references.
e501603b
TO
93 *
94 * @return array
95 * [CRM_Core_Reference_Interface]
96 */
c3fc2621 97 public static function getReferenceColumns() {
346aaaba 98 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 99 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
100 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'dashboard_id', 'civicrm_dashboard', 'id');
101 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
346aaaba 102 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 103 }
346aaaba 104 return Civi::$statics[__CLASS__]['links'];
e501603b 105 }
c3fc2621 106
e501603b
TO
107 /**
108 * Returns all the column names of this table
109 *
110 * @return array
111 */
c3fc2621 112 public static function &fields() {
346aaaba 113 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
114 Civi::$statics[__CLASS__]['fields'] = [
115 'id' => [
e501603b
TO
116 'name' => 'id',
117 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
118 'title' => ts('Dashboard Contact ID'),
119 'required' => TRUE,
a36434b9 120 'where' => 'civicrm_dashboard_contact.id',
522a26c9 121 'table_name' => 'civicrm_dashboard_contact',
122 'entity' => 'DashboardContact',
123 'bao' => 'CRM_Contact_BAO_DashboardContact',
6a7e5e5d 124 'localizable' => 0,
2cbbebe8
A
125 'html' => [
126 'type' => 'Number',
127 ],
1fe423d6 128 'readonly' => TRUE,
a9d0587b 129 'add' => '3.1',
c3fc2621
CW
130 ],
131 'dashboard_id' => [
e501603b
TO
132 'name' => 'dashboard_id',
133 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 134 'title' => ts('Dashboard ID'),
215b423e 135 'description' => ts('Dashboard ID'),
c3fc2621 136 'required' => TRUE,
a36434b9 137 'where' => 'civicrm_dashboard_contact.dashboard_id',
522a26c9 138 'table_name' => 'civicrm_dashboard_contact',
139 'entity' => 'DashboardContact',
140 'bao' => 'CRM_Contact_BAO_DashboardContact',
6a7e5e5d 141 'localizable' => 0,
e501603b 142 'FKClassName' => 'CRM_Core_DAO_Dashboard',
2cbbebe8
A
143 'html' => [
144 'label' => ts("Dashboard"),
145 ],
a9d0587b 146 'add' => '3.1',
c3fc2621
CW
147 ],
148 'contact_id' => [
e501603b
TO
149 'name' => 'contact_id',
150 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 151 'title' => ts('Contact ID'),
215b423e 152 'description' => ts('Contact ID'),
c3fc2621 153 'required' => TRUE,
a36434b9 154 'where' => 'civicrm_dashboard_contact.contact_id',
522a26c9 155 'table_name' => 'civicrm_dashboard_contact',
156 'entity' => 'DashboardContact',
157 'bao' => 'CRM_Contact_BAO_DashboardContact',
6a7e5e5d 158 'localizable' => 0,
e501603b 159 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
160 'html' => [
161 'label' => ts("Contact"),
162 ],
a9d0587b 163 'add' => '3.1',
c3fc2621
CW
164 ],
165 'column_no' => [
e501603b 166 'name' => 'column_no',
756d2540 167 'type' => CRM_Utils_Type::T_INT,
c3fc2621 168 'title' => ts('Column No'),
215b423e 169 'description' => ts('column no for this widget'),
a36434b9 170 'where' => 'civicrm_dashboard_contact.column_no',
45a83e42 171 'default' => '0',
522a26c9 172 'table_name' => 'civicrm_dashboard_contact',
173 'entity' => 'DashboardContact',
174 'bao' => 'CRM_Contact_BAO_DashboardContact',
6a7e5e5d 175 'localizable' => 0,
c23563e3
SL
176 'html' => [
177 'label' => ts("Column Number"),
178 ],
a9d0587b 179 'add' => '3.1',
c3fc2621
CW
180 ],
181 'is_active' => [
e501603b
TO
182 'name' => 'is_active',
183 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 184 'title' => ts('Dashlet is Active?'),
215b423e 185 'description' => ts('Is this widget active?'),
a36434b9 186 'where' => 'civicrm_dashboard_contact.is_active',
45a83e42 187 'default' => '0',
522a26c9 188 'table_name' => 'civicrm_dashboard_contact',
189 'entity' => 'DashboardContact',
190 'bao' => 'CRM_Contact_BAO_DashboardContact',
6a7e5e5d 191 'localizable' => 0,
a9d0587b 192 'add' => '3.1',
c3fc2621
CW
193 ],
194 'weight' => [
e501603b
TO
195 'name' => 'weight',
196 'type' => CRM_Utils_Type::T_INT,
c3fc2621 197 'title' => ts('Order'),
215b423e 198 'description' => ts('Ordering of the widgets.'),
a36434b9 199 'where' => 'civicrm_dashboard_contact.weight',
45a83e42 200 'default' => '0',
522a26c9 201 'table_name' => 'civicrm_dashboard_contact',
202 'entity' => 'DashboardContact',
203 'bao' => 'CRM_Contact_BAO_DashboardContact',
6a7e5e5d 204 'localizable' => 0,
a9d0587b 205 'add' => '3.1',
c3fc2621
CW
206 ],
207 ];
346aaaba 208 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 209 }
346aaaba 210 return Civi::$statics[__CLASS__]['fields'];
e501603b 211 }
c3fc2621 212
e501603b 213 /**
bd8e0b14 214 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
215 *
216 * @return array
bd8e0b14 217 * Array(string $name => string $uniqueName).
e501603b 218 */
c3fc2621 219 public static function &fieldKeys() {
bd8e0b14
TO
220 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
221 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 222 }
bd8e0b14 223 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 224 }
c3fc2621 225
e501603b
TO
226 /**
227 * Returns the names of this table
228 *
229 * @return string
230 */
c3fc2621 231 public static function getTableName() {
e501603b
TO
232 return self::$_tableName;
233 }
c3fc2621 234
e501603b
TO
235 /**
236 * Returns if this table needs to be logged
237 *
c3fc2621 238 * @return bool
e501603b 239 */
c3fc2621 240 public function getLog() {
e501603b
TO
241 return self::$_log;
242 }
c3fc2621 243
e501603b
TO
244 /**
245 * Returns the list of fields that can be imported
246 *
247 * @param bool $prefix
248 *
249 * @return array
250 */
c3fc2621
CW
251 public static function &import($prefix = FALSE) {
252 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard_contact', $prefix, []);
60808919 253 return $r;
e501603b 254 }
c3fc2621 255
e501603b
TO
256 /**
257 * Returns the list of fields that can be exported
258 *
259 * @param bool $prefix
260 *
261 * @return array
262 */
c3fc2621
CW
263 public static function &export($prefix = FALSE) {
264 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard_contact', $prefix, []);
60808919 265 return $r;
e501603b 266 }
c3fc2621 267
e7a6b91a
AS
268 /**
269 * Returns the list of indices
c3fc2621
CW
270 *
271 * @param bool $localize
272 *
273 * @return array
e7a6b91a
AS
274 */
275 public static function indices($localize = TRUE) {
c3fc2621
CW
276 $indices = [
277 'index_dashboard_id_contact_id' => [
e7a6b91a 278 'name' => 'index_dashboard_id_contact_id',
c3fc2621 279 'field' => [
e7a6b91a
AS
280 0 => 'dashboard_id',
281 1 => 'contact_id',
c3fc2621
CW
282 ],
283 'localizable' => FALSE,
284 'unique' => TRUE,
e7a6b91a 285 'sig' => 'civicrm_dashboard_contact::1::dashboard_id::contact_id',
c3fc2621
CW
286 ],
287 ];
e7a6b91a
AS
288 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
289 }
c3fc2621 290
e501603b 291}