Jaljale_Testimonials - Version 1.0.0

Version Notes

A simple magneto module for testimonial

Download this release

Release Info

Developer Krish
Extension Jaljale_Testimonials
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (25) hide show
  1. app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonial.php +17 -0
  2. app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonial/Edit.php +44 -0
  3. app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonial/Edit/Form.php +17 -0
  4. app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonial/Edit/Tab/Form.php +62 -0
  5. app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonial/Edit/Tabs.php +21 -0
  6. app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonial/Grid.php +75 -0
  7. app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonialsbackend.php +5 -0
  8. app/code/community/Jaljale/Testimonials/Block/Index.php +42 -0
  9. app/code/community/Jaljale/Testimonials/Helper/Data.php +9 -0
  10. app/code/community/Jaljale/Testimonials/Model/Mysql4/Testimonial.php +8 -0
  11. app/code/community/Jaljale/Testimonials/Model/Mysql4/Testimonial/Collection.php +12 -0
  12. app/code/community/Jaljale/Testimonials/Model/Testimonial.php +12 -0
  13. app/code/community/Jaljale/Testimonials/controllers/Adminhtml/TestimonialController.php +209 -0
  14. app/code/community/Jaljale/Testimonials/controllers/Adminhtml/TestimonialsbackendController.php +10 -0
  15. app/code/community/Jaljale/Testimonials/controllers/IndexController.php +40 -0
  16. app/code/community/Jaljale/Testimonials/etc/config.xml +127 -0
  17. app/code/community/Jaljale/Testimonials/sql/testimonials_setup/mysql4-install-0.1.0.php +14 -0
  18. app/design/adminhtml/default/default/layout/testimonials.xml +13 -0
  19. app/design/frontend/base/default/layout/testimonials.xml +30 -0
  20. app/design/frontend/base/default/template/testimonials/all.phtml +26 -0
  21. app/design/frontend/base/default/template/testimonials/index.phtml +1 -0
  22. app/design/frontend/base/default/template/testimonials/testimonials.phtml +17 -0
  23. app/etc/modules/Jaljale_Testimonials.xml +10 -0
  24. package.xml +28 -0
  25. skin/frontend/base/default/css/testimonials.css +101 -0
