CRM-19130 - xml/templates/dao.tpl - Fire events for fields() and links()
[civicrm-core.git] / CRM / Core / DAO / Email.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
30 *
31 * Generated from xml/schema/CRM/Core/Email.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:988b68b07a90ff903001c8f68b2e2545)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_Email extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_email';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
e501603b
TO
50 /**
51 * static instance to hold the FK relationships
52 *
53 * @var string
54 */
55 static $_links = null;
e501603b
TO
56 /**
57 * static value to see if we should log any modifications to
58 * this table in the civicrm_log table
59 *
60 * @var boolean
61 */
62 static $_log = true;
63 /**
64 * Unique Email ID
65 *
66 * @var int unsigned
67 */
68 public $id;
69 /**
70 * FK to Contact ID
71 *
72 * @var int unsigned
73 */
74 public $contact_id;
75 /**
76 * Which Location does this email belong to.
77 *
78 * @var int unsigned
79 */
80 public $location_type_id;
81 /**
82 * Email address
83 *
84 * @var string
85 */
86 public $email;
87 /**
88 * Is this the primary?
89 *
90 * @var boolean
91 */
92 public $is_primary;
93 /**
94 * Is this the billing?
95 *
96 * @var boolean
97 */
98 public $is_billing;
99 /**
100 * Is this address on bounce hold?
101 *
102 * @var boolean
103 */
104 public $on_hold;
105 /**
106 * Is this address for bulk mail ?
107 *
108 * @var boolean
109 */
110 public $is_bulkmail;
111 /**
112 * When the address went on bounce hold
113 *
114 * @var datetime
115 */
116 public $hold_date;
117 /**
118 * When the address bounce status was last reset
119 *
120 * @var datetime
121 */
122 public $reset_date;
123 /**
124 * Text formatted signature for the email.
125 *
126 * @var text
127 */
128 public $signature_text;
129 /**
130 * HTML formatted signature for the email.
131 *
132 * @var text
133 */
134 public $signature_html;
135 /**
136 * class constructor
137 *
138 * @return civicrm_email
139 */
140 function __construct() {
141 $this->__table = 'civicrm_email';
142 parent::__construct();
143 }
144 /**
145 * Returns foreign keys and entity references
146 *
147 * @return array
148 * [CRM_Core_Reference_Interface]
149 */
150 static function getReferenceColumns() {
151 if (!self::$_links) {
152 self::$_links = static ::createReferenceColumns(__CLASS__);
153 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
154 }
155 return self::$_links;
156 }
157 /**
158 * Returns all the column names of this table
159 *
160 * @return array
161 */
162 static function &fields() {
163 if (!(self::$_fields)) {
164 self::$_fields = array(
165 'id' => array(
166 'name' => 'id',
167 'type' => CRM_Utils_Type::T_INT,
168 'title' => ts('Email ID') ,
169 'description' => 'Unique Email ID',
170 'required' => true,
171 ) ,
172 'contact_id' => array(
173 'name' => 'contact_id',
174 'type' => CRM_Utils_Type::T_INT,
175 'title' => ts('Email Contact') ,
176 'description' => 'FK to Contact ID',
177 'FKClassName' => 'CRM_Contact_DAO_Contact',
178 ) ,
179 'location_type_id' => array(
180 'name' => 'location_type_id',
181 'type' => CRM_Utils_Type::T_INT,
182 'title' => ts('Email Location Type') ,
183 'description' => 'Which Location does this email belong to.',
184 'html' => array(
185 'type' => 'Select',
186 ) ,
187 'pseudoconstant' => array(
188 'table' => 'civicrm_location_type',
189 'keyColumn' => 'id',
190 'labelColumn' => 'display_name',
191 )
192 ) ,
193 'email' => array(
194 'name' => 'email',
195 'type' => CRM_Utils_Type::T_STRING,
196 'title' => ts('Email') ,
197 'description' => 'Email address',
198 'maxlength' => 254,
199 'size' => 30,
200 'import' => true,
201 'where' => 'civicrm_email.email',
202 'headerPattern' => '/e.?mail/i',
203 'dataPattern' => '/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/',
204 'export' => true,
205 'rule' => 'email',
206 'html' => array(
207 'type' => 'Text',
208 ) ,
209 ) ,
210 'is_primary' => array(
211 'name' => 'is_primary',
212 'type' => CRM_Utils_Type::T_BOOLEAN,
213 'title' => ts('Is Primary email') ,
214 'description' => 'Is this the primary?',
215 ) ,
216 'is_billing' => array(
217 'name' => 'is_billing',
218 'type' => CRM_Utils_Type::T_BOOLEAN,
219 'title' => ts('Is Billing Email?') ,
220 'description' => 'Is this the billing?',
221 ) ,
222 'on_hold' => array(
223 'name' => 'on_hold',
224 'type' => CRM_Utils_Type::T_BOOLEAN,
225 'title' => ts('On Hold') ,
226 'description' => 'Is this address on bounce hold?',
227 'required' => true,
228 'export' => true,
229 'where' => 'civicrm_email.on_hold',
230 'headerPattern' => '',
231 'dataPattern' => '',
232 'html' => array(
233 'type' => 'CheckBox',
234 ) ,
235 ) ,
236 'is_bulkmail' => array(
237 'name' => 'is_bulkmail',
238 'type' => CRM_Utils_Type::T_BOOLEAN,
239 'title' => ts('Use for Bulk Mail') ,
240 'description' => 'Is this address for bulk mail ?',
241 'required' => true,
242 'export' => true,
243 'where' => 'civicrm_email.is_bulkmail',
244 'headerPattern' => '',
245 'dataPattern' => '',
246 ) ,
247 'hold_date' => array(
248 'name' => 'hold_date',
249 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
250 'title' => ts('Hold Date') ,
251 'description' => 'When the address went on bounce hold',
252 ) ,
253 'reset_date' => array(
254 'name' => 'reset_date',
255 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
256 'title' => ts('Reset Date') ,
257 'description' => 'When the address bounce status was last reset',
258 ) ,
259 'signature_text' => array(
260 'name' => 'signature_text',
261 'type' => CRM_Utils_Type::T_TEXT,
262 'title' => ts('Signature Text') ,
263 'description' => 'Text formatted signature for the email.',
264 'import' => true,
265 'where' => 'civicrm_email.signature_text',
266 'headerPattern' => '',
267 'dataPattern' => '',
268 'export' => true,
269 'default' => 'NULL',
270 ) ,
271 'signature_html' => array(
272 'name' => 'signature_html',
273 'type' => CRM_Utils_Type::T_TEXT,
274 'title' => ts('Signature Html') ,
275 'description' => 'HTML formatted signature for the email.',
276 'import' => true,
277 'where' => 'civicrm_email.signature_html',
278 'headerPattern' => '',
279 'dataPattern' => '',
280 'export' => true,
281 'default' => 'NULL',
282 ) ,
283 );
284 }
285 return self::$_fields;
286 }
287 /**
bd8e0b14 288 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
289 *
290 * @return array
bd8e0b14 291 * Array(string $name => string $uniqueName).
e501603b
TO
292 */
293 static function &fieldKeys() {
bd8e0b14
TO
294 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
295 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 296 }
bd8e0b14 297 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
298 }
299 /**
300 * Returns the names of this table
301 *
302 * @return string
303 */
304 static function getTableName() {
305 return self::$_tableName;
306 }
307 /**
308 * Returns if this table needs to be logged
309 *
310 * @return boolean
311 */
312 function getLog() {
313 return self::$_log;
314 }
315 /**
316 * Returns the list of fields that can be imported
317 *
318 * @param bool $prefix
319 *
320 * @return array
321 */
322 static function &import($prefix = false) {
60808919
TO
323 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'email', $prefix, array());
324 return $r;
e501603b
TO
325 }
326 /**
327 * Returns the list of fields that can be exported
328 *
329 * @param bool $prefix
330 *
331 * @return array
332 */
333 static function &export($prefix = false) {
60808919
TO
334 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'email', $prefix, array());
335 return $r;
e501603b
TO
336 }
337}