Merge pull request #19565 from ahed-compucorp/add-missing-labels
[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
2cbbebe8 9 * (GenCodeChecksum:11cb89ad6720c440b84d0f60799cc2b2)
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 ],
a9d0587b 128 'add' => '3.1',
c3fc2621
CW
129 ],
130 'dashboard_id' => [
e501603b
TO
131 'name' => 'dashboard_id',
132 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 133 'title' => ts('Dashboard ID'),
215b423e 134 'description' => ts('Dashboard ID'),
c3fc2621 135 'required' => TRUE,
a36434b9 136 'where' => 'civicrm_dashboard_contact.dashboard_id',
522a26c9 137 'table_name' => 'civicrm_dashboard_contact',
138 'entity' => 'DashboardContact',
139 'bao' => 'CRM_Contact_BAO_DashboardContact',
6a7e5e5d 140 'localizable' => 0,
e501603b 141 'FKClassName' => 'CRM_Core_DAO_Dashboard',
2cbbebe8
A
142 'html' => [
143 'label' => ts("Dashboard"),
144 ],
a9d0587b 145 'add' => '3.1',
c3fc2621
CW
146 ],
147 'contact_id' => [
e501603b
TO
148 'name' => 'contact_id',
149 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 150 'title' => ts('Contact ID'),
215b423e 151 'description' => ts('Contact ID'),
c3fc2621 152 'required' => TRUE,
a36434b9 153 'where' => 'civicrm_dashboard_contact.contact_id',
522a26c9 154 'table_name' => 'civicrm_dashboard_contact',
155 'entity' => 'DashboardContact',
156 'bao' => 'CRM_Contact_BAO_DashboardContact',
6a7e5e5d 157 'localizable' => 0,
e501603b 158 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
159 'html' => [
160 'label' => ts("Contact"),
161 ],
a9d0587b 162 'add' => '3.1',
c3fc2621
CW
163 ],
164 'column_no' => [
e501603b 165 'name' => 'column_no',
756d2540 166 'type' => CRM_Utils_Type::T_INT,
c3fc2621 167 'title' => ts('Column No'),
215b423e 168 'description' => ts('column no for this widget'),
a36434b9 169 'where' => 'civicrm_dashboard_contact.column_no',
45a83e42 170 'default' => '0',
522a26c9 171 'table_name' => 'civicrm_dashboard_contact',
172 'entity' => 'DashboardContact',
173 'bao' => 'CRM_Contact_BAO_DashboardContact',
6a7e5e5d 174 'localizable' => 0,
a9d0587b 175 'add' => '3.1',
c3fc2621
CW
176 ],
177 'is_active' => [
e501603b
TO
178 'name' => 'is_active',
179 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 180 'title' => ts('Dashlet is Active?'),
215b423e 181 'description' => ts('Is this widget active?'),
a36434b9 182 'where' => 'civicrm_dashboard_contact.is_active',
45a83e42 183 'default' => '0',
522a26c9 184 'table_name' => 'civicrm_dashboard_contact',
185 'entity' => 'DashboardContact',
186 'bao' => 'CRM_Contact_BAO_DashboardContact',
6a7e5e5d 187 'localizable' => 0,
a9d0587b 188 'add' => '3.1',
c3fc2621
CW
189 ],
190 'weight' => [
e501603b
TO
191 'name' => 'weight',
192 'type' => CRM_Utils_Type::T_INT,
c3fc2621 193 'title' => ts('Order'),
215b423e 194 'description' => ts('Ordering of the widgets.'),
a36434b9 195 'where' => 'civicrm_dashboard_contact.weight',
45a83e42 196 'default' => '0',
522a26c9 197 'table_name' => 'civicrm_dashboard_contact',
198 'entity' => 'DashboardContact',
199 'bao' => 'CRM_Contact_BAO_DashboardContact',
6a7e5e5d 200 'localizable' => 0,
a9d0587b 201 'add' => '3.1',
c3fc2621
CW
202 ],
203 ];
346aaaba 204 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 205 }
346aaaba 206 return Civi::$statics[__CLASS__]['fields'];
e501603b 207 }
c3fc2621 208
e501603b 209 /**
bd8e0b14 210 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
211 *
212 * @return array
bd8e0b14 213 * Array(string $name => string $uniqueName).
e501603b 214 */
c3fc2621 215 public static function &fieldKeys() {
bd8e0b14
TO
216 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
217 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 218 }
bd8e0b14 219 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 220 }
c3fc2621 221
e501603b
TO
222 /**
223 * Returns the names of this table
224 *
225 * @return string
226 */
c3fc2621 227 public static function getTableName() {
e501603b
TO
228 return self::$_tableName;
229 }
c3fc2621 230
e501603b
TO
231 /**
232 * Returns if this table needs to be logged
233 *
c3fc2621 234 * @return bool
e501603b 235 */
c3fc2621 236 public function getLog() {
e501603b
TO
237 return self::$_log;
238 }
c3fc2621 239
e501603b
TO
240 /**
241 * Returns the list of fields that can be imported
242 *
243 * @param bool $prefix
244 *
245 * @return array
246 */
c3fc2621
CW
247 public static function &import($prefix = FALSE) {
248 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard_contact', $prefix, []);
60808919 249 return $r;
e501603b 250 }
c3fc2621 251
e501603b
TO
252 /**
253 * Returns the list of fields that can be exported
254 *
255 * @param bool $prefix
256 *
257 * @return array
258 */
c3fc2621
CW
259 public static function &export($prefix = FALSE) {
260 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard_contact', $prefix, []);
60808919 261 return $r;
e501603b 262 }
c3fc2621 263
e7a6b91a
AS
264 /**
265 * Returns the list of indices
c3fc2621
CW
266 *
267 * @param bool $localize
268 *
269 * @return array
e7a6b91a
AS
270 */
271 public static function indices($localize = TRUE) {
c3fc2621
CW
272 $indices = [
273 'index_dashboard_id_contact_id' => [
e7a6b91a 274 'name' => 'index_dashboard_id_contact_id',
c3fc2621 275 'field' => [
e7a6b91a
AS
276 0 => 'dashboard_id',
277 1 => 'contact_id',
c3fc2621
CW
278 ],
279 'localizable' => FALSE,
280 'unique' => TRUE,
e7a6b91a 281 'sig' => 'civicrm_dashboard_contact::1::dashboard_id::contact_id',
c3fc2621
CW
282 ],
283 ];
e7a6b91a
AS
284 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
285 }
c3fc2621 286
e501603b 287}