CRM-19925 Add Entity data and date format data to fields array on DAO.
[civicrm-core.git] / CRM / Contact / DAO / DashboardContact.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Contact/DashboardContact.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:21ce0d18eb988e90850ba4f5e56c161f)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Contact_DAO_DashboardContact constructor.
39 */
40 class CRM_Contact_DAO_DashboardContact extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_dashboard_contact';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 *
55 * @var int unsigned
56 */
57 public $id;
58 /**
59 * Dashboard ID
60 *
61 * @var int unsigned
62 */
63 public $dashboard_id;
64 /**
65 * Contact ID
66 *
67 * @var int unsigned
68 */
69 public $contact_id;
70 /**
71 * column no for this widget
72 *
73 * @var boolean
74 */
75 public $column_no;
76 /**
77 * Is this widget active?
78 *
79 * @var boolean
80 */
81 public $is_active;
82 /**
83 * Ordering of the widgets.
84 *
85 * @var int
86 */
87 public $weight;
88 /**
89 * Class constructor.
90 */
91 function __construct() {
92 $this->__table = 'civicrm_dashboard_contact';
93 parent::__construct();
94 }
95 /**
96 * Returns foreign keys and entity references.
97 *
98 * @return array
99 * [CRM_Core_Reference_Interface]
100 */
101 static function getReferenceColumns() {
102 if (!isset(Civi::$statics[__CLASS__]['links'])) {
103 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
104 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'dashboard_id', 'civicrm_dashboard', 'id');
105 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
106 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
107 }
108 return Civi::$statics[__CLASS__]['links'];
109 }
110 /**
111 * Returns all the column names of this table
112 *
113 * @return array
114 */
115 static function &fields() {
116 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
117 Civi::$statics[__CLASS__]['fields'] = array(
118 'id' => array(
119 'name' => 'id',
120 'type' => CRM_Utils_Type::T_INT,
121 'title' => ts('Dashboard Contact ID') ,
122 'required' => true,
123 ) ,
124 'dashboard_id' => array(
125 'name' => 'dashboard_id',
126 'type' => CRM_Utils_Type::T_INT,
127 'title' => ts('Dashboard') ,
128 'description' => 'Dashboard ID',
129 'required' => true,
130 'FKClassName' => 'CRM_Core_DAO_Dashboard',
131 ) ,
132 'contact_id' => array(
133 'name' => 'contact_id',
134 'type' => CRM_Utils_Type::T_INT,
135 'title' => ts('Dashboard Contact') ,
136 'description' => 'Contact ID',
137 'required' => true,
138 'FKClassName' => 'CRM_Contact_DAO_Contact',
139 ) ,
140 'column_no' => array(
141 'name' => 'column_no',
142 'type' => CRM_Utils_Type::T_BOOLEAN,
143 'title' => ts('Column No') ,
144 'description' => 'column no for this widget',
145 ) ,
146 'is_active' => array(
147 'name' => 'is_active',
148 'type' => CRM_Utils_Type::T_BOOLEAN,
149 'title' => ts('Dashlet is Active?') ,
150 'description' => 'Is this widget active?',
151 ) ,
152 'weight' => array(
153 'name' => 'weight',
154 'type' => CRM_Utils_Type::T_INT,
155 'title' => ts('Order') ,
156 'description' => 'Ordering of the widgets.',
157 ) ,
158 );
159 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
160 }
161 return Civi::$statics[__CLASS__]['fields'];
162 }
163 /**
164 * Return a mapping from field-name to the corresponding key (as used in fields()).
165 *
166 * @return array
167 * Array(string $name => string $uniqueName).
168 */
169 static function &fieldKeys() {
170 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
171 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
172 }
173 return Civi::$statics[__CLASS__]['fieldKeys'];
174 }
175 /**
176 * Returns the names of this table
177 *
178 * @return string
179 */
180 static function getTableName() {
181 return self::$_tableName;
182 }
183 /**
184 * Returns if this table needs to be logged
185 *
186 * @return boolean
187 */
188 function getLog() {
189 return self::$_log;
190 }
191 /**
192 * Returns the list of fields that can be imported
193 *
194 * @param bool $prefix
195 *
196 * @return array
197 */
198 static function &import($prefix = false) {
199 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard_contact', $prefix, array());
200 return $r;
201 }
202 /**
203 * Returns the list of fields that can be exported
204 *
205 * @param bool $prefix
206 *
207 * @return array
208 */
209 static function &export($prefix = false) {
210 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard_contact', $prefix, array());
211 return $r;
212 }
213 }