Phxsolution_Formbuilder - Version 0.3.0

Version Notes

Releasing update of the extension, version 0.3.0 with email Email functionality & Issues of Form title & Form status not getting saved.

Download this release

Release Info

Developer Prakash Vaniya
Extension Phxsolution_Formbuilder
Version 0.3.0
Comparing to
See all releases


Code changes from version 0.2.0 to 0.3.0

app/code/community/Phxsolution/Formbuilder/Block/Adminhtml/Formbuilder/Edit/Tab/Recordsgrid.php CHANGED
@@ -1,141 +1,139 @@
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 block
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_Block_Adminhtml_Formbuilder_Edit_Tab_Recordsgrid extends Mage_Adminhtml_Block_Widget_Grid
29
- implements Mage_Adminhtml_Block_Widget_Tab_Interface
30
- {
31
- public function _construct()
32
- {
33
- parent::_construct();
34
- $this->setId('records_grid');
35
- $this->setDefaultSort('records_index');
36
- $this->setDefaultDir('ASC');
37
- //enable ajax grid
38
- $this->setUseAjax(true);
39
- $this->setSaveParametersInSession(true);
40
- }
41
- protected function _prepareCollection()
42
- {
43
- /*if(!Mage::helper('formbuilder')->isEnabled())
44
- {
45
- Mage::getSingleton('adminhtml/session')->addError('Extension is disabled');
46
- return;
47
- }*/
48
- $currentFormId = $this->getRequest()->getParam('id');
49
- $recordsModel = Mage::helper('formbuilder')->getRecordsModel();
50
- $collection = $recordsModel->getRecordsCollection($currentFormId);
51
- $this->setCollection($collection);
52
- return parent::_prepareCollection();
53
- }
54
- protected function _prepareColumns()
55
- {
56
- //$titleArray = array(8=>'First Name',9=>'Last Name',10=>'12th Result');
57
- $currentFormId = $this->getRequest()->getParam('id');
58
- $fieldsModel = Mage::helper('formbuilder')->getFieldsModel();
59
- $prepareFieldTitles = array();
60
- $prepareFieldTitles = $fieldsModel->prepareFieldTitles($currentFormId);
61
-
62
- /*echo "<pre>";
63
- print_r($prepareFieldTitles);
64
- echo "</pre>";*/
65
-
66
- if(count($prepareFieldTitles))
67
- {
68
- $this->addColumn('records_index', array(
69
- 'header' => Mage::helper('formbuilder')->__('ID'),
70
- 'align' => 'left',
71
- 'index' => 'records_index',
72
- ));
73
- $this->addColumn('customer', array(
74
- 'header' => Mage::helper('formbuilder')->__('Customer'),
75
- 'align' => 'left',
76
- 'index' => 'customer',
77
- ));
78
- $i=1;
79
- foreach ($prepareFieldTitles as $fieldId => $fieldTitle)
80
- {
81
- $this->addColumn($fieldId, array(
82
- 'header' => Mage::helper('formbuilder')->__($fieldTitle),
83
- 'align' => 'left',
84
- 'name' => $i++,
85
- 'index' => $fieldId,
86
- 'renderer' => 'formbuilder/adminhtml_formbuilder_renderer_recordvalue'
87
- ));
88
- }
89
- }
90
-
91
-
92
- /*$this->addColumn('records_index', array(
93
- 'header' => Mage::helper('formbuilder')->__('ID'),
94
- 'align' => 'left',
95
- 'index' => 'records_index',
96
- ));
97
- $this->addColumn('forms_index', array(
98
- 'header' => Mage::helper('formbuilder')->__('FORM'),
99
- 'align' => 'left',
100
- 'index' => 'forms_index',
101
- ));
102
- $this->addColumn('fields_index', array(
103
- 'header' => Mage::helper('formbuilder')->__('FIELD ID'),
104
- 'align' => 'left',
105
- 'index' => 'fields_index',
106
- 'renderer' => 'formbuilder/adminhtml_formbuilder_renderer_fieldtitle'
107
- ));
108
- $this->addColumn('options_index', array(
109
- 'header' => Mage::helper('formbuilder')->__('OPTION ID'),
110
- 'align' => 'left',
111
- 'index' => 'options_index',
112
- ));
113
- $this->addColumn('value', array(
114
- 'header' => Mage::helper('formbuilder')->__('VALUE'),
115
- 'align' => 'left',
116
- 'index' => 'value',
117
- ));*/
118
- return parent::_prepareColumns();
119
- }
120
- //this method is reuired if you want ajax grid
121
- public function getGridUrl()
122
- {
123
- return $this->getUrl('*/*/recordsgrid', array('_current' => true));
124
- }
125
- public function canShowTab()
126
- {
127
- return true;
128
- }
129
- public function isHidden()
130
- {
131
- return false;
132
- }
133
- public function getTabLabel()
134
- {
135
- return $this->__('Fields List');
136
- }
137
- public function getTabTitle()
138
- {
139
- return $this->__('Fields List');
140
- }
141
  }
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 block
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_Block_Adminhtml_Formbuilder_Edit_Tab_Recordsgrid extends Mage_Adminhtml_Block_Widget_Grid
29
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
30
+ {
31
+ public function _construct()
32
+ {
33
+ parent::_construct();
34
+ $this->setId('records_grid');
35
+ $this->setDefaultSort('records_index');
36
+ $this->setDefaultDir('ASC');
37
+ //enable ajax grid
38
+ $this->setUseAjax(true);
39
+ $this->setSaveParametersInSession(true);
40
+ }
41
+ protected function _prepareCollection()
42
+ {
43
+ /*if(!Mage::helper('formbuilder')->isEnabled())
44
+ {
45
+ Mage::getSingleton('adminhtml/session')->addError('Extension is disabled');
46
+ return;
47
+ }*/
48
+ $currentFormId = $this->getRequest()->getParam('id');
49
+ $recordsModel = Mage::helper('formbuilder')->getRecordsModel();
50
+ $collection = $recordsModel->getRecordsCollection($currentFormId);
51
+ $this->setCollection($collection);
52
+ return parent::_prepareCollection();
53
+ }
54
+ protected function _prepareColumns()
55
+ {
56
+ //$titleArray = array(8=>'First Name',9=>'Last Name',10=>'12th Result');
57
+ $currentFormId = $this->getRequest()->getParam('id');
58
+ $fieldsModel = Mage::helper('formbuilder')->getFieldsModel();
59
+ $prepareFieldTitles = array();
60
+ $prepareFieldTitles = $fieldsModel->prepareFieldTitles($currentFormId);
61
+
62
+ /*echo "<pre>";
63
+ print_r($prepareFieldTitles);
64
+ echo "</pre>";*/
65
+ if(count($prepareFieldTitles))
66
+ {
67
+ $this->addColumn('records_index', array(
68
+ 'header' => Mage::helper('formbuilder')->__('ID'),
69
+ 'align' => 'left',
70
+ 'index' => 'records_index',
71
+ ));
72
+ $this->addColumn('customer', array(
73
+ 'header' => Mage::helper('formbuilder')->__('Customer'),
74
+ 'align' => 'left',
75
+ 'index' => 'customer',
76
+ ));
77
+ $i=1;
78
+ foreach ($prepareFieldTitles as $fieldId => $fieldTitle)
79
+ {
80
+ $this->addColumn($fieldId, array(
81
+ 'header' => Mage::helper('formbuilder')->__($fieldTitle),
82
+ 'align' => 'left',
83
+ 'name' => $i++,
84
+ 'index' => $fieldId,
85
+ 'renderer' => 'formbuilder/adminhtml_formbuilder_renderer_recordvalue'
86
+ ));
87
+ }
88
+ }
89
+
90
+ /*$this->addColumn('records_index', array(
91
+ 'header' => Mage::helper('formbuilder')->__('ID'),
92
+ 'align' => 'left',
93
+ 'index' => 'records_index',
94
+ ));
95
+ $this->addColumn('forms_index', array(
96
+ 'header' => Mage::helper('formbuilder')->__('FORM'),
97
+ 'align' => 'left',
98
+ 'index' => 'forms_index',
99
+ ));
100
+ $this->addColumn('fields_index', array(
101
+ 'header' => Mage::helper('formbuilder')->__('FIELD ID'),
102
+ 'align' => 'left',
103
+ 'index' => 'fields_index',
104
+ 'renderer' => 'formbuilder/adminhtml_formbuilder_renderer_fieldtitle'
105
+ ));
106
+ $this->addColumn('options_index', array(
107
+ 'header' => Mage::helper('formbuilder')->__('OPTION ID'),
108
+ 'align' => 'left',
109
+ 'index' => 'options_index',
110
+ ));
111
+ $this->addColumn('value', array(
112
+ 'header' => Mage::helper('formbuilder')->__('VALUE'),
113
+ 'align' => 'left',
114
+ 'index' => 'value',
115
+ ));*/
116
+ return parent::_prepareColumns();
117
+ }
118
+ //this method is reuired if you want ajax grid
119
+ public function getGridUrl()
120
+ {
121
+ return $this->getUrl('*/*/recordsgrid', array('_current' => true));
122
+ }
123
+ public function canShowTab()
124
+ {
125
+ return true;
126
+ }
127
+ public function isHidden()
128
+ {
129
+ return false;
130
+ }
131
+ public function getTabLabel()
132
+ {
133
+ return $this->__('Fields List');
134
+ }
135
+ public function getTabTitle()
136
+ {
137
+ return $this->__('Fields List');
138
+ }
 
 
139
  }
