Commit | Line | Data |
---|---|---|
13e70378 J |
1 | <?php |
2 | /* | |
bccdda02 J |
3 | +--------------------------------------------------------------------+ |
4 | | CiviCRM Widget Creation Interface (WCI) Version 1.0 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright Zyxware Technologies (c) 2014 | | |
7 | +--------------------------------------------------------------------+ | |
8 | | This file is a part of CiviCRM WCI. | | |
9 | | | | |
10 | | CiviCRM WCI is free software; you can copy, modify, and distribute | | |
11 | | it under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007. | | |
13 | | | | |
14 | | CiviCRM WCI is distributed in the hope that it will be useful, | | |
15 | | but 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 along with this program; if not, contact Zyxware | | |
21 | | Technologies at info[AT]zyxware[DOT]com. | | |
22 | +--------------------------------------------------------------------+ | |
13e70378 | 23 | */ |
bccdda02 | 24 | |
13e70378 J |
25 | /** |
26 | * | |
27 | * @package CRM | |
28 | * @copyright CiviCRM LLC (c) 2004-2013 | |
29 | */ | |
30 | class CRM_Wci_DAO_EmbedCode extends CRM_Core_DAO | |
31 | { | |
32 | /** | |
33 | * static instance to hold the table name | |
34 | * | |
35 | * @var string | |
36 | * @static | |
37 | */ | |
38 | static $_tableName = 'civicrm_wci_embed_code'; | |
39 | /** | |
40 | * static instance to hold the field values | |
41 | * | |
42 | * @var array | |
43 | * @static | |
44 | */ | |
45 | static $_fields = null; | |
46 | /** | |
47 | * static instance to hold the keys used in $_fields for each field. | |
48 | * | |
49 | * @var array | |
50 | * @static | |
51 | */ | |
52 | static $_fieldKeys = null; | |
53 | /** | |
54 | * static instance to hold the FK relationships | |
55 | * | |
56 | * @var string | |
57 | * @static | |
58 | */ | |
59 | static $_links = null; | |
60 | /** | |
61 | * static instance to hold the values that can | |
62 | * be imported | |
63 | * | |
64 | * @var array | |
65 | * @static | |
66 | */ | |
67 | static $_import = null; | |
68 | /** | |
69 | * static instance to hold the values that can | |
70 | * be exported | |
71 | * | |
72 | * @var array | |
73 | * @static | |
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 | * @static | |
82 | */ | |
83 | static $_log = true; | |
84 | /** | |
85 | * Embed code Id | |
86 | * | |
87 | * @var int unsigned | |
88 | */ | |
89 | public $id; | |
90 | /** | |
91 | * Name of embed cide | |
92 | * | |
93 | * @var string | |
94 | */ | |
95 | public $name; | |
96 | /** | |
97 | * widget id | |
98 | * | |
99 | * @var float | |
100 | */ | |
101 | public $widget_id; | |
bccdda02 | 102 | |
13e70378 J |
103 | function __construct() |
104 | { | |
105 | $this->__table = 'civicrm_wci_embed_code'; | |
106 | parent::__construct(); | |
107 | } | |
108 | /** | |
109 | * return foreign keys and entity references | |
110 | * | |
111 | * @static | |
112 | * @access public | |
113 | * @return array of CRM_Core_EntityReference | |
114 | */ | |
115 | static function getReferenceColumns() | |
116 | { | |
117 | return self::$_links; | |
118 | } | |
119 | /** | |
120 | * returns all the column names of this table | |
121 | * | |
122 | * @access public | |
123 | * @return array | |
124 | */ | |
125 | static function &fields() | |
126 | { | |
127 | if (!(self::$_fields)) { | |
128 | self::$_fields = array( | |
129 | 'embed_code_id' => array( | |
130 | 'name' => 'id', | |
131 | 'type' => CRM_Utils_Type::T_INT, | |
dcd2221d | 132 | 'title' => ts('WCI embed code Id', array('domain' => 'com.zyxware.civiwci')) , |
13e70378 J |
133 | 'required' => true, |
134 | ) , | |
135 | 'name' => array( | |
136 | 'name' => 'name', | |
137 | 'type' => CRM_Utils_Type::T_STRING, | |
dcd2221d | 138 | 'title' => ts('embed cide Name', array('domain' => 'com.zyxware.civiwci')) , |
13e70378 J |
139 | 'required' => true, |
140 | 'maxlength' => 64, | |
141 | ) , | |
142 | 'widget_id' => array( | |
143 | 'name' => 'widget_id', | |
144 | 'type' => CRM_Utils_Type::T_INT, | |
145 | 'required' => false, | |
146 | ) , | |
147 | ); | |
148 | } | |
149 | return self::$_fields; | |
150 | } | |
151 | /** | |
152 | * Returns an array containing, for each field, the arary key used for that | |
153 | * field in self::$_fields. | |
154 | * | |
155 | * @access public | |
156 | * @return array | |
157 | */ | |
158 | static function &fieldKeys() | |
159 | { | |
160 | if (!(self::$_fieldKeys)) { | |
161 | self::$_fieldKeys = array( | |
162 | 'id' => 'progress_bar_id', | |
163 | 'name' => 'name', | |
164 | 'widget_id' => 'widget_id', | |
165 | ); | |
166 | } | |
167 | return self::$_fieldKeys; | |
168 | } | |
169 | /** | |
170 | * returns the names of this table | |
171 | * | |
172 | * @access public | |
173 | * @static | |
174 | * @return string | |
175 | */ | |
176 | static function getTableName() | |
177 | { | |
178 | return self::$_tableName; | |
179 | } | |
180 | /** | |
181 | * returns if this table needs to be logged | |
182 | * | |
183 | * @access public | |
184 | * @return boolean | |
185 | */ | |
186 | function getLog() | |
187 | { | |
188 | return self::$_log; | |
189 | } | |
190 | /** | |
191 | * returns the list of fields that can be imported | |
192 | * | |
193 | * @access public | |
194 | * return array | |
195 | * @static | |
196 | */ | |
197 | static function &import($prefix = false) | |
198 | { | |
199 | if (!(self::$_import)) { | |
200 | self::$_import = array(); | |
201 | $fields = self::fields(); | |
202 | foreach($fields as $name => $field) { | |
203 | if (CRM_Utils_Array::value('import', $field)) { | |
204 | if ($prefix) { | |
205 | self::$_import['wci_progress_bar'] = & $fields[$name]; | |
206 | } else { | |
207 | self::$_import[$name] = & $fields[$name]; | |
208 | } | |
209 | } | |
210 | } | |
211 | } | |
212 | return self::$_import; | |
213 | } | |
214 | /** | |
215 | * returns the list of fields that can be exported | |
216 | * | |
217 | * @access public | |
218 | * return array | |
219 | * @static | |
220 | */ | |
221 | static function &export($prefix = false) | |
222 | { | |
223 | if (!(self::$_export)) { | |
224 | self::$_export = array(); | |
225 | $fields = self::fields(); | |
226 | foreach($fields as $name => $field) { | |
227 | if (CRM_Utils_Array::value('export', $field)) { | |
228 | if ($prefix) { | |
229 | self::$_export['wci_progress_bar'] = & $fields[$name]; | |
230 | } else { | |
231 | self::$_export[$name] = & $fields[$name]; | |
232 | } | |
233 | } | |
234 | } | |
235 | } | |
236 | return self::$_export; | |
237 | } | |
238 | } |