customer_testimonial - Version 1.0.0

Version Notes

First Release.

Download this release

Release Info

Developer Chandan Kumar Singh
Extension customer_testimonial
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (23) hide show
  1. app/code/community/Chandan/Testimonial/Block/Adminhtml/Testimonial.php +12 -0
  2. app/code/community/Chandan/Testimonial/Block/Adminhtml/Testimonial/Edit.php +45 -0
  3. app/code/community/Chandan/Testimonial/Block/Adminhtml/Testimonial/Edit/Form.php +19 -0
  4. app/code/community/Chandan/Testimonial/Block/Adminhtml/Testimonial/Edit/Tab/Form.php +74 -0
  5. app/code/community/Chandan/Testimonial/Block/Adminhtml/Testimonial/Edit/Tabs.php +24 -0
  6. app/code/community/Chandan/Testimonial/Block/Adminhtml/Testimonial/Grid.php +129 -0
  7. app/code/community/Chandan/Testimonial/Block/Testimonial.php +17 -0
  8. app/code/community/Chandan/Testimonial/Helper/Data.php +6 -0
  9. app/code/community/Chandan/Testimonial/Model/Mysql4/Testimonial.php +10 -0
  10. app/code/community/Chandan/Testimonial/Model/Mysql4/Testimonial/Collection.php +10 -0
  11. app/code/community/Chandan/Testimonial/Model/Status.php +15 -0
  12. app/code/community/Chandan/Testimonial/Model/Testimonial.php +10 -0
  13. app/code/community/Chandan/Testimonial/controllers/Adminhtml/TestimonialController.php +212 -0
  14. app/code/community/Chandan/Testimonial/controllers/IndexController.php +109 -0
  15. app/code/community/Chandan/Testimonial/etc/config.xml +142 -0
  16. app/code/community/Chandan/Testimonial/etc/system.xml +50 -0
  17. app/code/community/Chandan/Testimonial/sql/testimonial_setup/mysql4-install-1.0.0.php +19 -0
  18. app/design/adminhtml/default/default/layout/testimonial.xml +8 -0
  19. app/design/frontend/base/default/layout/testimonial.xml +30 -0
  20. app/design/frontend/base/default/template/testimonial/newtestimonial.phtml +64 -0
  21. app/design/frontend/base/default/template/testimonial/testimonial.phtml +111 -0
  22. app/etc/modules/Chandan_Testimonial.xml +9 -0
  23. package.xml +20 -0