app/code/community/Phxsolution/Formbuilder/Block/Adminhtml/Formbuilder/Renderer/Recordvalue.php CHANGED
@@ -1,111 +1,106 @@
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 block renderer
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_Block_Adminhtml_Formbuilder_Renderer_Recordvalue extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
29
- {
30
- public function render(Varien_Object $row)
31
- {
32
- /*$recordId = intval($row->getData('records_index'));
33
- $fieldId = intval($this->getColumn()->getIndex());
34
- $i = intval($this->getColumn()->getName());
35
- //return "recordId=".$recordId.", fieldId=".$fieldId;
36
-
37
- $recordsModel = Mage::helper('formbuilder')->getRecordsModel();
38
- $recordsModel->load($recordId);
39
- if($recordsModel['fields_index']==$fieldId)
40
- return "($fieldId) ".$recordsModel['value'];
41
- return "($fieldId)";*/
42
-
43
- $recordId = intval($row->getData('records_index'));
44
- $fieldId = intval($this->getColumn()->getIndex());
45
- $i = intval($this->getColumn()->getName());
46
- $found = false;
47
-
48
- //$serialized = 'a:3:{i:8;s:16:"test first name3";i:9;s:15:"test last name3";i:10;s:1:"7";}';
49
- $serialized = $row->getData('value');
50
- $unserialized = unserialize($serialized);
51
- $recordsModel = Mage::helper('formbuilder')->getRecordsModel();
52
- foreach ($unserialized as $key => $value)
53
- {
54
- $recordsModel->load($recordId);
55
- if($key==$fieldId)
56
- {
57
- $found = true;
58
- $returnValue = $value;
59
- break;
60
- }
61
- }
62
- if($found)
63
- {
64
- $optionsModel = Mage::helper('formbuilder')->getOptionsModel();
65
- if(is_array($returnValue))
66
- {
67
- foreach ($returnValue as $key)
68
- {
69
- $optionsModel->load($key);
70
- if($title = $optionsModel['title'])
71
- $temp[] = $title;
72
- else
73
- $temp[] = $returnValue;
74
- }
75
- return implode(',',$temp);
76
- }
77
- else
78
- {
79
- if(is_numeric($returnValue))
80
- {
81
- $optionsModel->load($returnValue);
82
- if($title = $optionsModel['title'])
83
- return $title;
84
- }
85
- else
86
- {
87
- $supported_image = array('gif','jpg','jpeg','png');
88
- $src_file_name = $returnValue;
89
- $ext = strtolower(pathinfo($src_file_name, PATHINFO_EXTENSION)); // Using strtolower to overcome case sensitive
90
- if (in_array($ext, $supported_image))
91
- {
92
- $file_path = Mage::getBaseUrl('media') . $returnValue;
93
- $gd = @imagecreatefromstring(file_get_contents($file_path));
94
- if ($gd === false)
95
- return "Image seems corrupted or not found";
96
- //else
97
- $html = '<img height=75 width=75 ';
98
- $html .= 'src="'. Mage::getBaseUrl('media') . $returnValue . '"';
99
- $html .= 'class="grid-image ' . $this->getColumn()->getInlineCss().'"';
100
- $html .= 'style="weight:75px;height:75px"' . '"/>';
101
- return $html;
102
-
103
- }
104
- else
105
- return $returnValue;
106
- }
107
- }
108
- }
109
- return "";
110
- }
111
  }
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 block renderer
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_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'));
37
+ $fieldId = intval($this->getColumn()->getIndex());
38
+ $i = intval($this->getColumn()->getName());*/
39
+ $recordId = ($recordId) ? $recordId : intval($row->getData('records_index'));
40
+ $fieldId = ($fieldId) ? $fieldId : intval($this->getColumn()->getIndex());
41
+ $found = false;
42
+
43
+ //$serialized = 'a:3:{i:8;s:16:"test first name3";i:9;s:15:"test last name3";i:10;s:1:"7";}';
44
+ $serializedValue = ($serializedValue) ? $serializedValue : $row->getData('value');
45
+ $unserialized = unserialize($serializedValue);
46
+ $recordsModel = Mage::helper('formbuilder')->getRecordsModel();
47
+ foreach ($unserialized as $key => $value)
48
+ {
49
+ $recordsModel->load($recordId);
50
+ if($key==$fieldId)
51
+ {
52
+ $found = true;
53
+ $returnValue = $value;
54
+ break;
55
+ }
56
+ }
57
+ if($found)
58
+ {
59
+ $optionsModel = Mage::helper('formbuilder')->getOptionsModel();
60
+ if(is_array($returnValue))
61
+ {
62
+ foreach ($returnValue as $key)
63
+ {
64
+ $optionsModel->load($key);
65
+ if($title = $optionsModel['title'])
66
+ $temp[] = $title;
67
+ else
68
+ $temp[] = $returnValue;
69
+ }
70
+ return implode(',',$temp);
71
+ }
72
+ else
73
+ {
74
+ if(is_numeric($returnValue))
75
+ {
76
+ $optionsModel->load($returnValue);
77
+ if($title = $optionsModel['title'])
78
+ return $title;
79
+ }
80
+ else
81
+ {
82
+ $supported_image = array('gif','jpg','jpeg','png');
83
+ $src_file_name = $returnValue;
84
+ $ext = strtolower(pathinfo($src_file_name, PATHINFO_EXTENSION)); // Using strtolower to overcome case sensitive
85
+ if (in_array($ext, $supported_image))
86
+ {
87
+ $file_path = Mage::getBaseUrl('media') . $returnValue;
88
+ $gd = @imagecreatefromstring(file_get_contents($file_path));
89
+ if ($gd === false)
90
+ return "Image seems corrupted or not found";
91
+ //else
92
+ $html = '<img height=75 width=75 ';
93
+ $html .= 'src="'. Mage::getBaseUrl('media') . $returnValue . '"';
94
+ $html .= 'class="grid-image ' . $this->getColumn()->getInlineCss().'"';
95
+ $html .= 'style="weight:75px;height:75px"' . '"/>';
96
+ return $html;
97
+
98
+ }
99
+ else
100
+ return $returnValue;
101
+ }
102
+ }
103
+ }
104
+ return "";
105
+ }
 
 
 
 
 
106
  }
app/code/community/Phxsolution/Formbuilder/controllers-7-8-15/Adminhtml/FormbuilderController.php ADDED
@@ -0,0 +1,409 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,571 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/Adminhtml/FormbuilderController.php CHANGED
@@ -1,409 +1,411 @@
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
  }
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
+
268
+
269
+ $model->setData($data)
270
+ ->setFormsIndex($this->getRequest()->getParam("id"))
271
+ ->save();
272
+
273
+ if(!$currentFormId)
274
+ $currentFormId = $model->getFormsIndex();
275
+ // saveFields
276
+ $fieldsArray = $data['product']['options'];
277
+ //Mage::helper('formbuilder')->saveFields($fieldsArray);
278
+ $fieldsModel = Mage::helper('formbuilder')->getFieldsModel();
279
+ $fieldsModel->saveFields($fieldsArray,$currentFormId);
280
+ // saveFields
281
+
282
+ //save no of fields
283
+ $fieldsModel = Mage::helper('formbuilder')->getFieldsModel();
284
+ $getFieldsCollection = $fieldsModel->getFieldsCollection($currentFormId);
285
+ $getNoOfFields = count($getFieldsCollection);
286
+ //$data['no_of_fields'] = $getNoOfFields;
287
+ $formsModel = Mage::helper('formbuilder')->getFormsModel();
288
+ $formsModel->load($currentFormId);
289
+ $formsModel->setNoOfFields($getNoOfFields);
290
+ $formsModel->save();
291
+ //save no of fields ends
292
+
293
+ //$this->createCmsPage($model);
294
+
295
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('formbuilder')->__('Form was successfully saved'));
296
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
297
+
298
+ if ($this->getRequest()->getParam('back')) {
299
+ $this->_redirect('*/*/edit', array('id' => $model->getFormsIndex()));
300
+ return;
301
+ }
302
+ $this->_redirect('*/*/');
303
+ return;
304
+ }
305
+ catch (Exception $e)
306
+ {
307
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
308
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
309
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
310
+ return;
311
+ }
312
+ }
313
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('formbuilder')->__('Unable to find Form to save'));
314
+ $this->_redirect('*/*/');
315
+ }
316
+ public function createCmsPage($currentModel)
317
+ {
318
+ $title = $currentModel['title'];
319
+ $identifier = strtolower($title);
320
+ $identifier = str_replace(" ","-",$identifier);
321
+
322
+ Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
323
+ $cmsPage = array(
324
+ 'title' => $title,
325
+ 'identifier' => $identifier,
326
+ 'content' => '{{block type="formbuilder/frontend_form" name="frontend_form" template="formbuilder/form.phtml"}}',
327
+ 'is_active' => 1,
328
+ 'sort_order' => 0,
329
+ 'stores' => array(0),
330
+ 'root_template' => 'one_column'
331
+ );
332
+ Mage::getModel('cms/page')->setData($cmsPage)->save();
333
+ }
334
+ public function deleteAction()
335
+ {
336
+ if( $this->getRequest()->getParam('id') > 0 )
337
+ {
338
+ try
339
+ {
340
+ $model = Mage::getModel('formbuilder/forms');
341
+
342
+ $model->setFormsIndex($this->getRequest()->getParam('id'))
343
+ ->delete();
344
+
345
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Form was successfully deleted'));
346
+ $this->_redirect('*/*/');
347
+ }
348
+ catch (Exception $e)
349
+ {
350
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
351
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
352
+ }
353
+ }
354
+ $this->_redirect('*/*/');
355
+ }
356
+ public function massDeleteAction()
357
+ {
358
+ $formbuilderIds = $this->getRequest()->getParam('formbuilder');
359
+ if(!is_array($formbuilderIds))
360
+ {
361
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select Form(s)'));
362
+ }
363
+ else
364
+ {
365
+ try
366
+ {
367
+ foreach ($formbuilderIds as $formbuilderId)
368
+ {
369
+ $formbuilder = Mage::getModel('formbuilder/forms')->load($formbuilderId);
370
+ $formbuilder->delete();
371
+ }
372
+ Mage::getSingleton('adminhtml/session')->addSuccess(
373
+ Mage::helper('adminhtml')->__('Total of %d record(s) were successfully deleted', count($formbuilderIds)));
374
+ }
375
+ catch (Exception $e)
376
+ {
377
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
378
+ }
379
+ }
380
+ $this->_redirect('*/*/index');
381
+ }
382
+ public function massStatusAction()
383
+ {
384
+ $formbuilderIds = $this->getRequest()->getParam('formbuilder');
385
+ if(!is_array($formbuilderIds))
386
+ {
387
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select Form(s)'));
388
+ }
389
+ else
390
+ {
391
+ try
392
+ {
393
+ foreach ($formbuilderIds as $formbuilderId)
394
+ {
395
+ $formbuilder = Mage::getSingleton('formbuilder/forms')
396
+ ->load($formbuilderId)
397
+ ->setStatus($this->getRequest()->getParam('status'))
398
+ ->setIsMassupdate(true)
399
+ ->save();
400
+ }
401
+ $this->_getSession()->addSuccess(
402
+ $this->__('Total of %d record(s) were successfully updated', count($formbuilderIds)));
403
+ }
404
+ catch (Exception $e)
405
+ {
406
+ $this->_getSession()->addError($e->getMessage());
407
+ }
408
+ }
409
+ $this->_redirect('*/*/index');
410
+ }
411
  }
