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