app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonial.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Jaljale_Testimonials_Block_Adminhtml_Testimonial extends Mage_Adminhtml_Block_Widget_Grid_Container{
5
+
6
+ public function __construct()
7
+ {
8
+
9
+ $this->_controller = "adminhtml_testimonial";
10
+ $this->_blockGroup = "testimonials";
11
+ $this->_headerText = Mage::helper("testimonials")->__("Testimonial Manager");
12
+ $this->_addButtonLabel = Mage::helper("testimonials")->__("Add New Item");
13
+ parent::__construct();
14
+
15
+ }
16
+
17
+ }
app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonial/Edit.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jaljale_Testimonials_Block_Adminhtml_Testimonial_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+
8
+ parent::__construct();
9
+ $this->_objectId = "id";
10
+ $this->_blockGroup = "testimonials";
11
+ $this->_controller = "adminhtml_testimonial";
12
+ $this->_updateButton("save", "label", Mage::helper("testimonials")->__("Save Item"));
13
+ $this->_updateButton("delete", "label", Mage::helper("testimonials")->__("Delete Item"));
14
+
15
+ $this->_addButton("saveandcontinue", array(
16
+ "label" => Mage::helper("testimonials")->__("Save And Continue Edit"),
17
+ "onclick" => "saveAndContinueEdit()",
18
+ "class" => "save",
19
+ ), -100);
20
+
21
+
22
+
23
+ $this->_formScripts[] = "
24
+
25
+ function saveAndContinueEdit(){
26
+ editForm.submit($('edit_form').action+'back/edit/');
27
+ }
28
+ ";
29
+ }
30
+
31
+ public function getHeaderText()
32
+ {
33
+ if( Mage::registry("testimonial_data") && Mage::registry("testimonial_data")->getId() ){
34
+
35
+ return Mage::helper("testimonials")->__("Edit Item '%s'", $this->htmlEscape(Mage::registry("testimonial_data")->getId()));
36
+
37
+ }
38
+ else{
39
+
40
+ return Mage::helper("testimonials")->__("Add Item");
41
+
42
+ }
43
+ }
44
+ }
app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonial/Edit/Form.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Testimonials_Block_Adminhtml_Testimonial_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ "id" => "edit_form",
8
+ "action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
9
+ "method" => "post",
10
+ "enctype" =>"multipart/form-data",
11
+ )
12
+ );
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+ }
app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonial/Edit/Tab/Form.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Testimonials_Block_Adminhtml_Testimonial_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset("testimonials_form", array("legend"=>Mage::helper("testimonials")->__("Item information")));
10
+
11
+
12
+ $fieldset->addField("name", "text", array(
13
+ "label" => Mage::helper("testimonials")->__("Name"),
14
+ "class" => "required-entry",
15
+ "required" => true,
16
+ "name" => "name",
17
+ ));
18
+
19
+ $fieldset->addField('image', 'image', array(
20
+ 'label' => Mage::helper('testimonials')->__('Image'),
21
+ 'name' => 'image',
22
+ 'note' => '(*.jpg, *.png, *.gif)',
23
+ ));
24
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(
25
+ Mage_Core_Model_Locale::FORMAT_TYPE_SHORT
26
+ );
27
+
28
+ $fieldset->addField('date', 'date', array(
29
+ 'label' => Mage::helper('testimonials')->__('Date'),
30
+ 'name' => 'date',
31
+ "class" => "required-entry",
32
+ "required" => true,
33
+ 'time' => true,
34
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
35
+ 'format' => $dateFormatIso
36
+ ));
37
+ $fieldset->addField("title", "text", array(
38
+ "label" => Mage::helper("testimonials")->__("Title`"),
39
+ "class" => "required-entry",
40
+ "required" => true,
41
+ "name" => "title",
42
+ ));
43
+
44
+ $fieldset->addField("description", "textarea", array(
45
+ "label" => Mage::helper("testimonials")->__("Description"),
46
+ "class" => "required-entry",
47
+ "required" => true,
48
+ "name" => "description",
49
+ ));
50
+
51
+
52
+ if (Mage::getSingleton("adminhtml/session")->getTestimonialData())
53
+ {
54
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getTestimonialData());
55
+ Mage::getSingleton("adminhtml/session")->setTestimonialData(null);
56
+ }
57
+ elseif(Mage::registry("testimonial_data")) {
58
+ $form->setValues(Mage::registry("testimonial_data")->getData());
59
+ }
60
+ return parent::_prepareForm();
61
+ }
62
+ }
app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonial/Edit/Tabs.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Testimonials_Block_Adminhtml_Testimonial_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId("testimonial_tabs");
8
+ $this->setDestElementId("edit_form");
9
+ $this->setTitle(Mage::helper("testimonials")->__("Item Information"));
10
+ }
11
+ protected function _beforeToHtml()
12
+ {
13
+ $this->addTab("form_section", array(
14
+ "label" => Mage::helper("testimonials")->__("Item Information"),
15
+ "title" => Mage::helper("testimonials")->__("Item Information"),
16
+ "content" => $this->getLayout()->createBlock("testimonials/adminhtml_testimonial_edit_tab_form")->toHtml(),
17
+ ));
18
+ return parent::_beforeToHtml();
19
+ }
20
+
21
+ }
app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonial/Grid.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jaljale_Testimonials_Block_Adminhtml_Testimonial_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId("testimonialGrid");
10
+ $this->setDefaultSort("id");
11
+ $this->setDefaultDir("DESC");
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+
15
+ protected function _prepareCollection()
16
+ {
17
+ $collection = Mage::getModel("testimonials/testimonial")->getCollection();
18
+ $this->setCollection($collection);
19
+ return parent::_prepareCollection();
20
+ }
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn("id", array(
24
+ "header" => Mage::helper("testimonials")->__("ID"),
25
+ "align" =>"right",
26
+ "width" => "50px",
27
+ "type" => "number",
28
+ "index" => "id",
29
+ ));
30
+
31
+ $this->addColumn("id", array(
32
+ "header" => Mage::helper("testimonials")->__("Tid"),
33
+ "index" => "id",
34
+ ));
35
+ $this->addColumn("name", array(
36
+ "header" => Mage::helper("testimonials")->__("Name"),
37
+ "index" => "name",
38
+ ));
39
+ $this->addColumn('date', array(
40
+ 'header' => Mage::helper('testimonials')->__('Date'),
41
+ 'index' => 'date',
42
+ 'type' => 'datetime',
43
+ ));
44
+ $this->addColumn("title", array(
45
+ "header" => Mage::helper("testimonials")->__("Title`"),
46
+ "index" => "title",
47
+ ));
48
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
49
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
50
+
51
+ return parent::_prepareColumns();
52
+ }
53
+
54
+ public function getRowUrl($row)
55
+ {
56
+ return $this->getUrl("*/*/edit", array("id" => $row->getId()));
57
+ }
58
+
59
+
60
+
61
+ protected function _prepareMassaction()
62
+ {
63
+ $this->setMassactionIdField('id');
64
+ $this->getMassactionBlock()->setFormFieldName('ids');
65
+ $this->getMassactionBlock()->setUseSelectAll(true);
66
+ $this->getMassactionBlock()->addItem('remove_testimonial', array(
67
+ 'label'=> Mage::helper('testimonials')->__('Remove Testimonial'),
68
+ 'url' => $this->getUrl('*/adminhtml_testimonial/massRemove'),
69
+ 'confirm' => Mage::helper('testimonials')->__('Are you sure?')
70
+ ));
71
+ return $this;
72
+ }
73
+
74
+
75
+ }
app/code/community/Jaljale/Testimonials/Block/Adminhtml/Testimonialsbackend.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jaljale_Testimonials_Block_Adminhtml_Testimonialsbackend extends Mage_Adminhtml_Block_Template {
4
+
5
+ }
app/code/community/Jaljale/Testimonials/Block/Index.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Testimonials_Block_Index extends Mage_Core_Block_Template{
3
+
4
+ public function getTestimonials(){
5
+ $collection = $this->getCollection();
6
+ $collection->setOrder('id','DESC');
7
+ return $collection;
8
+ }
9
+
10
+ public function getLastestTestimonials(){
11
+ $collection = $this->getTestimonials()->getFirstItem();
12
+ return $collection;
13
+ }
14
+
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+ $collection = Mage::getModel('testimonials/testimonial')->getCollection();
19
+ $this->setCollection($collection);
20
+ }
21
+
22
+ protected function _prepareLayout()
23
+ {
24
+ parent::_prepareLayout();
25
+
26
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
27
+ $pager->setAvailableLimit(array(1=>1,10=>10,20=>20,'all'=>'all'));
28
+ $pager->setCollection($this->getCollection());
29
+ $this->setChild('pager', $pager);
30
+ $this->getCollection()->load();
31
+ return $this;
32
+ }
33
+
34
+ public function getPagerHtml()
35
+ {
36
+ return $this->getChildHtml('pager');
37
+ }
38
+
39
+
40
+
41
+
42
+ }
app/code/community/Jaljale/Testimonials/Helper/Data.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Testimonials_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ function getImage($testimonial){
5
+ return Mage::getBaseUrl('media')."/".$testimonial->getData('image');
6
+
7
+ }
8
+ }
9
+
app/code/community/Jaljale/Testimonials/Model/Mysql4/Testimonial.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Testimonials_Model_Mysql4_Testimonial extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("testimonials/testimonial", "id");
7
+ }
8
+ }
app/code/community/Jaljale/Testimonials/Model/Mysql4/Testimonial/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Testimonials_Model_Mysql4_Testimonial_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("testimonials/testimonial");
7
+ }
8
+
9
+
10
+
11
+ }
12
+
app/code/community/Jaljale/Testimonials/Model/Testimonial.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jaljale_Testimonials_Model_Testimonial extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct(){
6
+
7
+ $this->_init("testimonials/testimonial");
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Jaljale/Testimonials/controllers/Adminhtml/TestimonialController.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jaljale_Testimonials_Adminhtml_TestimonialController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ protected function _initAction()
6
+ {
7
+ $this->loadLayout()->_setActiveMenu("testimonials/testimonial")->_addBreadcrumb(Mage::helper("adminhtml")->__("Testimonial Manager"),Mage::helper("adminhtml")->__("Testimonial Manager"));
8
+ return $this;
9
+ }
10
+ public function indexAction()
11
+ {
12
+ $this->_title($this->__("Testimonials"));
13
+ $this->_title($this->__("Manager Testimonial"));
14
+
15
+ $this->_initAction();
16
+ $this->renderLayout();
17
+ }
18
+ public function editAction()
19
+ {
20
+ $this->_title($this->__("Testimonials"));
21
+ $this->_title($this->__("Testimonial"));
22
+ $this->_title($this->__("Edit Item"));
23
+
24
+ $id = $this->getRequest()->getParam("id");
25
+ $model = Mage::getModel("testimonials/testimonial")->load($id);
26
+ if ($model->getId()) {
27
+ Mage::register("testimonial_data", $model);
28
+ $this->loadLayout();
29
+ $this->_setActiveMenu("testimonials/testimonial");
30
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Testimonial Manager"), Mage::helper("adminhtml")->__("Testimonial Manager"));
31
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Testimonial Description"), Mage::helper("adminhtml")->__("Testimonial Description"));
32
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
33
+ $this->_addContent($this->getLayout()->createBlock("testimonials/adminhtml_testimonial_edit"))->_addLeft($this->getLayout()->createBlock("testimonials/adminhtml_testimonial_edit_tabs"));
34
+ $this->renderLayout();
35
+ }
36
+ else {
37
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("testimonials")->__("Item does not exist."));
38
+ $this->_redirect("*/*/");
39
+ }
40
+ }
41
+
42
+ public function newAction()
43
+ {
44
+
45
+ $this->_title($this->__("Testimonials"));
46
+ $this->_title($this->__("Testimonial"));
47
+ $this->_title($this->__("New Item"));
48
+
49
+ $id = $this->getRequest()->getParam("id");
50
+ $model = Mage::getModel("testimonials/testimonial")->load($id);
51
+
52
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
53
+ if (!empty($data)) {
54
+ $model->setData($data);
55
+ }
56
+
57
+ Mage::register("testimonial_data", $model);
58
+
59
+ $this->loadLayout();
60
+ $this->_setActiveMenu("testimonials/testimonial");
61
+
62
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
63
+
64
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Testimonial Manager"), Mage::helper("adminhtml")->__("Testimonial Manager"));
65
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Testimonial Description"), Mage::helper("adminhtml")->__("Testimonial Description"));
66
+
67
+
68
+ $this->_addContent($this->getLayout()->createBlock("testimonials/adminhtml_testimonial_edit"))->_addLeft($this->getLayout()->createBlock("testimonials/adminhtml_testimonial_edit_tabs"));
69
+
70
+ $this->renderLayout();
71
+
72
+ }
73
+ public function saveAction()
74
+ {
75
+
76
+ $post_data=$this->getRequest()->getPost();
77
+
78
+
79
+ if ($post_data) {
80
+
81
+ try {
82
+
83
+
84
+ //save image
85
+ try{
86
+
87
+ if((bool)$post_data['image']['delete']==1) {
88
+
89
+ $post_data['image']='';
90
+
91
+ }
92
+ else {
93
+
94
+ unset($post_data['image']);
95
+
96
+ if (isset($_FILES)){
97
+
98
+ if ($_FILES['image']['name']) {
99
+
100
+ if($this->getRequest()->getParam("id")){
101
+ $model = Mage::getModel("testimonials/testimonial")->load($this->getRequest()->getParam("id"));
102
+ if($model->getData('image')){
103
+ $io = new Varien_Io_File();
104
+ $io->rm(Mage::getBaseDir('media').DS.implode(DS,explode('/',$model->getData('image'))));
105
+ }
106
+ }
107
+ $path = Mage::getBaseDir('media') . DS . 'testimonials' . DS .'testimonial'.DS;
108
+ $uploader = new Varien_File_Uploader('image');
109
+ $uploader->setAllowedExtensions(array('jpg','png','gif'));
110
+ $uploader->setAllowRenameFiles(false);
111
+ $uploader->setFilesDispersion(false);
112
+ $destFile = $path.$_FILES['image']['name'];
113
+ $filename = $uploader->getNewFileName($destFile);
114
+ $uploader->save($path, $filename);
115
+
116
+ $post_data['image']='testimonials/testimonial/'.$filename;
117
+ }
118
+ }
119
+ }
120
+
121
+ } catch (Exception $e) {
122
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
123
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
124
+ return;
125
+ }
126
+ //save image
127
+
128
+
129
+ $model = Mage::getModel("testimonials/testimonial")
130
+ ->addData($post_data)
131
+ ->setId($this->getRequest()->getParam("id"))
132
+ ->save();
133
+
134
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Testimonial was successfully saved"));
135
+ Mage::getSingleton("adminhtml/session")->setTestimonialData(false);
136
+
137
+ if ($this->getRequest()->getParam("back")) {
138
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
139
+ return;
140
+ }
141
+ $this->_redirect("*/*/");
142
+ return;
143
+ }
144
+ catch (Exception $e) {
145
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
146
+ Mage::getSingleton("adminhtml/session")->setTestimonialData($this->getRequest()->getPost());
147
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
148
+ return;
149
+ }
150
+
151
+ }
152
+ $this->_redirect("*/*/");
153
+ }
154
+
155
+
156
+
157
+ public function deleteAction()
158
+ {
159
+ if( $this->getRequest()->getParam("id") > 0 ) {
160
+ try {
161
+ $model = Mage::getModel("testimonials/testimonial");
162
+ $model->setId($this->getRequest()->getParam("id"))->delete();
163
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
164
+ $this->_redirect("*/*/");
165
+ }
166
+ catch (Exception $e) {
167
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
168
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
169
+ }
170
+ }
171
+ $this->_redirect("*/*/");
172
+ }
173
+
174
+
175
+ public function massRemoveAction()
176
+ {
177
+ try {
178
+ $ids = $this->getRequest()->getPost('ids', array());
179
+ foreach ($ids as $id) {
180
+ $model = Mage::getModel("testimonials/testimonial");
181
+ $model->setId($id)->delete();
182
+ }
183
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item(s) was successfully removed"));
184
+ }
185
+ catch (Exception $e) {
186
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
187
+ }
188
+ $this->_redirect('*/*/');
189
+ }
190
+
191
+ /**
192
+ * Export order grid to CSV format
193
+ */
194
+ public function exportCsvAction()
195
+ {
196
+ $fileName = 'testimonial.csv';
197
+ $grid = $this->getLayout()->createBlock('testimonials/adminhtml_testimonial_grid');
198
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
199
+ }
200
+ /**
201
+ * Export order grid to Excel XML format
202
+ */
203
+ public function exportExcelAction()
204
+ {
205
+ $fileName = 'testimonial.xml';
206
+ $grid = $this->getLayout()->createBlock('testimonials/adminhtml_testimonial_grid');
207
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
208
+ }
209
+ }
app/code/community/Jaljale/Testimonials/controllers/Adminhtml/TestimonialsbackendController.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Testimonials_Adminhtml_TestimonialsbackendController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->_title($this->__("Backend Page Title"));
8
+ $this->renderLayout();
9
+ }
10
+ }
app/code/community/Jaljale/Testimonials/controllers/IndexController.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Testimonials_IndexController extends Mage_Core_Controller_Front_Action{
3
+ public function IndexAction() {
4
+
5
+ $this->loadLayout();
6
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Front Testimonial"));
7
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
8
+ $breadcrumbs->addCrumb("home", array(
9
+ "label" => $this->__("Home Page"),
10
+ "title" => $this->__("Home Page"),
11
+ "link" => Mage::getBaseUrl()
12
+ ));
13
+
14
+ $breadcrumbs->addCrumb("front testimonial", array(
15
+ "label" => $this->__("Front Testimonial"),
16
+ "title" => $this->__("Front Testimonial")
17
+ ));
18
+
19
+ $this->renderLayout();
20
+
21
+ }
22
+
23
+ public function testimonialsAction(){
24
+
25
+ $this->loadLayout();
26
+ $this->renderLayout();
27
+
28
+ $request = $this->getRequest();
29
+
30
+ }
31
+
32
+ public function allAction(){
33
+
34
+ $this->loadLayout();
35
+ $this->renderLayout();
36
+
37
+ $request = $this->getRequest();
38
+
39
+ }
40
+ }
app/code/community/Jaljale/Testimonials/etc/config.xml ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Jaljale_Testimonials>
5
+ <version>0.1.0</version>
6
+ </Jaljale_Testimonials>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <testimonials>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Jaljale_Testimonials</module>
14
+ <frontName>testimonials</frontName>
15
+ </args>
16
+ </testimonials>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <testimonials>
21
+ <file>testimonials.xml</file>
22
+ </testimonials>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <helpers>
28
+ <testimonials>
29
+ <class>Jaljale_Testimonials_Helper</class>
30
+ </testimonials>
31
+ </helpers>
32
+ <blocks>
33
+ <testimonials>
34
+ <class>Jaljale_Testimonials_Block</class>
35
+ </testimonials>
36
+ </blocks>
37
+ <models>
38
+ <testimonials>
39
+ <class>Jaljale_Testimonials_Model</class>
40
+ <resourceModel>testimonials_mysql4</resourceModel>
41
+ </testimonials>
42
+ <testimonials_mysql4>
43
+ <class>Jaljale_Testimonials_Model_Mysql4</class>
44
+ <entities>
45
+ <testimonial>
46
+ <table>testimonial</table>
47
+ </testimonial>
48
+ </entities>
49
+ </testimonials_mysql4>
50
+ </models>
51
+ <resources>
52
+ <testimonials_setup>
53
+ <setup>
54
+ <module>Jaljale_Testimonials</module>
55
+ </setup>
56
+ <connection>
57
+ <use>core_setup</use>
58
+ </connection>
59
+ </testimonials_setup>
60
+ <testimonials_write>
61
+ <connection>
62
+ <use>core_write</use>
63
+ </connection>
64
+ </testimonials_write>
65
+ <testimonials_read>
66
+ <connection>
67
+ <use>core_read</use>
68
+ </connection>
69
+ </testimonials_read>
70
+ </resources>
71
+ </global>
72
+ <admin>
73
+ <routers>
74
+ <testimonials>
75
+ <use>admin</use>
76
+ <args>
77
+ <module>Jaljale_Testimonials</module>
78
+ <frontName>admin_testimonials</frontName>
79
+ </args>
80
+ </testimonials>
81
+ </routers>
82
+ </admin>
83
+ <adminhtml>
84
+ <menu>
85
+ <jaljale>
86
+ <children>
87
+ <testimonial module="testimonials">
88
+ <title>Manage Testimonial</title>
89
+ <sort_order>0</sort_order>
90
+ <action>admin_testimonials/adminhtml_testimonial</action>
91
+ </testimonial>
92
+ </children>
93
+ </jaljale>
94
+ </menu>
95
+ <acl>
96
+ <resources>
97
+ <all>
98
+ <title>Allow Everything</title>
99
+ </all>
100
+ <admin>
101
+ <children>
102
+ <testimonials translate="title" module="testimonials">
103
+ <title>Testimonials</title>
104
+ <sort_order>1000</sort_order>
105
+ <children>
106
+ <testimonialsbackend translate="title">
107
+ <title>Backend Page Title</title>
108
+ </testimonialsbackend>
109
+ <testimonial translate="title">
110
+ <title>Manage Testimonial</title>
111
+ <sort_order>0</sort_order>
112
+ </testimonial>
113
+ </children>
114
+ </testimonials>
115
+ </children>
116
+ </admin>
117
+ </resources>
118
+ </acl>
119
+ <layout>
120
+ <updates>
121
+ <testimonials>
122
+ <file>testimonials.xml</file>
123
+ </testimonials>
124
+ </updates>
125
+ </layout>
126
+ </adminhtml>
127
+ </config>
app/code/community/Jaljale/Testimonials/sql/testimonials_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $sql=<<<SQLTEXT
5
+ CREATE TABLE IF NOT EXISTS `testimonial` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(40) NOT NULL,`image` varchar(100) NOT NULL,`date` date NOT NULL,`title` varchar(30) NOT NULL,`description` varchar(200) NOT NULL,PRIMARY KEY (`id`));
6
+
7
+ SQLTEXT;
8
+
9
+ $installer->run($sql);
10
+ //demo
11
+ //Mage::getModel('core/url_rewrite')->setId(null);
12
+ //demo
13
+ $installer->endSetup();
14
+
app/design/adminhtml/default/default/layout/testimonials.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <testimonials_adminhtml_testimonialsbackend_index>
4
+ <reference name="content">
5
+ <block type="testimonials/adminhtml_testimonialsbackend" name="testimonialsbackend" template="testimonials/testimonialsbackend.phtml"/>
6
+ </reference>
7
+ </testimonials_adminhtml_testimonialsbackend_index>
8
+ <testimonials_adminhtml_testimonial_index>
9
+ <reference name="content">
10
+ <block type="testimonials/adminhtml_testimonial" name="testimonial" />
11
+ </reference>
12
+ </testimonials_adminhtml_testimonial_index>
13
+ </layout>
app/design/frontend/base/default/layout/testimonials.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="root">
5
+ <action method="setTemplate">
6
+ <template>page/1column.phtml</template>
7
+ </action>
8
+ </reference>
9
+ <reference name="head">
10
+ <action method="addCss">
11
+ <template>css/testimonials.css</template>
12
+ </action>
13
+ </reference>
14
+ </default>
15
+ <testimonials_index_index>
16
+ <reference name="content">
17
+ <block type="testimonials/index" name="testimonials_index" template="testimonials/index.phtml" />
18
+ </reference>
19
+ </testimonials_index_index>
20
+ <testimonials_index_testimonials>
21
+ <reference name="content">
22
+ <block type="testimonials/index" name="testimonials_testimonials" template="testimonials/testimonials.phtml" />
23
+ </reference>
24
+ </testimonials_index_testimonials>
25
+ <testimonials_index_all>
26
+ <reference name="content">
27
+ <block type="testimonials/index" name="testimonials_all" template="testimonials/all.phtml" />
28
+ </reference>
29
+ </testimonials_index_all>
30
+ </layout>
app/design/frontend/base/default/template/testimonials/all.phtml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="container">
2
+ <h2><a href="all"><strong style="color: #30506b; padding-left: 20px;">CLIENT'S TESTIMONIALS</strong></a></h2>
3
+ <?php
4
+ $collection = $this->getTestimonials();
5
+ foreach($collection as $item){
6
+ ?>
7
+ <div class="testimonials clearfix" style="width: 555px;max-width: 100%;margin-bottom:5px;">
8
+ <div class="client-img">
9
+
10
+ <img class="img-responsive img-thumbnail" src="<?php echo Mage::helper('testimonials')-> getImage($item) ?>" alt="" /><br>
11
+ <h3 style="text-align: center;margin:0px;"><?php echo $item->getData('name'); ?></h3>
12
+ </div>
13
+ <div class="clients-view">
14
+ <h1 style="margin-top:0px;float:left"><?php echo $item->getData('title'); ?></h1>
15
+ <p style="float:right;font-size:12px;color:#666;"><?php echo $item->getData('date'); ?></p><br/>
16
+ <p style="margin-top:30px;"><?php echo $item->getData('description'); ?></p>
17
+ </div>
18
+ </div>
19
+
20
+ <?php
21
+ }
22
+
23
+ echo $this->getPagerHtml();
24
+ ?>
25
+
26
+ </div>
app/design/frontend/base/default/template/testimonials/index.phtml ADDED
@@ -0,0 +1 @@
 