app/code/community/Phxsolution/Formbuilder/controllers/IndexController.php CHANGED
@@ -1,571 +1,723 @@
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
  }
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
+ 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
+ {
45
+ parent::preDispatch();
46
+ if(!Mage::helper('formbuilder')->isEnabled())
47
+ {
48
+ //$this->_redirectUrl(Mage::helper('core/url')->getHomeUrl());
49
+ $helper = Mage::helper('formbuilder');
50
+ $session = Mage::getSingleton('core/session');
51
+ $session->addError($helper->__("Formbuilder Extension seems disabled."));
52
+ }
53
+ }
54
+ public function indexAction()
55
+ {
56
+ $this->loadLayout();
57
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Formbuilder"));
58
+
59
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
60
+ $breadcrumbs->addCrumb("home", array(
61
+ "label" => $this->__("Home"),
62
+ "title" => $this->__("Home"),
63
+ "link" => Mage::getBaseUrl()
64
+ ));
65
+ $breadcrumbs->addCrumb("formbuilder", array(
66
+ "label" => $this->__("Formbuilder"),
67
+ "title" => $this->__("Formbuilder")
68
+ ));
69
+ $this->renderLayout();
70
+ }
71
+ public function viewAction()
72
+ {
73
+ $id = $this->getRequest()->getParam('id');
74
+ $formsModel = Mage::helper('formbuilder')->getFormsModel();
75
+ $formsModel->load($id);
76
+ if(empty($formsModel['forms_index']))
77
+ {
78
+ Mage::getSingleton('core/session')->addError('Form not found');
79
+ //$this->_redirectUrl(Mage::helper('core/url')->getHomeUrl());
80
+ $this->_redirectUrl( Mage::getUrl('formbuilder') );
81
+ }
82
+ Mage::register('frontend_form',$formsModel);
83
+
84
+ $this->loadLayout();
85
+
86
+ $this->_currentFormId = intval($id);
87
+ $currentForm = Mage::helper('formbuilder')->getCurrentFormDetails($this->_currentFormId);
88
+ $currentFormTitle = "";
89
+ $currentFormTitle = $currentForm['title'];
90
+ $this->_currentFormTitle = $currentFormTitle;
91
+
92
+ if($currentFormTitle)
93
+ $this->getLayout()->getBlock("head")->setTitle($this->__($currentFormTitle));
94
+ else
95
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Formbuilder"));
96
+
97
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
98
+ $breadcrumbs->addCrumb("home", array(
99
+ "label" => $this->__("Home"),
100
+ "title" => $this->__("Home"),
101
+ "link" => Mage::getBaseUrl()
102
+ ));
103
+ if($currentFormTitle)
104
+ {
105
+ $breadcrumbs->addCrumb("formbuilder", array(
106
+ "label" => $this->__("Formbuilder"),
107
+ "title" => $this->__("Formbuilder"),
108
+ "link" => Mage::getUrl('formbuilder')
109
+ ));
110
+ $breadcrumbs->addCrumb($currentFormTitle, array(
111
+ "label" => $this->__($currentFormTitle),
112
+ "title" => $this->__($currentFormTitle)
113
+ ));
114
+ }
115
+ else
116
+ {
117
+ $breadcrumbs->addCrumb("formbuilder", array(
118
+ "label" => $this->__("Formbuilder"),
119
+ "title" => $this->__("Formbuilder")
120
+ ));
121
+ }
122
+ $this->renderLayout();
123
+ }
124
+ public function checkEmpty($value)
125
+ {
126
+ $error = false;
127
+ if(!Zend_Validate::is($value, 'NotEmpty'))
128
+ $error = $this->_helper->__("'".$this->_fieldTitle."'".' is a required field');
129
+ return $error;
130
+ }
131
+ public function checkLength($value,$lengthLimit)
132
+ {
133
+ $error = false;
134
+ if(strlen($value)>$lengthLimit)
135
+ $error = $this->_helper->__("'".$this->_fieldTitle."'".' text length must be less then or equal to '.$lengthLimit);
136
+ return $error;
137
+ }
138
+ public function checkFile()
139
+ {
140
+ $fileErrorsArray = array();
141
+ foreach ($this->_fileObject as $key => $value)
142
+ {
143
+ $this->_fileCanBeUploaded = true;
144
+
145
+ list($pre,$fileKey,$post) = explode('_',$key);
146
+ $this->_fieldsModel->load($fileKey);
147
+ $this->_fieldTitle = $this->_fieldsModel['title'];
148
+ if($value['name']=='')
149
+ {
150
+ $this->_fileCanBeUploaded = false;
151
+ if($this->_fieldsModel['is_require'])
152
+ {
153
+ $fileErrorsArray[] = "'".$this->_fieldTitle."' is a required field";
154
+ }
155
+ }
156
+ else
157
+ {
158
+ $allowed = explode(',',$this->_fieldsModel['file_extension']);
159
+ $filename = $value['name'];
160
+ $ext = pathinfo($filename, PATHINFO_EXTENSION);
161
+
162
+ $fileTypeString = $value['type'];
163
+ list($fileType,$fileExtension) = explode('/',$fileTypeString);
164
+
165
+ if(!in_array($ext,$allowed) )
166
+ {
167
+ $fileErrorsArray[] = "'".$this->_fieldTitle."' has invalid extension";
168
+ $this->_fileCanBeUploaded = false;
169
+ }
170
+ elseif($fileType=='image' && $this->_fieldsModel['image_size_x'] || $this->_fieldsModel['image_size_y'])
171
+ {
172
+ $image_info = getimagesize($value['tmp_name']);
173
+ $image_width = $image_info[0];
174
+ $image_height = $image_info[1];
175
+ $specified_width=$this->_fieldsModel['image_size_x'];
176
+ $specified_height=$this->_fieldsModel['image_size_y'];
177
+ if( $image_width > $specified_width && $image_height > $specified_height )
178
+ {
179
+ $fileErrorsArray[] = "'".$this->_fieldTitle."' has invalid size";
180
+ $this->_fileCanBeUploaded = false;
181
+ }
182
+ }
183
+ }
184
+ if($this->_validateDataErrorsCount==0 && $this->_fileCanBeUploaded)
185
+ $this->_filesToBeUploaded[] = $key;
186
+ }
187
+ return $fileErrorsArray;
188
+ }
189
+ public function validateDate($month,$day,$year,$fieldId)
190
+ {
191
+ $yearRange = $this->_helper->getYearRange();
192
+ list($yearFrom,$yearTo) = explode(',',$yearRange);
193
+
194
+ if( !checkDate($month,$day,$year) || $year<$yearFrom || $year>$yearTo )
195
+ return "'".$this->_fieldTitle."' is not valid";
196
+ $day += 1;
197
+ $dateToFormat = "$year-$month-$day";
198
+ //$dateToFormat = '2011-12-11';
199
+ $this->_dateToBeSaved[$fieldId] = Mage::helper('core')->formatDate($dateToFormat, 'long', false);
200
+ return;
201
+ }
202
+ public function validateTime($hour="",$minute="",$day_part="",$fieldId)
203
+ {
204
+ $timeFormat = $this->_helper->getTimeFormat();
205
+ if($timeFormat=='12h' && $hour && $minute && $day_part)
206
+ {
207
+ //12 hour format (12:50PM)
208
+ $time12 = "$hour:$minute$day_part";
209
+ $res = preg_match('/^(0[1-9]|1[0-2]):([0-5][0-9])(am|pm)$/', $time12);
210
+ if (!$time12 || !$res)
211
+ return "'".$this->_fieldTitle."' is not valid";
212
+ if($this->_fieldsModel['type']=='date_time')
213
+ $this->_dateToBeSaved[$fieldId] .= ", $time12";
214
+ elseif($this->_fieldsModel['type']=='time')
215
+ $this->_dateToBeSaved[$fieldId] .= "$time12";
216
+ return;
217
+ }
218
+ elseif($timeFormat=='24h' && $hour && $minute)
219
+ {
220
+ //24 hour format (00:00:00)
221
+ $time24 = "$hour:$minute:00";
222
+ $res = preg_match("/^([0-2][0-3]|[01]?[1-9]):([0-5]?[0-9]):([0-5]?[0-9])$/", $time24);
223
+ if (!$time24 || !$res)
224
+ return "'".$this->_fieldTitle."' is not valid";
225
+ if($this->_fieldsModel['type']=='date_time')
226
+ $this->_dateToBeSaved[$fieldId] .= ", $time24";
227
+ elseif($this->_fieldsModel['type']=='time')
228
+ $this->_dateToBeSaved[$fieldId] .= "$time24";
229
+ return;
230
+ }
231
+ return "'".$this->_fieldTitle."' is not valid";
232
+ }
233
+ public function checkDate( $dateArray,$fieldId )
234
+ {
235
+ $month=$day=$year=$hour=$minute=$day_part="";
236
+ foreach ($dateArray as $key => $value)
237
+ {
238
+ if($key=='date')
239
+ list($month,$day,$year) = explode('/',$value);
240
+ elseif($key=='day')
241
+ $day = $value;
242
+ elseif($key=='month')
243
+ $month = $value;
244
+ elseif($key=='year')
245
+ $year = $value;
246
+ elseif($key=='hour')
247
+ {
248
+ if($value>=0 && $value<=9)
249
+ $hour = '0'.$value;
250
+ else
251
+ $hour = $value;
252
+ }
253
+ elseif($key=='minute')
254
+ {
255
+ if($value>=0 && $value<=9)
256
+ $minute = '0'.$value;
257
+ else
258
+ $minute = $value;
259
+ }
260
+ elseif($key=='day_part')
261
+ $day_part = $value;
262
+ }
263
+ $this->_dateToBeSaved[$fieldId] = "";
264
+ if($this->_fieldsModel['type']=='date')
265
+ {
266
+ if($month && $day && $year)
267
+ return $this->validateDate($month,$day,$year,$fieldId);
268
+ }
269
+ elseif($this->_fieldsModel['type']=='date_time')
270
+ {
271
+ if($month && $day && $year)
272
+ {
273
+ if($error = $this->validateDate($month,$day,$year,$fieldId))
274
+ return $error;
275
+ else
276
+ return $this->validateTime($hour,$minute,$day_part,$fieldId);
277
+ }
278
+ }
279
+ elseif($this->_fieldsModel['type']=='time')
280
+ {
281
+ if($hour && $minute)
282
+ return $this->validateTime($hour,$minute,$day_part,$fieldId);
283
+ }
284
+ return false;
285
+ }
286
+ public function checkCheckbox($checkboxArray,$fieldId)
287
+ {
288
+ return "checkboxArray = ".implode(',',$checkboxArray);
289
+ }
290
+ public function _validateData($data)
291
+ {
292
+ $this->_currentFormId = $data['current_form_id'];
293
+ $errorsArray = $this->_fileErrorsArray = array();
294
+ $this->_fieldsModel = $this->_helper->getFieldsModel();
295
+ $previousKey = 0;
296
+
297
+ $optionsDataArray = $verifiedCheckboxIds = $allCheckboxTypeIds = array();
298
+ $optionsDataArray = $data['options'];
299
+ foreach ($optionsDataArray as $key => $value)
300
+ {
301
+ $this->_fieldsModel->load($key);
302
+ $this->_fieldTitle = $this->_fieldsModel['title'];
303
+ if($this->_fieldsModel['forms_index']==$this->_currentFormId)
304
+ {
305
+ if(is_array($value))
306
+ {
307
+ foreach ($value as $key2 => $value2)
308
+ {
309
+ if($previousKey!=$key)
310
+ {
311
+ if($this->_fieldsModel['is_require'])
312
+ {
313
+ $errorsArray[] = $this->checkEmpty($value2);
314
+ if($this->_fieldsModel['type']=='checkbox')
315
+ $verifiedCheckboxIds[] = $key;
316
+ }
317
+ if($lengthLimit = $this->_fieldsModel['max_characters'])
318
+ $errorsArray[] = $this->checkLength($value2,$lengthLimit);
319
+ if($this->_fieldsModel['previous_group']=='date')
320
+ {
321
+ $fieldId = $key;
322
+ $errorsArray[] = $this->checkDate( $optionsDataArray[$key],$fieldId );
323
+ }
324
+ //$errorsArray[] = "key = ".$key;
325
+ }
326
+ $previousKey = $key;
327
+ }
328
+ }
329
+ else
330
+ {
331
+ if($this->_fieldsModel['is_require'])
332
+ $errorsArray[] = $this->checkEmpty($value);
333
+ if($lengthLimit = $this->_fieldsModel['max_characters'])
334
+ $errorsArray[] = $this->checkLength($value,$lengthLimit);
335
+ //$errorsArray[] = "key = ".$key;
336
+ }
337
+ }
338
+ }
339
+ // validate checkbox
340
+ $allCheckboxTypeIds = $this->_fieldsModel->getCheckboxTypeIds($this->_currentFormId);
341
+ if(count($allCheckboxTypeIds))
342
+ {
343
+ foreach ($allCheckboxTypeIds as $key => $value)
344
+ {
345
+ $checkboxId = implode(',',$value);
346
+ $this->_fieldsModel->load($checkboxId);
347
+ $title = $this->_fieldsModel['title'];
348
+ $isRequired = ($this->_fieldsModel['is_require']) ? true : false;
349
+ if( !in_array( $checkboxId,$verifiedCheckboxIds ) && $isRequired )
350
+ $errorsArray[] = "'".$title."' is a required field";
351
+ }
352
+ }
353
+ $count=0;
354
+ $errorsArrayFinal = array();
355
+ foreach ($errorsArray as $key => $value)
356
+ {
357
+ if(!empty($value))
358
+ {
359
+ $count++;
360
+ $errorsArrayFinal[] = $value;
361
+ }
362
+ }
363
+ $this->_validateDataErrorsCount = $count;
364
+ $this->_fileErrorsArray = $this->checkFile();
365
+ foreach ($this->_fileErrorsArray as $key => $value)
366
+ {
367
+ if(!empty($value))
368
+ $errorsArrayFinal[] = $value;
369
+ }
370
+ return $errorsArrayFinal;
371
+ }
372
+ public function uploadFile($key)
373
+ {
374
+ try
375
+ {
376
+ $path = Mage::getBaseDir('media') . DS . 'formbuilder/frontend/uploaded_files' . DS;
377
+ $uploader = new Varien_File_Uploader($key);
378
+ //$uploader->setAllowedExtensions(array('jpg','png','gif'));
379
+ $uploader->setAllowRenameFiles(false);
380
+ $uploader->setFilesDispersion(false);
381
+ $destFile = $path.$this->_fileObject[$key]['name'];
382
+ $filename = $uploader->getNewFileName($destFile);
383
+ $uploader->save($path, $filename);
384
+
385
+ return "formbuilder/frontend/uploaded_files/".$filename;
386
+ }
387
+ catch (Exception $e)
388
+ {
389
+ $this->_session->addError($this->_helper->__("Error uploading file"));
390
+ return false;
391
+ }
392
+ }
393
+ public function _saveData($data)
394
+ {
395
+ $this->_fieldsModel = $this->_helper->getFieldsModel();
396
+ $this->_optionsModel = $this->_helper->getOptionsModel();
397
+ $returnStatus = false;
398
+
399
+ $optionsDataArray = array();
400
+ $optionsDataArray = $data['options'];
401
+
402
+ $serialized = serialize($optionsDataArray);
403
+ $data['forms_index'] = $this->_currentFormId;
404
+ $data['value'] = $serialized;
405
+ $this->_recordsModel->setData($data);
406
+ if($this->_recordsModel->save())
407
+ {
408
+ $returnStatus = true;
409
+ $this->_lastInsertedRecordId = $this->_recordsModel->getRecordsIndex();
410
+ $this->_lastInsertedRecordValue = $this->_recordsModel->getValue();
411
+ }
412
+ else
413
+ $returnStatus = false;
414
+ return $returnStatus;
415
+
416
+ }
417
+ public function sendEmail($data)
418
+ {
419
+ $currentFormId = $this->_currentFormId;
420
+ $fieldsModel = Mage::helper('formbuilder')->getFieldsModel();
421
+ $prepareFieldTitles = array();
422
+ $prepareFieldTitles = $fieldsModel->prepareFieldTitles($currentFormId);
423
+
424
+ //current form title
425
+ $currentForm = Mage::helper('formbuilder')->getCurrentFormDetails($this->_currentFormId);
426
+ $this->_currentFormTitle = $currentForm['title'];
427
+
428
+ $userDetailHtml = "";
429
+ $userDetailHtml .= '<table width="100%" style="font-family: sans-serif; border: 1px solid #ccc;"><thead>
430
+ <tr>
431
+ <th colspan="2" style="padding: 10px; background:#ccc;">We received the following data:</th>
432
+ </tr>
433
+ <tr>
434
+ <td width="130" style="background:#f2f2f2; padding:5px; text-align: right;">Form Title</td>
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(null,$this->_lastInsertedRecordId,$fieldId,$this->_lastInsertedRecordValue);
443
+ $userDetailHtml .= '<tr>
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
+ $userDetailHtml .= '</thead></table>';
450
+
451
+
452
+ if (Mage::getSingleton('customer/session')->isLoggedIn())
453
+ {
454
+ // Load the customer's data
455
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
456
+ $email = $customer->getEmail();
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}}",$userDetailHtml,$email_desc);
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>
490
+ <table border="0">
491
+ <tr>
492
+ <Td>'.$logo_img.'</Td>
493
+ </tr>
494
+ <tr>
495
+ <td colspan="2">&nbsp;</td></tr>
496
+ <tr>
497
+ <Td><p>'.$email_desc.'. </p></Td>
498
+ </tr>
499
+ </table>
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">&nbsp;</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($email,$email_subject_for_admin,$adminContent,$headers);
544
+ }
545
+ catch (Exception $e)
546
+ {
547
+ Mage::getSingleton('core/session')->addError('Error sending email');
548
+ //$this->_redirectReferer();
549
+ }
550
+ }
551
+ else
552
+ //Mage::getSingleton('core/session')->addNotice('Email sending failed as customer is guest');
553
+ ;
554
+ }
555
+ public function formsubmitAction()
556
+ {
557
+ $errors = array();
558
+ $this->_helper = Mage::helper('formbuilder');
559
+ $session = Mage::getSingleton('core/session');
560
+ $this->_session = $session;
561
+ $customerSession = Mage::getSingleton('customer/session');
562
+ $this->_getLimitFormSubmissionForGuest = $this->_helper->getLimitFormSubmissionForGuest();
563
+ $this->_getLimitFormSubmissionForRegistered = $this->_helper->getLimitFormSubmissionForRegistered();
564
+ $this->_getRedirectUrl = $this->_helper->getRedirectUrl();
565
+
566
+ if (!$this->_helper->isEnabled())
567
+ {
568
+ $session->addError($this->_helper->__('Formbuilder Extension seems disabled, Please contact Administrator.'));
569
+ $this->_redirectUrl(Mage::helper('core/url')->getHomeUrl());
570
+ return;
571
+ }
572
+ else
573
+ {
574
+ if($data = $this->getRequest()->getPost())
575
+ {
576
+ //field=11, form=9
577
+ $this->_helper->setFormData($data['options'][11]);
578
+ $this->_currentFormId = $data['current_form_id'];
579
+ $this->_recordsModel = $this->_helper->getRecordsModel();
580
+
581
+ if($this->_helper->registeredOnly() && !$customerSession->isLoggedIn())
582
+ {
583
+ if(!$customerSession->isLoggedIn())
584
+ {
585
+ $session->addError($this->_helper->__('You must be logged in to submit.'));
586
+ $this->_redirectReferer();
587
+ return;
588
+ }
589
+ else//logged in user
590
+ {
591
+ $customer = $this->_helper->getCustomerInfo();
592
+ //save customer id
593
+ $customerId = $customer->getId();
594
+ //check form submission
595
+ if($this->_getLimitFormSubmissionForRegistered)
596
+ {
597
+ $totalRecords = $this->_recordsModel->checkFormSubmissionLimit($customerId,$this->_currentFormId);
598
+ if($totalRecords>=$this->_getLimitFormSubmissionForRegistered)
599
+ {
600
+ $this->_session->addError($this->_helper->__('Can not submit form, limitation of form submission for current user is reached.'));
601
+ $this->_redirectReferer();
602
+ return;
603
+ }
604
+ }
605
+ $data['customer'] = $customerId;
606
+ }
607
+ }
608
+ elseif(!$customerSession->isLoggedIn())//guest user
609
+ {
610
+ $customer = $this->_helper->getCustomerInfo();
611
+ //save customer ip address
612
+ $customerIp = Mage::helper('core/http')->getRemoteAddr();
613
+ //check form submission
614
+ if($this->_getLimitFormSubmissionForGuest)
615
+ {
616
+ $totalRecords = $this->_recordsModel->checkFormSubmissionLimit($customerIp,$this->_currentFormId);
617
+ if($totalRecords>=$this->_getLimitFormSubmissionForGuest)
618
+ {
619
+ $this->_session->addError($this->_helper->__('Can not submit form, limitation of form submission for current user is reached.'));
620
+ $this->_redirectReferer();
621
+ return;
622
+ }
623
+ }
624
+ $data['customer'] = $customerIp;
625
+ }
626
+ elseif($customerSession->isLoggedIn())//logged in user
627
+ {
628
+ $customer = $this->_helper->getCustomerInfo();
629
+ //save customer id
630
+ $customerId = $customer->getId();
631
+ //check form submission
632
+ if($this->_getLimitFormSubmissionForRegistered)
633
+ {
634
+ $totalRecords = $this->_recordsModel->checkFormSubmissionLimit($customerId,$this->_currentFormId);
635
+ if($totalRecords>=$this->_getLimitFormSubmissionForRegistered)
636
+ {
637
+ $this->_session->addError($this->_helper->__('Can not submit form, limitation of form submission for current user is reached.'));
638
+ $this->_redirectReferer();
639
+ return;
640
+ }
641
+ }
642
+ $data['customer'] = $customerId;
643
+ }
644
+ if(isset($_FILES))
645
+ {
646
+ $this->_fileObject = $_FILES;
647
+ }
648
+ $errors = $this->_validateData($data);
649
+ if (!empty($errors))
650
+ {
651
+ foreach ($errors as $error)
652
+ {
653
+ $session->addError($error);
654
+ }
655
+ $this->_redirectReferer();
656
+ return;
657
+ }
658
+ if( count($this->_filesToBeUploaded) )
659
+ {
660
+ foreach ($this->_filesToBeUploaded as $key)
661
+ {
662
+ list($pre,$fileKey,$post) = explode('_',$key);
663
+ if( $res = $this->uploadFile($key) )
664
+ $data['options'][$fileKey] = $res;
665
+ else
666
+ {
667
+ $this->_redirectReferer();
668
+ return;
669
+ }
670
+ }
671
+ }
672
+ if(count($this->_dateToBeSaved))
673
+ {
674
+ foreach ($this->_dateToBeSaved as $id => $date)
675
+ {
676
+ //$this->_session->addError("(id=$id) = ".$date);
677
+ $data['options'][$id] = $date;
678
+ }
679
+ }
680
+
681
+ /*echo "<pre>";
682
+ echo "<h1>printing data</h1>";
683
+ print_r($data);
684
+ echo "<h1>printing data['options']</h1>";
685
+ print_r($data['options']);
686
+ echo "</pre>";
687
+ exit();*/
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');
699
+ if($this->_send_email_to_customer || $this->_send_email_to_admin)
700
+ $this->sendEmail($data);
701
+ if($this->_getRedirectUrl)
702
+ $this->_redirectUrl(Mage::getUrl($this->_getRedirectUrl));
703
+ //return;
704
+ }
705
+ else
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();
713
+ return;
714
+ }
715
+ else
716
+ {
717
+ $session->addNotice($this->_helper->__('The requested page could not be found'));
718
+ $this->_redirectReferer();
719
+ return false;
720
+ }
721
+ }//else extension is enabled
722
+ }
723
  }
