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