CRM-14885 - Import DAO's
[civicrm-core.git] / CRM / Friend / DAO / Friend.php
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/Friend/Friend.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:a4644e3a31c87da3c038fb840579e48b)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Friend_DAO_Friend extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_tell_friend';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = false;
83 /**
84 * Friend ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * Name of table where item being referenced is stored.
91 *
92 * @var string
93 */
94 public $entity_table;
95 /**
96 * Foreign key to the referenced item.
97 *
98 * @var int unsigned
99 */
100 public $entity_id;
101 /**
102 *
103 * @var string
104 */
105 public $title;
106 /**
107 * Introductory message to contributor or participant displayed on the Tell a Friend form.
108 *
109 * @var text
110 */
111 public $intro;
112 /**
113 * Suggested message to friends, provided as default on the Tell A Friend form.
114 *
115 * @var text
116 */
117 public $suggested_message;
118 /**
119 * URL for general info about the organization - included in the email sent to friends.
120 *
121 * @var string
122 */
123 public $general_link;
124 /**
125 * Text for Tell a Friend thank you page header and HTML title.
126 *
127 * @var string
128 */
129 public $thankyou_title;
130 /**
131 * Thank you message displayed on success page.
132 *
133 * @var text
134 */
135 public $thankyou_text;
136 /**
137 *
138 * @var boolean
139 */
140 public $is_active;
141 /**
142 * class constructor
143 *
144 * @return civicrm_tell_friend
145 */
146 function __construct() {
147 $this->__table = 'civicrm_tell_friend';
148 parent::__construct();
149 }
150 /**
151 * Returns foreign keys and entity references
152 *
153 * @return array
154 * [CRM_Core_Reference_Interface]
155 */
156 static function getReferenceColumns() {
157 if (!self::$_links) {
158 self::$_links = static ::createReferenceColumns(__CLASS__);
159 self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
160 }
161 return self::$_links;
162 }
163 /**
164 * Returns all the column names of this table
165 *
166 * @return array
167 */
168 static function &fields() {
169 if (!(self::$_fields)) {
170 self::$_fields = array(
171 'id' => array(
172 'name' => 'id',
173 'type' => CRM_Utils_Type::T_INT,
174 'title' => ts('Friend ID') ,
175 'description' => 'Friend ID',
176 'required' => true,
177 ) ,
178 'entity_table' => array(
179 'name' => 'entity_table',
180 'type' => CRM_Utils_Type::T_STRING,
181 'title' => ts('Entity Table') ,
182 'description' => 'Name of table where item being referenced is stored.',
183 'required' => true,
184 'maxlength' => 64,
185 'size' => CRM_Utils_Type::BIG,
186 ) ,
187 'entity_id' => array(
188 'name' => 'entity_id',
189 'type' => CRM_Utils_Type::T_INT,
190 'title' => ts('Entity ID') ,
191 'description' => 'Foreign key to the referenced item.',
192 'required' => true,
193 ) ,
194 'title' => array(
195 'name' => 'title',
196 'type' => CRM_Utils_Type::T_STRING,
197 'title' => ts('Title') ,
198 'maxlength' => 255,
199 'size' => CRM_Utils_Type::HUGE,
200 'html' => array(
201 'type' => 'Text',
202 ) ,
203 ) ,
204 'intro' => array(
205 'name' => 'intro',
206 'type' => CRM_Utils_Type::T_TEXT,
207 'title' => ts('Intro') ,
208 'description' => 'Introductory message to contributor or participant displayed on the Tell a Friend form.',
209 'html' => array(
210 'type' => 'Text',
211 ) ,
212 ) ,
213 'suggested_message' => array(
214 'name' => 'suggested_message',
215 'type' => CRM_Utils_Type::T_TEXT,
216 'title' => ts('Suggested Message') ,
217 'description' => 'Suggested message to friends, provided as default on the Tell A Friend form.',
218 'html' => array(
219 'type' => 'Text',
220 ) ,
221 ) ,
222 'general_link' => array(
223 'name' => 'general_link',
224 'type' => CRM_Utils_Type::T_STRING,
225 'title' => ts('General Link') ,
226 'description' => 'URL for general info about the organization - included in the email sent to friends.',
227 'maxlength' => 255,
228 'size' => CRM_Utils_Type::HUGE,
229 'import' => true,
230 'where' => 'civicrm_tell_friend.general_link',
231 'headerPattern' => '',
232 'dataPattern' => '',
233 'export' => true,
234 'html' => array(
235 'type' => 'Text',
236 ) ,
237 ) ,
238 'thankyou_title' => array(
239 'name' => 'thankyou_title',
240 'type' => CRM_Utils_Type::T_STRING,
241 'title' => ts('Thank You Title') ,
242 'description' => 'Text for Tell a Friend thank you page header and HTML title.',
243 'maxlength' => 255,
244 'size' => CRM_Utils_Type::HUGE,
245 'html' => array(
246 'type' => 'Text',
247 ) ,
248 ) ,
249 'thankyou_text' => array(
250 'name' => 'thankyou_text',
251 'type' => CRM_Utils_Type::T_TEXT,
252 'title' => ts('Thank You Text') ,
253 'description' => 'Thank you message displayed on success page.',
254 'html' => array(
255 'type' => 'Text',
256 ) ,
257 ) ,
258 'is_active' => array(
259 'name' => 'is_active',
260 'type' => CRM_Utils_Type::T_BOOLEAN,
261 'title' => ts('Enabled?') ,
262 'html' => array(
263 'type' => 'CheckBox',
264 ) ,
265 ) ,
266 );
267 }
268 return self::$_fields;
269 }
270 /**
271 * Returns an array containing, for each field, the arary key used for that
272 * field in self::$_fields.
273 *
274 * @return array
275 */
276 static function &fieldKeys() {
277 if (!(self::$_fieldKeys)) {
278 self::$_fieldKeys = array(
279 'id' => 'id',
280 'entity_table' => 'entity_table',
281 'entity_id' => 'entity_id',
282 'title' => 'title',
283 'intro' => 'intro',
284 'suggested_message' => 'suggested_message',
285 'general_link' => 'general_link',
286 'thankyou_title' => 'thankyou_title',
287 'thankyou_text' => 'thankyou_text',
288 'is_active' => 'is_active',
289 );
290 }
291 return self::$_fieldKeys;
292 }
293 /**
294 * Returns the names of this table
295 *
296 * @return string
297 */
298 static function getTableName() {
299 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
300 }
301 /**
302 * Returns if this table needs to be logged
303 *
304 * @return boolean
305 */
306 function getLog() {
307 return self::$_log;
308 }
309 /**
310 * Returns the list of fields that can be imported
311 *
312 * @param bool $prefix
313 *
314 * @return array
315 */
316 static function &import($prefix = false) {
317 if (!(self::$_import)) {
318 self::$_import = array();
319 $fields = self::fields();
320 foreach($fields as $name => $field) {
321 if (CRM_Utils_Array::value('import', $field)) {
322 if ($prefix) {
323 self::$_import['tell_friend'] = & $fields[$name];
324 } else {
325 self::$_import[$name] = & $fields[$name];
326 }
327 }
328 }
329 }
330 return self::$_import;
331 }
332 /**
333 * Returns the list of fields that can be exported
334 *
335 * @param bool $prefix
336 *
337 * @return array
338 */
339 static function &export($prefix = false) {
340 if (!(self::$_export)) {
341 self::$_export = array();
342 $fields = self::fields();
343 foreach($fields as $name => $field) {
344 if (CRM_Utils_Array::value('export', $field)) {
345 if ($prefix) {
346 self::$_export['tell_friend'] = & $fields[$name];
347 } else {
348 self::$_export[$name] = & $fields[$name];
349 }
350 }
351 }
352 }
353 return self::$_export;
354 }
355 }