Upgrade age_asof_date to datepicker in search
[civicrm-core.git] / CRM / Contact / DAO / DashboardContact.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Contact/DashboardContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:f9be53bdf3d5151edf77e9b9f9004571)
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 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 static $_log = FALSE;
30
31 /**
32 * @var int unsigned
33 */
34 public $id;
35
36 /**
37 * Dashboard ID
38 *
39 * @var int unsigned
40 */
41 public $dashboard_id;
42
43 /**
44 * Contact ID
45 *
46 * @var int unsigned
47 */
48 public $contact_id;
49
50 /**
51 * column no for this widget
52 *
53 * @var boolean
54 */
55 public $column_no;
56
57 /**
58 * Is this widget active?
59 *
60 * @var boolean
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 'table_name' => 'civicrm_dashboard_contact',
109 'entity' => 'DashboardContact',
110 'bao' => 'CRM_Contact_BAO_DashboardContact',
111 'localizable' => 0,
112 ],
113 'dashboard_id' => [
114 'name' => 'dashboard_id',
115 'type' => CRM_Utils_Type::T_INT,
116 'title' => ts('Dashboard'),
117 'description' => ts('Dashboard ID'),
118 'required' => TRUE,
119 'table_name' => 'civicrm_dashboard_contact',
120 'entity' => 'DashboardContact',
121 'bao' => 'CRM_Contact_BAO_DashboardContact',
122 'localizable' => 0,
123 'FKClassName' => 'CRM_Core_DAO_Dashboard',
124 ],
125 'contact_id' => [
126 'name' => 'contact_id',
127 'type' => CRM_Utils_Type::T_INT,
128 'title' => ts('Dashboard Contact'),
129 'description' => ts('Contact ID'),
130 'required' => TRUE,
131 'table_name' => 'civicrm_dashboard_contact',
132 'entity' => 'DashboardContact',
133 'bao' => 'CRM_Contact_BAO_DashboardContact',
134 'localizable' => 0,
135 'FKClassName' => 'CRM_Contact_DAO_Contact',
136 ],
137 'column_no' => [
138 'name' => 'column_no',
139 'type' => CRM_Utils_Type::T_BOOLEAN,
140 'title' => ts('Column No'),
141 'description' => ts('column no for this widget'),
142 'default' => '0',
143 'table_name' => 'civicrm_dashboard_contact',
144 'entity' => 'DashboardContact',
145 'bao' => 'CRM_Contact_BAO_DashboardContact',
146 'localizable' => 0,
147 ],
148 'is_active' => [
149 'name' => 'is_active',
150 'type' => CRM_Utils_Type::T_BOOLEAN,
151 'title' => ts('Dashlet is Active?'),
152 'description' => ts('Is this widget active?'),
153 'default' => '0',
154 'table_name' => 'civicrm_dashboard_contact',
155 'entity' => 'DashboardContact',
156 'bao' => 'CRM_Contact_BAO_DashboardContact',
157 'localizable' => 0,
158 ],
159 'weight' => [
160 'name' => 'weight',
161 'type' => CRM_Utils_Type::T_INT,
162 'title' => ts('Order'),
163 'description' => ts('Ordering of the widgets.'),
164 'default' => '0',
165 'table_name' => 'civicrm_dashboard_contact',
166 'entity' => 'DashboardContact',
167 'bao' => 'CRM_Contact_BAO_DashboardContact',
168 'localizable' => 0,
169 ],
170 ];
171 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
172 }
173 return Civi::$statics[__CLASS__]['fields'];
174 }
175
176 /**
177 * Return a mapping from field-name to the corresponding key (as used in fields()).
178 *
179 * @return array
180 * Array(string $name => string $uniqueName).
181 */
182 public static function &fieldKeys() {
183 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
184 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
185 }
186 return Civi::$statics[__CLASS__]['fieldKeys'];
187 }
188
189 /**
190 * Returns the names of this table
191 *
192 * @return string
193 */
194 public static function getTableName() {
195 return self::$_tableName;
196 }
197
198 /**
199 * Returns if this table needs to be logged
200 *
201 * @return bool
202 */
203 public function getLog() {
204 return self::$_log;
205 }
206
207 /**
208 * Returns the list of fields that can be imported
209 *
210 * @param bool $prefix
211 *
212 * @return array
213 */
214 public static function &import($prefix = FALSE) {
215 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard_contact', $prefix, []);
216 return $r;
217 }
218
219 /**
220 * Returns the list of fields that can be exported
221 *
222 * @param bool $prefix
223 *
224 * @return array
225 */
226 public static function &export($prefix = FALSE) {
227 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard_contact', $prefix, []);
228 return $r;
229 }
230
231 /**
232 * Returns the list of indices
233 *
234 * @param bool $localize
235 *
236 * @return array
237 */
238 public static function indices($localize = TRUE) {
239 $indices = [
240 'index_dashboard_id_contact_id' => [
241 'name' => 'index_dashboard_id_contact_id',
242 'field' => [
243 0 => 'dashboard_id',
244 1 => 'contact_id',
245 ],
246 'localizable' => FALSE,
247 'unique' => TRUE,
248 'sig' => 'civicrm_dashboard_contact::1::dashboard_id::contact_id',
249 ],
250 ];
251 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
252 }
253
254 }