Jextn_Testimonials - Version 0.1.0

Version Notes

Release from magento 1.5.x, 1.4.x, 1.3.x versions

Download this release

Release Info

Developer Magento Core Team
Extension Jextn_Testimonials
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (29) hide show
  1. app/code/community/Jextn/Testimonials/Block/Adminhtml/Testimonials.php +16 -0
  2. app/code/community/Jextn/Testimonials/Block/Adminhtml/Testimonials/Edit.php +45 -0
  3. app/code/community/Jextn/Testimonials/Block/Adminhtml/Testimonials/Edit/Form.php +19 -0
  4. app/code/community/Jextn/Testimonials/Block/Adminhtml/Testimonials/Edit/Tab/Form.php +77 -0
  5. app/code/community/Jextn/Testimonials/Block/Adminhtml/Testimonials/Edit/Tabs.php +24 -0
  6. app/code/community/Jextn/Testimonials/Block/Adminhtml/Testimonials/Grid.php +146 -0
  7. app/code/community/Jextn/Testimonials/Block/Testimonials.php +29 -0
  8. app/code/community/Jextn/Testimonials/Helper/Data.php +34 -0
  9. app/code/community/Jextn/Testimonials/Model/Mysql4/Testimonials.php +10 -0
  10. app/code/community/Jextn/Testimonials/Model/Mysql4/Testimonials/Collection.php +20 -0
  11. app/code/community/Jextn/Testimonials/Model/Status.php +15 -0
  12. app/code/community/Jextn/Testimonials/Model/System/Config/Source/Yesno.php +47 -0
  13. app/code/community/Jextn/Testimonials/Model/Testimonials.php +11 -0
  14. app/code/community/Jextn/Testimonials/controllers/Adminhtml/TestimonialsController.php +196 -0
  15. app/code/community/Jextn/Testimonials/controllers/IndexController.php +12 -0
  16. app/code/community/Jextn/Testimonials/controllers/SubmitController.php +87 -0
  17. app/code/community/Jextn/Testimonials/etc/config.xml +129 -0
  18. app/code/community/Jextn/Testimonials/etc/system.xml +75 -0
  19. app/code/community/Jextn/Testimonials/sql/testimonials_setup/mysql4-install-0.1.0.php +23 -0
  20. app/design/adminhtml/default/default/layout/testimonials.xml +8 -0
  21. app/design/frontend/default/default/layout/testimonials.xml +28 -0
  22. app/design/frontend/default/default/template/testimonials/form.phtml +64 -0
  23. app/design/frontend/default/default/template/testimonials/sidebar.phtml +28 -0
  24. app/design/frontend/default/default/template/testimonials/testimonials.phtml +17 -0
  25. app/etc/modules/Jextn_Testimonials.xml +9 -0
  26. package.xml +22 -0
  27. skin/frontend/default/default/css/testimonials.css +34 -0
  28. skin/frontend/default/default/images/icon-testi.png +0 -0
  29. skin/frontend/default/default/js/carousel-min.js +25 -0
