Web-forms - Version 1.0.0

Version Notes

This release is stable and contains sample data

Download this release

Release Info

Developer Vladimir Popov
Extension Web-forms
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (55) hide show
  1. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fields/Edit.php +41 -0
  2. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fields/Edit/Form.php +27 -0
  3. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fields/Edit/Tab/Design.php +58 -0
  4. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fields/Edit/Tab/Information.php +123 -0
  5. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fields/Edit/Tabs.php +40 -0
  6. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fieldsets/Edit.php +43 -0
  7. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fieldsets/Edit/Form.php +82 -0
  8. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Menu.php +49 -0
  9. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Results.php +31 -0
  10. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Results/Grid.php +147 -0
  11. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Results/Renderer/Customer.php +33 -0
  12. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Results/Renderer/Value.php +21 -0
  13. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms.php +21 -0
  14. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit.php +75 -0
  15. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit/Form.php +28 -0
  16. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit/Tab/Fields.php +111 -0
  17. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit/Tab/Fieldsets.php +86 -0
  18. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit/Tab/Information.php +76 -0
  19. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit/Tab/Settings.php +86 -0
  20. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit/Tabs.php +57 -0
  21. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Grid.php +162 -0
  22. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Renderer/Action.php +22 -0
  23. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Renderer/Fields.php +28 -0
  24. app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Renderer/Results.php +28 -0
  25. app/code/community/VladimirPopov/WebForms/Block/Webforms.php +27 -0
  26. app/code/community/VladimirPopov/WebForms/Block/Widget.php +124 -0
  27. app/code/community/VladimirPopov/WebForms/Helper/Data.php +15 -0
  28. app/code/community/VladimirPopov/WebForms/Model/Fields.php +125 -0
  29. app/code/community/VladimirPopov/WebForms/Model/Fieldsets.php +21 -0
  30. app/code/community/VladimirPopov/WebForms/Model/Mysql4/Fields.php +26 -0
  31. app/code/community/VladimirPopov/WebForms/Model/Mysql4/Fields/Collection.php +22 -0
  32. app/code/community/VladimirPopov/WebForms/Model/Mysql4/Fieldsets.php +28 -0
  33. app/code/community/VladimirPopov/WebForms/Model/Mysql4/Fieldsets/Collection.php +22 -0
  34. app/code/community/VladimirPopov/WebForms/Model/Mysql4/Results.php +87 -0
  35. app/code/community/VladimirPopov/WebForms/Model/Mysql4/Results/Collection.php +45 -0
  36. app/code/community/VladimirPopov/WebForms/Model/Mysql4/Webforms.php +34 -0
  37. app/code/community/VladimirPopov/WebForms/Model/Mysql4/Webforms/Collection.php +40 -0
  38. app/code/community/VladimirPopov/WebForms/Model/Results.php +166 -0
  39. app/code/community/VladimirPopov/WebForms/Model/Webforms.php +98 -0
  40. app/code/community/VladimirPopov/WebForms/controllers/Adminhtml/FieldsController.php +115 -0
  41. app/code/community/VladimirPopov/WebForms/controllers/Adminhtml/FieldsetsController.php +115 -0
  42. app/code/community/VladimirPopov/WebForms/controllers/Adminhtml/ResultsController.php +128 -0
  43. app/code/community/VladimirPopov/WebForms/controllers/Adminhtml/WebformsController.php +172 -0
  44. app/code/community/VladimirPopov/WebForms/controllers/IndexController.php +21 -0
  45. app/code/community/VladimirPopov/WebForms/etc/config.xml +201 -0
  46. app/code/community/VladimirPopov/WebForms/etc/system.xml +108 -0
  47. app/code/community/VladimirPopov/WebForms/etc/widget.xml +30 -0
  48. app/code/community/VladimirPopov/WebForms/sql/webforms_setup/mysql4-install-1.0.0.php +125 -0
  49. app/design/adminhtml/default/default/layout/webforms.xml +13 -0
  50. app/design/frontend/default/default/layout/webforms.xml +14 -0
  51. app/design/frontend/default/default/template/webforms/default.phtml +131 -0
  52. app/etc/modules/VladimirPopov_WebForms.xml +9 -0
  53. app/locale/en_US/VladimirPopov_WebForms.csv +112 -0
  54. app/locale/en_US/template/email/webforms_results.html +36 -0
  55. package.xml +31 -0
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fields/Edit.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Fields_Edit
13
+ extends Mage_Adminhtml_Block_Widget_Form_Container
14
+ {
15
+ public function __construct(){
16
+ parent::__construct();
17
+ $this->_objectId = 'id';
18
+ $this->_blockGroup = 'webforms';
19
+ $this->_controller = 'adminhtml_fields';
20
+
21
+ }
22
+
23
+ public function getSaveUrl()
24
+ {
25
+ return $this->getUrl('*/adminhtml_webforms/save',array('webform_id'=>Mage::registry('webforms_data')->getId()));
26
+ }
27
+
28
+ public function getBackUrl(){
29
+ return $this->getUrl('*/adminhtml_webforms/edit',array('id'=>Mage::registry('webforms_data')->getId()));
30
+ }
31
+
32
+ public function getHeaderText(){
33
+ if( Mage::registry('fields_data') && Mage::registry('fields_data')->getId() ) {
34
+ return Mage::helper('webforms')->__("Edit '%s' Field - %s", $this->htmlEscape(Mage::registry('fields_data')->getName()), $this->htmlEscape($this->htmlEscape(Mage::registry('webforms_data')->getName())));
35
+ } else {
36
+ return Mage::helper('webforms')->__('Add Field - %s',$this->htmlEscape(Mage::registry('webforms_data')->getName()));
37
+ }
38
+ }
39
+
40
+ }
41
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fields/Edit/Form.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Fields_Edit_Form
13
+ extends Mage_Adminhtml_Block_Widget_Form
14
+ {
15
+ protected function _prepareForm(){
16
+ $form = new Varien_Data_Form(array(
17
+ 'id' => 'edit_form',
18
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
19
+ 'method' => 'post',
20
+ ));
21
+
22
+ $form->setUseContainer(true);
23
+ $this->setForm($form);
24
+ return parent::_prepareForm();
25
+ }
26
+ }
27
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fields/Edit/Tab/Design.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Fields_Edit_Tab_Design
13
+ extends Mage_Adminhtml_Block_Widget_Form
14
+ {
15
+ protected function _prepareLayout(){
16
+
17
+ parent::_prepareLayout();
18
+ }
19
+
20
+ protected function _prepareForm()
21
+ {
22
+ $model = Mage::getModel('webforms/webforms');
23
+ $form = new Varien_Data_Form();
24
+ $this->setForm($form);
25
+ $fieldset = $form->addFieldset('webforms_form',array(
26
+ 'legend' => Mage::helper('webforms')->__('Design')
27
+ ));
28
+
29
+
30
+ $fieldset->addField('size','select',array(
31
+ 'label' => Mage::helper('webforms')->__('Size'),
32
+ 'name' => 'size',
33
+ 'values' => Mage::getModel('webforms/fields')->getSizeTypes(),
34
+ 'note' => Mage::helper('webforms')->__('Standard - two neighbour fields will be merged in one row<br />Wide - field will be wide and single in a row')
35
+ ));
36
+
37
+ $fieldset->addField('css_class','text',array(
38
+ 'label' => Mage::helper('webforms')->__('Additional CSS class'),
39
+ 'name' => 'css_class',
40
+ 'note' => Mage::helper('webforms')->__('You can also use it for additional field validation (see Prototype validation classes)')
41
+ ));
42
+
43
+ $fieldset->addField('css_style','text',array(
44
+ 'label' => Mage::helper('webforms')->__('Additional CSS style'),
45
+ 'name' => 'css_style'
46
+ ));
47
+
48
+ if(Mage::getSingleton('adminhtml/session')->getWebFormsData())
49
+ {
50
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getWebFormsData());
51
+ Mage::getSingleton('adminhtml/session')->setWebFormsData(null);
52
+ } elseif(Mage::registry('fields_data')){
53
+ $form->setValues(Mage::registry('fields_data')->getData());
54
+ }
55
+ return parent::_prepareForm();
56
+ }
57
+ }
58
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fields/Edit/Tab/Information.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Fields_Edit_Tab_Information
13
+ extends Mage_Adminhtml_Block_Widget_Form
14
+ {
15
+ protected function _prepareLayout(){
16
+
17
+ parent::_prepareLayout();
18
+ }
19
+
20
+ protected function _prepareForm()
21
+ {
22
+ $model = Mage::getModel('webforms/fields');
23
+ $form = new Varien_Data_Form();
24
+ $this->setForm($form);
25
+ $fieldset = $form->addFieldset('webforms_form',array(
26
+ 'legend' => Mage::helper('webforms')->__('Information')
27
+ ));
28
+
29
+ $fieldset->addField('name','text',array(
30
+ 'label' => Mage::helper('webforms')->__('Name'),
31
+ 'class' => 'required-entry',
32
+ 'required' => true,
33
+ 'name' => 'name'
34
+ ));
35
+
36
+ $fieldset->addField('type', 'select', array(
37
+ 'label' => Mage::helper('webforms')->__('Type'),
38
+ 'title' => Mage::helper('webforms')->__('Type'),
39
+ 'name' => 'type',
40
+ 'required' => true,
41
+ 'options' => $model->getFieldTypes(),
42
+ ));
43
+
44
+ $fieldsetsOptions = Mage::registry('webforms_data')->getFieldsetsOptionsArray();
45
+ if(count($fieldsetsOptions)>1){
46
+ $fieldset->addField('fieldset_id', 'select', array(
47
+ 'label' => Mage::helper('webforms')->__('Field set'),
48
+ 'title' => Mage::helper('webforms')->__('Field set'),
49
+ 'name' => 'fieldset_id',
50
+ 'required' => true,
51
+ 'options' => $fieldsetsOptions,
52
+ ));
53
+ }
54
+
55
+ $fieldset->addField('value','textarea',array(
56
+ 'label' => Mage::helper('webforms')->__('Field value(s)'),
57
+ 'required' => false,
58
+ 'name' => 'value',
59
+ 'note' => Mage::helper('webforms')->__('Values for select type field should be separated with new line (the first listed value is default).<br />You can use following variables for default values:<br />{{firstname}} - logged in customer first name <br />{{lastname}} - logged in customer last name <br />{{email}} - logged in customer e-mail address'),
60
+ ));
61
+
62
+ $fieldset->addField('email_subject', 'select', array(
63
+ 'label' => Mage::helper('webforms')->__('Use as e-mail subject'),
64
+ 'title' => Mage::helper('webforms')->__('Use as e-mail subject'),
65
+ 'name' => 'email_subject',
66
+ 'note' => Mage::helper('webforms')->__('This field will be used as a subject in notification e-mail'),
67
+ 'required' => true,
68
+ 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
69
+ ));
70
+
71
+ $fieldset->addField('position','text',array(
72
+ 'label' => Mage::helper('webforms')->__('Position'),
73
+ 'required' => true,
74
+ 'name' => 'position',
75
+ 'note' => Mage::helper('webforms')->__('Field position in the form relative to field set'),
76
+ ));
77
+
78
+ $fieldset->addField('required', 'select', array(
79
+ 'label' => Mage::helper('webforms')->__('Required'),
80
+ 'title' => Mage::helper('webforms')->__('Required'),
81
+ 'name' => 'required',
82
+ 'required' => true,
83
+ 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
84
+ ));
85
+
86
+ $fieldset->addField('is_active', 'select', array(
87
+ 'label' => Mage::helper('webforms')->__('Status'),
88
+ 'title' => Mage::helper('webforms')->__('Status'),
89
+ 'name' => 'is_active',
90
+ 'note' => Mage::helper('webforms')->__('If assigned field set is not active the field won`t be displayed'),
91
+ 'required' => true,
92
+ 'options' => Mage::getModel('webforms/webforms')->getAvailableStatuses(),
93
+ ));
94
+ $fieldset->addField('webform_id', 'hidden', array(
95
+ 'name' => 'webform_id',
96
+ 'value' => 1,
97
+ ));
98
+
99
+
100
+ if (!$model->getId()) {
101
+ $model->setData('is_active', $isElementDisabled ? '0' : '1');
102
+ }
103
+
104
+ if(Mage::getSingleton('adminhtml/session')->getWebFormsData())
105
+ {
106
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getWebFormsData());
107
+ Mage::getSingleton('adminhtml/session')->setWebFormsData(null);
108
+ } elseif(Mage::registry('fields_data')){
109
+ $form->setValues(Mage::registry('fields_data')->getData());
110
+ }
111
+
112
+ // set default field values
113
+ if(!Mage::registry('fields_data')->getId()){
114
+ $form->setValues(array(
115
+ 'webform_id' => $this->getRequest()->getParam('webform_id'),
116
+ 'position' => 10
117
+ ));
118
+ }
119
+
120
+ return parent::_prepareForm();
121
+ }
122
+ }
123
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fields/Edit/Tabs.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Fields_Edit_Tabs
13
+ extends Mage_Adminhtml_Block_Widget_Tabs
14
+ {
15
+ public function __construct(){
16
+ parent::__construct();
17
+ $this->setId('webforms_fields_tabs');
18
+ $this->setDestElementId('edit_form');
19
+ $this->setTitle(Mage::helper('webforms')->__('Field Information'));
20
+ }
21
+
22
+ protected function _beforeToHtml()
23
+ {
24
+
25
+ $this->addTab('form_information',array(
26
+ 'label' => Mage::helper('webforms')->__('Information'),
27
+ 'title' => Mage::helper('webforms')->__('Information'),
28
+ 'content' => $this->getLayout()->createBlock('webforms/adminhtml_fields_edit_tab_information')->toHtml(),
29
+ ));
30
+
31
+ $this->addTab('form_fields',array(
32
+ 'label' => Mage::helper('webforms')->__('Design'),
33
+ 'title' => Mage::helper('webforms')->__('Design'),
34
+ 'content' => $this->getLayout()->createBlock('webforms/adminhtml_fields_edit_tab_design')->toHtml(),
35
+ ));
36
+
37
+ return parent::_beforeToHtml();
38
+ }
39
+ }
40
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fieldsets/Edit.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Fieldsets_Edit
13
+ extends Mage_Adminhtml_Block_Widget_Form_Container
14
+ {
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+ $this->_objectId = 'id';
19
+ $this->_blockGroup = 'webforms';
20
+ $this->_controller = 'adminhtml_fieldsets';
21
+
22
+ }
23
+
24
+ public function getSaveUrl()
25
+ {
26
+ return $this->getUrl('*/adminhtml_webforms/save',array('webform_id'=>Mage::registry('webforms_data')->getId()));
27
+ }
28
+
29
+ public function getBackUrl(){
30
+ return $this->getUrl('*/adminhtml_webforms/edit',array('id'=>Mage::registry('webforms_data')->getId()));
31
+ }
32
+
33
+ public function getHeaderText()
34
+ {
35
+ if(!is_null(Mage::registry('fieldsets_data')->getId())) {
36
+ return Mage::helper('webforms')->__("Edit Field Set '%s'", $this->htmlEscape(Mage::registry('fieldsets_data')->getName()));
37
+ } else {
38
+ return Mage::helper('webforms')->__('New Field Set');
39
+ }
40
+ }
41
+
42
+ }
43
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Fieldsets/Edit/Form.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Fieldsets_Edit_Form
13
+ extends Mage_Adminhtml_Block_Widget_Form
14
+ {
15
+
16
+ protected function _prepareLayout()
17
+ {
18
+ parent::_prepareLayout();
19
+
20
+ $model = Mage::getModel('webforms/fieldsets');
21
+ $form = new Varien_Data_Form(array(
22
+ 'id' => 'edit_form',
23
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
24
+ 'method' => 'post',
25
+ ));
26
+ $fieldset = $form->addFieldset('webforms_form',array(
27
+ 'legend' => Mage::helper('webforms')->__('Information')
28
+ ));
29
+
30
+ $fieldset->addField('name','text',array(
31
+ 'label' => Mage::helper('webforms')->__('Name'),
32
+ 'class' => 'required-entry',
33
+ 'required' => true,
34
+ 'name' => 'name'
35
+ ));
36
+
37
+ $fieldset->addField('position','text',array(
38
+ 'label' => Mage::helper('webforms')->__('Position'),
39
+ 'required' => true,
40
+ 'name' => 'position',
41
+ 'note' => Mage::helper('webforms')->__('Fieldset position in the form'),
42
+ ));
43
+
44
+ $fieldset->addField('is_active', 'select', array(
45
+ 'label' => Mage::helper('webforms')->__('Status'),
46
+ 'title' => Mage::helper('webforms')->__('Status'),
47
+ 'name' => 'is_active',
48
+ 'required' => true,
49
+ 'options' => Mage::getModel('webforms/webforms')->getAvailableStatuses(),
50
+ ));
51
+
52
+ $fieldset->addField('webform_id', 'hidden', array(
53
+ 'name' => 'webform_id',
54
+ 'value' => 1,
55
+ ));
56
+
57
+
58
+ if (!$model->getId()) {
59
+ $model->setData('is_active', $isElementDisabled ? '0' : '1');
60
+ }
61
+
62
+ if(Mage::getSingleton('adminhtml/session')->getWebFormsData())
63
+ {
64
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getWebFormsData());
65
+ Mage::getSingleton('adminhtml/session')->setWebFormsData(null);
66
+ } elseif(Mage::registry('fieldsets_data')){
67
+ $form->setValues(Mage::registry('fieldsets_data')->getData());
68
+ }
69
+
70
+ // set default field values
71
+ if(!Mage::registry('fieldsets_data')->getId()){
72
+ $form->setValues(array(
73
+ 'webform_id' => $this->getRequest()->getParam('webform_id'),
74
+ 'position' => 10
75
+ ));
76
+ }
77
+ $form->setUseContainer(true);
78
+ $this->setForm($form);
79
+
80
+ }
81
+ }
82
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Menu.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Menu extends Mage_Adminhtml_Block_Page_Menu
13
+ {
14
+ public function getMenuArray()
15
+ {
16
+ //Load standard menu
17
+ $parentArr = parent::getMenuArray();
18
+
19
+ $collection = Mage::getModel('webforms/webforms')->getCollection()
20
+ ->addFilter('is_active','1')
21
+ ->addOrder('name','asc');
22
+ $totalCount= count($collection);
23
+
24
+ //Update all previous menu items
25
+ if($totalCount){
26
+ foreach($parentArr['webforms']['children'] as $i=>$item){
27
+ $parentArr['webforms']['children'][$i]['last'] = false;
28
+ }
29
+ }
30
+
31
+ $k=0;
32
+ foreach($collection as $webform){
33
+ $menuitem = array(
34
+ 'label' => $webform->getName(),
35
+ 'active' => false ,
36
+ 'sort_order' => $i++ * 10,
37
+ 'level' => 1,
38
+ 'url' => $this->getUrl('webforms/adminhtml_results',array('webform_id'=>$webform->getId()))
39
+ );
40
+ if($k==$totalCount-1){
41
+ $menuitem['last'] = true;
42
+ }
43
+ $parentArr['webforms']['children'][]= $menuitem;
44
+ $k++;
45
+ }
46
+
47
+ return $parentArr;
48
+ }
49
+ }
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Results.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Results extends Mage_Adminhtml_Block_Widget_Grid_Container{
13
+ public function __construct(){
14
+ $this->_controller = 'adminhtml_results';
15
+ $this->_blockGroup = 'webforms';
16
+ $webform = Mage::getModel('webforms/webforms')->load($this->getRequest()->getParam('webform_id'));
17
+ $this->_headerText = $webform->getName();
18
+ parent::__construct();
19
+ $this->_removeButton('add');
20
+ $this->_addButton('edit', array(
21
+ 'label' => Mage::helper('webforms')->__('Edit Web-form'),
22
+ 'onclick' => 'setLocation(\'' . $this->getEditUrl() .'\')',
23
+ 'class' => 'edit',
24
+ ));
25
+ }
26
+
27
+ public function getEditUrl(){
28
+ return $this->getUrl('*/adminhtml_webforms/edit',array('id'=>$this->getRequest()->getParam('webform_id')));
29
+ }
30
+ }
31
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Results/Grid.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Results_Grid
13
+ extends Mage_Adminhtml_Block_Widget_Grid
14
+ {
15
+ public function __construct(){
16
+ parent::__construct();
17
+ $this->setId('webformsGrid');
18
+ $this->setDefaultSort('created_time');
19
+ $this->setDefaultDir('desc');
20
+ $this->setSaveParametersInSession(true);
21
+ $this->setUseAjax(true);
22
+ $this->setVarNameFilter('product_filter');
23
+ }
24
+
25
+ public function getGridUrl()
26
+ {
27
+ return $this->getUrl('*/*/grid', array('_current'=>true));
28
+ }
29
+
30
+ protected function _getStore()
31
+ {
32
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
33
+ return Mage::app()->getStore($storeId);
34
+ }
35
+
36
+ protected function _filterCustomerCondition($collection,$column){
37
+ if (!$value = trim($column->getFilter()->getValue())) {
38
+ return;
39
+ }
40
+ while(strstr($value," ")){
41
+ $value = str_replace(" "," ",$value);
42
+ }
43
+ $customers_array = array();
44
+ $name = explode(" ",$value);
45
+ $firstname = $name[0];
46
+ $lastname = $name[count($name)-1];
47
+ $customers = Mage::getModel('customer/customer')->getCollection()
48
+ ->addAttributeToFilter('firstname',$firstname);
49
+ if(count($name)==2)
50
+ $customers->addAttributeToFilter('lastname',$lastname);
51
+ foreach($customers as $customer){
52
+ $customers_array[]= $customer->getId();
53
+ }
54
+ $collection->addFieldToFilter('customer_id', array('in' => $customers_array));
55
+ }
56
+
57
+ protected function _prepareCollection()
58
+ {
59
+ $collection = Mage::getModel('webforms/results')->getCollection()->addFilter('webform_id',$this->getRequest()->getParam('webform_id'));
60
+ $this->setCollection($collection);
61
+ return parent::_prepareCollection();
62
+ }
63
+
64
+ protected function _prepareColumns()
65
+ {
66
+ $this->addColumn('id',array(
67
+ 'header' => Mage::helper('webforms')->__('Id'),
68
+ 'align' => 'right',
69
+ 'width' => '50px',
70
+ 'index' => 'id',
71
+ ));
72
+
73
+ $fields = Mage::getModel('webforms/fields')->getCollection()
74
+ ->addFilter('webform_id',$this->getRequest()->getParam('webform_id'))
75
+ ->addOrder('position','asc');
76
+
77
+ $maxlength = Mage::getStoreConfig('webforms/results/fieldname_display_limit');
78
+ foreach($fields as $field){
79
+ $field_name = $field->getName();
80
+ if(strlen($field->getName())>$maxlength){
81
+ $field_name = substr($field_name,0,$maxlength).'...';
82
+ }
83
+ $this->addColumn('field_'.$field->getId(), array(
84
+ 'header' => $field_name,
85
+ 'index' => 'field_'.$field->getId(),
86
+ 'sortable' => false,
87
+ 'filter' => false,
88
+ 'renderer' => 'VladimirPopov_WebForms_Block_Adminhtml_Results_Renderer_Value'
89
+ ));
90
+ }
91
+
92
+ $this->addColumn('customer_id',array(
93
+ 'header' => Mage::helper('webforms')->__('Customer'),
94
+ 'align' => 'left',
95
+ 'index' => 'customer_id',
96
+ 'renderer' => 'VladimirPopov_WebForms_Block_Adminhtml_Results_Renderer_Customer',
97
+ 'filter_condition_callback' => array($this, '_filterCustomerCondition'),
98
+ 'sortable' => false
99
+ ));
100
+
101
+ $this->addColumn('ip',array(
102
+ 'header' => Mage::helper('webforms')->__('IP'),
103
+ 'index' => 'ip',
104
+ ));
105
+
106
+ $this->addColumn('created_time', array(
107
+ 'header' => Mage::helper('webforms')->__('Date Created'),
108
+ 'index' => 'created_time',
109
+ 'type' => 'datetime',
110
+ ));
111
+
112
+ $this->addExportType('*/*/exportCsv', Mage::helper('webforms')->__('CSV'));
113
+ $this->addExportType('*/*/exportXml', Mage::helper('webforms')->__('Excel XML'));
114
+
115
+ return parent::_prepareColumns();
116
+ }
117
+
118
+ protected function _filterStoreCondition($collection, $column)
119
+ {
120
+ if (!$value = $column->getFilter()->getValue()) {
121
+ return;
122
+ }
123
+
124
+ $this->getCollection()->addStoreFilter($value);
125
+ }
126
+
127
+ protected function _prepareMassaction()
128
+ {
129
+ $this->setMassactionIdField('id');
130
+ $this->getMassactionBlock()->setFormFieldName('id');
131
+
132
+ $this->getMassactionBlock()->addItem('email', array(
133
+ 'label'=> Mage::helper('webforms')->__('Send by e-mail'),
134
+ 'url' => $this->getUrl('*/*/massEmail',array('webform_id'=>$this->getRequest()->getParam('webform_id'))),
135
+ 'confirm' => Mage::helper('webforms')->__('Send selected results by e-mail?'),
136
+ ));
137
+
138
+ $this->getMassactionBlock()->addItem('delete', array(
139
+ 'label'=> Mage::helper('webforms')->__('Delete'),
140
+ 'url' => $this->getUrl('*/*/massDelete',array('webform_id'=>$this->getRequest()->getParam('webform_id'))),
141
+ 'confirm' => Mage::helper('webforms')->__('Are you sure to delete selected results?'),
142
+ ));
143
+
144
+ return $this;
145
+ }
146
+ }
147
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Results/Renderer/Customer.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Results_Renderer_Customer extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
13
+ {
14
+ public function render(Varien_Object $row)
15
+ {
16
+ $value = $row->getData($this->getColumn()->getIndex());
17
+ if($value){
18
+ $output = "<a href='".$this->getCustomerUrl($row)."' target='_blank'>".Mage::getModel('customer/customer')->load($value)->getName()."</a>";
19
+ } else{
20
+ $output = Mage::helper('webforms')->__('Guest');
21
+ }
22
+ return $output;
23
+ }
24
+
25
+ public function getCustomerUrl(Varien_Object $row)
26
+ {
27
+
28
+ return $this->getUrl('adminhtml/customer/edit',array('id'=>$row->getCustomerId(),'_current'=>false));
29
+ }
30
+
31
+ }
32
+
33
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Results/Renderer/Value.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Results_Renderer_Value extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
13
+ {
14
+ public function render(Varien_Object $row)
15
+ {
16
+ $value = $row->getData($this->getColumn()->getIndex());
17
+ return nl2br(htmlentities($value));
18
+ }
19
+ }
20
+
21
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Webforms extends Mage_Adminhtml_Block_Widget_Grid_Container{
13
+ public function __construct(){
14
+ $this->_controller = 'adminhtml_webforms';
15
+ $this->_blockGroup = 'webforms';
16
+ $this->_headerText = Mage::helper('webforms')->__('Manage Forms');
17
+ $this->_addButtonLabel = Mage::helper('webforms')->__('Add New Web-form');
18
+ parent::__construct();
19
+ }
20
+ }
21
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Webforms_Edit
13
+ extends Mage_Adminhtml_Block_Widget_Form_Container
14
+ {
15
+ protected function _prepareLayout(){
16
+ parent::_prepareLayout();
17
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
18
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
19
+ }
20
+ }
21
+
22
+ public function __construct(){
23
+ parent::__construct();
24
+ $this->_objectId = 'id';
25
+ $this->_blockGroup = 'webforms';
26
+ $this->_controller = 'adminhtml_webforms';
27
+
28
+ if(Mage::registry('webforms_data') && Mage::registry('webforms_data')->getId() ){
29
+ $this->_addButton('add_fieldset', array(
30
+ 'label' => Mage::helper('webforms')->__('Add Field Set'),
31
+ 'class' => 'add',
32
+ 'onclick' => 'setLocation(\'' . $this->getAddFieldsetUrl() . '\')',
33
+ ));
34
+
35
+ $this->_addButton('add_field', array(
36
+ 'label' => Mage::helper('webforms')->__('Add Field'),
37
+ 'class' => 'add',
38
+ 'onclick' => 'setLocation(\'' . $this->getAddFieldUrl() . '\')',
39
+ ));
40
+ } else {
41
+ $this->_removeButton('save');
42
+ }
43
+
44
+ $this->_addButton('saveandcontinue', array(
45
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
46
+ 'onclick' => 'saveAndContinueEdit()',
47
+ 'class' => 'save',
48
+ ), -100);
49
+
50
+ $this->_formScripts[] = "
51
+ function saveAndContinueEdit(){
52
+ editForm.submit($('edit_form').action+'back/edit/');
53
+ }
54
+ ";
55
+ }
56
+
57
+ public function getAddFieldUrl()
58
+ {
59
+ return $this->getUrl('*/adminhtml_fields/edit', array('webform_id'=>Mage::registry('webforms_data')->getId()));
60
+ }
61
+
62
+ public function getAddFieldsetUrl()
63
+ {
64
+ return $this->getUrl('*/adminhtml_fieldsets/edit', array('webform_id'=>Mage::registry('webforms_data')->getId()));
65
+ }
66
+
67
+ public function getHeaderText(){
68
+ if( Mage::registry('webforms_data') && Mage::registry('webforms_data')->getId() ) {
69
+ return Mage::helper('webforms')->__("Edit '%s' Form", $this->htmlEscape(Mage::registry('webforms_data')->getName()));
70
+ } else {
71
+ return Mage::helper('webforms')->__('Add Form');
72
+ }
73
+ }
74
+ }
75
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit/Form.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_WebForms_Edit_Form
13
+ extends Mage_Adminhtml_Block_Widget_Form
14
+ {
15
+ protected function _prepareForm(){
16
+ $form = new Varien_Data_Form(array(
17
+ 'id' => 'edit_form',
18
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
19
+ 'method' => 'post',
20
+ ));
21
+
22
+ $form->setUseContainer(true);
23
+ $this->setForm($form);
24
+
25
+ return parent::_prepareForm();
26
+ }
27
+ }
28
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit/Tab/Fields.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Webforms_Edit_Tab_Fields
13
+ extends Mage_Adminhtml_Block_Widget_Grid
14
+ {
15
+
16
+ public function _prepareLayout(){
17
+ parent::_prepareLayout();
18
+ }
19
+
20
+ /**
21
+ * Set grid params
22
+ *
23
+ */
24
+ public function __construct()
25
+ {
26
+ parent::__construct();
27
+ $this->setId('form_fields_grid');
28
+ $this->setDefaultSort('position');
29
+ $this->setDefaultDir('asc');
30
+ $this->setUseAjax(true);
31
+ $this->setFilterVisibility(false);
32
+ }
33
+
34
+ public function getGridUrl(){
35
+ return $this->getUrl('*/adminhtml_fields/grid',array('id'=> $this->getRequest()->getParam('id')));
36
+ }
37
+
38
+ public function getRowUrl($row){
39
+ return $this->getUrl('*/adminhtml_fields/edit', array('id' => $row->getId(), 'webform_id' => $this->getRequest()->getParam('id')));
40
+ }
41
+
42
+ public function _prepareCollection(){
43
+ $collection = Mage::getModel('webforms/fields')->getCollection()->addFilter('webform_id', $this->getRequest()->getParam('id'));
44
+ $this->setCollection($collection);
45
+ return parent::_prepareCollection();
46
+ }
47
+
48
+ /**
49
+ * Add columns to grid
50
+ *
51
+ * @return Mage_Adminhtml_Block_Widget_Grid
52
+ */
53
+ protected function _prepareColumns()
54
+ {
55
+ $this->addColumn('id', array(
56
+ 'header' => Mage::helper('webforms')->__('ID'),
57
+ 'width' => 60,
58
+ 'index' => 'id'
59
+ ));
60
+
61
+ $this->addColumn('name', array(
62
+ 'header' => Mage::helper('webforms')->__('Name'),
63
+ 'index' => 'name'
64
+ ));
65
+
66
+ $fieldsetsOptions = Mage::registry('webforms_data')->getFieldsetsOptionsArray();
67
+ if(count($fieldsetsOptions)>1) {
68
+ $this->addColumn('fieldset_id', array(
69
+ 'header' => Mage::helper('webforms')->__('Field Set'),
70
+ 'index' => 'fieldset_id',
71
+ 'type' => 'options',
72
+ 'options' => $fieldsetsOptions,
73
+ ));
74
+ }
75
+
76
+ $this->addColumn('type', array(
77
+ 'header' => Mage::helper('webforms')->__('Type'),
78
+ 'width' => 150,
79
+ 'index' => 'type',
80
+ 'type' => 'options',
81
+ 'options' => Mage::getModel('webforms/fields')->getFieldTypes(),
82
+ ));
83
+
84
+ $this->addColumn('required', array(
85
+ 'header' => Mage::helper('webforms')->__('Required'),
86
+ 'width' => 100,
87
+ 'index' => 'required',
88
+ 'type' => 'options',
89
+ 'options' => array("1"=>$this->__("Yes"),"0"=>$this->__("No")),
90
+ ));
91
+
92
+ $this->addColumn('is_active', array(
93
+ 'header' => Mage::helper('webforms')->__('Status'),
94
+ 'index' => 'is_active',
95
+ 'type' => 'options',
96
+ 'options' => Mage::getModel('webforms/webforms')->getAvailableStatuses(),
97
+ ));
98
+
99
+ $this->addColumn('position', array(
100
+ 'header' => Mage::helper('webforms')->__('Position'),
101
+ 'name' => 'position',
102
+ 'type' => 'number',
103
+ 'validate_class' => 'validate-number',
104
+ 'index' => 'position',
105
+ 'width' => 60,
106
+ ));
107
+ return parent::_prepareColumns();
108
+ }
109
+
110
+ }
111
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit/Tab/Fieldsets.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Webforms_Edit_Tab_Fieldsets
13
+ extends Mage_Adminhtml_Block_Widget_Grid
14
+ {
15
+
16
+ public function _prepareLayout(){
17
+
18
+ parent::_prepareLayout();
19
+ }
20
+
21
+ /**
22
+ * Set grid params
23
+ *
24
+ */
25
+ public function __construct()
26
+ {
27
+ parent::__construct();
28
+ $this->setId('form_fieldsets_grid');
29
+ $this->setDefaultSort('position');
30
+ $this->setDefaultDir('asc');
31
+ $this->setUseAjax(true);
32
+ $this->setFilterVisibility(false);
33
+ }
34
+
35
+ public function getGridUrl(){
36
+ return $this->getUrl('*/adminhtml_fieldsets/grid',array('id'=> $this->getRequest()->getParam('id')));
37
+ }
38
+
39
+ public function getRowUrl($row){
40
+ return $this->getUrl('*/adminhtml_fieldsets/edit', array('id' => $row->getId(), 'webform_id' => $this->getRequest()->getParam('id')));
41
+ }
42
+
43
+ public function _prepareCollection(){
44
+ $collection = Mage::getModel('webforms/fieldsets')->getCollection()->addFilter('webform_id', $this->getRequest()->getParam('id'));
45
+ $this->setCollection($collection);
46
+ return parent::_prepareCollection();
47
+ }
48
+
49
+ /**
50
+ * Add columns to grid
51
+ *
52
+ * @return Mage_Adminhtml_Block_Widget_Grid
53
+ */
54
+ protected function _prepareColumns()
55
+ {
56
+ $this->addColumn('id', array(
57
+ 'header' => Mage::helper('webforms')->__('ID'),
58
+ 'width' => 60,
59
+ 'index' => 'id'
60
+ ));
61
+
62
+ $this->addColumn('name', array(
63
+ 'header' => Mage::helper('webforms')->__('Name'),
64
+ 'index' => 'name'
65
+ ));
66
+
67
+ $this->addColumn('is_active', array(
68
+ 'header' => Mage::helper('webforms')->__('Status'),
69
+ 'index' => 'is_active',
70
+ 'type' => 'options',
71
+ 'options' => Mage::getModel('webforms/webforms')->getAvailableStatuses(),
72
+ ));
73
+
74
+ $this->addColumn('position', array(
75
+ 'header' => Mage::helper('webforms')->__('Position'),
76
+ 'name' => 'position',
77
+ 'type' => 'number',
78
+ 'validate_class' => 'validate-number',
79
+ 'index' => 'position',
80
+ 'width' => 60,
81
+ ));
82
+ return parent::_prepareColumns();
83
+ }
84
+
85
+ }
86
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit/Tab/Information.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Webforms_Edit_Tab_Information
13
+ extends Mage_Adminhtml_Block_Widget_Form
14
+ {
15
+ protected function _prepareLayout(){
16
+
17
+ parent::_prepareLayout();
18
+ }
19
+
20
+ protected function _prepareForm()
21
+ {
22
+ $model = Mage::getModel('webforms/webforms');
23
+ $form = new Varien_Data_Form();
24
+ $this->setForm($form);
25
+ $fieldset = $form->addFieldset('webforms_form',array(
26
+ 'legend' => Mage::helper('webforms')->__('Form Information')
27
+ ));
28
+
29
+ $fieldset->addField('name','text',array(
30
+ 'label' => Mage::helper('webforms')->__('Name'),
31
+ 'class' => 'required-entry',
32
+ 'required' => true,
33
+ 'name' => 'name'
34
+ ));
35
+
36
+ $fieldset->addField('description','editor',array(
37
+ 'label' => Mage::helper('webforms')->__('Description'),
38
+ 'required' => false,
39
+ 'name' => 'description',
40
+ 'style' => 'height:20em; width:50em;',
41
+ 'note' => Mage::helper('webforms')->__('This text will appear under the form name'),
42
+ 'wysiwyg' => true,
43
+ ));
44
+
45
+ $fieldset->addField('success_text','editor',array(
46
+ 'label' => Mage::helper('webforms')->__('Success text'),
47
+ 'required' => false,
48
+ 'name' => 'success_text',
49
+ 'style' => 'height:20em; width:50em;',
50
+ 'note' => Mage::helper('webforms')->__('This text will be displayed after the form completion'),
51
+ 'wysiwyg' => true,
52
+ ));
53
+
54
+ $fieldset->addField('is_active', 'select', array(
55
+ 'label' => Mage::helper('webforms')->__('Status'),
56
+ 'title' => Mage::helper('webforms')->__('Status'),
57
+ 'name' => 'is_active',
58
+ 'required' => true,
59
+ 'options' => $model->getAvailableStatuses(),
60
+ ));
61
+
62
+ if (!$model->getId()) {
63
+ $model->setData('is_active', $isElementDisabled ? '0' : '1');
64
+ }
65
+
66
+ if(Mage::getSingleton('adminhtml/session')->getWebFormsData())
67
+ {
68
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getWebFormsData());
69
+ Mage::getSingleton('adminhtml/session')->setWebFormsData(null);
70
+ } elseif(Mage::registry('webforms_data')){
71
+ $form->setValues(Mage::registry('webforms_data')->getData());
72
+ }
73
+ return parent::_prepareForm();
74
+ }
75
+ }
76
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit/Tab/Settings.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Webforms_Edit_Tab_Settings
13
+ extends Mage_Adminhtml_Block_Widget_Form
14
+ {
15
+ protected function _prepareLayout(){
16
+
17
+ parent::_prepareLayout();
18
+ }
19
+
20
+ protected function _prepareForm()
21
+ {
22
+ $model = Mage::getModel('webforms/webforms');
23
+ $form = new Varien_Data_Form();
24
+ $this->setForm($form);
25
+ $fieldset = $form->addFieldset('webforms_form',array(
26
+ 'legend' => Mage::helper('webforms')->__('Form Settings')
27
+ ));
28
+
29
+ $fieldset->addField('send_email', 'select', array(
30
+ 'label' => Mage::helper('webforms')->__('Send results by e-mail'),
31
+ 'title' => Mage::helper('webforms')->__('Send results by e-mail'),
32
+ 'name' => 'send_email',
33
+ 'required' => true,
34
+ 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
35
+ ));
36
+
37
+ $fieldset->addField('duplicate_email', 'select', array(
38
+ 'label' => Mage::helper('webforms')->__('Duplicate results by e-mail to customer'),
39
+ 'title' => Mage::helper('webforms')->__('Duplicate results by e-mail to customer'),
40
+ 'name' => 'duplicate_email',
41
+ 'required' => true,
42
+ 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
43
+ ));
44
+
45
+ $fieldset->addField('email','text',array(
46
+ 'label' => Mage::helper('webforms')->__('Notification e-mail address'),
47
+ 'note' => Mage::helper('webforms')->__('If empty default notofication e-mail address will be used'),
48
+ 'name' => 'email'
49
+ ));
50
+
51
+ $fieldset->addField('registered_only', 'select', array(
52
+ 'label' => Mage::helper('webforms')->__('Registered customers only'),
53
+ 'title' => Mage::helper('webforms')->__('Registered customers only'),
54
+ 'name' => 'registered_only',
55
+ 'required' => true,
56
+ 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
57
+ ));
58
+
59
+ $fieldset->addField('survey', 'select', array(
60
+ 'label' => Mage::helper('webforms')->__('Survey mode'),
61
+ 'title' => Mage::helper('webforms')->__('Survey mode'),
62
+ 'name' => 'survey',
63
+ 'required' => true,
64
+ 'note' => Mage::helper('webforms')->__('Survey mode allows filling up the form only one time'),
65
+ 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
66
+ ));
67
+
68
+ $fieldset->addField('continue_button', 'note', array(
69
+ 'text' => $this->getChildHtml('continue_button'),
70
+ ));
71
+
72
+ if (!$model->getId()) {
73
+ Mage::registry('webforms_data')->setData('send_email',1);
74
+ }
75
+
76
+ if(Mage::getSingleton('adminhtml/session')->getWebFormsData())
77
+ {
78
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getWebFormsData());
79
+ Mage::getSingleton('adminhtml/session')->setWebFormsData(null);
80
+ } elseif(Mage::registry('webforms_data')){
81
+ $form->setValues(Mage::registry('webforms_data')->getData());
82
+ }
83
+ return parent::_prepareForm();
84
+ }
85
+ }
86
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Edit/Tabs.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_WebForms_Edit_Tabs
13
+ extends Mage_Adminhtml_Block_Widget_Tabs
14
+ {
15
+ public function __construct(){
16
+ parent::__construct();
17
+ $this->setId('webforms_tabs');
18
+ $this->setDestElementId('edit_form');
19
+ $this->setTitle(Mage::helper('webforms')->__('Form Information'));
20
+ }
21
+
22
+ protected function _beforeToHtml()
23
+ {
24
+
25
+ $this->addTab('form_information',array(
26
+ 'label' => Mage::helper('webforms')->__('Information'),
27
+ 'title' => Mage::helper('webforms')->__('Information'),
28
+ 'content' => $this->getLayout()->createBlock('webforms/adminhtml_webforms_edit_tab_information')->toHtml(),
29
+ ));
30
+
31
+ $this->addTab('form_settings',array(
32
+ 'label' => Mage::helper('webforms')->__('Settings'),
33
+ 'title' => Mage::helper('webforms')->__('Settings'),
34
+ 'content' => $this->getLayout()->createBlock('webforms/adminhtml_webforms_edit_tab_settings')->toHtml(),
35
+ ));
36
+
37
+ if(Mage::registry('webforms_data') && Mage::registry('webforms_data')->getId() ){
38
+ $this->addTab('form_fieldsets',array(
39
+ 'label' => Mage::helper('webforms')->__('Field Sets'),
40
+ 'title' => Mage::helper('webforms')->__('Field Sets'),
41
+ 'content' => $this->getLayout()->createBlock('webforms/adminhtml_webforms_edit_tab_fieldsets')->toHtml(),
42
+ ));
43
+
44
+ $this->addTab('form_fields',array(
45
+ 'label' => Mage::helper('webforms')->__('Fields'),
46
+ 'title' => Mage::helper('webforms')->__('Fields'),
47
+ 'content' => $this->getLayout()->createBlock('webforms/adminhtml_webforms_edit_tab_fields')->toHtml(),
48
+ ));
49
+ }
50
+
51
+ if($this->getRequest()->getParam('tab')){
52
+ $this->setActiveTab($this->getRequest()->getParam('tab'));
53
+ }
54
+ return parent::_beforeToHtml();
55
+ }
56
+ }
57
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Grid.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Webforms_Grid
13
+ extends Mage_Adminhtml_Block_Widget_Grid
14
+ {
15
+ public function __construct(){
16
+ parent::__construct();
17
+ $this->setId('webformsGrid');
18
+ $this->setDefaultSort('id');
19
+ $this->setDefaultDir('desc');
20
+ $this->setSaveParametersInSession(true);
21
+ $this->setUseAjax(true);
22
+ $this->setVarNameFilter('product_filter');
23
+ }
24
+
25
+ public function getGridUrl()
26
+ {
27
+ return $this->getUrl('*/*/grid', array('_current'=>true));
28
+ }
29
+
30
+ protected function _getStore()
31
+ {
32
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
33
+ return Mage::app()->getStore($storeId);
34
+ }
35
+
36
+ protected function _prepareCollection()
37
+ {
38
+ $collection = Mage::getModel('webforms/webforms')->getCollection();
39
+ $this->setCollection($collection);
40
+ return parent::_prepareCollection();
41
+ }
42
+
43
+ protected function _prepareColumns()
44
+ {
45
+ $this->addColumn('id',array(
46
+ 'header' => Mage::helper('webforms')->__('Id'),
47
+ 'align' => 'right',
48
+ 'width' => '50px',
49
+ 'index' => 'id',
50
+ ));
51
+
52
+ $this->addColumn('name',array(
53
+ 'header' => Mage::helper('webforms')->__('Name'),
54
+ 'align' => 'left',
55
+ 'index' => 'name',
56
+ ));
57
+
58
+ $this->addColumn('fields',array(
59
+ 'header' => Mage::helper('webforms')->__('Fields'),
60
+ 'align' => 'right',
61
+ 'index' => 'fields',
62
+ 'type' => 'number',
63
+ 'sortable' => false,
64
+ 'renderer' => 'VladimirPopov_WebForms_Block_Adminhtml_Webforms_Renderer_Fields',
65
+ 'filter' => false
66
+ ));
67
+
68
+ $this->addColumn('results',array(
69
+ 'header' => Mage::helper('webforms')->__('Results'),
70
+ 'align' => 'right',
71
+ 'index' => 'results',
72
+ 'type' => 'number',
73
+ 'renderer' => 'VladimirPopov_WebForms_Block_Adminhtml_Webforms_Renderer_Results',
74
+ 'sortable' => false,
75
+ 'filter' => false
76
+ ));
77
+
78
+ $this->addColumn('is_active', array(
79
+ 'header' => Mage::helper('webforms')->__('Status'),
80
+ 'index' => 'is_active',
81
+ 'type' => 'options',
82
+ 'options' => Mage::getModel('webforms/webforms')->getAvailableStatuses(),
83
+ ));
84
+
85
+ $this->addColumn('created_time', array(
86
+ 'header' => Mage::helper('webforms')->__('Date Created'),
87
+ 'index' => 'created_time',
88
+ 'type' => 'datetime',
89
+ ));
90
+
91
+ $this->addColumn('update_time', array(
92
+ 'header' => Mage::helper('webforms')->__('Last Modified'),
93
+ 'index' => 'update_time',
94
+ 'type' => 'datetime',
95
+ ));
96
+
97
+ $this->addColumn('last_result_time', array(
98
+ 'header' => Mage::helper('webforms')->__('Last Result'),
99
+ 'index' => 'last_result_time',
100
+ 'filter' => false,
101
+ 'sortable' => false,
102
+ 'type' => 'datetime',
103
+ ));
104
+
105
+ $this->addColumn('action',
106
+ array(
107
+ 'header' => Mage::helper('webforms')->__('Action'),
108
+ 'width' => '100',
109
+ 'filter' => false,
110
+ 'sortable' => false,
111
+ 'renderer' => 'VladimirPopov_WebForms_Block_Adminhtml_Webforms_Renderer_Action',
112
+ 'is_system' => true,
113
+ ));
114
+
115
+
116
+ return parent::_prepareColumns();
117
+ }
118
+
119
+ protected function _filterStoreCondition($collection, $column)
120
+ {
121
+ if (!$value = $column->getFilter()->getValue()) {
122
+ return;
123
+ }
124
+
125
+ $this->getCollection()->addStoreFilter($value);
126
+ }
127
+
128
+ public function getRowUrl($row){
129
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
130
+ }
131
+
132
+ protected function _prepareMassaction()
133
+ {
134
+ $this->setMassactionIdField('id');
135
+ $this->getMassactionBlock()->setFormFieldName('id');
136
+
137
+ $this->getMassactionBlock()->addItem('delete', array(
138
+ 'label'=> Mage::helper('webforms')->__('Delete'),
139
+ 'url' => $this->getUrl('*/*/massDelete'),
140
+ 'confirm' => Mage::helper('webforms')->__('Are you sure to delete selected elements?')
141
+ ));
142
+
143
+ $statuses = Mage::getModel("webforms/webforms")->getAvailableStatuses();
144
+
145
+ $this->getMassactionBlock()->addItem('status', array(
146
+ 'label'=> Mage::helper('catalog')->__('Change status'),
147
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
148
+ 'additional' => array(
149
+ 'visibility' => array(
150
+ 'name' => 'status',
151
+ 'type' => 'select',
152
+ 'class' => 'required-entry',
153
+ 'label' => Mage::helper('webforms')->__('Status'),
154
+ 'values' => $statuses
155
+ )
156
+ )
157
+ ));
158
+
159
+ return $this;
160
+ }
161
+ }
162
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Renderer/Action.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Webforms_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
13
+ {
14
+ public function render(Varien_Object $row)
15
+ {
16
+ $urlModel = Mage::getModel('core/url');
17
+ $href = $urlModel->getUrl('webforms', array('_current'=>false,'id'=>$row->getId()));
18
+ return '<a href="'.$href.'" target="_blank">'.$this->__('Preview').'</a>';
19
+ }
20
+ }
21
+
22
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Renderer/Fields.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Webforms_Renderer_Fields extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
13
+ {
14
+
15
+ public function render(Varien_Object $row)
16
+ {
17
+ $value = $row->getData($this->getColumn()->getIndex());
18
+ return $value.' [ <a href="#" style="text-decoration:none" onclick="setLocation(\''.$this->getAddFieldUrl($row).'\')">+</a> ]';
19
+
20
+ }
21
+
22
+ public function getAddFieldUrl(Varien_Object $row)
23
+ {
24
+ return $this->getUrl('*/adminhtml_fields/edit',array('webform_id'=>$row->getId()));
25
+ }
26
+
27
+ }
28
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Webforms/Renderer/Results.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Adminhtml_Webforms_Renderer_Results extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
13
+ {
14
+
15
+ public function render(Varien_Object $row)
16
+ {
17
+ $value = $row->getData($this->getColumn()->getIndex());
18
+ return $value.' [ <a href="#" style="text-decoration:none" onclick="setLocation(\''.$this->getAddFieldUrl($row).'\')">'.Mage::helper('webforms')->__('View').'</a> ]';
19
+
20
+ }
21
+
22
+ public function getAddFieldUrl(Varien_Object $row)
23
+ {
24
+ return $this->getUrl('*/adminhtml_results',array('webform_id'=>$row->getId()));
25
+ }
26
+
27
+ }
28
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Webforms.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Webforms extends VladimirPopov_WebForms_Block_Widget
13
+ {
14
+ public function getData(){
15
+ $data = $this->getRequest()->getParams();
16
+ $data['webform_id'] = $data['id'];
17
+ return $data;
18
+ }
19
+
20
+ public function _prepareLayout(){
21
+ parent::_prepareLayout();
22
+ $this->getLayout()->getBlock('head')->setTitle(Mage::registry('webform')->getName());
23
+ Mage::register('show_form_name',true);
24
+ }
25
+
26
+ }
27
+ ?>
app/code/community/VladimirPopov/WebForms/Block/Widget.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Block_Widget
13
+ extends Mage_Core_Block_Template
14
+ implements Mage_Widget_Block_Interface
15
+ {
16
+ protected function _prepareLayout()
17
+ {
18
+ $data = $this->getData();
19
+ //get form data
20
+ $webform = Mage::getModel('webforms/webforms')->load($data['webform_id']);
21
+ Mage::register('webform',$webform);
22
+
23
+ if($webform->getSurvey()){
24
+ $collection = Mage::getModel('webforms/results')->getCollection();
25
+
26
+ if(Mage::helper('customer')->isLoggedIn())
27
+ $collection->addFilter('webform_id',$data['webform_id'])->addFilter('customer_id',Mage::getSingleton('customer/session')->getCustomerId());
28
+ else{
29
+ $session_validator = Mage::getSingleton('customer/session')->getData('_session_validator_data');
30
+ $collection->addFilter('customer_ip',ip2long($session_validator['remote_addr']));
31
+ }
32
+ $count = $collection->count();
33
+ if($count>0){
34
+ $show_success = true;
35
+ }
36
+ }
37
+
38
+ if(Mage::getSingleton('core/session')->getWebformsSuccess() == $data['webform_id'] || $show_success){
39
+ Mage::register('show_success',true);
40
+ Mage::getSingleton('core/session')->setWebformsSuccess();
41
+ }
42
+
43
+ if($webform->getRegisteredOnly() && !Mage::helper('customer')->isLoggedIn()){
44
+ Mage::getSingleton('customer/session')->setBeforeAuthUrl($this->getRequest()->getRequestUri());
45
+ Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::helper('customer')->getLoginUrl(),301);
46
+ }
47
+
48
+ Mage::register('fields_to_fieldsets',$webform->getFieldsToFieldsets());
49
+
50
+ //use captcha
51
+ if(!Mage::helper('customer')->isLoggedIn()){
52
+ $pubKey = Mage::getStoreConfig('webforms/captcha/public_key');
53
+ $privKey = Mage::getStoreConfig('webforms/captcha/private_key');
54
+ if($pubKey && $privKey)
55
+ Mage::register('use_captcha',true);
56
+ }
57
+
58
+ //proccess the result
59
+ if($this->getRequest()->getParam('submitWebform_'.$data['webform_id'])){
60
+ //validate captcha
61
+ if(Mage::registry('use_captcha')){
62
+ if($this->getRequest()->getParam('recaptcha_response_field')) {
63
+ $verify = $this->getCaptcha()->verify($this->getRequest()->getParam('recaptcha_challenge_field'),$this->getRequest()->getParam('recaptcha_response_field'));
64
+ if($verify->isValid()){
65
+ $success = $this->saveResult();
66
+ } else {
67
+ Mage::getSingleton('core/session')->addError($this->__('Verification code was not correct. Please try again.'));
68
+ }
69
+ } else {
70
+ Mage::getSingleton('core/session')->addError($this->__('Verification code was not correct. Please try again.'));
71
+ }
72
+ } else {
73
+ $success = $this->saveResult();
74
+ }
75
+ if($success){
76
+ Mage::getSingleton('core/session')->setWebformsSuccess($data['webform_id']);
77
+ }
78
+ Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::helper('core/url')->getCurrentUrl());
79
+ }
80
+ parent::_prepareLayout();
81
+
82
+ }
83
+
84
+ public function getCaptcha(){
85
+ $pubKey = Mage::getStoreConfig('webforms/captcha/public_key');
86
+ $privKey = Mage::getStoreConfig('webforms/captcha/private_key');
87
+ if($pubKey && $privKey)
88
+ $recaptcha = new Zend_Service_ReCaptcha($pubKey, $privKey);
89
+ return $recaptcha;
90
+ }
91
+
92
+ public function saveResult(){
93
+ if(!Mage::registry('webform')) return false;
94
+ try{
95
+ $postData = $this->getRequest()->getPost();
96
+ $resultsModel = Mage::getModel('webforms/results');
97
+
98
+ $session_validator = Mage::getSingleton('customer/session')->getData('_session_validator_data');
99
+ $resultsModel->setData($postData)
100
+ ->setWebformId(Mage::registry('webform')->getId())
101
+ ->setStoreId(Mage::app()->getStore()->getId())
102
+ ->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
103
+ ->setCustomerIp(ip2long($session_validator['remote_addr']))
104
+ ->save();
105
+ $emailSettings = Mage::registry('webform')->getEmailSettings();
106
+
107
+ if($emailSettings['email_enable']){
108
+
109
+ $result = Mage::getModel('webforms/results')->load($resultsModel->getId());
110
+ $result->sendEmail();
111
+ if(Mage::registry('webform')->getDuplicateEmail()){
112
+ $result->sendEmail('customer');
113
+ }
114
+ }
115
+ return true;
116
+ } catch (Exception $e){
117
+ Mage::getSingleton('core/session')->addError($e->getMessage());
118
+ return false;
119
+ }
120
+ }
121
+
122
+ }
123
+
124
+ ?>
app/code/community/VladimirPopov/WebForms/Helper/Data.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Helper_Data extends Mage_Core_Helper_Abstract{
13
+
14
+ }
15
+ ?>
app/code/community/VladimirPopov/WebForms/Model/Fields.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Model_Fields extends Mage_Core_Model_Abstract{
13
+
14
+ public function _construct()
15
+ {
16
+ parent::_construct();
17
+ $this->_init('webforms/fields');
18
+ }
19
+
20
+ public function getFieldTypes()
21
+ {
22
+ $types = new Varien_Object(array(
23
+ "text" => Mage::helper('webforms')->__('Text'),
24
+ "email" => Mage::helper('webforms')->__('Text / E-mail'),
25
+ "number" => Mage::helper('webforms')->__('Text / Number'),
26
+ "textarea" => Mage::helper('webforms')->__('Textarea'),
27
+ "select" => Mage::helper('webforms')->__('Select'),
28
+ "select/radio" => Mage::helper('webforms')->__('Select / Radio'),
29
+ "select/checkbox" => Mage::helper('webforms')->__('Select / Checkbox'),
30
+
31
+ ));
32
+
33
+ Mage::dispatchEvent('webforms_get_available_statuses', array('types' => $types));
34
+
35
+ return $types->getData();
36
+
37
+ }
38
+
39
+ public function getSizeTypes(){
40
+ $types = new Varien_Object(array(
41
+ "standard" => Mage::helper('webforms')->__('Standard'),
42
+ "wide" => Mage::helper('webforms')->__('Wide'),
43
+ ));
44
+
45
+ Mage::dispatchEvent('webforms_get_available_statuses', array('types' => $types));
46
+
47
+ return $types->getData();
48
+
49
+ }
50
+
51
+ public function toHtml()
52
+ {
53
+ $html="";
54
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
55
+ $filter = new Varien_Filter_Template_Simple();
56
+ $filter->setData('firstname',$customer->getFirstname());
57
+ $filter->setData('lastname',$customer->getLastname());
58
+ $filter->setData('email',$customer->getEmail());
59
+
60
+ $field_id="field[".$this->getId()."]";
61
+ $field_name = $field_id;
62
+ $field_value = $filter->filter($this->getValue());
63
+ $field_type = $this->getType();
64
+ $field_class="input-text";
65
+ if($this->getRequired())
66
+ $field_class.=" required-entry";
67
+ if($field_type == "email")
68
+ $field_class.= " validate-email";
69
+ if($field_type == "number")
70
+ $field_class.= " validate-number";
71
+ if($this->getCssClass()){
72
+ $field_class.=' '.$this->getCssClass();
73
+ }
74
+ if($this->getCssStyle()){
75
+ $field_style = $this->getCssStyle();
76
+ }
77
+ switch($field_type){
78
+ case 'textarea':
79
+ $html = "<textarea name='$field_name' id='$field_id' class='$field_class' style='$field_style'>$field_value</textarea>";
80
+ break;
81
+ case 'select':
82
+ $options = explode("\n",$field_value);
83
+ $html = "<select name='$field_name' id='$field_id' class='$field_class' style='$field_style'>";
84
+ foreach($options as $option){
85
+ if(trim($option))
86
+ $html.= "<option value='$option'>$option</option>";
87
+ }
88
+ $html.="</select>";
89
+ break;
90
+ case 'select/radio':
91
+ $options = explode("\n",$field_value);
92
+ $html= "<ul style='padding:10px'>";
93
+ $field_class= $this->getCssClass();
94
+ foreach($options as $i=>$option){
95
+ if($this->getRequired() && $i==(count($options)-1)){
96
+ $validate = "validate-one-required-by-name";
97
+ }
98
+ if(trim($option))
99
+ $html.= "<li class='control'><input style='float:left' type='radio' name='".$field_name."[]' id='$field_id.$i' value='$option' class='radio $validate'/><label for='$field_id.$i' class='$field_class' style='$field_style'>$option</label></li>";
100
+ }
101
+ $html.="</ul>";
102
+ break;
103
+ case 'select/checkbox':
104
+ $options = explode("\n",$field_value);
105
+ $html= "<ul style='padding:10px'>";
106
+ $field_class= $this->getCssClass();
107
+ foreach($options as $i=>$option){
108
+ if($this->getRequired() && $i==(count($options)-1)){
109
+ $validate = "validate-one-required-by-name";
110
+ }
111
+
112
+ if(trim($option))
113
+ $html.= "<li class='control'><input style='float:left' type='checkbox' name='".$field_name."[]' id='$field_id.$i' value='$option' class='checkbox $validate'/><label for='$field_id.$i' class='$field_class' style='$field_style'>&nbsp;$option</label></li>";
114
+ }
115
+ $html.="</ul>";
116
+ break;
117
+ default:
118
+ $html ="<input type='text' name='$field_name' id='$field_id' class='$field_class' style='$field_style' value='$field_value'/>";
119
+ break;
120
+ }
121
+ return $html;
122
+ }
123
+
124
+ }
125
+ ?>
app/code/community/VladimirPopov/WebForms/Model/Fieldsets.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Model_Fieldsets extends Mage_Core_Model_Abstract{
13
+
14
+ public function _construct()
15
+ {
16
+ parent::_construct();
17
+ $this->_init('webforms/fieldsets');
18
+ }
19
+
20
+ }
21
+ ?>
app/code/community/VladimirPopov/WebForms/Model/Mysql4/Fields.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Model_Mysql4_Fields
13
+ extends Mage_Core_Model_Mysql4_Abstract
14
+ {
15
+
16
+ public function _construct(){
17
+ $this->_init('webforms/fields','id');
18
+ }
19
+
20
+ public function _afterDelete(Mage_Core_Model_Abstract $object){
21
+ //delete values
22
+ $values = $this->_getReadAdapter()->delete($this->getTable('webforms/results_values'),'field_id ='. $object->getId());
23
+ return parent::_afterDelete($object);
24
+ }
25
+ }
26
+ ?>
app/code/community/VladimirPopov/WebForms/Model/Mysql4/Fields/Collection.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Model_Mysql4_Fields_Collection
13
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
14
+ {
15
+
16
+ public function _construct(){
17
+ parent::_construct();
18
+ $this->_init('webforms/fields');
19
+ }
20
+
21
+ }
22
+ ?>
app/code/community/VladimirPopov/WebForms/Model/Mysql4/Fieldsets.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Model_Mysql4_Fieldsets
13
+ extends Mage_Core_Model_Mysql4_Abstract
14
+ {
15
+ public function _construct(){
16
+ $this->_init('webforms/fieldsets','id');
17
+ }
18
+
19
+ public function _afterDelete(Mage_Core_Model_Abstract $object){
20
+ //set fields fieldset_id to null
21
+ $fields = Mage::getModel('webforms/fields')->getCollection()->addFilter('fieldset_id',$object->getId());
22
+ foreach($fields as $field){
23
+ $field->setFieldsetId(0)->save();
24
+ }
25
+ return parent::_afterDelete($object);
26
+ }
27
+ }
28
+ ?>
app/code/community/VladimirPopov/WebForms/Model/Mysql4/Fieldsets/Collection.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Model_Mysql4_Fieldsets_Collection
13
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
14
+ {
15
+
16
+ public function _construct(){
17
+ parent::_construct();
18
+ $this->_init('webforms/fieldsets');
19
+ }
20
+
21
+ }
22
+ ?>
app/code/community/VladimirPopov/WebForms/Model/Mysql4/Results.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Model_Mysql4_Results
13
+ extends Mage_Core_Model_Mysql4_Abstract
14
+ {
15
+ public function _construct(){
16
+ $this->_init('webforms/results','id');
17
+ }
18
+
19
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
20
+ {
21
+
22
+ if (! $object->getId() && $object->getCreatedTime() == "") {
23
+ $object->setCreatedTime(Mage::getSingleton('core/date')->gmtDate());
24
+ }
25
+
26
+ $object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate());
27
+
28
+ return $this;
29
+ }
30
+
31
+ public function _afterSave(Mage_Core_Model_Abstract $object){
32
+ $condition = $this->_getWriteAdapter()->quoteInto('result_id = ?', $object->getId());
33
+ $this->_getWriteAdapter()->delete($this->getTable('webforms/results_values'), $condition);
34
+
35
+ //insert field values
36
+ foreach($object->getData('field') as $field_id=>$value){
37
+ if(is_array($value)){
38
+ $value = implode("",$value);
39
+ }
40
+ $this->_getWriteAdapter()->insert($this->getTable('webforms/results_values'),array(
41
+ "result_id" => $object->getId(),
42
+ "field_id" => $field_id,
43
+ "value" => $value,
44
+ ));
45
+ }
46
+
47
+ //fix customer data, its not updated with set method
48
+ $this->_getWriteAdapter()->update($this->getTable('webforms/results'), array(
49
+ "customer_id" => $object->getData('customer_id'),
50
+ "customer_ip" => $object->getData('customer_ip')
51
+ ), "id = ".$object->getId());
52
+
53
+ return parent::_afterSave($object);
54
+ }
55
+
56
+ public function _afterLoad(Mage_Core_Model_Abstract $object){
57
+ $webform = Mage::getModel('webforms/webforms')->load($object->getData('webform_id'));
58
+ $fields_to_fieldsets = $webform->getFieldsToFieldsets();
59
+
60
+ $select = $this->_getReadAdapter()->select()
61
+ ->from($this->getTable('webforms/results_values'))
62
+ ->where('result_id = ?', $object->getId());
63
+ $values = $this->_getReadAdapter()->fetchAll($select);
64
+
65
+ foreach($values as $val){
66
+ $object->setData('field_'.$val['field_id'],$val['value']);
67
+ }
68
+
69
+ $object->setData('ip',long2ip($object->getCustomerIp()));
70
+ if($object->getCustomerId()){
71
+ $object->setData('customer',Mage::getModel('customer/customer')->load($object->getCustomerId())->getName());
72
+ } else {
73
+ $object->setData('customer',Mage::helper('webforms')->__('Guest'));
74
+ }
75
+ return parent::_afterLoad($object);
76
+ }
77
+
78
+ public function _afterDelete(Mage_Core_Model_Abstract $object){
79
+ //delete values
80
+ $values = $this->_getReadAdapter()->delete($this->getTable('webforms/results_values'),
81
+ 'result_id = '. $object->getId()
82
+ );
83
+
84
+ return parent::_afterDelete($object);
85
+ }
86
+ }
87
+ ?>
app/code/community/VladimirPopov/WebForms/Model/Mysql4/Results/Collection.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Model_Mysql4_Results_Collection
13
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
14
+ {
15
+
16
+ public function _construct(){
17
+ parent::_construct();
18
+ $this->_init('webforms/results');
19
+ }
20
+
21
+ protected function _afterLoad()
22
+ {
23
+ parent::_afterLoad();
24
+ foreach ($this as $item) {
25
+ $query = $this->getConnection()->select()
26
+ ->from($this->getTable('webforms/results_values'))
27
+ ->where($this->getTable('webforms/results_values').'.result_id = '.$item->getId())
28
+ ;
29
+ $results = $this->getConnection()->fetchAll($query);
30
+ foreach($results as $result){
31
+ $item->setData('field_'.$result['field_id'],$result['value']);
32
+ }
33
+
34
+ $item->setData('ip',long2ip($item->getCustomerIp()));
35
+
36
+ if($item->getCustomerId()){
37
+ $item->setData('customer',Mage::getModel('customer/customer')->load($item->getCustomerId())->getName());
38
+ } else {
39
+ $item->setData('customer',Mage::helper('webforms')->__('Guest'));
40
+ }
41
+ }
42
+ return $this;
43
+ }
44
+ }
45
+ ?>
app/code/community/VladimirPopov/WebForms/Model/Mysql4/Webforms.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Model_Mysql4_Webforms
13
+ extends Mage_Core_Model_Mysql4_Abstract
14
+ {
15
+ public function _construct(){
16
+ $this->_init('webforms/webforms','id');
17
+ }
18
+
19
+ protected function _afterDelete(Mage_Core_Model_Abstract $object){
20
+ //delete fields
21
+ $fields = Mage::getModel('webforms/fields')->getCollection()->addFilter('webform_id',$object->getId());
22
+ foreach($fields as $field){
23
+ $field->delete();
24
+ }
25
+ //delete fieldsets
26
+ $fieldsets = Mage::getModel('webforms/fieldsets')->getCollection()->addFilter('webform_id',$object->getId());
27
+ foreach($fieldsets as $fieldset){
28
+ $fieldset->delete();
29
+ }
30
+ return parent::_afterDelete($object);
31
+ }
32
+
33
+ }
34
+ ?>
app/code/community/VladimirPopov/WebForms/Model/Mysql4/Webforms/Collection.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Model_Mysql4_Webforms_Collection
13
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
14
+ {
15
+
16
+ public function _construct(){
17
+ parent::_construct();
18
+ $this->_init('webforms/webforms');
19
+ }
20
+
21
+ protected function _afterLoad()
22
+ {
23
+ parent::_afterLoad();
24
+ foreach ($this as $item) {
25
+ $fields = Mage::getModel('webforms/fields')->getCollection()->addFilter('webform_id',$item->getId())->count();
26
+ $item->setData('fields',$fields);
27
+
28
+ $results = Mage::getModel('webforms/results')->getCollection()->addFilter('webform_id',$item->getId())->count();
29
+ $item->setData('results',$results);
30
+
31
+ // get last result time
32
+ $last_result = Mage::getModel('webforms/results')->getCollection()->addFilter('webform_id',$item->getId())->addOrder('created_time','desc')->setPageSize(1);
33
+ $item->setData('last_result_time',$last_result->getFirstItem()->getData('created_time'));
34
+ }
35
+ return $this;
36
+ }
37
+
38
+
39
+ }
40
+ ?>
app/code/community/VladimirPopov/WebForms/Model/Results.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Model_Results extends Mage_Core_Model_Abstract{
13
+
14
+ public function _construct(){
15
+ parent::_construct();
16
+ $this->_init('webforms/results');
17
+ }
18
+
19
+ public function sendEmail($recipient='admin'){
20
+ $webform = Mage::getModel('webforms/webforms')->load($this->getWebformId());
21
+ if(!Mage::registry('webform'))
22
+ Mage::register('webform',$webform);
23
+
24
+ $emailSettings = $webform->getEmailSettings();
25
+
26
+ // for admin
27
+ $sender = Array(
28
+ 'name' => $this->getCustomer(),
29
+ 'email' => $this->getReplyTo($recipient),
30
+ );
31
+ // for customer
32
+ if($recipient == 'customer'){
33
+ $sender['name'] = Mage::app()->getStore($this->getStoreId())->getFrontendName();
34
+ }
35
+
36
+ $subject = $this->getEmailSubject($recipient);
37
+
38
+ $email = $emailSettings['email'];
39
+
40
+ //for customer
41
+ if($recipient == 'customer'){
42
+ $email = $this->getCustomerEmail();
43
+ }
44
+
45
+ $name = '';
46
+
47
+ $vars = Array(
48
+ 'webform_name'=>$webform->getName(),
49
+ 'webform_result' =>$this->toHtml($recipient),
50
+ );
51
+
52
+ if($recipient == 'customer'){
53
+ $vars['noreply'] = Mage::helper('webforms')->__('Please, don`t reply to this e-mail!');
54
+ }
55
+
56
+ $storeId = Mage::app()->getStore($this->getStoreId())->getId();
57
+ $templateId = 'webforms_results';
58
+ $success = Mage::getModel('core/email_template')
59
+ ->setTemplateSubject($subject)
60
+ ->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
61
+ return $success;
62
+ }
63
+
64
+ public function getEmailSubject($recipient='admin'){
65
+ $webform_name = Mage::registry('webform')->getName();
66
+ $store_name = Mage::app()->getStore($this->getStoreId())->getFrontendName();
67
+
68
+ //get subject for customer
69
+ if($recipient == 'customer'){
70
+ return Mage::helper('webforms')->__("You have submitted '%s' form on %s website",$webform_name,$store_name);
71
+ }
72
+
73
+ //get default subject for admin
74
+ $subject = Mage::helper('webforms')->__("Web-form '%s' submitted",$webform_name);
75
+
76
+ //iterate through fields and build subject
77
+ $subject_array = array();
78
+ $fields = Mage::getModel('webforms/fields')->getCollection()->addFilter('webform_id',$this->getWebformId())->addFilter('email_subject',1);
79
+ foreach($fields as $field){
80
+ foreach($this->getData() as $key=>$value){
81
+ if($key == 'field_'.$field->getId() && $value){
82
+ $subject_array[]= $value;
83
+ }
84
+ }
85
+ }
86
+ if(count($subject_array)>0){
87
+ $subject = implode(" / ",$subject_array);
88
+ }
89
+ return $subject;
90
+ }
91
+
92
+ public function getReplyTo($recipient='admin'){
93
+ $fields = Mage::getModel('webforms/fields')->getCollection()->addFilter('webform_id',$this->getWebformId())->addFilter('type','email');
94
+
95
+ foreach($this->getData() as $key=>$value){
96
+ if($key == 'field_'.$fields->getFirstItem()->getId()) {
97
+ $reply_to = $value;
98
+ }
99
+ }
100
+ if(!$reply_to){
101
+ if(Mage::helper('customer')->isLoggedIn()){
102
+ $reply_to = Mage::getSingleton('customer/session')->getCustomer()->getEmail();
103
+ }
104
+ else{
105
+ $reply_to = Mage::getStoreConfig('trans_email/ident_general/email');
106
+ }
107
+ }
108
+ if($recipient == 'customer'){
109
+ if(Mage::getStoreConfig('webforms/email/email_reply_to'))
110
+ $reply_to = Mage::getStoreConfig('webforms/email/email_reply_to');
111
+ else
112
+ $reply_to = Mage::getStoreConfig('trans_email/ident_general/email');
113
+ }
114
+ return $reply_to;
115
+ }
116
+
117
+ public function getCustomerEmail(){
118
+ $fields = Mage::getModel('webforms/fields')->getCollection()->addFilter('webform_id',$this->getWebformId())->addFilter('type','email');
119
+
120
+ foreach($this->getData() as $key=>$value){
121
+ if($key == 'field_'.$fields->getFirstItem()->getId()) {
122
+ $customer_email = $value;
123
+ }
124
+ }
125
+ if(!$customer_email){
126
+ if(Mage::helper('customer')->isLoggedIn()){
127
+ $customer_email = Mage::getSingleton('customer/session')->getCustomer()->getEmail();
128
+ }
129
+ }
130
+ return $customer_email;
131
+ }
132
+
133
+ public function toHtml($recipient = 'admin'){
134
+ $store_group = Mage::app()->getStore($this->getStoreId())->getFrontendName();
135
+ $store_name = Mage::app()->getStore($this->getStoreId())->getName();
136
+
137
+ $html = "";
138
+ if($recipient == 'admin'){
139
+ if($store_group)
140
+ $html .= Mage::helper('webforms')->__('Store group').": ".$store_group."<br />";
141
+ if($store_name)
142
+ $html .= Mage::helper('webforms')->__('Store name').": ".$store_name."<br />";
143
+ $html .= Mage::helper('webforms')->__('Customer').": ".$this->getCustomer()."<br />";
144
+ $html .= Mage::helper('webforms')->__('IP').": ".$this->getIp()."<br />";
145
+ }
146
+ $format = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
147
+ $html .= Mage::helper('webforms')->__('Date').": ". Mage::app()->getLocale()->date($this->getCreatedTime())->toString($format)."<br />";
148
+ $html .= "<br />";
149
+
150
+ $fields_to_fieldsets = Mage::getModel('webforms/webforms')->load($this->getWebformId())->getFieldsToFieldsets();
151
+
152
+ foreach($fields_to_fieldsets as $fieldset){
153
+ if($fieldset['name'])
154
+ $html.= '<h2>'.$fieldset['name'].'</h2>';
155
+ foreach($fieldset['fields'] as $field){
156
+ $html.= '<b>'.$field->getName().'</b><br/>';
157
+ $value= $this->getData('field_'.$field->getId());
158
+ $value = nl2br(htmlentities($value));
159
+ $html.=$value."<br /><br />";
160
+ }
161
+ }
162
+ return $html;
163
+
164
+ }
165
+ }
166
+ ?>
app/code/community/VladimirPopov/WebForms/Model/Webforms.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Model_Webforms extends Mage_Core_Model_Abstract{
13
+
14
+ const STATUS_ENABLED = 1;
15
+ const STATUS_DISABLED = 0;
16
+
17
+ public function _construct(){
18
+ parent::_construct();
19
+ $this->_init('webforms/webforms');
20
+ }
21
+
22
+ public function getAvailableStatuses(){
23
+ $statuses = new Varien_Object(array(
24
+ self::STATUS_ENABLED => Mage::helper('webforms')->__('Enabled'),
25
+ self::STATUS_DISABLED => Mage::helper('webforms')->__('Disabled'),
26
+ ));
27
+
28
+ Mage::dispatchEvent('webforms_get_available_statuses', array('statuses' => $statuses));
29
+
30
+ return $statuses->getData();
31
+
32
+ }
33
+
34
+ /**
35
+ * Provide available options as a value/label array
36
+ *
37
+ * @return array
38
+ */
39
+ public function toOptionArray(){
40
+ $collection = $this->getCollection()->addFilter('is_active',self::STATUS_ENABLED)->addOrder('name','asc');
41
+ $option_array = array();
42
+ foreach($collection as $webform)
43
+ $option_array[]= array('value'=>$webform->getId(), 'label' => $webform->getName());
44
+ return $option_array;
45
+ }
46
+
47
+ public function getFieldsetsOptionsArray(){
48
+ $collection = Mage::getModel('webforms/fieldsets')->getCollection()->addFilter('webform_id',$this->getId())->addOrder('position','asc');
49
+ $options = array(0 =>'...');
50
+ foreach($collection as $o){
51
+ $options[$o->getId()]= $o->getName();
52
+ }
53
+ return $options;
54
+ }
55
+
56
+ public function getEmailSettings(){
57
+ $settings["email_enable"] = $this->getSendEmail();
58
+ $settings["email"] = Mage::getStoreConfig('webforms/email/email');
59
+ if($this->getEmail())
60
+ $settings["email"] = $this->getEmail();
61
+ return $settings;
62
+ }
63
+
64
+ public function getFieldsToFieldsets(){
65
+ //get form fieldsets
66
+ $fieldsets = Mage::getModel('webforms/fieldsets')->getCollection()
67
+ ->addFilter('webform_id',$this->getId())
68
+ ->addFilter('is_active', self::STATUS_ENABLED)
69
+ ->addOrder('position','asc');
70
+
71
+ //get form fields
72
+ $fields = Mage::getModel('webforms/fields')->getCollection()
73
+ ->addFilter('webform_id',$this->getId())
74
+ ->addFilter('is_active', self::STATUS_ENABLED)
75
+ ->addOrder('position','asc');
76
+
77
+ //fields to fieldsets
78
+ //make zero fieldset
79
+ $fields_to_fieldsets = array();
80
+ foreach($fields as $field){
81
+ if($field->getFieldsetId() == 0){
82
+ $fields_to_fieldsets[0]['fields'][] = $field;
83
+ }
84
+ }
85
+
86
+ foreach($fieldsets as $fieldset){
87
+ $fields_to_fieldsets[$fieldset->getId()]['name'] = $fieldset->getName();
88
+ foreach($fields as $field){
89
+ if($field->getFieldsetId() == $fieldset->getId())
90
+ $fields_to_fieldsets[$fieldset->getId()]['fields'][] = $field;
91
+ }
92
+ }
93
+
94
+ return $fields_to_fieldsets;
95
+
96
+ }
97
+ }
98
+ ?>
app/code/community/VladimirPopov/WebForms/controllers/Adminhtml/FieldsController.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Adminhtml_FieldsController
13
+ extends Mage_Adminhtml_Controller_action
14
+ {
15
+ protected function _initAction()
16
+ {
17
+ $this->loadLayout()
18
+ ->_setActiveMenu('webforms/webforms');
19
+ return $this;
20
+ }
21
+
22
+ public function indexAction(){
23
+ $this->_initAction();
24
+ $this->renderLayout();
25
+ }
26
+
27
+ public function gridAction()
28
+ {
29
+ $this->getResponse()->setBody(
30
+ $this->getLayout()->createBlock('webforms/adminhtml_webforms_edit_tab_fields')->toHtml()
31
+ );
32
+ }
33
+
34
+ public function editAction(){
35
+ $this->_title($this->__('Web-forms'))->_title($this->__('Edit Field'));
36
+ $fieldsId = $this->getRequest()->getParam('id');
37
+ $webformsId = $this->getRequest()->getParam('webform_id');
38
+ $fieldsModel = Mage::getModel('webforms/fields')->load($fieldsId);
39
+ if($fieldsModel->getWebformId()){
40
+ $webformsId = $fieldsModel->getWebformId();
41
+ }
42
+ $webformsModel = Mage::getModel('webforms/webforms')->load($webformsId);
43
+
44
+ if($fieldsModel->getId() || $fieldsId == 0){
45
+ Mage::register('webforms_data',$webformsModel);
46
+ Mage::register('fields_data',$fieldsModel);
47
+
48
+ $this->loadLayout();
49
+ $this->_setActiveMenu('webforms/webforms');
50
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('WebForms'),Mage::helper('adminhtml')->__('Web-forms'));
51
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
52
+
53
+ $this->_addContent($this->getLayout()->createBlock('webforms/adminhtml_fields_edit'))
54
+ ->_addLeft($this->getLayout()->createBlock('webforms/adminhtml_fields_edit_tabs'));
55
+
56
+ $this->renderLayout();
57
+ } else {
58
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('webforms')->__('Field does not exist'));
59
+ $this->_redirect('*/adminhtml_webforms/edit',array('id' => $webformsId));
60
+ }
61
+ }
62
+
63
+ public function newAction()
64
+ {
65
+ $this->_forward('edit');
66
+ }
67
+
68
+ public function saveAction()
69
+ {
70
+ if( $this->getRequest()->getPost()){
71
+ try{
72
+ $postData = $this->getRequest()->getPost();
73
+ $fieldsModel = Mage::getModel('webforms/fields');
74
+
75
+ $fieldsModel->setData($postData)
76
+ ->setUpdateTime(Mage::getSingleton('core/date')->gmtDate())
77
+ ->setId($this->getRequest()->getParam('id'))
78
+ ->save();
79
+
80
+ if( $this->getRequest()->getParam('id') <= 0 )
81
+ $fieldsModel->setCreatedTime(Mage::getSingleton('core/date')->gmtDate())->save();
82
+
83
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Field was successfully saved'));
84
+ Mage::getSingleton('adminhtml/session')->setWebFormsData(false);
85
+ $this->_redirect('*/adminhtml_webforms/edit',array('id' => $this->getRequest()->getParam('webform_id'),'tab' => 'form_fields'));
86
+ return;
87
+ } catch (Exception $e){
88
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
89
+ Mage::getSingleton('adminhtml/session')->setWebFormsData($this->getRequest()->getPost());
90
+ $this->_redirect('*/*/edit',array('id' => $this->getRequest()->getParam('id')));
91
+ return;
92
+ }
93
+
94
+ }
95
+ $this->_redirect('*/adminhtml_webforms/edit',array('id' => $this->getRequest()->getParam('webform_id'),'tab' => 'form_fields'));
96
+ }
97
+
98
+ public function deleteAction()
99
+ {
100
+ if( $this->getRequest()->getParam('id') > 0){
101
+ try{
102
+ $fieldsModel = Mage::getModel('webforms/fields')->load($this->getRequest()->getParam('id'));
103
+ $webform_id = $fieldsModel->getWebformId();
104
+ $fieldsModel->delete();
105
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Field was successfully deleted'));
106
+ } catch (Exception $e){
107
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
108
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
109
+ }
110
+ }
111
+ $this->_redirect('*/adminhtml_webforms/edit',array('id' => $webform_id,'tab' => 'form_fields'));
112
+ }
113
+
114
+ }
115
+ ?>
app/code/community/VladimirPopov/WebForms/controllers/Adminhtml/FieldsetsController.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Adminhtml_FieldsetsController
13
+ extends Mage_Adminhtml_Controller_action
14
+ {
15
+ protected function _initAction()
16
+ {
17
+ $this->loadLayout()
18
+ ->_setActiveMenu('webforms/webforms');
19
+ return $this;
20
+ }
21
+
22
+ public function indexAction(){
23
+ $this->_initAction();
24
+ $this->renderLayout();
25
+ }
26
+
27
+ public function gridAction()
28
+ {
29
+ $this->getResponse()->setBody(
30
+ $this->getLayout()->createBlock('webforms/adminhtml_webforms_edit_tab_fieldsets')->toHtml()
31
+ );
32
+ }
33
+
34
+ public function editAction(){
35
+ $this->_title($this->__('Web-forms'))->_title($this->__('Edit Field Set'));
36
+ $fieldsetId = $this->getRequest()->getParam('id');
37
+ $webformsId = $this->getRequest()->getParam('webform_id');
38
+ $fieldsetsModel = Mage::getModel('webforms/fieldsets')->load($fieldsetId);
39
+ if($fieldsetsModel->getWebformId()){
40
+ $webformsId = $fieldsetsModel->getWebformId();
41
+ }
42
+ $webformsModel = Mage::getModel('webforms/webforms')->load($webformsId);
43
+
44
+ if($fieldsetsModel->getId() || $fieldsetId == 0){
45
+ Mage::register('webforms_data',$webformsModel);
46
+ Mage::register('fieldsets_data',$fieldsetsModel);
47
+
48
+ $this->loadLayout();
49
+ $this->_setActiveMenu('webforms/webforms');
50
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Web-forms'),Mage::helper('adminhtml')->__('Web-forms'));
51
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
52
+
53
+ $this->_addContent($this->getLayout()->createBlock('webforms/adminhtml_fieldsets_edit'));
54
+
55
+ $this->renderLayout();
56
+ } else {
57
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('webforms')->__('Fieldset does not exist'));
58
+ $this->_redirect('*/adminhtml_webforms/edit',array('id' => $webformsId));
59
+ }
60
+ }
61
+
62
+ public function newAction()
63
+ {
64
+ $this->_forward('edit');
65
+ }
66
+
67
+ public function saveAction()
68
+ {
69
+ if( $this->getRequest()->getPost()){
70
+ try{
71
+ $postData = $this->getRequest()->getPost();
72
+ $fieldsetsModel = Mage::getModel('webforms/fieldsets');
73
+
74
+ $fieldsetsModel->setData($postData)
75
+ ->setUpdateTime(Mage::getSingleton('core/date')->gmtDate())
76
+ ->setId($this->getRequest()->getParam('id'))
77
+ ->save();
78
+
79
+ if( $this->getRequest()->getParam('id') <= 0 )
80
+ $fieldsetsModel->setCreatedTime(Mage::getSingleton('core/date')->gmtDate())->save();
81
+
82
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Fieldset was successfully saved'));
83
+ Mage::getSingleton('adminhtml/session')->setWebFormsData(false);
84
+ $this->_redirect('*/adminhtml_webforms/edit',array('id' => $this->getRequest()->getParam('webform_id'),'tab' => 'form_fieldsets'));
85
+ return;
86
+ } catch (Exception $e){
87
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
88
+ Mage::getSingleton('adminhtml/session')->setWebFormsData($this->getRequest()->getPost());
89
+ $this->_redirect('*/*/edit',array('id' => $this->getRequest()->getParam('id')));
90
+ return;
91
+ }
92
+
93
+ }
94
+ $this->_redirect('*/adminhtml_webforms/edit',array('id' => $this->getRequest()->getParam('webform_id'),'tab' => 'form_fieldsets'));
95
+ }
96
+
97
+ public function deleteAction()
98
+ {
99
+ if( $this->getRequest()->getParam('id') > 0){
100
+ try{
101
+ $fieldsetsModel = Mage::getModel('webforms/fieldsets');
102
+ $fieldsetsModel->load($this->getRequest()->getParam('id'))->delete();
103
+ $webform_id = $fieldsetsModel->getWebformId();
104
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Fieldset was successfully deleted'));
105
+ $this->_redirect('*/adminhtml_webforms/edit',array('id' => $this->getRequest()->getParam('webform_id'),'tab' => 'form_fieldsets'));
106
+ } catch (Exception $e){
107
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
108
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
109
+ }
110
+ }
111
+ $this->_redirect('*/adminhtml_webforms/edit',array('id' => $webform_id,'tab' => 'form_fieldsets'));
112
+ }
113
+
114
+ }
115
+ ?>
app/code/community/VladimirPopov/WebForms/controllers/Adminhtml/ResultsController.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Adminhtml_ResultsController
13
+ extends Mage_Adminhtml_Controller_action
14
+ {
15
+ protected function _initAction()
16
+ {
17
+ $this->loadLayout()
18
+ ->_setActiveMenu('webforms/webforms');
19
+ $this->_title($this->__('Web-forms'))->_title($this->__('Results'));
20
+ return $this;
21
+ }
22
+
23
+ public function indexAction(){
24
+ $this->_initAction();
25
+ $this->renderLayout();
26
+ }
27
+
28
+ public function gridAction()
29
+ {
30
+ $this->getResponse()->setBody(
31
+ $this->getLayout()->createBlock('webforms/adminhtml_results_grid')->toHtml()
32
+ );
33
+ }
34
+
35
+ public function deleteAction()
36
+ {
37
+ if( $this->getRequest()->getParam('id') > 0){
38
+ try{
39
+ $webformsModel = Mage::getModel('webforms/webforms');
40
+ $webformsModel->setId($this->getRequest()->getParam('id'))->delete();
41
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Result was successfully deleted'));
42
+ $this->_redirect('*/*/');
43
+ } catch (Exception $e){
44
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
45
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
46
+ }
47
+ }
48
+ $this->_redirect('*/*/');
49
+ }
50
+
51
+ /**
52
+ * Export customer grid to CSV format
53
+ */
54
+ public function exportCsvAction()
55
+ {
56
+ $fileName = 'results.csv';
57
+ $content = $this->getLayout()->createBlock('webforms/adminhtml_results_grid')
58
+ ->getCsvFile();
59
+
60
+ $this->_prepareDownloadResponse($fileName, $content);
61
+ }
62
+
63
+ /**
64
+ * Export customer grid to XML format
65
+ */
66
+ public function exportXmlAction()
67
+ {
68
+ $fileName = 'results.xml';
69
+ $content = $this->getLayout()->createBlock('webforms/adminhtml_results_grid')
70
+ ->getExcelFile();
71
+
72
+ $this->_prepareDownloadResponse($fileName, $content);
73
+ }
74
+
75
+ public function massEmailAction(){
76
+ $Ids = (array)$this->getRequest()->getParam('id');
77
+ try {
78
+ foreach($Ids as $id){
79
+ $result = Mage::getModel('webforms/results')->load($id);
80
+ $result->sendEmail();
81
+ }
82
+
83
+ $this->_getSession()->addSuccess(
84
+ $this->__('Total of %d result(s) have been emailed.', count($Ids))
85
+ );
86
+ }
87
+ catch (Mage_Core_Model_Exception $e) {
88
+ $this->_getSession()->addError($e->getMessage());
89
+ }
90
+ catch (Mage_Core_Exception $e) {
91
+ $this->_getSession()->addError($e->getMessage());
92
+ }
93
+ catch (Exception $e) {
94
+ $this->_getSession()->addException($e, $this->__('An error occurred during operation.'));
95
+ }
96
+
97
+ $this->_redirect('*/*/',array('webform_id' => $this->getRequest()->getParam('webform_id')));
98
+
99
+ }
100
+
101
+ public function massDeleteAction(){
102
+ $Ids = (array)$this->getRequest()->getParam('id');
103
+
104
+ try {
105
+ foreach($Ids as $id){
106
+ $result = Mage::getModel('webforms/results')->load($id);
107
+ $result->delete();
108
+ }
109
+
110
+ $this->_getSession()->addSuccess(
111
+ $this->__('Total of %d record(s) have been deleted.', count($Ids))
112
+ );
113
+ }
114
+ catch (Mage_Core_Model_Exception $e) {
115
+ $this->_getSession()->addError($e->getMessage());
116
+ }
117
+ catch (Mage_Core_Exception $e) {
118
+ $this->_getSession()->addError($e->getMessage());
119
+ }
120
+ catch (Exception $e) {
121
+ $this->_getSession()->addException($e, $this->__('An error occurred while updating records.'));
122
+ }
123
+
124
+ $this->_redirect('*/*/',array('webform_id' => $this->getRequest()->getParam('webform_id')));
125
+
126
+ }
127
+ }
128
+ ?>
app/code/community/VladimirPopov/WebForms/controllers/Adminhtml/WebformsController.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_Adminhtml_WebFormsController
13
+ extends Mage_Adminhtml_Controller_action
14
+ {
15
+ protected function _initAction()
16
+ {
17
+ $this->loadLayout()
18
+ ->_setActiveMenu('webforms/webforms');
19
+ $this->_title($this->__('Web-forms'))->_title($this->__('Manage Forms'));
20
+ return $this;
21
+ }
22
+
23
+ public function indexAction(){
24
+ $this->_initAction();
25
+ $this->renderLayout();
26
+ }
27
+
28
+ public function gridAction()
29
+ {
30
+ $this->getResponse()->setBody(
31
+ $this->getLayout()->createBlock('webforms/adminhtml_webforms_grid')->toHtml()
32
+ );
33
+ }
34
+
35
+ public function editAction(){
36
+ $this->_title($this->__('Web-forms'))->_title($this->__('Edit Form'));
37
+
38
+ $webformsId = $this->getRequest()->getParam('id');
39
+ $webformsModel = Mage::getModel('webforms/webforms')->load($webformsId);
40
+
41
+ if($webformsModel->getId() || $webformsId ==0 ){
42
+ Mage::register('webforms_data',$webformsModel);
43
+ $this->loadLayout();
44
+ $this->_setActiveMenu('webforms/webforms');
45
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Web-forms'),Mage::helper('adminhtml')->__('Web-forms'));
46
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
47
+ $this->_addContent($this->getLayout()->createBlock('webforms/adminhtml_webforms_edit'))
48
+ ->_addLeft($this->getLayout()->createBlock('webforms/adminhtml_webforms_edit_tabs'));
49
+ $this->renderLayout();
50
+ } else {
51
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('webforms')->__('Web-form does not exist'));
52
+ $this->_redirect('*/*/');
53
+ }
54
+ }
55
+
56
+ public function newAction()
57
+ {
58
+ $this->_forward('edit');
59
+ }
60
+
61
+ public function saveAction()
62
+ {
63
+ if( $this->getRequest()->getPost()){
64
+ try{
65
+ $postData = $this->getRequest()->getPost();
66
+ $webformsModel = Mage::getModel('webforms/webforms');
67
+
68
+ $webformsModel->setData($postData)
69
+ ->setUpdateTime(Mage::getSingleton('core/date')->gmtDate())
70
+ ->setId($this->getRequest()->getParam('id'))
71
+ ->save();
72
+
73
+ if( $this->getRequest()->getParam('id') <= 0 )
74
+ $webformsModel->setCreatedTime(Mage::getSingleton('core/date')->gmtDate())->save();
75
+
76
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Web-form was successfully saved'));
77
+ Mage::getSingleton('adminhtml/session')->setWebFormsData(false);
78
+
79
+ // check if 'Save and Continue'
80
+ if ($this->getRequest()->getParam('back')) {
81
+ $this->_redirect('*/*/edit', array('id' => $webformsModel->getId()));
82
+ return;
83
+ }
84
+
85
+ $this->_redirect('*/*/');
86
+ return;
87
+ } catch (Exception $e){
88
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
89
+ Mage::getSingleton('adminhtml/session')->setWebFormsData($this->getRequest()->getPost());
90
+ $this->_redirect('*/*/edit',array('id' => $this->getRequest()->getParam('id')));
91
+ return;
92
+ }
93
+
94
+ }
95
+ $this->_redirect('*/*/');
96
+ }
97
+
98
+ public function deleteAction()
99
+ {
100
+ if( $this->getRequest()->getParam('id') > 0){
101
+ try{
102
+ $webformsModel = Mage::getModel('webforms/webforms');
103
+ $webformsModel->setId($this->getRequest()->getParam('id'))->delete();
104
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Web-form was successfully deleted'));
105
+ $this->_redirect('*/*/');
106
+ } catch (Exception $e){
107
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
108
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
109
+ }
110
+ }
111
+ $this->_redirect('*/*/');
112
+ }
113
+
114
+
115
+ public function massStatusAction(){
116
+ $Ids = (array)$this->getRequest()->getParam('id');
117
+ $status = (int)$this->getRequest()->getParam('status');
118
+
119
+ try {
120
+ foreach($Ids as $id){
121
+ $result = Mage::getModel('webforms/webforms')->load($id);
122
+ $result->setData('is_active',$status);
123
+ $result->save();
124
+ }
125
+
126
+ $this->_getSession()->addSuccess(
127
+ $this->__('Total of %d record(s) have been updated.', count($Ids))
128
+ );
129
+ }
130
+ catch (Mage_Core_Model_Exception $e) {
131
+ $this->_getSession()->addError($e->getMessage());
132
+ }
133
+ catch (Mage_Core_Exception $e) {
134
+ $this->_getSession()->addError($e->getMessage());
135
+ }
136
+ catch (Exception $e) {
137
+ $this->_getSession()->addException($e, $this->__('An error occurred while updating records.'));
138
+ }
139
+
140
+ $this->_redirect('*/*/');
141
+
142
+
143
+ }
144
+
145
+ public function massDeleteAction(){
146
+ $Ids = (array)$this->getRequest()->getParam('id');
147
+
148
+ try {
149
+ foreach($Ids as $id){
150
+ $result = Mage::getModel('webforms/webforms')->load($id);
151
+ $result->delete();
152
+ }
153
+
154
+ $this->_getSession()->addSuccess(
155
+ $this->__('Total of %d record(s) have been deleted.', count($Ids))
156
+ );
157
+ }
158
+ catch (Mage_Core_Model_Exception $e) {
159
+ $this->_getSession()->addError($e->getMessage());
160
+ }
161
+ catch (Mage_Core_Exception $e) {
162
+ $this->_getSession()->addError($e->getMessage());
163
+ }
164
+ catch (Exception $e) {
165
+ $this->_getSession()->addException($e, $this->__('An error occurred while updating records.'));
166
+ }
167
+
168
+ $this->_redirect('*/*/');
169
+
170
+ }
171
+ }
172
+ ?>
app/code/community/VladimirPopov/WebForms/controllers/IndexController.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class VladimirPopov_WebForms_IndexController extends Mage_Core_Controller_Front_Action{
13
+
14
+ public function indexAction()
15
+ {
16
+ $this->loadLayout();
17
+ $this->renderLayout();
18
+ }
19
+
20
+ }
21
+ ?>
app/code/community/VladimirPopov/WebForms/etc/config.xml ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <VladimirPopov_WebForms>
5
+ <version>1.0.0</version>
6
+ </VladimirPopov_WebForms>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <webforms>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>VladimirPopov_WebForms</module>
14
+ <frontName>webforms</frontName>
15
+ </args>
16
+ </webforms>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <webforms>
21
+ <file>webforms.xml</file>
22
+ </webforms>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <webforms>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>VladimirPopov_WebForms</module>
32
+ <frontName>webforms</frontName>
33
+ </args>
34
+ </webforms>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <translate>
39
+ <modules>
40
+ <Mage_Adminhtml>
41
+ <files>
42
+ <default>VladimirPopov_WebForms.csv</default>
43
+ </files>
44
+ </Mage_Adminhtml>
45
+ </modules>
46
+ </translate>
47
+ <menu>
48
+ <webforms module="webforms">
49
+ <title>Web-forms</title>
50
+ <sort_order>75</sort_order>
51
+ <children>
52
+ <items module="webforms">
53
+ <title>Manage Forms</title>
54
+ <sort_order>0</sort_order>
55
+ <action>webforms/adminhtml_webforms</action>
56
+ </items>
57
+ </children>
58
+ </webforms>
59
+ </menu>
60
+ <acl>
61
+ <resources>
62
+ <all>
63
+ <title>Allow Everything</title>
64
+ </all>
65
+ <admin>
66
+ <children>
67
+ <VladimirPopov_WebForms>
68
+ <title>Web-forms Module</title>
69
+ <sort_order>10</sort_order>
70
+ </VladimirPopov_WebForms>
71
+ </children>
72
+ </admin>
73
+ <admin>
74
+ <children>
75
+ <system>
76
+ <children>
77
+ <config>
78
+ <children>
79
+ <webforms>
80
+ <title>Web-forms Section</title>
81
+ </webforms>
82
+ </children>
83
+ </config>
84
+ </children>
85
+ </system>
86
+ </children>
87
+ </admin>
88
+ </resources>
89
+ </acl>
90
+ <layout>
91
+ <updates>
92
+ <webforms>
93
+ <file>webforms.xml</file>
94
+ </webforms>
95
+ </updates>
96
+ </layout>
97
+ </adminhtml>
98
+ <global>
99
+ <models>
100
+ <webforms>
101
+ <class>VladimirPopov_WebForms_Model</class>
102
+ <resourceModel>webforms_mysql4</resourceModel>
103
+ </webforms>
104
+ <results>
105
+ <class>VladimirPopov_WebForms_Model</class>
106
+ <resourceModel>webforms_mysql4</resourceModel>
107
+ </results>
108
+ <fields>
109
+ <class>VladimirPopov_WebForms_Model</class>
110
+ <resourceModel>webforms_mysql4</resourceModel>
111
+ </fields>
112
+ <fieldsets>
113
+ <class>VladimirPopov_WebForms_Model</class>
114
+ <resourceModel>webforms_mysql4</resourceModel>
115
+ </fieldsets>
116
+ <webforms_mysql4>
117
+ <class>VladimirPopov_WebForms_Model_Mysql4</class>
118
+ <entities>
119
+ <webforms>
120
+ <table>webforms</table>
121
+ </webforms>
122
+ <fields>
123
+ <table>webforms_fields</table>
124
+ </fields>
125
+ <fieldsets>
126
+ <table>webforms_fieldsets</table>
127
+ </fieldsets>
128
+ <results>
129
+ <table>webforms_results</table>
130
+ </results>
131
+ <results_values>
132
+ <table>webforms_results_values</table>
133
+ </results_values>
134
+ </entities>
135
+ </webforms_mysql4>
136
+ </models>
137
+ <events>
138
+ <checkout_type_onepage_save_order>
139
+ <observers>
140
+ <VladimirPopov_WebForms_order_observer>
141
+ <type>model</type>
142
+ <class>VladimirPopov_WebForms_Model_Order_Observer</class>
143
+ <method>verify</method>
144
+ </VladimirPopov_WebForms_order_observer>
145
+ </observers>
146
+ </checkout_type_onepage_save_order>
147
+ </events>
148
+ <resources>
149
+ <webforms_setup>
150
+ <setup>
151
+ <module>VladimirPopov_WebForms</module>
152
+ </setup>
153
+ <connection>
154
+ <use>core_setup</use>
155
+ </connection>
156
+ </webforms_setup>
157
+ <webforms_write>
158
+ <connection>
159
+ <use>core_write</use>
160
+ </connection>
161
+ </webforms_write>
162
+ <webforms_read>
163
+ <connection>
164
+ <use>core_read</use>
165
+ </connection>
166
+ </webforms_read>
167
+ </resources>
168
+ <blocks>
169
+ <webforms>
170
+ <class>VladimirPopov_WebForms_Block</class>
171
+ </webforms>
172
+ <adminhtml>
173
+ <rewrite>
174
+ <page_menu>VladimirPopov_WebForms_Block_Adminhtml_Menu</page_menu>
175
+ </rewrite>
176
+ </adminhtml>
177
+ </blocks>
178
+ <helpers>
179
+ <webforms>
180
+ <class>VladimirPopov_WebForms_Helper</class>
181
+ </webforms>
182
+ </helpers>
183
+ <template>
184
+ <email>
185
+ <webforms_results module="webforms">
186
+ <label>Web-form new result</label>
187
+ <file>webforms_results.html</file>
188
+ <type>html</type>
189
+ </webforms_results>
190
+ </email>
191
+ </template>
192
+ </global>
193
+ <default>
194
+ <webforms>
195
+ <email>
196
+ <email_enable></email_enable>
197
+ <email></email>
198
+ </email>
199
+ </webforms>
200
+ </default>
201
+ </config>
app/code/community/VladimirPopov/WebForms/etc/system.xml ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <webforms_tab translate="label" module="webforms">
5
+ <label>Web-forms</label>
6
+ <sort_order>99999</sort_order>
7
+ </webforms_tab>
8
+ </tabs>
9
+ <sections>
10
+ <webforms translate="label">
11
+ <label>Forms Settings</label>
12
+ <tab>webforms_tab</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>307</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <email translate="label comment">
20
+ <comment></comment>
21
+ <label>E-mail settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+ <email translate="label comment">
29
+ <comment>
30
+ <![CDATA[This address will be used by default to send you new results notifications]]>
31
+ </comment>
32
+ <label>Default e-mail address</label>
33
+ <frontend_type>text</frontend_type>
34
+ <validate>validate-email</validate>
35
+ <sort_order>10</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ </email>
40
+ <email_reply_to translate="label comment">
41
+ <comment>
42
+ <![CDATA[This address will be used in reply-to field in customer notification]]>
43
+ </comment>
44
+ <label>Reply-to e-mail address for customer</label>
45
+ <frontend_type>text</frontend_type>
46
+ <validate>validate-email</validate>
47
+ <sort_order>15</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </email_reply_to>
52
+ </fields>
53
+ </email>
54
+ <captcha translate="label comment">
55
+ <comment>
56
+ <![CDATA["In order for reCaptcha to work please enter valid public and private keys. You can get those by visiting <a href='http://www.google.com/recaptcha/whyrecaptcha' target='_blank'>this page</a>"]]>
57
+ </comment>
58
+ <label>reCaptcha settings</label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>1</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ <fields>
65
+ <public_key translate="label">
66
+ <label>Public key</label>
67
+ <frontend_type>text</frontend_type>
68
+ <sort_order>1</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ </public_key>
73
+ <private_key translate="label">
74
+ <label>Private key</label>
75
+ <frontend_type>text</frontend_type>
76
+ <sort_order>1</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ </private_key>
81
+ </fields>
82
+ </captcha>
83
+ <results translate="label comment">
84
+ <comment></comment>
85
+ <label>Results settings</label>
86
+ <frontend_type>text</frontend_type>
87
+ <sort_order>20</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
+ <fields>
92
+ <fieldname_display_limit translate="label comment">
93
+ <label>Field name display length</label>
94
+ <comment>
95
+ <![CDATA[This will limit long field names in results table. It doesn`t affect export]]>
96
+ </comment>
97
+ <frontend_type>text</frontend_type>
98
+ <sort_order>1</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>1</show_in_store>
102
+ </fieldname_display_limit>
103
+ </fields>
104
+ </results>
105
+ </groups>
106
+ </webforms>
107
+ </sections>
108
+ </config>
app/code/community/VladimirPopov/WebForms/etc/widget.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <widgets>
3
+
4
+ <webforms_widget type="webforms/widget" translate="name description" module="webforms">
5
+ <name>Web-forms</name>
6
+ <description type="desc">Adds web-form to a page</description>
7
+ <parameters>
8
+ <webform_id>
9
+ <label>Web-form</label>
10
+ <visible>1</visible>
11
+ <required>1</required>
12
+ <type>select</type>
13
+ <source_model>webforms/webforms</source_model>
14
+ </webform_id>
15
+ <template translate="label">
16
+ <label>Frontend Template</label>
17
+ <visible>1</visible>
18
+ <required>1</required>
19
+ <type>select</type>
20
+ <values>
21
+ <default translate="label">
22
+ <value>webforms/default.phtml</value>
23
+ <label>Default</label>
24
+ </default>
25
+ </values>
26
+ </template>
27
+ </parameters>
28
+ </webforms_widget>
29
+
30
+ </widgets>
app/code/community/VladimirPopov/WebForms/sql/webforms_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /* @var $installer Mage_Core_Model_Resource_Setup */
13
+ $installer = $this;
14
+
15
+ $installer->startSetup();
16
+
17
+ $installer->run("
18
+ DROP TABLE IF EXISTS `{$this->getTable('webforms/webforms')}`;
19
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('webforms/webforms')}` (
20
+ `id` int(11) NOT NULL AUTO_INCREMENT,
21
+ `name` varchar(255) NOT NULL,
22
+ `description` text NOT NULL,
23
+ `success_text` text NOT NULL,
24
+ `registered_only` tinyint(1) NOT NULL,
25
+ `send_email` tinyint(1) NOT NULL,
26
+ `duplicate_email` tinyint(1) NOT NULL,
27
+ `email` varchar(255) NOT NULL,
28
+ `survey` tinyint(1) NOT NULL,
29
+ `created_time` datetime DEFAULT NULL,
30
+ `update_time` datetime DEFAULT NULL,
31
+ `is_active` tinyint(1) NOT NULL DEFAULT '1',
32
+ PRIMARY KEY (`id`)
33
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
34
+
35
+ DROP TABLE IF EXISTS `{$this->getTable('webforms/fields')}`;
36
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('webforms/fields')}` (
37
+ `id` int(11) NOT NULL AUTO_INCREMENT,
38
+ `webform_id` int(11) NOT NULL,
39
+ `fieldset_id` int(11) NOT NULL,
40
+ `name` varchar(255) NOT NULL,
41
+ `type` varchar(100) NOT NULL,
42
+ `size` varchar(20) NOT NULL,
43
+ `value` text NOT NULL,
44
+ `email_subject` tinyint(1) NOT NULL,
45
+ `css_class` varchar(255) NOT NULL,
46
+ `css_style` varchar(255) NOT NULL,
47
+ `position` int(11) NOT NULL,
48
+ `required` tinyint(1) NOT NULL,
49
+ `created_time` datetime NOT NULL,
50
+ `update_time` datetime NOT NULL,
51
+ `is_active` tinyint(1) NOT NULL,
52
+ PRIMARY KEY (`id`)
53
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
54
+
55
+ DROP TABLE IF EXISTS `{$this->getTable('webforms/fieldsets')}`;
56
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('webforms/fieldsets')}` (
57
+ `id` int(11) NOT NULL AUTO_INCREMENT,
58
+ `webform_id` int(11) NOT NULL,
59
+ `name` varchar(100) NOT NULL,
60
+ `position` int(11) NOT NULL,
61
+ `created_time` datetime NOT NULL,
62
+ `update_time` datetime NOT NULL,
63
+ `is_active` tinyint(1) NOT NULL,
64
+ PRIMARY KEY (`id`)
65
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
66
+
67
+ DROP TABLE IF EXISTS `{$this->getTable('webforms/results')}`;
68
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('webforms/results')}` (
69
+ `id` int(11) NOT NULL AUTO_INCREMENT,
70
+ `webform_id` int(11) NOT NULL,
71
+ `store_id` int(11) NOT NULL,
72
+ `customer_id` int(11) NOT NULL,
73
+ `customer_ip` int(11) NOT NULL,
74
+ `created_time` datetime NOT NULL,
75
+ `update_time` datetime NOT NULL,
76
+ PRIMARY KEY (`id`)
77
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
78
+
79
+ DROP TABLE IF EXISTS `{$this->getTable('webforms/results_values')}`;
80
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('webforms/results_values')}` (
81
+ `id` int(11) NOT NULL AUTO_INCREMENT,
82
+ `result_id` int(11) NOT NULL,
83
+ `field_id` int(11) NOT NULL,
84
+ `value` text NOT NULL,
85
+ PRIMARY KEY (`id`),
86
+ UNIQUE KEY `result_id` (`result_id`,`field_id`)
87
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
88
+
89
+ INSERT INTO `{$this->getTable('webforms/webforms')}` VALUES(1, 'Contact Us', '<p>You can use this extension to create and manage web-forms on your sites.</p>\r\n<ul class=\"disc\">\r\n<li>Native Magento form proccessing.</li>\r\n<li>No limits to site views, fields or localization.</li>\r\n<li>All results are stored in database and are accessible anytime.</li>\r\n<li>Set up notification e-mails for new submissions.</li>\r\n<li>Style it to your needs.</li>\r\n<li>Use Prototype validation classes for precize field entries.</li>\r\n<li>Add Google reCaptcha for unregistered users.</li>\r\n<li>Insert it via widget on any page you like.</li>\r\n<li>Come on! It`s absolutely free!</li>\r\n</ul>', '<p>Thank you for contacting me.</p>\r\n<p>You should get notification e-mail to the address you specified in the form.</p>\r\n<p>If you wonder how survey results are proccessed. Its exported to Excel XML file from administration panel, then analyzed in Excel application.</p>\r\n<p>You can contact me on Facebook&nbsp;<a href=\"http://www.facebook.com/rebimol\">http://www.facebook.com/rebimol</a><br /><br /></p>', 0, 1, 1, '', 0, '2011-06-27 09:54:10', '2011-06-28 04:28:04', 1);
90
+ INSERT INTO `{$this->getTable('webforms/webforms')}` VALUES(3, 'Customer Support', '<p><span style=\"color: #cc0000;\">ALWAYS INCLUDE YOUR ORDER NUMBER IN YOUR COMMUNICATION</span>&nbsp;</p>\r\n<p>We can only read and reply to queries in&nbsp;<strong>English</strong>.</p>\r\n<p>Our current average respons time is&nbsp;<span style=\"color: #cc0000;\"><strong>24 hours</strong></span>.&nbsp;<br /><br /></p>', '<p>Thank you for contacting our support!</p>\r\n<p>We will get back to you shortly.</p>\r\n<p>Feel free to call us <span style=\"color: #cc0000;\"><strong>+4 (123) 123-1234</strong></span></p>', 1, 1, 1, 'rebimol@gmail.com', 0, '2011-06-28 06:22:37', '2011-06-28 08:14:55', 1);
91
+ INSERT INTO `{$this->getTable('webforms/webforms')}` VALUES(4, 'Sample Survey', '<p>Please, fill up the form and see how survey works!</p>', '<p>If you wonder how survey data is analized:</p>\r\n<ul class=\"disc\">\r\n<li>Its exported to CSV or Excel XML</li>\r\n<li>Analyzed in Excel or any other your favorite application</li>\r\n</ul>', 1, 1, 1, '', 1, '2011-06-28 08:37:26', '2011-06-28 08:53:36', 1);
92
+
93
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(1, 1, 1, 'First name', 'text', 'standard', '{{firstname}}', 0, 'validate-alpha', '', 10, 1, '2011-06-27 09:58:43', '2011-06-27 10:03:03', 1);
94
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(2, 1, 1, 'Last name', 'text', 'standard', '{{lastname}}', 0, 'validate-alpha', '', 20, 1, '2011-06-27 10:16:03', '2011-06-27 10:16:03', 1);
95
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(3, 1, 1, 'E-mail address', 'email', 'wide', '{{email}}', 0, '', '', 30, 1, '2011-06-27 10:16:43', '2011-06-27 10:16:43', 1);
96
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(4, 1, 2, 'Do you need custom web-forms on your site?', 'select/radio', 'standard', 'Yes\r\nNo', 0, '', '', 40, 0, '2011-06-27 10:18:29', '2011-06-28 03:51:42', 1);
97
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(5, 1, 2, 'Did you try other web-forms extensions?', 'select/radio', 'standard', 'Yes\r\nNo', 0, '', '', 50, 0, '2011-06-27 10:19:40', '2011-06-28 03:52:23', 1);
98
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(6, 1, 2, 'How did you find this page?', 'select/checkbox', 'standard', 'Search engine\r\nMagento connect\r\nForums\r\nBlogs\r\nFriends\r\nLink from the other site', 0, '', '', 70, 1, '2011-06-27 10:24:46', '2011-06-28 03:53:32', 1);
99
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(7, 1, 2, 'What other web-forms extensions have you tried?', 'text', 'wide', '', 0, '', '', 60, 0, '2011-06-27 10:28:39', '2011-06-28 04:25:04', 1);
100
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(8, 1, 3, 'Subject', 'select', 'wide', 'I like your extension\r\nI found a bug\r\nIt needs more important features\r\nOther\r\n', 1, '', 'font-weight:bold', 80, 1, '2011-06-28 03:47:53', '2011-06-28 03:47:53', 1);
101
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(9, 1, 3, 'Comments', 'textarea', 'wide', '', 0, '', 'font-style:italic; color:#333', 90, 1, '2011-06-28 03:48:37', '2011-06-28 03:48:37', 1);
102
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(10, 1, 2, 'Do you like this extension?', 'select/radio', 'standard', 'Yes\r\nYes, but it needs more features\r\nI`m not sure yet\r\nI don`t know how to use it\r\nNo, it lacks important features\r\nNo, it absolytely doesn`t suit my needs', 0, '', '', 65, 0, '2011-06-28 03:55:13', '2011-06-28 03:56:37', 1);
103
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(15, 3, 8, 'Subject', 'text', 'wide', '', 1, '', '', 10, 1, '2011-06-28 06:23:51', '2011-06-28 08:07:49', 1);
104
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(16, 3, 8, 'Message', 'textarea', 'wide', '', 0, '', '', 60, 1, '2011-06-28 06:24:27', '2011-06-28 06:41:02', 1);
105
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(17, 3, 8, 'Criticality', 'select', 'standard', 'Low\r\nNormal\r\nHigh', 1, '', '', 30, 1, '2011-06-28 06:25:47', '2011-06-28 06:29:06', 1);
106
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(18, 3, 8, 'Category', 'select', 'standard', 'Update shipping address\r\nTracking number request\r\nWhen will my order be shipped?\r\nI have a problem with the website\r\nI want to cancel my order\r\nGeneral inquiries', 1, '', '', 50, 1, '2011-06-28 06:28:19', '2011-06-28 06:29:30', 1);
107
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(19, 3, 8, 'Phone', 'text', 'standard', '', 0, 'validate-phoneStrict', '', 15, 0, '2011-06-28 06:30:32', '2011-06-28 06:30:32', 1);
108
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(31, 3, 8, 'Order ID', 'text', 'standard', '', 1, 'validate-number', '', 12, 0, '2011-06-28 08:08:31', '2011-06-28 08:08:31', 1);
109
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(32, 4, 9, 'Gender', 'select/radio', 'wide', 'female\r\nmale', 0, '', '', 10, 1, '2011-06-28 08:39:54', '2011-06-28 08:42:12', 1);
110
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(33, 4, 9, 'U.S. ethnic code', 'select/radio', 'wide', 'White (Non Hispanic)\r\nCambodian, Laotian, or Vietnamese whose family immigrated after 1975\r\nOther Asian or Pacific Islander\r\nAmerican Indian or Alaskan Native\r\nHispanic/Latin American\r\nBlack/African-American', 0, '', '', 20, 1, '2011-06-28 08:41:11', '2011-06-28 08:48:35', 1);
111
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(34, 4, 9, 'College rank', 'select/radio', 'wide', 'freshman\r\nsophomore\r\njunior\r\nsenior\r\nspecial\r\ngraduate', 0, '', '', 30, 1, '2011-06-28 08:41:57', '2011-06-28 08:48:48', 1);
112
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(35, 4, 9, 'Which of the following science courses have you completed in high school or college (check all that apply)', 'select/checkbox', 'wide', 'biology\r\nchemistry\r\nphysics', 0, '', '', 40, 1, '2011-06-28 08:42:47', '2011-06-28 08:49:11', 1);
113
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(36, 4, 9, 'Which of the following math courses have you completed in high school or college (check all that apply)', 'select/checkbox', 'wide', 'basic math\r\nalgebra\r\ngeometry\r\npre-calculus/trigonometry\r\ncalculus', 0, '', '', 35, 1, '2011-06-28 08:43:37', '2011-06-28 08:48:59', 1);
114
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(37, 4, 9, 'How many hours per week will you be working at a paid job this semester?', 'select/radio', 'wide', 'none\r\n1-5\r\n6-10\r\n11-15\r\n16-20\r\n21-30\r\n31-40', 0, '', '', 60, 1, '2011-06-28 08:44:33', '2011-06-28 08:49:24', 1);
115
+ INSERT INTO `{$this->getTable('webforms/fields')}` VALUES(38, 4, 9, 'Do you expect to have child care responsibilities this semester that will sometimes conflict with classes?', 'select/radio', 'wide', 'yes\r\nno', 0, '', '', 70, 1, '2011-06-28 08:45:06', '2011-06-28 08:49:35', 1);
116
+
117
+ INSERT INTO `{$this->getTable('webforms/fieldsets')}` VALUES(1, 1, 'Personal Info', 10, '2011-06-27 09:54:43', '2011-06-27 09:54:43', 1);
118
+ INSERT INTO `{$this->getTable('webforms/fieldsets')}` VALUES(2, 1, 'Survey', 20, '2011-06-27 09:55:08', '2011-06-27 09:55:22', 1);
119
+ INSERT INTO `{$this->getTable('webforms/fieldsets')}` VALUES(3, 1, 'Message', 30, '2011-06-27 09:55:48', '2011-06-27 09:55:48', 1);
120
+ INSERT INTO `{$this->getTable('webforms/fieldsets')}` VALUES(8, 3, 'Trouble Ticket', 10, '2011-06-28 06:23:11', '2011-06-28 06:23:11', 1);
121
+ INSERT INTO `{$this->getTable('webforms/fieldsets')}` VALUES(9, 4, 'Background Questions', 10, '2011-06-28 08:37:54', '2011-06-28 08:37:54', 1);
122
+ ");
123
+
124
+ $installer->endSetup();
125
+ ?>
app/design/adminhtml/default/default/layout/webforms.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <webforms_adminhtml_webforms_index>
4
+ <reference name="content">
5
+ <block type="webforms/adminhtml_webforms" name="webforms" />
6
+ </reference>
7
+ </webforms_adminhtml_webforms_index>
8
+ <webforms_adminhtml_results_index>
9
+ <reference name="content">
10
+ <block type="webforms/adminhtml_results" name="results" />
11
+ </reference>
12
+ </webforms_adminhtml_results_index>
13
+ </layout>
app/design/frontend/default/default/layout/webforms.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default translate="label">
4
+ <label>WebForms</label>
5
+ </default>
6
+ <webforms_index_index>
7
+ <reference name="root">
8
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
9
+ </reference>
10
+ <reference name="content">
11
+ <block type="webforms/webforms" name="webforms" template="webforms/default.phtml"/>
12
+ </reference>
13
+ </webforms_index_index>
14
+ </layout>
app/design/frontend/default/default/template/webforms/default.phtml ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Feel free to contact me via Facebook
4
+ * http://www.facebook.com/rebimol
5
+ *
6
+ *
7
+ * @author Vladimir Popov (magento-it.com)
8
+ * @copyright Copyright (c) 2011 Vladimir Popov
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ if(Mage::registry('show_form_name')){?>
13
+ <div class="page-title">
14
+ <h1><?php echo Mage::registry('webform')->getName();?></h2>
15
+ </div>
16
+ <?php } ?>
17
+
18
+
19
+ <?php
20
+ if(Mage::registry('show_success')){?>
21
+ <div class="std">
22
+ <?php echo Mage::registry('webform')->getSuccessText()?>
23
+ </div>
24
+ <?php } else {
25
+ ?>
26
+
27
+ <div class="std">
28
+ <?php echo Mage::registry('webform')->getDescription();?>
29
+ </div>
30
+
31
+ <form action="<?php $this->getUrl()?>" method="post" name="webform_<?php echo Mage::registry('webform')->getId()?>" id="webform_<?php echo Mage::registry('webform')->getId()?>">
32
+
33
+ <input type="hidden" name="submitWebform_<?php echo Mage::registry('webform')->getId()?>" value="1"/>
34
+
35
+ <?php
36
+ foreach (Mage::registry('fields_to_fieldsets') as $fieldset){
37
+ ?>
38
+
39
+ <div class="fieldset">
40
+
41
+ <?php if($fieldset['name']) { ?>
42
+ <h2 class="legend"><?php echo $fieldset['name']?></h2>
43
+ <?php } ?>
44
+
45
+ <ul class="form-list">
46
+ <?php
47
+ $k=0;
48
+ $j=0;
49
+ $prev = false;
50
+ $fields_count = count($fieldset['fields']);
51
+ foreach($fieldset['fields'] as $field)
52
+ {
53
+
54
+ $size_class ="fields";
55
+ $field_class= "field";
56
+ if($field->getSize()=='wide'){
57
+ $size_class = "wide";
58
+ $field_class="";
59
+ }
60
+
61
+ ?>
62
+ <?php if ($j%2 ==0 || $field->getSize()=='wide' || $prev->getSize()=='wide') { $j=0;?>
63
+ <?php if ($k>1) {?></li><?php }?>
64
+ <li class="<?php echo $size_class?>">
65
+ <?php }?>
66
+ <div class="<?php echo $field_class?>">
67
+
68
+ <label for="field_<?php echo $field->getId()?>" <?php if($field->getRequired()){ ?>class="required"<?php }?>>
69
+
70
+ <?php if($field->getRequired()){ ?>
71
+ <em>*</em>
72
+ <?php }?>
73
+
74
+ <?php echo $field->getName()?>
75
+
76
+ </label>
77
+
78
+ <div class="input-box">
79
+ <?php echo $field->toHtml();?>
80
+ </div>
81
+
82
+ </div>
83
+ <?php if($k == $fields_count-1){?>
84
+ </li>
85
+ <?php } ?>
86
+ <?php
87
+ $k++; $j++;
88
+ $prev = $field;
89
+ }?>
90
+ </ul>
91
+
92
+ </div>
93
+
94
+ <?php
95
+ } // foreach 'fields_to_fieldsets'
96
+ ?>
97
+
98
+ <?php if(Mage::registry('use_captcha')) { ?>
99
+ <div class="fieldset">
100
+ <h2 class="legend">Captcha</h2>
101
+ <ul class="form-list">
102
+ <li class="fields">
103
+ <div class="field">
104
+ <?php echo $this->getCaptcha()->getHTML()?>
105
+ </div>
106
+ </li>
107
+ </ul>
108
+ </div>
109
+ <?php }?>
110
+
111
+ <div class="buttons-set">
112
+ <p class="required"><?php echo $this->__('* Required Fields')?></p>
113
+ <button type="submit" class="button" title="<?php echo $this->__('submit')?>">
114
+ <span>
115
+ <span><?php echo $this->__('Submit')?></span>
116
+ </span>
117
+ </button>
118
+ </div>
119
+
120
+
121
+ </form>
122
+
123
+ <script type="text/javascript">
124
+ //<![CDATA[
125
+ var webform_<?php echo Mage::registry('webform')->getId()?> = new VarienForm('webform_<?php echo Mage::registry('webform')->getId()?>',true);
126
+ //]]>
127
+ </script>
128
+
129
+ <?php
130
+ } // if(show_success)
131
+ ?>
app/etc/modules/VladimirPopov_WebForms.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <VladimirPopov_WebForms>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </VladimirPopov_WebForms>
8
+ </modules>
9
+ </config>
app/locale/en_US/VladimirPopov_WebForms.csv ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Action","Action"
2
+ "Add Field Set","Add Field Set"
3
+ "Add Field","Add Field"
4
+ "Add Form","Add Form"
5
+ "Add New Web-form","Add New Web-form"
6
+ "Additional CSS class","Additional CSS class"
7
+ "Additional CSS style","Additional CSS style"
8
+ "Adds web-form to a page","Adds web-form to a page"
9
+ "An error occurred during operation.","An error occurred during operation."
10
+ "An error occurred while updating records.","An error occurred while updating records."
11
+ "Are you sure to delete selected elements?","Are you sure to delete selected elements?"
12
+ "Are you sure to delete selected results?","Are you sure to delete selected results?"
13
+ "Customer","Customer"
14
+ "Date Created","Date Created"
15
+ "Date Created","Date Created"
16
+ "Date","Date"
17
+ "Default e-mail address","Default e-mail address"
18
+ "Default","Default"
19
+ "Delete","Delete"
20
+ "Description","Description"
21
+ "Design","Design"
22
+ "Disabled","Disabled"
23
+ "Duplicate results by e-mail to customer","Duplicate results by e-mail to customer"
24
+ "Edit '%s' Field - %s","Edit '%s' Field - %s"
25
+ "Edit '%s' Form","Edit '%s' Form"
26
+ "Edit Field Set '%s'","Edit Field Set '%s'"
27
+ "Edit Field Set","Edit Field Set"
28
+ "Edit Field","Edit Field"
29
+ "Edit Web-form","Edit Web-form"
30
+ "E-mail settings","E-mail settings"
31
+ "Enabled","Enabled"
32
+ "Field does not exist","Field does not exist"
33
+ "Field Information","Field Information"
34
+ "Field name display length","Field name display length"
35
+ "Field position in the form relative to field set","Field position in the form relative to field set"
36
+ "Field position in the form","Field position in the form"
37
+ "Fieldset position in the form","Fieldset position in the form"
38
+ "Field set","Field set"
39
+ "Field Sets","Field Sets"
40
+ "Field value(s)","Field value(s)"
41
+ "Field was successfully deleted","Field was successfully deleted"
42
+ "Field was successfully saved","Field was successfully saved"
43
+ "Fields","Fields"
44
+ "Fieldset does not exist","Fieldset does not exist"
45
+ "Fieldset was successfully deleted","Fieldset was successfully deleted"
46
+ "Fieldset was successfully saved","Fieldset was successfully saved"
47
+ "Form Information","Form Information"
48
+ "Forms Settings","Forms Settings"
49
+ "Frontend Template","Frontend Template"
50
+ "Guest","Guest"
51
+ "If assigned field set is not active the field won`t be displayed","If assigned field set is not active the field won`t be displayed"
52
+ "If empty default notofication e-mail address will be used","If empty default notofication e-mail address will be used"
53
+ "In order for reCaptcha to work please enter valid public and private keys. You can get those by visiting <a href='http://www.google.com/recaptcha/whyrecaptcha' target='_blank'>this page</a>","In order for reCaptcha to work please enter valid public and private keys. You can get those by visiting <a href='http://www.google.com/recaptcha/whyrecaptcha' target='_blank'>this page</a>"
54
+ "Information","Information"
55
+ "Last Modified","Last Modified"
56
+ "Last Result","Last Result"
57
+ "Manage Forms","Manage Forms"
58
+ "Name","Name"
59
+ "New Field Set","New Field Set"
60
+ "Notification e-mail address","Notification e-mail address"
61
+ "Please, don`t reply to this e-mail!","Please, don`t reply to this e-mail!"
62
+ "Position","Position"
63
+ "Private key","Private key"
64
+ "Public key","Public key"
65
+ "reCaptcha settings","reCaptcha settings"
66
+ "Registered customers only","Registered customers only"
67
+ "Required","Required"
68
+ "Result was successfully deleted","Result was successfully deleted"
69
+ "Results settings","Results settings"
70
+ "Results","Results"
71
+ "Select / Checkbox","Select / Checkbox"
72
+ "Select / Radio","Select / Radio"
73
+ "Select","Select"
74
+ "Send by e-mail","Send by e-mail"
75
+ "Send results by e-mail","Send results by e-mail"
76
+ "Send selected results by e-mail?","Send selected results by e-mail?"
77
+ "Settings","Settings"
78
+ "Size","Size"
79
+ "Standard - two neighbour fields will be merged in one row<br />Wide - field will be wide and single in a row","Standard - two neighbour fields will be merged in one row<br />Wide - field will be wide and single in a row"
80
+ "Standard","Standard"
81
+ "Status","Status"
82
+ "Store group","Store group"
83
+ "Store name","Store name"
84
+ "Success text","Success text"
85
+ "Survey mode allows filling up the form only one time","Survey mode allows filling up the form only one time"
86
+ "Survey mode","Survey mode"
87
+ "Text / E-mail","Text / E-mail"
88
+ "Text / Number","Text / Number"
89
+ "Text","Text"
90
+ "Textarea","Textarea"
91
+ "This address will be used by default to send you new results notifications","This address will be used by default to send you new results notifications"
92
+ "This address will be used in reply-to field in customer notification","This address will be used in reply-to field in customer notification"
93
+ "This field will be used as a subject in notification e-mail","This field will be used as a subject in notification e-mail"
94
+ "This text will appear under the form name","This text will appear under the form name"
95
+ "This text will be displayed after the form completion","This text will be displayed after the form completion"
96
+ "This will limit long field names in results table. It doesn`t affect export","This will limit long field names in results table. It doesn`t affect export"
97
+ "Total of %d record(s) have been deleted.","Total of %d record(s) have been deleted."
98
+ "Type","Type"
99
+ "Use as e-mail subject","Use as e-mail subject"
100
+ "Values for select type field should be separated with new line (the first listed value is default).<br />You can use following variables for default values:<br />{{firstname}} - logged in customer first name <br />{{lastname}} - logged in customer last name <br />{{email}} - logged in customer e-mail address","Values for select type field should be separated with new line (the first listed value is default).<br />You can use following variables for default values:<br />{{firstname}} - logged in customer first name <br />{{lastname}} - logged in customer last name <br />{{email}} - logged in customer e-mail address"
101
+ "Verification code was not correct. Please try again.","Verification code was not correct. Please try again."
102
+ "Web-form '%s' submitted","Web-form '%s' submitted"
103
+ "Web-form does not exist","Web-form does not exist"
104
+ "Web-form was successfully deleted","Web-form was successfully deleted"
105
+ "Web-form was successfully saved","Web-form was successfully saved"
106
+ "Web-forms Module","Web-forms Module"
107
+ "Web-forms Result","Web-forms Result"
108
+ "Web-forms Section","Web-forms Section"
109
+ "Web-forms","Web-forms"
110
+ "Wide","Wide"
111
+ "You can also use it for additional field validation (see Prototype validation classes)","You can also use it for additional field validation (see Prototype validation classes)"
112
+ "You have submitted '%s' form on %s website","You have submitted '%s' form on %s website"
app/locale/en_US/template/email/webforms_results.html ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@vars
2
+ {"var webform.name=\"\"":"Web-form name",
3
+ "var webform.result=\"\"":"Web-form result html"}
4
+ @-->
5
+
6
+ <!--@styles
7
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
8
+ @-->
9
+
10
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
11
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
12
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
13
+ <tr>
14
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
15
+ <!-- [ header starts here] -->
16
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
17
+ <!-- [ middle starts here] -->
18
+ <tr>
19
+ <td valign="top">
20
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Web-form "{{var webform_name}}"</h1>
21
+
22
+ <p style="font-size:12px; line-height:16px; margin:0 0 8px 0;">
23
+ {{var webform_result}}
24
+ </p>
25
+
26
+ <p style="font-size:12px;">
27
+ {{var noreply}}
28
+ </p>
29
+ </td>
30
+ </tr>
31
+ </table>
32
+ </td>
33
+ </tr>
34
+ </table>
35
+ </div>
36
+ </body>
package.xml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Web-forms</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Web forms, contact us forms, customer support, surveys, form editor</summary>
10
+ <description>Ever wanted to create managable web form on your Magento site? &#xD;
11
+ &#xD;
12
+ With this free extension you can create any kind of web form you like, set up notification letters for new results and get your customers feedback.&#xD;
13
+ &#xD;
14
+ With easy Magento style admin interface create any number of web forms and insert them on your pages with via widget.&#xD;
15
+ &#xD;
16
+ Main features:&#xD;
17
+ &#xD;
18
+ Customizable web forms including contact us forms, customer support and surveys&#xD;
19
+ Native Magento form proccessing with field validation&#xD;
20
+ E-mail notification&#xD;
21
+ Widget interface&#xD;
22
+ &#xD;
23
+ </description>
24
+ <notes>This release is stable and contains sample data</notes>
25
+ <authors><author><name>Vladimir Popov</name><user>rebimol</user><email>rebimol@gmail.com</email></author></authors>
26
+ <date>2011-06-28</date>
27
+ <time>10:34:54</time>
28
+ <contents><target name="magecommunity"><dir name="VladimirPopov"><dir name="WebForms"><dir name="Block"><dir name="Adminhtml"><dir name="Fields"><dir name="Edit"><file name="Form.php" hash="d50e03fbdca39202221416717077f2ba"/><dir name="Tab"><file name="Design.php" hash="408a020918d28972075ebdeede5a09c7"/><file name="Information.php" hash="a1c94fcc73655190c36c299fbbae6712"/></dir><file name="Tabs.php" hash="6e730e0325f6d8c62cbaaaf49434e067"/></dir><file name="Edit.php" hash="d2b487829fa100f67bde4520b4204baf"/></dir><dir name="Fieldsets"><dir name="Edit"><file name="Form.php" hash="5d1eaf0601753f3ac4107959c0c56ddf"/></dir><file name="Edit.php" hash="ad3d32506037443ee89b7857817c7481"/></dir><file name="Menu.php" hash="26203e0de4f1093d67a70055defb598d"/><dir name="Results"><file name="Grid.php" hash="841f1d2d27c355053f392460dbbe8557"/><dir name="Renderer"><file name="Customer.php" hash="2bed3ab369eef73f80d8abf67a2ae45c"/><file name="Value.php" hash="6e983c04dfbbbe71a9a58a948b248e06"/></dir></dir><file name="Results.php" hash="d2127ec1a4639bb9e676965c105cf8a7"/><dir name="Webforms"><dir name="Edit"><file name="Form.php" hash="c4b525bd38a40b38dbebc18a372690c4"/><dir name="Tab"><file name="Fields.php" hash="ea3229f01030d6728e592fbfa6c40463"/><file name="Fieldsets.php" hash="358422bf07236fc0f09399ac0a4cdacb"/><file name="Information.php" hash="73d84677686acf950e838b7e546d075a"/><file name="Settings.php" hash="b10b9ec0b1c891d6df9b30f740ca2b58"/></dir><file name="Tabs.php" hash="eb3c86eac0e93e6a9f66c1233ca79bc1"/></dir><file name="Edit.php" hash="62572ee93f3d187cb5d8b22baec5ddbd"/><file name="Grid.php" hash="dde6e315cd679b8bb4345e14b06e6fbe"/><dir name="Renderer"><file name="Action.php" hash="6d7f31835245361426d3aef9cd0e90ab"/><file name="Fields.php" hash="7141da168afe028d89a292a90cdc5b70"/><file name="Results.php" hash="bf3fff65cb72006dfe7ae7273738b126"/></dir></dir><file name="Webforms.php" hash="be5395fa7cb37409d5abd3325cce83d3"/></dir><file name="Webforms.php" hash="f50860a806594a9f65cdf39a924b4bc7"/><file name="Widget.php" hash="015d534b56798c7be9beb2f19cb80860"/></dir><dir name="Helper"><file name="Data.php" hash="81741460c659f6a2df8fcb5636f7f434"/></dir><dir name="Model"><file name="Fields.php" hash="4bb33d166b0dc19d3e90e54153d0370e"/><file name="Fieldsets.php" hash="574644ade9e12b6f27721ed7c8b8810d"/><dir name="Mysql4"><dir name="Fields"><file name="Collection.php" hash="d8d08d301cdede52873aeaadf9701e4c"/></dir><file name="Fields.php" hash="30737dd7b095016be55c28ba75db9360"/><dir name="Fieldsets"><file name="Collection.php" hash="b278afccf81a3a41382e40fa145629b0"/></dir><file name="Fieldsets.php" hash="c8abcb2145d9e98b83ecf9941da62271"/><dir name="Results"><file name="Collection.php" hash="f791e79817183c247fc6254adef0f5fd"/></dir><file name="Results.php" hash="d8818a107444cad0eca847f8c41df6b8"/><dir name="Webforms"><file name="Collection.php" hash="70c8b2c870ebe0ff90e705b9a37c84d4"/></dir><file name="Webforms.php" hash="a6ca077775a6efa64f90ad1962f80d3d"/></dir><file name="Results.php" hash="13350f882156d00d6b739eb51a43adaa"/><file name="Webforms.php" hash="aa2a344f286514d87f541b6b5a80ff68"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FieldsController.php" hash="a658d62baafbd26c7a348518920ee0cb"/><file name="FieldsetsController.php" hash="6053860be647e7bf9439951a3b7620ba"/><file name="ResultsController.php" hash="3e7b0e865f3d54ec4c7beedaabc0489f"/><file name="WebformsController.php" hash="5d8f6f95e4e7a645ad2b204cd8ea9e3b"/></dir><file name="IndexController.php" hash="64a80458723135f4772d17ade9f44242"/></dir><dir name="etc"><file name="config.xml" hash="3717fb9489858d3feac326fc159f0b46"/><file name="system.xml" hash="a9aa042b21c76f2a53405a42e05b068f"/><file name="widget.xml" hash="4ce4dfc5e052cf6e081136bae2c8de6f"/></dir><dir name="sql"><dir name="webforms_setup"><file name="mysql4-install-1.0.0.php" hash="6915e04b9a572e918cb5c24ffec06a0c"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="VladimirPopov_WebForms.csv" hash="0e9a00ad901a5d91268641733a56c94d"/><dir name="template"><dir name="email"><file name="webforms_results.html" hash="bf775d1f202162d9c20154107c031b27"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="webforms.xml" hash="5fb83919accc09539dd4df6e0670fbc3"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="webforms.xml" hash="19b288c8fe2db45a655aadd9f6d24ccd"/></dir><dir name="template"><dir name="webforms"><file name="default.phtml" hash="059b914b35a1ca1e9a2e211b6c2119bc"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VladimirPopov_WebForms.xml" hash="cb5fecfd55a527b2e3cc388d9c254848"/></dir></target></contents>
29
+ <compatible/>
30
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
31
+ </package>