app/code/community/Phxsolution/Formbuilder/etc/config.xml CHANGED
@@ -1,269 +1,299 @@
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 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
- <modules>
29
- <Phxsolution_Formbuilder>
30
- <version>0.2.0</version>
31
- </Phxsolution_Formbuilder>
32
- </modules>
33
- <frontend>
34
- <routers>
35
- <formbuilder>
36
- <use>standard</use>
37
- <args>
38
- <module>Phxsolution_Formbuilder</module>
39
- <frontName>formbuilder</frontName>
40
- </args>
41
- </formbuilder>
42
- </routers>
43
- <layout>
44
- <updates>
45
- <formbuilder module="Phxsolution_Formbuilder">
46
- <file>formbuilder.xml</file>
47
- </formbuilder>
48
- </updates>
49
- </layout>
50
- <events>
51
- <page_block_html_topmenu_gethtml_before>
52
- <observers>
53
- <formbuilder>
54
- <class>formbuilder/observer</class>
55
- <method>addToTopmenu</method>
56
- </formbuilder>
57
- </observers>
58
- </page_block_html_topmenu_gethtml_before>
59
- </events>
60
- <!-- <translate>
61
- <modules>
62
- <Phxsolution_Formbuilder>
63
- <files>
64
- <default>Phxsolution_Formbuilder.csv</default>
65
- </files>
66
- </Phxsolution_Formbuilder>
67
- </modules>
68
- </translate> -->
69
- <!-- <events>
70
- <core_block_abstract_prepare_layout_before>
71
- <observers>
72
- <nextbits_jquery_prepare_layout_before>
73
- <class>formbuilder/observer</class>
74
- <method>prepareLayoutBefore</method>
75
- </nextbits_jquery_prepare_layout_before>
76
- </observers>
77
- </core_block_abstract_prepare_layout_before>
78
- </events> -->
79
- </frontend>
80
- <admin>
81
- <routers>
82
- <formbuilder>
83
- <use>admin</use>
84
- <args>
85
- <module>Phxsolution_Formbuilder</module>
86
- <frontName>formbuilder</frontName>
87
- </args>
88
- </formbuilder>
89
- </routers>
90
- </admin>
91
- <adminhtml>
92
- <menu>
93
- <formbuilder module="formbuilder">
94
- <depends>
95
- <config>formbuilder_section/general/active</config>
96
- </depends>
97
- <title>Form Builder</title>
98
- <sort_order>71</sort_order>
99
- <children>
100
- <items module="formbuilder">
101
- <title>Manage Forms</title>
102
- <sort_order>0</sort_order>
103
- <action>formbuilder/adminhtml_formbuilder</action>
104
- </items>
105
- <items2 module="formbuilder">
106
- <title>Add Form</title>
107
- <sort_order>1</sort_order>
108
- <action>formbuilder/adminhtml_formbuilder/new</action>
109
- </items2>
110
- <items3 module="formbuilder">
111
- <title>Formbuilder Settings</title>
112
- <sort_order>2</sort_order>
113
- <action>adminhtml/system_config/edit/section/formbuilder_section</action>
114
- </items3>
115
- <!-- <items4 module="formbuilder">
116
- <title>Form with Results</title>
117
- <sort_order>3</sort_order>
118
- <action>adminhtml/system_config/edit/section/formbuilder_section</action>
119
- </items4> -->
120
- </children>
121
- </formbuilder>
122
- </menu>
123
- <acl>
124
- <resources>
125
- <all>
126
- <title>Allow Everything</title>
127
- </all>
128
- <admin>
129
- <children>
130
- <formbuilder module="formbuilder">
131
- <title>Phxsolution</title>
132
- <sort_order>71</sort_order>
133
- <children>
134
- <items module="formbuilder">
135
- <title>Manage Forms</title>
136
- <sort_order>0</sort_order>
137
- <action>formbuilder/adminhtml_formbuilder</action>
138
- </items>
139
- <items2 module="formbuilder">
140
- <title>Add Form</title>
141
- <sort_order>1</sort_order>
142
- <action>formbuilder/adminhtml_formbuilder/new</action>
143
- </items2>
144
- <items3 module="formbuilder">
145
- <title>Formbuilder Settings</title>
146
- <sort_order>2</sort_order>
147
- <action>adminhtml/system_config/edit/section/formbuilder_section</action>
148
- </items3>
149
- </children>
150
- </formbuilder>
151
- <system>
152
- <children>
153
- <config>
154
- <children>
155
- <formbuilder_section translate="title" module="formbuilder">
156
- <title>Phxsolution Formbuilder Section</title>
157
- </formbuilder_section>
158
- </children>
159
- </config>
160
- </children>
161
- </system>
162
- </children>
163
- </admin>
164
- </resources>
165
- </acl>
166
- <layout>
167
- <updates>
168
- <formbuilder>
169
- <file>formbuilder.xml</file>
170
- </formbuilder>
171
- </updates>
172
- </layout>
173
- </adminhtml>
174
- <global>
175
- <models>
176
- <formbuilder>
177
- <class>Phxsolution_Formbuilder_Model</class>
178
- <resourceModel>formbuilder_mysql4</resourceModel>
179
- </formbuilder>
180
- <formbuilder_mysql4>
181
- <class>Phxsolution_Formbuilder_Model_Mysql4</class>
182
- <entities>
183
- <forms>
184
- <table>formbuilder_forms</table>
185
- </forms>
186
- <fields>
187
- <table>formbuilder_fields</table>
188
- </fields>
189
- <options>
190
- <table>formbuilder_fields_options</table>
191
- </options>
192
- <records>
193
- <table>formbuilder_records</table>
194
- </records>
195
- </entities>
196
- </formbuilder_mysql4>
197
- </models>
198
- <resources>
199
- <formbuilder_setup>
200
- <setup>
201
- <module>Phxsolution_Formbuilder</module>
202
- </setup>
203
- <connection>
204
- <use>core_setup</use>
205
- </connection>
206
- </formbuilder_setup>
207
- <formbuilder_write>
208
- <connection>
209
- <use>core_write</use>
210
- </connection>
211
- </formbuilder_write>
212
- <formbuilder_read>
213
- <connection>
214
- <use>core_read</use>
215
- </connection>
216
- </formbuilder_read>
217
- </resources>
218
- <blocks>
219
- <formbuilder>
220
- <class>Phxsolution_Formbuilder_Block</class>
221
- </formbuilder>
222
- <!-- <adminhtml>
223
- <rewrite>
224
- <page_menu>Phxsolution_Formbuilder_Block_Adminhtml_Menu</page_menu>
225
- </rewrite>
226
- </adminhtml> -->
227
- <adminhtml>
228
- <rewrite>
229
- <catalog_product_edit_tab_options_type_text>Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Options_Type_Text</catalog_product_edit_tab_options_type_text>
230
- <catalog_product_edit_tab_options_type_select>Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Options_Type_Select</catalog_product_edit_tab_options_type_select>
231
- <catalog_product_edit_tab_options_type_file>Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Options_Type_File</catalog_product_edit_tab_options_type_file>
232
- <catalog_product_edit_tab_options_type_date>Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Options_Type_Date</catalog_product_edit_tab_options_type_date>
233
- </rewrite>
234
-
235
- </adminhtml>
236
- <!-- <adminhtml> -->
237
- <!-- <rewrite>
238
- <catalog_product_edit_tab_options>Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Options</catalog_product_edit_tab_options>
239
- </rewrite> -->
240
- <!-- <rewrite>
241
- <catalog_product_edit_tab_options_option>Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Options_Option</catalog_product_edit_tab_options_option>
242
- </rewrite> -->
243
- <!-- </adminhtml> -->
244
- </blocks>
245
- <helpers>
246
- <formbuilder>
247
- <class>Phxsolution_Formbuilder_Helper</class>
248
- </formbuilder>
249
- </helpers>
250
- </global>
251
- <default>
252
- <formbuilder_section>
253
- <general>
254
- <active>1</active>
255
- </general>
256
- </formbuilder_section>
257
- </default>
258
- <adminhtml>
259
- <translate>
260
- <modules>
261
- <Phxsolution_Formbuilder>
262
- <files>
263
- <default>Phxsolution_Formbuilder.csv</default>
264
- </files>
265
- </Phxsolution_Formbuilder>
266
- </modules>
267
- </translate>
268
- </adminhtml>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  </config>
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 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
+ <modules>
29
+ <Phxsolution_Formbuilder>
30
+ <version>0.3.0</version>
31
+ </Phxsolution_Formbuilder>
32
+ </modules>
33
+ <frontend>
34
+ <routers>
35
+ <formbuilder>
36
+ <use>standard</use>
37
+ <args>
38
+ <module>Phxsolution_Formbuilder</module>
39
+ <frontName>formbuilder</frontName>
40
+ </args>
41
+ </formbuilder>
42
+ </routers>
43
+ <layout>
44
+ <updates>
45
+ <formbuilder module="Phxsolution_Formbuilder">
46
+ <file>formbuilder.xml</file>
47
+ </formbuilder>
48
+ </updates>
49
+ </layout>
50
+ <events>
51
+ <page_block_html_topmenu_gethtml_before>
52
+ <observers>
53
+ <formbuilder>
54
+ <class>formbuilder/observer</class>
55
+ <method>addToTopmenu</method>
56
+ </formbuilder>
57
+ </observers>
58
+ </page_block_html_topmenu_gethtml_before>
59
+ </events>
60
+ <!-- <translate>
61
+ <modules>
62
+ <Phxsolution_Formbuilder>
63
+ <files>
64
+ <default>Phxsolution_Formbuilder.csv</default>
65
+ </files>
66
+ </Phxsolution_Formbuilder>
67
+ </modules>
68
+ </translate> -->
69
+ <!-- <events>
70
+ <core_block_abstract_prepare_layout_before>
71
+ <observers>
72
+ <nextbits_jquery_prepare_layout_before>
73
+ <class>formbuilder/observer</class>
74
+ <method>prepareLayoutBefore</method>
75
+ </nextbits_jquery_prepare_layout_before>
76
+ </observers>
77
+ </core_block_abstract_prepare_layout_before>
78
+ </events> -->
79
+ </frontend>
80
+ <admin>
81
+ <routers>
82
+ <formbuilder>
83
+ <use>admin</use>
84
+ <args>
85
+ <module>Phxsolution_Formbuilder</module>
86
+ <frontName>formbuilder</frontName>
87
+ </args>
88
+ </formbuilder>
89
+ </routers>
90
+ </admin>
91
+ <adminhtml>
92
+ <menu>
93
+ <formbuilder module="formbuilder">
94
+ <depends>
95
+ <config>formbuilder_section/general/active</config>
96
+ </depends>
97
+ <title>Form Builder</title>
98
+ <sort_order>71</sort_order>
99
+ <children>
100
+ <items module="formbuilder">
101
+ <title>Manage Forms</title>
102
+ <sort_order>0</sort_order>
103
+ <action>formbuilder/adminhtml_formbuilder</action>
104
+ </items>
105
+ <items2 module="formbuilder">
106
+ <title>Add Form</title>
107
+ <sort_order>1</sort_order>
108
+ <action>formbuilder/adminhtml_formbuilder/new</action>
109
+ </items2>
110
+ <items3 module="formbuilder">
111
+ <title>Formbuilder Settings</title>
112
+ <sort_order>2</sort_order>
113
+ <action>adminhtml/system_config/edit/section/formbuilder_section</action>
114
+ </items3>
115
+ <!-- <items4 module="formbuilder">
116
+ <title>Form with Results</title>
117
+ <sort_order>3</sort_order>
118
+ <action>adminhtml/system_config/edit/section/formbuilder_section</action>
119
+ </items4> -->
120
+ </children>
121
+ </formbuilder>
122
+ </menu>
123
+ <acl>
124
+ <resources>
125
+ <all>
126
+ <title>Allow Everything</title>
127
+ </all>
128
+ <admin>
129
+ <children>
130
+ <formbuilder module="formbuilder">
131
+ <title>Phxsolution</title>
132
+ <sort_order>71</sort_order>
133
+ <children>
134
+ <items module="formbuilder">
135
+ <title>Manage Forms</title>
136
+ <sort_order>0</sort_order>
137
+ <action>formbuilder/adminhtml_formbuilder</action>
138
+ </items>
139
+ <items2 module="formbuilder">
140
+ <title>Add Form</title>
141
+ <sort_order>1</sort_order>
142
+ <action>formbuilder/adminhtml_formbuilder/new</action>
143
+ </items2>
144
+ <items3 module="formbuilder">
145
+ <title>Formbuilder Settings</title>
146
+ <sort_order>2</sort_order>
147
+ <action>adminhtml/system_config/edit/section/formbuilder_section</action>
148
+ </items3>
149
+ </children>
150
+ </formbuilder>
151
+ <system>
152
+ <children>
153
+ <config>
154
+ <children>
155
+ <formbuilder_section translate="title" module="formbuilder">
156
+ <title>Phxsolution Formbuilder Section</title>
157
+ </formbuilder_section>
158
+ </children>
159
+ </config>
160
+ </children>
161
+ </system>
162
+ </children>
163
+ </admin>
164
+ </resources>
165
+ </acl>
166
+ <layout>
167
+ <updates>
168
+ <formbuilder>
169
+ <file>formbuilder.xml</file>
170
+ </formbuilder>
171
+ </updates>
172
+ </layout>
173
+ </adminhtml>
174
+ <global>
175
+ <models>
176
+ <formbuilder>
177
+ <class>Phxsolution_Formbuilder_Model</class>
178
+ <resourceModel>formbuilder_mysql4</resourceModel>
179
+ </formbuilder>
180
+ <formbuilder_mysql4>
181
+ <class>Phxsolution_Formbuilder_Model_Mysql4</class>
182
+ <entities>
183
+ <forms>
184
+ <table>formbuilder_forms</table>
185
+ </forms>
186
+ <fields>
187
+ <table>formbuilder_fields</table>
188
+ </fields>
189
+ <options>
190
+ <table>formbuilder_fields_options</table>
191
+ </options>
192
+ <records>
193
+ <table>formbuilder_records</table>
194
+ </records>
195
+ </entities>
196
+ </formbuilder_mysql4>
197
+ </models>
198
+ <resources>
199
+ <formbuilder_setup>
200
+ <setup>
201
+ <module>Phxsolution_Formbuilder</module>
202
+ </setup>
203
+ <connection>
204
+ <use>core_setup</use>
205
+ </connection>
206
+ </formbuilder_setup>
207
+ <formbuilder_write>
208
+ <connection>
209
+ <use>core_write</use>
210
+ </connection>
211
+ </formbuilder_write>
212
+ <formbuilder_read>
213
+ <connection>
214
+ <use>core_read</use>
215
+ </connection>
216
+ </formbuilder_read>
217
+ </resources>
218
+ <blocks>
219
+ <formbuilder>
220
+ <class>Phxsolution_Formbuilder_Block</class>
221
+ </formbuilder>
222
+ <!-- <adminhtml>
223
+ <rewrite>
224
+ <page_menu>Phxsolution_Formbuilder_Block_Adminhtml_Menu</page_menu>
225
+ </rewrite>
226
+ </adminhtml> -->
227
+ <adminhtml>
228
+ <rewrite>
229
+ <catalog_product_edit_tab_options_type_text>Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Options_Type_Text</catalog_product_edit_tab_options_type_text>
230
+ <catalog_product_edit_tab_options_type_select>Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Options_Type_Select</catalog_product_edit_tab_options_type_select>
231
+ <catalog_product_edit_tab_options_type_file>Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Options_Type_File</catalog_product_edit_tab_options_type_file>
232
+ <catalog_product_edit_tab_options_type_date>Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Options_Type_Date</catalog_product_edit_tab_options_type_date>
233
+ </rewrite>
234
+
235
+ </adminhtml>
236
+ <!-- <adminhtml> -->
237
+ <!-- <rewrite>
238
+ <catalog_product_edit_tab_options>Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Options</catalog_product_edit_tab_options>
239
+ </rewrite> -->
240
+ <!-- <rewrite>
241
+ <catalog_product_edit_tab_options_option>Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Options_Option</catalog_product_edit_tab_options_option>
242
+ </rewrite> -->
243
+ <!-- </adminhtml> -->
244
+ </blocks>
245
+ <helpers>
246
+ <formbuilder>
247
+ <class>Phxsolution_Formbuilder_Helper</class>
248
+ </formbuilder>
249
+ </helpers>
250
+ </global>
251
+ <default>
252
+ <formbuilder_section>
253
+ <general>
254
+ <active>1</active>
255
+ </general>
256
+ <form_submission_email>
257
+ <sender_name>Storename - Support Team</sender_name>
258
+ </form_submission_email>
259
+ <form_submission_email>
260
+ <sender_email>support@storename.com</sender_email>
261
+ </form_submission_email>
262
+ <form_submission_email>
263
+ <send_email_to_customer>1</send_email_to_customer>
264
+ </form_submission_email>
265
+ <form_submission_email>
266
+ <send_email_to_admin>1</send_email_to_admin>
267
+ </form_submission_email>
268
+ <form_submission_email>
269
+ <admin_email>admin-name@storename.com</admin_email>
270
+ </form_submission_email>
271
+ <form_submission_email>
272
+ <email_subject_for_customer>Thank you for contacting us</email_subject_for_customer>
273
+ </form_submission_email>
274
+ <form_submission_email>
275
+ <email_content_for_customer>&lt;h2&gt;Hello {{Name}}, &lt;/h2&gt;&lt;br&gt;&lt;br&gt;Thank you for contacting us. A company representative will contact you with more information within two business days.&lt;br&gt;&lt;br&gt;{{FormData}}&lt;br&gt;&lt;br&gt;Thank You,&lt;br&gt;{{Storename}}&lt;br&gt;Phone: {{Storephone}}</email_content_for_customer>
276
+ </form_submission_email>
277
+ <form_submission_email>
278
+ <email_subject_for_admin>Contact request received</email_subject_for_admin>
279
+ </form_submission_email>
280
+ <form_submission_email>
281
+ <email_content_for_admin>&lt;h2&gt;Hello Admin, &lt;/h2&gt;&lt;br&gt;&lt;br&gt;Have a look at the form submission by customer "{{CustomerEmail}}" from the store "{{Storename}}"&lt;br&gt;&lt;br&gt;{{FormData}}</email_content_for_admin>
282
+ </form_submission_email>
283
+ <custom_options>
284
+ <use_calendar>1</use_calendar>
285
+ </custom_options>
286
+ </formbuilder_section>
287
+ </default>
288
+ <adminhtml>
289
+ <translate>
290
+ <modules>
291
+ <Phxsolution_Formbuilder>
292
+ <files>
293
+ <default>Phxsolution_Formbuilder.csv</default>
294
+ </files>
295
+ </Phxsolution_Formbuilder>
296
+ </modules>
297
+ </translate>
298
+ </adminhtml>
299
  </config>
