Samdoit_Magetestimonials - Version 1.0.0

Version Notes

Stable Version tested the compatibility with magento 1.7.2

Download this release

Release Info

Developer Samdoit
Extension Samdoit_Magetestimonials
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (22) hide show
  1. app/code/community/Samdoit/Magetestimonials/Block/.Magetestimonials.php.swp +0 -0
  2. app/code/community/Samdoit/Magetestimonials/Block/Adminhtml/Magetestimonials.php +12 -0
  3. app/code/community/Samdoit/Magetestimonials/Block/Adminhtml/Magetestimonials/Edit.php +45 -0
  4. app/code/community/Samdoit/Magetestimonials/Block/Adminhtml/Magetestimonials/Edit/Form.php +19 -0
  5. app/code/community/Samdoit/Magetestimonials/Block/Adminhtml/Magetestimonials/Edit/Tab/Form.php +52 -0
  6. app/code/community/Samdoit/Magetestimonials/Block/Adminhtml/Magetestimonials/Edit/Tabs.php +24 -0
  7. app/code/community/Samdoit/Magetestimonials/Block/Adminhtml/Magetestimonials/Grid.php +116 -0
  8. app/code/community/Samdoit/Magetestimonials/Block/Magetestimonials.php +18 -0
  9. app/code/community/Samdoit/Magetestimonials/Helper/Data.php +6 -0
  10. app/code/community/Samdoit/Magetestimonials/Model/Magetestimonials.php +21 -0
  11. app/code/community/Samdoit/Magetestimonials/Model/Mysql4/Magetestimonials.php +10 -0
  12. app/code/community/Samdoit/Magetestimonials/Model/Mysql4/Magetestimonials/Collection.php +10 -0
  13. app/code/community/Samdoit/Magetestimonials/Model/Status.php +15 -0
  14. app/code/community/Samdoit/Magetestimonials/controllers/Adminhtml/MagetestimonialsController.php +179 -0
  15. app/code/community/Samdoit/Magetestimonials/controllers/IndexController.php +9 -0
  16. app/code/community/Samdoit/Magetestimonials/etc/config.xml +118 -0
  17. app/code/community/Samdoit/Magetestimonials/sql/magetestimonials_setup/mysql4-install-1.0.0.php +22 -0
  18. app/design/adminhtml/default/default/layout/magetestimonials.xml +8 -0
  19. app/design/frontend/default/default/layout/magetestimonials.xml +12 -0
  20. app/design/frontend/default/default/template/magetestimonials/magetestimonials.phtml +17 -0
  21. app/etc/modules/Samdoit_Magetestimonials.xml +9 -0
  22. package.xml +18 -0
