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