Apt_Testimonial - Version 1.0.0.0

Version Notes

Initial version

Download this release

Release Info

Developer prax Ahir
Extension Apt_Testimonial
Version 1.0.0.0
Comparing to
See all releases


Version 1.0.0.0

Files changed (42) hide show
  1. app/code/community/Apt/Testimonial/Block/Adminhtml/Testimonial.php +19 -0
  2. app/code/community/Apt/Testimonial/Block/Adminhtml/Testimonial/Edit.php +49 -0
  3. app/code/community/Apt/Testimonial/Block/Adminhtml/Testimonial/Edit/Form.php +175 -0
  4. app/code/community/Apt/Testimonial/Block/Adminhtml/Testimonial/Grid.php +124 -0
  5. app/code/community/Apt/Testimonial/Block/Testimonial.php +119 -0
  6. app/code/community/Apt/Testimonial/Helper/Data.php +150 -0
  7. app/code/community/Apt/Testimonial/Model/Mysql4/Testimonial.php +16 -0
  8. app/code/community/Apt/Testimonial/Model/Mysql4/Testimonial/Collection.php +18 -0
  9. app/code/community/Apt/Testimonial/Model/Status.php +15 -0
  10. app/code/community/Apt/Testimonial/Model/Testimonial.php +21 -0
  11. app/code/community/Apt/Testimonial/Model/system/Layout.php +17 -0
  12. app/code/community/Apt/Testimonial/controllers/Adminhtml/TestimonialController.php +249 -0
  13. app/code/community/Apt/Testimonial/controllers/IndexController.php +114 -0
  14. app/code/community/Apt/Testimonial/etc/adminhtml.xml +52 -0
  15. app/code/community/Apt/Testimonial/etc/config.xml +132 -0
  16. app/code/community/Apt/Testimonial/etc/system.xml +300 -0
  17. app/code/community/Apt/Testimonial/sql/testimonial_setup/mysql4-install-1.0.0.0.php +31 -0
  18. app/design/adminhtml/default/default/layout/apt/testimonial.xml +10 -0
  19. app/design/frontend/base/default/layout/apt/testimonial.xml +84 -0
  20. app/design/frontend/base/default/template/apt/page/html/head_custom.phtml +1 -0
  21. app/design/frontend/base/default/template/apt/testimonial/testimonials.phtml +192 -0
  22. app/design/frontend/base/default/template/apt/testimonial/testimonials_leftsidebar.phtml +65 -0
  23. app/design/frontend/base/default/template/apt/testimonial/testimonials_sidebar.phtml +63 -0
  24. app/etc/modules/Apt_Testimonial.xml +17 -0
  25. package.xml +18 -0
  26. skin/frontend/base/default/apt/testimonial/css/dd.css +64 -0
  27. skin/frontend/base/default/apt/testimonial/css/jquery.bxslider.css +208 -0
  28. skin/frontend/base/default/apt/testimonial/css/jquery.fancybox.css +274 -0
  29. skin/frontend/base/default/apt/testimonial/css/testimonial.css +133 -0
  30. skin/frontend/base/default/apt/testimonial/images/company_icon.png +0 -0
  31. skin/frontend/base/default/apt/testimonial/images/email_icon.png +0 -0
  32. skin/frontend/base/default/apt/testimonial/images/fancybox_overlay.png +0 -0
  33. skin/frontend/base/default/apt/testimonial/images/fancybox_sprite.png +0 -0
  34. skin/frontend/base/default/apt/testimonial/images/icon_top.png +0 -0
  35. skin/frontend/base/default/apt/testimonial/images/location_icon.png +0 -0
  36. skin/frontend/base/default/apt/testimonial/images/no-image.png +0 -0
  37. skin/frontend/base/default/apt/testimonial/images/quote-sml.png +0 -0
  38. skin/frontend/base/default/apt/testimonial/images/quote.png +0 -0
  39. skin/frontend/base/default/apt/testimonial/images/testi-sdw.png +0 -0
  40. skin/frontend/base/default/apt/testimonial/js/jquery.bxslider.min.js +10 -0
  41. skin/frontend/base/default/apt/testimonial/js/jquery.dd.min.js +11 -0
  42. skin/frontend/base/default/apt/testimonial/js/jquery.fancybox.js +46 -0
