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