Commit | Line | Data |
---|---|---|
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/Contribute/Premium.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:c84ce7b79339fc7842fe872fe75eccc1) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Contribute_DAO_Premium extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_premiums'; | |
e501603b TO |
44 | /** |
45 | * static value to see if we should log any modifications to | |
46 | * this table in the civicrm_log table | |
47 | * | |
48 | * @var boolean | |
49 | */ | |
50 | static $_log = true; | |
51 | /** | |
52 | * | |
53 | * @var int unsigned | |
54 | */ | |
55 | public $id; | |
56 | /** | |
57 | * Joins these premium settings to another object. Always civicrm_contribution_page for now. | |
58 | * | |
59 | * @var string | |
60 | */ | |
61 | public $entity_table; | |
62 | /** | |
63 | * | |
64 | * @var int unsigned | |
65 | */ | |
66 | public $entity_id; | |
67 | /** | |
68 | * Is the Premiums feature enabled for this page? | |
69 | * | |
70 | * @var boolean | |
71 | */ | |
72 | public $premiums_active; | |
73 | /** | |
74 | * Title for Premiums section. | |
75 | * | |
76 | * @var string | |
77 | */ | |
78 | public $premiums_intro_title; | |
79 | /** | |
80 | * Displayed in <div> at top of Premiums section of page. Text and HTML allowed. | |
81 | * | |
82 | * @var text | |
83 | */ | |
84 | public $premiums_intro_text; | |
85 | /** | |
86 | * This email address is included in receipts if it is populated and a premium has been selected. | |
87 | * | |
88 | * @var string | |
89 | */ | |
90 | public $premiums_contact_email; | |
91 | /** | |
92 | * This phone number is included in receipts if it is populated and a premium has been selected. | |
93 | * | |
94 | * @var string | |
95 | */ | |
96 | public $premiums_contact_phone; | |
97 | /** | |
98 | * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions. | |
99 | * | |
100 | * @var boolean | |
101 | */ | |
102 | public $premiums_display_min_contribution; | |
103 | /** | |
104 | * Label displayed for No Thank-you option in premiums block (e.g. No thank you) | |
105 | * | |
106 | * @var string | |
107 | */ | |
108 | public $premiums_nothankyou_label; | |
109 | /** | |
110 | * | |
111 | * @var int unsigned | |
112 | */ | |
113 | public $premiums_nothankyou_position; | |
114 | /** | |
115 | * class constructor | |
116 | * | |
117 | * @return civicrm_premiums | |
118 | */ | |
119 | function __construct() { | |
120 | $this->__table = 'civicrm_premiums'; | |
121 | parent::__construct(); | |
122 | } | |
123 | /** | |
124 | * Returns foreign keys and entity references | |
125 | * | |
126 | * @return array | |
127 | * [CRM_Core_Reference_Interface] | |
128 | */ | |
129 | static function getReferenceColumns() { | |
346aaaba TO |
130 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
131 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
132 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); | |
133 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 134 | } |
346aaaba | 135 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
136 | } |
137 | /** | |
138 | * Returns all the column names of this table | |
139 | * | |
140 | * @return array | |
141 | */ | |
142 | static function &fields() { | |
346aaaba TO |
143 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
144 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
145 | 'id' => array( |
146 | 'name' => 'id', | |
147 | 'type' => CRM_Utils_Type::T_INT, | |
148 | 'title' => ts('Premium ID') , | |
149 | 'required' => true, | |
150 | ) , | |
151 | 'entity_table' => array( | |
152 | 'name' => 'entity_table', | |
153 | 'type' => CRM_Utils_Type::T_STRING, | |
154 | 'title' => ts('Premium Entity') , | |
155 | 'description' => 'Joins these premium settings to another object. Always civicrm_contribution_page for now.', | |
156 | 'required' => true, | |
157 | 'maxlength' => 64, | |
158 | 'size' => CRM_Utils_Type::BIG, | |
159 | ) , | |
160 | 'entity_id' => array( | |
161 | 'name' => 'entity_id', | |
162 | 'type' => CRM_Utils_Type::T_INT, | |
163 | 'title' => ts('Premium entity ID') , | |
164 | 'required' => true, | |
165 | ) , | |
166 | 'premiums_active' => array( | |
167 | 'name' => 'premiums_active', | |
168 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
169 | 'title' => ts('Is Premium Active?') , | |
170 | 'description' => 'Is the Premiums feature enabled for this page?', | |
171 | 'required' => true, | |
172 | ) , | |
173 | 'premiums_intro_title' => array( | |
174 | 'name' => 'premiums_intro_title', | |
175 | 'type' => CRM_Utils_Type::T_STRING, | |
176 | 'title' => ts('Title for Premiums section') , | |
177 | 'description' => 'Title for Premiums section.', | |
178 | 'maxlength' => 255, | |
179 | 'size' => CRM_Utils_Type::HUGE, | |
180 | ) , | |
181 | 'premiums_intro_text' => array( | |
182 | 'name' => 'premiums_intro_text', | |
183 | 'type' => CRM_Utils_Type::T_TEXT, | |
184 | 'title' => ts('Premium Introductory Text') , | |
185 | 'description' => 'Displayed in <div> at top of Premiums section of page. Text and HTML allowed.', | |
186 | ) , | |
187 | 'premiums_contact_email' => array( | |
188 | 'name' => 'premiums_contact_email', | |
189 | 'type' => CRM_Utils_Type::T_STRING, | |
190 | 'title' => ts('Premium Contact Email') , | |
191 | 'description' => 'This email address is included in receipts if it is populated and a premium has been selected.', | |
192 | 'maxlength' => 100, | |
193 | 'size' => CRM_Utils_Type::HUGE, | |
194 | ) , | |
195 | 'premiums_contact_phone' => array( | |
196 | 'name' => 'premiums_contact_phone', | |
197 | 'type' => CRM_Utils_Type::T_STRING, | |
198 | 'title' => ts('Premiums Contact Phone') , | |
199 | 'description' => 'This phone number is included in receipts if it is populated and a premium has been selected.', | |
200 | 'maxlength' => 50, | |
201 | 'size' => CRM_Utils_Type::BIG, | |
202 | ) , | |
203 | 'premiums_display_min_contribution' => array( | |
204 | 'name' => 'premiums_display_min_contribution', | |
205 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
206 | 'title' => ts('Display Minimum Contribution?') , | |
207 | 'description' => 'Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.', | |
208 | 'required' => true, | |
209 | ) , | |
210 | 'premiums_nothankyou_label' => array( | |
211 | 'name' => 'premiums_nothankyou_label', | |
212 | 'type' => CRM_Utils_Type::T_STRING, | |
213 | 'title' => ts('No Thank-you Text') , | |
214 | 'description' => 'Label displayed for No Thank-you option in premiums block (e.g. No thank you)', | |
215 | 'maxlength' => 255, | |
216 | 'size' => CRM_Utils_Type::HUGE, | |
217 | ) , | |
218 | 'premiums_nothankyou_position' => array( | |
219 | 'name' => 'premiums_nothankyou_position', | |
220 | 'type' => CRM_Utils_Type::T_INT, | |
221 | 'title' => ts('No Thank-you Position') , | |
222 | 'default' => '1', | |
223 | ) , | |
224 | ); | |
346aaaba | 225 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 226 | } |
346aaaba | 227 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
228 | } |
229 | /** | |
bd8e0b14 | 230 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
231 | * |
232 | * @return array | |
bd8e0b14 | 233 | * Array(string $name => string $uniqueName). |
e501603b TO |
234 | */ |
235 | static function &fieldKeys() { | |
bd8e0b14 TO |
236 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
237 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 238 | } |
bd8e0b14 | 239 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
240 | } |
241 | /** | |
242 | * Returns the names of this table | |
243 | * | |
244 | * @return string | |
245 | */ | |
246 | static function getTableName() { | |
247 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); | |
248 | } | |
249 | /** | |
250 | * Returns if this table needs to be logged | |
251 | * | |
252 | * @return boolean | |
253 | */ | |
254 | function getLog() { | |
255 | return self::$_log; | |
256 | } | |
257 | /** | |
258 | * Returns the list of fields that can be imported | |
259 | * | |
260 | * @param bool $prefix | |
261 | * | |
262 | * @return array | |
263 | */ | |
264 | static function &import($prefix = false) { | |
60808919 TO |
265 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums', $prefix, array()); |
266 | return $r; | |
e501603b TO |
267 | } |
268 | /** | |
269 | * Returns the list of fields that can be exported | |
270 | * | |
271 | * @param bool $prefix | |
272 | * | |
273 | * @return array | |
274 | */ | |
275 | static function &export($prefix = false) { | |
60808919 TO |
276 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums', $prefix, array()); |
277 | return $r; | |
e501603b TO |
278 | } |
279 | } |