app/code/community/Chandan/Testimonial/Block/Adminhtml/Testimonial.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Chandan_Testimonial_Block_Adminhtml_Testimonial extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_testimonial';
7
+ $this->_blockGroup = 'testimonial';
8
+ $this->_headerText = Mage::helper('testimonial')->__('Testimonial Manager');
9
+ $this->_addButtonLabel = Mage::helper('testimonial')->__('Add Testimonial');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/community/Chandan/Testimonial/Block/Adminhtml/Testimonial/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_Testimonial_Block_Adminhtml_Testimonial_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 = 'testimonial';
11
+ $this->_controller = 'adminhtml_testimonial';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('testimonial')->__('Save Testimonial'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('testimonial')->__('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('testimonial_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'testimonial_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'testimonial_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('testimonial_data') && Mage::registry('testimonial_data')->getId() ) {
40
+ return Mage::helper('testimonial')->__("Edit Testimonial '%s'", $this->htmlEscape(Mage::registry('testimonial_data')->getTitle()));
41
+ } else {
42
+ return Mage::helper('testimonial')->__('Add Testimonial');
43
+ }
44
+ }
45
+ }
app/code/community/Chandan/Testimonial/Block/Adminhtml/Testimonial/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_Testimonial_Block_Adminhtml_Testimonial_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/Chandan/Testimonial/Block/Adminhtml/Testimonial/Edit/Tab/Form.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_Testimonial_Block_Adminhtml_Testimonial_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('testimonial_form', array('legend'=>Mage::helper('testimonial')->__('Testimonial information')));
10
+
11
+ $fieldset->addField('name', 'text', array(
12
+ 'label' => Mage::helper('testimonial')->__('Name'),
13
+ 'class' => 'required-entry',
14
+ 'required' => true,
15
+ 'name' => 'name',
16
+ ));
17
+
18
+ $fieldset->addField('companyname', 'text', array(
19
+ 'label' => Mage::helper('testimonial')->__('Company Name'),
20
+ 'class' => 'required-entry',
21
+ 'required' => true,
22
+ 'name' => 'companyname',
23
+ ));
24
+
25
+ $fieldset->addField('desigination', 'text', array(
26
+ 'label' => Mage::helper('testimonial')->__('Desigination'),
27
+ 'class' => 'required-entry',
28
+ 'required' => true,
29
+ 'name' => 'desigination',
30
+ ));
31
+
32
+
33
+ $fieldset->addField('profileimage', 'image', array(
34
+ 'label' => Mage::helper('testimonial')->__('Profile Image'),
35
+ 'required' => false,
36
+ 'name' => 'profileimage',
37
+ ));
38
+
39
+ $fieldset->addField('content', 'editor', array(
40
+ 'name' => 'content',
41
+ 'label' => Mage::helper('testimonial')->__('Content'),
42
+ 'title' => Mage::helper('testimonial')->__('Content'),
43
+ 'style' => 'width:300px; height:200px;',
44
+ 'wysiwyg' => false,
45
+ 'required' => true,
46
+ ));
47
+
48
+ $fieldset->addField('status', 'select', array(
49
+ 'label' => Mage::helper('testimonial')->__('Status'),
50
+ 'name' => 'status',
51
+ 'values' => array(
52
+ array(
53
+ 'value' => 1,
54
+ 'label' => Mage::helper('testimonial')->__('Enabled'),
55
+ ),
56
+
57
+ array(
58
+ 'value' => 2,
59
+ 'label' => Mage::helper('testimonial')->__('Disabled'),
60
+ ),
61
+ ),
62
+ ));
63
+
64
+
65
+ if ( Mage::getSingleton('adminhtml/session')->getTestimonialData() )
66
+ {
67
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getTestimonialData());
68
+ Mage::getSingleton('adminhtml/session')->setTestimonialData(null);
69
+ } elseif ( Mage::registry('testimonial_data') ) {
70
+ $form->setValues(Mage::registry('testimonial_data')->getData());
71
+ }
72
+ return parent::_prepareForm();
73
+ }
74
+ }
app/code/community/Chandan/Testimonial/Block/Adminhtml/Testimonial/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_Testimonial_Block_Adminhtml_Testimonial_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('testimonial_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('testimonial')->__('Testimonial Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('testimonial')->__('Testimonial Information'),
18
+ 'title' => Mage::helper('testimonial')->__('Testimonial Information'),
19
+ 'content' => $this->getLayout()->createBlock('testimonial/adminhtml_testimonial_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/community/Chandan/Testimonial/Block/Adminhtml/Testimonial/Grid.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_Testimonial_Block_Adminhtml_Testimonial_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('testimonialGrid');
9
+ $this->setDefaultSort('testimonial_id');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('testimonial/testimonial')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('testimonial_id', array(
24
+ 'header' => Mage::helper('testimonial')->__('ID'),
25
+ 'align' =>'right',
26
+ 'width' => '50px',
27
+ 'index' => 'testimonial_id',
28
+ ));
29
+
30
+ $this->addColumn('name', array(
31
+ 'header' => Mage::helper('testimonial')->__('Name'),
32
+ 'align' =>'left',
33
+ 'width' => '150px',
34
+ 'index' => 'name',
35
+ ));
36
+
37
+ $this->addColumn('companyname', array(
38
+ 'header' => Mage::helper('testimonial')->__('Company Name'),
39
+ 'align' =>'left',
40
+ 'width' => '150px',
41
+ 'index' => 'companyname',
42
+ ));
43
+
44
+ $this->addColumn('desigination', array(
45
+ 'header' => Mage::helper('testimonial')->__('Desigination'),
46
+ 'align' =>'left',
47
+ 'width' => '150px',
48
+ 'index' => 'desigination',
49
+ ));
50
+
51
+ $this->addColumn('content', array(
52
+ 'header' => Mage::helper('testimonial')->__('Item Content'),
53
+ 'width' => '150px',
54
+ 'index' => 'content',
55
+ ));
56
+
57
+ $this->addColumn('status', array(
58
+ 'header' => Mage::helper('testimonial')->__('Status'),
59
+ 'align' => 'left',
60
+ 'width' => '80px',
61
+ 'index' => 'status',
62
+ 'type' => 'options',
63
+ 'options' => array(
64
+ 1 => 'Enabled',
65
+ 2 => 'Disabled',
66
+ ),
67
+ ));
68
+
69
+ $this->addColumn('action',
70
+ array(
71
+ 'header' => Mage::helper('testimonial')->__('Action'),
72
+ 'width' => '100',
73
+ 'type' => 'action',
74
+ 'getter' => 'getId',
75
+ 'actions' => array(
76
+ array(
77
+ 'caption' => Mage::helper('testimonial')->__('Edit'),
78
+ 'url' => array('base'=> '*/*/edit'),
79
+ 'field' => 'id'
80
+ )
81
+ ),
82
+ 'filter' => false,
83
+ 'sortable' => false,
84
+ 'index' => 'stores',
85
+ 'is_system' => true,
86
+ ));
87
+
88
+ $this->addExportType('*/*/exportCsv', Mage::helper('testimonial')->__('CSV'));
89
+ $this->addExportType('*/*/exportXml', Mage::helper('testimonial')->__('XML'));
90
+
91
+ return parent::_prepareColumns();
92
+ }
93
+
94
+ protected function _prepareMassaction()
95
+ {
96
+ $this->setMassactionIdField('testimonial_id');
97
+ $this->getMassactionBlock()->setFormFieldName('testimonial');
98
+
99
+ $this->getMassactionBlock()->addItem('delete', array(
100
+ 'label' => Mage::helper('testimonial')->__('Delete'),
101
+ 'url' => $this->getUrl('*/*/massDelete'),
102
+ 'confirm' => Mage::helper('testimonial')->__('Are you sure?')
103
+ ));
104
+
105
+ $statuses = Mage::getSingleton('testimonial/status')->getOptionArray();
106
+
107
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
108
+ $this->getMassactionBlock()->addItem('status', array(
109
+ 'label'=> Mage::helper('testimonial')->__('Change status'),
110
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
111
+ 'additional' => array(
112
+ 'visibility' => array(
113
+ 'name' => 'status',
114
+ 'type' => 'select',
115
+ 'class' => 'required-entry',
116
+ 'label' => Mage::helper('testimonial')->__('Status'),
117
+ 'values' => $statuses
118
+ )
119
+ )
120
+ ));
121
+ return $this;
122
+ }
123
+
124
+ public function getRowUrl($row)
125
+ {
126
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
127
+ }
128
+
129
+ }
app/code/community/Chandan/Testimonial/Block/Testimonial.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Chandan_Testimonial_Block_Testimonial extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getTestimonial()
10
+ {
11
+ if (!$this->hasData('testimonial')) {
12
+ $this->setData('testimonial', Mage::registry('testimonial'));
13
+ }
14
+ return $this->getData('testimonial');
15
+
16
+ }
17
+ }
app/code/community/Chandan/Testimonial/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_Testimonial_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Chandan/Testimonial/Model/Mysql4/Testimonial.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_Testimonial_Model_Mysql4_Testimonial extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the testimonial_id refers to the key field in your database table.
8
+ $this->_init('testimonial/testimonial', 'testimonial_id');
9
+ }
10
+ }
app/code/community/Chandan/Testimonial/Model/Mysql4/Testimonial/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_Testimonial_Model_Mysql4_Testimonial_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('testimonial/testimonial');
9
+ }
10
+ }
app/code/community/Chandan/Testimonial/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_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/Chandan/Testimonial/Model/Testimonial.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_Testimonial_Model_Testimonial extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('testimonial/testimonial');
9
+ }
10
+ }
app/code/community/Chandan/Testimonial/controllers/Adminhtml/TestimonialController.php ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Chandan_Testimonial_Adminhtml_TestimonialController extends Mage_Adminhtml_Controller_action
3
+ {
4
+
5
+ protected function _isAllowed()
6
+ {
7
+ return true;
8
+ }
9
+
10
+ protected function _initAction() {
11
+ $this->loadLayout()
12
+ ->_setActiveMenu('testimonial/items')
13
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Testimonial Manager'), Mage::helper('adminhtml')->__('Testimonial Manager'));
14
+
15
+ return $this;
16
+ }
17
+
18
+ public function indexAction() {
19
+ $this->_initAction()
20
+ ->renderLayout();
21
+ }
22
+
23
+ public function editAction() {
24
+ $id = $this->getRequest()->getParam('id');
25
+ $model = Mage::getModel('testimonial/testimonial')->load($id);
26
+
27
+ if ($model->getId() || $id == 0) {
28
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
29
+ if (!empty($data)) {
30
+ $model->setData($data);
31
+ }
32
+
33
+ Mage::register('testimonial_data', $model);
34
+
35
+ $this->loadLayout();
36
+ $this->_setActiveMenu('testimonial/items');
37
+
38
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Testimonial Manager'), Mage::helper('adminhtml')->__('Testimonial Manager'));
39
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Testimonial News'), Mage::helper('adminhtml')->__('Testimonial News'));
40
+
41
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
42
+
43
+ $this->_addContent($this->getLayout()->createBlock('testimonial/adminhtml_testimonial_edit'))
44
+ ->_addLeft($this->getLayout()->createBlock('testimonial/adminhtml_testimonial_edit_tabs'));
45
+
46
+ $this->renderLayout();
47
+ } else {
48
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('testimonial')->__('Testimonial does not exist'));
49
+ $this->_redirect('*/*/');
50
+ }
51
+ }
52
+
53
+ public function newAction() {
54
+ $this->_forward('edit');
55
+ }
56
+
57
+ public function saveAction() {
58
+ if ($data = $this->getRequest()->getPost()) {
59
+
60
+ if(isset($_FILES['profileimage']['name']) && $_FILES['profileimage']['name'] != '') {
61
+ try {
62
+ /* Starting upload */
63
+ $uploader = new Varien_File_Uploader('profileimage');
64
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
65
+ $uploader->setAllowRenameFiles(false);
66
+ $uploader->setFilesDispersion(false);
67
+ $path = Mage::getBaseDir('media') . DS ;
68
+ $uploader->save($path, $_FILES['profileimage']['name'] );
69
+ } catch (Exception $e) {
70
+
71
+ }
72
+
73
+ //this way the name is saved in DB
74
+ $data['profileimage'] = $_FILES['profileimage']['name'];
75
+ }
76
+
77
+ if(is_array($data['profileimage'])){
78
+ $data['profileimage'] = $data['profileimage']['value'];
79
+ }
80
+
81
+
82
+ $model = Mage::getModel('testimonial/testimonial');
83
+ $model->setData($data)
84
+ ->setId($this->getRequest()->getParam('id'));
85
+
86
+ try {
87
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
88
+ $model->setCreatedTime(now())
89
+ ->setUpdateTime(now());
90
+ } else {
91
+ $model->setUpdateTime(now());
92
+ }
93
+
94
+ $model->save();
95
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('testimonial')->__('Testimonial was successfully saved'));
96
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
97
+
98
+ if ($this->getRequest()->getParam('back')) {
99
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
100
+ return;
101
+ }
102
+ $this->_redirect('*/*/');
103
+ return;
104
+ } catch (Exception $e) {
105
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
106
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
107
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
108
+ return;
109
+ }
110
+ }
111
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('testimonial')->__('Unable to find testimonial to save'));
112
+ $this->_redirect('*/*/');
113
+ }
114
+
115
+ public function deleteAction() {
116
+ if( $this->getRequest()->getParam('id') > 0 ) {
117
+ try {
118
+ $model = Mage::getModel('testimonial/testimonial');
119
+
120
+ $model->setId($this->getRequest()->getParam('id'))
121
+ ->delete();
122
+
123
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Testimonial was successfully deleted'));
124
+ $this->_redirect('*/*/');
125
+ } catch (Exception $e) {
126
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
127
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
128
+ }
129
+ }
130
+ $this->_redirect('*/*/');
131
+ }
132
+
133
+ public function massDeleteAction() {
134
+ $testimonialIds = $this->getRequest()->getParam('testimonial');
135
+ if(!is_array($testimonialIds)) {
136
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select testimonial(s)'));
137
+ } else {
138
+ try {
139
+ foreach ($testimonialIds as $testimonialId) {
140
+ $testimonial = Mage::getModel('testimonial/testimonial')->load($testimonialId);
141
+ $testimonial->delete();
142
+ }
143
+ Mage::getSingleton('adminhtml/session')->addSuccess(
144
+ Mage::helper('adminhtml')->__(
145
+ 'Total of %d record(s) were successfully deleted', count($testimonialIds)
146
+ )
147
+ );
148
+ } catch (Exception $e) {
149
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
150
+ }
151
+ }
152
+ $this->_redirect('*/*/index');
153
+ }
154
+
155
+ public function massStatusAction()
156
+ {
157
+ $testimonialIds = $this->getRequest()->getParam('testimonial');
158
+ if(!is_array($testimonialIds)) {
159
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select testimonial(s)'));
160
+ } else {
161
+ try {
162
+ foreach ($testimonialIds as $testimonialId) {
163
+ $testimonial = Mage::getSingleton('testimonial/testimonial')
164
+ ->load($testimonialId)
165
+ ->setStatus($this->getRequest()->getParam('status'))
166
+ ->setIsMassupdate(true)
167
+ ->save();
168
+ }
169
+ $this->_getSession()->addSuccess(
170
+ $this->__('Total of %d record(s) were successfully updated', count($testimonialIds))
171
+ );
172
+ } catch (Exception $e) {
173
+ $this->_getSession()->addError($e->getMessage());
174
+ }
175
+ }
176
+ $this->_redirect('*/*/index');
177
+ }
178
+
179
+ public function exportCsvAction()
180
+ {
181
+ $fileName = 'testimonial.csv';
182
+ $content = $this->getLayout()->createBlock('testimonial/adminhtml_testimonial_grid')
183
+ ->getCsv();
184
+
185
+ $this->_sendUploadResponse($fileName, $content);
186
+ }
187
+
188
+ public function exportXmlAction()
189
+ {
190
+ $fileName = 'testimonial.xml';
191
+ $content = $this->getLayout()->createBlock('testimonial/adminhtml_testimonial_grid')
192
+ ->getXml();
193
+
194
+ $this->_sendUploadResponse($fileName, $content);
195
+ }
196
+
197
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
198
+ {
199
+ $response = $this->getResponse();
200
+ $response->setHeader('HTTP/1.1 200 OK','');
201
+ $response->setHeader('Pragma', 'public', true);
202
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
203
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
204
+ $response->setHeader('Last-Modified', date('r'));
205
+ $response->setHeader('Accept-Ranges', 'bytes');
206
+ $response->setHeader('Content-Length', strlen($content));
207
+ $response->setHeader('Content-type', $contentType);
208
+ $response->setBody($content);
209
+ $response->sendResponse();
210
+ die;
211
+ }
212
+ }
app/code/community/Chandan/Testimonial/controllers/IndexController.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Chandan_Testimonial_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+
7
+ /*
8
+ * Load an object by id
9
+ * Request looking like:
10
+ * http://site.com/testimonial?id=15
11
+ * or
12
+ * http://site.com/testimonial/id/15
13
+ */
14
+ /*
15
+ $testimonial_id = $this->getRequest()->getParam('id');
16
+
17
+ if($testimonial_id != null && $testimonial_id != '') {
18
+ $testimonial = Mage::getModel('testimonial/testimonial')->load($testimonial_id)->getData();
19
+ } else {
20
+ $testimonial = null;
21
+ }
22
+ */
23
+
24
+ /*
25
+ * If no param we load a the last created item
26
+ */
27
+ /*
28
+ if($testimonial == null) {
29
+ $resource = Mage::getSingleton('core/resource');
30
+ $read= $resource->getConnection('core_read');
31
+ $testimonialTable = $resource->getTableName('testimonial');
32
+
33
+ $select = $read->select()
34
+ ->from($testimonialTable,array('testimonial_id','title','content','status'))
35
+ ->where('status',1)
36
+ ->order('created_time DESC') ;
37
+
38
+ $testimonial = $read->fetchRow($select);
39
+ }
40
+ Mage::register('testimonial', $testimonial);
41
+ */
42
+
43
+
44
+ $this->loadLayout();
45
+ $this->renderLayout();
46
+ }
47
+
48
+ public function createpostAction(){
49
+ $configValue = Mage::getStoreConfig('chandantestimonial/testimonial_group/testimonial_frontend');
50
+ if($configValue == 1){
51
+ $data = $this->getRequest()->getPost();
52
+ if(empty($data)) {
53
+ $this->loadLayout();
54
+ $this->renderLayout();
55
+ } else{
56
+ if(isset($_FILES['profileimage']['name']) && $_FILES['profileimage']['name'] != '') {
57
+ try {
58
+ $uploader = new Varien_File_Uploader('profileimage');
59
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
60
+ $uploader->setAllowRenameFiles(false);
61
+ $uploader->setFilesDispersion(false);
62
+ $path = Mage::getBaseDir('media') . DS ;
63
+ $uploader->save($path, $_FILES['profileimage']['name'] );
64
+ } catch (Exception $e) {
65
+
66
+ }
67
+ $data['profileimage'] = $_FILES['profileimage']['name'];
68
+ }
69
+
70
+ if(is_array($data['profileimage'])){
71
+ $data['profileimage'] = $data['profileimage']['value'];
72
+ }
73
+
74
+ $data['status'] = 2;
75
+
76
+ $model = Mage::getModel('testimonial/testimonial');
77
+ $model->setData($data)
78
+ ->setId($this->getRequest()->getParam('id'));
79
+
80
+ try {
81
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
82
+ $model->setCreatedTime(now())
83
+ ->setUpdateTime(now());
84
+ } else {
85
+ $model->setUpdateTime(now());
86
+ }
87
+
88
+ $model->save();
89
+ Mage::getSingleton('core/session')->addSuccess(Mage::helper('testimonial')->__('Testimonial was successfully saved'));
90
+ Mage::getSingleton('core/session')->setFormData(false);
91
+
92
+ if ($this->getRequest()->getParam('back')) {
93
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
94
+ return;
95
+ }
96
+ $this->_redirect('testimonial/index');
97
+ return;
98
+ } catch (Exception $e) {
99
+ Mage::getSingleton('core/session')->addError($e->getMessage());
100
+ Mage::getSingleton('core/session')->setFormData($data);
101
+ $this->_redirect('testimonial/index/createpost');
102
+ return;
103
+ }
104
+ }
105
+ } else {
106
+ $this->_redirect('testimonial/index');
107
+ }
108
+ }
109
+ }
app/code/community/Chandan/Testimonial/etc/config.xml ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Chandan_Testimonial>
5
+ <version>1.0.0</version>
6
+ </Chandan_Testimonial>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <testimonial>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Chandan_Testimonial</module>
14
+ <frontName>testimonial</frontName>
15
+ </args>
16
+ </testimonial>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <testimonial>
21
+ <file>testimonial.xml</file>
22
+ </testimonial>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <testimonial>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Chandan_Testimonial</module>
32
+ <frontName>testimonial</frontName>
33
+ </args>
34
+ </testimonial>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <menu>
39
+ <testimonial module="testimonial">
40
+ <title>Testimonial</title>
41
+ <sort_order>71</sort_order>
42
+ <children>
43
+ <items module="testimonial">
44
+ <title>Manage Testimonial</title>
45
+ <sort_order>0</sort_order>
46
+ <action>testimonial/adminhtml_testimonial</action>
47
+ </items>
48
+ </children>
49
+ </testimonial>
50
+ </menu>
51
+ <acl>
52
+ <resources>
53
+ <all>
54
+ <title>Allow Everything</title>
55
+ </all>
56
+ <admin>
57
+ <children>
58
+ <testimonial module="testimonial">
59
+ <title>Testimonial</title>
60
+ <sort_order>71</sort_order>
61
+ <children>
62
+ <items module="testimonial">
63
+ <title>Manage Testimonial</title>
64
+ <sort_order>0</sort_order>
65
+ <action>testimonial/adminhtml_testimonial</action>
66
+ </items>
67
+ </children>
68
+ </testimonial>
69
+
70
+ <system>
71
+ <children>
72
+ <config>
73
+ <children>
74
+ <chandantestimonial>
75
+ <title>Testimonial - All</title>
76
+ </chandantestimonial>
77
+ </children>
78
+ </config>
79
+ </children>
80
+ </system>
81
+
82
+
83
+
84
+ </children>
85
+ </admin>
86
+ </resources>
87
+ </acl>
88
+ <layout>
89
+ <updates>
90
+ <testimonial>
91
+ <file>testimonial.xml</file>
92
+ </testimonial>
93
+ </updates>
94
+ </layout>
95
+ </adminhtml>
96
+ <global>
97
+ <models>
98
+ <testimonial>
99
+ <class>Chandan_Testimonial_Model</class>
100
+ <resourceModel>testimonial_mysql4</resourceModel>
101
+ </testimonial>
102
+ <testimonial_mysql4>
103
+ <class>Chandan_Testimonial_Model_Mysql4</class>
104
+ <entities>
105
+ <testimonial>
106
+ <table>testimonial</table>
107
+ </testimonial>
108
+ </entities>
109
+ </testimonial_mysql4>
110
+ </models>
111
+ <resources>
112
+ <testimonial_setup>
113
+ <setup>
114
+ <module>Chandan_Testimonial</module>
115
+ </setup>
116
+ <connection>
117
+ <use>core_setup</use>
118
+ </connection>
119
+ </testimonial_setup>
120
+ <testimonial_write>
121
+ <connection>
122
+ <use>core_write</use>
123
+ </connection>
124
+ </testimonial_write>
125
+ <testimonial_read>
126
+ <connection>
127
+ <use>core_read</use>
128
+ </connection>
129
+ </testimonial_read>
130
+ </resources>
131
+ <blocks>
132
+ <testimonial>
133
+ <class>Chandan_Testimonial_Block</class>
134
+ </testimonial>
135
+ </blocks>
136
+ <helpers>
137
+ <testimonial>
138
+ <class>Chandan_Testimonial_Helper</class>
139
+ </testimonial>
140
+ </helpers>
141
+ </global>
142
+ </config>
app/code/community/Chandan/Testimonial/etc/system.xml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <chandantestimonial translate="label" module="testimonial">
5
+ <label>Testimonial Setting</label>
6
+ <sort_order>100</sort_order>
7
+ </chandantestimonial>
8
+ </tabs>
9
+ <sections>
10
+ <chandantestimonial translate="label" module="testimonial">
11
+ <label>Testimonial Options</label>
12
+ <tab>chandantestimonial</tab>
13
+ <sort_order>1</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
+ <testimonial_group translate="label" module="testimonial">
19
+ <label>Testimonial Settings</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>1</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
+ <testimonial_status translate="label">
27
+ <label>Testimonial Status: </label>
28
+ <frontend_type>select</frontend_type>
29
+ <sort_order>1</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
+ <source_model>adminhtml/system_config_source_yesno</source_model>
34
+ </testimonial_status>
35
+
36
+ <testimonial_frontend translate="label">
37
+ <label>Add Frontend Testimonial: </label>
38
+ <frontend_type>select</frontend_type>
39
+ <sort_order>2</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
+ <source_model>adminhtml/system_config_source_yesno</source_model>
44
+ </testimonial_frontend>
45
+ </fields>
46
+ </testimonial_group>
47
+ </groups>
48
+ </chandantestimonial>
49
+ </sections>
50
+ </config>
app/code/community/Chandan/Testimonial/sql/testimonial_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->run("
5
+ -- DROP TABLE IF EXISTS {$this->getTable('testimonial')};
6
+ CREATE TABLE {$this->getTable('testimonial')} (
7
+ `testimonial_id` int(11) unsigned NOT NULL auto_increment,
8
+ `name` varchar(255) NOT NULL default '',
9
+ `companyname` varchar(255) NOT NULL default '',
10
+ `desigination` varchar(255) NOT NULL default '',
11
+ `profileimage` varchar(255) NOT NULL default '',
12
+ `content` text NOT NULL default '',
13
+ `status` smallint(6) NOT NULL default '0',
14
+ `created_time` datetime NULL,
15
+ `update_time` datetime NULL,
16
+ PRIMARY KEY (`testimonial_id`)
17
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
18
+ ");
19
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/testimonial.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <testimonial_adminhtml_testimonial_index>
4
+ <reference name="content">
5
+ <block type="testimonial/adminhtml_testimonial" name="testimonial" />
6
+ </reference>
7
+ </testimonial_adminhtml_testimonial_index>
8
+ </layout>
app/design/frontend/base/default/layout/testimonial.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="top.links">
5
+ <action method="addLink" translate="Testimonial">
6
+ <label>Testimonial</label>
7
+ <url>testimonial/index/</url>
8
+ <title>Testimonial</title>
9
+ <position>10</position>
10
+ </action>
11
+ </reference>
12
+ </default>
13
+ <testimonial_index_index>
14
+ <reference name="root">
15
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
16
+ </reference>
17
+ <reference name="content">
18
+ <block type="testimonial/testimonial" name="testimonial" template="testimonial/testimonial.phtml" />
19
+ </reference>
20
+ </testimonial_index_index>
21
+
22
+ <testimonial_index_createpost>
23
+ <reference name="root">
24
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
25
+ </reference>
26
+ <reference name="content">
27
+ <block type="testimonial/testimonial" name="testimonial" template="testimonial/newtestimonial.phtml" />
28
+ </reference>
29
+ </testimonial_index_createpost>
30
+ </layout>
app/design/frontend/base/default/template/testimonial/newtestimonial.phtml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="account-create">
2
+ <div class="page-title">
3
+ <h1>Create an Testimonial</h1>
4
+ </div>
5
+
6
+ <div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
7
+
8
+ <form action="<?php echo $this->getUrl(); ?>testimonial/index/createpost/" method="post" id="form-validate" class="scaffold-form" enctype="multipart/form-data">
9
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
10
+ <div class="fieldset">
11
+ <p class="form-instructions">Please enter the following information to create your testimonial.</p>
12
+ <p class="required">* Required Fields</p>
13
+ <ul class="form-list">
14
+ <li class="fields">
15
+ <div class="field">
16
+ <label for="name" class="required"><em>*</em>Name</label>
17
+ <div class="input-box">
18
+ <input type="text" id="name" name="name" value="" title="Name" maxlength="255" class="input-text required-entry" required>
19
+ </div>
20
+ </div>
21
+ </li>
22
+
23
+ <li class="fields">
24
+ <div class="field">
25
+ <label for="companyname">Company Name</label>
26
+ <div class="input-box">
27
+ <input type="text" id="companyname" name="companyname" value="" title="Company Name" class="input-text ">
28
+ </div>
29
+ </div>
30
+ </li>
31
+
32
+ <li class="fields">
33
+ <div class="field">
34
+ <label for="desigination">Desigination</label>
35
+ <div class="input-box">
36
+ <input type="text" id="desigination" name="desigination" value="" title="Last Name" maxlength="255" class="input-text">
37
+ </div>
38
+ </div>
39
+ </li>
40
+
41
+ <li>
42
+ <div class="field">
43
+ <label for="content" class="required"><em>*</em>Message</label>
44
+ <div class="input-box">
45
+ <textarea autocapitalize="off" title="Message" autocorrect="off" spellcheck="false" name="content" id="content" rows="4" class="input-text required-entry" cols="50" required></textarea>
46
+ </div>
47
+ </div>
48
+ </li>
49
+
50
+ <li class="fields">
51
+ <div class="field">
52
+ <label for="profileimage" class="required"><em>*</em>Profile Image</label>
53
+ <div class="input-box">
54
+ <input type="file" name="profileimage" id="profileimage" title="profileimage" class="input-file required-entry" required/>
55
+ </div>
56
+ </div>
57
+ </li>
58
+ </ul>
59
+ </div>
60
+ <div class="buttons-set">
61
+ <button type="submit" title="Register" class="button"><span><span>Register</span></span></button>
62
+ </div>
63
+ </form>
64
+ </div>
app/design/frontend/base/default/template/testimonial/testimonial.phtml ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h4><?php echo $this->__('Testimonial') ?></h4>
2
+ <?php
3
+
4
+ /*
5
+ This shows how to load specific fields from a record in the database.
6
+ 1) Note the load(15), this corresponds to saying "select * from table where table_id = 15"
7
+ 2) You can then just use the get(fieldname) to pull specific data from the table.
8
+ 3) If you have a field named news_id, then it becomes getNewsId, etc.
9
+ */
10
+ /*
11
+ $news = Mage::getModel('testimonial/testimonial')->load(15);
12
+ echo $news->getNewsId();
13
+ echo $news->getTitle();
14
+ echo $news->getContent();
15
+ echo $news->getStatus();
16
+ */
17
+
18
+ /*
19
+ This shows an alternate way of loading datas from a record using the database the "Magento Way" (using blocks and controller).
20
+ Uncomment blocks in /app/code/local/Namespace/Module/controllers/IndexController.php if you want to use it.
21
+
22
+ */
23
+ /*
24
+ $object = $this->getTestimonial();
25
+ echo 'id: '.$object['test_id'].'<br/>';
26
+ echo 'title: '.$object['title'].'<br/>';
27
+ echo 'content: '.$object['content'].'<br/>';
28
+ echo 'status: '.$object['status'].'<br/>';
29
+ */
30
+
31
+
32
+ /*
33
+ This shows how to load multiple rows in a collection and save a change to them.
34
+ 1) The setPageSize function will load only 5 records per page and you can set the current Page with the setCurPage function.
35
+ 2) The $collection->walk('save') allows you to save everything in the collection after all changes have been made.
36
+ */
37
+ /*
38
+ $i = 0;
39
+
40
+ $collection = Mage::getModel('testimonial/testimonial')->getCollection();
41
+ $collection->setPageSize(5);
42
+ $collection->setCurPage(2);
43
+ $size = $collection->getSize();
44
+ $cnt = count($collection);
45
+ foreach ($collection as $item) {
46
+ $i = $i+1;
47
+ $item->setTitle($i);
48
+ echo $item->getTitle();
49
+ }
50
+
51
+ $collection->walk('save');
52
+ */
53
+
54
+ /*
55
+ This shows how to load a single record and save a change.
56
+ 1) Note the setTitle, this corresponds to the table field name, title, and then you pass it the text to change.
57
+ 2) Call the save() function only on a single record.
58
+ */
59
+ /*
60
+ $object = Mage::getModel('testimonial/testimonial')->load(1);
61
+ $object->setTitle('This is a changed title');
62
+ $object->save();
63
+ */
64
+ /*
65
+
66
+ `testimonial_id` int(11) unsigned NOT NULL auto_increment,
67
+ `name` varchar(255) NOT NULL default '',
68
+ `companyname` varchar(255) NOT NULL default '',
69
+ `desigination` varchar(255) NOT NULL default '',
70
+ `profileimage` varchar(255) NOT NULL default '',
71
+ `content` text NOT NULL default '',
72
+ */
73
+ $collection = Mage::getModel('testimonial/testimonial')->getCollection();
74
+ ?>
75
+
76
+
77
+ <div class="category-products">
78
+ <ol class="products-list" id="products-list">
79
+ <?php foreach ($collection as $item) { ?>
80
+
81
+ <li class="item last even">
82
+ <a href="javascript:void(0)" title="Kaze dama pisa " class="product-image">
83
+ <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);?><?php echo $item->getProfileimage(); ?>" alt="<?php echo $item->getName(); ?>">
84
+ </a>
85
+ <div class="product-shop">
86
+ <div class="f-fix">
87
+ <div class="product-primary"><h2 class="product-name"><?php echo $item->getName(); ?></h2></div>
88
+ <div class="product-secondary">
89
+ <ul class="add-to-links">
90
+ <li><span class="link-wishlist"> <?php echo $item->getDesigination(); ?></a></li>
91
+ <li><span class="separator">|</span>
92
+ <span class="link-compare"> <?php echo $item->getCompanyname(); ?></a></li>
93
+ </ul>
94
+ </div>
95
+ <div class="desc std">
96
+ <?php echo $item->getContent(); ?>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ </li>
101
+
102
+ <?php } ?>
103
+ </ol>
104
+ </div>
105
+ <?php $configValue = Mage::getStoreConfig('chandantestimonial/testimonial_group/testimonial_frontend'); ?>
106
+ <?php if($configValue==1){ ?>
107
+ <div class="buttons-set">
108
+ <p class="back-link"><a onClick="Javascript:history.back();" class="back-link"><small>« </small>Back</a></p>
109
+ <a title="Add New Testimonial" class="button" href="<?php echo $this->getUrl() ?>testimonial/index/createpost/"><span><span>Add New Testimonial</span></span></a>
110
+ </div>
111
+ <?php } ?>
app/etc/modules/Chandan_Testimonial.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Chandan_Testimonial>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Chandan_Testimonial>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>customer_testimonial</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </summary>
10
+ <description>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.&#xD;
11
+ &#xD;
12
+ </description>
13
+ <notes>First Release.</notes>
14
+ <authors><author><name>Chandan Kumar Singh</name><user>chandan8050</user><email>chandankumar8050@gmail.com</email></author></authors>
15
+ <date>2017-01-05</date>
16
+ <time>04:21:28</time>
17
+ <contents><target name="magecommunity"><dir name="Chandan"><dir name="Testimonial"><dir name="Block"><dir name="Adminhtml"><dir name="Testimonial"><dir name="Edit"><file name="Form.php" hash="ac6e146a725ee37ef1da96bbc5fba9cd"/><dir name="Tab"><file name="Form.php" hash="f5711509573f57b237125d4be774a326"/></dir><file name="Tabs.php" hash="3bc3d0641ccfa570f5ed3899ea3286be"/></dir><file name="Edit.php" hash="5c9bca35a19831cbf068be263be78fe4"/><file name="Grid.php" hash="cc0917b6cd147b13eb547099f3b4aaa9"/></dir><file name="Testimonial.php" hash="46f67d1b882059ef197e6bf148ba7b23"/></dir><file name="Testimonial.php" hash="07f74a8cdda484ac741fea030cbe866a"/></dir><dir name="Helper"><file name="Data.php" hash="1ef8cc41cfe783ecb5def07b6852000a"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Testimonial"><file name="Collection.php" hash="b3206df570245796998ccf0e3a658dd6"/></dir><file name="Testimonial.php" hash="e62506158575a51996aed3693aa5a1fa"/></dir><file name="Status.php" hash="e4d798261b6ce4fe19cfb7d12dbf49a3"/><file name="Testimonial.php" hash="2cb1a7bb3b5a1dc7ae78a4cdf4124a78"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="TestimonialController.php" hash="c9fde22b2f133e6f937808cf794f10fd"/></dir><file name="IndexController.php" hash="3b19bcabc032af64f23a9edfaa00a606"/></dir><dir name="etc"><file name="config.xml" hash="cc8b6c28684e04751cf2143e68eda197"/><file name="system.xml" hash="8cce437660acb4ab76e05ccf08fb807a"/></dir><dir name="sql"><dir name="testimonial_setup"><file name="mysql4-install-1.0.0.php" hash="9122a959eb16d5f53b1f70f74350c915"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Chandan_Testimonial.xml" hash="e4b6b2b86b6f3e3d382ce59ec3fee4d6"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="testimonial.xml" hash="08df54e54e60b674e177be5bda54bff0"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="testimonial.xml" hash="67a832ea748c3fd4b39fd612090ffa50"/></dir><dir name="template"><dir name="testimonial"><file name="newtestimonial.phtml" hash="25d6ef223efd05c3911075e9beffad2d"/><file name="testimonial.phtml" hash="73d4d1e17deddd35b63deafdbf8663f0"/></dir></dir></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.0.0</min><max>7.1.0</max></php></required></dependencies>
20
+ </package>