app/code/community/Apt/Testimonial/Block/Adminhtml/Testimonial.php ADDED
@@ -0,0 +1,19 @@
1
+ <?php
2
+ /**
3
+ *
4
+ * @package Apt_Testimonial
5
+ * @author Apt
6
+ */
7
+ class Apt_Testimonial_Block_Adminhtml_Testimonial extends Mage_Adminhtml_Block_Widget_Grid_Container
8
+ {
9
+
10
+ public function __construct()
11
+ {
12
+ $this->_controller = 'adminhtml_testimonial';
13
+ $this->_blockGroup = 'testimonial';
14
+ $this->_headerText = Mage::helper('testimonial')->__('Manage Testimonials');
15
+ $this->_addButtonLabel = Mage::helper('testimonial')->__('Add New Testimonial');
16
+ parent::__construct();
17
+ }
18
+
19
+ }
app/code/community/Apt/Testimonial/Block/Adminhtml/Testimonial/Edit.php ADDED
@@ -0,0 +1,49 @@
1
+ <?php
2
+ /**
3
+ *
4
+ * @package Apt_Testimonial
5
+ * @author Apt
6
+ */
7
+ class Apt_Testimonial_Block_Adminhtml_Testimonial_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
8
+ {
9
+
10
+
11
+ public function __construct()
12
+ {
13
+ parent::__construct();
14
+
15
+ $this->_objectId = 'id';
16
+ $this->_blockGroup = 'testimonial';
17
+ $this->_controller = 'adminhtml_testimonial';
18
+
19
+ $this->_updateButton('save', 'label', Mage::helper('testimonial')->__('Save Testimonial'));
20
+ $this->_updateButton('delete', 'label', Mage::helper('testimonial')->__('Delete Testimonial'));
21
+ $this->_addButton('saveandcontinue', array(
22
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
23
+ 'onclick' => 'saveAndContinueEdit()',
24
+ 'class' => 'save',
25
+ ), -100);
26
+
27
+ $this->_formScripts[] = "
28
+ function saveAndContinueEdit(){
29
+ editForm.submit($('edit_form').action+'back/edit/');
30
+ }
31
+ ";
32
+
33
+ if( $this->getRequest()->getParam($this->_objectId) ) {
34
+ $model = Mage::getModel('testimonial/testimonial')->load($this->getRequest()->getParam($this->_objectId));
35
+ Mage::register('testimonial', $model);
36
+ }
37
+
38
+ }
39
+
40
+
41
+ public function getHeaderText()
42
+ {
43
+ if( Mage::registry('testimonial') && Mage::registry('testimonial')->getId() ) {
44
+ return Mage::helper('testimonial')->__('Edit Testimonial');
45
+ } else {
46
+ return Mage::helper('testimonial')->__('Add Testimonial');
47
+ }
48
+ }
49
+ }
app/code/community/Apt/Testimonial/Block/Adminhtml/Testimonial/Edit/Form.php ADDED
@@ -0,0 +1,175 @@
1
+ <?php
2
+ /**
3
+ *
4
+ * @package Apt_Testimonial
5
+ * @author Apt
6
+ */
7
+ class Apt_Testimonial_Block_Adminhtml_Testimonial_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
8
+ {
9
+
10
+
11
+ protected function _prepareLayout()
12
+ {
13
+ parent::_prepareLayout();
14
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
15
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
16
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
17
+ }
18
+ }
19
+
20
+
21
+ protected function _prepareForm()
22
+ {
23
+ $config = Mage::getSingleton('cms/wysiwyg_config')->getConfig(
24
+ array(
25
+ 'add_widgets' => false,
26
+ 'add_variables' => false,
27
+ 'add_images' => false,
28
+ 'files_browser_window_url'=> $this->getBaseUrl().'admin/cms_wysiwyg_images/index/',
29
+ ));
30
+ $helper = Mage::helper('testimonial');
31
+ $form = new Varien_Data_Form(array(
32
+ 'id' => 'edit_form',
33
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
34
+ 'method' => 'post',
35
+ 'enctype' => 'multipart/form-data'
36
+ ));
37
+
38
+ $fieldset = $form->addFieldset('testimonial_form', array(
39
+ 'legend' => Mage::helper('testimonial')->__('Testimonial'),
40
+ 'class' => 'fieldset-wide',
41
+ )
42
+ );
43
+
44
+ if($helper->isEnableContactName()){
45
+ $fieldset->addField('testimonial_name', 'text', array(
46
+ 'name' => 'testimonial_name',
47
+ 'label' => Mage::helper('testimonial')->__('Contact Name'),
48
+ 'class' => 'required-entry',
49
+ 'required' => true,
50
+ ));
51
+ }
52
+
53
+ if($helper->isEnableContactEmail()){
54
+ $fieldset->addField('testimonial_email', 'text', array(
55
+ 'name' => 'testimonial_email',
56
+ 'label' => Mage::helper('testimonial')->__('Contact Email'),
57
+ 'class' => 'required-entry validate-email',
58
+ 'required' => true,
59
+ ));
60
+ }
61
+
62
+ if($helper->isEnableCompanyname()){
63
+ $fieldset->addField('testimonial_companyname', 'text', array(
64
+ 'name' => 'testimonial_companyname',
65
+ 'label' => Mage::helper('testimonial')->__('Company Name'),
66
+ 'required' => false,
67
+ ));
68
+ }
69
+
70
+ if($helper->isEnableContactAddress()){
71
+ $fieldset->addField('testimonial_address', 'text', array(
72
+ 'name' => 'testimonial_address',
73
+ 'label' => Mage::helper('testimonial')->__('Location'),
74
+ 'required' => false,
75
+ ));
76
+ }
77
+
78
+ $fieldset->addField('testimonial_text', 'editor', array(
79
+ 'name' => 'testimonial_text',
80
+ 'label' => Mage::helper('testimonial')->__('Content'),
81
+ 'title' => Mage::helper('testimonial')->__('Content'),
82
+ 'style' => 'width:100%;height:300px;',
83
+ 'required' => true,
84
+ 'wysiwyg' => true,
85
+ 'required' => true,
86
+ 'config' => $config,
87
+
88
+ ));
89
+
90
+ if($helper->isEnableContactPhoto()){
91
+ $fieldset->addField('testimonial_img', 'image', array(
92
+ 'name' => 'testimonial_img',
93
+ 'label' => Mage::helper('testimonial')->__('Contact Photo'),
94
+ ));
95
+ }
96
+
97
+
98
+ $fieldset->addField('status', 'select', array(
99
+ 'label' => Mage::helper('testimonial')->__('Status'),
100
+ 'name' => 'status',
101
+ 'values' => array(
102
+ array(
103
+ 'value' => 1,
104
+ 'label' => Mage::helper('testimonial')->__('Enabled'),
105
+ ),
106
+
107
+ array(
108
+ 'value' => 2,
109
+ 'label' => Mage::helper('testimonial')->__('Disabled'),
110
+ ),
111
+ ),
112
+ ));
113
+ if (!Mage::app()->isSingleStoreMode()) {
114
+ $fieldset->addField('store_id', 'multiselect', array(
115
+ 'name' => 'stores[]',
116
+ 'label' => Mage::helper('testimonial')->__('Store View'),
117
+ 'title' => Mage::helper('testimonial')->__('Store View'),
118
+ 'required' => true,
119
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
120
+ ));
121
+ }
122
+ else {
123
+ $fieldset->addField('store_id', 'hidden', array(
124
+ 'name' => 'stores[]',
125
+ 'value' => Mage::app()->getStore(true)->getId()
126
+ ));
127
+ $model = Mage::getModel('testimonial/testimonial');
128
+ $model->setStoreId(Mage::app()->getStore(true)->getId());
129
+ }
130
+
131
+ if($helper->isEnableSidebar()){
132
+ $fieldset->addField('testimonial_sidebar', 'select', array(
133
+ 'label' => Mage::helper('testimonial')->__('Show in Sidebar'),
134
+ 'name' => 'testimonial_sidebar',
135
+ 'values' => array(
136
+ array(
137
+ 'value' => 1,
138
+ 'label' => Mage::helper('core')->__('Yes'),
139
+ ),
140
+ array(
141
+ 'value' => 0,
142
+ 'label' => Mage::helper('core')->__('No'),
143
+ ),
144
+ ),
145
+ ));
146
+ }
147
+ $fieldset->addField('testimonial_position', 'text', array(
148
+ 'name' => 'testimonial_position',
149
+ 'label' => Mage::helper('testimonial')->__('Position'),
150
+ 'style' => 'width:100px !important',
151
+ ));
152
+
153
+
154
+
155
+ $form->setUseContainer(true);
156
+ $this->setForm($form);
157
+
158
+
159
+ if ( Mage::getSingleton('adminhtml/session')->getTestimonial() )
160
+ {
161
+ $data = Mage::getSingleton('adminhtml/session')->getTestimonial();
162
+ Mage::getSingleton('adminhtml/session')->getTestimonial(null);
163
+ } elseif ( Mage::registry('testimonial') ) {
164
+ $data = Mage::registry('testimonial')->getData();
165
+ }
166
+ $data['store_id'] = explode(',',$data['stores']);
167
+ $form->setValues($data);
168
+
169
+
170
+
171
+
172
+ return parent::_prepareForm();
173
+ }
174
+
175
+ }
app/code/community/Apt/Testimonial/Block/Adminhtml/Testimonial/Grid.php ADDED
@@ -0,0 +1,124 @@
1
+ <?php
2
+ /**
3
+ *
4
+ * @package Apt_Testimonial
5
+ * @author Apt
6
+ */
7
+ class Apt_Testimonial_Block_Adminhtml_Testimonial_Grid extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+
10
+
11
+ public function __construct()
12
+ {
13
+ parent::__construct();
14
+ $this->setId('testimonialGrid');
15
+ $this->setDefaultSort('testimonial_position');
16
+ $this->setDefaultDir('DESC');
17
+ $this->setSaveParametersInSession(true);
18
+ }
19
+
20
+
21
+ protected function _prepareCollection()
22
+ {
23
+ $collection = Mage::getModel('testimonial/testimonial')->getCollection();
24
+ $this->setCollection($collection);
25
+ return parent::_prepareCollection();
26
+
27
+ }
28
+
29
+
30
+ protected function _prepareColumns()
31
+ {
32
+ $this->addColumn('testimonial_position', array(
33
+ 'header' => Mage::helper('testimonial')->__('Position'),
34
+ 'align' => 'right',
35
+ 'width' => '50px',
36
+ 'index' => 'testimonial_position',
37
+ 'type' => 'number',
38
+ ));
39
+
40
+ $this->addColumn('testimonial_name', array(
41
+ 'header' => Mage::helper('testimonial')->__('Name'),
42
+ 'align' => 'left',
43
+ 'index' => 'testimonial_name',
44
+ ));
45
+
46
+ $this->addColumn('testimonial_text', array(
47
+ 'header' => Mage::helper('testimonial')->__('Text'),
48
+ 'align' => 'left',
49
+ 'index' => 'testimonial_text',
50
+ ));
51
+
52
+ $this->addColumn('status', array(
53
+ 'header' => Mage::helper('testimonial')->__('Status'),
54
+ 'align' => 'left',
55
+ 'width' => '80px',
56
+ 'index' => 'status',
57
+ 'type' => 'options',
58
+ 'options' => array(
59
+ 1 => 'Enabled',
60
+ 2 => 'Disabled',
61
+ ),
62
+ ));
63
+
64
+ $this->addColumn('action',
65
+ array(
66
+ 'header' => Mage::helper('testimonial')->__('Action'),
67
+ 'width' => '100',
68
+ 'type' => 'action',
69
+ 'getter' => 'getId',
70
+ 'actions' => array(
71
+ array(
72
+ 'caption' => Mage::helper('testimonial')->__('Edit'),
73
+ 'url' => array('base'=> '*/*/edit'),
74
+ 'field' => 'id'
75
+ )
76
+ ),
77
+ 'filter' => false,
78
+ 'sortable' => false,
79
+ 'index' => 'stores',
80
+ 'is_system' => true,
81
+ ));
82
+
83
+ $this->addExportType('*/*/exportCsv', Mage::helper('testimonial')->__('CSV'));
84
+ $this->addExportType('*/*/exportXml', Mage::helper('testimonial')->__('XML'));
85
+
86
+ return parent::_prepareColumns();
87
+ }
88
+ protected function _prepareMassaction()
89
+ {
90
+ $this->setMassactionIdField('testimonial_id');
91
+ $this->getMassactionBlock()->setFormFieldName('testimonial');
92
+
93
+ $this->getMassactionBlock()->addItem('delete', array(
94
+ 'label' => Mage::helper('testimonial')->__('Delete'),
95
+ 'url' => $this->getUrl('*/*/massDelete'),
96
+ 'confirm' => Mage::helper('testimonial')->__('Are you sure?')
97
+ ));
98
+
99
+ $statuses = Mage::getSingleton('testimonial/status')->getOptionArray();
100
+
101
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
102
+ $this->getMassactionBlock()->addItem('status', array(
103
+ 'label'=> Mage::helper('testimonial')->__('Change status'),
104
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
105
+ 'additional' => array(
106
+ 'visibility' => array(
107
+ 'name' => 'status',
108
+ 'type' => 'select',
109
+ 'class' => 'required-entry',
110
+ 'label' => Mage::helper('testimonial')->__('Status'),
111
+ 'values' => $statuses
112
+ )
113
+ )
114
+ ));
115
+ return $this;
116
+ }
117
+
118
+
119
+ public function getRowUrl($row)
120
+ {
121
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
122
+ }
123
+
124
+ }
app/code/community/Apt/Testimonial/Block/Testimonial.php ADDED
@@ -0,0 +1,119 @@
1
+ <?php
2
+
3
+ class Apt_Testimonial_Block_Testimonial extends Mage_Core_Block_Template
4
+ {
5
+
6
+ /**
7
+ * Before rendering html, but after trying to load cache
8
+ *
9
+
10
+ */
11
+ public function __construct() {
12
+ parent::__construct();
13
+ $collection = Mage::getModel('testimonial/testimonial')->getCollection() // for collection
14
+ ->addFieldToFilter('status','1');
15
+ $this->setTestimonials($collection);
16
+ //var_dump((string)$collection->getSelect());
17
+
18
+ $this->setFormAction(Mage::getUrl('*/*/save'));
19
+ }
20
+
21
+ protected function _beforeToHtml()
22
+ {
23
+
24
+ $this->_prepareCollection();
25
+ return parent::_beforeToHtml();
26
+ }
27
+
28
+ /**
29
+ * Prepare testimonial collection object
30
+ *
31
+
32
+ */
33
+ protected function _prepareCollection()
34
+ {
35
+ $current_store = Mage::app()->getStore()->getId();
36
+ $configTestyBlockValue = Mage::getStoreConfig('testimonialsection/testisettings/testynumbers');
37
+ $configFeaturedTestyBlockValue = Mage::getStoreConfig('testimonialsection/testyblock/featuredtestynumbers');
38
+ $pagerEnable = Mage::getStoreConfig('testimonialsection/testisettings/allowpagination');
39
+ $collection = Mage::getModel("testimonial/testimonial")->getCollection()
40
+ ->addFieldToFilter('status','1');
41
+
42
+
43
+ /* echo '<pre>';
44
+ print_r(get_class_methods($collection));exit; */
45
+ if(!$this->getSidebar()) {
46
+ if($pagerEnable != 1){
47
+ if($configTestyBlockValue =='')
48
+ {
49
+ $collection->clear()->setPageSize(10);
50
+ }
51
+ else
52
+ {
53
+ $collection->clear()->setPageSize($configTestyBlockValue);
54
+ }
55
+ }
56
+ else{
57
+ $limit = $this->getRequest()->getParam('limit');
58
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'testimonials.pager');
59
+ //$pager->setAvailableLimit(array(6=>6,12=>12,20=>20));
60
+ if(!empty($limit))
61
+ {
62
+ $collection->clear()->setPageSize($limit);
63
+ $pager->setCollection($collection);
64
+ }
65
+ else
66
+ {
67
+ $collection->clear()->setPageSize(10);
68
+ $pager->setCollection($collection);
69
+ }
70
+ $this->setChild('pager', $pager);
71
+ }
72
+ }
73
+ if ($this->getSidebar()){
74
+ $collection->addFieldToFilter('testimonial_sidebar', '1');
75
+ if($configFeaturedTestyBlockValue ==''){
76
+ $collection->clear()->setPageSize(5);
77
+ }
78
+ else{
79
+ $collection->clear()->setPageSize($configFeaturedTestyBlockValue);
80
+ }
81
+ }
82
+ $collection->setOrder('testimonial_position', 'DESC')
83
+ ->load();
84
+
85
+ $testys = array();
86
+ foreach ($collection as $testy) {
87
+ $stores = explode(',',$testy->getStores());
88
+ if (in_array(0,$stores) || in_array($current_store,$stores))
89
+ //if ($banner->getStatus())
90
+ $testys[] = $testy;
91
+
92
+ }
93
+ $this->setTestimonials($testys);
94
+
95
+ return $this;
96
+ }
97
+
98
+ public function getPagerHtml()
99
+ {
100
+ return $this->getChildHtml('pager');
101
+ }
102
+
103
+
104
+ /**
105
+ * Setter for limit items per page
106
+ *
107
+ * @param int $limit
108
+ * @return Mage_Page_Block_Html_Pager
109
+ */
110
+ public function setLimit($limit)
111
+ {
112
+ $this->_limit = $limit;
113
+ return $this;
114
+ }
115
+
116
+
117
+
118
+
119
+ }
app/code/community/Apt/Testimonial/Helper/Data.php ADDED
@@ -0,0 +1,150 @@
1
+ <?php
2
+ /**
3
+ *
4
+ * @package Apt_Testimonial
5
+ * @author Apt
6
+ */
7
+ class Apt_Testimonial_Helper_Data extends Mage_Core_Helper_Abstract
8
+ {
9
+ const ROUTE_TESTIMONIAL = 'testimonials';
10
+
11
+ /**
12
+ * Get name of the extension
13
+ *
14
+ * @return string - name
15
+ */
16
+ public function getTranslatedExtensionName()
17
+ {
18
+ return $this->__('Testimonials');
19
+ }
20
+ public function getUserName()
21
+ {
22
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
23
+ return '';
24
+ }
25
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
26
+ return trim($customer->getName());
27
+ }
28
+
29
+ public function getUserEmail()
30
+ {
31
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
32
+ return '';
33
+ }
34
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
35
+ return $customer->getEmail();
36
+ }
37
+
38
+ public function getTitle()
39
+ {
40
+ $configTitleValue = Mage::getStoreConfig('testimonialsection/testisettings/title');
41
+ if ($configTitleValue=='') {
42
+ return 'Testimonials';
43
+ }
44
+ else{
45
+ return $configTitleValue;
46
+ }
47
+ }
48
+ public function getFeaturedTitle()
49
+ {
50
+ $configTitleValue = Mage::getStoreConfig('testimonialsection/testyblock/featuredtitle');
51
+ if ($configTitleValue=='') {
52
+ return 'Featured Testimonials';
53
+ }
54
+ else{
55
+ return $configTitleValue;
56
+ }
57
+ }
58
+ public function getStatusAprroval()
59
+ {
60
+ $configStatusAprroveValue = Mage::getStoreConfig('testimonialsection/testisettings/adminapproval');
61
+
62
+ $status ="";
63
+ if ($configStatusAprroveValue == 0) {
64
+ $status = 1;
65
+ return (int)$status;
66
+ }
67
+ else{
68
+ $status = 2;
69
+ return (int)$status;
70
+ }
71
+ }
72
+
73
+ public function getTestimonialUrl()
74
+ {
75
+ return $this->_getUrl(self::ROUTE_TESTIMONIAL);
76
+ }
77
+
78
+ public function resizeImage($imageName, $width=NULL, $height=NULL, $imagePath=NULL)
79
+ {
80
+ $imagePath = str_replace("/", DS, $imagePath);
81
+ $imagePathFull = Mage::getBaseDir('media') . DS . $imagePath . DS . $imageName;
82
+
83
+ if($width == NULL && $height == NULL) {
84
+ $width = 100;
85
+ $height = 100;
86
+ }
87
+ $resizePath = $width . 'x' . $height;
88
+ $resizePathFull = Mage::getBaseDir('media') . DS . $imagePath . DS . $resizePath . DS . $imageName;
89
+
90
+ if (file_exists($imagePathFull) && !file_exists($resizePathFull)) {
91
+ $imageObj = new Varien_Image($imagePathFull);
92
+ $imageObj->constrainOnly(TRUE);
93
+ $imageObj->keepAspectRatio(TRUE);
94
+ $imageObj->resize($width,$height);
95
+ $imageObj->save($resizePathFull);
96
+ }
97
+
98
+ $imagePath=str_replace(DS, "/", $imagePath);
99
+ return Mage::getBaseUrl("media") . $imagePath . "/" . $resizePath . "/" . $imageName;
100
+ }
101
+ public function isEnableContactName()
102
+ {
103
+ $configContactNameValue = Mage::getStoreConfig('testimonialsection/showhideform/contactname');
104
+ return $configContactNameValue;
105
+ }
106
+ public function isEnableCompanyname()
107
+ {
108
+ $configCompanyNameValue = Mage::getStoreConfig('testimonialsection/showhideform/companyname');
109
+ return $configCompanyNameValue;
110
+ }
111
+ public function isEnableContactEmail()
112
+ {
113
+ $configContactEmailValue = Mage::getStoreConfig('testimonialsection/showhideform/contactemail');
114
+ return $configContactEmailValue;
115
+ }
116
+
117
+ public function isEnableSidebar()
118
+ {
119
+ $configFeatueredValue = Mage::getStoreConfig('testimonialsection/testyblock/featured');
120
+ return $configFeatueredValue;
121
+ }
122
+ public function isEnableContactPhoto()
123
+ {
124
+ $configContactPhotoValue = Mage::getStoreConfig('testimonialsection/showhideform/contactphoto');
125
+ return $configContactPhotoValue;
126
+ }
127
+
128
+ public function isEnableContactAddress()
129
+ {
130
+ $configAddressValue = Mage::getStoreConfig('testimonialsection/showhideform/address');
131
+ return $configAddressValue;
132
+ }
133
+ public function isEnableFrontend()
134
+ {
135
+ $configEnableValue = Mage::getStoreConfig('testimonialsection/testisettings/activetesty');
136
+ return $configEnableValue;
137
+ }
138
+
139
+ public function isEnableGuest()
140
+ {
141
+ $enableguest = Mage::getStoreConfig('testimonialsection/testisettings/enableguest');
142
+ return $enableguest;
143
+ }
144
+
145
+
146
+
147
+
148
+
149
+
150
+ }
app/code/community/Apt/Testimonial/Model/Mysql4/Testimonial.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ *
4
+ * @package Apt_Testimonial
5
+ * @author Apt
6
+ */
7
+ class Apt_Testimonial_Model_Mysql4_Testimonial extends Mage_Core_Model_Mysql4_Abstract
8
+ {
9
+
10
+
11
+ public function _construct()
12
+ {
13
+ $this->_init('testimonial/testimonial', 'testimonial_id');
14
+ }
15
+
16
+ }
app/code/community/Apt/Testimonial/Model/Mysql4/Testimonial/Collection.php ADDED
@@ -0,0 +1,18 @@
1
+ <?php
2
+ /**
3
+ *
4
+ * @package Apt_Testimonial
5
+ * @author Apt
6
+ */
7
+
8
+ class Apt_Testimonial_Model_Mysql4_Testimonial_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
9
+ {
10
+
11
+
12
+ public function _construct()
13
+ {
14
+ parent::_construct();
15
+ $this->_init('testimonial/testimonial');
16
+ }
17
+
18
+ }
app/code/community/Apt/Testimonial/Model/Status.php ADDED
@@ -0,0 +1,15 @@
1
+ <?php
2
+
3
+ class Apt_Testimonial_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('testimonial')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('testimonial')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/community/Apt/Testimonial/Model/Testimonial.php ADDED
@@ -0,0 +1,21 @@
1
+ <?php
2
+ /**
3
+ *
4
+ * @package Apt_Testimonial
5
+ * @author Apt
6
+ */
7
+
8
+ class Apt_Testimonial_Model_Testimonial extends Mage_Core_Model_Abstract
9
+ {
10
+
11
+
12
+
13
+ public function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->_init('testimonial/testimonial');
17
+ }
18
+
19
+
20
+
21
+ }
app/code/community/Apt/Testimonial/Model/system/Layout.php ADDED
@@ -0,0 +1,17 @@
1
+ <?php
2
+
3
+ class Apt_Testimonial_Model_System_Layout
4
+ {
5
+ protected $_options;
6
+
7
+ public function toOptionArray()
8
+ {
9
+ if (!$this->_options) {
10
+ $this->_options = array(
11
+ array('value' => 1,'label' => Mage::helper('testimonial')->__('Right')),
12
+ array('value' => 0,'label' => Mage::helper('testimonial')->__('Left')),
13
+ );
14
+ }
15
+ return $this->_options;
16
+ }
17
+ }
app/code/community/Apt/Testimonial/controllers/Adminhtml/TestimonialController.php ADDED
@@ -0,0 +1,249 @@
1
+ <?php
2
+ /**
3
+ *
4
+ * @package Apt_Testimonial
5
+ * @author Apt
6
+ */
7
+ class Apt_Testimonial_Adminhtml_TestimonialController extends Mage_Adminhtml_Controller_Action
8
+ {
9
+
10
+
11
+ protected function _initAction()
12
+ {
13
+ $this->loadLayout();
14
+ $this->_setActiveMenu('apt/testimonial');
15
+ $this->_addBreadcrumb(Mage::helper('testimonial')->__('Testimonials'), Mage::helper('testimonial')->__('Testimonials'));
16
+ }
17
+
18
+ /**
19
+ * View grid action
20
+ */
21
+ public function indexAction()
22
+ {
23
+ $this->_initAction();
24
+ $this->renderLayout();
25
+ }
26
+
27
+ /**
28
+ * View edit form action
29
+ */
30
+ public function editAction()
31
+ {
32
+
33
+ $this->_initAction();
34
+ $this->_addContent($this->getLayout()->createBlock('testimonial/adminhtml_testimonial_edit'));
35
+ $this->renderLayout();
36
+ }
37
+
38
+ /**
39
+ * View new form action
40
+ */
41
+ public function newAction()
42
+ {
43
+ $this->editAction();
44
+ }
45
+
46
+
47
+ /**
48
+ * Save form action
49
+ */
50
+ public function saveAction()
51
+ {
52
+
53
+ if ($this->getRequest()->getPost()) {
54
+
55
+ try {
56
+ $data = $this->getRequest()->getPost();
57
+ $fileName = '';
58
+ if (isset($_FILES['testimonial_img']['name']) and (file_exists($_FILES['testimonial_img']['tmp_name']))) {
59
+ $baseDir = Mage::getBaseDir('media').DS.'testimonials';
60
+ $file = new Varien_Io_File();
61
+ mkdir($baseDir,0777);
62
+ $fileName = $_FILES['testimonial_img']['name'];
63
+ mysql_real_escape_string($fileName);
64
+ $tmp = explode(".",$fileName);
65
+ $fileName = time().uniqid().'.'.end($tmp);
66
+ $image_to_upload = "";
67
+ $uploader = new Varien_File_Uploader('testimonial_img');
68
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
69
+ $uploader->setAllowRenameFiles(false);
70
+ $uploader->setFilesDispersion(false);
71
+ $path = Mage::getBaseDir('media') . DS.'testimonials'.DS ;
72
+ $sitePath = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'testimonials';
73
+ $uploader->save($path, $fileName);
74
+ $data['testimonial_img'] = $sitePath.'/'.$fileName;
75
+ } else {
76
+
77
+ if(isset($data['testimonial_img']['delete']) && $data['testimonial_img']['delete'] == 1) {
78
+ $data['testimonial_img'] = '';
79
+ $path = Mage::getBaseDir('media') . DS . 'testimonials';
80
+ $model = Mage::getModel('testimonial/testimonial');
81
+ $resizeEndarray = explode("/",$model->load($this->getRequest()->getParam('id'))->getTestimonialImg());
82
+ unlink($path.'/'.end($resizeEndarray)); //delete it
83
+ } else {
84
+ unset($data['testimonial_img']);
85
+
86
+ }
87
+ }
88
+
89
+ $model = Mage::getModel('testimonial/testimonial');
90
+
91
+
92
+ $model->setData($data)->setTestimonialId($this->getRequest()->getParam('id'));
93
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
94
+ $model->setCreatedTime(now())
95
+ ->setUpdateTime(now());
96
+ } else {
97
+
98
+ $model->setUpdateTime(now());
99
+ }
100
+ $model->setStores(implode(',',$data['stores']));
101
+
102
+ $model->save();
103
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('testimonial')->__('Testimonial was successfully saved'));
104
+ if ($this->getRequest()->getParam('back')) {
105
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
106
+ return;
107
+ }
108
+ $this->_redirect('*/*/');
109
+ return;
110
+ } catch (Exception $e) {
111
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
112
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
113
+ return;
114
+ }
115
+ }
116
+
117
+ $this->_redirect('*/*/');
118
+ }
119
+
120
+ /**
121
+ * Delete action
122
+ */
123
+ public function deleteAction()
124
+ {
125
+ if ($this->getRequest()->getParam('id') > 0) {
126
+ try {
127
+ $model = Mage::getModel('testimonial/testimonial');
128
+ $imageId= $this->getRequest()->getParam('id');
129
+ $path = Mage::getBaseDir('media') . DS . 'testimonials';
130
+ $resizeEndarray = explode("/",$model->load($imageId)->getTestimonialImg());
131
+ unlink($path.'/'.end($resizeEndarray)); //delete it
132
+ $model->setTestimonialId($imageId)->delete();
133
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('testimonial')->__('Testimonial was successfully deleted'));
134
+ $this->_redirect('*/*/');
135
+ } catch (Exception $e) {
136
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
137
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
138
+ }
139
+ }
140
+
141
+ $this->_redirect('*/*/');
142
+ }
143
+
144
+ /**
145
+ * Check allow or not access to ths page
146
+ *
147
+ * @return bool - is allowed to access this menu
148
+ */
149
+ protected function _isAllowed()
150
+ {
151
+ return Mage::getSingleton('admin/session')->isAllowed('apt/testimonial');
152
+ }
153
+
154
+
155
+
156
+
157
+
158
+ public function massDeleteAction() {
159
+ $testimonialsIds = $this->getRequest()->getParam('testimonial');
160
+
161
+ if(!is_array($testimonialsIds)) {
162
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
163
+ } else {
164
+ try {
165
+
166
+ foreach ($testimonialsIds as $testimonialsId) {
167
+ $testimonials = Mage::getModel('testimonial/testimonial')->load($testimonialsId);
168
+ $path = Mage::getBaseDir('media') . DS . 'testimonials';
169
+ /* $filename = basename($testimonials->getTestimonialImg()); //get the filename
170
+ unlink($path.'/'.$filename); //delete it */
171
+ $resizeEndarray = explode("/",$testimonials->getTestimonialImg());
172
+ unlink($path.'/'.end($resizeEndarray)); //delete it
173
+ $testimonials->delete();
174
+ }
175
+
176
+ Mage::getSingleton('adminhtml/session')->addSuccess(
177
+ Mage::helper('adminhtml')->__(
178
+ 'Total of %d record(s) were successfully deleted', count($testimonialsIds)
179
+ )
180
+ );
181
+ } catch (Exception $e) {
182
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
183
+ }
184
+ }
185
+ $this->_redirect('*/*/index');
186
+ }
187
+
188
+ public function massStatusAction()
189
+ {
190
+ $testimonialsIds = $this->getRequest()->getParam('testimonial');
191
+ if(!is_array($testimonialsIds)) {
192
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
193
+ } else {
194
+ try {
195
+ foreach ($testimonialsIds as $testimonialsId) {
196
+ $testimonials = Mage::getSingleton('testimonial/testimonial')
197
+ ->load($testimonialsId)
198
+ ->setStatus($this->getRequest()->getParam('status'))
199
+ ->setIsMassupdate(true)
200
+ ->save();
201
+ }
202
+ $this->_getSession()->addSuccess(
203
+ $this->__('Total of %d record(s) were successfully updated', count($testimonialsIds))
204
+ );
205
+ } catch (Exception $e) {
206
+ $this->_getSession()->addError($e->getMessage());
207
+ }
208
+ }
209
+ $this->_redirect('*/*/index');
210
+ }
211
+
212
+ public function exportCsvAction()
213
+ {
214
+ $fileName = 'testimonial.csv';
215
+ $content = $this->getLayout()->createBlock('testimonial/adminhtml_testimonial_grid')
216
+ ->getCsv();
217
+
218
+ $this->_sendUploadResponse($fileName, $content);
219
+ }
220
+
221
+ public function exportXmlAction()
222
+ {
223
+ $fileName = 'testimonial.xml';
224
+ $content = $this->getLayout()->createBlock('testimonial/adminhtml_testimonial_grid')
225
+ ->getXml();
226
+
227
+ $this->_sendUploadResponse($fileName, $content);
228
+ }
229
+
230
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
231
+ {
232
+ $response = $this->getResponse();
233
+ $response->setHeader('HTTP/1.1 200 OK','');
234
+ $response->setHeader('Pragma', 'public', true);
235
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
236
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
237
+ $response->setHeader('Last-Modified', date('r'));
238
+ $response->setHeader('Accept-Ranges', 'bytes');
239
+ $response->setHeader('Content-Length', strlen($content));
240
+ $response->setHeader('Content-type', $contentType);
241
+ $response->setBody($content);
242
+ $response->sendResponse();
243
+ die;
244
+ }
245
+
246
+
247
+
248
+
249
+ }
app/code/community/Apt/Testimonial/controllers/IndexController.php ADDED
@@ -0,0 +1,114 @@
1
+ <?php
2
+ /**
3
+ *
4
+ * @package Apt_Testimonial
5
+ * @author Apt
6
+ */
7
+ class Apt_Testimonial_IndexController extends Mage_Core_Controller_Front_Action
8
+ {
9
+
10
+ const XML_PATH_EMAIL_SENDER = 'testimonialsection/testisettings/sender_email_identity';
11
+ const XML_PATH_EMAIL_TEMPLATE = 'testimonialsection/testisettings/email_template';
12
+ const XML_PATH_EMAIL_RECIPIENT = 'testimonialsection/testisettings/recipient';
13
+
14
+ public function indexAction()
15
+ {
16
+
17
+ $this->loadLayout();
18
+ $this->renderLayout();
19
+ }
20
+
21
+ public function saveAction()
22
+ {
23
+
24
+
25
+ if ($this->getRequest()->getPost()) {
26
+
27
+ try {
28
+ $data = $this->getRequest()->getPost();
29
+ $postObject = new Varien_Object();
30
+ $postObject->setData($data);
31
+ $translate = Mage::getSingleton('core/translate');
32
+ /* @var $translate Mage_Core_Model_Translate */
33
+ $translate->setTranslateInline(false);
34
+
35
+ $fileName = '';
36
+ if (isset($_FILES['testimonial_img']['name']) and (file_exists($_FILES['testimonial_img']['tmp_name']))) {
37
+ $baseDir = Mage::getBaseDir('media').DS.'testimonials';
38
+ $file = new Varien_Io_File();
39
+ mkdir($baseDir,0777);
40
+ $fileName = $_FILES['testimonial_img']['name'];
41
+ mysql_real_escape_string($fileName);
42
+ $tmp = explode(".",$fileName);
43
+
44
+ $fileName = time().uniqid().'.'.end($tmp);
45
+ $image_to_upload = "";
46
+ $uploader = new Varien_File_Uploader('testimonial_img');
47
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
48
+ $uploader->setAllowRenameFiles(false);
49
+ $uploader->setFilesDispersion(false);
50
+ $path = Mage::getBaseDir('media') . DS.'testimonials'.DS ;
51
+ $sitePath = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'testimonials';
52
+ $uploader->save($path, $fileName);
53
+ $data['testimonial_img'] = $sitePath.'/'.$fileName;
54
+
55
+ }
56
+ $model = Mage::getModel('testimonial/testimonial');
57
+ $numberOfData = $model->getCollection()->count();
58
+
59
+ $model->setData($data)->setTestimonialId($this->getRequest()->getParam('id'));
60
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
61
+ $model->setCreatedTime(now())
62
+ ->setUpdateTime(now());
63
+ } else {
64
+
65
+ $model->setUpdateTime(now());
66
+ }
67
+
68
+ $store= Mage::app()->getStore();
69
+ $current_store = $store->getId();
70
+
71
+ $configContactEmailValue = Mage::getStoreConfig('testimonialsection/showhideform/contactemail');
72
+ $configEmailToAdmin = Mage::getStoreConfig('testimonialsection/testisettings/allowemail');
73
+ if($configContactEmailValue == 1 && $configEmailToAdmin == 1 ){
74
+ $mailTemplate = Mage::getModel('core/email_template');
75
+ /* @var $mailTemplate Mage_Core_Model_Email_Template */
76
+
77
+ $mailTemplate->setDesignConfig(array('area' => 'frontend','store'=>$current_store))
78
+ ->setReplyTo($data['testimonial_email'])
79
+ ->sendTransactional(
80
+ Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
81
+ Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
82
+ Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),
83
+ null,
84
+ array('data' => $postObject)
85
+ );
86
+ }
87
+ $model->setStores($current_store);
88
+ $status = Mage::helper('testimonial')->getStatusAprroval();
89
+
90
+ $model->setStatus($status);
91
+ $model->setTestimonialPosition($numberOfData+1);
92
+ $model->save();
93
+ Mage::getSingleton('core/session')->addSuccess(Mage::helper('testimonial')->__('Your inquiry was submitted and will be responded to as soon as possible.'));
94
+ $this->_redirect('*/*');
95
+ return;
96
+ } catch (Exception $e) {
97
+ Mage::getModel('core/session')->setData('submited', '0');
98
+ $e->getMessage();exit;
99
+ Mage::getSingleton('core/session')->addError(Mage::helper('testimonial')->__('Unable to submit your request. Please, try again later'));
100
+ $this->_redirect('*/*');
101
+ return;
102
+ /* echo $e->getMessage();*/
103
+ }
104
+ }else{
105
+ Mage::getSingleton('core/session')->addError(Mage::helper('testimonial')->__('There is No Data'));
106
+ $this->_redirect('*/*');
107
+ return;
108
+ }
109
+ }
110
+
111
+
112
+
113
+
114
+ }
app/code/community/Apt/Testimonial/etc/adminhtml.xml ADDED
@@ -0,0 +1,52 @@
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <menu>
5
+ <apt translate="title" module="testimonial">
6
+ <title>Apt Extensions</title>
7
+ <sort_order>80</sort_order>
8
+ <children>
9
+ <testimonial translate="title" module="testimonial">
10
+ <title>Testimonials</title>
11
+ <sort_order>5</sort_order>
12
+ <action>adminhtml/testimonial</action>
13
+ </testimonial>
14
+ </children>
15
+ </apt>
16
+ </menu>
17
+ <acl>
18
+ <resources>
19
+ <all>
20
+ <title>Allow Everything</title>
21
+ </all>
22
+ <admin>
23
+ <children>
24
+ <apt>
25
+ <title>Apt Extensions</title>
26
+ <sort_order>150</sort_order>
27
+ <children>
28
+ <testimonial>
29
+ <title>Testimonials</title>
30
+ <sort_order>5</sort_order>
31
+ </testimonial>
32
+ </children>
33
+ </apt>
34
+ </children>
35
+ <children>
36
+ <system>
37
+ <children>
38
+ <config>
39
+ <children>
40
+ <testimonialsection translate="title" module="testimonial">
41
+ <title>Apt Testimonials</title>
42
+ <sort_order>11</sort_order>
43
+ </testimonialsection>
44
+ </children>
45
+ </config>
46
+ </children>
47
+ </system>
48
+ </children>
49
+ </admin>
50
+ </resources>
51
+ </acl>
52
+ </config>
app/code/community/Apt/Testimonial/etc/config.xml ADDED
@@ -0,0 +1,132 @@
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Apt_Testimonial>
5
+ <version>1.0.0.0</version>
6
+ </Apt_Testimonial>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <testimonial>
11
+ <class>Apt_Testimonial_Model</class>
12
+ <resourceModel>testimonial_mysql4</resourceModel>
13
+ </testimonial>
14
+ <testimonial_mysql4>
15
+ <class>Apt_Testimonial_Model_Mysql4</class>
16
+ <entities>
17
+ <testimonial>
18
+ <table>apt_testimonials</table>
19
+ </testimonial>
20
+ </entities>
21
+ </testimonial_mysql4>
22
+ </models>
23
+ <blocks>
24
+ <testimonial>
25
+ <class>Apt_Testimonial_Block</class>
26
+ </testimonial>
27
+ </blocks>
28
+ <helpers>
29
+ <testimonial>
30
+ <class>Apt_Testimonial_Helper</class>
31
+ </testimonial>
32
+ </helpers>
33
+ <resources>
34
+ <testimonial_setup>
35
+ <setup>
36
+ <module>Apt_Testimonial</module>
37
+ </setup>
38
+ <connection>
39
+ <use>core_setup</use>
40
+ </connection>
41
+ </testimonial_setup>
42
+ <testimonial_write>
43
+ <connection>
44
+ <use>core_write</use>
45
+ </connection>
46
+ </testimonial_write>
47
+ <testimonial_read>
48
+ <connection>
49
+ <use>core_read</use>
50
+ </connection>
51
+ </testimonial_read>
52
+ </resources>
53
+ <template>
54
+ <email>
55
+ <testimonialsection_testisettings_email_template translate="label" module="testimonial">
56
+ <label>Testimonial Form</label>
57
+ <file>apt/testimonial_form.html</file>
58
+ <type>text</type>
59
+ </testimonialsection_testisettings_email_template>
60
+ </email>
61
+ </template>
62
+ </global>
63
+ <admin>
64
+ <routers>
65
+ <adminhtml>
66
+ <args>
67
+ <modules>
68
+ <apt_testimonial after="Mage_Adminhtml">Apt_Testimonial_Adminhtml</apt_testimonial>
69
+ </modules>
70
+ </args>
71
+ </adminhtml>
72
+ </routers>
73
+ </admin>
74
+ <adminhtml>
75
+ <layout>
76
+ <updates>
77
+ <testimonial>
78
+ <file>apt/testimonial.xml</file>
79
+ </testimonial>
80
+ </updates>
81
+ </layout>
82
+ </adminhtml>
83
+ <frontend>
84
+ <routers>
85
+ <testimonial>
86
+ <use>standard</use>
87
+ <args>
88
+ <module>Apt_Testimonial</module>
89
+ <frontName>testimonials</frontName>
90
+ </args>
91
+ </testimonial>
92
+ </routers>
93
+ <layout>
94
+ <updates>
95
+ <testimonial>
96
+ <file>apt/testimonial.xml</file>
97
+ </testimonial>
98
+ </updates>
99
+ </layout>
100
+ </frontend>
101
+ <default>
102
+ <testimonialsection>
103
+ <testisettings>
104
+ <title>Testimonials</title>
105
+ <active>1</active>
106
+ <activetesty>1</activetesty>
107
+ <adminapproval>1</adminapproval>
108
+ <enableguest>1</enableguest>
109
+ <testynumbers>10</testynumbers>
110
+ <enabletoplinks>1</enabletoplinks>
111
+ <footerlinks>1</footerlinks>
112
+ <recipient><![CDATA[hello@example.com]]></recipient>
113
+ </testisettings>
114
+ <showhideform>
115
+ <companyname>1</companyname>
116
+ <contactname>1</contactname>
117
+ <address>1</address>
118
+ <contactemail>1</contactemail>
119
+ <contactphoto>1</contactphoto>
120
+ <height>120</height>
121
+ <width>120</width>
122
+ </showhideform>
123
+ <testyblock>
124
+ <featuredtestynumbers>5</featuredtestynumbers>
125
+ <featuredtitle>Featured Testimonials</featuredtitle>
126
+ <featured>1</featured>
127
+ <layoutrighttype>1</layoutrighttype>
128
+ <layoutlefttype>1</layoutlefttype>
129
+ </testyblock>
130
+ </testimonialsection>
131
+ </default>
132
+ </config>
app/code/community/Apt/Testimonial/etc/system.xml ADDED
@@ -0,0 +1,300 @@
1
+ <config>
2
+ <tabs>
3
+ <apt translate="label" module="testimonial">
4
+ <label>Apt Extensions</label>
5
+ <sort_order>150</sort_order>
6
+ </apt>
7
+ </tabs>
8
+ <sections>
9
+ <testimonialsection translate="label" module="testimonial">
10
+ <label>Testimonial Configuration</label>
11
+ <tab>apt</tab>
12
+ <frontend_type>text</frontend_type>
13
+ <sort_order>11</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
+ <testisettings translate="label">
19
+ <label>Add Testimonial Settings</label>
20
+ <expanded>1</expanded>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>1</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <active translate="label">
28
+ <label>Enabled</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>0</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </active>
36
+ <title translate="label">
37
+ <label>Title</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>Title Of Block </comment>
44
+ </title>
45
+ <activetesty translate="label">
46
+ <label>Allow users to write testimonials</label>
47
+ <frontend_type>select</frontend_type>
48
+ <source_model>adminhtml/system_config_source_yesno</source_model>
49
+ <sort_order>2</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ <tooltip>User can write testimonials </tooltip>
54
+ </activetesty>
55
+ <enableguest translate="label">
56
+ <label>Enable for Guests</label>
57
+ <depends><activetesty>1</activetesty></depends>
58
+ <frontend_type>select</frontend_type>
59
+ <source_model>adminhtml/system_config_source_yesno</source_model>
60
+ <sort_order>3</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </enableguest>
65
+ <adminapproval translate="label">
66
+ <label>Need Admin Approval</label>
67
+ <depends><activetesty>1</activetesty></depends>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>adminhtml/system_config_source_yesno</source_model>
70
+ <sort_order>4</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </adminapproval>
75
+ <allowpagination translate="label">
76
+ <label>Allow Pagination</label>
77
+ <frontend_type>select</frontend_type>
78
+ <source_model>adminhtml/system_config_source_yesno</source_model>
79
+ <sort_order>5</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>1</show_in_store>
83
+ </allowpagination>
84
+ <testynumbers translate="label">
85
+ <label>Number of Testimonials</label>
86
+ <frontend_type>text</frontend_type>
87
+ <depends><allowpagination>0</allowpagination></depends>
88
+ <sort_order>6</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ <comment>If empty then set to 10 </comment>
93
+ </testynumbers>
94
+ <allowemail translate="label">
95
+ <label>Allow Email</label>
96
+ <depends><activetesty>1</activetesty></depends>
97
+ <frontend_type>select</frontend_type>
98
+ <source_model>adminhtml/system_config_source_yesno</source_model>
99
+ <sort_order>7</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ </allowemail>
104
+ <recipient translate="label">
105
+ <label>Send Emails To</label>
106
+ <depends><allowemail>1</allowemail></depends>
107
+ <frontend_type>text</frontend_type>
108
+ <sort_order>8</sort_order>
109
+ <show_in_default>1</show_in_default>
110
+ <show_in_website>1</show_in_website>
111
+ <show_in_store>1</show_in_store>
112
+ </recipient>
113
+ <sender_email_identity translate="label">
114
+ <label>Email Sender</label>
115
+ <frontend_type>select</frontend_type>
116
+ <depends><allowemail>1</allowemail></depends>
117
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
118
+ <sort_order>9</sort_order>
119
+ <show_in_default>1</show_in_default>
120
+ <show_in_website>1</show_in_website>
121
+ <show_in_store>1</show_in_store>
122
+ </sender_email_identity>
123
+ <email_template translate="label">
124
+ <label>Email Template</label>
125
+ <depends><allowemail>1</allowemail></depends>
126
+ <frontend_type>select</frontend_type>
127
+ <source_model>adminhtml/system_config_source_email_template</source_model>
128
+ <sort_order>10</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ </email_template>
133
+ <enabletoplinks translate="label">
134
+ <label>Show link as Toplink</label>
135
+ <frontend_type>select</frontend_type>
136
+ <source_model>adminhtml/system_config_source_yesno</source_model>
137
+ <sort_order>11</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>1</show_in_store>
141
+ </enabletoplinks>
142
+ <footerlinks translate="label">
143
+ <label>Show link as Footerlink</label>
144
+ <frontend_type>select</frontend_type>
145
+ <source_model>adminhtml/system_config_source_yesno</source_model>
146
+ <sort_order>12</sort_order>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>1</show_in_store>
150
+ </footerlinks>
151
+ </fields>
152
+ </testisettings>
153
+ <showhideform translate="label">
154
+ <label>Show/Hide Form Fields</label>
155
+ <frontend_type>text</frontend_type>
156
+ <sort_order>2</sort_order>
157
+ <show_in_default>1</show_in_default>
158
+ <show_in_website>1</show_in_website>
159
+ <show_in_store>1</show_in_store>
160
+ <fields>
161
+ <companyname translate="label">
162
+ <label>Company Name</label>
163
+ <frontend_type>select</frontend_type>
164
+ <source_model>adminhtml/system_config_source_yesno</source_model>
165
+ <sort_order>0</sort_order>
166
+ <show_in_default>1</show_in_default>
167
+ <show_in_website>1</show_in_website>
168
+ <show_in_store>1</show_in_store>
169
+ </companyname>
170
+ <contactname translate="label">
171
+ <label>Contact Name</label>
172
+ <frontend_type>select</frontend_type>
173
+ <source_model>adminhtml/system_config_source_yesno</source_model>
174
+ <sort_order>1</sort_order>
175
+ <show_in_default>1</show_in_default>
176
+ <show_in_website>1</show_in_website>
177
+ <show_in_store>1</show_in_store>
178
+ </contactname>
179
+ <contactemail translate="label">
180
+ <label>Contact Email</label>
181
+ <frontend_type>select</frontend_type>
182
+ <source_model>adminhtml/system_config_source_yesno</source_model>
183
+ <sort_order>2</sort_order>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>1</show_in_website>
186
+ <show_in_store>1</show_in_store>
187
+ </contactemail>
188
+ <address translate="label">
189
+ <label>Location</label>
190
+ <frontend_type>select</frontend_type>
191
+ <source_model>adminhtml/system_config_source_yesno</source_model>
192
+ <sort_order>3</sort_order>
193
+ <show_in_default>1</show_in_default>
194
+ <show_in_website>1</show_in_website>
195
+ <show_in_store>1</show_in_store>
196
+ </address>
197
+ <contactphoto translate="label">
198
+ <label>Contact Photo</label>
199
+ <frontend_type>select</frontend_type>
200
+ <source_model>adminhtml/system_config_source_yesno</source_model>
201
+ <sort_order>4</sort_order>
202
+ <show_in_default>1</show_in_default>
203
+ <show_in_website>1</show_in_website>
204
+ <show_in_store>1</show_in_store>
205
+ </contactphoto>
206
+ <height translate="label">
207
+ <label>Image Height</label>
208
+ <depends><contactphoto>1</contactphoto></depends>
209
+ <frontend_type>text</frontend_type>
210
+ <comment> In Pixel </comment>
211
+ <sort_order>5</sort_order>
212
+ <show_in_default>1</show_in_default>
213
+ <show_in_website>1</show_in_website>
214
+ <show_in_store>1</show_in_store>
215
+ </height>
216
+ <width translate="label">
217
+ <label>Image Width</label>
218
+ <depends><contactphoto>1</contactphoto></depends>
219
+ <frontend_type>text</frontend_type>
220
+ <comment> In Pixel </comment>
221
+ <sort_order>6</sort_order>
222
+ <show_in_default>1</show_in_default>
223
+ <show_in_website>1</show_in_website>
224
+ <show_in_store>1</show_in_store>
225
+ </width>
226
+ </fields>
227
+ </showhideform>
228
+ <testyblock translate="label">
229
+ <label>Testimonials Featured Block Settings</label>
230
+ <frontend_type>text</frontend_type>
231
+ <sort_order>3</sort_order>
232
+ <show_in_default>1</show_in_default>
233
+ <show_in_website>1</show_in_website>
234
+ <show_in_store>1</show_in_store>
235
+ <fields>
236
+ <featured translate="label">
237
+ <label>Display In Sidebar</label>
238
+ <frontend_type>select</frontend_type>
239
+ <source_model>adminhtml/system_config_source_yesno</source_model>
240
+ <sort_order>0</sort_order>
241
+ <show_in_default>1</show_in_default>
242
+ <show_in_website>1</show_in_website>
243
+ <show_in_store>1</show_in_store>
244
+ </featured>
245
+ <featuredtitle translate="label">
246
+ <label>Title</label>
247
+ <depends><featured>1</featured></depends>
248
+ <frontend_type>text</frontend_type>
249
+ <sort_order>1</sort_order>
250
+ <show_in_default>1</show_in_default>
251
+ <show_in_website>1</show_in_website>
252
+ <show_in_store>1</show_in_store>
253
+ <comment>Title Of Block </comment>
254
+ </featuredtitle>
255
+ <layoutrighttype translate="label">
256
+ <label>Right Sidebar</label>
257
+ <depends><featured>1</featured></depends>
258
+ <frontend_type>select</frontend_type>
259
+ <source_model>adminhtml/system_config_source_yesno</source_model>
260
+ <sort_order>2</sort_order>
261
+ <show_in_default>1</show_in_default>
262
+ <show_in_website>1</show_in_website>
263
+ <show_in_store>1</show_in_store>
264
+ </layoutrighttype>
265
+ <layoutlefttype translate="label">
266
+ <label>Left Sidebar</label>
267
+ <depends><featured>1</featured></depends>
268
+ <frontend_type>select</frontend_type>
269
+ <source_model>adminhtml/system_config_source_yesno</source_model>
270
+ <sort_order>3</sort_order>
271
+ <show_in_default>1</show_in_default>
272
+ <show_in_website>1</show_in_website>
273
+ <show_in_store>1</show_in_store>
274
+ </layoutlefttype>
275
+ <enableslider translate="label">
276
+ <label>Display as slider</label>
277
+ <frontend_type>select</frontend_type>
278
+ <depends><featured>1</featured></depends>
279
+ <source_model>adminhtml/system_config_source_yesno</source_model>
280
+ <sort_order>4</sort_order>
281
+ <show_in_default>1</show_in_default>
282
+ <show_in_website>1</show_in_website>
283
+ <show_in_store>1</show_in_store>
284
+ </enableslider>
285
+ <featuredtestynumbers translate="label">
286
+ <label>Number of Featured Testimonials</label>
287
+ <depends><featured>1</featured></depends>
288
+ <frontend_type>text</frontend_type>
289
+ <sort_order>5</sort_order>
290
+ <show_in_default>1</show_in_default>
291
+ <show_in_website>1</show_in_website>
292
+ <show_in_store>1</show_in_store>
293
+ <comment>If empty then set to 5 </comment>
294
+ </featuredtestynumbers>
295
+ </fields>
296
+ </testyblock>
297
+ </groups>
298
+ </testimonialsection>
299
+ </sections>
300
+ </config>
app/code/community/Apt/Testimonial/sql/testimonial_setup/mysql4-install-1.0.0.0.php ADDED
@@ -0,0 +1,31 @@
1
+ <?php
2
+ /**
3
+ * @package Apt_Testimonial
4
+ * @author Apt
5
+ */
6
+ $installer = $this;
7
+
8
+ $installer->startSetup();
9
+
10
+ $table = $installer->getTable('apt_testimonials');
11
+
12
+ $installer->run("
13
+ create table IF NOT EXISTS {$table} (
14
+ `testimonial_id` int(11) unsigned not null auto_increment,
15
+ `testimonial_position` int(11) default 0,
16
+ `testimonial_name` varchar(50) not null default '',
17
+ `testimonial_email` varchar(255) NOT NULL default '',
18
+ `testimonial_text` text not null default '',
19
+ `testimonial_companyname` text not null default '',
20
+ `testimonial_address` text not null default '',
21
+ `testimonial_img` varchar(128) default NULL,
22
+ `testimonial_sidebar` tinyint(4) NOT NULL,
23
+ `status` smallint(6) NOT NULL default '0',
24
+ `stores` varchar(255) NOT NULL default '',
25
+ `created_time` datetime NULL,
26
+ `update_time` datetime NULL,
27
+ PRIMARY KEY(testimonial_id)
28
+ ) engine=InnoDB default charset=utf8;
29
+ ");
30
+
31
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/apt/testimonial.xml ADDED
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0"?>
2
+ <layout version="1.0.0">
3
+
4
+ <adminhtml_testimonial_index>
5
+ <reference name="content">
6
+ <block type="testimonial/adminhtml_testimonial" name="testimonial" />
7
+ </reference>
8
+ </adminhtml_testimonial_index>
9
+
10
+ </layout>
app/design/frontend/base/default/layout/apt/testimonial.xml ADDED
@@ -0,0 +1,84 @@
1
+ <?xml version="1.0"?>
2
+ <layout version="1.0.0">
3
+ <default>
4
+
5
+ <reference name="right">
6
+ <block type="testimonial/testimonial" name="right.testimonials" >
7
+ <action method="setSidebar">
8
+ <sidebar>1</sidebar>
9
+ </action>
10
+ <action method="setTemplate" ifconfig="testimonialsection/testyblock/layoutrighttype">
11
+ <template>apt/testimonial/testimonials_sidebar.phtml</template>
12
+ </action>
13
+ </block>
14
+ </reference>
15
+ <reference name="left">
16
+ <block type="testimonial/testimonial" name="left.testimonials" >
17
+ <action method="setSidebar">
18
+ <sidebar>1</sidebar>
19
+ </action>
20
+ <action method="setTemplate" ifconfig="testimonialsection/testyblock/layoutlefttype">
21
+ <template>apt/testimonial/testimonials_leftsidebar.phtml</template>
22
+ </action>
23
+ </block>
24
+ </reference>
25
+ <reference name="head">
26
+ <!--<action method="addJs" ><script>testimonial/jquery-1.9.1.min.js</script></action>-->
27
+
28
+ <action method="addItem" ifconfig="testimonialsection/testyblock/enableslider"><type>skin_js</type><name>apt/testimonial/js/jquery.dd.min.js</name></action>
29
+ <action method="addItem" ifconfig="testimonialsection/testyblock/enableslider"><type>skin_js</type><name>apt/testimonial/js/jquery.bxslider.min.js</name></action>
30
+
31
+
32
+ <action method="addCss"><stylesheet>apt/testimonial/css/testimonial.css</stylesheet></action>
33
+ <action method="addCss" ifconfig="testimonialsection/testyblock/enableslider"><stylesheet>apt/testimonial/css/dd.css</stylesheet></action>
34
+ <action method="addCss" ifconfig="testimonialsection/testyblock/enableslider"><stylesheet>apt/testimonial/css/jquery.bxslider.css</stylesheet></action>
35
+
36
+
37
+ </reference>
38
+ <reference name="top.links">
39
+ <action method="addLink" translate="label title" module="testimonial" ifconfig="testimonialsection/testisettings/enabletoplinks">
40
+ <label helper="testimonial/getTitle"/>
41
+ <url helper="testimonial/getTestimonialUrl"/>
42
+ <title helper="testimonial/getTitle"/>
43
+ <prepare/>
44
+ <urlParams/>
45
+ <position>200</position>
46
+ <liParams/>
47
+ <aParams>class='testimonial-top-link'</aParams>
48
+ </action>
49
+ </reference>
50
+ <reference name="footer_links">
51
+ <action method="addLink" translate="label title" ifconfig="testimonialsection/testisettings/footerlinks">
52
+ <label helper="testimonial/getTitle"/>
53
+ <url helper="testimonial/getTestimonialUrl"/>
54
+ <title helper="testimonial/getTitle"/>
55
+ <prepare/>
56
+ <urlParams/>
57
+ <position>2</position>
58
+ <liParams/>
59
+ <aParams>class='testimonial-footer-link'</aParams>
60
+ </action>
61
+ </reference>
62
+ </default>
63
+ <testimonial_index_index>
64
+ <label>Testimonials</label>
65
+ <reference name="head">
66
+ <block type="page/html_head" name="head_custom" template="apt/page/html/head_custom.phtml">
67
+ <action method="setTitle"><title>Testimonials</title></action>
68
+
69
+ <action method="addItem" ifconfig="testimonialsection/testisettings/activetesty"><type>skin_js</type><name>apt/testimonial/js/jquery.fancybox.js</name></action>
70
+ <action method="addCss" ifconfig="testimonialsection/testisettings/activetesty"><stylesheet>apt/testimonial/css/jquery.fancybox.css</stylesheet></action>
71
+ </block>
72
+ </reference>
73
+ <reference name="root">
74
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
75
+ </reference>
76
+ <reference name="content">
77
+ <block type="testimonial/testimonial" name="testimonials">
78
+ <action method="setTemplate" ifconfig="testimonialsection/testisettings/active">
79
+ <template>apt/testimonial/testimonials.phtml</template>
80
+ </action>
81
+ </block>
82
+ </reference>
83
+ </testimonial_index_index>
84
+ </layout>
app/design/frontend/base/default/template/apt/page/html/head_custom.phtml ADDED
@@ -0,0 +1 @@
1
+ <?php echo $this->getCssJsHtml(); ?>
app/design/frontend/base/default/template/apt/testimonial/testimonials.phtml ADDED
@@ -0,0 +1,192 @@
1
+ <?php
2
+ /* $configContactNameValue = Mage::getStoreConfig('testimonialsection/testisettings/active');
3
+ echo $configContactNameValue;exit;*/
4
+ ?>
5
+ <script type="text/javascript">
6
+ jQuery.noConflict();
7
+ </script>
8
+ <?php
9
+ $configEnableValue = Mage::getStoreConfig('testimonialsection/testisettings/activetesty');
10
+ $enableguest = Mage::getStoreConfig('testimonialsection/testisettings/enableguest');
11
+ $helper = Mage::helper('testimonial');
12
+ if($configEnableValue == 1 ):
13
+ if($enableguest == 1 ):
14
+
15
+ ?>
16
+
17
+
18
+ <a id="testy-create" class="fancybox" onclick='jQuery.fancybox({"href" : "#info-testy-create",scrolling: "no", afterClose: function() { jQuery("div").remove(".validation-advice"); jQuery("div.input-box input,div.input-box textarea").removeClass("validation-failed"); } });' title="<?php echo Mage::helper('testimonial')->__('Add Testimonial') ?>" href="javascript:void(0)"><?php echo Mage::helper('testimonial')->__('Add Testimonial') ?></a>
19
+ <div id="info-testy-create" style="display:none;min-width:700px;min-height:400px;">
20
+ <div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
21
+ <div class="page-title">
22
+ <h1> <?php echo $this->htmlEscape($this->helper('testimonial')->getTitle()) ?></h1>
23
+ </div>
24
+
25
+ <form action="<?php echo $this->getFormAction(); ?>" id="testyForm" method="post" enctype="multipart/form-data">
26
+ <div class="fieldset_popup">
27
+ <ul class="form-list">
28
+
29
+ <li class="fields">
30
+ <?php if($helper->isEnableContactName()):?>
31
+ <div class="field">
32
+ <label for="testimonial_name" class="required"><em>*</em><?php echo Mage::helper('testimonial')->__('Name') ?></label>
33
+ <div class="input-box">
34
+ <input name="testimonial_name" id="testimonial_name" title="<?php echo Mage::helper('testimonial')->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('testimonial')->getUserName()) ?>" class="input-text required-entry" type="text" />
35
+ </div>
36
+ </div>
37
+ <?php endif;?>
38
+ <?php if($helper->isEnableContactEmail()):?>
39
+ <div class="field">
40
+ <label for="testimonial_email" class="required"><em>*</em><?php echo Mage::helper('testimonial')->__('Email') ?></label>
41
+ <div class="input-box">
42
+ <input name="testimonial_email" id="testimonial_email" title="<?php echo Mage::helper('testimonial')->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('testimonial')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="text" />
43
+ </div>
44
+ </div>
45
+ </li>
46
+ <?php endif;?>
47
+ <li class="fields">
48
+ <?php if($helper->isEnableCompanyname()): ?>
49
+ <div class="field">
50
+ <label for="testimonial_companyname"><?php echo Mage::helper('testimonial')->__('Comapny Name') ?></label>
51
+ <div class="input-box">
52
+ <input name="testimonial_companyname" id="testimonial_companyname" title="<?php echo Mage::helper('testimonial')->__('Company Name') ?>" value="" class="input-text" type="text" />
53
+ </div>
54
+ </div>
55
+
56
+ <?php endif;?>
57
+ <?php if($helper->isEnableContactAddress()):?>
58
+ <div class="field">
59
+ <label for="testimonial_address"><?php echo Mage::helper('testimonial')->__('Location') ?></label>
60
+ <div class="input-box">
61
+ <input name="testimonial_address" id="testimonial_address" title="<?php echo Mage::helper('testimonial')->__('Company Location') ?>" value="" class="input-text" type="text" />
62
+ </div>
63
+ </div>
64
+
65
+ <?php endif;?>
66
+ </li>
67
+ <li class="wide">
68
+ <label for="testimonial_text" class="required"><em>*</em><?php echo Mage::helper('testimonial')->__('Content') ?></label>
69
+ <div class="input-box alignleft">
70
+ <textarea name="testimonial_text" id="testimonial_text" title="<?php echo Mage::helper('testimonial')->__('Content') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
71
+ </div>
72
+ </li>
73
+ <?php if($helper->isEnableContactPhoto()):?>
74
+ <li class="fields">
75
+ <label for="testimonial_img"><?php echo Mage::helper('testimonial')->__('Contact Photo') ?></label>
76
+ <div class="input-box alignleft">
77
+ <input name="testimonial_img" id="testimonial_img" class="input-text" type="file" />
78
+ </div>
79
+ </li>
80
+ <?php endif;?>
81
+
82
+ </ul>
83
+ </div>
84
+ <div class="buttons-set">
85
+ <p class="required"><?php echo Mage::helper('testimonial')->__('* Required Fields') ?></p>
86
+ <button type="submit" title="<?php echo Mage::helper('testimonial')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('testimonial')->__('Submit') ?></span></span></button>
87
+ <button type="reset" class="button" value="<?php echo Mage::helper('testimonial')->__('Reset') ?>"><span><span><?php echo Mage::helper('testimonial')->__('Reset') ?></span></span></button>
88
+
89
+ </div>
90
+ </form>
91
+ <script type="text/javascript">
92
+ //<![CDATA[
93
+ var testyForm = new VarienForm('testyForm', true);
94
+ //]]>
95
+ </script>
96
+ </div>
97
+
98
+
99
+ <?php endif;?>
100
+ <?php endif;?>
101
+ <div class="testimonials_container">
102
+ <h1 class="testimonials_title">
103
+ <?php echo $this->htmlEscape($this->helper('testimonial')->getTitle()) ?>
104
+ </h1>
105
+ <div class="testimonials">
106
+ <?php $testimonials = $this->getTestimonials(); ?>
107
+ <?php $i = 0;?>
108
+ <?php if (count($testimonials) > 0): ?>
109
+ <?php foreach ($testimonials as $testimonial): ?>
110
+ <div class="testimonial_<?php $i++; echo (is_int($i/2) ? "right" : "left")?>">
111
+ <?php if($helper->isEnableContactPhoto()):?>
112
+ <div class="testimonial_image">
113
+ <?php
114
+ $configHeightValue = Mage::getStoreConfig('testimonialsection/showhideform/height');
115
+ $configWidthValue = Mage::getStoreConfig('testimonialsection/showhideform/width');
116
+ ?>
117
+ <?php if ($testimonial->getTestimonialImg()):
118
+ $resizeEndarray = explode("/",$testimonial->getTestimonialImg());
119
+
120
+ ?>
121
+
122
+
123
+ <img src="<?php echo Mage::helper('testimonial')->resizeImage(end($resizeEndarray),$configHeightValue,$configWidthValue,'testimonials'); ?>" alt="<?php echo $testimonial->getTestimonialName(); ?>" title="<?php echo $testimonial->getTestimonialName(); ?>" class="testy_img"/>
124
+
125
+
126
+
127
+ <?php else: ?>
128
+ <img src="<?php echo $this->getSkinUrl('apt/testimonial/images/no-image.png') ?>" alt="<?php echo $testimonial->getTestimonialName(); ?>" title="<?php echo $testimonial->getTestimonialName(); ?>" class="testy_no_img" height="<?php echo $configHeightValue.'px' ;?>" width="<?php echo $configWidthValue.'px' ;?>"/>
129
+
130
+
131
+ <?php endif; ?>
132
+ </div>
133
+ <?php endif; ?>
134
+
135
+ <div class="testimonial_content">
136
+ <?php echo $testimonial->getTestimonialText(); ?>
137
+ <?php if($helper->isEnableContactName()):?>
138
+
139
+ <h2><?php echo $testimonial->getTestimonialName(); ?></h2>
140
+ <?php endif;?>
141
+ <?php if($helper->isEnableContactEmail()&& $testimonial->getTestimonialEmail()!=''):?>