app/code/community/Phxsolution/Formbuilder/etc/system.xml CHANGED
@@ -1,204 +1,290 @@
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 &amp; 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>
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
+ <form_submission_email translate="label">
154
+ <label>Frontend - Form Submission Email 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
+ <sender_name translate="label">
162
+ <label>Sender Name</label>
163
+ <frontend_type>text</frontend_type>
164
+ <sort_order>10</sort_order>
165
+ <show_in_default>1</show_in_default>
166
+ <show_in_website>1</show_in_website>
167
+ <show_in_store>1</show_in_store>
168
+ </sender_name>
169
+ <sender_email translate="label">
170
+ <label>Sender Email</label>
171
+ <frontend_type>text</frontend_type>
172
+ <sort_order>10</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>1</show_in_website>
175
+ <show_in_store>1</show_in_store>
176
+ </sender_email>
177
+ <send_email_to_customer translate="label">
178
+ <label>Send Email to Customer?</label>
179
+ <frontend_type>select</frontend_type>
180
+ <source_model>adminhtml/system_config_source_yesno</source_model>
181
+ <sort_order>11</sort_order>
182
+ <show_in_default>1</show_in_default>
183
+ <show_in_website>1</show_in_website>
184
+ <show_in_store>1</show_in_store>
185
+ </send_email_to_customer>
186
+ <email_subject_for_customer translate="label">
187
+ <label>Email Subject for Customer</label>
188
+ <frontend_type>text</frontend_type>
189
+ <sort_order>12</sort_order>
190
+ <show_in_default>1</show_in_default>
191
+ <show_in_website>1</show_in_website>
192
+ <show_in_store>1</show_in_store>
193
+ </email_subject_for_customer>
194
+ <email_content_for_customer translate="label">
195
+ <label>Email content for Customer</label>
196
+ <frontend_type>textarea</frontend_type>
197
+ <sort_order>13</sort_order>
198
+ <show_in_default>1</show_in_default>
199
+ <show_in_website>1</show_in_website>
200
+ <show_in_store>1</show_in_store>
201
+ <comment><![CDATA[Please do not change variables: {{Name}},{{FormData}},{{Storename}} & {{Storephone}}, if you don't want any variable then simply remove it from content.]]> </comment>
202
+ </email_content_for_customer>
203
+ <send_email_to_admin translate="label">
204
+ <label>Send Email to Admin?</label>
205
+ <frontend_type>select</frontend_type>
206
+ <source_model>adminhtml/system_config_source_yesno</source_model>
207
+ <sort_order>14</sort_order>
208
+ <show_in_default>1</show_in_default>
209
+ <show_in_website>1</show_in_website>
210
+ <show_in_store>1</show_in_store>
211
+ </send_email_to_admin>
212
+ <admin_email translate="label">
213
+ <label>Admin Email</label>
214
+ <frontend_type>text</frontend_type>
215
+ <sort_order>15</sort_order>
216
+ <show_in_default>1</show_in_default>
217
+ <show_in_website>1</show_in_website>
218
+ <show_in_store>1</show_in_store>
219
+ </admin_email>
220
+ <email_subject_for_admin translate="label">
221
+ <label>Email Subject for Admin</label>
222
+ <frontend_type>text</frontend_type>
223
+ <sort_order>16</sort_order>
224
+ <show_in_default>1</show_in_default>
225
+ <show_in_website>1</show_in_website>
226
+ <show_in_store>1</show_in_store>
227
+ </email_subject_for_admin>
228
+ <email_content_for_admin translate="label">
229
+ <label>Email content for Admin</label>
230
+ <frontend_type>textarea</frontend_type>
231
+ <sort_order>17</sort_order>
232
+ <show_in_default>1</show_in_default>
233
+ <show_in_website>1</show_in_website>
234
+ <show_in_store>1</show_in_store>
235
+ <comment><![CDATA[Please do not change variables: {{CustomerEmail}},{{Storename}} & {{FormData}}, if you don't want any variable then simply remove it from content.]]> </comment>
236
+ </email_content_for_admin>
237
+ </fields>
238
+ </form_submission_email>
239
+ <custom_options translate="label">
240
+ <label>Frontend - Date &amp; Time Settings</label>
241
+ <frontend_type>text</frontend_type>
242
+ <sort_order>18</sort_order>
243
+ <show_in_default>1</show_in_default>
244
+ <show_in_website>1</show_in_website>
245
+ <show_in_store>1</show_in_store>
246
+ <fields>
247
+ <use_calendar translate="label">
248
+ <label>Use JavaScript Calendar</label>
249
+ <frontend_type>select</frontend_type>
250
+ <source_model>adminhtml/system_config_source_yesno</source_model>
251
+ <sort_order>1</sort_order>
252
+ <show_in_default>1</show_in_default>
253
+ <show_in_website>1</show_in_website>
254
+ <show_in_store>1</show_in_store>
255
+ </use_calendar>
256
+ <date_fields_order translate="label">
257
+ <label>Date Fields Order</label>
258
+ <frontend_type>select</frontend_type>
259
+ <frontend_model>adminhtml/catalog_form_renderer_config_dateFieldsOrder</frontend_model>
260
+ <sort_order>2</sort_order>
261
+ <show_in_default>1</show_in_default>
262
+ <show_in_website>1</show_in_website>
263
+ <show_in_store>1</show_in_store>
264
+ <depends><use_calendar>0</use_calendar></depends>
265
+ </date_fields_order>
266
+ <time_format translate="label">
267
+ <label>Time Format</label>
268
+ <frontend_type>select</frontend_type>
269
+ <source_model>adminhtml/system_config_source_catalog_timeFormat</source_model>
270
+ <sort_order>3</sort_order>
271
+ <show_in_default>1</show_in_default>
272
+ <show_in_website>1</show_in_website>
273
+ <show_in_store>1</show_in_store>
274
+ </time_format>
275
+ <year_range translate="label comment">
276
+ <label>Year Range</label>
277
+ <comment>Use four-digit year format.</comment>
278
+ <frontend_type>text</frontend_type>
279
+ <frontend_model>adminhtml/catalog_form_renderer_config_yearRange</frontend_model>
280
+ <sort_order>4</sort_order>
281
+ <show_in_default>1</show_in_default>
282
+ <show_in_website>1</show_in_website>
283
+ <show_in_store>1</show_in_store>
284
+ </year_range>
285
+ </fields>
286
+ </custom_options>
287
+ </groups>
288
+ </formbuilder_section>
289
+ </sections>
290
  </config>
app/code/community/Phxsolution/Formbuilder/etc/system.xml-7-8-15 ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 &amp; 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
@@ -1,83 +1,83 @@
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 adminhtml layout
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
- <layout version="0.2.0">
28
- <default>
29
- <reference name="head">
30
- <!-- <action method="addItem"><type>skin_js</type><name>js/formbuilder/jscolor/jscolor.js</name></action> -->
31
- <action method="addJs">
32
- <script>formbuilder/jscolor/jscolor.js</script>
33
- <!-- <script>formbuilder/procolor-1.0/procolor.compressed.js</script> -->
34
- </action>
35
- <!-- <action method="setCanLoadExtJs"><flag>1</flag></action>
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"/>
51
- <reference name="content">
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"/>
81
- </block>
82
- </formbuilder_adminhtml_formbuilder_options>
83
  </layout>
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 adminhtml layout
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
+ <layout version="0.3.0">
28
+ <default>
29
+ <reference name="head">
30
+ <!-- <action method="addItem"><type>skin_js</type><name>js/formbuilder/jscolor/jscolor.js</name></action> -->
31
+ <action method="addJs">
32
+ <script>formbuilder/jscolor/jscolor.js</script>
33
+ <!-- <script>formbuilder/procolor-1.0/procolor.compressed.js</script> -->
34
+ </action>
35
+ <!-- <action method="setCanLoadExtJs"><flag>1</flag></action>
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"/>
51
+ <reference name="content">
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"/>
81
+ </block>
82
+ </formbuilder_adminhtml_formbuilder_options>
83
  </layout>
app/design/frontend/base/default/layout/formbuilder.xml CHANGED
@@ -1,105 +1,101 @@
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 frontend layout
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
- <layout version="0.2.0">
28
- <default translate="label" module="formbuilder">
29
- <reference name="head">
30
- <action method="addCss">
31
- <stylesheet>css/formbuilder/custom.css</stylesheet>
32
- </action>
33
- </reference>
34
-
35
- <reference name="head">
36
- <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
37
- <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
38
- <action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
39
- </reference>
40
- <reference name="content">
41
- <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml" />
42
- </reference>
43
-
44
- <reference name="top.links">
45
- <action method="addLink" translate="label title" module="formbuilder" ifconfig="formbuilder_section/general/in_toplinks">
46
- <label>Formbuilder</label>
47
- <url>formbuilder</url>
48
- <title>Formbuilder</title>
49
- <prepare>true</prepare>
50
- <urlParams/>
51
- <position>200</position>
52
- <liParams/><aParams/>
53
- </action>
54
- </reference>
55
- <reference name="footer_links">
56
- <action method="addLink" translate="label title" module="formbuilder" ifconfig="formbuilder_section/general/in_footerlinks">
57
- <label>Formbuilder</label>
58
- <url>formbuilder</url>
59
- <title>Formbuilder</title>
60
- <prepare>true</prepare>
61
- </action>
62
- </reference>
63
- </default>
64
- <formbuilder_index_index>
65
- <reference name="root">
66
- <action method="setTemplate"><template>page/1column.phtml</template></action>
67
- </reference>
68
-
69
-
70
- <!-- <reference name="head">
71
- <action method="addCss">
72
- <stylesheet>css/formbuilder/bootstrap-responsive.css</stylesheet>
73
- </action>
74
- <action method="addCss">
75
- <stylesheet>css/formbuilder/bootstrap.min.css</stylesheet>
76
- </action>
77
- <action method="addJs">
78
- <script>formbuilder/jquery-1.11.1.min.js</script>
79
- </action>
80
- <action method="addJs">
81
- <script>formbuilder/bootstrap.min.js</script>
82
- </action>
83
- </reference> -->
84
-
85
-
86
-
87
- <reference name="content">
88
- <block type="formbuilder/frontend_formbuilder" name="frontend_formbuilder" template="formbuilder/formbuilder.phtml" />
89
- </reference>
90
- </formbuilder_index_index>
91
- <formbuilder_index_view>
92
- <reference name="root">
93
- <action method="setTemplate"><template>page/1column.phtml</template></action>
94
- </reference>
95
- <reference name="content">
96
- <block type="formbuilder/frontend_form" name="frontend_form" template="formbuilder/form.phtml" />
97
- <!-- <block type="formbuilder/frontend_text" name="frontend_text" template="formbuilder/text.phtml" />
98
- <block type="formbuilder/frontend_select" name="frontend_select" template="formbuilder/select.phtml" />
99
- <block type="formbuilder/frontend_file" name="frontend_file" template="formbuilder/file.phtml" />
100
- <block type="formbuilder/frontend_date" name="frontend_date" template="formbuilder/date.phtml" /> -->
101
- <!-- <block type="core/template" name="options_js" template="catalog/product/view/options/js.phtml"/> -->
102
- <!-- <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml" /> -->
103
- </reference>
104
- </formbuilder_index_view>
105
  </layout>
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 frontend layout
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
+ <layout version="0.3.0">
28
+ <default translate="label" module="formbuilder">
29
+ <reference name="head">
30
+ <action method="addCss">
31
+ <stylesheet>css/formbuilder/custom.css</stylesheet>
32
+ </action>
33
+ </reference>
34
+ <reference name="head">
35
+ <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
36
+ <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
37
+ <action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
38
+ </reference>
39
+ <reference name="content">
40
+ <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml" />
41
+ </reference>
42
+ <reference name="top.links">
43
+ <action method="addLink" translate="label title" module="formbuilder" ifconfig="formbuilder_section/general/in_toplinks">
44
+ <label>Formbuilder</label>
45
+ <url>formbuilder</url>
46
+ <title>Formbuilder</title>
47
+ <prepare>true</prepare>
48
+ <urlParams/>
49
+ <position>200</position>
50
+ <liParams/><aParams/>
51
+ </action>
52
+ </reference>
53
+ <reference name="footer_links">
54
+ <action method="addLink" translate="label title" module="formbuilder" ifconfig="formbuilder_section/general/in_footerlinks">
55
+ <label>Formbuilder</label>
56
+ <url>formbuilder</url>
57
+ <title>Formbuilder</title>
58
+ <prepare>true</prepare>
59
+ </action>
60
+ </reference>
61
+ </default>
62
+ <formbuilder_index_index>
63
+ <reference name="root">
64
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
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" />
85
+ </reference>
86
+ </formbuilder_index_index>
87
+ <formbuilder_index_view>
88
+ <reference name="root">
89
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
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>
app/etc/modules/Phxsolution_Formbuilder.xml CHANGED
@@ -1,35 +1,35 @@
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 global 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
- <modules>
29
- <Phxsolution_Formbuilder>
30
- <active>true</active>
31
- <codePool>community</codePool>
32
- <version>0.2.0</version>
33
- </Phxsolution_Formbuilder>
34
- </modules>
35
  </config>
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 global 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
+ <modules>
29
+ <Phxsolution_Formbuilder>
30
+ <active>true</active>
31
+ <codePool>community</codePool>
32
+ <version>0.3.0</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.2.0</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>Form Builder allows you to create any type of form right from admin panel. </summary>
10
- <description>Custom Formbuilder is a complete solution for creating and managing custom forms on your Magento site.</description>
11
- <notes>Fixed extension package issue</notes>
12
- <authors><author><name>Murad Ali</name><user>phxsolution</user><email>contact@phxsolution.com</email></author></authors>
13
- <date>2015-06-01</date>
14
- <time>12:21:08</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Phxsolution_Formbuilder.xml" hash="5691fe9ce77bce1decdf6c68c3c7de88"/></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="c7b64bb9e72ea272dc498f41862b9d24"/></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="139e84376a1c38d5b7e123db4dbbb8a8"/></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="44cbde7be22fd873e330aa1fa9df082f"/></dir><file name="IndexController.php" hash="9dbe6bb107ec88528d979a99a23fb93f"/></dir><dir name="etc"><file name="config.xml" hash="56aa15924c0803be1b4bfd8cd6a2951d"/><file name="system.xml" hash="f907c9ecd89a531ae3e6da816d397d74"/></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="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="formbuilder.xml" hash="e59df913ac6ca984f3214132962ad8d3"/></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><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="formbuilder.xml" hash="ac93534580693b9e5440bb4876915c88"/></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></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><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></contents>
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.0</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>Releasing update of the extension, version 0.3.0 with email Email functionality &amp; Issues of Form title &amp; Form status not getting saved.</summary>
10
+ <description>Releasing update of the extension, version 0.3.0 with email Email functionality &amp; Issues of Form title &amp; Form status not getting saved.</description>
11
+ <notes>Releasing update of the extension, version 0.3.0 with email Email functionality &amp; Issues of Form title &amp; Form status not getting saved.</notes>
12
+ <authors><author><name>murad.magento</name><user>phxsolution</user><email>plvaniya@phxsolution.com</email></author></authors>
13
+ <date>2015-08-07</date>
14
+ <time>14:43:30</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Phxsolution_Formbuilder.xml" hash="6d8038973a2544ccf1de80e0bd13edea"/></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="42585d05d56c2d49aab9671f2c690c48"/></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="c74e21bce29ff5f6dccb062a902ef012"/></dir><dir name="controllers-7-8-15"><dir name="Adminhtml"><file name="FormbuilderController.php" hash="44cbde7be22fd873e330aa1fa9df082f"/></dir><file name="IndexController.php" hash="9dbe6bb107ec88528d979a99a23fb93f"/></dir><dir name="etc"><file name="config.xml" hash="89a755695e60dbd669ee0d88f96e9517"/><file name="system.xml" hash="50e22f7a3bffae4c59f6b6abe65420bf"/><file name="system.xml-7-8-15" hash="f907c9ecd89a531ae3e6da816d397d74"/></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="1f8c0608e912c87a6df5a12a446cf72e"/></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="d2ad782667380d95b1c27766cf87524d"/></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="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><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></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>