app/code/community/Jextn/Testimonials/Block/Adminhtml/Testimonials.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jextn_Testimonials_Block_Adminhtml_Testimonials extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_testimonials';
7
+ $this->_blockGroup = 'testimonials';
8
+ $this->_headerText = Mage::helper('testimonials')->__('Testimonials Manager');
9
+ $this->_addButtonLabel = Mage::helper('testimonials')->__('Add Testimonial');
10
+ parent::__construct();
11
+ }
12
+ public function getHeaderCssClass()
13
+ {
14
+ return '';
15
+ }
16
+ }
app/code/community/Jextn/Testimonials/Block/Adminhtml/Testimonials/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jextn_Testimonials_Block_Adminhtml_Testimonials_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 = 'testimonials';
11
+ $this->_controller = 'adminhtml_testimonials';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('testimonials')->__('Save Testimonial'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('testimonials')->__('Delete Testimonial'));
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('testimonials_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'testimonials_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'testimonials_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('testimonials_data') && Mage::registry('testimonials_data')->getId() ) {
40
+ return Mage::helper('testimonials')->__("Edit Testimonial for '%s'", $this->htmlEscape(Mage::registry('testimonials_data')->getName()));
41
+ } else {
42
+ return Mage::helper('testimonials')->__('Add Testimonial');
43
+ }
44
+ }
45
+ }
app/code/community/Jextn/Testimonials/Block/Adminhtml/Testimonials/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jextn_Testimonials_Block_Adminhtml_Testimonials_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/community/Jextn/Testimonials/Block/Adminhtml/Testimonials/Edit/Tab/Form.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jextn_Testimonials_Block_Adminhtml_Testimonials_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('testimonials_form', array('legend'=>Mage::helper('testimonials')->__('Item information')));
10
+
11
+ $fieldset->addField('name', 'text', array(
12
+ 'label' => Mage::helper('testimonials')->__('Name'),
13
+ 'class' => 'required-entry',
14
+ 'required' => true,
15
+ 'name' => 'name',
16
+ ));
17
+ $fieldset->addField('email', 'text', array(
18
+ 'label' => Mage::helper('testimonials')->__('Email'),
19
+ 'class' => 'required-entry',
20
+ 'required' => true,
21
+ 'name' => 'email',
22
+ ));
23
+ $fieldset->addField('url', 'text', array(
24
+ 'label' => Mage::helper('testimonials')->__('URL'),
25
+ 'required' => false,
26
+ 'name' => 'url',
27
+ ));
28
+
29
+ $fieldset->addField('status', 'select', array(
30
+ 'label' => Mage::helper('testimonials')->__('Status'),
31
+ 'name' => 'status',
32
+ 'values' => array(
33
+ array(
34
+ 'value' => 1,
35
+ 'label' => Mage::helper('testimonials')->__('Approved'),
36
+ ),
37
+
38
+ array(
39
+ 'value' => 2,
40
+ 'label' => Mage::helper('testimonials')->__('Pending'),
41
+ ),
42
+ ),
43
+ ));
44
+ $fieldset->addField('sidebar', 'select', array(
45
+ 'label' => Mage::helper('testimonials')->__('Side bar display'),
46
+ 'name' => 'sidebar',
47
+ 'values' => array(
48
+ array(
49
+ 'value' => 1,
50
+ 'label' => Mage::helper('testimonials')->__('yes'),
51
+ ),
52
+
53
+ array(
54
+ 'value' => 0,
55
+ 'label' => Mage::helper('testimonials')->__('No'),
56
+ ),
57
+ ),
58
+ ));
59
+ $fieldset->addField('content', 'editor', array(
60
+ 'name' => 'content',
61
+ 'label' => Mage::helper('testimonials')->__('Testimonial Content'),
62
+ 'title' => Mage::helper('testimonials')->__('Testimonial Content'),
63
+ 'style' => 'width:700px; height:200px;',
64
+ 'wysiwyg' => false,
65
+ 'required' => true,
66
+ ));
67
+
68
+ if ( Mage::getSingleton('adminhtml/session')->getTestimonialsData() )
69
+ {
70
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getTestimonialsData());
71
+ Mage::getSingleton('adminhtml/session')->setTestimonialsData(null);
72
+ } elseif ( Mage::registry('testimonials_data') ) {
73
+ $form->setValues(Mage::registry('testimonials_data')->getData());
74
+ }
75
+ return parent::_prepareForm();
76
+ }
77
+ }
app/code/community/Jextn/Testimonials/Block/Adminhtml/Testimonials/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jextn_Testimonials_Block_Adminhtml_Testimonials_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('testimonials_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('testimonials')->__('Testimonial Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('testimonials')->__('Testimonial Information'),
18
+ 'title' => Mage::helper('testimonials')->__('Testimonial Information'),
19
+ 'content' => $this->getLayout()->createBlock('testimonials/adminhtml_testimonials_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/community/Jextn/Testimonials/Block/Adminhtml/Testimonials/Grid.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jextn_Testimonials_Block_Adminhtml_Testimonials_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('testimonialsGrid');
9
+ $this->setDefaultSort('testimonials_id');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('testimonials/testimonials')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('testimonials_id', array(
24
+ 'header' => Mage::helper('testimonials')->__('ID'),
25
+ 'align' =>'right',
26
+ 'width' => '50px',
27
+ 'index' => 'testimonials_id',
28
+ ));
29
+
30
+ $this->addColumn('name', array(
31
+ 'header' => Mage::helper('testimonials')->__('Name'),
32
+ 'align' =>'left',
33
+ 'index' => 'name',
34
+ ));
35
+ $this->addColumn('sidebar', array(
36
+ 'header' => Mage::helper('testimonials')->__('Sidebar'),
37
+ 'align' => 'left',
38
+ 'width' => '80px',
39
+ 'index' => 'sidebar',
40
+ 'type' => 'options',
41
+ 'options' => array(
42
+ 1 => 'Yes',
43
+ 0 => 'No',
44
+ ),
45
+ ));
46
+
47
+ $this->addColumn('status', array(
48
+ 'header' => Mage::helper('testimonials')->__('Status'),
49
+ 'align' => 'left',
50
+ 'width' => '80px',
51
+ 'index' => 'status',
52
+ 'type' => 'options',
53
+ 'options' => array(
54
+ 1 => 'Approved',
55
+ 2 => 'Pending',
56
+ ),
57
+ ));
58
+ $this->addColumn('created_time', array(
59
+ 'header' => Mage::helper('cms')->__('Date Created'),
60
+ 'index' => 'created_time',
61
+ 'width' => '150px',
62
+ 'type' => 'datetime',
63
+ ));
64
+ $this->addColumn('update_time', array(
65
+ 'header' => Mage::helper('cms')->__('Last Modified'),
66
+ 'index' => 'update_time',
67
+ 'width' => '150px',
68
+ 'type' => 'datetime',
69
+ ));
70
+ $this->addColumn('action',
71
+ array(
72
+ 'header' => Mage::helper('testimonials')->__('Action'),
73
+ 'width' => '100',
74
+ 'type' => 'action',
75
+ 'getter' => 'getId',
76
+ 'actions' => array(
77
+ array(
78
+ 'caption' => Mage::helper('testimonials')->__('Edit'),
79
+ 'url' => array('base'=> '*/*/edit'),
80
+ 'field' => 'id'
81
+ )
82
+ ),
83
+ 'filter' => false,
84
+ 'sortable' => false,
85
+ 'index' => 'stores',
86
+ 'is_system' => true,
87
+ ));
88
+
89
+
90
+ return parent::_prepareColumns();
91
+ }
92
+ protected function _afterToHtml($html)
93
+ {
94
+ return parent::_afterToHtml($html). $this->_appendHtml();
95
+ }
96
+ private function _appendHtml()
97
+ {
98
+ $html=
99
+ '
100
+ <style type="text/css">
101
+ <!--
102
+ #jextn-href { text-align:right; font-size:9px; }
103
+ #jextn-href a{ text-decoration:none; color:#2F2F2F; }
104
+ #jextn-href a:hover { text-decoration:none; }
105
+ -->
106
+ </style>
107
+ <div id="jextn-href">Community version of Testimonials - Jextn <a href="'.$this->_jextnUrl.'" title="Magento Themes" target="_blank">Magento Themes</a></div>
108
+ ';
109
+ return $html;
110
+ }
111
+ protected function _prepareMassaction()
112
+ {
113
+ $this->setMassactionIdField('testimonials_id');
114
+ $this->getMassactionBlock()->setFormFieldName('testimonials');
115
+
116
+ $this->getMassactionBlock()->addItem('delete', array(
117
+ 'label' => Mage::helper('testimonials')->__('Delete'),
118
+ 'url' => $this->getUrl('*/*/massDelete'),
119
+ 'confirm' => Mage::helper('testimonials')->__('Are you sure?')
120
+ ));
121
+
122
+ $statuses = Mage::getSingleton('testimonials/status')->getOptionArray();
123
+
124
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
125
+ $this->getMassactionBlock()->addItem('status', array(
126
+ 'label'=> Mage::helper('testimonials')->__('Change status'),
127
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
128
+ 'additional' => array(
129
+ 'visibility' => array(
130
+ 'name' => 'status',
131
+ 'type' => 'select',
132
+ 'class' => 'required-entry',
133
+ 'label' => Mage::helper('testimonials')->__('Status'),
134
+ 'values' => $statuses
135
+ )
136
+ )
137
+ ));
138
+ return $this;
139
+ }
140
+
141
+ public function getRowUrl($row)
142
+ {
143
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
144
+ }
145
+
146
+ }
app/code/community/Jextn/Testimonials/Block/Testimonials.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jextn_Testimonials_Block_Testimonials extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ $this->getLayout()->getBlock('head')->setTitle(Mage::helper('testimonials')->getTestimonialsTitle());
7
+ return parent::_prepareLayout();
8
+ }
9
+
10
+ public function getTestimonials()
11
+ {
12
+ $collection = Mage::getModel('testimonials/testimonials')->getCollection()
13
+ ->addIsActiveFilter();
14
+ return $collection;
15
+ }
16
+
17
+ public function getSidebarTestimonials()
18
+ {
19
+ $collection = Mage::getModel('testimonials/testimonials')->getCollection()
20
+ ->addSidebarFilter()
21
+ ->addIsActiveFilter();
22
+ return $collection;
23
+ }
24
+
25
+ public function getFormAction()
26
+ {
27
+ return $this->getUrl('testimonials/submit/post', array('_secure' => true));
28
+ }
29
+ }
app/code/community/Jextn/Testimonials/Helper/Data.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jextn_Testimonials_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ const XML_PATH_TITLE = 'testimonials/testimonials/title';
6
+ const XML_PATH_PUBKEY = 'testimonials/recaptcha/pubkey';
7
+ const XML_PATH_PRIVKEY = 'testimonials/recaptcha/privkey';
8
+ const XML_PATH_AUTOAPPROVED = 'testimonials/testimonials/autoapproved';
9
+
10
+ public function getTestimonialsTitle()
11
+ {
12
+ if(trim(Mage::getStoreConfig(self::XML_PATH_TITLE))==''){
13
+ $titletest = $this->__('Testimonials');
14
+ } else {
15
+ $titletest = Mage::getStoreConfig(self::XML_PATH_TITLE);
16
+ }
17
+ return $titletest;
18
+ }
19
+
20
+ public function getRecaptcha()
21
+ {
22
+ $recaptcha = new Zend_Service_ReCaptcha(Mage::getStoreConfig(self::XML_PATH_PUBKEY), Mage::getStoreConfig(self::XML_PATH_PRIVKEY));
23
+ return $recaptcha;
24
+ }
25
+ public function checkRecaptcha()
26
+ {
27
+ return trim(Mage::getStoreConfig(self::XML_PATH_PUBKEY));
28
+ }
29
+ public function getAutoApproved()
30
+ {
31
+ return Mage::getStoreConfig(self::XML_PATH_AUTOAPPROVED);
32
+ }
33
+
34
+ }
app/code/community/Jextn/Testimonials/Model/Mysql4/Testimonials.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jextn_Testimonials_Model_Mysql4_Testimonials extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the testimonials_id refers to the key field in your database table.
8
+ $this->_init('testimonials/testimonials', 'testimonials_id');
9
+ }
10
+ }
app/code/community/Jextn/Testimonials/Model/Mysql4/Testimonials/Collection.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jextn_Testimonials_Model_Mysql4_Testimonials_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('testimonials/testimonials');
9
+ }
10
+ public function addIsActiveFilter()
11
+ {
12
+ $this->addFilter('status', 1);
13
+ return $this;
14
+ }
15
+ public function addSidebarFilter()
16
+ {
17
+ $this->addFilter('sidebar', 1);
18
+ return $this;
19
+ }
20
+ }
app/code/community/Jextn/Testimonials/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jextn_Testimonials_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('testimonials')->__('Approved'),
12
+ self::STATUS_DISABLED => Mage::helper('testimonials')->__('Pending')
13
+ );
14
+ }
15
+ }
app/code/community/Jextn/Testimonials/Model/System/Config/Source/Yesno.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Used in creating options for Yes|No config value selection
29
+ *
30
+ */
31
+ class Jextn_Testimonials_Model_System_Config_Source_Yesno
32
+ {
33
+
34
+ /**
35
+ * Options getter
36
+ *
37
+ * @return array
38
+ */
39
+ public function toOptionArray()
40
+ {
41
+ return array(
42
+ array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('Yes')),
43
+ array('value' => 2, 'label'=>Mage::helper('adminhtml')->__('No')),
44
+ );
45
+ }
46
+
47
+ }
app/code/community/Jextn/Testimonials/Model/Testimonials.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jextn_Testimonials_Model_Testimonials extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('testimonials/testimonials');
9
+ }
10
+
11
+ }
app/code/community/Jextn/Testimonials/controllers/Adminhtml/TestimonialsController.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jextn_Testimonials_Adminhtml_TestimonialsController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('cms/testimonials')
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('testimonials/testimonials')->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('testimonials_data', $model);
30
+
31
+ $this->loadLayout();
32
+ $this->_setActiveMenu('cms/testimonials');
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('testimonials/adminhtml_testimonials_edit'))
40
+ ->_addLeft($this->getLayout()->createBlock('testimonials/adminhtml_testimonials_edit_tabs'));
41
+
42
+ $this->renderLayout();
43
+ } else {
44
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('testimonials')->__('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('testimonials/testimonials');
57
+ $model->setData($data)
58
+ ->setId($this->getRequest()->getParam('id'));
59
+
60
+ try {
61
+
62
+ if (! $model->getId()) {
63
+ $model->setCreatedTime(now());
64
+ }
65
+ $model->setUpdateTime(now());
66
+
67
+ $url = $data['url'];
68
+ if($url != '') {
69
+ $checkval = "http://";
70
+ $pos = strpos($url, $checkval);
71
+ if($pos === false){
72
+ $churl = $checkval.$url;
73
+ $model->setUrl($churl);
74
+ } else {
75
+ $model->setUrl($url);
76
+ }
77
+ }
78
+ $model->save();
79
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('testimonials')->__('Testimonial was successfully saved'));
80
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
81
+
82
+ if ($this->getRequest()->getParam('back')) {
83
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
84
+ return;
85
+ }
86
+ $this->_redirect('*/*/');
87
+ return;
88
+ } catch (Exception $e) {
89
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
90
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
91
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
92
+ return;
93
+ }
94
+ }
95
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('testimonials')->__('Unable to find item to save'));
96
+ $this->_redirect('*/*/');
97
+ }
98
+
99
+ public function deleteAction() {
100
+ if( $this->getRequest()->getParam('id') > 0 ) {
101
+ try {
102
+ $model = Mage::getModel('testimonials/testimonials');
103
+
104
+ $model->setId($this->getRequest()->getParam('id'))
105
+ ->delete();
106
+
107
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
108
+ $this->_redirect('*/*/');
109
+ } catch (Exception $e) {
110
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
111
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
112
+ }
113
+ }
114
+ $this->_redirect('*/*/');
115
+ }
116
+
117
+ public function massDeleteAction() {
118
+ $testimonialsIds = $this->getRequest()->getParam('testimonials');
119
+ if(!is_array($testimonialsIds)) {
120
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
121
+ } else {
122
+ try {
123
+ foreach ($testimonialsIds as $testimonialsId) {
124
+ $testimonials = Mage::getModel('testimonials/testimonials')->load($testimonialsId);
125
+ $testimonials->delete();
126
+ }
127
+ Mage::getSingleton('adminhtml/session')->addSuccess(
128
+ Mage::helper('adminhtml')->__(
129
+ 'Total of %d record(s) were successfully deleted', count($testimonialsIds)
130
+ )
131
+ );
132
+ } catch (Exception $e) {
133
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
134
+ }
135
+ }
136
+ $this->_redirect('*/*/index');
137
+ }
138
+
139
+ public function massStatusAction()
140
+ {
141
+ $testimonialsIds = $this->getRequest()->getParam('testimonials');
142
+ if(!is_array($testimonialsIds)) {
143
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
144
+ } else {
145
+ try {
146
+ foreach ($testimonialsIds as $testimonialsId) {
147
+ $testimonials = Mage::getSingleton('testimonials/testimonials')
148
+ ->load($testimonialsId)
149
+ ->setStatus($this->getRequest()->getParam('status'))
150
+ ->setIsMassupdate(true)
151
+ ->save();
152
+ }
153
+ $this->_getSession()->addSuccess(
154
+ $this->__('Total of %d record(s) were successfully updated', count($testimonialsIds))
155
+ );
156
+ } catch (Exception $e) {
157
+ $this->_getSession()->addError($e->getMessage());
158
+ }
159
+ }
160
+ $this->_redirect('*/*/index');
161
+ }
162
+
163
+ public function exportCsvAction()
164
+ {
165
+ $fileName = 'testimonials.csv';
166
+ $content = $this->getLayout()->createBlock('testimonials/adminhtml_testimonials_grid')
167
+ ->getCsv();
168
+
169
+ $this->_sendUploadResponse($fileName, $content);
170
+ }
171
+
172
+ public function exportXmlAction()
173
+ {
174
+ $fileName = 'testimonials.xml';
175
+ $content = $this->getLayout()->createBlock('testimonials/adminhtml_testimonials_grid')
176
+ ->getXml();
177
+
178
+ $this->_sendUploadResponse($fileName, $content);
179
+ }
180
+
181
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
182
+ {
183
+ $response = $this->getResponse();
184
+ $response->setHeader('HTTP/1.1 200 OK','');
185
+ $response->setHeader('Pragma', 'public', true);
186
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
187
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
188
+ $response->setHeader('Last-Modified', date('r'));
189
+ $response->setHeader('Accept-Ranges', 'bytes');
190
+ $response->setHeader('Content-Length', strlen($content));
191
+ $response->setHeader('Content-type', $contentType);
192
+ $response->setBody($content);
193
+ $response->sendResponse();
194
+ die;
195
+ }
196
+ }
app/code/community/Jextn/Testimonials/controllers/IndexController.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jextn_Testimonials_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+
7
+ $this->loadLayout();
8
+ $this->renderLayout();
9
+ }
10
+
11
+
12
+ }
app/code/community/Jextn/Testimonials/controllers/SubmitController.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jextn_Testimonials_SubmitController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+
7
+ $this->loadLayout();
8
+ $this->_initLayoutMessages('customer/session');
9
+ $this->_initLayoutMessages('catalog/session');
10
+ $this->renderLayout();
11
+ }
12
+
13
+ public function postAction()
14
+ {
15
+ $post = $this->getRequest()->getPost();
16
+ if ( $post ) {
17
+
18
+ $model = Mage::getModel('testimonials/testimonials');
19
+ $model->setData($post)
20
+ ->setId($this->getRequest()->getParam('id'));
21
+ try {
22
+ $error = false;
23
+
24
+ if (!Zend_Validate::is(trim($post['name']) , 'NotEmpty')) {
25
+ $error = true;
26
+ }
27
+ if (!Zend_Validate::is(trim($post['email']), 'EmailAddress')) {
28
+ $error = true;
29
+ }
30
+ if (!Zend_Validate::is(trim($post['content']) , 'NotEmpty')) {
31
+ $error = true;
32
+ }
33
+ // validate captcha!
34
+ $recaptcha = Mage::helper('testimonials')->getRecaptcha();
35
+
36
+ if(!empty($post["recaptcha_response_field"])) {
37
+ $result = $recaptcha->verify($post["recaptcha_challenge_field"], $post["recaptcha_response_field"]);
38
+
39
+ if(!$result->isValid()) { // failed validation
40
+ Mage::getSingleton('customer/session')->addError(Mage::helper('testimonials')->__('The reCAPTCHA wasn\'t entered correctly. Go back and try it again'));
41
+ $error = true;
42
+ }
43
+ }
44
+ else {
45
+ Mage::getSingleton('customer/session')->addError(Mage::helper('testimonials')->__('The reCAPTCHA wasn\'t entered correctly. Go back and try it again'));
46
+ $error = true;
47
+ }
48
+ if ($error) {
49
+ throw new Exception();
50
+ }
51
+ $url = $post['url'];
52
+ if($url != '') {
53
+ $checkval = "http://";
54
+ $pos = strpos($url, $checkval);
55
+ if($pos === false){
56
+ $churl = $checkval.$url;
57
+ $model->setUrl($churl);
58
+ } else {
59
+ $model->setUrl($url);
60
+ }
61
+ }
62
+ if (! $model->getId()) {
63
+ $model->setCreatedTime(now());
64
+ }
65
+ $model->setUpdateTime(now());
66
+
67
+ $model->save();
68
+ if(Mage::helper('testimonials')->getAutoApproved()== "0"){
69
+ Mage::getSingleton('customer/session')->addSuccess(Mage::helper('testimonials')->__('Your testimonial has been accepted for moderation.'));
70
+ } else {
71
+ Mage::getSingleton('customer/session')->addSuccess(Mage::helper('testimonials')->__('Your testimonial has been accepted.'));
72
+ }
73
+ $this->_redirect('*/*');
74
+
75
+ return;
76
+ } catch (Exception $e) {
77
+
78
+ Mage::getSingleton('customer/session')->addError(Mage::helper('testimonials')->__('Unable to submit your request. Please, try again later'));
79
+ $this->_redirect('*/*');
80
+ return;
81
+ }
82
+
83
+ } else {
84
+ $this->_redirect('*/*/');
85
+ }
86
+ }
87
+ }
app/code/community/Jextn/Testimonials/etc/config.xml ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Jextn_Testimonials>
5
+ <version>0.1.0</version>
6
+ </Jextn_Testimonials>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <testimonials>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Jextn_Testimonials</module>
14
+ <frontName>testimonials</frontName>
15
+ </args>
16
+ </testimonials>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <testimonials>
21
+ <file>testimonials.xml</file>
22
+ </testimonials>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <testimonials>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Jextn_Testimonials</module>
32
+ <frontName>testimonials</frontName>
33
+ </args>
34
+ </testimonials>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <menu>
39
+ <cms>
40
+ <children>
41
+ <testimonials module="testimonials">
42
+ <title>Testimonials</title>
43
+ <sort_order>71</sort_order>
44
+ <action>testimonials/adminhtml_testimonials</action>
45
+ </testimonials>
46
+ </children>
47
+ </cms>
48
+ </menu>
49
+ <acl>
50
+ <resources>
51
+ <all>
52
+ <title>Allow Everything</title>
53
+ </all>
54
+ <admin>
55
+ <children>
56
+ <Jextn_Testimonials>
57
+ <title>Testimonials Module</title>
58
+ <sort_order>10</sort_order>
59
+ </Jextn_Testimonials>
60
+ <system>
61
+ <children>
62
+ <config>
63
+ <children>
64
+ <testimonials>
65
+ <title>Testimonials</title>
66
+ </testimonials>
67
+ </children>
68
+ </config>
69
+ </children>
70
+ </system>
71
+ </children>
72
+ </admin>
73
+ </resources>
74
+ </acl>
75
+ <layout>
76
+ <updates>
77
+ <testimonials>
78
+ <file>testimonials.xml</file>
79
+ </testimonials>
80
+ </updates>
81
+ </layout>
82
+ </adminhtml>
83
+ <global>
84
+ <models>
85
+ <testimonials>
86
+ <class>Jextn_Testimonials_Model</class>
87
+ <resourceModel>testimonials_mysql4</resourceModel>
88
+ </testimonials>
89
+ <testimonials_mysql4>
90
+ <class>Jextn_Testimonials_Model_Mysql4</class>
91
+ <entities>
92
+ <testimonials>
93
+ <table>testimonials</table>
94
+ </testimonials>
95
+ </entities>
96
+ </testimonials_mysql4>
97
+ </models>
98
+ <resources>
99
+ <testimonials_setup>
100
+ <setup>
101
+ <module>Jextn_Testimonials</module>
102
+ </setup>
103
+ <connection>
104
+ <use>core_setup</use>
105
+ </connection>
106
+ </testimonials_setup>
107
+ <testimonials_write>
108
+ <connection>
109
+ <use>core_write</use>
110
+ </connection>
111
+ </testimonials_write>
112
+ <testimonials_read>
113
+ <connection>
114
+ <use>core_read</use>
115
+ </connection>
116
+ </testimonials_read>
117
+ </resources>
118
+ <blocks>
119
+ <testimonials>
120
+ <class>Jextn_Testimonials_Block</class>
121
+ </testimonials>
122
+ </blocks>
123
+ <helpers>
124
+ <testimonials>
125
+ <class>Jextn_Testimonials_Helper</class>
126
+ </testimonials>
127
+ </helpers>
128
+ </global>
129
+ </config>
app/code/community/Jextn/Testimonials/etc/system.xml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <tabs>
3
+ <jextn translate="label" module="testimonials">
4
+ <label>Jextn Modules</label>
5
+ <sort_order>100</sort_order>
6
+ </jextn>
7
+ </tabs>
8
+ <sections>
9
+ <testimonials translate="label" module="testimonials">
10
+ <label>Testimonials</label>
11
+ <tab>jextn</tab>
12
+ <frontend_type>text</frontend_type>
13
+ <sort_order>120</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <testimonials translate="label">
19
+ <label>Testimonials</label>
20
+ <frontend_type>text</frontend_type>
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
+ <title translate="label">
27
+ <label>Testimonials Title</label>
28
+ <frontend_type>text</frontend_type>
29
+ <sort_order>20</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ </title>
34
+ <autoapproved translate="label">
35
+ <label>Auto Approved</label>
36
+ <frontend_type>select</frontend_type>
37
+ <source_model>testimonials/system_config_source_yesno</source_model>
38
+ <sort_order>25</sort_order>
39
+ <show_in_default>2</show_in_default>
40
+ <show_in_website>2</show_in_website>
41
+ <show_in_store>2</show_in_store>
42
+ </autoapproved>
43
+ </fields>
44
+ </testimonials>
45
+ <recaptcha translate="label">
46
+ <label>Recaptcha</label>
47
+ <frontend_type>text</frontend_type>
48
+ <sort_order>20</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><![CDATA[<a href="http://www.google.com/recaptcha" target="_blank">Click here to sign up for recaptcha account</a>]]></comment>
53
+ <fields>
54
+ <pubkey translate="label">
55
+ <label>Public Key</label>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>20</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
+ </pubkey>
62
+ <privkey translate="label">
63
+ <label>Private Key</label>
64
+ <frontend_type>text</frontend_type>
65
+ <sort_order>25</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>1</show_in_store>
69
+ </privkey>
70
+ </fields>
71
+ </recaptcha>
72
+ </groups>
73
+ </testimonials>
74
+ </sections>
75
+ </config>
app/code/community/Jextn/Testimonials/sql/testimonials_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('testimonials')};
10
+ CREATE TABLE {$this->getTable('testimonials')} (
11
+ `testimonials_id` int(11) unsigned NOT NULL auto_increment,
12
+ `name` varchar(255) NOT NULL default '',
13
+ `email` varchar(150) NOT NULL default '',
14
+ `url` varchar(255) NOT NULL default '',
15
+ `content` text NOT NULL default '',
16
+ `status` smallint(6) NOT NULL default '2',
17
+ `sidebar` smallint(6) NOT NULL,
18
+ `created_time` datetime NULL,
19
+ `update_time` datetime NULL,
20
+ PRIMARY KEY (`testimonials_id`)
21
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
22
+
23
+ ");
app/design/adminhtml/default/default/layout/testimonials.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <testimonials_adminhtml_testimonials_index>
4
+ <reference name="content">
5
+ <block type="testimonials/adminhtml_testimonials" name="testimonials" />
6
+ </reference>
7
+ </testimonials_adminhtml_testimonials_index>
8
+ </layout>
app/design/frontend/default/default/layout/testimonials.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><stylesheet>css/testimonials.css</stylesheet></action>
6
+ <action method="addItem"><type>skin_js</type><name>js/carousel-min.js</name></action>
7
+ </reference>
8
+ <reference name="right">
9
+ <block type="testimonials/testimonials" name="testimonials.sidebar" template="testimonials/sidebar.phtml" />
10
+ </reference>
11
+ </default>
12
+ <testimonials_index_index>
13
+ <reference name="root">
14
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
15
+ </reference>
16
+ <reference name="content">
17
+ <block type="testimonials/testimonials" name="testimonials" template="testimonials/testimonials.phtml" />
18
+ </reference>
19
+ </testimonials_index_index>
20
+ <testimonials_submit_index>
21
+ <reference name="root">
22
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
23
+ </reference>
24
+ <reference name="content">
25
+ <block type="testimonials/testimonials" name="testimonials.form" template="testimonials/form.phtml" />
26
+ </reference>
27
+ </testimonials_submit_index>
28
+ </layout>
app/design/frontend/default/default/template/testimonials/form.phtml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
2
+ <div class="page-title">
3
+ <h1 style="float:left;"><?php echo Mage::helper('testimonials')->__('Testimonials') ?></h1>
4
+ <span style="float:right;"><a href="<?php echo $this->getUrl('testimonials'); ?>" title="<?php echo $this->__('View All Testimonials') ?>"><?php echo $this->__('View All Testimonials') ?></a></span>
5
+ </div>
6
+ <form action="<?php echo $this->getFormAction(); ?>" id="testimonialForm" method="post">
7
+ <div class="fieldset">
8
+ <h2 class="legend"><?php echo Mage::helper('testimonials')->__('Testimonial Information') ?></h2>
9
+ <ul class="form-list">
10
+ <li class="fields">
11
+ <div class="field">
12
+ <label for="name" class="required"><em>*</em><?php echo Mage::helper('testimonials')->__('Name') ?></label>
13
+ <div class="input-box">
14
+ <input name="name" id="name" title="<?php echo Mage::helper('testimonials')->__('Name') ?>" class="input-text required-entry" type="text" />
15
+ </div>
16
+ </div>
17
+ <div class="field">
18
+ <label for="email" class="required"><em>*</em><?php echo Mage::helper('testimonials')->__('Email') ?></label>
19
+ <div class="input-box">
20
+ <input name="email" id="email" title="<?php echo Mage::helper('testimonials')->__('Email') ?>" class="input-text required-entry validate-email" type="text" />
21
+ </div>
22
+ </div>
23
+ </li>
24
+ <li>
25
+ <div class="field">
26
+ <label for="url"><?php echo Mage::helper('testimonials')->__('Website URL( optional )') ?></label>
27
+ <div class="input-box">
28
+ <input name="url" id="url" title="<?php echo Mage::helper('testimonials')->__('Website URL') ?>" class="input-text" type="text" />
29
+ </div>
30
+ </div>
31
+ </li>
32
+ <li class="wide">
33
+ <label for="content" class="required"><em>*</em><?php echo Mage::helper('testimonials')->__('Your Testimonial') ?></label>
34
+ <div class="input-box">
35
+ <textarea name="content" id="content" title="<?php echo Mage::helper('testimonials')->__('Your Testimonial') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
36
+ </div>
37
+ </li>
38
+ <li>
39
+ <?php if(Mage::helper('testimonials')->checkRecaptcha()!= ''): ?>
40
+ <?php echo Mage::helper('testimonials')->getRecaptcha()->getHTML(); ?>
41
+ <?php else: ?>
42
+ <div>Please add recaptcha keys in testimonials configuration</div>
43
+ <script type="text/javascript">
44
+ Event.observe(window, 'load', function() {
45
+ $('testi-button').remove();
46
+ });
47
+ </script>
48
+ <?php endif; ?>
49
+ </li>
50
+ </ul>
51
+ </div>
52
+ <div class="buttons-set" id="testi-button">
53
+ <p class="required"><?php echo Mage::helper('testimonials')->__('* Required Fields') ?></p>
54
+ <input type="text" name="status" id="status" value="<?php echo Mage::helper('testimonials')->getAutoApproved(); ?>" style="display:none !important;" />
55
+ <button type="submit" title="<?php echo Mage::helper('testimonials')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('testimonials')->__('Submit') ?></span></span></button>
56
+ </div>
57
+ </form>
58
+ <div class="com-jextn">Community version of Testimonials - Jextn <a href="http://www.magento-themes.jextn.com">Magento Themes</a></div>
59
+ <script type="text/javascript">
60
+ //<![CDATA[
61
+ var testimonialForm = new VarienForm('testimonialForm', true);
62
+ //]]>
63
+ </script>
64
+
app/design/frontend/default/default/template/testimonials/sidebar.phtml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $cnt = count($this->getSidebarTestimonials()); ?>
2
+ <?php if($cnt > 0 ): ?>
3
+ <div class="block block-testimonials">
4
+ <div class="block-title">
5
+ <strong><span><?php echo $this->__('Testimonials') ?></span></strong>
6
+ </div>
7
+ <div class="block-content">
8
+
9
+
10
+ <div id="carousel-wrapper">
11
+ <div id="carousel-content">
12
+ <?php foreach ($this->getSidebarTestimonials() as $item): ?>
13
+ <div class="slide">
14
+ <p><?php echo '&ldquo;'.$item->getContent().'&rdquo;'; ?></p>
15
+ <div class="name"><?php echo $item->getName(); ?></div>
16
+ <span class="url"><a href="http://<?php echo $item->getUrl(); ?>"><?php echo $item->getUrl(); ?></a></span>
17
+ </div>
18
+ <?php endforeach; ?>
19
+ </div>
20
+ </div>
21
+ <script type="text/javascript">
22
+ new Carousel('carousel-wrapper', $$('#carousel-content .slide'), $$('a.carousel-control', 'a.carousel-jumper'), {auto:true, frequency :5, duration: 1, circular: true, effect: 'fade' });
23
+ </script>
24
+ <div style="float:right;"><a href="<?php echo $this->getUrl('testimonials'); ?>" title="<?php echo $this->__('View All Testimonials') ?>"><?php echo $this->__('View All Testimonials') ?></a></div>
25
+ </div>
26
+ </div>
27
+ <div style="clear:both;"></div>
28
+ <?php endif; ?>
app/design/frontend/default/default/template/testimonials/testimonials.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="testimonials">
2
+ <h4><?php echo $this->__('Testimonials') ?></h4>
3
+ <?php $cnt = count($this->getTestimonials()); ?>
4
+ <?php if($cnt > 0 ): ?>
5
+ <?php foreach ($this->getTestimonials() as $item): ?>
6
+ <div class="client" >
7
+ <p><?php echo '&ldquo;'.$item->getContent().'&rdquo;'; ?></p>
8
+ <div class="name"><?php echo $item->getName(); ?></div>
9
+ <span class="url"><a href="<?php echo $item->getUrl(); ?>"><?php echo $item->getUrl(); ?></a></span>
10
+ </div>
11
+ <?php endforeach; ?>
12
+ <?php else: ?>
13
+ <div>There is no testimonials here</div>
14
+ <?php endif; ?>
15
+ <div class="submit"><a href="<?php echo $this->getUrl('testimonials/submit'); ?>"><?php echo $this->__('Submit Your Testimonial') ?></a></div>
16
+ <div class="com-jextn">Community version of Testimonials - Jextn <a href="http://www.magento-themes.jextn.com">Magento Themes</a></div>
17
+ </div>
app/etc/modules/Jextn_Testimonials.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Jextn_Testimonials>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Jextn_Testimonials>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Jextn_Testimonials</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Jextn Testimonials Community Extension</summary>
10
+ <description>Adding testimonial by admin panel.&#xD;
11
+ Client to submit testimonial on frontend.&#xD;
12
+ Google recaptcha enabled in frontend and settings in testimonials configuration.&#xD;
13
+ Auto approved option in testimonials configuration.&#xD;
14
+ Fade effect support in sidebar testimonials.</description>
15
+ <notes>Release from magento 1.5.x, 1.4.x, 1.3.x versions</notes>
16
+ <authors><author><name>Jextn Themes</name><user>auto-converted</user><email>magento-support@jextn.com</email></author></authors>
17
+ <date>2011-06-27</date>
18
+ <time>12:26:04</time>
19
+ <contents><target name="magecommunity"><dir name="Jextn"><dir name="Testimonials"><dir name="Block"><dir name="Adminhtml"><dir name="Testimonials"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="55c62c5624290be60216dd27179736d0"/></dir><file name="Form.php" hash="b9d556d1ee060507a2fde023ec8bb213"/><file name="Tabs.php" hash="ca8c3e9b7cbbc15cd5d49c965beccd09"/></dir><file name="Edit.php" hash="f23992e03f07d1fefb331cf286ee80e2"/><file name="Grid.php" hash="3e340bb5764f995f17a1cd26769538e2"/></dir><file name="Testimonials.php" hash="dfebdba304ecc87a4c8709043d12dec7"/></dir><file name="Testimonials.php" hash="773b191fc069a5edb8eaf91500cdea91"/></dir><dir name="Helper"><file name="Data.php" hash="d23a34afaaeccd8db4df60e5ceb8fa78"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Testimonials"><file name="Collection.php" hash="7088eda135efb1e348b8b2ce0ea76e47"/></dir><file name="Testimonials.php" hash="99dcbc2087b3b94c363d8c3f06a26da0"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Yesno.php" hash="03b5be8a31ecfc6dfdb54676c1589292"/></dir></dir></dir><file name="Status.php" hash="0c713c1173f0a2e4dcdbbf71871903d2"/><file name="Testimonials.php" hash="18d0ec9447b0ba8416ec3ab333e6392c"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="TestimonialsController.php" hash="a4d74d183e2b3652e80a112780ae9596"/></dir><file name="IndexController.php" hash="377210e63b75c3a51b9a367282e5d583"/><file name="SubmitController.php" hash="be82977c93e67db7ac892dc993695b19"/></dir><dir name="etc"><file name="config.xml" hash="d464edaf115f1885512236bb9ba0c50f"/><file name="system.xml" hash="ade0823073a3702d639af5b38ffbde03"/></dir><dir name="sql"><dir name="testimonials_setup"><file name="mysql4-install-0.1.0.php" hash="7c114b9f662c023370a98116f7280d78"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Jextn_Testimonials.xml" hash="d03755f743e19482bcbbcd621b446806"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="testimonials.xml" hash="417e3bad9114b4df5acec6d134db380f"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="testimonials.xml" hash="a579e50ce79f8ef8167992cf76e6c951"/></dir><dir name="template"><dir name="testimonials"><file name="form.phtml" hash="bfd6dd4020ed03b673bfff53fcec1126"/><file name="sidebar.phtml" hash="4acadfbc7ffad8c94b4db8073a4636d0"/><file name="testimonials.phtml" hash="fa2b44df26eccdd1af1121a0c87b791d"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="testimonials.css" hash="43c760308509ec912c63e6addfbf903d"/></dir><dir name="images"><file name="icon-testi.png" hash="c1f1733ad53faf9c5ba2af14adf01be6"/></dir><dir name="js"><file name="carousel-min.js" hash="cfd7a8d08a6dca87e4211a400877716e"/></dir></dir></dir></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies/>
22
+ </package>
skin/frontend/default/default/css/testimonials.css ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #carousel-wrapper {
2
+ width: 188px;
3
+ overflow: hidden;
4
+ }
5
+ #carousel-content {
6
+ width: 1880px;
7
+ }
8
+ #carousel-content .slide {
9
+ float: left;
10
+ width: 188px;
11
+ }
12
+ .block-testimonials .block-title strong
13
+ {
14
+ background-image:url(../images/icon-testi.png);
15
+ background-position:0 0;
16
+ background-repeat:no-repeat;
17
+ padding-left:21px;
18
+ }
19
+ .block-testimonials .block-content {
20
+ background:#F8F7F5;
21
+ padding:5px;
22
+ }
23
+ .testimonials .client
24
+ {
25
+ margin:20px 0;
26
+ }
27
+ .testimonials .client .name {
28
+ font-weight:bold;
29
+ }
30
+ .testimonials .client p {
31
+ margin:0;
32
+ }
33
+ .testimonials .submit { text-align:right; }
34
+ .com-jextn { text-align:right; padding-top:5px; font-size:8px; }
skin/frontend/default/default/images/icon-testi.png ADDED
Binary file
skin/frontend/default/default/js/carousel-min.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2009 Victor Stanciu - http://www.victorstanciu.ro
3
+
4
+ Permission is hereby granted, free of charge, to any person
5
+ obtaining a copy of this software and associated documentation
6
+ files (the "Software"), to deal in the Software without
7
+ restriction, including without limitation the rights to use,
8
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the
10
+ Software is furnished to do so, subject to the following
11
+ conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
+ OTHER DEALINGS IN THE SOFTWARE.
24
+ */
25
+ eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('1C=19.1a(1D,{1b:7(c,d,e,f){4.o=t;4.h=$(c);4.8=d;4.k=e;4.5=F.G({p:1,1c:t,1d:3,q:1,1e:\'H-1E\',1f:\'H-1F\',I:\'H-1G\',J:\'H-1H\',r:t,v:K,w:\'1g\',S:\'T\'},f||{});6(4.5.w==\'L\'){4.5.r=K}4.8.1I(7(a,b){a.M=b});6(4.k){4.k.N(\'U\',\'V\',4.V.z(4))}6(4.5.v){4.h.U(\'1J\',4.v.1h(4)).U(\'1K\',4.v.1h(4))}6(4.5.1c){4.A()}6(4.5.1i){9 g=4.8.1L($(4.5.1i));6(g>(4.5.q-1)&&4.5.q>1){6(g>4.8.i-(4.5.q+1)){g=4.8.i-4.5.q}}4.l(4.8[g])}},V:7(a){4.B();9 b=a.1M(\'a\');6(!b.W(4.5.I)){6(b.W(4.5.1e)){1N("4."+b.1j+"()")}s 6(b.W(4.5.1f)){4.l(b.1j);6(4.5.J){4.k.N(\'1k\',4.5.J);b.1l(4.5.J)}}}4.X();a.B()},l:7(a){6(4.5.Y&&(Z 4.5.Y==\'7\')){4.5.Y()}4.10=4.m?4.m:4.8[0];4.m=$(a);9 b=4.h.1m();9 c=4.m.1m();6(4.o){4.o.1O()}1n(4.5.w){O\'L\':4.o=11 n.1o(4.h,{1p:1.0,1q:0,p:4.5.p,12:(7(){4.h.C=c[0]-b[0];4.h.D=c[1]-b[1];11 n.1o(4.h,{1p:0,1q:1.0,p:4.5.p,12:(7(){6(4.k){4.P()}6(4.5.u&&(Z 4.5.u==\'7\')){4.5.u()}}).z(4)})}).z(4)});Q;O\'1g\':1r:9 d;1n(4.5.S){O\'1s\':d=n.1t.1s;Q;O\'T\':1r:d=n.1t.T;Q}4.o=11 n.13(4.h,{p:4.5.p,x:(c[0]-b[0]),y:(c[1]-b[1]),S:d,12:(7(){6(4.k){4.P()}6(4.5.u&&(Z 4.5.u==\'7\')){4.5.u()}4.o=t}).z(4)});Q}R t},1u:7(){6(4.m){9 a=4.m.M;9 b=(a==0)?(4.5.r?4.8.i-1:0):a-1}s{9 b=(4.5.r?4.8.i-1:0)}6(b==(4.8.i-1)&&4.5.r&&4.5.w!=\'L\'){4.h.C=(4.8.i-1)*4.8.14().1P();4.h.D=(4.8.i-1)*4.8.14().1Q();b=4.8.i-2}4.l(4.8[b])},15:7(){6(4.m){9 a=4.m.M;9 b=(4.8.i-1==a)?(4.5.r?0:a):a+1}s{9 b=1}6(b==0&&4.5.r&&4.5.w!=\'L\'){4.h.C=0;4.h.D=0;b=1}6(b>4.8.i-(4.5.q+1)){b=4.8.i-4.5.q}4.l(4.8[b])},14:7(){4.l(4.8[0])},1R:7(){4.l(4.8[4.8.i-1])},1S:7(){6(4.10){4.l(4.8[4.10.M])}s{R t}},B:7(){6(4.E){1v(4.E)}},A:7(){4.16()},1T:7(){4.B();4.P()},1U:7(b){6(b){9 c=b.1V||b.1W;6(!c||(!4.8.1X(c)&&!4.8.1Y(7(a){R c.1Z(a)}))){4.A()}}s{4.A()}},16:7(){6(4.E!=20){1v(4.E);4.15()}4.E=21(4.16.z(4),4.5.1d*22)},v:7(a){a.23=K;a.B();9 b=0;6(!a){a=24.25}6(a.1w){b=a.1w/26}s 6(a.1x){b=-a.1x/3}6(!4.o){4.X();6(b>0){4.1u()}s{4.15()}}R 27.28(b)},X:7(){4.k.N(\'1l\',4.5.I)},P:7(){4.k.N(\'1k\',4.5.I)}});n.13=19.1a();F.G(F.G(n.13.1y,n.29.1y),{1b:7(a){4.j=$(a);9 b=F.G({x:0,y:0,1z:\'1A\'},2a[1]||{});4.A(b)},2b:7(){6(4.5.2c&&!4.j.1B){4.j.2d();4.j.1B=K;4.j.2e(4.j.2f)}4.17=4.j.C;4.18=4.j.D;6(4.5.1z==\'1A\'){4.5.x-=4.17;4.5.y-=4.18}},2g:7(a){4.j.C=4.5.x*a+4.17;4.j.D=4.5.y*a+4.18}});',62,141,'||||this|options|if|function|slides|var||||||||scroller|length|element|controls|moveTo|current|Effect|scrolling|duration|visibleSlides|circular|else|false|afterMove|wheel|effect|||bind|start|stop|scrollLeft|scrollTop|timer|Object|extend|carousel|disabledClassName|selectedClassName|true|fade|_index|invoke|case|activateControls|break|return|transition|sinoidal|observe|click|hasClassName|deactivateControls|beforeMove|typeof|previous|new|afterFinish|SmoothScroll|first|next|periodicallyUpdate|originalLeft|originalTop|Class|create|initialize|auto|frequency|controlClassName|jumperClassName|scroll|bindAsEventListener|initial|rel|removeClassName|addClassName|cumulativeOffset|switch|Opacity|from|to|default|spring|Transitions|prev|clearTimeout|wheelDelta|detail|prototype|mode|absolute|_ext|Carousel|Abstract|control|jumper|disabled|selected|each|mousewheel|DOMMouseScroll|indexOf|findElement|eval|cancel|getWidth|getHeight|last|toggle|pause|resume|relatedTarget|toElement|include|any|descendantOf|null|setTimeout|1000|cancelBubble|window|event|120|Math|round|Base|arguments|setup|continuous|cleanWhitespace|appendChild|firstChild|update'.split('|'),0,{}))