app/code/community/Samdoit/Magetestimonials/Block/.Magetestimonials.php.swp ADDED
Binary file
app/code/community/Samdoit/Magetestimonials/Block/Adminhtml/Magetestimonials.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Samdoit_Magetestimonials_Block_Adminhtml_Magetestimonials extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_magetestimonials';
7
+ $this->_blockGroup = 'magetestimonials';
8
+ $this->_headerText = Mage::helper('magetestimonials')->__('Item Manager');
9
+ $this->_addButtonLabel = Mage::helper('magetestimonials')->__('Add Item');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/community/Samdoit/Magetestimonials/Block/Adminhtml/Magetestimonials/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Samdoit_Magetestimonials_Block_Adminhtml_Magetestimonials_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 = 'magetestimonials';
11
+ $this->_controller = 'adminhtml_magetestimonials';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('magetestimonials')->__('Save Item'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('magetestimonials')->__('Delete Item'));
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('magetestimonials_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'magetestimonials_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'magetestimonials_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('magetestimonials_data') && Mage::registry('magetestimonials_data')->getId() ) {
40
+ return Mage::helper('magetestimonials')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('magetestimonials_data')->getTitle()));
41
+ } else {
42
+ return Mage::helper('magetestimonials')->__('Add Item');
43
+ }
44
+ }
45
+ }
app/code/community/Samdoit/Magetestimonials/Block/Adminhtml/Magetestimonials/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Samdoit_Magetestimonials_Block_Adminhtml_Magetestimonials_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/Samdoit/Magetestimonials/Block/Adminhtml/Magetestimonials/Edit/Tab/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Samdoit_Magetestimonials_Block_Adminhtml_Magetestimonials_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('magetestimonials_form', array('legend'=>Mage::helper('magetestimonials')->__('Item information')));
10
+
11
+ $fieldset->addField('title', 'text', array(
12
+ 'label' => Mage::helper('magetestimonials')->__('Title'),
13
+ 'class' => 'required-entry',
14
+ 'required' => true,
15
+ 'name' => 'title',
16
+ ));
17
+
18
+ $fieldset->addField('status', 'select', array(
19
+ 'label' => Mage::helper('magetestimonials')->__('Status'),
20
+ 'name' => 'status',
21
+ 'values' => array(
22
+ array(
23
+ 'value' => 1,
24
+ 'label' => Mage::helper('magetestimonials')->__('Enabled'),
25
+ ),
26
+
27
+ array(
28
+ 'value' => 2,
29
+ 'label' => Mage::helper('magetestimonials')->__('Disabled'),
30
+ ),
31
+ ),
32
+ ));
33
+
34
+ $fieldset->addField('content', 'editor', array(
35
+ 'name' => 'content',
36
+ 'label' => Mage::helper('magetestimonials')->__('Content'),
37
+ 'title' => Mage::helper('magetestimonials')->__('Content'),
38
+ 'style' => 'width:700px; height:500px;',
39
+ 'wysiwyg' => false,
40
+ 'required' => true,
41
+ ));
42
+
43
+ if ( Mage::getSingleton('adminhtml/session')->getMagetestimonialsData() )
44
+ {
45
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getMagetestimonialsData());
46
+ Mage::getSingleton('adminhtml/session')->setMagetestimonialsData(null);
47
+ } elseif ( Mage::registry('magetestimonials_data') ) {
48
+ $form->setValues(Mage::registry('magetestimonials_data')->getData());
49
+ }
50
+ return parent::_prepareForm();
51
+ }
52
+ }
app/code/community/Samdoit/Magetestimonials/Block/Adminhtml/Magetestimonials/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Samdoit_Magetestimonials_Block_Adminhtml_Magetestimonials_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('magetestimonials_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('magetestimonials')->__('Item Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('magetestimonials')->__('Item Information'),
18
+ 'title' => Mage::helper('magetestimonials')->__('Item Information'),
19
+ 'content' => $this->getLayout()->createBlock('magetestimonials/adminhtml_magetestimonials_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/community/Samdoit/Magetestimonials/Block/Adminhtml/Magetestimonials/Grid.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Samdoit_Magetestimonials_Block_Adminhtml_Magetestimonials_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('magetestimonialsGrid');
9
+ $this->setDefaultSort('magetestimonials_id');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('magetestimonials/magetestimonials')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('magetestimonials_id', array(
24
+ 'header' => Mage::helper('magetestimonials')->__('ID'),
25
+ 'align' =>'right',
26
+ 'width' => '50px',
27
+ 'index' => 'magetestimonials_id',
28
+ ));
29
+
30
+ $this->addColumn('title', array(
31
+ 'header' => Mage::helper('magetestimonials')->__('Title'),
32
+ 'align' =>'left',
33
+ 'index' => 'title',
34
+ ));
35
+
36
+ /*
37
+ $this->addColumn('content', array(
38
+ 'header' => Mage::helper('magetestimonials')->__('Item Content'),
39
+ 'width' => '150px',
40
+ 'index' => 'content',
41
+ ));
42
+ */
43
+
44
+ $this->addColumn('status', array(
45
+ 'header' => Mage::helper('magetestimonials')->__('Status'),
46
+ 'align' => 'left',
47
+ 'width' => '80px',
48
+ 'index' => 'status',
49
+ 'type' => 'options',
50
+ 'options' => array(
51
+ 1 => 'Enabled',
52
+ 2 => 'Disabled',
53
+ ),
54
+ ));
55
+
56
+ $this->addColumn('action',
57
+ array(
58
+ 'header' => Mage::helper('magetestimonials')->__('Action'),
59
+ 'width' => '100',
60
+ 'type' => 'action',
61
+ 'getter' => 'getId',
62
+ 'actions' => array(
63
+ array(
64
+ 'caption' => Mage::helper('magetestimonials')->__('Edit'),
65
+ 'url' => array('base'=> '*/*/edit'),
66
+ 'field' => 'id'
67
+ )
68
+ ),
69
+ 'filter' => false,
70
+ 'sortable' => false,
71
+ 'index' => 'stores',
72
+ 'is_system' => true,
73
+ ));
74
+
75
+ $this->addExportType('*/*/exportCsv', Mage::helper('magetestimonials')->__('CSV'));
76
+ $this->addExportType('*/*/exportXml', Mage::helper('magetestimonials')->__('XML'));
77
+
78
+ return parent::_prepareColumns();
79
+ }
80
+
81
+ protected function _prepareMassaction()
82
+ {
83
+ $this->setMassactionIdField('magetestimonials_id');
84
+ $this->getMassactionBlock()->setFormFieldName('magetestimonials');
85
+
86
+ $this->getMassactionBlock()->addItem('delete', array(
87
+ 'label' => Mage::helper('magetestimonials')->__('Delete'),
88
+ 'url' => $this->getUrl('*/*/massDelete'),
89
+ 'confirm' => Mage::helper('magetestimonials')->__('Are you sure?')
90
+ ));
91
+
92
+ $statuses = Mage::getSingleton('magetestimonials/status')->getOptionArray();
93
+
94
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
95
+ $this->getMassactionBlock()->addItem('status', array(
96
+ 'label'=> Mage::helper('magetestimonials')->__('Change status'),
97
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
98
+ 'additional' => array(
99
+ 'visibility' => array(
100
+ 'name' => 'status',
101
+ 'type' => 'select',
102
+ 'class' => 'required-entry',
103
+ 'label' => Mage::helper('magetestimonials')->__('Status'),
104
+ 'values' => $statuses
105
+ )
106
+ )
107
+ ));
108
+ return $this;
109
+ }
110
+
111
+ public function getRowUrl($row)
112
+ {
113
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
114
+ }
115
+
116
+ }
app/code/community/Samdoit/Magetestimonials/Block/Magetestimonials.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Samdoit_Magetestimonials_Block_Magetestimonials extends Mage_Core_Block_Template
3
+ {
4
+ protected $_pageCollection;
5
+ public function _prepareLayout()
6
+ {
7
+ return parent::_prepareLayout();
8
+ }
9
+
10
+ public function getMagetestimonials()
11
+ {
12
+ $resource = Mage::getSingleton('core/resource');
13
+ $readConnection = $resource->getConnection('core_read');
14
+ $query = "SELECT *FROM ".$resource->getTableName('magetestimonials/magetestimonials')." WHERE status=1";
15
+ $pageCollection = $readConnection->fetchAll($query);
16
+ return $pageCollection;
17
+ }
18
+ }
app/code/community/Samdoit/Magetestimonials/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Samdoit_Magetestimonials_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Samdoit/Magetestimonials/Model/Magetestimonials.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Samdoit_Magetestimonials_Model_Magetestimonials extends Mage_Core_Model_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->_init('magetestimonials/magetestimonials');
8
+ }
9
+ /* public getDetail()
10
+ {
11
+ $resource = Mage::getSingleton('core/resource');
12
+ $readConnection = $resource->getConnection('core_read');
13
+ $query = "SELECT *FROM magetestimonials";
14
+ echo $query;
15
+ $wppageCollection = $readConnection->fetchAll($query);
16
+ foreach($wppageCollection as $key=>$value)
17
+ {
18
+ print_r($value);
19
+ }
20
+ }*/
21
+ }
app/code/community/Samdoit/Magetestimonials/Model/Mysql4/Magetestimonials.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Samdoit_Magetestimonials_Model_Mysql4_Magetestimonials extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the magetestimonials_id refers to the key field in your database table.
8
+ $this->_init('magetestimonials/magetestimonials', 'magetestimonials_id');
9
+ }
10
+ }
app/code/community/Samdoit/Magetestimonials/Model/Mysql4/Magetestimonials/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Samdoit_Magetestimonials_Model_Mysql4_Magetestimonials_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('magetestimonials/magetestimonials');
9
+ }
10
+ }
app/code/community/Samdoit/Magetestimonials/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Samdoit_Magetestimonials_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('magetestimonials')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('magetestimonials')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/community/Samdoit/Magetestimonials/controllers/Adminhtml/MagetestimonialsController.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Samdoit_Magetestimonials_Adminhtml_MagetestimonialsController extends Mage_Adminhtml_Controller_action
4
+ {
5
+ protected function _initAction() {
6
+ $this->loadLayout()
7
+ ->_setActiveMenu('admin')
8
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
9
+
10
+ return $this;
11
+ }
12
+
13
+ public function indexAction() {
14
+ $this->_initAction()
15
+ ->renderLayout();
16
+ }
17
+
18
+ public function editAction() {
19
+ $id = $this->getRequest()->getParam('id');
20
+ $model = Mage::getModel('magetestimonials/magetestimonials')->load($id);
21
+
22
+ if ($model->getId() || $id == 0) {
23
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
24
+ if (!empty($data)) {
25
+ $model->setData($data);
26
+ }
27
+
28
+ Mage::register('magetestimonials_data', $model);
29
+
30
+ $this->loadLayout();
31
+ $this->_setActiveMenu('magetestimonials/items');
32
+
33
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
34
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
35
+
36
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
37
+
38
+ $this->_addContent($this->getLayout()->createBlock('magetestimonials/adminhtml_magetestimonials_edit'))
39
+ ->_addLeft($this->getLayout()->createBlock('magetestimonials/adminhtml_magetestimonials_edit_tabs'));
40
+
41
+ $this->renderLayout();
42
+ } else {
43
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magetestimonials')->__('Item does not exist'));
44
+ $this->_redirect('*/*/');
45
+ }
46
+ }
47
+
48
+ public function newAction() {
49
+ $this->_forward('edit');
50
+ }
51
+
52
+ public function saveAction() {
53
+ if ($data = $this->getRequest()->getPost()) {
54
+
55
+ if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
56
+ try {
57
+ /* Starting upload */
58
+ $uploader = new Varien_File_Uploader('filename');
59
+
60
+ // Any extention would work
61
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
62
+ $uploader->setAllowRenameFiles(false);
63
+
64
+ // Set the file upload mode
65
+ // false -> get the file directly in the specified folder
66
+ // true -> get the file in the product like folders
67
+ // (file.jpg will go in something like /media/f/i/file.jpg)
68
+ $uploader->setFilesDispersion(false);
69
+
70
+ // We set media as the upload dir
71
+ $path = Mage::getBaseDir('media') . DS ;
72
+ $uploader->save($path, $_FILES['filename']['name'] );
73
+
74
+ } catch (Exception $e) {
75
+
76
+ }
77
+
78
+ //this way the name is saved in DB
79
+ $data['filename'] = $_FILES['filename']['name'];
80
+ }
81
+
82
+
83
+ $model = Mage::getModel('magetestimonials/magetestimonials');
84
+ $model->setData($data)
85
+ ->setId($this->getRequest()->getParam('id'));
86
+
87
+ try {
88
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
89
+ $model->setCreatedTime(now())
90
+ ->setUpdateTime(now());
91
+ } else {
92
+ $model->setUpdateTime(now());
93
+ }
94
+
95
+ $model->save();
96
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magetestimonials')->__('Item was successfully saved'));
97
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
98
+
99
+ if ($this->getRequest()->getParam('back')) {
100
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
101
+ return;
102
+ }
103
+ $this->_redirect('*/*/');
104
+ return;
105
+ } catch (Exception $e) {
106
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
107
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
108
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
109
+ return;
110
+ }
111
+ }
112
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magetestimonials')->__('Unable to find item to save'));
113
+ $this->_redirect('*/*/');
114
+ }
115
+
116
+ public function deleteAction() {
117
+ if( $this->getRequest()->getParam('id') > 0 ) {
118
+ try {
119
+ $model = Mage::getModel('magetestimonials/magetestimonials');
120
+
121
+ $model->setId($this->getRequest()->getParam('id'))
122
+ ->delete();
123
+
124
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
125
+ $this->_redirect('*/*/');
126
+ } catch (Exception $e) {
127
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
128
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
129
+ }
130
+ }
131
+ $this->_redirect('*/*/');
132
+ }
133
+
134
+ public function massDeleteAction() {
135
+ $magetestimonialsIds = $this->getRequest()->getParam('magetestimonials');
136
+ if(!is_array($magetestimonialsIds)) {
137
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
138
+ } else {
139
+ try {
140
+ foreach ($magetestimonialsIds as $magetestimonialsId) {
141
+ $magetestimonials = Mage::getModel('magetestimonials/magetestimonials')->load($magetestimonialsId);
142
+ $magetestimonials->delete();
143
+ }
144
+ Mage::getSingleton('adminhtml/session')->addSuccess(
145
+ Mage::helper('adminhtml')->__(
146
+ 'Total of %d record(s) were successfully deleted', count($magetestimonialsIds)
147
+ )
148
+ );
149
+ } catch (Exception $e) {
150
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
151
+ }
152
+ }
153
+ $this->_redirect('*/*/index');
154
+ }
155
+
156
+ public function massStatusAction()
157
+ {
158
+ $magetestimonialsIds = $this->getRequest()->getParam('magetestimonials');
159
+ if(!is_array($magetestimonialsIds)) {
160
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
161
+ } else {
162
+ try {
163
+ foreach ($magetestimonialsIds as $magetestimonialsId) {
164
+ $magetestimonials = Mage::getSingleton('magetestimonials/magetestimonials')
165
+ ->load($magetestimonialsId)
166
+ ->setStatus($this->getRequest()->getParam('status'))
167
+ ->setIsMassupdate(true)
168
+ ->save();
169
+ }
170
+ $this->_getSession()->addSuccess(
171
+ $this->__('Total of %d record(s) were successfully updated', count($magetestimonialsIds))
172
+ );
173
+ } catch (Exception $e) {
174
+ $this->_getSession()->addError($e->getMessage());
175
+ }
176
+ }
177
+ $this->_redirect('*/*/index');
178
+ }
179
+ }
app/code/community/Samdoit/Magetestimonials/controllers/IndexController.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Samdoit_Magetestimonials_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->renderLayout();
8
+ }
9
+ }
app/code/community/Samdoit/Magetestimonials/etc/config.xml ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Samdoit_Magetestimonials>
5
+ <version>1.0.0</version>
6
+ </Samdoit_Magetestimonials>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <magetestimonials>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Samdoit_Magetestimonials</module>
14
+ <frontName>testimonials</frontName>
15
+ </args>
16
+ </magetestimonials>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <magetestimonials>
21
+ <file>magetestimonials.xml</file>
22
+ </magetestimonials>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <magetestimonials>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Samdoit_Magetestimonials</module>
32
+ <frontName>magetestimonials</frontName>
33
+ </args>
34
+ </magetestimonials>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <menu>
39
+ <cms>
40
+ <children>
41
+ <magetestimonials module="magetestimonials">
42
+ <title>Testimonials</title>
43
+ <sort_order>300</sort_order>
44
+ <action>magetestimonials/adminhtml_magetestimonials</action>
45
+ </magetestimonials>
46
+ </children>
47
+ </cms>
48
+ </menu>
49
+ <acl>
50
+ <resources>
51
+ <all>
52
+ <title>Allow Everything</title>
53
+ </all>
54
+ <admin>
55
+ <children>
56
+ <Samdoit_Magetestimonials>
57
+ <title>Magetestimonials Module</title>
58
+ <sort_order>100</sort_order>
59
+ </Samdoit_Magetestimonials>
60
+ </children>
61
+ </admin>
62
+ </resources>
63
+ </acl>
64
+ <layout>
65
+ <updates>
66
+ <magetestimonials>
67
+ <file>magetestimonials.xml</file>
68
+ </magetestimonials>
69
+ </updates>
70
+ </layout>
71
+ </adminhtml>
72
+ <global>
73
+ <models>
74
+ <magetestimonials>
75
+ <class>Samdoit_Magetestimonials_Model</class>
76
+ <resourceModel>magetestimonials_mysql4</resourceModel>
77
+ </magetestimonials>
78
+ <magetestimonials_mysql4>
79
+ <class>Samdoit_Magetestimonials_Model_Mysql4</class>
80
+ <entities>
81
+ <magetestimonials>
82
+ <table>magetestimonials</table>
83
+ </magetestimonials>
84
+ </entities>
85
+ </magetestimonials_mysql4>
86
+ </models>
87
+ <resources>
88
+ <magetestimonials_setup>
89
+ <setup>
90
+ <module>Samdoit_Magetestimonials</module>
91
+ </setup>
92
+ <connection>
93
+ <use>core_setup</use>
94
+ </connection>
95
+ </magetestimonials_setup>
96
+ <magetestimonials_write>
97
+ <connection>
98
+ <use>core_write</use>
99
+ </connection>
100
+ </magetestimonials_write>
101
+ <magetestimonials_read>
102
+ <connection>
103
+ <use>core_read</use>
104
+ </connection>
105
+ </magetestimonials_read>
106
+ </resources>
107
+ <blocks>
108
+ <magetestimonials>
109
+ <class>Samdoit_Magetestimonials_Block</class>
110
+ </magetestimonials>
111
+ </blocks>
112
+ <helpers>
113
+ <magetestimonials>
114
+ <class>Samdoit_Magetestimonials_Helper</class>
115
+ </magetestimonials>
116
+ </helpers>
117
+ </global>
118
+ </config>
app/code/community/Samdoit/Magetestimonials/sql/magetestimonials_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('magetestimonials')};
10
+ CREATE TABLE {$this->getTable('magetestimonials')} (
11
+ `magetestimonials_id` int(11) unsigned NOT NULL auto_increment,
12
+ `title` varchar(255) NOT NULL default '',
13
+ `content` text NOT NULL default '',
14
+ `status` smallint(6) NOT NULL default '0',
15
+ `created_time` datetime NULL,
16
+ `update_time` datetime NULL,
17
+ PRIMARY KEY (`magetestimonials_id`)
18
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
19
+
20
+ ");
21
+
22
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/magetestimonials.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <magetestimonials_adminhtml_magetestimonials_index>
4
+ <reference name="content">
5
+ <block type="magetestimonials/adminhtml_magetestimonials" name="magetestimonials" />
6
+ </reference>
7
+ </magetestimonials_adminhtml_magetestimonials_index>
8
+ </layout>
app/design/frontend/default/default/layout/magetestimonials.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout version="0.1.0">
2
+ <magetestimonials_index_index>
3
+ <reference name="root">
4
+ <action method="setTemplate">
5
+ <template>page/1column.phtml</template>
6
+ </action>
7
+ </reference>
8
+ <reference name="content">
9
+ <block type="magetestimonials/magetestimonials" name="magetestimonials" template="magetestimonials/magetestimonials.phtml" />
10
+ </reference>
11
+ </magetestimonials_index_index>
12
+ </layout>
app/design/frontend/default/default/template/magetestimonials/magetestimonials.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $pageDetail = $this->getMagetestimonials();
3
+ ?>
4
+ <ul>
5
+ <?php foreach($pageDetail as $key=>$value) {?>
6
+ <li>
7
+ <div>
8
+ <div id="portfolio-header">
9
+ <h3><?php echo $value['title'];?></h3>
10
+ </div>
11
+ <div id="portfolio-content">
12
+ <?php echo $value['content'];?>
13
+ </div>
14
+ </div>
15
+ </li>
16
+ <?php } ?>
17
+ </ul>
app/etc/modules/Samdoit_Magetestimonials.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Samdoit_Magetestimonials>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Samdoit_Magetestimonials>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Samdoit_Magetestimonials</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Ultimate Testimonials easy to create your testimonials content and easy to access by admin user</summary>
10
+ <description>Ultimate Testimonials to add your testimonials in magento admin you can view from your front end, you can view the testimonials by http://your-domain/testimonials</description>
11
+ <notes>Stable Version tested the compatibility with magento 1.7.2</notes>
12
+ <authors><author><name>Samdoit</name><user>samdoit</user><email>arulmanickams@samdoit.com</email></author></authors>
13
+ <date>2013-09-13</date>
14
+ <time>06:06:44</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Samdoit_Magetestimonials.xml" hash="1a32c3231d97d8ffba6697afaf470e54"/></dir></target><target name="magecommunity"><dir name="Samdoit"><dir name="Magetestimonials"><dir><dir name="Block"><dir name="Adminhtml"><dir name="Magetestimonials"><dir name="Edit"><file name="Form.php" hash="12488b62f9179e0f20f7bc10330a796d"/><dir name="Tab"><file name="Form.php" hash="a529b0a0e450103c07134ff57b8cb5d8"/></dir><file name="Tabs.php" hash="0296964121029a78631d0f138e560300"/></dir><file name="Edit.php" hash="aee55b42e89e4a96b2bfd5a50d3b6f54"/><file name="Grid.php" hash="6e14be924a2d29ea85fcaab4ac951e43"/></dir><file name="Magetestimonials.php" hash="a5134df79fb61d91ac0d6da7448e5a3e"/></dir><file name="Magetestimonials.php" hash="4c6941ccce236281d0e4037c059529fc"/><file name=".Magetestimonials.php.swp" hash="5f6a330f86a45c7e28d18c51a4682dac"/></dir><dir name="Helper"><file name="Data.php" hash="72d2e7efb63169d2d14660a8e809a57e"/></dir><dir name="Model"><file name="Magetestimonials.php" hash="f4221d6b748b5b6a67b1a9a00b2dd93c"/><dir name="Mysql4"><dir name="Magetestimonials"><file name="Collection.php" hash="ba0d1ee3b3e775dac496e557317bbb3f"/></dir><file name="Magetestimonials.php" hash="cd5ed6b55cd7eccc686fa087ce5f9a57"/></dir><file name="Status.php" hash="c142ce69e01b8f92f81168247de40c9b"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MagetestimonialsController.php" hash="74aedd18b43929bc432aab99187aaec9"/></dir><file name="IndexController.php" hash="fb28034acab91b1748cea1d4e35d87fc"/></dir><dir name="etc"><file name="config.xml" hash="00100c20f8835f35b646a1e7c4ce98f7"/></dir><dir name="sql"><dir name="magetestimonials_setup"><file name="mysql4-install-1.0.0.php" hash="41b0e2c96eba9a229ab836ede486a2d5"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="magetestimonials.xml" hash="14b173f1d807050d8d8e0497a3a9e22b"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="magetestimonials"><file name="magetestimonials.phtml" hash="6a7e9ae8cc57a0effecdc78f41bc8f45"/></dir></dir><dir name="layout"><file name="magetestimonials.xml" hash="5bec12a249a0eaff29acad3706c5c17f"/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>