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