FancyFeedback - Version 1.0.0.0

Version Notes

FancyFeedback allows the visitors on your site to leave you their precious feedbacks in a stylish way.

Download this release

Release Info

Developer Magento Core Team
Extension FancyFeedback
Version 1.0.0.0
Comparing to
See all releases


Version 1.0.0.0

Files changed (39) hide show
  1. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedback.php +13 -0
  2. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedback/Edit.php +45 -0
  3. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedback/Edit/Form.php +19 -0
  4. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedback/Edit/Tab/Form.php +60 -0
  5. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedback/Edit/Tabs.php +24 -0
  6. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedback/Grid.php +133 -0
  7. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedbacksettings.php +12 -0
  8. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedbacksettings/Edit.php +45 -0
  9. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedbacksettings/Edit/Form.php +18 -0
  10. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedbacksettings/Edit/Tab/Form.php +41 -0
  11. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedbacksettings/Edit/Tabs.php +24 -0
  12. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedbacksettings/Grid.php +85 -0
  13. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Fancyfeedback.php +17 -0
  14. app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Fancyfeedbacksettings.php +17 -0
  15. app/code/local/WebspeaksFeedback/Fancyfeedback/Helper/Data.php +6 -0
  16. app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Fancyfeedback.php +10 -0
  17. app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Fancyfeedbacksettings.php +10 -0
  18. app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Mysql4/Fancyfeedback.php +10 -0
  19. app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Mysql4/Fancyfeedback/Collection.php +10 -0
  20. app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Mysql4/Fancyfeedbacksettings.php +10 -0
  21. app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Mysql4/Fancyfeedbacksettings/Collection.php +10 -0
  22. app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Status.php +15 -0
  23. app/code/local/WebspeaksFeedback/Fancyfeedback/controllers/Adminhtml/FancyfeedbackController.php +204 -0
  24. app/code/local/WebspeaksFeedback/Fancyfeedback/controllers/Adminhtml/FancyfeedbacksettingsController.php +201 -0
  25. app/code/local/WebspeaksFeedback/Fancyfeedback/controllers/IndexController.php +70 -0
  26. app/code/local/WebspeaksFeedback/Fancyfeedback/etc/adminhtml.xml +23 -0
  27. app/code/local/WebspeaksFeedback/Fancyfeedback/etc/config.xml +152 -0
  28. app/code/local/WebspeaksFeedback/Fancyfeedback/etc/system.xml +77 -0
  29. app/code/local/WebspeaksFeedback/Fancyfeedback/sql/fancyfeedback_setup/mysql4-install-0.1.0.php +23 -0
  30. app/code/local/WebspeaksFeedback/Fancyfeedback/sql/fancyfeedbacksettings_setup/mysql4-install-0.1.0.php +17 -0
  31. app/design/frontend/default/default/layout/fancyfeedback.xml +10 -0
  32. app/design/frontend/default/default/template/fancyfeedback/fancyfeedback.phtml +0 -0
  33. app/etc/modules/WebspeaksFeedback_Fancyfeedback.xml +9 -0
  34. package.xml +18 -0
  35. skin/frontend/default/default/css/fancyfeedback/style.css +77 -0
  36. skin/frontend/default/default/images/fancyfeedback/feed_close_btn.png +0 -0
  37. skin/frontend/default/default/images/fancyfeedback/feed_left_btn.png +0 -0
  38. skin/frontend/default/default/images/fancyfeedback/feed_right_btn.png +0 -0
  39. skin/frontend/default/default/js/fancyfeedback/feedback.js +57 -0
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedback.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WebspeaksFeedback_Fancyfeedback_Block_Adminhtml_Fancyfeedback extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_fancyfeedback';
7
+ $this->_blockGroup = 'fancyfeedback';
8
+ $this->_headerText = Mage::helper('fancyfeedback')->__('Manage Feedbacks');
9
+ // $this->_addButtonLabel = Mage::helper('fancyfeedback')->__('Add Item');
10
+ parent::__construct();
11
+ $this->_removeButton('add');
12
+ }
13
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedback/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Block_Adminhtml_Fancyfeedback_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'fancyfeedback';
11
+ $this->_controller = 'adminhtml_fancyfeedback';
12
+
13
+ $this->_updateButton('delete', 'label', Mage::helper('fancyfeedback')->__('Delete Item'));
14
+ $this->_updateButton('save', 'label', Mage::helper('fancyfeedback')->__('Reply'));
15
+
16
+ /* $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);*/
21
+
22
+ $this->_formScripts[] = "
23
+ function toggleEditor() {
24
+ if (tinyMCE.getInstanceById('fancyfeedback_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'fancyfeedback_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'fancyfeedback_content');
28
+ }
29
+ }
30
+
31
+ function saveAndContinueEdit(){
32
+ editForm.submit($('edit_form').action+'back/edit/');
33
+ }
34
+ ";
35
+ }
36
+
37
+ public function getHeaderText()
38
+ {
39
+ if( Mage::registry('fancyfeedback_data') && Mage::registry('fancyfeedback_data')->getId() ) {
40
+ return Mage::helper('fancyfeedback')->__("Reply to '%s'", $this->htmlEscape(Mage::registry('fancyfeedback_data')->getName()));
41
+ } else {
42
+ return Mage::helper('fancyfeedback')->__('Add Item');
43
+ }
44
+ }
45
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedback/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Block_Adminhtml_Fancyfeedback_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedback/Edit/Tab/Form.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Block_Adminhtml_Fancyfeedback_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('fancyfeedback_form', array('legend'=>Mage::helper('fancyfeedback')->__('Reply to Feedback')));
10
+
11
+ $fieldset->addField('name', 'label', array(
12
+ 'label' => Mage::helper('fancyfeedback')->__('Name'),
13
+ 'name' => 'name',
14
+ ));
15
+
16
+ $fieldset->addField('email', 'label', array(
17
+ 'label' => Mage::helper('fancyfeedback')->__('Email'),
18
+ 'name' => 'email',
19
+ ));
20
+
21
+ $fieldset->addField('comment', 'label', array(
22
+ 'label' => Mage::helper('fancyfeedback')->__('Comment'),
23
+ 'name' => 'comment',
24
+ ));
25
+
26
+ /* $fieldset->addField('status', 'select', array(
27
+ 'label' => Mage::helper('fancyfeedback')->__('Status'),
28
+ 'name' => 'status',
29
+ 'values' => array(
30
+ array(
31
+ 'value' => 1,
32
+ 'label' => Mage::helper('fancyfeedback')->__('Enabled'),
33
+ ),
34
+
35
+ array(
36
+ 'value' => 2,
37
+ 'label' => Mage::helper('fancyfeedback')->__('Disabled'),
38
+ ),
39
+ ),
40
+ ));*/
41
+
42
+ $fieldset->addField('reply', 'editor', array(
43
+ 'name' => 'reply',
44
+ 'label' => Mage::helper('fancyfeedback')->__('Message'),
45
+ 'title' => Mage::helper('fancyfeedback')->__('Message'),
46
+ 'style' => 'width:280px; height:200px;',
47
+ 'wysiwyg' => false,
48
+ 'required' => true,
49
+ ));
50
+
51
+ if ( Mage::getSingleton('adminhtml/session')->getFancyfeedbackData() )
52
+ {
53
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getFancyfeedbackData());
54
+ Mage::getSingleton('adminhtml/session')->setFancyfeedbackData(null);
55
+ } elseif ( Mage::registry('fancyfeedback_data') ) {
56
+ $form->setValues(Mage::registry('fancyfeedback_data')->getData());
57
+ }
58
+ return parent::_prepareForm();
59
+ }
60
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedback/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Block_Adminhtml_Fancyfeedback_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('fancyfeedback_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('fancyfeedback')->__('Feedback'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('fancyfeedback')->__('Reply'),
18
+ 'title' => Mage::helper('fancyfeedback')->__('Reply'),
19
+ 'content' => $this->getLayout()->createBlock('fancyfeedback/adminhtml_fancyfeedback_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedback/Grid.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Block_Adminhtml_Fancyfeedback_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('fancyfeedbackGrid');
9
+ $this->setDefaultSort('fancyfeedback_id');
10
+ $this->setDefaultDir('DESC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('fancyfeedback/fancyfeedback')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('fancyfeedback_id', array(
24
+ 'header' => Mage::helper('fancyfeedback')->__('ID'),
25
+ 'align' =>'right',
26
+ 'index' => 'fancyfeedback_id',
27
+ 'width' => '80px',
28
+ ));
29
+
30
+ $this->addColumn('name', array(
31
+ 'header' => Mage::helper('fancyfeedback')->__('Name'),
32
+ 'align' =>'left',
33
+ 'index' => 'name',
34
+ ));
35
+
36
+ $this->addColumn('email', array(
37
+ 'header' => Mage::helper('fancyfeedback')->__('Email'),
38
+ 'align' =>'left',
39
+ 'index' => 'email',
40
+ ));
41
+
42
+ $this->addColumn('comment', array(
43
+ 'header' => Mage::helper('fancyfeedback')->__('Comment'),
44
+ 'align' =>'left',
45
+ 'width' => '380px',
46
+ 'index' => 'comment',
47
+ ));
48
+
49
+ $this->addColumn('date', array(
50
+ 'header' => Mage::helper('fancyfeedback')->__('Received On'),
51
+ 'align' =>'left',
52
+ 'index' => 'created_time',
53
+ ));
54
+
55
+ $this->addColumn('reply', array(
56
+ 'header' => Mage::helper('fancyfeedback')->__('Reply'),
57
+ 'align' =>'left',
58
+ 'index' => 'reply',
59
+ ));
60
+
61
+ /*$this->addColumn('status', array(
62
+ 'header' => Mage::helper('fancyfeedback')->__('Status'),
63
+ 'align' => 'left',
64
+ 'width' => '80px',
65
+ 'index' => 'status',
66
+ 'type' => 'options',
67
+ 'options' => array(
68
+ 1 => 'Enabled',
69
+ 2 => 'Disabled',
70
+ ),
71
+ ));*/
72
+
73
+ $this->addColumn('action',
74
+ array(
75
+ 'header' => Mage::helper('fancyfeedback')->__('Action'),
76
+ 'width' => '80',
77
+ 'type' => 'action',
78
+ 'getter' => 'getId',
79
+ 'actions' => array(
80
+ array(
81
+ 'caption' => Mage::helper('fancyfeedback')->__('Reply'),
82
+ 'url' => array('base'=> '*/*/edit'),
83
+ 'field' => 'id'
84
+ )
85
+ ),
86
+ 'filter' => false,
87
+ 'sortable' => false,
88
+ 'index' => 'stores',
89
+ 'is_system' => true,
90
+ ));
91
+
92
+ $this->addExportType('*/*/exportCsv', Mage::helper('fancyfeedback')->__('CSV'));
93
+ $this->addExportType('*/*/exportXml', Mage::helper('fancyfeedback')->__('XML'));
94
+
95
+ return parent::_prepareColumns();
96
+ }
97
+
98
+ protected function _prepareMassaction()
99
+ {
100
+ $this->setMassactionIdField('fancyfeedback_id');
101
+ $this->getMassactionBlock()->setFormFieldName('fancyfeedback');
102
+
103
+ $this->getMassactionBlock()->addItem('delete', array(
104
+ 'label' => Mage::helper('fancyfeedback')->__('Delete'),
105
+ 'url' => $this->getUrl('*/*/massDelete'),
106
+ 'confirm' => Mage::helper('fancyfeedback')->__('Are you sure?')
107
+ ));
108
+
109
+ /* $statuses = Mage::getSingleton('fancyfeedback/status')->getOptionArray();
110
+
111
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
112
+ $this->getMassactionBlock()->addItem('status', array(
113
+ 'label'=> Mage::helper('fancyfeedback')->__('Change status'),
114
+ 'url' => $this->getUrl('*//*/massStatus', array('_current'=>true)),
115
+ 'additional' => array(
116
+ 'visibility' => array(
117
+ 'name' => 'status',
118
+ 'type' => 'select',
119
+ 'class' => 'required-entry',
120
+ 'label' => Mage::helper('fancyfeedback')->__('Status'),
121
+ 'values' => $statuses
122
+ )
123
+ )
124
+ ));*/
125
+ return $this;
126
+ }
127
+
128
+ public function getRowUrl($row)
129
+ {
130
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
131
+ }
132
+
133
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedbacksettings.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WebspeaksFeedback_Fancyfeedback_Block_Adminhtml_Fancyfeedbacksettings extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_fancyfeedbacksettings';
7
+ $this->_blockGroup = 'fancyfeedback';
8
+ $this->_headerText = Mage::helper('fancyfeedback')->__('Manage Feedback Settings');
9
+ // $this->_addButtonLabel = Mage::helper('fancyfeedback')->__('Add Item');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedbacksettings/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Block_Adminhtml_Fancyfeedbacksettings_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'fancyfeedback';
11
+ $this->_controller = 'adminhtml_fancyfeedbacksettings';
12
+
13
+ $this->_updateButton('delete', 'label', Mage::helper('fancyfeedbacksettings')->__('Delete Item'));
14
+ $this->_updateButton('save', 'label', Mage::helper('fancyfeedbacksettings')->__('Reply'));
15
+
16
+ /* $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);*/
21
+
22
+ $this->_formScripts[] = "
23
+ function toggleEditor() {
24
+ if (tinyMCE.getInstanceById('fancyfeedbacksettings_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'fancyfeedbacksettings_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'fancyfeedbacksettings_content');
28
+ }
29
+ }
30
+
31
+ function saveAndContinueEdit(){
32
+ editForm.submit($('edit_form').action+'back/edit/');
33
+ }
34
+ ";
35
+ }
36
+
37
+ public function getHeaderText()
38
+ {
39
+ if( Mage::registry('fancyfeedbacksettings_data') && Mage::registry('fancyfeedbacksettings_data')->getId() ) {
40
+ return Mage::helper('fancyfeedbacksettings')->__("Reply to '%s'", $this->htmlEscape(Mage::registry('fancyfeedbacksettings_data')->getName()));
41
+ } else {
42
+ return Mage::helper('fancyfeedbacksettings')->__('Add Item');
43
+ }
44
+ }
45
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedbacksettings/Edit/Form.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Block_Adminhtml_Fancyfeedbacksettings_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post'
11
+ )
12
+ );
13
+
14
+ $form->setUseContainer(true);
15
+ $this->setForm($form);
16
+ return parent::_prepareForm();
17
+ }
18
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedbacksettings/Edit/Tab/Form.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Block_Adminhtml_Fancyfeedbacksettings_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('fancyfeedbacksettings_form', array('legend'=>Mage::helper('fancyfeedback')->__('Reply to Feedback')));
10
+
11
+ $fieldset->addField('enabled', 'label', array(
12
+ 'label' => Mage::helper('fancyfeedback')->__('Enabled'),
13
+ 'name' => 'enabled',
14
+ ));
15
+
16
+ /* $fieldset->addField('status', 'select', array(
17
+ 'label' => Mage::helper('fancyfeedbacksettings')->__('Status'),
18
+ 'name' => 'status',
19
+ 'values' => array(
20
+ array(
21
+ 'value' => 1,
22
+ 'label' => Mage::helper('fancyfeedbacksettings')->__('Enabled'),
23
+ ),
24
+
25
+ array(
26
+ 'value' => 2,
27
+ 'label' => Mage::helper('fancyfeedbacksettings')->__('Disabled'),
28
+ ),
29
+ ),
30
+ ));*/
31
+
32
+ if ( Mage::getSingleton('adminhtml/session')->getFancyfeedbacksettingsData() )
33
+ {
34
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getFancyfeedbacksettingsData());
35
+ Mage::getSingleton('adminhtml/session')->setFancyfeedbacksettingsData(null);
36
+ } elseif ( Mage::registry('fancyfeedbacksettings_data') ) {
37
+ $form->setValues(Mage::registry('fancyfeedbacksettings_data')->getData());
38
+ }
39
+ return parent::_prepareForm();
40
+ }
41
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedbacksettings/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Block_Adminhtml_Fancyfeedbacksettings_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('fancyfeedbacksettings_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('fancyfeedback')->__('Feedback'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('fancyfeedback')->__('Reply'),
18
+ 'title' => Mage::helper('fancyfeedback')->__('Reply'),
19
+ 'content' => $this->getLayout()->createBlock('fancyfeedback/adminhtml_fancyfeedbacksettings_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Adminhtml/Fancyfeedbacksettings/Grid.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Block_Adminhtml_Fancyfeedbacksettings_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('fancyfeedbacksettingsGrid');
9
+ $this->setDefaultSort('fancyfeedbacksettings_id');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('fancyfeedback/fancyfeedbacksettings')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('fancyfeedbacksettings_id', array(
24
+ 'header' => Mage::helper('fancyfeedback')->__('ID'),
25
+ 'align' =>'right',
26
+ 'index' => 'fancyfeedbacksettings_id',
27
+ 'width' => '80px',
28
+ ));
29
+
30
+ /*$this->addColumn('status', array(
31
+ 'header' => Mage::helper('fancyfeedback')->__('Status'),
32
+ 'align' => 'left',
33
+ 'width' => '80px',
34
+ 'index' => 'status',
35
+ 'type' => 'options',
36
+ 'options' => array(
37
+ 1 => 'Enabled',
38
+ 2 => 'Disabled',
39
+ ),
40
+ ));*/
41
+
42
+ $this->addColumn('action',
43
+ array(
44
+ 'header' => Mage::helper('fancyfeedback')->__('Action'),
45
+ 'width' => '100',
46
+ 'type' => 'action',
47
+ 'getter' => 'getId',
48
+ 'actions' => array(
49
+ array(
50
+ 'caption' => Mage::helper('fancyfeedback')->__('Reply'),
51
+ 'url' => array('base'=> '*/*/edit'),
52
+ 'field' => 'id'
53
+ )
54
+ ),
55
+ 'filter' => false,
56
+ 'sortable' => false,
57
+ 'index' => 'stores',
58
+ 'is_system' => true,
59
+ ));
60
+
61
+ $this->addExportType('*/*/exportCsv', Mage::helper('fancyfeedback')->__('CSV'));
62
+ $this->addExportType('*/*/exportXml', Mage::helper('fancyfeedback')->__('XML'));
63
+
64
+ return parent::_prepareColumns();
65
+ }
66
+
67
+ protected function _prepareMassaction()
68
+ {
69
+ $this->setMassactionIdField('fancyfeedbacksettings_id');
70
+ $this->getMassactionBlock()->setFormFieldName('fancyfeedbacksettings');
71
+
72
+ $this->getMassactionBlock()->addItem('delete', array(
73
+ 'label' => Mage::helper('fancyfeedback')->__('Delete'),
74
+ 'url' => $this->getUrl('*/*/massDelete'),
75
+ 'confirm' => Mage::helper('fancyfeedback')->__('Are you sure?')
76
+ ));
77
+ return $this;
78
+ }
79
+
80
+ public function getRowUrl($row)
81
+ {
82
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
83
+ }
84
+
85
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Fancyfeedback.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WebspeaksFeedback_Fancyfeedback_Block_Fancyfeedback extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getFancyfeedback()
10
+ {
11
+ if (!$this->hasData('fancyfeedback')) {
12
+ $this->setData('fancyfeedback', Mage::registry('fancyfeedback'));
13
+ }
14
+ return $this->getData('fancyfeedback');
15
+
16
+ }
17
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Block/Fancyfeedbacksettings.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WebspeaksFeedback_Fancyfeedback_Block_Fancyfeedbacksettings extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getFancyfeedbacksettings()
10
+ {
11
+ if (!$this->hasData('fancyfeedbacksettings')) {
12
+ $this->setData('fancyfeedbacksettings', Mage::registry('fancyfeedbacksettings'));
13
+ }
14
+ return $this->getData('fancyfeedbacksettings');
15
+
16
+ }
17
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Fancyfeedback.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Model_Fancyfeedback extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('fancyfeedback/fancyfeedback');
9
+ }
10
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Fancyfeedbacksettings.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Model_Fancyfeedbacksettings extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('fancyfeedback/fancyfeedbacksettings');
9
+ }
10
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Mysql4/Fancyfeedback.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Model_Mysql4_Fancyfeedback extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the fancyfeedback_id refers to the key field in your database table.
8
+ $this->_init('fancyfeedback/fancyfeedback', 'fancyfeedback_id');
9
+ }
10
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Mysql4/Fancyfeedback/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Model_Mysql4_Fancyfeedback_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('fancyfeedback/fancyfeedback');
9
+ }
10
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Mysql4/Fancyfeedbacksettings.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Model_Mysql4_Fancyfeedbacksettings extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the fancyfeedbacksettings_id refers to the key field in your database table.
8
+ $this->_init('fancyfeedback/fancyfeedbacksettings', 'fancyfeedbacksettings_id');
9
+ }
10
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Mysql4/Fancyfeedbacksettings/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Model_Mysql4_Fancyfeedbacksettings_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('fancyfeedback/fancyfeedbacksettings');
9
+ }
10
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('fancyfeedback')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('fancyfeedback')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/controllers/Adminhtml/FancyfeedbackController.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Adminhtml_FancyfeedbackController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('fancyfeedback/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function editAction() {
20
+ $id = $this->getRequest()->getParam('id');
21
+ $model = Mage::getModel('fancyfeedback/fancyfeedback')->load($id);
22
+
23
+ if ($model->getId() || $id == 0) {
24
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
25
+ if (!empty($data)) {
26
+ $model->setData($data);
27
+ }
28
+
29
+ Mage::register('fancyfeedback_data', $model);
30
+
31
+ $this->loadLayout();
32
+ $this->_setActiveMenu('fancyfeedback/items');
33
+
34
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
35
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
36
+
37
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
38
+
39
+ $this->_addContent($this->getLayout()->createBlock('fancyfeedback/adminhtml_fancyfeedback_edit'))
40
+ ->_addLeft($this->getLayout()->createBlock('fancyfeedback/adminhtml_fancyfeedback_edit_tabs'));
41
+
42
+ $this->renderLayout();
43
+ } else {
44
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('fancyfeedback')->__('Item does not exist'));
45
+ $this->_redirect('*/*/');
46
+ }
47
+ }
48
+
49
+ public function newAction() {
50
+ $this->_forward('edit');
51
+ }
52
+
53
+ public function saveAction() {
54
+ if ($data = $this->getRequest()->getPost()) {
55
+
56
+ $model = Mage::getModel('fancyfeedback/fancyfeedback');
57
+ $model->setData($data)->setId($this->getRequest()->getParam('id'));
58
+ try {
59
+ /*if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
60
+ $model->setCreatedTime(now())
61
+ ->setUpdateTime(now());
62
+ } else {
63
+ $model->setUpdateTime(now());
64
+ } */
65
+
66
+ $model->save();
67
+
68
+ $thisModel = Mage::getModel('fancyfeedback/fancyfeedback')->load($this->getRequest()->getParam('id'));
69
+ if($thisModel->getName() != '' && $thisModel->getEmail() != '')
70
+ {
71
+ $this->sendMail( $thisModel->getEmail(), $thisModel->getName(), substr('Re: '.$thisModel->getComment(),0,100), $data['reply']);
72
+ }
73
+
74
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('fancyfeedback')->__('Reply was sent successfully.'));
75
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
76
+
77
+ if ($this->getRequest()->getParam('back')) {
78
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
79
+ return;
80
+ }
81
+ $this->_redirect('*/*/');
82
+ return;
83
+ } catch (Exception $e) {
84
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
85
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
86
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
87
+ return;
88
+ }
89
+ }
90
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('fancyfeedback')->__('Unable to find item to save'));
91
+ $this->_redirect('*/*/');
92
+ }
93
+
94
+ public function deleteAction() {
95
+ if( $this->getRequest()->getParam('id') > 0 ) {
96
+ try {
97
+ $model = Mage::getModel('fancyfeedback/fancyfeedback');
98
+
99
+ $model->setId($this->getRequest()->getParam('id'))
100
+ ->delete();
101
+
102
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
103
+ $this->_redirect('*/*/');
104
+ } catch (Exception $e) {
105
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
106
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
107
+ }
108
+ }
109
+ $this->_redirect('*/*/');
110
+ }
111
+
112
+ public function massDeleteAction() {
113
+ $fancyfeedbackIds = $this->getRequest()->getParam('fancyfeedback');
114
+ if(!is_array($fancyfeedbackIds)) {
115
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
116
+ } else {
117
+ try {
118
+ foreach ($fancyfeedbackIds as $fancyfeedbackId) {
119
+ $fancyfeedback = Mage::getModel('fancyfeedback/fancyfeedback')->load($fancyfeedbackId);
120
+ $fancyfeedback->delete();
121
+ }
122
+ Mage::getSingleton('adminhtml/session')->addSuccess(
123
+ Mage::helper('adminhtml')->__(
124
+ 'Total of %d record(s) were successfully deleted', count($fancyfeedbackIds)
125
+ )
126
+ );
127
+ } catch (Exception $e) {
128
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
129
+ }
130
+ }
131
+ $this->_redirect('*/*/index');
132
+ }
133
+
134
+ public function massStatusAction()
135
+ {
136
+ $fancyfeedbackIds = $this->getRequest()->getParam('fancyfeedback');
137
+ if(!is_array($fancyfeedbackIds)) {
138
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
139
+ } else {
140
+ try {
141
+ foreach ($fancyfeedbackIds as $fancyfeedbackId) {
142
+ $fancyfeedback = Mage::getSingleton('fancyfeedback/fancyfeedback')
143
+ ->load($fancyfeedbackId)
144
+ ->setStatus($this->getRequest()->getParam('status'))
145
+ ->setIsMassupdate(true)
146
+ ->save();
147
+ }
148
+ $this->_getSession()->addSuccess(
149
+ $this->__('Total of %d record(s) were successfully updated', count($fancyfeedbackIds))
150
+ );
151
+ } catch (Exception $e) {
152
+ $this->_getSession()->addError($e->getMessage());
153
+ }
154
+ }
155
+ $this->_redirect('*/*/index');
156
+ }
157
+
158
+ public function exportCsvAction()
159
+ {
160
+ $fileName = 'fancyfeedback.csv';
161
+ $content = $this->getLayout()->createBlock('fancyfeedback/adminhtml_fancyfeedback_grid')
162
+ ->getCsv();
163
+
164
+ $this->_sendUploadResponse($fileName, $content);
165
+ }
166
+
167
+ public function exportXmlAction()
168
+ {
169
+ $fileName = 'fancyfeedback.xml';
170
+ $content = $this->getLayout()->createBlock('fancyfeedback/adminhtml_fancyfeedback_grid')
171
+ ->getXml();
172
+
173
+ $this->_sendUploadResponse($fileName, $content);
174
+ }
175
+
176
+ public function sendMail($email, $name, $subject='', $body='')
177
+ {
178
+ ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
179
+ ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
180
+
181
+
182
+ $sender_email = Mage::getStoreConfig('fancyfeedbackconfig/fancyfeedback_group/fancyfeedback_senderemail');
183
+ $sender_name = Mage::getStoreConfig('fancyfeedbackconfig/fancyfeedback_group/fancyfeedback_sendername');
184
+
185
+ $mail = new Zend_Mail(); //class for mail
186
+ $mail->setBodyHtml($body); //for sending message containing html code
187
+ $mail->setFrom($sender_email, $sender_name);
188
+ $mail->addTo($email, $name);
189
+ //$mail->addCc($cc, $ccname); //can set cc
190
+ //$mail->addBCc($bcc, $bccname); //can set bcc
191
+ $mail->setSubject($subject);
192
+ try {
193
+ if($mail->send())
194
+ {
195
+ // die("Mail sent successfully to $to");
196
+ }
197
+ }
198
+ catch(Exception $ex) {
199
+ // echo 'error->'.$error_msg = $ex->getMessage();
200
+ // die("Error sending mail to $to,$error_msg");
201
+ }
202
+ return true;
203
+ }
204
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/controllers/Adminhtml/FancyfeedbacksettingsController.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WebspeaksFeedback_Fancyfeedback_Adminhtml_FancyfeedbacksettingsController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('fancyfeedback/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()->renderLayout();
16
+ }
17
+
18
+ public function editAction() {
19
+ $id = $this->getRequest()->getParam('id');
20
+ $model = Mage::getModel('fancyfeedback/fancyfeedback')->load($id);
21
+
22
+ if ($model->getId() || $id == 0) {
23
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
24
+ if (!empty($data)) {
25
+ $model->setData($data);
26
+ }
27
+
28
+ Mage::register('fancyfeedback_data', $model);
29
+
30
+ $this->loadLayout();
31
+ $this->_setActiveMenu('fancyfeedback/items');
32
+
33
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
34
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
35
+
36
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
37
+
38
+ $this->_addContent($this->getLayout()->createBlock('fancyfeedback/adminhtml_fancyfeedback_edit'))
39
+ ->_addLeft($this->getLayout()->createBlock('fancyfeedback/adminhtml_fancyfeedback_edit_tabs'));
40
+
41
+ $this->renderLayout();
42
+ } else {
43
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('fancyfeedback')->__('Item does not exist'));
44
+ $this->_redirect('*/*/');
45
+ }
46
+ }
47
+
48
+ public function newAction() {
49
+ $this->_forward('edit');
50
+ }
51
+
52
+ public function saveAction() {
53
+ if ($data = $this->getRequest()->getPost()) {
54
+
55
+ $model = Mage::getModel('fancyfeedback/fancyfeedback');
56
+ $model->setData($data)
57
+ ->setId($this->getRequest()->getParam('id'));
58
+ try {
59
+ /*if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
60
+ $model->setCreatedTime(now())
61
+ ->setUpdateTime(now());
62
+ } else {
63
+ $model->setUpdateTime(now());
64
+ } */
65
+
66
+ $model->save();
67
+
68
+ $thisModel = Mage::getModel('fancyfeedback/fancyfeedback')->load($this->getRequest()->getParam('id'));
69
+ if($thisModel->getName != '' && $thisModel->getEmail != '')
70
+ {
71
+ $this->sendMail($thisModel->getName(), $thisModel->getEmail());
72
+ }
73
+
74
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('fancyfeedback')->__('Reply was sent successfully.'));
75
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
76
+
77
+ if ($this->getRequest()->getParam('back')) {
78
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
79
+ return;
80
+ }
81
+ $this->_redirect('*/*/');
82
+ return;
83
+ } catch (Exception $e) {
84
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
85
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
86
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
87
+ return;
88
+ }
89
+ }
90
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('fancyfeedback')->__('Unable to find item to save'));
91
+ $this->_redirect('*/*/');
92
+ }
93
+
94
+ public function deleteAction() {
95
+ if( $this->getRequest()->getParam('id') > 0 ) {
96
+ try {
97
+ $model = Mage::getModel('fancyfeedback/fancyfeedback');
98
+
99
+ $model->setId($this->getRequest()->getParam('id'))
100
+ ->delete();
101
+
102
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
103
+ $this->_redirect('*/*/');
104
+ } catch (Exception $e) {
105
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
106
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
107
+ }
108
+ }
109
+ $this->_redirect('*/*/');
110
+ }
111
+
112
+ public function massDeleteAction() {
113
+ $fancyfeedbackIds = $this->getRequest()->getParam('fancyfeedback');
114
+ if(!is_array($fancyfeedbackIds)) {
115
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
116
+ } else {
117
+ try {
118
+ foreach ($fancyfeedbackIds as $fancyfeedbackId) {
119
+ $fancyfeedback = Mage::getModel('fancyfeedback/fancyfeedback')->load($fancyfeedbackId);
120
+ $fancyfeedback->delete();
121
+ }
122
+ Mage::getSingleton('adminhtml/session')->addSuccess(
123
+ Mage::helper('adminhtml')->__(
124
+ 'Total of %d record(s) were successfully deleted', count($fancyfeedbackIds)
125
+ )
126
+ );
127
+ } catch (Exception $e) {
128
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
129
+ }
130
+ }
131
+ $this->_redirect('*/*/index');
132
+ }
133
+
134
+ public function massStatusAction()
135
+ {
136
+ $fancyfeedbackIds = $this->getRequest()->getParam('fancyfeedback');
137
+ if(!is_array($fancyfeedbackIds)) {
138
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
139
+ } else {
140
+ try {
141
+ foreach ($fancyfeedbackIds as $fancyfeedbackId) {
142
+ $fancyfeedback = Mage::getSingleton('fancyfeedback/fancyfeedback')
143
+ ->load($fancyfeedbackId)
144
+ ->setStatus($this->getRequest()->getParam('status'))
145
+ ->setIsMassupdate(true)
146
+ ->save();
147
+ }
148
+ $this->_getSession()->addSuccess(
149
+ $this->__('Total of %d record(s) were successfully updated', count($fancyfeedbackIds))
150
+ );
151
+ } catch (Exception $e) {
152
+ $this->_getSession()->addError($e->getMessage());
153
+ }
154
+ }
155
+ $this->_redirect('*/*/index');
156
+ }
157
+
158
+ public function exportCsvAction()
159
+ {
160
+ $fileName = 'fancyfeedback.csv';
161
+ $content = $this->getLayout()->createBlock('fancyfeedback/adminhtml_fancyfeedback_grid')
162
+ ->getCsv();
163
+
164
+ $this->_sendUploadResponse($fileName, $content);
165
+ }
166
+
167
+ public function exportXmlAction()
168
+ {
169
+ $fileName = 'fancyfeedback.xml';
170
+ $content = $this->getLayout()->createBlock('fancyfeedback/adminhtml_fancyfeedback_grid')
171
+ ->getXml();
172
+
173
+ $this->_sendUploadResponse($fileName, $content);
174
+ }
175
+
176
+ public function sendMail($email, $name=null, array $variables = array())
177
+ {
178
+ ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
179
+ ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
180
+
181
+ $config = array(
182
+ 'ssl' => 'tls', //optional
183
+ 'port' => Mage::getStoreConfig('system/smtp/port'), //optional - default 25
184
+ 'auth' => 'login',
185
+ 'username' => 'username@somesite.com',
186
+ 'password' => 'secret'
187
+ );
188
+
189
+ $transport = new Zend_Mail_Transport_Smtp(Mage::getStoreConfig('system/smtp/host'), $config);
190
+
191
+ $mail = Mage_Core_Model_Email_Template::getMail();
192
+
193
+ try {
194
+ $mail->send($transport); //add $transport object as parameter
195
+ }
196
+ catch (Exception $e) {
197
+ return false;
198
+ }
199
+ return true;
200
+ }
201
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/controllers/IndexController.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WebspeaksFeedback_Fancyfeedback_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $fancyfeedbackTable = Mage::getSingleton('core/resource')->getTableName('fancyfeedback');
7
+
8
+ $write = Mage::getSingleton("core/resource")->getConnection("core_write");
9
+ $query = "insert into ".$fancyfeedbackTable." (name, email, comment, ip, created_time) values (:name, :email, :comment, :ip, NOW())";
10
+
11
+ $binds = array(
12
+ 'name' => ($_GET['name'])?$_GET['name']:'',
13
+ 'email' => ($_GET['email'])?$_GET['email']:'',
14
+ 'comment' => ($_GET['msg'])?$_GET['msg']:'',
15
+ 'ip' => $this->getRealIpAddr(),
16
+ );
17
+ $write->query($query, $binds);
18
+
19
+ echo json_encode(array('value'=>'Thanks for your response!'));
20
+
21
+ $this->sendMail($_GET['email'], $_GET['name'], 'New Feedback Received!', $_GET['msg']);
22
+ die;
23
+ // $this->loadLayout();
24
+ // $this->renderLayout();
25
+ }
26
+
27
+ public function sendMail($email, $name, $subject='', $body='')
28
+ {
29
+ ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
30
+ ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
31
+
32
+ $receiver_email = Mage::getStoreConfig('fancyfeedbackconfig/fancyfeedback_group/fancyfeedback_receiveremail');
33
+ $receiver_subject = Mage::getStoreConfig('fancyfeedbackconfig/fancyfeedback_group/fancyfeedback_subject');
34
+
35
+ $mail = new Zend_Mail(); //class for mail
36
+ $mail->setBodyHtml($body); //for sending message containing html code
37
+ $mail->setFrom($email, $name);
38
+ $mail->addTo($receiver_email);
39
+ //$mail->addCc($cc, $ccname); //can set cc
40
+ //$mail->addBCc($bcc, $bccname); //can set bcc
41
+ $mail->setSubject($receiver_subject);
42
+ try {
43
+ if($mail->send())
44
+ {
45
+ return true;
46
+ }
47
+ }
48
+ catch(Exception $ex) {
49
+ // echo 'error->'.$error_msg = $ex->getMessage();
50
+ return false;
51
+ }
52
+ }
53
+
54
+ public function getRealIpAddr()
55
+ {
56
+ if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
57
+ {
58
+ $ip=$_SERVER['HTTP_CLIENT_IP'];
59
+ }
60
+ elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
61
+ {
62
+ $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
63
+ }
64
+ else
65
+ {
66
+ $ip=$_SERVER['REMOTE_ADDR'];
67
+ }
68
+ return $ip;
69
+ }
70
+ }
app/code/local/WebspeaksFeedback/Fancyfeedback/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <fancyfeedbackconfig translate="title" module="fancyfeedback">
12
+ <title>Fancy Feedback Configuration</title>
13
+ <sort_order>100</sort_order>
14
+ </fancyfeedbackconfig>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/local/WebspeaksFeedback/Fancyfeedback/etc/config.xml ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <WebspeaksFeedback_Fancyfeedback>
5
+ <version>0.1.0</version>
6
+ </WebspeaksFeedback_Fancyfeedback>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <fancyfeedback>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>WebspeaksFeedback_Fancyfeedback</module>
14
+ <frontName>fancyfeedback</frontName>
15
+ </args>
16
+ </fancyfeedback>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <fancyfeedback>
21
+ <file>fancyfeedback.xml</file>
22
+ </fancyfeedback>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <fancyfeedback>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>WebspeaksFeedback_Fancyfeedback</module>
32
+ <frontName>fancyfeedback</frontName>
33
+ </args>
34
+ </fancyfeedback>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <menu>
39
+ <fancyfeedback module="fancyfeedback">
40
+ <title>Fancyfeedback</title>
41
+ <sort_order>71</sort_order>
42
+ <children>
43
+ <manage module="fancyfeedback">
44
+ <title>Manage Feedbacks</title>
45
+ <sort_order>1</sort_order>
46
+ <action>fancyfeedback/adminhtml_fancyfeedback</action>
47
+ </manage>
48
+ <!--<settings module="fancyfeedback">
49
+ <title>Settings</title>
50
+ <sort_order>0</sort_order>
51
+ <action>fancyfeedback/adminhtml_fancyfeedbacksettings</action>
52
+ </settings>-->
53
+ </children>
54
+ </fancyfeedback>
55
+ </menu>
56
+ <acl>
57
+ <resources>
58
+ <all>
59
+ <title>Allow Everything</title>
60
+ </all>
61
+ <admin>
62
+ <children>
63
+ <manage module="fancyfeedback">
64
+ <title>Manage Feedbacks</title>
65
+ <sort_order>1</sort_order>
66
+ </manage>
67
+ <settings module="fancyfeedback">
68
+ <title>Settings</title>
69
+ <sort_order>0</sort_order>
70
+ </settings>
71
+ <system>
72
+ <children>
73
+ <config>
74
+ <children>
75
+ <fancyfeedbackconfig translate="title" module="fancyfeedback">
76
+ <title>Fancyfeedback Configuration</title>
77
+ <sort_order>100</sort_order>
78
+ </fancyfeedbackconfig>
79
+ </children>
80
+ </config>
81
+ </children>
82
+ </system>
83
+ </children>
84
+ </admin>
85
+ </resources>
86
+ </acl>
87
+ <layout>
88
+ <updates>
89
+ <fancyfeedback>
90
+ <file>fancyfeedback.xml</file>
91
+ </fancyfeedback>
92
+ </updates>
93
+ </layout>
94
+ </adminhtml>
95
+ <global>
96
+ <models>
97
+ <fancyfeedback>
98
+ <class>WebspeaksFeedback_Fancyfeedback_Model</class>
99
+ <resourceModel>fancyfeedback_mysql4</resourceModel>
100
+ </fancyfeedback>
101
+ <fancyfeedback_mysql4>
102
+ <class>WebspeaksFeedback_Fancyfeedback_Model_Mysql4</class>
103
+ <entities>
104
+ <fancyfeedback>
105
+ <table>fancyfeedback</table>
106
+ </fancyfeedback>
107
+ <fancyfeedbacksettings>
108
+ <table>fancyfeedbacksettings</table>
109
+ </fancyfeedbacksettings>
110
+ </entities>
111
+ </fancyfeedback_mysql4>
112
+ </models>
113
+ <resources>
114
+ <fancyfeedback_setup>
115
+ <setup>
116
+ <module>WebspeaksFeedback_Fancyfeedback</module>
117
+ </setup>
118
+ <connection>
119
+ <use>core_setup</use>
120
+ </connection>
121
+ </fancyfeedback_setup>
122
+ <fancyfeedback_write>
123
+ <connection>
124
+ <use>core_write</use>
125
+ </connection>
126
+ </fancyfeedback_write>
127
+ <fancyfeedback_read>
128
+ <connection>
129
+ <use>core_read</use>
130
+ </connection>
131
+ </fancyfeedback_read>
132
+ </resources>
133
+ <blocks>
134
+ <fancyfeedback>
135
+ <class>WebspeaksFeedback_Fancyfeedback_Block</class>
136
+ </fancyfeedback>
137
+ </blocks>
138
+ <helpers>
139
+ <fancyfeedback>
140
+ <class>WebspeaksFeedback_Fancyfeedback_Helper</class>
141
+ </fancyfeedback>
142
+ </helpers>
143
+ </global>
144
+ <default>
145
+ <fancyfeedbackconfig>
146
+ <fancyfeedback_group>
147
+ <fancyfeedback_enabled>1</fancyfeedback_enabled>
148
+ <fancyfeedback_subject>New Feedback received!</fancyfeedback_subject>
149
+ </fancyfeedback_group>
150
+ </fancyfeedbackconfig>
151
+ </default>
152
+ </config>
app/code/local/WebspeaksFeedback/Fancyfeedback/etc/system.xml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <tabs>
4
+ <fancyfeedback_tab module="fancyfeedback" translate="label">
5
+ <label>Fancy Feedback</label>
6
+ <sort_order>100</sort_order>
7
+ </fancyfeedback_tab>
8
+ </tabs>
9
+ <sections>
10
+ <fancyfeedbackconfig module="fancyfeedback" translate="label">
11
+ <label>Configuration</label>
12
+ <sort_order>200</sort_order>
13
+ <show_in_default>1</show_in_default>
14
+ <show_in_website>1</show_in_website>
15
+ <show_in_store>1</show_in_store>
16
+ <tab>fancyfeedback_tab</tab>
17
+ <groups>
18
+ <fancyfeedback_group translate="label">
19
+ <label>Fancy Feedback Configuration</label>
20
+ <!--<comment>Show/Hide Fancy feedback on your site</comment>-->
21
+ <sort_order>10</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <fancyfeedback_enabled translate="label tooltip comment">
27
+ <label>Is Enabled</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>adminhtml/system_config_source_yesno</source_model>
30
+ <sort_order>0</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ <comment>Display Fancy feedback form in front office.</comment>
35
+ </fancyfeedback_enabled>
36
+ <fancyfeedback_senderemail translate="label tooltip comment">
37
+ <label>Sender Email</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>1</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ <comment>Email address used to reply feedbacks.</comment>
44
+ </fancyfeedback_senderemail>
45
+ <fancyfeedback_sendername translate="label tooltip comment">
46
+ <label>Sender Name</label>
47
+ <frontend_type>text</frontend_type>
48
+ <sort_order>2</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ <comment>Name used to reply feedbacks.</comment>
53
+ </fancyfeedback_sendername>
54
+ <fancyfeedback_receiveremail translate="label tooltip comment">
55
+ <label>Receiver Email</label>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>3</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ <comment>Email on which feedbacks are received.</comment>
62
+ </fancyfeedback_receiveremail>
63
+ <fancyfeedback_subject translate="label tooltip comment">
64
+ <label>Default Subject</label>
65
+ <frontend_type>text</frontend_type>
66
+ <sort_order>4</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ <comment>Subject line of received feedback mails.</comment>
71
+ </fancyfeedback_subject>
72
+ </fields>
73
+ </fancyfeedback_group>
74
+ </groups>
75
+ </fancyfeedbackconfig>
76
+ </sections>
77
+ </config>
app/code/local/WebspeaksFeedback/Fancyfeedback/sql/fancyfeedback_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('fancyfeedback')};
10
+ CREATE TABLE {$this->getTable('fancyfeedback')} (
11
+ `fancyfeedback_id` int(11) unsigned NOT NULL auto_increment,
12
+ `name` varchar(255) NOT NULL default '',
13
+ `email` varchar(255) NOT NULL default '',
14
+ `comment` text NOT NULL,
15
+ `ip` varchar(30) default '',
16
+ `created_time` datetime default NULL,
17
+ `reply` text,
18
+ `reply_time` datetime default NULL,
19
+ PRIMARY KEY (`fancyfeedback_id`)
20
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
21
+ ");
22
+
23
+ $installer->endSetup();
app/code/local/WebspeaksFeedback/Fancyfeedback/sql/fancyfeedbacksettings_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('fancyfeedbacksettings')};
10
+ CREATE TABLE `fancyfeedbacksettings` (
11
+ `fancyfeedbacksettings_id` INT(11) NOT NULL AUTO_INCREMENT,
12
+ `enabled` ENUM('y','n') DEFAULT 'y',
13
+ PRIMARY KEY (`fancyfeedbacksettings_id`)
14
+ ) ENGINE=INNODB DEFAULT CHARSET=latin1;
15
+ ");
16
+
17
+ $installer->endSetup();
app/design/frontend/default/default/layout/fancyfeedback.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <fancyfeedback_index_index>
6
+ <reference name="content">
7
+ <block type="fancyfeedback/fancyfeedback" name="fancyfeedback" template="fancyfeedback/fancyfeedback.phtml" />
8
+ </reference>
9
+ </fancyfeedback_index_index>
10
+ </layout>
app/design/frontend/default/default/template/fancyfeedback/fancyfeedback.phtml ADDED
File without changes
app/etc/modules/WebspeaksFeedback_Fancyfeedback.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <WebspeaksFeedback_Fancyfeedback>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </WebspeaksFeedback_Fancyfeedback>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>FancyFeedback</name>
4
+ <version>1.0.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>FancyFeedback allows the visitors on your site to leave you their precious feedbacks in a stylish way.</summary>
10
+ <description>FancyFeedback allows the visitors on your site to leave you their precious feedbacks in a stylish way.</description>
11
+ <notes>FancyFeedback allows the visitors on your site to leave you their precious feedbacks in a stylish way.</notes>
12
+ <authors><author><name>Arvind Bhardwaj</name><user>auto-converted</user><email>bhardwajsonheight@gmail.com</email></author><author><name>Arvind Bhardwaj</name><user>auto-converted</user><email>bhardwajsonheight@gmail.com</email></author><author><name>Arvind Bhardwaj</name><user>auto-converted</user><email>bhardwajsonheight@gmail.com</email></author></authors>
13
+ <date>2011-02-11</date>
14
+ <time>11:50:54</time>
15
+ <contents><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="fancyfeedback"><file name="style.css" hash="70ecc660da56cd1e895f8fde17074d95"/></dir></dir><dir name="images"><dir name="fancyfeedback"><file name="feed_close_btn.png" hash="110f2df27998a51e8c3d4c15ca099f30"/><file name="feed_left_btn.png" hash="9b84256e9f7cb9b12713cf505621261c"/><file name="feed_right_btn.png" hash="09e178ae12ab692da1f457df9ca26e5d"/></dir></dir><dir name="js"><dir name="fancyfeedback"><file name="feedback.js" hash="6a8bab8536d74ae646b3415e16d97d9c"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="fancyfeedback.xml" hash="17c534bde84cb48501e06bc64eb73a92"/></dir><dir name="template"><dir name="fancyfeedback"><file name="fancyfeedback.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="WebspeaksFeedback_Fancyfeedback.xml" hash="257bf9c32ee26ef94a05e856846e998d"/></dir></target><target name="magelocal"><dir name="WebspeaksFeedback"><dir name="Fancyfeedback"><dir name="Block"><file name="Fancyfeedback.php" hash="d02b3f93ba6ee94bc74b54ef25046fd9"/><file name="Fancyfeedbacksettings.php" hash="f04fc609ce337105787dcbb256c636eb"/><dir name="Adminhtml"><file name="Fancyfeedback.php" hash="cf620a2b1f3113946638c20fb6ad3e41"/><file name="Fancyfeedbacksettings.php" hash="52706a0cb59be12f73cc5e8d8792543a"/><dir name="Fancyfeedback"><file name="Edit.php" hash="9f86528100061fd986763966d3bc0e75"/><file name="Grid.php" hash="c5bce27e2cee5d1ca0ead9f4cdef94d7"/><dir name="Edit"><file name="Form.php" hash="4b428d7015b1b30797cb238a48635e96"/><file name="Tabs.php" hash="343574517ed6498b3fd774e37856b4f7"/><dir name="Tab"><file name="Form.php" hash="339e16730e24adbe7c507a532a76e973"/></dir></dir></dir><dir name="Fancyfeedbacksettings"><file name="Edit.php" hash="2da6ba8586c5ae7b16d823551f581786"/><file name="Grid.php" hash="ae6d02768f3914c6a19d1397effe8077"/><dir name="Edit"><file name="Form.php" hash="dd2cbef4a22f03a1678d9e0eb7406cd3"/><file name="Tabs.php" hash="d7b8374aa1a7bee3ece8f1e70d2521a6"/><dir name="Tab"><file name="Form.php" hash="1a3fae0d48a7d911b704f88e5b66eede"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="00c3aaa2a4085f506850960e3d83fd49"/><dir name="Adminhtml"><file name="FancyfeedbackController.php" hash="e642bdf0842e42461e61659946f3ab92"/><file name="FancyfeedbacksettingsController.php" hash="2d5ce7b4d6a5a96fa6b847ee78e1643b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="f474b64ecee5a0c40deb8fae6a65b90e"/><file name="config.xml" hash="bd6629862ea5ecc50c1a76d55279abaf"/><file name="system.xml" hash="60190e2b1846d3ebbc58dbd2ed36690a"/></dir><dir name="Helper"><file name="Data.php" hash="b740042b28249ba9ad094aec306a595e"/></dir><dir name="Model"><file name="Fancyfeedback.php" hash="5b7c332074e592ed84f4d1ecd43495e9"/><file name="Fancyfeedbacksettings.php" hash="0b7f8532742919d1f058d7bc7ba9f7b5"/><file name="Status.php" hash="2abfc9c042beba1ca72f700731f97097"/><dir name="Mysql4"><file name="Fancyfeedback.php" hash="d941d2fa2dfcfc130ab198057ad2ed9d"/><file name="Fancyfeedbacksettings.php" hash="2345af5cd69086b36e727b5404b47a22"/><dir name="Fancyfeedback"><file name="Collection.php" hash="c50573841e863124f474e492225cb11c"/></dir><dir name="Fancyfeedbacksettings"><file name="Collection.php" hash="e2becf3a961c00f105a28bba24ef708a"/></dir></dir></dir><dir name="sql"><dir name="fancyfeedbacksettings_setup"><file name="mysql4-install-0.1.0.php" hash="bf4179597e398cb8609e68760e2f3991"/></dir><dir name="fancyfeedback_setup"><file name="mysql4-install-0.1.0.php" hash="26912548fc55ec16d36db173e62d7435"/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>
skin/frontend/default/default/css/fancyfeedback/style.css ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #feedback{
2
+ width: 362px;
3
+ padding: 10px 0px 10px 10px;
4
+ /*position: absolute;
5
+ top: 100px;
6
+ display: block;*/
7
+ }
8
+ #feedback .formdiv{
9
+ width: 300px;
10
+ float: left;
11
+ background-color: #6f115c;
12
+ padding: 0px 5px 5px 5px;
13
+ -moz-border-radius-bottomright: 6px;
14
+ -moz-border-radius-bottomleft: 6px;
15
+ border-bottom-right-radius:6px;
16
+ border-bottom-left-radius:6px;
17
+ min-height:100px;
18
+ display:none;
19
+ }
20
+ #feedback label{
21
+ font:bold 11px arial;
22
+ color: #febaf9;
23
+ }
24
+ #feedback textarea{
25
+ width: 290px;
26
+ height: 100px;
27
+ color: #fcd1f2;
28
+ font: normal 11px verdana;
29
+ border: none;
30
+ padding: 5px;
31
+ background-color: #943080;
32
+ -moz-box-shadow: inset 1px 1px 1px #4c0b3f;
33
+ -webkit-box-shadow: inset 1px 1px 1px #4c0b3f;
34
+ resize: none; /* disable extending textarea in chrome */
35
+ }
36
+ #feedback input[type="text"]{
37
+ color: #606060;
38
+ font: normal 11px verdana;
39
+ padding: 3px;
40
+ width: 200px;
41
+ height: 25px;
42
+ border: none;
43
+ color: #fcd1f2;
44
+ -moz-border-radius: 4px;
45
+ -webkit-border-radius: 4px;
46
+ background-color: #943080;
47
+ -moz-box-shadow: inset 1px 1px 1px #4c0b3f;
48
+ -webkit-box-shadow: inset 1px 1px 1px #4c0b3f;
49
+ }
50
+ #feedback input[type="submit"]{
51
+ background-color: #ffaffa;
52
+ border: none;
53
+ color: #6f115c;
54
+ font:bold 11px arial;
55
+ padding: 2px 6px;
56
+ -moz-border-radius: 8px;
57
+ -webkit-border-radius: 8px;
58
+ cursor: pointer;
59
+ }
60
+ #feedback .left_btn,#feedback .right_btn{
61
+ width: 26px;
62
+ height: 100px;
63
+ float: left;
64
+ cursor: pointer;
65
+ }
66
+
67
+ #feedback .feed_close{
68
+ cursor: pointer;
69
+ margin:-10px -5px 0px 0px;
70
+ float:right;
71
+ }
72
+ #error{
73
+ color:#fff;
74
+ padding:4px;
75
+ font-size:11px;
76
+ font-weight:bold;
77
+ }
skin/frontend/default/default/images/fancyfeedback/feed_close_btn.png ADDED
Binary file
skin/frontend/default/default/images/fancyfeedback/feed_left_btn.png ADDED
Binary file
skin/frontend/default/default/images/fancyfeedback/feed_right_btn.png ADDED
Binary file
skin/frontend/default/default/js/fancyfeedback/feedback.js ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $.noConflict();
2
+ $(document).ready(function()
3
+ {
4
+ $('.right_btn').click(function()
5
+ {
6
+ $('#feedback .formdiv').show();
7
+ $('#feedback_holder').animate({right: '-26px'}, 400).animate({right: '-140px'}, 400).animate({right: '-26px'}, 300);
8
+ });
9
+
10
+ $('.feed_close').click(function()
11
+ {
12
+ $('#feedback_holder').animate({right: '50px'}, 300).animate({right: '-336px'}, 300, function(){
13
+ $('#feedback .formdiv').hide();
14
+ });
15
+ });
16
+
17
+ $('#submit_btn').click(function()
18
+ {
19
+ var url = $('#url').val();
20
+ var name = $('#name').val();
21
+ var email = $('#email').val();
22
+ var msg = $('#msg').val();
23
+ if(name.length>0 && email.length>0 && msg.length>0)
24
+ {
25
+ if(validate_email(email))
26
+ {
27
+ $('#submit_btn').attr('disabled','disabled');
28
+ $('#error').html('Submitting your feedback...');
29
+ $.getJSON(url, {'name' : name, 'email':email, 'msg':msg}, parseInfo);
30
+ }
31
+ else
32
+ {
33
+ $('#error').html('<span style="color:red">Your email seems to be invalid!</span>');
34
+ }
35
+ }
36
+ else
37
+ {
38
+ $('#error').html('Please enter some thing.');
39
+ $('#submit_btn').removeAttr('disabled');
40
+ }
41
+ return false;
42
+ });
43
+
44
+ function parseInfo(data)
45
+ {
46
+ $('#name').val('');
47
+ $('#email').val('');
48
+ $('#msg').val('');
49
+ $('#error').html(data.value);
50
+ $('#submit_btn').removeAttr('disabled');
51
+ }
52
+ function validate_email(str)
53
+ {
54
+ return /^([\w-_.]+)(\.[\w-_.]+)*@([\w\-]+)(\.[\w]{2,7})(\.[a-z]{2})?$/i.test(str);
55
+ }
56
+
57
+ });