1
+ Demo Page
app/design/frontend/base/default/template/testimonials/testimonials.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $item = $this->getLastestTestimonials();
3
+
4
+ ?>
5
+
6
+
7
+ <div class="testimonials clearfix">
8
+ <div class="client-img">
9
+ <img class="img-responsive img-thumbnail" src="<?php echo Mage::helper('testimonials')-> getImage($item) ?>" alt="" /></div>
10
+ <div class="clients-view">
11
+ <p style="float:right;font-size:12px;color:#666;"><?php echo $item->getData('date'); ?></p><br/>
12
+ <p><?php echo $item->getData('description'); ?></p>
13
+ </div>
14
+ </div>
15
+ <label class="client-name"><?php echo $item->getData('name'); ?><span>|</span><a href="<?php echo $this->getUrl('')."testimonials/index/all"?>">View All</a></label>
16
+
17
+
app/etc/modules/Jaljale_Testimonials.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <modules>
4
+ <Jaljale_Testimonials>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>0.1.0</version>
8
+ </Jaljale_Testimonials>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Jaljale_Testimonials</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.gnu.org/licenses/gpl-3.0.en.html">GNU General Public License (GPL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>A testimonial from a satisfied customer is the most effective means to convince a new customer that you are believable and make them feel secure to purchase items or services from your store. Let everyone know what your customers think about your store or products.</summary>
10
+ <description>You can add customer name, photo and their valuable comments about your store on testimonials. Show testimonials on sidebar, footer or separate page. Switch between single view and all list view.&#xD;
11
+ Feature&#xD;
12
+ * Add testimonials from admin panel&#xD;
13
+ * Display testimonials block in sidebar, footer or separate page&#xD;
14
+ * Show all testimonials in single page.&#xD;
15
+ * No programming skills required&#xD;
16
+ * Easy to install and configure&#xD;
17
+ &#xD;
18
+ Magento Supported Version: &#xD;
19
+ 1.9.x.x&#xD;
20
+ Support for Magento 2.0 will be updated</description>
21
+ <notes>A simple magneto module for testimonial</notes>
22
+ <authors><author><name>Krish</name><user>jaljale</user><email>jaljaletech@gmail.com</email></author><author><name>Subin Shrestha</name><user>sthasbin</user><email>sthasbin@jaljale.com</email></author></authors>
23
+ <date>2015-06-16</date>
24
+ <time>06:16:48</time>
25
+ <contents><target name="magecommunity"><dir name="Jaljale"><dir name="Testimonials"><dir name="Block"><dir name="Adminhtml"><dir name="Testimonial"><dir name="Edit"><file name="Form.php" hash="ac7a4c4ddf863c2ece0a520965494d70"/><dir name="Tab"><file name="Form.php" hash="e738d03c420d0df7f8d428ea2eba3958"/></dir><file name="Tabs.php" hash="1819ce16380bd4d25e01b6db9e2de4df"/></dir><file name="Edit.php" hash="4a17e51b2fa9d07012c0b83a5ad050f2"/><file name="Grid.php" hash="423d6ad3085fcc00a723286eae7c6015"/></dir><file name="Testimonial.php" hash="1c63057236b5278810773444841a21b3"/><file name="Testimonialsbackend.php" hash="84e8c38cb00defa003da9aa89960b4c3"/></dir><file name="Index.php" hash="dd280e811504ed94e7bbf0ae25124208"/></dir><dir name="Helper"><file name="Data.php" hash="6754286c5f49dc232e6d2d7a963692fe"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Testimonial"><file name="Collection.php" hash="4999acde88c6cb936e359ad35361f681"/></dir><file name="Testimonial.php" hash="6556f75356bff5a7e60e39af26b29408"/></dir><file name="Testimonial.php" hash="858eee754d8c78cb006074a29d0e3cd9"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="TestimonialController.php" hash="f640888f4931b6c8dd1a2e4c189195ba"/><file name="TestimonialsbackendController.php" hash="e01406a0e4fdc624fe9a7266b75b537c"/></dir><file name="IndexController.php" hash="354d759c88ed607cb156d6932f803822"/></dir><dir name="etc"><file name="config.xml" hash="2d448080ec95df0ac4012f19f6c8467b"/></dir><dir name="sql"><dir name="testimonials_setup"><file name="mysql4-install-0.1.0.php" hash="019f4fb97141e5aff7fda57066894158"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="testimonials.xml" hash="35ee0c6dffecda0f9864953b4718f470"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="testimonials.xml" hash="99cbd9e9e347cd33c30eeb5b3e2be79f"/></dir><dir name="template"><dir name="testimonials"><file name="all.phtml" hash="a692c92713e8b1f3961caf637844f291"/><file name="index.phtml" hash="395b5512423d31a9526f94e3d7dcc13a"/><file name="testimonials.phtml" hash="57a09a43b3431261c7387177936486bf"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Jaljale_Testimonials.xml" hash="b558ad0a1ed075974ca6179ddcd55bc8"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="testimonials.css" hash="1ece9085d758334a21da27c21c30f960"/></dir></dir></dir></dir></target></contents>
26
+ <compatible/>
27
+ <dependencies><required><php><min>5.1.3</min><max>6.5.5</max></php></required></dependencies>
28
+ </package>
skin/frontend/base/default/css/testimonials.css ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .testimonials {
2
+ border: 1px solid #ebebeb;
3
+ background-color: #ebebeb;
4
+ border-radius: 4px;
5
+ padding: 20px;
6
+ }
7
+
8
+ .client-name >a {
9
+ font-family: proximanovaregular;
10
+ color: #00bfef;
11
+ font-size: 16px;
12
+ }
13
+
14
+ .client-name >span {
15
+ padding: 0 10px;
16
+ }
17
+
18
+ .testimonials:before {
19
+ content: "";
20
+ border-top: 16px solid #ebebeb;
21
+ border-left: 20px solid transparent;
22
+ position: absolute;
23
+ top: 100%;
24
+ left: 25%;
25
+ }
26
+
27
+ .client-img {
28
+ float: left;
29
+ margin-right: 20px;
30
+ max-width: 100%;
31
+ width: 160px;
32
+ }
33
+
34
+ .client-name {
35
+ position: absolute;
36
+ left: 32%;
37
+ margin-top: 10px;
38
+ font-weight: bold;
39
+ font-size: 16px;
40
+ }
41
+ /* If you have include bootstrap css then the following css doesn't required */
42
+
43
+ .clearfix:before,
44
+ .clearfix:after,
45
+ .container:before,
46
+ .container:after {
47
+ display: table;
48
+ content: " ";
49
+ }
50
+
51
+ .clearfix:after,
52
+ .container:after {
53
+ clear: both;
54
+ }
55
+
56
+ .img-responsive {
57
+ display: block;
58
+ width: 100% \9;
59
+ max-width: 100%;
60
+ height: auto;
61
+ }
62
+
63
+ .img-thumbnail {
64
+ display: inline-block;
65
+ width: 100% \9;
66
+ max-width: 100%;
67
+ height: auto;
68
+ padding: 4px;
69
+ line-height: 1.42857143;
70
+ background-color: #fff;
71
+ border: 1px solid #ddd;
72
+ border-radius: 4px;
73
+ -webkit-transition: all .2s ease-in-out;
74
+ -o-transition: all .2s ease-in-out;
75
+ transition: all .2s ease-in-out;
76
+ }
77
+
78
+ .container {
79
+ padding-right: 15px;
80
+ padding-left: 15px;
81
+ margin-right: auto;
82
+ margin-left: auto;
83
+ }
84
+
85
+ @media (min-width: 768px) {
86
+ .container {
87
+ width: 750px;
88
+ }
89
+ }
90
+
91
+ @media (min-width: 992px) {
92
+ .container {
93
+ width: 970px;
94
+ }
95
+ }
96
+
97
+ @media (min-width: 1200px) {
98
+ .container {
99
+ width: 1170px;
100
+ }
101
+ }