Version Notes
Fixed some bugs of version 0.3.0
Download this release
Release Info
Developer | Prakash Vaniya |
Extension | Phxsolution_Formbuilder |
Version | 0.3.1 |
Comparing to | |
See all releases |
Code changes from version 0.3.0 to 0.3.1
- app/code/community/Phxsolution/Formbuilder/Block/Adminhtml/Formbuilder/Renderer/Recordvalue.php +4 -9
- app/code/community/Phxsolution/Formbuilder/controllers-7-8-15/Adminhtml/FormbuilderController.php +0 -409
- app/code/community/Phxsolution/Formbuilder/controllers-7-8-15/IndexController.php +0 -571
- app/code/community/Phxsolution/Formbuilder/controllers/IndexController.php +75 -69
- app/code/community/Phxsolution/Formbuilder/etc/config.xml +2 -2
- app/code/community/Phxsolution/Formbuilder/etc/system.xml-7-8-15 +0 -204
- app/design/adminhtml/default/default/layout/formbuilder.xml +4 -41
- app/design/frontend/base/default/layout/formbuilder.xml +1 -21
- app/etc/modules/Phxsolution_Formbuilder.xml +2 -2
- package.xml +7 -7
app/code/community/Phxsolution/Formbuilder/Block/Adminhtml/Formbuilder/Renderer/Recordvalue.php
CHANGED
@@ -27,10 +27,6 @@
|
|
27 |
<?php
|
28 |
class Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Renderer_Recordvalue extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
29 |
{
|
30 |
-
public function test($test)
|
31 |
-
{
|
32 |
-
return "hello ".$test;
|
33 |
-
}
|
34 |
public function render(Varien_Object $row, $recordId=0, $fieldId=0, $serializedValue=0)
|
35 |
{
|
36 |
/*$recordId = intval($row->getData('records_index'));
|
@@ -89,12 +85,11 @@ class Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Renderer_Recordvalue e
|
|
89 |
if ($gd === false)
|
90 |
return "Image seems corrupted or not found";
|
91 |
//else
|
92 |
-
$html = '<img height=75 width=
|
93 |
-
$html .= 'src="'. Mage::getBaseUrl('media') . $returnValue . '"';
|
94 |
-
$html .= 'class="grid-image '
|
95 |
-
$html .= 'style="
|
96 |
return $html;
|
97 |
-
|
98 |
}
|
99 |
else
|
100 |
return $returnValue;
|
27 |
<?php
|
28 |
class Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Renderer_Recordvalue extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
29 |
{
|
|
|
|
|
|
|
|
|
30 |
public function render(Varien_Object $row, $recordId=0, $fieldId=0, $serializedValue=0)
|
31 |
{
|
32 |
/*$recordId = intval($row->getData('records_index'));
|
85 |
if ($gd === false)
|
86 |
return "Image seems corrupted or not found";
|
87 |
//else
|
88 |
+
$html = '<img height=75 width=150 ';
|
89 |
+
$html .= 'src="'. Mage::getBaseUrl('media') . $returnValue . '" ';
|
90 |
+
$html .= 'class="grid-image" ';
|
91 |
+
$html .= 'style="max-height:75px;max-width:150px" />';
|
92 |
return $html;
|
|
|
93 |
}
|
94 |
else
|
95 |
return $returnValue;
|
app/code/community/Phxsolution/Formbuilder/controllers-7-8-15/Adminhtml/FormbuilderController.php
DELETED
@@ -1,409 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
/**
|
4 |
-
* Phxsolution Formbuilder
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/osl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
-
*
|
16 |
-
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
-
*
|
18 |
-
* @category adminhtml controller
|
19 |
-
* @package Phxsolution_Formbuilder
|
20 |
-
* @author Murad Ali
|
21 |
-
* @contact contact@phxsolution.com
|
22 |
-
* @site www.phxsolution.com
|
23 |
-
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php
|
28 |
-
class Phxsolution_Formbuilder_Adminhtml_FormbuilderController extends Mage_Adminhtml_Controller_Action
|
29 |
-
{
|
30 |
-
//this is ajax grid request action
|
31 |
-
public function fieldsgridAction()
|
32 |
-
{
|
33 |
-
echo $this->getLayout()->createBlock('formbuilder/adminhtml_formbuilder_edit_tab_fieldsgrid')->toHtml();
|
34 |
-
}
|
35 |
-
public function recordsgridAction()
|
36 |
-
{
|
37 |
-
$this->loadLayout();
|
38 |
-
$this->_addContent($this->getLayout()->createBlock('formbuilder/adminhtml_formbuilder_edit_tab_recordsgrid'));
|
39 |
-
$this->renderLayout();
|
40 |
-
//echo $this->getLayout()->createBlock('formbuilder/adminhtml_formbuilder_edit_tab_fieldsgrid')->toHtml();
|
41 |
-
}
|
42 |
-
public function optionsAction()
|
43 |
-
{
|
44 |
-
$this->loadLayout();
|
45 |
-
$this->renderLayout();
|
46 |
-
}
|
47 |
-
public function getBaseTmpMediaUrl()
|
48 |
-
{
|
49 |
-
return Mage::getBaseUrl('media') . 'formbuilder';
|
50 |
-
}
|
51 |
-
public function getBaseTmpMediaPath()
|
52 |
-
{
|
53 |
-
return Mage::getBaseDir('media') . DS . 'formbuilder';
|
54 |
-
}
|
55 |
-
protected function _initAction()
|
56 |
-
{
|
57 |
-
$this->loadLayout()
|
58 |
-
->_setActiveMenu('formbuilder/items')
|
59 |
-
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Form Manager'));
|
60 |
-
|
61 |
-
return $this;
|
62 |
-
}
|
63 |
-
public function indexAction()
|
64 |
-
{
|
65 |
-
$this->_initAction()
|
66 |
-
//$this->getLayout()->getBlock('head')->setTitle($this->__('Banner'));
|
67 |
-
->renderLayout();
|
68 |
-
}
|
69 |
-
/*public function editAction()
|
70 |
-
{
|
71 |
-
$id = $this->getRequest()->getParam('id');
|
72 |
-
$model = Mage::getModel('formbuilder/forms')->load($id);
|
73 |
-
|
74 |
-
if ($model->getId() || $id == 0)
|
75 |
-
{
|
76 |
-
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
77 |
-
if (!empty($data))
|
78 |
-
{
|
79 |
-
$model->setData($data);
|
80 |
-
}
|
81 |
-
//echo '<pre>';
|
82 |
-
//$model->setData('stores',json_decode($model->getData('stores')));
|
83 |
-
//print_R($model->getData());exit;
|
84 |
-
Mage::register('formbuilder_data', $model);
|
85 |
-
|
86 |
-
$this->loadLayout();
|
87 |
-
$this->_setActiveMenu('formbuilder/items');
|
88 |
-
|
89 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Form Manager'), Mage::helper('adminhtml')->__('Form Manager'));
|
90 |
-
|
91 |
-
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
92 |
-
|
93 |
-
$this->_addContent($this->getLayout()->createBlock('formbuilder/adminhtml_formbuilder_edit'))
|
94 |
-
->_addLeft($this->getLayout()->createBlock('formbuilder/adminhtml_formbuilder_edit_tabs'));
|
95 |
-
|
96 |
-
$this->renderLayout();
|
97 |
-
}
|
98 |
-
else
|
99 |
-
{
|
100 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('formbuilder')->__('Form does not exist'));
|
101 |
-
$this->_redirect('*//**//*');
|
102 |
-
}
|
103 |
-
}
|
104 |
-
public function newAction()
|
105 |
-
{
|
106 |
-
$this->_title($this->__('New Form'));
|
107 |
-
|
108 |
-
$_model = Mage::getModel('formbuilder/forms');
|
109 |
-
Mage::register('formbuilder_data', $_model);
|
110 |
-
Mage::register('current_Form', $_model);
|
111 |
-
|
112 |
-
$this->_initAction();
|
113 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Form Manager'), Mage::helper('adminhtml')->__('Form Manager'), $this->getUrl('*'));
|
114 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Add Form'), Mage::helper('adminhtml')->__('Add Form'));
|
115 |
-
|
116 |
-
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
117 |
-
|
118 |
-
$this->_addContent($this->getLayout()->createBlock('formbuilder/adminhtml_formbuilder_edit'))
|
119 |
-
->_addLeft($this->getLayout()->createBlock('formbuilder/adminhtml_formbuilder_edit_tabs'));
|
120 |
-
|
121 |
-
$this->renderLayout();
|
122 |
-
}*/
|
123 |
-
public function editAction()
|
124 |
-
{
|
125 |
-
$this->_title($this->__("Form"));
|
126 |
-
$this->_title($this->__("Form Listing"));
|
127 |
-
$this->_title($this->__("Edit Form"));
|
128 |
-
|
129 |
-
$id = $this->getRequest()->getParam("id");
|
130 |
-
$model = Mage::getModel("formbuilder/forms")->load($id);
|
131 |
-
|
132 |
-
//echo "model->getFormsIndex() = ".$model->getFormsIndex();
|
133 |
-
//exit();
|
134 |
-
|
135 |
-
if ($model->getFormsIndex() || $id==0)
|
136 |
-
{
|
137 |
-
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
138 |
-
if (!empty($data))
|
139 |
-
{
|
140 |
-
$model->setData($data);
|
141 |
-
}
|
142 |
-
Mage::register("formbuilder_data", $model);
|
143 |
-
$this->loadLayout();
|
144 |
-
$this->_setActiveMenu("formbuilder/items");
|
145 |
-
$this->_addBreadcrumb(Mage::helper("adminhtml")->__("Form Manager"), Mage::helper("adminhtml")->__("Form Manager"));
|
146 |
-
$this->_addBreadcrumb(Mage::helper("adminhtml")->__("Form Description"), Mage::helper("adminhtml")->__("Form Description"));
|
147 |
-
$this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
|
148 |
-
$this->_addContent($this->getLayout()->createBlock("formbuilder/adminhtml_formbuilder_edit"))->_addLeft($this->getLayout()->createBlock("formbuilder/adminhtml_formbuilder_edit_tabs"));
|
149 |
-
$this->renderLayout();
|
150 |
-
}
|
151 |
-
else {
|
152 |
-
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("formbuilder")->__("Form does not exist."));
|
153 |
-
$this->_redirect("*/*/");
|
154 |
-
}
|
155 |
-
}
|
156 |
-
public function newAction()
|
157 |
-
{
|
158 |
-
$this->_title($this->__("Form"));
|
159 |
-
//$this->_title($this->__("Form"));
|
160 |
-
$this->_title($this->__("New Form"));
|
161 |
-
|
162 |
-
$id = $this->getRequest()->getParam("id");
|
163 |
-
$model = Mage::getModel("formbuilder/forms")->load($id);
|
164 |
-
|
165 |
-
$data = Mage::getSingleton("adminhtml/session")->getFormData(true);
|
166 |
-
if (!empty($data)) {
|
167 |
-
$model->setData($data);
|
168 |
-
}
|
169 |
-
Mage::register("formbuilder_data", $model);
|
170 |
-
|
171 |
-
$this->loadLayout();
|
172 |
-
$this->_setActiveMenu("formbuilder/items");
|
173 |
-
|
174 |
-
$this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
|
175 |
-
|
176 |
-
$this->_addBreadcrumb(Mage::helper("adminhtml")->__("Form Manager"), Mage::helper("adminhtml")->__("Form Manager"));
|
177 |
-
$this->_addBreadcrumb(Mage::helper("adminhtml")->__("Form Description"), Mage::helper("adminhtml")->__("Form Description"));
|
178 |
-
|
179 |
-
$this->_addContent($this->getLayout()->createBlock("formbuilder/adminhtml_formbuilder_edit"))->_addLeft($this->getLayout()->createBlock("formbuilder/adminhtml_formbuilder_edit_tabs"));
|
180 |
-
|
181 |
-
$this->renderLayout();
|
182 |
-
}
|
183 |
-
public function saveAction()
|
184 |
-
{
|
185 |
-
if ($data = $this->getRequest()->getPost())
|
186 |
-
{
|
187 |
-
/*echo "<pre>";
|
188 |
-
print_r($data);
|
189 |
-
echo "</pre>";
|
190 |
-
exit();*/
|
191 |
-
|
192 |
-
$model = Mage::getModel("formbuilder/forms")->load($this->getRequest()->getParam("id"));
|
193 |
-
$currentFormId = $this->getRequest()->getParam("id");
|
194 |
-
|
195 |
-
//save image
|
196 |
-
try
|
197 |
-
{
|
198 |
-
if((bool)$data['title_image']['delete']==1)
|
199 |
-
{
|
200 |
-
$data['title_image']='';
|
201 |
-
}
|
202 |
-
else
|
203 |
-
{
|
204 |
-
unset($data['title_image']);
|
205 |
-
if (isset($_FILES))
|
206 |
-
{
|
207 |
-
if ($_FILES['title_image']['name'])
|
208 |
-
{
|
209 |
-
if($this->getRequest()->getParam("id"))
|
210 |
-
{
|
211 |
-
//$model = Mage::getModel("formbuilder/forms")->load($this->getRequest()->getParam("id"));
|
212 |
-
if($model->getData('title_image'))
|
213 |
-
{
|
214 |
-
$io = new Varien_Io_File();
|
215 |
-
$io->rm(Mage::getBaseDir('media').DS.implode(DS,explode('/',$model->getData('title_image'))));
|
216 |
-
}
|
217 |
-
}
|
218 |
-
$path = Mage::getBaseDir('media') . DS . 'formbuilder/images' . DS;
|
219 |
-
$uploader = new Varien_File_Uploader('title_image');
|
220 |
-
$uploader->setAllowedExtensions(array('jpg','png','gif'));
|
221 |
-
$uploader->setAllowRenameFiles(false);
|
222 |
-
$uploader->setFilesDispersion(false);
|
223 |
-
$destFile = $path.$_FILES['title_image']['name'];
|
224 |
-
$filename = $uploader->getNewFileName($destFile);
|
225 |
-
$uploader->save($path, $filename);
|
226 |
-
|
227 |
-
$data['title_image']='formbuilder/images/'.$filename;
|
228 |
-
}
|
229 |
-
}
|
230 |
-
}
|
231 |
-
}
|
232 |
-
catch (Exception $e)
|
233 |
-
{
|
234 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
235 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
236 |
-
return;
|
237 |
-
}
|
238 |
-
//save image ends
|
239 |
-
try
|
240 |
-
{
|
241 |
-
//$model = Mage::getModel("formbuilder/forms")->load($this->getRequest()->getParam("id"));
|
242 |
-
if(isset($data['stores']) && !empty($data['stores']))
|
243 |
-
{
|
244 |
-
if(in_array('0',$data['stores'])){
|
245 |
-
$data['stores'] = array(0);
|
246 |
-
}
|
247 |
-
//$stores = Mage::helper('core')->jsonEncode($data['stores']);
|
248 |
-
$data['stores'] = implode(',',$data['stores']);
|
249 |
-
}
|
250 |
-
if ($model->getCreatedTime() == NULL)
|
251 |
-
{
|
252 |
-
$data['created_time'] = now();
|
253 |
-
}
|
254 |
-
$data['update_time'] = now();
|
255 |
-
|
256 |
-
/*$fieldsModel = Mage::helper('formbuilder')->getFieldsModel();
|
257 |
-
$getFieldsCollection = $fieldsModel->getFieldsCollection($currentFormId);
|
258 |
-
$getNoOfFields = count($getFieldsCollection);
|
259 |
-
$data['no_of_fields'] = $getNoOfFields;*/
|
260 |
-
|
261 |
-
/*if($data['title']=='' || $data['title']==NULL)
|
262 |
-
$data['title'] = $model['title'];*/
|
263 |
-
|
264 |
-
/*$data['title'] = $data['in_toplinks'];
|
265 |
-
$data['title_image'] = $data['in_menu'];*/
|
266 |
-
|
267 |
-
$model->addData($data)
|
268 |
-
->setFormsIndex($this->getRequest()->getParam("id"))
|
269 |
-
->save();
|
270 |
-
|
271 |
-
if(!$currentFormId)
|
272 |
-
$currentFormId = $model->getFormsIndex();
|
273 |
-
// saveFields
|
274 |
-
$fieldsArray = $data['product']['options'];
|
275 |
-
//Mage::helper('formbuilder')->saveFields($fieldsArray);
|
276 |
-
$fieldsModel = Mage::helper('formbuilder')->getFieldsModel();
|
277 |
-
$fieldsModel->saveFields($fieldsArray,$currentFormId);
|
278 |
-
// saveFields
|
279 |
-
|
280 |
-
//save no of fields
|
281 |
-
$fieldsModel = Mage::helper('formbuilder')->getFieldsModel();
|
282 |
-
$getFieldsCollection = $fieldsModel->getFieldsCollection($currentFormId);
|
283 |
-
$getNoOfFields = count($getFieldsCollection);
|
284 |
-
//$data['no_of_fields'] = $getNoOfFields;
|
285 |
-
$formsModel = Mage::helper('formbuilder')->getFormsModel();
|
286 |
-
$formsModel->load($currentFormId);
|
287 |
-
$formsModel->setNoOfFields($getNoOfFields);
|
288 |
-
$formsModel->save();
|
289 |
-
//save no of fields ends
|
290 |
-
|
291 |
-
//$this->createCmsPage($model);
|
292 |
-
|
293 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('formbuilder')->__('Form was successfully saved'));
|
294 |
-
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
295 |
-
|
296 |
-
if ($this->getRequest()->getParam('back')) {
|
297 |
-
$this->_redirect('*/*/edit', array('id' => $model->getFormsIndex()));
|
298 |
-
return;
|
299 |
-
}
|
300 |
-
$this->_redirect('*/*/');
|
301 |
-
return;
|
302 |
-
}
|
303 |
-
catch (Exception $e)
|
304 |
-
{
|
305 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
306 |
-
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
307 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
308 |
-
return;
|
309 |
-
}
|
310 |
-
}
|
311 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('formbuilder')->__('Unable to find Form to save'));
|
312 |
-
$this->_redirect('*/*/');
|
313 |
-
}
|
314 |
-
public function createCmsPage($currentModel)
|
315 |
-
{
|
316 |
-
$title = $currentModel['title'];
|
317 |
-
$identifier = strtolower($title);
|
318 |
-
$identifier = str_replace(" ","-",$identifier);
|
319 |
-
|
320 |
-
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
321 |
-
$cmsPage = array(
|
322 |
-
'title' => $title,
|
323 |
-
'identifier' => $identifier,
|
324 |
-
'content' => '{{block type="formbuilder/frontend_form" name="frontend_form" template="formbuilder/form.phtml"}}',
|
325 |
-
'is_active' => 1,
|
326 |
-
'sort_order' => 0,
|
327 |
-
'stores' => array(0),
|
328 |
-
'root_template' => 'one_column'
|
329 |
-
);
|
330 |
-
Mage::getModel('cms/page')->setData($cmsPage)->save();
|
331 |
-
}
|
332 |
-
public function deleteAction()
|
333 |
-
{
|
334 |
-
if( $this->getRequest()->getParam('id') > 0 )
|
335 |
-
{
|
336 |
-
try
|
337 |
-
{
|
338 |
-
$model = Mage::getModel('formbuilder/forms');
|
339 |
-
|
340 |
-
$model->setFormsIndex($this->getRequest()->getParam('id'))
|
341 |
-
->delete();
|
342 |
-
|
343 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Form was successfully deleted'));
|
344 |
-
$this->_redirect('*/*/');
|
345 |
-
}
|
346 |
-
catch (Exception $e)
|
347 |
-
{
|
348 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
349 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
350 |
-
}
|
351 |
-
}
|
352 |
-
$this->_redirect('*/*/');
|
353 |
-
}
|
354 |
-
public function massDeleteAction()
|
355 |
-
{
|
356 |
-
$formbuilderIds = $this->getRequest()->getParam('formbuilder');
|
357 |
-
if(!is_array($formbuilderIds))
|
358 |
-
{
|
359 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select Form(s)'));
|
360 |
-
}
|
361 |
-
else
|
362 |
-
{
|
363 |
-
try
|
364 |
-
{
|
365 |
-
foreach ($formbuilderIds as $formbuilderId)
|
366 |
-
{
|
367 |
-
$formbuilder = Mage::getModel('formbuilder/forms')->load($formbuilderId);
|
368 |
-
$formbuilder->delete();
|
369 |
-
}
|
370 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(
|
371 |
-
Mage::helper('adminhtml')->__('Total of %d record(s) were successfully deleted', count($formbuilderIds)));
|
372 |
-
}
|
373 |
-
catch (Exception $e)
|
374 |
-
{
|
375 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
376 |
-
}
|
377 |
-
}
|
378 |
-
$this->_redirect('*/*/index');
|
379 |
-
}
|
380 |
-
public function massStatusAction()
|
381 |
-
{
|
382 |
-
$formbuilderIds = $this->getRequest()->getParam('formbuilder');
|
383 |
-
if(!is_array($formbuilderIds))
|
384 |
-
{
|
385 |
-
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select Form(s)'));
|
386 |
-
}
|
387 |
-
else
|
388 |
-
{
|
389 |
-
try
|
390 |
-
{
|
391 |
-
foreach ($formbuilderIds as $formbuilderId)
|
392 |
-
{
|
393 |
-
$formbuilder = Mage::getSingleton('formbuilder/forms')
|
394 |
-
->load($formbuilderId)
|
395 |
-
->setStatus($this->getRequest()->getParam('status'))
|
396 |
-
->setIsMassupdate(true)
|
397 |
-
->save();
|
398 |
-
}
|
399 |
-
$this->_getSession()->addSuccess(
|
400 |
-
$this->__('Total of %d record(s) were successfully updated', count($formbuilderIds)));
|
401 |
-
}
|
402 |
-
catch (Exception $e)
|
403 |
-
{
|
404 |
-
$this->_getSession()->addError($e->getMessage());
|
405 |
-
}
|
406 |
-
}
|
407 |
-
$this->_redirect('*/*/index');
|
408 |
-
}
|
409 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Phxsolution/Formbuilder/controllers-7-8-15/IndexController.php
DELETED
@@ -1,571 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
/**
|
4 |
-
* Phxsolution Formbuilder
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/osl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
-
*
|
16 |
-
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
-
*
|
18 |
-
* @category frontend controller
|
19 |
-
* @package Phxsolution_Formbuilder
|
20 |
-
* @author Murad Ali
|
21 |
-
* @contact contact@phxsolution.com
|
22 |
-
* @site www.phxsolution.com
|
23 |
-
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php
|
28 |
-
class Phxsolution_Formbuilder_IndexController extends Mage_Core_Controller_Front_Action
|
29 |
-
{
|
30 |
-
protected $_errors = array();
|
31 |
-
protected $_fieldsModel;
|
32 |
-
protected $_fieldTitle;
|
33 |
-
protected $_currentFormId;
|
34 |
-
protected $_fileType;
|
35 |
-
protected $_recordsModel;
|
36 |
-
protected $_fileObject;
|
37 |
-
|
38 |
-
public function preDispatch()
|
39 |
-
{
|
40 |
-
parent::preDispatch();
|
41 |
-
if(!Mage::helper('formbuilder')->isEnabled())
|
42 |
-
{
|
43 |
-
//$this->_redirectUrl(Mage::helper('core/url')->getHomeUrl());
|
44 |
-
$helper = Mage::helper('formbuilder');
|
45 |
-
$session = Mage::getSingleton('core/session');
|
46 |
-
$session->addError($helper->__("Formbuilder Extension seems disabled."));
|
47 |
-
}
|
48 |
-
}
|
49 |
-
public function indexAction()
|
50 |
-
{
|
51 |
-
$this->loadLayout();
|
52 |
-
$this->getLayout()->getBlock("head")->setTitle($this->__("Formbuilder"));
|
53 |
-
|
54 |
-
$breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
|
55 |
-
$breadcrumbs->addCrumb("home", array(
|
56 |
-
"label" => $this->__("Home"),
|
57 |
-
"title" => $this->__("Home"),
|
58 |
-
"link" => Mage::getBaseUrl()
|
59 |
-
));
|
60 |
-
$breadcrumbs->addCrumb("formbuilder", array(
|
61 |
-
"label" => $this->__("Formbuilder"),
|
62 |
-
"title" => $this->__("Formbuilder")
|
63 |
-
));
|
64 |
-
$this->renderLayout();
|
65 |
-
}
|
66 |
-
public function viewAction()
|
67 |
-
{
|
68 |
-
$id = $this->getRequest()->getParam('id');
|
69 |
-
$formsModel = Mage::helper('formbuilder')->getFormsModel();
|
70 |
-
$formsModel->load($id);
|
71 |
-
if(empty($formsModel['forms_index']))
|
72 |
-
{
|
73 |
-
Mage::getSingleton('core/session')->addError('Form not found');
|
74 |
-
//$this->_redirectUrl(Mage::helper('core/url')->getHomeUrl());
|
75 |
-
$this->_redirectUrl( Mage::getUrl('formbuilder') );
|
76 |
-
}
|
77 |
-
Mage::register('frontend_form',$formsModel);
|
78 |
-
|
79 |
-
$this->loadLayout();
|
80 |
-
|
81 |
-
$this->_currentFormId = intval($id);
|
82 |
-
$currentForm = Mage::helper('formbuilder')->getCurrentFormDetails($this->_currentFormId);
|
83 |
-
$currentFormTitle = "";
|
84 |
-
$currentFormTitle = $currentForm['title'];
|
85 |
-
|
86 |
-
if($currentFormTitle)
|
87 |
-
$this->getLayout()->getBlock("head")->setTitle($this->__($currentFormTitle));
|
88 |
-
else
|
89 |
-
$this->getLayout()->getBlock("head")->setTitle($this->__("Formbuilder"));
|
90 |
-
|
91 |
-
$breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
|
92 |
-
$breadcrumbs->addCrumb("home", array(
|
93 |
-
"label" => $this->__("Home"),
|
94 |
-
"title" => $this->__("Home"),
|
95 |
-
"link" => Mage::getBaseUrl()
|
96 |
-
));
|
97 |
-
if($currentFormTitle)
|
98 |
-
{
|
99 |
-
$breadcrumbs->addCrumb("formbuilder", array(
|
100 |
-
"label" => $this->__("Formbuilder"),
|
101 |
-
"title" => $this->__("Formbuilder"),
|
102 |
-
"link" => Mage::getUrl('formbuilder')
|
103 |
-
));
|
104 |
-
$breadcrumbs->addCrumb($currentFormTitle, array(
|
105 |
-
"label" => $this->__($currentFormTitle),
|
106 |
-
"title" => $this->__($currentFormTitle)
|
107 |
-
));
|
108 |
-
}
|
109 |
-
else
|
110 |
-
{
|
111 |
-
$breadcrumbs->addCrumb("formbuilder", array(
|
112 |
-
"label" => $this->__("Formbuilder"),
|
113 |
-
"title" => $this->__("Formbuilder")
|
114 |
-
));
|
115 |
-
}
|
116 |
-
$this->renderLayout();
|
117 |
-
}
|
118 |
-
public function checkEmpty($value)
|
119 |
-
{
|
120 |
-
$error = false;
|
121 |
-
if(!Zend_Validate::is($value, 'NotEmpty'))
|
122 |
-
$error = $this->_helper->__("'".$this->_fieldTitle."'".' is a required field');
|
123 |
-
return $error;
|
124 |
-
}
|
125 |
-
public function checkLength($value,$lengthLimit)
|
126 |
-
{
|
127 |
-
$error = false;
|
128 |
-
if(strlen($value)>$lengthLimit)
|
129 |
-
$error = $this->_helper->__("'".$this->_fieldTitle."'".' text length must be less then or equal to '.$lengthLimit);
|
130 |
-
return $error;
|
131 |
-
}
|
132 |
-
public function checkFile()
|
133 |
-
{
|
134 |
-
$fileErrorsArray = array();
|
135 |
-
foreach ($this->_fileObject as $key => $value)
|
136 |
-
{
|
137 |
-
$this->_fileCanBeUploaded = true;
|
138 |
-
|
139 |
-
list($pre,$fileKey,$post) = explode('_',$key);
|
140 |
-
$this->_fieldsModel->load($fileKey);
|
141 |
-
$this->_fieldTitle = $this->_fieldsModel['title'];
|
142 |
-
if($value['name']=='')
|
143 |
-
{
|
144 |
-
$this->_fileCanBeUploaded = false;
|
145 |
-
if($this->_fieldsModel['is_require'])
|
146 |
-
{
|
147 |
-
$fileErrorsArray[] = "'".$this->_fieldTitle."' is a required field";
|
148 |
-
}
|
149 |
-
}
|
150 |
-
else
|
151 |
-
{
|
152 |
-
$allowed = explode(',',$this->_fieldsModel['file_extension']);
|
153 |
-
$filename = $value['name'];
|
154 |
-
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
155 |
-
|
156 |
-
$fileTypeString = $value['type'];
|
157 |
-
list($fileType,$fileExtension) = explode('/',$fileTypeString);
|
158 |
-
|
159 |
-
if(!in_array($ext,$allowed) )
|
160 |
-
{
|
161 |
-
$fileErrorsArray[] = "'".$this->_fieldTitle."' has invalid extension";
|
162 |
-
$this->_fileCanBeUploaded = false;
|
163 |
-
}
|
164 |
-
elseif($fileType=='image' && $this->_fieldsModel['image_size_x'] || $this->_fieldsModel['image_size_y'])
|
165 |
-
{
|
166 |
-
$image_info = getimagesize($value['tmp_name']);
|
167 |
-
$image_width = $image_info[0];
|
168 |
-
$image_height = $image_info[1];
|
169 |
-
$specified_width=$this->_fieldsModel['image_size_x'];
|
170 |
-
$specified_height=$this->_fieldsModel['image_size_y'];
|
171 |
-
if( $image_width > $specified_width && $image_height > $specified_height )
|
172 |
-
{
|
173 |
-
$fileErrorsArray[] = "'".$this->_fieldTitle."' has invalid size";
|
174 |
-
$this->_fileCanBeUploaded = false;
|
175 |
-
}
|
176 |
-
}
|
177 |
-
}
|
178 |
-
if($this->_validateDataErrorsCount==0 && $this->_fileCanBeUploaded)
|
179 |
-
$this->_filesToBeUploaded[] = $key;
|
180 |
-
}
|
181 |
-
return $fileErrorsArray;
|
182 |
-
}
|
183 |
-
public function validateDate($month,$day,$year,$fieldId)
|
184 |
-
{
|
185 |
-
$yearRange = $this->_helper->getYearRange();
|
186 |
-
list($yearFrom,$yearTo) = explode(',',$yearRange);
|
187 |
-
|
188 |
-
if( !checkDate($month,$day,$year) || $year<$yearFrom || $year>$yearTo )
|
189 |
-
return "'".$this->_fieldTitle."' is not valid";
|
190 |
-
$day += 1;
|
191 |
-
$dateToFormat = "$year-$month-$day";
|
192 |
-
//$dateToFormat = '2011-12-11';
|
193 |
-
$this->_dateToBeSaved[$fieldId] = Mage::helper('core')->formatDate($dateToFormat, 'long', false);
|
194 |
-
return;
|
195 |
-
}
|
196 |
-
public function validateTime($hour="",$minute="",$day_part="",$fieldId)
|
197 |
-
{
|
198 |
-
$timeFormat = $this->_helper->getTimeFormat();
|
199 |
-
if($timeFormat=='12h' && $hour && $minute && $day_part)
|
200 |
-
{
|
201 |
-
//12 hour format (12:50PM)
|
202 |
-
$time12 = "$hour:$minute$day_part";
|
203 |
-
$res = preg_match('/^(0[1-9]|1[0-2]):([0-5][0-9])(am|pm)$/', $time12);
|
204 |
-
if (!$time12 || !$res)
|
205 |
-
return "'".$this->_fieldTitle."' is not valid";
|
206 |
-
if($this->_fieldsModel['type']=='date_time')
|
207 |
-
$this->_dateToBeSaved[$fieldId] .= ", $time12";
|
208 |
-
elseif($this->_fieldsModel['type']=='time')
|
209 |
-
$this->_dateToBeSaved[$fieldId] .= "$time12";
|
210 |
-
return;
|
211 |
-
}
|
212 |
-
elseif($timeFormat=='24h' && $hour && $minute)
|
213 |
-
{
|
214 |
-
//24 hour format (00:00:00)
|
215 |
-
$time24 = "$hour:$minute:00";
|
216 |
-
$res = preg_match("/^([0-2][0-3]|[01]?[1-9]):([0-5]?[0-9]):([0-5]?[0-9])$/", $time24);
|
217 |
-
if (!$time24 || !$res)
|
218 |
-
return "'".$this->_fieldTitle."' is not valid";
|
219 |
-
if($this->_fieldsModel['type']=='date_time')
|
220 |
-
$this->_dateToBeSaved[$fieldId] .= ", $time24";
|
221 |
-
elseif($this->_fieldsModel['type']=='time')
|
222 |
-
$this->_dateToBeSaved[$fieldId] .= "$time24";
|
223 |
-
return;
|
224 |
-
}
|
225 |
-
return "'".$this->_fieldTitle."' is not valid";
|
226 |
-
}
|
227 |
-
public function checkDate( $dateArray,$fieldId )
|
228 |
-
{
|
229 |
-
$month=$day=$year=$hour=$minute=$day_part="";
|
230 |
-
foreach ($dateArray as $key => $value)
|
231 |
-
{
|
232 |
-
if($key=='date')
|
233 |
-
list($month,$day,$year) = explode('/',$value);
|
234 |
-
elseif($key=='day')
|
235 |
-
$day = $value;
|
236 |
-
elseif($key=='month')
|
237 |
-
$month = $value;
|
238 |
-
elseif($key=='year')
|
239 |
-
$year = $value;
|
240 |
-
elseif($key=='hour')
|
241 |
-
{
|
242 |
-
if($value>=0 && $value<=9)
|
243 |
-
$hour = '0'.$value;
|
244 |
-
else
|
245 |
-
$hour = $value;
|
246 |
-
}
|
247 |
-
elseif($key=='minute')
|
248 |
-
{
|
249 |
-
if($value>=0 && $value<=9)
|
250 |
-
$minute = '0'.$value;
|
251 |
-
else
|
252 |
-
$minute = $value;
|
253 |
-
}
|
254 |
-
elseif($key=='day_part')
|
255 |
-
$day_part = $value;
|
256 |
-
}
|
257 |
-
$this->_dateToBeSaved[$fieldId] = "";
|
258 |
-
if($this->_fieldsModel['type']=='date')
|
259 |
-
{
|
260 |
-
if($month && $day && $year)
|
261 |
-
return $this->validateDate($month,$day,$year,$fieldId);
|
262 |
-
}
|
263 |
-
elseif($this->_fieldsModel['type']=='date_time')
|
264 |
-
{
|
265 |
-
if($month && $day && $year)
|
266 |
-
{
|
267 |
-
if($error = $this->validateDate($month,$day,$year,$fieldId))
|
268 |
-
return $error;
|
269 |
-
else
|
270 |
-
return $this->validateTime($hour,$minute,$day_part,$fieldId);
|
271 |
-
}
|
272 |
-
}
|
273 |
-
elseif($this->_fieldsModel['type']=='time')
|
274 |
-
{
|
275 |
-
if($hour && $minute)
|
276 |
-
return $this->validateTime($hour,$minute,$day_part,$fieldId);
|
277 |
-
}
|
278 |
-
return false;
|
279 |
-
}
|
280 |
-
public function checkCheckbox($checkboxArray,$fieldId)
|
281 |
-
{
|
282 |
-
return "checkboxArray = ".implode(',',$checkboxArray);
|
283 |
-
}
|
284 |
-
public function _validateData($data)
|
285 |
-
{
|
286 |
-
$this->_currentFormId = $data['current_form_id'];
|
287 |
-
$errorsArray = $this->_fileErrorsArray = array();
|
288 |
-
$this->_fieldsModel = $this->_helper->getFieldsModel();
|
289 |
-
$previousKey = 0;
|
290 |
-
|
291 |
-
$optionsDataArray = $verifiedCheckboxIds = $allCheckboxTypeIds = array();
|
292 |
-
$optionsDataArray = $data['options'];
|
293 |
-
foreach ($optionsDataArray as $key => $value)
|
294 |
-
{
|
295 |
-
$this->_fieldsModel->load($key);
|
296 |
-
$this->_fieldTitle = $this->_fieldsModel['title'];
|
297 |
-
if($this->_fieldsModel['forms_index']==$this->_currentFormId)
|
298 |
-
{
|
299 |
-
if(is_array($value))
|
300 |
-
{
|
301 |
-
foreach ($value as $key2 => $value2)
|
302 |
-
{
|
303 |
-
if($previousKey!=$key)
|
304 |
-
{
|
305 |
-
if($this->_fieldsModel['is_require'])
|
306 |
-
{
|
307 |
-
$errorsArray[] = $this->checkEmpty($value2);
|
308 |
-
if($this->_fieldsModel['type']=='checkbox')
|
309 |
-
$verifiedCheckboxIds[] = $key;
|
310 |
-
}
|
311 |
-
if($lengthLimit = $this->_fieldsModel['max_characters'])
|
312 |
-
$errorsArray[] = $this->checkLength($value2,$lengthLimit);
|
313 |
-
if($this->_fieldsModel['previous_group']=='date')
|
314 |
-
{
|
315 |
-
$fieldId = $key;
|
316 |
-
$errorsArray[] = $this->checkDate( $optionsDataArray[$key],$fieldId );
|
317 |
-
}
|
318 |
-
//$errorsArray[] = "key = ".$key;
|
319 |
-
}
|
320 |
-
$previousKey = $key;
|
321 |
-
}
|
322 |
-
}
|
323 |
-
else
|
324 |
-
{
|
325 |
-
if($this->_fieldsModel['is_require'])
|
326 |
-
$errorsArray[] = $this->checkEmpty($value);
|
327 |
-
if($lengthLimit = $this->_fieldsModel['max_characters'])
|
328 |
-
$errorsArray[] = $this->checkLength($value,$lengthLimit);
|
329 |
-
//$errorsArray[] = "key = ".$key;
|
330 |
-
}
|
331 |
-
}
|
332 |
-
}
|
333 |
-
// validate checkbox
|
334 |
-
$allCheckboxTypeIds = $this->_fieldsModel->getCheckboxTypeIds($this->_currentFormId);
|
335 |
-
if(count($allCheckboxTypeIds))
|
336 |
-
{
|
337 |
-
foreach ($allCheckboxTypeIds as $key => $value)
|
338 |
-
{
|
339 |
-
$checkboxId = implode(',',$value);
|
340 |
-
$this->_fieldsModel->load($checkboxId);
|
341 |
-
$title = $this->_fieldsModel['title'];
|
342 |
-
$isRequired = ($this->_fieldsModel['is_require']) ? true : false;
|
343 |
-
if( !in_array( $checkboxId,$verifiedCheckboxIds ) && $isRequired )
|
344 |
-
$errorsArray[] = "'".$title."' is a required field";
|
345 |
-
}
|
346 |
-
}
|
347 |
-
$count=0;
|
348 |
-
$errorsArrayFinal = array();
|
349 |
-
foreach ($errorsArray as $key => $value)
|
350 |
-
{
|
351 |
-
if(!empty($value))
|
352 |
-
{
|
353 |
-
$count++;
|
354 |
-
$errorsArrayFinal[] = $value;
|
355 |
-
}
|
356 |
-
}
|
357 |
-
$this->_validateDataErrorsCount = $count;
|
358 |
-
$this->_fileErrorsArray = $this->checkFile();
|
359 |
-
foreach ($this->_fileErrorsArray as $key => $value)
|
360 |
-
{
|
361 |
-
if(!empty($value))
|
362 |
-
$errorsArrayFinal[] = $value;
|
363 |
-
}
|
364 |
-
return $errorsArrayFinal;
|
365 |
-
}
|
366 |
-
public function uploadFile($key)
|
367 |
-
{
|
368 |
-
try
|
369 |
-
{
|
370 |
-
$path = Mage::getBaseDir('media') . DS . 'formbuilder/frontend/uploaded_files' . DS;
|
371 |
-
$uploader = new Varien_File_Uploader($key);
|
372 |
-
//$uploader->setAllowedExtensions(array('jpg','png','gif'));
|
373 |
-
$uploader->setAllowRenameFiles(false);
|
374 |
-
$uploader->setFilesDispersion(false);
|
375 |
-
$destFile = $path.$this->_fileObject[$key]['name'];
|
376 |
-
$filename = $uploader->getNewFileName($destFile);
|
377 |
-
$uploader->save($path, $filename);
|
378 |
-
|
379 |
-
return "formbuilder/frontend/uploaded_files/".$filename;
|
380 |
-
}
|
381 |
-
catch (Exception $e)
|
382 |
-
{
|
383 |
-
$this->_session->addError($this->_helper->__("Error uploading file"));
|
384 |
-
return false;
|
385 |
-
}
|
386 |
-
}
|
387 |
-
public function _saveData($data)
|
388 |
-
{
|
389 |
-
$this->_fieldsModel = $this->_helper->getFieldsModel();
|
390 |
-
$this->_optionsModel = $this->_helper->getOptionsModel();
|
391 |
-
$returnStatus = false;
|
392 |
-
|
393 |
-
$optionsDataArray = array();
|
394 |
-
$optionsDataArray = $data['options'];
|
395 |
-
|
396 |
-
$serialized = serialize($optionsDataArray);
|
397 |
-
$data['forms_index'] = $this->_currentFormId;
|
398 |
-
$data['value'] = $serialized;
|
399 |
-
$this->_recordsModel->setData($data);
|
400 |
-
if($this->_recordsModel->save())
|
401 |
-
$returnStatus = true;
|
402 |
-
else
|
403 |
-
$returnStatus = false;
|
404 |
-
return $returnStatus;
|
405 |
-
|
406 |
-
}
|
407 |
-
public function formsubmitAction()
|
408 |
-
{
|
409 |
-
$errors = array();
|
410 |
-
$this->_helper = Mage::helper('formbuilder');
|
411 |
-
$session = Mage::getSingleton('core/session');
|
412 |
-
$this->_session = $session;
|
413 |
-
$customerSession = Mage::getSingleton('customer/session');
|
414 |
-
$this->_getLimitFormSubmissionForGuest = $this->_helper->getLimitFormSubmissionForGuest();
|
415 |
-
$this->_getLimitFormSubmissionForRegistered = $this->_helper->getLimitFormSubmissionForRegistered();
|
416 |
-
$this->_getRedirectUrl = $this->_helper->getRedirectUrl();
|
417 |
-
|
418 |
-
if (!$this->_helper->isEnabled())
|
419 |
-
{
|
420 |
-
$session->addError($this->_helper->__('Formbuilder Extension seems disabled, Please contact Administrator.'));
|
421 |
-
$this->_redirectUrl(Mage::helper('core/url')->getHomeUrl());
|
422 |
-
return;
|
423 |
-
}
|
424 |
-
else
|
425 |
-
{
|
426 |
-
if($data = $this->getRequest()->getPost())
|
427 |
-
{
|
428 |
-
//field=11, form=9
|
429 |
-
$this->_helper->setFormData($data['options'][11]);
|
430 |
-
$this->_currentFormId = $data['current_form_id'];
|
431 |
-
$this->_recordsModel = $this->_helper->getRecordsModel();
|
432 |
-
|
433 |
-
if($this->_helper->registeredOnly() && !$customerSession->isLoggedIn())
|
434 |
-
{
|
435 |
-
if(!$customerSession->isLoggedIn())
|
436 |
-
{
|
437 |
-
$session->addError($this->_helper->__('You must be logged in to submit.'));
|
438 |
-
$this->_redirectReferer();
|
439 |
-
return;
|
440 |
-
}
|
441 |
-
else//logged in user
|
442 |
-
{
|
443 |
-
$customer = $this->_helper->getCustomerInfo();
|
444 |
-
//save customer id
|
445 |
-
$customerId = $customer->getId();
|
446 |
-
//check form submission
|
447 |
-
if($this->_getLimitFormSubmissionForRegistered)
|
448 |
-
{
|
449 |
-
$totalRecords = $this->_recordsModel->checkFormSubmissionLimit($customerId,$this->_currentFormId);
|
450 |
-
if($totalRecords>=$this->_getLimitFormSubmissionForRegistered)
|
451 |
-
{
|
452 |
-
$this->_session->addError($this->_helper->__('Can not submit form, limitation of form submission for current user is reached.'));
|
453 |
-
$this->_redirectReferer();
|
454 |
-
return;
|
455 |
-
}
|
456 |
-
}
|
457 |
-
$data['customer'] = $customerId;
|
458 |
-
}
|
459 |
-
}
|
460 |
-
elseif(!$customerSession->isLoggedIn())//guest user
|
461 |
-
{
|
462 |
-
$customer = $this->_helper->getCustomerInfo();
|
463 |
-
//save customer ip address
|
464 |
-
$customerIp = Mage::helper('core/http')->getRemoteAddr();
|
465 |
-
//check form submission
|
466 |
-
if($this->_getLimitFormSubmissionForGuest)
|
467 |
-
{
|
468 |
-
$totalRecords = $this->_recordsModel->checkFormSubmissionLimit($customerIp,$this->_currentFormId);
|
469 |
-
if($totalRecords>=$this->_getLimitFormSubmissionForGuest)
|
470 |
-
{
|
471 |
-
$this->_session->addError($this->_helper->__('Can not submit form, limitation of form submission for current user is reached.'));
|
472 |
-
$this->_redirectReferer();
|
473 |
-
return;
|
474 |
-
}
|
475 |
-
}
|
476 |
-
$data['customer'] = $customerIp;
|
477 |
-
}
|
478 |
-
elseif($customerSession->isLoggedIn())//logged in user
|
479 |
-
{
|
480 |
-
$customer = $this->_helper->getCustomerInfo();
|
481 |
-
//save customer id
|
482 |
-
$customerId = $customer->getId();
|
483 |
-
//check form submission
|
484 |
-
if($this->_getLimitFormSubmissionForRegistered)
|
485 |
-
{
|
486 |
-
$totalRecords = $this->_recordsModel->checkFormSubmissionLimit($customerId,$this->_currentFormId);
|
487 |
-
if($totalRecords>=$this->_getLimitFormSubmissionForRegistered)
|
488 |
-
{
|
489 |
-
$this->_session->addError($this->_helper->__('Can not submit form, limitation of form submission for current user is reached.'));
|
490 |
-
$this->_redirectReferer();
|
491 |
-
return;
|
492 |
-
}
|
493 |
-
}
|
494 |
-
$data['customer'] = $customerId;
|
495 |
-
}
|
496 |
-
if(isset($_FILES))
|
497 |
-
{
|
498 |
-
$this->_fileObject = $_FILES;
|
499 |
-
}
|
500 |
-
$errors = $this->_validateData($data);
|
501 |
-
if (!empty($errors))
|
502 |
-
{
|
503 |
-
foreach ($errors as $error)
|
504 |
-
{
|
505 |
-
$session->addError($error);
|
506 |
-
}
|
507 |
-
$this->_redirectReferer();
|
508 |
-
return;
|
509 |
-
}
|
510 |
-
if( count($this->_filesToBeUploaded) )
|
511 |
-
{
|
512 |
-
foreach ($this->_filesToBeUploaded as $key)
|
513 |
-
{
|
514 |
-
list($pre,$fileKey,$post) = explode('_',$key);
|
515 |
-
if( $res = $this->uploadFile($key) )
|
516 |
-
$data['options'][$fileKey] = $res;
|
517 |
-
else
|
518 |
-
{
|
519 |
-
$this->_redirectReferer();
|
520 |
-
return;
|
521 |
-
}
|
522 |
-
}
|
523 |
-
}
|
524 |
-
if(count($this->_dateToBeSaved))
|
525 |
-
{
|
526 |
-
foreach ($this->_dateToBeSaved as $id => $date)
|
527 |
-
{
|
528 |
-
//$this->_session->addError("(id=$id) = ".$date);
|
529 |
-
$data['options'][$id] = $date;
|
530 |
-
}
|
531 |
-
}
|
532 |
-
|
533 |
-
/*echo "<pre>";
|
534 |
-
echo "<h1>printing data</h1>";
|
535 |
-
print_r($data);
|
536 |
-
echo "<h1>printing data['options']</h1>";
|
537 |
-
print_r($data['options']);
|
538 |
-
echo "</pre>";
|
539 |
-
exit();*/
|
540 |
-
|
541 |
-
$formsModel = $this->_helper->getFormsModel();
|
542 |
-
$formsModel->load($this->_currentFormId);
|
543 |
-
if($this->_saveData($data))
|
544 |
-
{
|
545 |
-
$successText = $formsModel['success_msg'];
|
546 |
-
if(!$successText)
|
547 |
-
$successText = 'Form submitted successfully, we will reach you soon.';
|
548 |
-
$session->addSuccess($this->_helper->__($successText));
|
549 |
-
if($this->_getRedirectUrl)
|
550 |
-
$this->_redirectUrl(Mage::getUrl($this->_getRedirectUrl));
|
551 |
-
//return;
|
552 |
-
}
|
553 |
-
else
|
554 |
-
{
|
555 |
-
$failureText = $formsModel['failure_msg'];
|
556 |
-
if(!$failureText)
|
557 |
-
$failureText = 'Problem occured submitting form.';
|
558 |
-
$session->addError($this->_helper->__($failureText));
|
559 |
-
}
|
560 |
-
$this->_redirectReferer();
|
561 |
-
return;
|
562 |
-
}
|
563 |
-
else
|
564 |
-
{
|
565 |
-
$session->addNotice($this->_helper->__('The requested page could not be found'));
|
566 |
-
$this->_redirectReferer();
|
567 |
-
return false;
|
568 |
-
}
|
569 |
-
}//else extension is enabled
|
570 |
-
}
|
571 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Phxsolution/Formbuilder/controllers/IndexController.php
CHANGED
@@ -37,8 +37,11 @@ class Phxsolution_Formbuilder_IndexController extends Mage_Core_Controller_Front
|
|
37 |
protected $_lastInsertedRecordId;
|
38 |
protected $_lastInsertedRecordValue;
|
39 |
protected $_currentFormTitle;
|
|
|
|
|
40 |
protected $_send_email_to_customer = false;
|
41 |
protected $_send_email_to_admin = false;
|
|
|
42 |
|
43 |
public function preDispatch()
|
44 |
{
|
@@ -338,7 +341,7 @@ class Phxsolution_Formbuilder_IndexController extends Mage_Core_Controller_Front
|
|
338 |
}
|
339 |
// validate checkbox
|
340 |
$allCheckboxTypeIds = $this->_fieldsModel->getCheckboxTypeIds($this->_currentFormId);
|
341 |
-
if(
|
342 |
{
|
343 |
foreach ($allCheckboxTypeIds as $key => $value)
|
344 |
{
|
@@ -425,8 +428,8 @@ class Phxsolution_Formbuilder_IndexController extends Mage_Core_Controller_Front
|
|
425 |
$currentForm = Mage::helper('formbuilder')->getCurrentFormDetails($this->_currentFormId);
|
426 |
$this->_currentFormTitle = $currentForm['title'];
|
427 |
|
428 |
-
$
|
429 |
-
$
|
430 |
<tr>
|
431 |
<th colspan="2" style="padding: 10px; background:#ccc;">We received the following data:</th>
|
432 |
</tr>
|
@@ -435,19 +438,70 @@ class Phxsolution_Formbuilder_IndexController extends Mage_Core_Controller_Front
|
|
435 |
<td style="background:#f5f2f0; padding:5px;">'.$this->_currentFormTitle.'</td>
|
436 |
</tr>';
|
437 |
|
|
|
438 |
foreach ($prepareFieldTitles as $fieldId => $fieldTitle)
|
439 |
{
|
440 |
if($this->_lastInsertedRecordId && $this->_lastInsertedRecordValue)
|
441 |
{
|
442 |
-
$_blockData = $this->getLayout()->getBlockSingleton('Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Renderer_Recordvalue')->render(
|
443 |
-
$
|
444 |
<td width="130" style="background:#f2f2f2; padding:5px; text-align: right;">'.$fieldTitle.'</td>
|
445 |
<td style="background:#f5f2f0; padding:5px;">'.$_blockData.'</td>
|
446 |
</tr>';
|
447 |
}
|
448 |
}
|
449 |
-
$
|
450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
|
452 |
if (Mage::getSingleton('customer/session')->isLoggedIn())
|
453 |
{
|
@@ -457,33 +511,14 @@ class Phxsolution_Formbuilder_IndexController extends Mage_Core_Controller_Front
|
|
457 |
$fname = $customer->getFirstname();
|
458 |
$lname = $customer->getLastname();
|
459 |
|
460 |
-
$email_logo = Mage::getStoreConfig('design/email/logo');
|
461 |
-
$senderName = Mage::getStoreConfig('formbuilder_section/form_submission_email/sender_name'); //sender name
|
462 |
-
$senderEmail = Mage::getStoreConfig('formbuilder_section/form_submission_email/sender_email'); //sender email
|
463 |
$email_subject_for_customer = Mage::getStoreConfig('formbuilder_section/form_submission_email/email_subject_for_customer'); //email subject
|
464 |
$email_content_for_customer = Mage::getStoreConfig('formbuilder_section/form_submission_email/email_content_for_customer'); //email content
|
465 |
|
466 |
$email_desc = str_replace("{{Name}}",$fname." ".$lname,$email_content_for_customer);
|
467 |
-
$email_desc = str_replace("{{FormData}}",$
|
468 |
-
$store_name = Mage::getStoreConfig('general/store_information/name');
|
469 |
-
$store_phone = Mage::getStoreConfig('general/store_information/phone');
|
470 |
-
|
471 |
-
$img_media = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'email/logo/';
|
472 |
-
|
473 |
-
$img_logo_final = $img_media.$email_logo;
|
474 |
-
$default_logo = Mage::getStoreConfig('design/header/logo_src');
|
475 |
-
$logo_default = Mage::getDesign()->getSkinUrl().$default_logo;
|
476 |
$email_desc = str_replace("{{Storename}}",$store_name,$email_desc);
|
477 |
$email_desc = str_replace("{{Storephone}}",$store_phone,$email_desc);
|
478 |
-
|
479 |
-
if($img_logo_final == $img_media)
|
480 |
-
{
|
481 |
-
$logo_img = "<img src='$logo_default'/>";
|
482 |
-
}
|
483 |
-
else
|
484 |
-
{
|
485 |
-
$logo_img = "<img src='$img_logo_final'/>";
|
486 |
-
}
|
487 |
$customerContent = '<table border="0">
|
488 |
<tr>
|
489 |
<td>
|
@@ -500,57 +535,26 @@ class Phxsolution_Formbuilder_IndexController extends Mage_Core_Controller_Front
|
|
500 |
</td>
|
501 |
</tr>
|
502 |
</table>';
|
503 |
-
$headers = "";
|
504 |
-
$headers .= 'MIME-Version: 1.0'."\r\n";
|
505 |
-
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
|
506 |
-
$headers .= 'From:'. $senderName.' <'.$senderEmail.'>';
|
507 |
-
|
508 |
|
509 |
-
//preparing email for admin if send_email_to_admin
|
510 |
-
if($this->_send_email_to_admin)
|
511 |
-
{
|
512 |
-
$email_subject_for_admin = Mage::getStoreConfig('formbuilder_section/form_submission_email/email_subject_for_admin'); //email subject
|
513 |
-
$email_content_for_admin = Mage::getStoreConfig('formbuilder_section/form_submission_email/email_content_for_admin'); //email content
|
514 |
-
$CustomerEmail = $email;
|
515 |
-
$Storename = $store_name;
|
516 |
-
$FormData = $userDetailHtml;
|
517 |
-
$email_desc2 = str_replace("{{CustomerEmail}}",$CustomerEmail,$email_content_for_admin);
|
518 |
-
$email_desc2 = str_replace("{{Storename}}",$Storename,$email_desc2);
|
519 |
-
$email_desc2 = str_replace("{{FormData}}",$FormData,$email_desc2);
|
520 |
-
$adminContent = '<table border="0">
|
521 |
-
<tr>
|
522 |
-
<td>
|
523 |
-
<table border="0">
|
524 |
-
<tr>
|
525 |
-
<Td>'.$logo_img.'</Td>
|
526 |
-
</tr>
|
527 |
-
<tr>
|
528 |
-
<td colspan="2"> </td></tr>
|
529 |
-
<tr>
|
530 |
-
<Td><p>'.$email_desc2.'. </p></Td>
|
531 |
-
</tr>
|
532 |
-
</table>
|
533 |
-
</td>
|
534 |
-
</tr>
|
535 |
-
</table>';
|
536 |
-
}
|
537 |
try
|
538 |
{
|
539 |
-
//Mage::getSingleton('core/session')->addNotice('within sendEmail - if customer isLoggedIn - try sending mail');
|
540 |
if($this->_send_email_to_customer)
|
541 |
mail($email,$email_subject_for_customer,$customerContent,$headers);
|
542 |
if($this->_send_email_to_admin)
|
543 |
-
mail($
|
544 |
}
|
545 |
catch (Exception $e)
|
546 |
{
|
547 |
Mage::getSingleton('core/session')->addError('Error sending email');
|
548 |
-
//$this->_redirectReferer();
|
549 |
}
|
550 |
}
|
551 |
else
|
552 |
-
|
553 |
-
|
|
|
|
|
|
|
|
|
554 |
}
|
555 |
public function formsubmitAction()
|
556 |
{
|
@@ -655,7 +659,7 @@ class Phxsolution_Formbuilder_IndexController extends Mage_Core_Controller_Front
|
|
655 |
$this->_redirectReferer();
|
656 |
return;
|
657 |
}
|
658 |
-
if(
|
659 |
{
|
660 |
foreach ($this->_filesToBeUploaded as $key)
|
661 |
{
|
@@ -669,7 +673,7 @@ class Phxsolution_Formbuilder_IndexController extends Mage_Core_Controller_Front
|
|
669 |
}
|
670 |
}
|
671 |
}
|
672 |
-
if(
|
673 |
{
|
674 |
foreach ($this->_dateToBeSaved as $id => $date)
|
675 |
{
|
@@ -688,11 +692,13 @@ class Phxsolution_Formbuilder_IndexController extends Mage_Core_Controller_Front
|
|
688 |
|
689 |
$formsModel = $this->_helper->getFormsModel();
|
690 |
$formsModel->load($this->_currentFormId);
|
|
|
|
|
691 |
if($this->_saveData($data))
|
692 |
{
|
693 |
$successText = $formsModel['success_msg'];
|
694 |
if(!$successText)
|
695 |
-
$successText = 'Form submitted successfully, we will reach you soon.';
|
696 |
$session->addSuccess($this->_helper->__($successText));
|
697 |
$this->_send_email_to_customer = Mage::getStoreConfig('formbuilder_section/form_submission_email/send_email_to_customer');
|
698 |
$this->_send_email_to_admin = Mage::getStoreConfig('formbuilder_section/form_submission_email/send_email_to_admin');
|
@@ -706,7 +712,7 @@ class Phxsolution_Formbuilder_IndexController extends Mage_Core_Controller_Front
|
|
706 |
{
|
707 |
$failureText = $formsModel['failure_msg'];
|
708 |
if(!$failureText)
|
709 |
-
$failureText = 'Problem occured submitting form.';
|
710 |
$session->addError($this->_helper->__($failureText));
|
711 |
}
|
712 |
$this->_redirectReferer();
|
37 |
protected $_lastInsertedRecordId;
|
38 |
protected $_lastInsertedRecordValue;
|
39 |
protected $_currentFormTitle;
|
40 |
+
protected $_filesToBeUploaded = false;
|
41 |
+
protected $_dateToBeSaved = false;
|
42 |
protected $_send_email_to_customer = false;
|
43 |
protected $_send_email_to_admin = false;
|
44 |
+
protected $_currentCustomer = false;
|
45 |
|
46 |
public function preDispatch()
|
47 |
{
|
341 |
}
|
342 |
// validate checkbox
|
343 |
$allCheckboxTypeIds = $this->_fieldsModel->getCheckboxTypeIds($this->_currentFormId);
|
344 |
+
if($allCheckboxTypeIds)
|
345 |
{
|
346 |
foreach ($allCheckboxTypeIds as $key => $value)
|
347 |
{
|
428 |
$currentForm = Mage::helper('formbuilder')->getCurrentFormDetails($this->_currentFormId);
|
429 |
$this->_currentFormTitle = $currentForm['title'];
|
430 |
|
431 |
+
$FormData = "";
|
432 |
+
$FormData .= '<table width="100%" style="font-family: sans-serif; border: 1px solid #ccc;"><thead>
|
433 |
<tr>
|
434 |
<th colspan="2" style="padding: 10px; background:#ccc;">We received the following data:</th>
|
435 |
</tr>
|
438 |
<td style="background:#f5f2f0; padding:5px;">'.$this->_currentFormTitle.'</td>
|
439 |
</tr>';
|
440 |
|
441 |
+
$nullObject = new Varien_Object();
|
442 |
foreach ($prepareFieldTitles as $fieldId => $fieldTitle)
|
443 |
{
|
444 |
if($this->_lastInsertedRecordId && $this->_lastInsertedRecordValue)
|
445 |
{
|
446 |
+
$_blockData = $this->getLayout()->getBlockSingleton('Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Renderer_Recordvalue')->render($nullObject,$this->_lastInsertedRecordId,$fieldId,$this->_lastInsertedRecordValue);
|
447 |
+
$FormData .= '<tr>
|
448 |
<td width="130" style="background:#f2f2f2; padding:5px; text-align: right;">'.$fieldTitle.'</td>
|
449 |
<td style="background:#f5f2f0; padding:5px;">'.$_blockData.'</td>
|
450 |
</tr>';
|
451 |
}
|
452 |
}
|
453 |
+
$FormData .= '</thead></table>';
|
454 |
|
455 |
+
//general configuration
|
456 |
+
$email_logo = Mage::getStoreConfig('design/email/logo');
|
457 |
+
$senderName = Mage::getStoreConfig('formbuilder_section/form_submission_email/sender_name'); //sender name
|
458 |
+
$senderEmail = Mage::getStoreConfig('formbuilder_section/form_submission_email/sender_email'); //sender email
|
459 |
+
$store_name = Mage::getStoreConfig('general/store_information/name');
|
460 |
+
$store_phone = Mage::getStoreConfig('general/store_information/phone');
|
461 |
+
$img_media = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'email/logo/';
|
462 |
+
$img_logo_final = $img_media.$email_logo;
|
463 |
+
$default_logo = Mage::getStoreConfig('design/header/logo_src');
|
464 |
+
$logo_default = Mage::getDesign()->getSkinUrl().$default_logo;
|
465 |
+
if($img_logo_final == $img_media)
|
466 |
+
$logo_img = "<img src='$logo_default'/>";
|
467 |
+
else
|
468 |
+
$logo_img = "<img src='$img_logo_final'/>";
|
469 |
+
$headers = "";
|
470 |
+
$headers .= 'MIME-Version: 1.0'."\r\n";
|
471 |
+
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
|
472 |
+
$headers .= 'From:'. $senderName.' <'.$senderEmail.'>';
|
473 |
+
|
474 |
+
|
475 |
+
//preparing email for admin if send_email_to_admin
|
476 |
+
if($this->_send_email_to_admin)
|
477 |
+
{
|
478 |
+
$email_for_admin = Mage::getStoreConfig('formbuilder_section/form_submission_email/admin_email'); //email subject
|
479 |
+
$email_subject_for_admin = Mage::getStoreConfig('formbuilder_section/form_submission_email/email_subject_for_admin'); //email subject
|
480 |
+
$email_content_for_admin = Mage::getStoreConfig('formbuilder_section/form_submission_email/email_content_for_admin'); //email content
|
481 |
+
$CustomerEmail = "Guest";
|
482 |
+
if($this->_currentCustomer)
|
483 |
+
$CustomerEmail = $this->_currentCustomer->getEmail();
|
484 |
+
|
485 |
+
$email_desc2 = str_replace("{{CustomerEmail}}",$CustomerEmail,$email_content_for_admin);
|
486 |
+
$email_desc2 = str_replace("{{Storename}}",$store_name,$email_desc2);
|
487 |
+
$email_desc2 = str_replace("{{FormData}}",$FormData,$email_desc2);
|
488 |
+
$adminContent = '<table border="0">
|
489 |
+
<tr>
|
490 |
+
<td>
|
491 |
+
<table border="0">
|
492 |
+
<tr>
|
493 |
+
<Td>'.$logo_img.'</Td>
|
494 |
+
</tr>
|
495 |
+
<tr>
|
496 |
+
<td colspan="2"> </td></tr>
|
497 |
+
<tr>
|
498 |
+
<Td><p>'.$email_desc2.'. </p></Td>
|
499 |
+
</tr>
|
500 |
+
</table>
|
501 |
+
</td>
|
502 |
+
</tr>
|
503 |
+
</table>';
|
504 |
+
}
|
505 |
|
506 |
if (Mage::getSingleton('customer/session')->isLoggedIn())
|
507 |
{
|
511 |
$fname = $customer->getFirstname();
|
512 |
$lname = $customer->getLastname();
|
513 |
|
|
|
|
|
|
|
514 |
$email_subject_for_customer = Mage::getStoreConfig('formbuilder_section/form_submission_email/email_subject_for_customer'); //email subject
|
515 |
$email_content_for_customer = Mage::getStoreConfig('formbuilder_section/form_submission_email/email_content_for_customer'); //email content
|
516 |
|
517 |
$email_desc = str_replace("{{Name}}",$fname." ".$lname,$email_content_for_customer);
|
518 |
+
$email_desc = str_replace("{{FormData}}",$FormData,$email_desc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
$email_desc = str_replace("{{Storename}}",$store_name,$email_desc);
|
520 |
$email_desc = str_replace("{{Storephone}}",$store_phone,$email_desc);
|
521 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
$customerContent = '<table border="0">
|
523 |
<tr>
|
524 |
<td>
|
535 |
</td>
|
536 |
</tr>
|
537 |
</table>';
|
|
|
|
|
|
|
|
|
|
|
538 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
539 |
try
|
540 |
{
|
|
|
541 |
if($this->_send_email_to_customer)
|
542 |
mail($email,$email_subject_for_customer,$customerContent,$headers);
|
543 |
if($this->_send_email_to_admin)
|
544 |
+
mail($email_for_admin,$email_subject_for_admin,$adminContent,$headers);
|
545 |
}
|
546 |
catch (Exception $e)
|
547 |
{
|
548 |
Mage::getSingleton('core/session')->addError('Error sending email');
|
|
|
549 |
}
|
550 |
}
|
551 |
else
|
552 |
+
{
|
553 |
+
if($this->_send_email_to_admin)
|
554 |
+
mail($email_for_admin,$email_subject_for_admin,$adminContent,$headers);
|
555 |
+
else
|
556 |
+
;//customer is not registered
|
557 |
+
}
|
558 |
}
|
559 |
public function formsubmitAction()
|
560 |
{
|
659 |
$this->_redirectReferer();
|
660 |
return;
|
661 |
}
|
662 |
+
if($this->_filesToBeUploaded)
|
663 |
{
|
664 |
foreach ($this->_filesToBeUploaded as $key)
|
665 |
{
|
673 |
}
|
674 |
}
|
675 |
}
|
676 |
+
if($this->_dateToBeSaved)
|
677 |
{
|
678 |
foreach ($this->_dateToBeSaved as $id => $date)
|
679 |
{
|
692 |
|
693 |
$formsModel = $this->_helper->getFormsModel();
|
694 |
$formsModel->load($this->_currentFormId);
|
695 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn())
|
696 |
+
$this->_currentCustomer = Mage::getSingleton('customer/session')->getCustomer();
|
697 |
if($this->_saveData($data))
|
698 |
{
|
699 |
$successText = $formsModel['success_msg'];
|
700 |
if(!$successText)
|
701 |
+
$successText = $this->__('Form submitted successfully, we will reach you soon.');
|
702 |
$session->addSuccess($this->_helper->__($successText));
|
703 |
$this->_send_email_to_customer = Mage::getStoreConfig('formbuilder_section/form_submission_email/send_email_to_customer');
|
704 |
$this->_send_email_to_admin = Mage::getStoreConfig('formbuilder_section/form_submission_email/send_email_to_admin');
|
712 |
{
|
713 |
$failureText = $formsModel['failure_msg'];
|
714 |
if(!$failureText)
|
715 |
+
$failureText = $this->__('Problem occured submitting form.');
|
716 |
$session->addError($this->_helper->__($failureText));
|
717 |
}
|
718 |
$this->_redirectReferer();
|
app/code/community/Phxsolution/Formbuilder/etc/config.xml
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
*
|
18 |
* @category module configuration
|
19 |
* @package Phxsolution_Formbuilder
|
20 |
-
* @author
|
21 |
* @contact contact@phxsolution.com
|
22 |
* @site www.phxsolution.com
|
23 |
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
@@ -27,7 +27,7 @@
|
|
27 |
<config>
|
28 |
<modules>
|
29 |
<Phxsolution_Formbuilder>
|
30 |
-
<version>0.3.
|
31 |
</Phxsolution_Formbuilder>
|
32 |
</modules>
|
33 |
<frontend>
|
17 |
*
|
18 |
* @category module configuration
|
19 |
* @package Phxsolution_Formbuilder
|
20 |
+
* @author murad.magento
|
21 |
* @contact contact@phxsolution.com
|
22 |
* @site www.phxsolution.com
|
23 |
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
27 |
<config>
|
28 |
<modules>
|
29 |
<Phxsolution_Formbuilder>
|
30 |
+
<version>0.3.1</version>
|
31 |
</Phxsolution_Formbuilder>
|
32 |
</modules>
|
33 |
<frontend>
|
app/code/community/Phxsolution/Formbuilder/etc/system.xml-7-8-15
DELETED
@@ -1,204 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* Phxsolution Formbuilder
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/osl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
-
*
|
16 |
-
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
-
*
|
18 |
-
* @category module system configuration
|
19 |
-
* @package Phxsolution_Formbuilder
|
20 |
-
* @author Murad Ali
|
21 |
-
* @contact contact@phxsolution.com
|
22 |
-
* @site www.phxsolution.com
|
23 |
-
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
-->
|
27 |
-
<config>
|
28 |
-
<tabs>
|
29 |
-
<formbuilder_tab translate="label" module="formbuilder">
|
30 |
-
<label>Phxsolution Extensions</label>
|
31 |
-
<sort_order>0</sort_order>
|
32 |
-
</formbuilder_tab>
|
33 |
-
</tabs>
|
34 |
-
<sections>
|
35 |
-
<formbuilder_section>
|
36 |
-
<label>Formbuilder</label>
|
37 |
-
<tab>formbuilder_tab</tab>
|
38 |
-
<!-- <class>phxsolution-formbuilder</class> -->
|
39 |
-
<frontend_type>text</frontend_type>
|
40 |
-
<sort_order>150</sort_order>
|
41 |
-
<show_in_default>1</show_in_default>
|
42 |
-
<show_in_website>1</show_in_website>
|
43 |
-
<show_in_store>1</show_in_store>
|
44 |
-
<groups>
|
45 |
-
<general translate="label">
|
46 |
-
<label>General Settings</label>
|
47 |
-
<frontend_type>text</frontend_type>
|
48 |
-
<sort_order>11</sort_order>
|
49 |
-
<show_in_default>1</show_in_default>
|
50 |
-
<show_in_website>1</show_in_website>
|
51 |
-
<show_in_store>1</show_in_store>
|
52 |
-
<!-- <expanded>1</expanded> -->
|
53 |
-
<fields>
|
54 |
-
<active translate="label">
|
55 |
-
<label>Enable Formbuilder</label>
|
56 |
-
<frontend_type>select</frontend_type>
|
57 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
58 |
-
<sort_order>1</sort_order>
|
59 |
-
<show_in_default>1</show_in_default>
|
60 |
-
<show_in_website>1</show_in_website>
|
61 |
-
<show_in_store>1</show_in_store>
|
62 |
-
</active>
|
63 |
-
</fields>
|
64 |
-
<fields>
|
65 |
-
<in_toplinks translate="label">
|
66 |
-
<label>Display Extension Link in Toplinks</label>
|
67 |
-
<frontend_type>select</frontend_type>
|
68 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
69 |
-
<sort_order>2</sort_order>
|
70 |
-
<show_in_default>1</show_in_default>
|
71 |
-
<show_in_website>1</show_in_website>
|
72 |
-
<show_in_store>1</show_in_store>
|
73 |
-
</in_toplinks>
|
74 |
-
</fields>
|
75 |
-
<fields>
|
76 |
-
<in_topmenu translate="label">
|
77 |
-
<label>Display Extension Link in Topmenu</label>
|
78 |
-
<frontend_type>select</frontend_type>
|
79 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
80 |
-
<sort_order>3</sort_order>
|
81 |
-
<show_in_default>1</show_in_default>
|
82 |
-
<show_in_website>1</show_in_website>
|
83 |
-
<show_in_store>1</show_in_store>
|
84 |
-
</in_topmenu>
|
85 |
-
</fields>
|
86 |
-
<fields>
|
87 |
-
<in_footerlinks translate="label">
|
88 |
-
<label>Display Extension Link in Footerlinks</label>
|
89 |
-
<frontend_type>select</frontend_type>
|
90 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
91 |
-
<sort_order>4</sort_order>
|
92 |
-
<show_in_default>1</show_in_default>
|
93 |
-
<show_in_website>1</show_in_website>
|
94 |
-
<show_in_store>1</show_in_store>
|
95 |
-
</in_footerlinks>
|
96 |
-
</fields>
|
97 |
-
</general>
|
98 |
-
<form_submission translate="label">
|
99 |
-
<label>Frontend - Form Submission Settings</label>
|
100 |
-
<frontend_type>text</frontend_type>
|
101 |
-
<sort_order>12</sort_order>
|
102 |
-
<show_in_default>1</show_in_default>
|
103 |
-
<show_in_website>1</show_in_website>
|
104 |
-
<show_in_store>1</show_in_store>
|
105 |
-
<fields>
|
106 |
-
<registered_only translate="label">
|
107 |
-
<label>Registered customers only</label>
|
108 |
-
<frontend_type>select</frontend_type>
|
109 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
110 |
-
<comment>Set form submission facility only for registered customers.</comment>
|
111 |
-
<sort_order>5</sort_order>
|
112 |
-
<show_in_default>1</show_in_default>
|
113 |
-
<show_in_website>1</show_in_website>
|
114 |
-
<show_in_store>1</show_in_store>
|
115 |
-
</registered_only>
|
116 |
-
</fields>
|
117 |
-
<fields>
|
118 |
-
<limit_form_submission_for_guest translate="label">
|
119 |
-
<label>Limit form submission for Guest user</label>
|
120 |
-
<frontend_type>text</frontend_type>
|
121 |
-
<comment>Limit form submission per customer. Customers are identified by IP Address (Guest user), Blank will take unlimited.</comment>
|
122 |
-
<sort_order>6</sort_order>
|
123 |
-
<show_in_default>1</show_in_default>
|
124 |
-
<show_in_website>1</show_in_website>
|
125 |
-
<show_in_store>1</show_in_store>
|
126 |
-
<validate>validate-zero-or-greater</validate>
|
127 |
-
</limit_form_submission_for_guest>
|
128 |
-
<limit_form_submission_for_registered translate="label">
|
129 |
-
<label>Limit form submission for Registered user</label>
|
130 |
-
<frontend_type>text</frontend_type>
|
131 |
-
<comment>Limit form submission per customer. Customers are identified by Customer Id (Registered user), Blank will take unlimited.</comment>
|
132 |
-
<sort_order>6</sort_order>
|
133 |
-
<show_in_default>1</show_in_default>
|
134 |
-
<show_in_website>1</show_in_website>
|
135 |
-
<show_in_store>1</show_in_store>
|
136 |
-
<validate>validate-zero-or-greater</validate>
|
137 |
-
</limit_form_submission_for_registered>
|
138 |
-
</fields>
|
139 |
-
<fields>
|
140 |
-
<redirect_url translate="label">
|
141 |
-
<label>Redirect URL</label>
|
142 |
-
<frontend_type>text</frontend_type>
|
143 |
-
<comment>Redirect customer to specified URL after successful form submission. Example: customer/account or home or customer-service. (URL added here will be added to base url)</comment>
|
144 |
-
<sort_order>7</sort_order>
|
145 |
-
<show_in_default>1</show_in_default>
|
146 |
-
<show_in_website>1</show_in_website>
|
147 |
-
<show_in_store>1</show_in_store>
|
148 |
-
<width>500</width>
|
149 |
-
<!-- <validate>validate-url</validate> -->
|
150 |
-
</redirect_url>
|
151 |
-
</fields>
|
152 |
-
</form_submission>
|
153 |
-
<custom_options translate="label">
|
154 |
-
<label>Frontend - Date & Time Settings</label>
|
155 |
-
<frontend_type>text</frontend_type>
|
156 |
-
<sort_order>13</sort_order>
|
157 |
-
<show_in_default>1</show_in_default>
|
158 |
-
<show_in_website>1</show_in_website>
|
159 |
-
<show_in_store>1</show_in_store>
|
160 |
-
<fields>
|
161 |
-
<use_calendar translate="label">
|
162 |
-
<label>Use JavaScript Calendar</label>
|
163 |
-
<frontend_type>select</frontend_type>
|
164 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
165 |
-
<sort_order>1</sort_order>
|
166 |
-
<show_in_default>1</show_in_default>
|
167 |
-
<show_in_website>1</show_in_website>
|
168 |
-
<show_in_store>1</show_in_store>
|
169 |
-
</use_calendar>
|
170 |
-
<date_fields_order translate="label">
|
171 |
-
<label>Date Fields Order</label>
|
172 |
-
<frontend_type>select</frontend_type>
|
173 |
-
<frontend_model>adminhtml/catalog_form_renderer_config_dateFieldsOrder</frontend_model>
|
174 |
-
<sort_order>2</sort_order>
|
175 |
-
<show_in_default>1</show_in_default>
|
176 |
-
<show_in_website>1</show_in_website>
|
177 |
-
<show_in_store>1</show_in_store>
|
178 |
-
<depends><use_calendar>0</use_calendar></depends>
|
179 |
-
</date_fields_order>
|
180 |
-
<time_format translate="label">
|
181 |
-
<label>Time Format</label>
|
182 |
-
<frontend_type>select</frontend_type>
|
183 |
-
<source_model>adminhtml/system_config_source_catalog_timeFormat</source_model>
|
184 |
-
<sort_order>3</sort_order>
|
185 |
-
<show_in_default>1</show_in_default>
|
186 |
-
<show_in_website>1</show_in_website>
|
187 |
-
<show_in_store>1</show_in_store>
|
188 |
-
</time_format>
|
189 |
-
<year_range translate="label comment">
|
190 |
-
<label>Year Range</label>
|
191 |
-
<comment>Use four-digit year format.</comment>
|
192 |
-
<frontend_type>text</frontend_type>
|
193 |
-
<frontend_model>adminhtml/catalog_form_renderer_config_yearRange</frontend_model>
|
194 |
-
<sort_order>4</sort_order>
|
195 |
-
<show_in_default>1</show_in_default>
|
196 |
-
<show_in_website>1</show_in_website>
|
197 |
-
<show_in_store>1</show_in_store>
|
198 |
-
</year_range>
|
199 |
-
</fields>
|
200 |
-
</custom_options>
|
201 |
-
</groups>
|
202 |
-
</formbuilder_section>
|
203 |
-
</sections>
|
204 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/layout/formbuilder.xml
CHANGED
@@ -17,34 +17,20 @@
|
|
17 |
*
|
18 |
* @category adminhtml layout
|
19 |
* @package Phxsolution_Formbuilder
|
20 |
-
* @author
|
21 |
* @contact contact@phxsolution.com
|
22 |
* @site www.phxsolution.com
|
23 |
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
-->
|
27 |
-
<layout version="0.3.
|
28 |
<default>
|
29 |
<reference name="head">
|
30 |
-
|
31 |
-
<action method="addJs">
|
32 |
<script>formbuilder/jscolor/jscolor.js</script>
|
33 |
-
<!-- <script>formbuilder/procolor-1.0/procolor.compressed.js</script> -->
|
34 |
</action>
|
35 |
-
|
36 |
-
<action method="setCanLoadTinyMce"><flag>1</flag></action>
|
37 |
-
<action method="addJs"><script>prototype/prototype.js</script></action>
|
38 |
-
<action method="addJs"><script>mage/adminhtml/variables.js</script></action>
|
39 |
-
<action method="addJs"><script>mage/adminhtml/wysiwyg/widget.js</script></action>
|
40 |
-
<action method="addJs"><script>lib/flex.js</script></action>
|
41 |
-
<action method="addJs"><script>lib/FABridge.js</script></action>
|
42 |
-
<action method="addJs"><script>mage/adminhtml/flexuploader.js</script></action>
|
43 |
-
<action method="addJs"><script>mage/adminhtml/browser.js</script></action>
|
44 |
-
<action method="addJs"><script>prototype/window.js</script></action>
|
45 |
-
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
|
46 |
-
<action method="addCss"><name>lib/prototype/windows/themes/magento.css</name></action> -->
|
47 |
-
</reference>
|
48 |
</default>
|
49 |
<formbuilder_adminhtml_formbuilder_index>
|
50 |
<update handle="editor_index_index"/>
|
@@ -52,29 +38,6 @@
|
|
52 |
<block type="formbuilder/adminhtml_formbuilder" name="formbuilder" />
|
53 |
</reference>
|
54 |
</formbuilder_adminhtml_formbuilder_index>
|
55 |
-
<!-- <formbuilder_adminhtml_formbuilder_product>
|
56 |
-
<block type="core/text_list" name="root" output="toHtml">
|
57 |
-
<block type="formbuilder/adminhtml_formbuilder_edit_tab_product" name="product.grid"/>
|
58 |
-
<block type="adminhtml/widget_grid_serializer" name="grid_serializer">
|
59 |
-
<reference name="grid_serializer">
|
60 |
-
<action method="initSerializerBlock">
|
61 |
-
<grid_block_name>product.grid</grid_block_name>
|
62 |
-
<data_callback>getSelectedProducts</data_callback>
|
63 |
-
<hidden_input_name>links[products]</hidden_input_name>
|
64 |
-
<reload_param_name>products</reload_param_name>
|
65 |
-
</action>
|
66 |
-
<action method="addColumnInputName">
|
67 |
-
<input_name>position</input_name>
|
68 |
-
</action>
|
69 |
-
</reference>
|
70 |
-
</block>
|
71 |
-
</block>
|
72 |
-
</formbuilder_adminhtml_formbuilder_product>-->
|
73 |
-
<!-- <formbuilder_adminhtml_formbuilder_productgrid>
|
74 |
-
<block type="core/text_list" name="root" output="toHtml">
|
75 |
-
<block type="formbuilder/adminhtml_formbuilder_edit_tab_product" name="product.grid"/>
|
76 |
-
</block>
|
77 |
-
</formbuilder_adminhtml_formbuilder_productgrid> -->
|
78 |
<formbuilder_adminhtml_formbuilder_options>
|
79 |
<block type="core/text_list" name="root" output="toHtml">
|
80 |
<block type="formbuilder/adminhtml_formbuilder_edit_tab_options" name="admin.product.options"/>
|
17 |
*
|
18 |
* @category adminhtml layout
|
19 |
* @package Phxsolution_Formbuilder
|
20 |
+
* @author murad.magento
|
21 |
* @contact contact@phxsolution.com
|
22 |
* @site www.phxsolution.com
|
23 |
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
-->
|
27 |
+
<layout version="0.3.1">
|
28 |
<default>
|
29 |
<reference name="head">
|
30 |
+
<action method="addJs">
|
|
|
31 |
<script>formbuilder/jscolor/jscolor.js</script>
|
|
|
32 |
</action>
|
33 |
+
</reference>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
</default>
|
35 |
<formbuilder_adminhtml_formbuilder_index>
|
36 |
<update handle="editor_index_index"/>
|
38 |
<block type="formbuilder/adminhtml_formbuilder" name="formbuilder" />
|
39 |
</reference>
|
40 |
</formbuilder_adminhtml_formbuilder_index>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
<formbuilder_adminhtml_formbuilder_options>
|
42 |
<block type="core/text_list" name="root" output="toHtml">
|
43 |
<block type="formbuilder/adminhtml_formbuilder_edit_tab_options" name="admin.product.options"/>
|
app/design/frontend/base/default/layout/formbuilder.xml
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
-->
|
27 |
-
<layout version="0.3.
|
28 |
<default translate="label" module="formbuilder">
|
29 |
<reference name="head">
|
30 |
<action method="addCss">
|
@@ -65,20 +65,6 @@
|
|
65 |
</reference>
|
66 |
|
67 |
|
68 |
-
<!-- <reference name="head">
|
69 |
-
<action method="addCss">
|
70 |
-
<stylesheet>css/formbuilder/bootstrap-responsive.css</stylesheet>
|
71 |
-
</action>
|
72 |
-
<action method="addCss">
|
73 |
-
<stylesheet>css/formbuilder/bootstrap.min.css</stylesheet>
|
74 |
-
</action>
|
75 |
-
<action method="addJs">
|
76 |
-
<script>formbuilder/jquery-1.11.1.min.js</script>
|
77 |
-
</action>
|
78 |
-
<action method="addJs">
|
79 |
-
<script>formbuilder/bootstrap.min.js</script>
|
80 |
-
</action>
|
81 |
-
</reference> -->
|
82 |
|
83 |
<reference name="content">
|
84 |
<block type="formbuilder/frontend_formbuilder" name="frontend_formbuilder" template="formbuilder/formbuilder.phtml" />
|
@@ -90,12 +76,6 @@
|
|
90 |
</reference>
|
91 |
<reference name="content">
|
92 |
<block type="formbuilder/frontend_form" name="frontend_form" template="formbuilder/form.phtml" />
|
93 |
-
<!-- <block type="formbuilder/frontend_text" name="frontend_text" template="formbuilder/text.phtml" />
|
94 |
-
<block type="formbuilder/frontend_select" name="frontend_select" template="formbuilder/select.phtml" />
|
95 |
-
<block type="formbuilder/frontend_file" name="frontend_file" template="formbuilder/file.phtml" />
|
96 |
-
<block type="formbuilder/frontend_date" name="frontend_date" template="formbuilder/date.phtml" /> -->
|
97 |
-
<!-- <block type="core/template" name="options_js" template="catalog/product/view/options/js.phtml"/> -->
|
98 |
-
<!-- <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml" /> -->
|
99 |
</reference>
|
100 |
</formbuilder_index_view>
|
101 |
</layout>
|
24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
-->
|
27 |
+
<layout version="0.3.1">
|
28 |
<default translate="label" module="formbuilder">
|
29 |
<reference name="head">
|
30 |
<action method="addCss">
|
65 |
</reference>
|
66 |
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
<reference name="content">
|
70 |
<block type="formbuilder/frontend_formbuilder" name="frontend_formbuilder" template="formbuilder/formbuilder.phtml" />
|
76 |
</reference>
|
77 |
<reference name="content">
|
78 |
<block type="formbuilder/frontend_form" name="frontend_form" template="formbuilder/form.phtml" />
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
</reference>
|
80 |
</formbuilder_index_view>
|
81 |
</layout>
|
app/etc/modules/Phxsolution_Formbuilder.xml
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
*
|
18 |
* @category module global configuration
|
19 |
* @package Phxsolution_Formbuilder
|
20 |
-
* @author
|
21 |
* @contact contact@phxsolution.com
|
22 |
* @site www.phxsolution.com
|
23 |
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
@@ -29,7 +29,7 @@
|
|
29 |
<Phxsolution_Formbuilder>
|
30 |
<active>true</active>
|
31 |
<codePool>community</codePool>
|
32 |
-
<version>0.3.
|
33 |
</Phxsolution_Formbuilder>
|
34 |
</modules>
|
35 |
</config>
|
17 |
*
|
18 |
* @category module global configuration
|
19 |
* @package Phxsolution_Formbuilder
|
20 |
+
* @author murad.magento
|
21 |
* @contact contact@phxsolution.com
|
22 |
* @site www.phxsolution.com
|
23 |
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
29 |
<Phxsolution_Formbuilder>
|
30 |
<active>true</active>
|
31 |
<codePool>community</codePool>
|
32 |
+
<version>0.3.1</version>
|
33 |
</Phxsolution_Formbuilder>
|
34 |
</modules>
|
35 |
</config>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Phxsolution_Formbuilder</name>
|
4 |
-
<version>0.3.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>murad.magento</name><user>phxsolution</user><email>plvaniya@phxsolution.com</email></author></authors>
|
13 |
-
<date>2015-08-
|
14 |
-
<time>
|
15 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Phxsolution_Formbuilder.xml" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Phxsolution_Formbuilder</name>
|
4 |
+
<version>0.3.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Fixed some bugs of version 0.3.0</summary>
|
10 |
+
<description>Fixed some bugs of version 0.3.0</description>
|
11 |
+
<notes>Fixed some bugs of version 0.3.0</notes>
|
12 |
<authors><author><name>murad.magento</name><user>phxsolution</user><email>plvaniya@phxsolution.com</email></author></authors>
|
13 |
+
<date>2015-08-12</date>
|
14 |
+
<time>12:54:46</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Phxsolution_Formbuilder.xml" hash="205b0c120a5a24a7d89aa0593165c9f9"/></dir></target><target name="magecommunity"><dir name="Phxsolution"><dir name="Formbuilder"><dir name="Block"><dir name="Adminhtml"><dir name="Formbuilder"><dir name="Edit"><dir name="Elements"><file name="Jscolorblock.php" hash="1a990d2bf3de66e0a57dfbee0392a24c"/></dir><file name="Form.php" hash="e20273437fb55a13d45d7f614b49e5ed"/><dir name="Tab"><file name="Fieldsgrid.php" hash="935506a56a3e021d90b39469381c1f95"/><file name="Form.php" hash="0f101907777b961c6a8276ec1ee6b553"/><dir name="Options"><file name="Option.php" hash="b90344afd1f05bfc8fd93fd8d6ad6e98"/><dir name="Type"><file name="Date.php" hash="c0565edcd7fe65e834c781d42a6d19c2"/><file name="File.php" hash="0bc4ad5bedd67075aeb36255a90934f5"/><file name="Select.php" hash="6f8fc022bec1946ca819d01426132013"/><file name="Text.php" hash="f0aaf04e77ed8877a91e8335d164a7a3"/></dir></dir><file name="Options.php" hash="a5eb61c23da76f98a58adfbc72ca3746"/><file name="Recordsgrid.php" hash="a8c0f341b75c0b87d0b9d5714b158362"/></dir><file name="Tabs.php" hash="594b46d1fb37f35da23435e5a29ad81e"/></dir><file name="Edit.php" hash="14988d6334ce10c41c5e1c4dcd77bfc4"/><file name="Grid.php" hash="f340245d0ba0c753076da26443de5bf9"/><dir name="Renderer"><file name="Fieldtitle.php" hash="77de7c80130e9c65f9a480c76fef1595"/><file name="Formtitle.php" hash="4f9ace648d90453f65163d9cf71f25af"/><file name="Getoptions.php" hash="4f4bbab55ae3b846c3e82f08d724e93c"/><file name="Image.php" hash="5f8a73638c4f56f31f98cfb66e955e61"/><file name="Numberoffields.php" hash="d6ce87f925d62b87b05e9267e79ae186"/><file name="Recordvalue.php" hash="d70981ef9bc85469ea883a636c9046d5"/></dir></dir><file name="Formbuilder.php" hash="f9f257c3730efb61a02c648e24613d5e"/></dir><dir name="Frontend"><file name="Date.php" hash="0797ca67913af04e5a174db2b53419eb"/><file name="File.php" hash="73b64e65cb622ea93ed127ac690103ae"/><file name="Form.php" hash="d5f5bc44ec2d929e91d22772275121de"/><file name="Formbuilder.php" hash="99d21ff63f09c50bb1c02f231201a7a1"/><file name="Select.php" hash="d97b7f7fa96c4327fb722b14a2995140"/><file name="Text.php" hash="e0dea9657f1ce1b7630f630e3bf133d4"/></dir></dir><dir name="Helper"><file name="Data.php" hash="9325a45f92283e264746a28c5dc2861e"/></dir><dir name="Model"><file name="Fields.php" hash="e03fcfc2bcfda3a0159d32fb134278d6"/><file name="Forms.php" hash="b911a987069ab83971cd8679696f1141"/><dir name="Mysql4"><dir name="Fields"><file name="Collection.php" hash="c7226e1388d223abd4869e2c960fd1c9"/></dir><file name="Fields.php" hash="53a3270bcc205ad77827e501b99d8258"/><dir name="Forms"><file name="Collection.php" hash="ed05e64031c62842df14721614687b33"/></dir><file name="Forms.php" hash="ec9f6f339eb39f32f3b5de7f8d2532ad"/><dir name="Options"><file name="Collection.php" hash="cc0d0272478f6d4f8b72d27bd96d55da"/></dir><file name="Options.php" hash="93bbe8f013286c7b2b4e2afb5d7da780"/><dir name="Records"><file name="Collection.php" hash="70e6959cf7b609f39aebed7058d5b34e"/></dir><file name="Records.php" hash="3209f8474955cff494c419b00fa729f5"/></dir><file name="Observer.php" hash="83deea98e8df7e61962cfb0af69a7682"/><file name="Options.php" hash="90fccc8c4be7b66d269fa9f88c069716"/><file name="Records.php" hash="76f39afcb412cfbae3211df2332ff407"/><file name="Status.php" hash="46137d1b2f0f3a2bc96729db3e0c6e99"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FormbuilderController.php" hash="f114ddf849b876f80133cbc65041eb58"/></dir><file name="IndexController.php" hash="225c6e59dbb9318e80330e21457f56ea"/></dir><dir name="etc"><file name="config.xml" hash="7a41ad74875150b5066973025e4a6000"/><file name="system.xml" hash="50e22f7a3bffae4c59f6b6abe65420bf"/></dir><dir name="sql"><dir name="formbuilder_setup"><file name="mysql4-install-0.1.0.php" hash="16a10b71a46e014f24c4c9f3e6c059e5"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="formbuilder.xml" hash="cb2c356c3666211638016a8ae5ff9854"/></dir><dir name="template"><dir name="formbuilder"><file name="date.phtml" hash="f9cf6dbae29f6078b1891d304c2546de"/><file name="file.phtml" hash="f9eb1f8c2cd771721073680d88980d85"/><file name="form.phtml" hash="28d0723b899618875fbfbe1bad88c2d0"/><file name="formbuilder.phtml" hash="28ea24b9237feec17e8475d0540e06a2"/><file name="select.phtml" hash="3d95fa9af63afcf5eccff1250d48f7dc"/><file name="text.phtml" hash="38503786b985bf3fcd48af6009a4bb10"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="formbuilder.xml" hash="89e5db34b8171e238af46178d386a0f1"/></dir><dir name="template"><dir name="formbuilder"><dir name="catalog"><dir name="product"><dir name="edit"><dir name="options"><file name="option.phtml" hash="c24802beaec38ea569082a0dc0268ad1"/><dir name="type"><file name="date.phtml" hash="e939ad56a38df54ef2e02050b8c196d4"/><file name="file.phtml" hash="6195acc29483fc3743f4f3761c2050c4"/><file name="select.phtml" hash="bad580b6b244b717a1de0a266edd255a"/><file name="text.phtml" hash="72d6ef6a4a46b7b342fd90be449e3731"/></dir></dir><file name="options.phtml" hash="8b4febcfd81ce0ef726393fbabfdd024"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="formbuilder"><file name="custom.css" hash="497bfb41e94a4659d36bffdaa0714a7b"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="formbuilder"><dir name="jscolor"><file name="arrow.gif" hash="5034704a76cd55c1cbcbc58ea6bf523f"/><file name="cross.gif" hash="ba9a274b9323753cd95bc3b1eb2f4e5f"/><file name="hs.png" hash="fefa1a03d92ebad25c88dca94a0b63db"/><file name="hv.png" hash="990d71cada17da100653636cf8490884"/><file name="jscolor.js" hash="d85e03380b38c0937ee2c2594c599720"/></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|