CRM-14885 - Import DAO's
[civicrm-core.git] / CRM / Member / DAO / MembershipBlock.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/Member/MembershipBlock.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:7b3991d790ed45fb4be2f9d4de4389da)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Member_DAO_MembershipBlock extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_membership_block';
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 = true;
83 /**
84 * Membership Id
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * Name for Membership Status
91 *
92 * @var string
93 */
94 public $entity_table;
95 /**
96 * FK to civicrm_contribution_page.id
97 *
98 * @var int unsigned
99 */
100 public $entity_id;
101 /**
102 * Membership types to be exposed by this block
103 *
104 * @var string
105 */
106 public $membership_types;
107 /**
108 * Optional foreign key to membership_type
109 *
110 * @var int unsigned
111 */
112 public $membership_type_default;
113 /**
114 * Display minimum membership fee
115 *
116 * @var boolean
117 */
118 public $display_min_fee;
119 /**
120 * Should membership transactions be processed separately
121 *
122 * @var boolean
123 */
124 public $is_separate_payment;
125 /**
126 * Title to display at top of block
127 *
128 * @var string
129 */
130 public $new_title;
131 /**
132 * Text to display below title
133 *
134 * @var text
135 */
136 public $new_text;
137 /**
138 * Title for renewal
139 *
140 * @var string
141 */
142 public $renewal_title;
143 /**
144 * Text to display for member renewal
145 *
146 * @var text
147 */
148 public $renewal_text;
149 /**
150 * Is membership sign up optional
151 *
152 * @var boolean
153 */
154 public $is_required;
155 /**
156 * Is this membership_block enabled
157 *
158 * @var boolean
159 */
160 public $is_active;
161 /**
162 * class constructor
163 *
164 * @return civicrm_membership_block
165 */
166 function __construct() {
167 $this->__table = 'civicrm_membership_block';
168 parent::__construct();
169 }
170 /**
171 * Returns foreign keys and entity references
172 *
173 * @return array
174 * [CRM_Core_Reference_Interface]
175 */
176 static function getReferenceColumns() {
177 if (!self::$_links) {
178 self::$_links = static ::createReferenceColumns(__CLASS__);
179 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'entity_id', 'civicrm_contribution_page', 'id');
180 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_default', 'civicrm_membership_type', 'id');
181 }
182 return self::$_links;
183 }
184 /**
185 * Returns all the column names of this table
186 *
187 * @return array
188 */
189 static function &fields() {
190 if (!(self::$_fields)) {
191 self::$_fields = array(
192 'id' => array(
193 'name' => 'id',
194 'type' => CRM_Utils_Type::T_INT,
195 'title' => ts('Membership Block ID') ,
196 'description' => 'Membership Id',
197 'required' => true,
198 ) ,
199 'entity_table' => array(
200 'name' => 'entity_table',
201 'type' => CRM_Utils_Type::T_STRING,
202 'title' => ts('Membership Block Entity Table') ,
203 'description' => 'Name for Membership Status',
204 'maxlength' => 64,
205 'size' => CRM_Utils_Type::BIG,
206 ) ,
207 'entity_id' => array(
208 'name' => 'entity_id',
209 'type' => CRM_Utils_Type::T_INT,
210 'title' => ts('Membership Block Entity ID') ,
211 'description' => 'FK to civicrm_contribution_page.id',
212 'required' => true,
213 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
214 ) ,
215 'membership_types' => array(
216 'name' => 'membership_types',
217 'type' => CRM_Utils_Type::T_STRING,
218 'title' => ts('Membership Block Membership Types') ,
219 'description' => 'Membership types to be exposed by this block',
220 'maxlength' => 1024,
221 'size' => CRM_Utils_Type::HUGE,
222 ) ,
223 'membership_type_default' => array(
224 'name' => 'membership_type_default',
225 'type' => CRM_Utils_Type::T_INT,
226 'title' => ts('Membership Block Default Type') ,
227 'description' => 'Optional foreign key to membership_type',
228 'FKClassName' => 'CRM_Member_DAO_MembershipType',
229 ) ,
230 'display_min_fee' => array(
231 'name' => 'display_min_fee',
232 'type' => CRM_Utils_Type::T_BOOLEAN,
233 'title' => ts('Membership Block Display Minimum Fee') ,
234 'description' => 'Display minimum membership fee',
235 'default' => '1',
236 ) ,
237 'is_separate_payment' => array(
238 'name' => 'is_separate_payment',
239 'type' => CRM_Utils_Type::T_BOOLEAN,
240 'title' => ts('Membership Block Is Separate Payment') ,
241 'description' => 'Should membership transactions be processed separately',
242 'default' => '1',
243 ) ,
244 'new_title' => array(
245 'name' => 'new_title',
246 'type' => CRM_Utils_Type::T_STRING,
247 'title' => ts('Membership Block New Title') ,
248 'description' => 'Title to display at top of block',
249 'maxlength' => 255,
250 'size' => CRM_Utils_Type::HUGE,
251 ) ,
252 'new_text' => array(
253 'name' => 'new_text',
254 'type' => CRM_Utils_Type::T_TEXT,
255 'title' => ts('Membership Block New Text') ,
256 'description' => 'Text to display below title',
257 ) ,
258 'renewal_title' => array(
259 'name' => 'renewal_title',
260 'type' => CRM_Utils_Type::T_STRING,
261 'title' => ts('Membership Block Renewal Title') ,
262 'description' => 'Title for renewal',
263 'maxlength' => 255,
264 'size' => CRM_Utils_Type::HUGE,
265 ) ,
266 'renewal_text' => array(
267 'name' => 'renewal_text',
268 'type' => CRM_Utils_Type::T_TEXT,
269 'title' => ts('Membership Block Renewal Text') ,
270 'description' => 'Text to display for member renewal',
271 ) ,
272 'is_required' => array(
273 'name' => 'is_required',
274 'type' => CRM_Utils_Type::T_BOOLEAN,
275 'title' => ts('Is Required') ,
276 'description' => 'Is membership sign up optional',
277 ) ,
278 'is_active' => array(
279 'name' => 'is_active',
280 'type' => CRM_Utils_Type::T_BOOLEAN,
281 'title' => ts('Is Active') ,
282 'description' => 'Is this membership_block enabled',
283 'default' => '1',
284 ) ,
285 );
286 }
287 return self::$_fields;
288 }
289 /**
290 * Returns an array containing, for each field, the arary key used for that
291 * field in self::$_fields.
292 *
293 * @return array
294 */
295 static function &fieldKeys() {
296 if (!(self::$_fieldKeys)) {
297 self::$_fieldKeys = array(
298 'id' => 'id',
299 'entity_table' => 'entity_table',
300 'entity_id' => 'entity_id',
301 'membership_types' => 'membership_types',
302 'membership_type_default' => 'membership_type_default',
303 'display_min_fee' => 'display_min_fee',
304 'is_separate_payment' => 'is_separate_payment',
305 'new_title' => 'new_title',
306 'new_text' => 'new_text',
307 'renewal_title' => 'renewal_title',
308 'renewal_text' => 'renewal_text',
309 'is_required' => 'is_required',
310 'is_active' => 'is_active',
311 );
312 }
313 return self::$_fieldKeys;
314 }
315 /**
316 * Returns the names of this table
317 *
318 * @return string
319 */
320 static function getTableName() {
321 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
322 }
323 /**
324 * Returns if this table needs to be logged
325 *
326 * @return boolean
327 */
328 function getLog() {
329 return self::$_log;
330 }
331 /**
332 * Returns the list of fields that can be imported
333 *
334 * @param bool $prefix
335 *
336 * @return array
337 */
338 static function &import($prefix = false) {
339 if (!(self::$_import)) {
340 self::$_import = array();
341 $fields = self::fields();
342 foreach($fields as $name => $field) {
343 if (CRM_Utils_Array::value('import', $field)) {
344 if ($prefix) {
345 self::$_import['membership_block'] = & $fields[$name];
346 } else {
347 self::$_import[$name] = & $fields[$name];
348 }
349 }
350 }
351 }
352 return self::$_import;
353 }
354 /**
355 * Returns the list of fields that can be exported
356 *
357 * @param bool $prefix
358 *
359 * @return array
360 */
361 static function &export($prefix = false) {
362 if (!(self::$_export)) {
363 self::$_export = array();
364 $fields = self::fields();
365 foreach($fields as $name => $field) {
366 if (CRM_Utils_Array::value('export', $field)) {
367 if ($prefix) {
368 self::$_export['membership_block'] = & $fields[$name];
369 } else {
370 self::$_export[$name] = & $fields[$name];
371 }
372 }
373 }
374 }
375 return self::$_export;
376 }
377 }