samsys-nivo-banner-1-0 - Version 1.0.0

Version Notes

Fresh release.

Download this release

Release Info

Developer sam-sys pvt ltd
Extension samsys-nivo-banner-1-0
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (69) hide show
  1. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner.php +20 -0
  2. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner/Edit.php +46 -0
  3. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner/Edit/Form.php +26 -0
  4. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner/Edit/Tab/Form.php +137 -0
  5. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner/Edit/Tabs.php +27 -0
  6. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner/Grid.php +160 -0
  7. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner/Grid/Renderer/Image.php +35 -0
  8. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup.php +19 -0
  9. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Edit.php +51 -0
  10. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Edit/Form.php +29 -0
  11. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Edit/Tab/Banner.php +123 -0
  12. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Edit/Tab/Form.php +190 -0
  13. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Edit/Tab/Gridbanner.php +48 -0
  14. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Edit/Tabs.php +34 -0
  15. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Grid.php +143 -0
  16. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Widget/Grid.php +28 -0
  17. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Widget/Grid/Column.php +36 -0
  18. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Widget/Grid/Column/Filter/Banner.php +12 -0
  19. app/code/community/Samsys/Nivobanner/Block/Adminhtml/Widget/Grid/Column/Renderer/Banner.php +35 -0
  20. app/code/community/Samsys/Nivobanner/Block/Nivobanner.php +192 -0
  21. app/code/community/Samsys/Nivobanner/Helper/Data.php +59 -0
  22. app/code/community/Samsys/Nivobanner/Model/Mysql4/Nivobanner.php +10 -0
  23. app/code/community/Samsys/Nivobanner/Model/Mysql4/Nivobanner/Collection.php +10 -0
  24. app/code/community/Samsys/Nivobanner/Model/Mysql4/Nivobannergroup.php +35 -0
  25. app/code/community/Samsys/Nivobanner/Model/Mysql4/Nivobannergroup/Collection.php +24 -0
  26. app/code/community/Samsys/Nivobanner/Model/Nivobanner.php +47 -0
  27. app/code/community/Samsys/Nivobanner/Model/Nivobannergroup.php +32 -0
  28. app/code/community/Samsys/Nivobanner/Model/Status.php +96 -0
  29. app/code/community/Samsys/Nivobanner/Model/Wysiwyg/Config.php +45 -0
  30. app/code/community/Samsys/Nivobanner/controllers/Adminhtml/NivobannerController.php +247 -0
  31. app/code/community/Samsys/Nivobanner/controllers/Adminhtml/NivobannergroupController.php +218 -0
  32. app/code/community/Samsys/Nivobanner/controllers/IndexController.php +9 -0
  33. app/code/community/Samsys/Nivobanner/etc/config.xml +156 -0
  34. app/code/community/Samsys/Nivobanner/sql/nivobanner_setup/mysql4-install-0.1.0.php +66 -0
  35. app/code/community/Samsys/Nivobanner/sql/nivobanner_setup/mysql4-upgrade-0.1.0-0.2.0.php +13 -0
  36. app/design/adminhtml/default/default/layout/nivobanner.xml +25 -0
  37. app/design/adminhtml/default/default/template/nivobanner/banner.phtml +59 -0
  38. app/design/frontend/base/default/layout/nivobanner.xml +30 -0
  39. app/design/frontend/base/default/template/nivobanner/nivobanner.phtml +131 -0
  40. app/etc/modules/Samsys_Nivobanner.xml +18 -0
  41. media/nivo/banner/nemo.jpg +0 -0
  42. media/nivo/banner/toystory.jpg +0 -0
  43. media/nivo/banner/up.jpg +0 -0
  44. media/nivo/banner/walle.jpg +0 -0
  45. package.xml +23 -0
  46. skin/frontend/base/default/nivobanner/js/jquery-1.9.0.min.js +4 -0
  47. skin/frontend/base/default/nivobanner/js/jquery.nivo.slider.js +662 -0
  48. skin/frontend/base/default/nivobanner/nivo-slider.css +113 -0
  49. skin/frontend/base/default/nivobanner/themes/.DS_Store +0 -0
  50. skin/frontend/base/default/nivobanner/themes/bar/arrows.png +0 -0
  51. skin/frontend/base/default/nivobanner/themes/bar/bar.css +132 -0
  52. skin/frontend/base/default/nivobanner/themes/bar/bullets.png +0 -0
  53. skin/frontend/base/default/nivobanner/themes/bar/loading.gif +0 -0
  54. skin/frontend/base/default/nivobanner/themes/dark/.DS_Store +0 -0
  55. skin/frontend/base/default/nivobanner/themes/dark/Thumbs.db +0 -0
  56. skin/frontend/base/default/nivobanner/themes/dark/arrows.png +0 -0
  57. skin/frontend/base/default/nivobanner/themes/dark/bullets.png +0 -0
  58. skin/frontend/base/default/nivobanner/themes/dark/dark.css +103 -0
  59. skin/frontend/base/default/nivobanner/themes/dark/loading.gif +0 -0
  60. skin/frontend/base/default/nivobanner/themes/default/Thumbs.db +0 -0
  61. skin/frontend/base/default/nivobanner/themes/default/arrows.png +0 -0
  62. skin/frontend/base/default/nivobanner/themes/default/bullets.png +0 -0
  63. skin/frontend/base/default/nivobanner/themes/default/default.css +93 -0
  64. skin/frontend/base/default/nivobanner/themes/default/loading.gif +0 -0
  65. skin/frontend/base/default/nivobanner/themes/light/Thumbs.db +0 -0
  66. skin/frontend/base/default/nivobanner/themes/light/arrows.png +0 -0
  67. skin/frontend/base/default/nivobanner/themes/light/bullets.png +0 -0
  68. skin/frontend/base/default/nivobanner/themes/light/light.css +102 -0
  69. skin/frontend/base/default/nivobanner/themes/light/loading.gif +0 -0
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobanner extends Mage_Adminhtml_Block_Widget_Grid_Container {
10
+
11
+ public function __construct() {
12
+ /*path to our banner controller = adminhtml bannercontroller*/
13
+ $this->_controller = 'adminhtml_nivobanner';
14
+ $this->_blockGroup = 'nivobanner';
15
+ $this->_headerText = Mage::helper('nivobanner')->__('Banner Manager');
16
+ $this->_addButtonLabel = Mage::helper('nivobanner')->__('Add Banner Item');
17
+ parent::__construct();
18
+
19
+ }
20
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner/Edit.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobanner_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+
14
+ $this->_objectId = 'id';
15
+ $this->_blockGroup = 'nivobanner';
16
+ $this->_controller = 'adminhtml_nivobanner';
17
+
18
+
19
+ /*add buttons*/
20
+ $this->_updateButton('save', 'label', Mage::helper('nivobanner')->__('Save Item'));
21
+ $this->_updateButton('delete', 'label', Mage::helper('nivobanner')->__('Delete Item'));
22
+
23
+ $this->_addButton('saveandcontinue', array(
24
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
25
+ 'onclick' => 'saveAndContinueEdit()',
26
+ 'class' => 'save',
27
+ ), -100);
28
+
29
+ /*to make save&continueedit button to work*/
30
+ $this->_formScripts[] = "
31
+ function saveAndContinueEdit(){
32
+ editForm.submit($('edit_form').action+'back/edit/');
33
+ }
34
+ ";
35
+
36
+ }
37
+
38
+ public function getHeaderText() {
39
+ if (Mage::registry('nivobanner_data') && Mage::registry('nivobanner_data')->getId()) {
40
+ return Mage::helper('nivobanner')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('nivobanner_data')->getTitle()));
41
+ } else {
42
+ return Mage::helper('nivobanner')->__('Add Item');
43
+ }
44
+ }
45
+
46
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner/Edit/Form.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobanner_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
10
+ {
11
+ protected function _prepareForm()
12
+ {
13
+ $form = new Varien_Data_Form(array(
14
+ 'id' => 'edit_form',
15
+
16
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
17
+ 'method' => 'post',
18
+ 'enctype' => 'multipart/form-data'
19
+ )
20
+ );
21
+
22
+ $form->setUseContainer(true);
23
+ $this->setForm($form);
24
+ return parent::_prepareForm();
25
+ }
26
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner/Edit/Tab/Form.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobanner_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
10
+
11
+ protected function _prepareForm() {
12
+ $form = new Varien_Data_Form();
13
+ $this->setForm($form);
14
+ $fieldset = $form->addFieldset('nivobanner_form', array('legend' => Mage::helper('nivobanner')->__('Item information')));
15
+ $version = substr(Mage::getVersion(), 0, 3);
16
+ //$config = (($version == '1.4' || $version == '1.5') ? "'config' => Mage::getSingleton('banner/wysiwyg_config')->getConfig()" : "'class'=>''");
17
+
18
+ $fieldset->addField('title', 'text', array(
19
+ 'label' => Mage::helper('nivobanner')->__('Title'),
20
+ 'class' => 'required-entry',
21
+ 'required' => true,
22
+ 'name' => 'title',
23
+ ));
24
+
25
+ $fieldset->addField('link', 'text', array(
26
+ 'label' => Mage::helper('nivobanner')->__('Link'),
27
+ 'name' => 'link',
28
+ ));
29
+
30
+ $fieldset->addField('banner_type', 'select', array(
31
+ 'label' => Mage::helper('nivobanner')->__('Link Target'),
32
+ 'name' => 'link_target',
33
+ 'values' => array(
34
+ array(
35
+ 'value' => 0,
36
+ 'label' => Mage::helper('nivobanner')->__('Self'),
37
+ ),
38
+ array(
39
+ 'value' => 1,
40
+ 'label' => Mage::helper('nivobanner')->__('New Window'),
41
+ ),
42
+ ),
43
+ ));
44
+
45
+ $fieldset->addField('filename', 'image', array(
46
+ 'label' => Mage::helper('nivobanner')->__('Image'),
47
+ 'class' => 'required-entry',
48
+ 'required' => true,
49
+ 'name' => 'filename',
50
+ ));
51
+
52
+ if (in_array($version, array('1.4','1.5','1.6','1.7'))) {
53
+ $fieldset->addField('banner_content', 'editor', array(
54
+ 'name' => 'banner_content',
55
+ 'label' => Mage::helper('nivobanner')->__('Content'),
56
+ 'title' => Mage::helper('nivobanner')->__('Content'),
57
+ 'style' => 'width:600px; height:250px;',
58
+ 'config' => Mage::getSingleton('nivobanner/wysiwyg_config')->getConfig(),
59
+ 'wysiwyg' => true,
60
+ 'required' => false,
61
+ ));
62
+ } else {
63
+ $fieldset->addField('banner_content', 'editor', array(
64
+ 'name' => 'banner_content',
65
+ 'label' => Mage::helper('cms')->__('Content'),
66
+ 'title' => Mage::helper('cms')->__('Content'),
67
+ 'style' => 'width:600px; height:250px;',
68
+ 'wysiwyg' => false,
69
+ 'required' => false,
70
+ ));
71
+ }
72
+
73
+ $fieldset->addField('show_title', 'select', array(
74
+ 'label' => Mage::helper('nivobanner')->__('Display Title'),
75
+ 'class' => 'required-entry',
76
+ 'name' => 'show_title',
77
+ 'values' => array(
78
+ array(
79
+ 'value' => 1,
80
+ 'label' => Mage::helper('nivobanner')->__('Yes'),
81
+ ),
82
+ array(
83
+ 'value' => 0,
84
+ 'label' => Mage::helper('nivobanner')->__('No'),
85
+ ),
86
+ ),
87
+ ));
88
+
89
+
90
+
91
+ $fieldset->addField('show_content', 'select', array(
92
+ 'label' => Mage::helper('nivobanner')->__('Display Content'),
93
+ 'class' => 'required-entry',
94
+ 'name' => 'show_content',
95
+ 'values' => array(
96
+ array(
97
+ 'value' => 1,
98
+ 'label' => Mage::helper('nivobanner')->__('Yes'),
99
+ ),
100
+ array(
101
+ 'value' => 0,
102
+ 'label' => Mage::helper('nivobanner')->__('No'),
103
+ ),
104
+ ),
105
+ ));
106
+
107
+ $fieldset->addField('sort_order', 'text', array(
108
+ 'label' => Mage::helper('nivobanner')->__('Sort Order'),
109
+ 'name' => 'sort_order',
110
+ ));
111
+
112
+ $fieldset->addField('status', 'select', array(
113
+ 'label' => Mage::helper('nivobanner')->__('Status'),
114
+ 'class' => 'required-entry',
115
+ 'name' => 'status',
116
+ 'values' => array(
117
+ array(
118
+ 'value' => 1,
119
+ 'label' => Mage::helper('nivobanner')->__('Enabled'),
120
+ ),
121
+ array(
122
+ 'value' => 2,
123
+ 'label' => Mage::helper('nivobanner')->__('Disabled'),
124
+ ),
125
+ ),
126
+ ));
127
+
128
+ if (Mage::getSingleton('adminhtml/session')->getBannerData()) {
129
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getBannerData());
130
+ Mage::getSingleton('adminhtml/session')->setBannerData(null);
131
+ } elseif (Mage::registry('nivobanner_data')) {
132
+ $form->setValues(Mage::registry('nivobanner_data')->getData());
133
+ }
134
+ return parent::_prepareForm();
135
+ }
136
+
137
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner/Edit/Tabs.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobanner_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+ $this->setId('nivobanner_tabs');
14
+ $this->setDestElementId('edit_form');
15
+ $this->setTitle(Mage::helper('nivobanner')->__('Item Information'));
16
+ }
17
+
18
+ protected function _beforeToHtml() {
19
+ $this->addTab('form_section', array(
20
+ 'label' => Mage::helper('nivobanner')->__('Banner Information'),
21
+ 'alt' => Mage::helper('nivobanner')->__('Banner information'),
22
+ 'content' => $this->getLayout()->createBlock('nivobanner/adminhtml_nivobanner_edit_tab_form')->toHtml(),
23
+ ));
24
+ return parent::_beforeToHtml();
25
+ }
26
+
27
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner/Grid.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobanner_Grid extends Samsys_Nivobanner_Block_Adminhtml_Widget_Grid {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+ $this->setId('nivobannerGrid');
14
+ $this->setDefaultSort('banner_id');
15
+ $this->setDefaultDir('ASC');
16
+ $this->setSaveParametersInSession(true);
17
+ }
18
+
19
+ protected function _prepareCollection() {
20
+ $collection = Mage::getModel('nivobanner/nivobanner')->getCollection();
21
+ $this->setCollection($collection);
22
+ return parent::_prepareCollection();
23
+ }
24
+
25
+ protected function _prepareColumns() {
26
+ $this->addColumn('nivobanner_id', array(
27
+ 'header' => Mage::helper('nivobanner')->__('ID'),
28
+ 'align' => 'center',
29
+ 'width' => '30px',
30
+ 'index' => 'banner_id',
31
+ ));
32
+
33
+ $this->addColumn('filename', array(
34
+ 'header' => Mage::helper('nivobanner')->__('Image'),
35
+ 'align' => 'center',
36
+ 'index' => 'filename',
37
+ /*for rendering image we are creating widget in name nivobanner*/
38
+ 'type' => 'nivobanner',
39
+ 'escape' => true,
40
+ 'sortable' => false,
41
+ 'width' => '150px',
42
+ ));
43
+
44
+ $this->addColumn('title', array(
45
+ 'header' => Mage::helper('nivobanner')->__('Title'),
46
+ 'index' => 'title',
47
+ ));
48
+
49
+ $this->addColumn('link', array(
50
+ 'header' => Mage::helper('nivobanner')->__('Link'),
51
+ 'index' => 'link',
52
+ 'width' => '150px',
53
+ ));
54
+
55
+ $this->addColumn('show_title', array(
56
+ 'header' => Mage::helper('nivobanner')->__('Show Title'),
57
+ 'align' => 'center',
58
+ 'width' => '80px',
59
+ 'index' => 'show_title',
60
+ 'type' => 'options',
61
+ 'options' => array(
62
+ 1 => 'Yes',
63
+ 0 => 'No',
64
+ ),
65
+ ));
66
+ $this->addColumn('show_content', array(
67
+ 'header' => Mage::helper('nivobanner')->__('Show Content'),
68
+ 'align' => 'center',
69
+ 'width' => '80px',
70
+ 'index' => 'show_content',
71
+ 'type' => 'options',
72
+ 'options' => array(
73
+ 1 => 'Yes',
74
+ 0 => 'No',
75
+ ),
76
+ ));
77
+
78
+
79
+
80
+ $this->addColumn('sort_order', array(
81
+ 'header' => Mage::helper('nivobanner')->__('Sort Order'),
82
+ 'width' => '80px',
83
+ 'index' => 'sort_order',
84
+ 'align' => 'center',
85
+ ));
86
+
87
+
88
+ $this->addColumn('status', array(
89
+ 'header' => Mage::helper('nivobanner')->__('Status'),
90
+ 'align' => 'left',
91
+ 'width' => '80px',
92
+ 'index' => 'status',
93
+ 'type' => 'options',
94
+ 'options' => array(
95
+ 1 => 'Enabled',
96
+ 2 => 'Disabled',
97
+ ),
98
+ ));
99
+
100
+ $this->addColumn('action',
101
+ array(
102
+ 'header' => Mage::helper('nivobanner')->__('Action'),
103
+ 'width' => '80',
104
+ 'type' => 'action',
105
+ 'getter' => 'getId',
106
+ 'actions' => array(
107
+ array(
108
+ 'caption' => Mage::helper('nivobanner')->__('Edit'),
109
+ 'url' => array('base' => '*/*/edit'),
110
+ 'field' => 'id'
111
+ )
112
+ ),
113
+ 'filter' => false,
114
+ 'sortable' => false,
115
+ 'index' => 'stores',
116
+ 'is_system' => true,
117
+ ));
118
+
119
+
120
+ return parent::_prepareColumns();
121
+ }
122
+
123
+ /*to get multiple delete and change status actions*/
124
+ protected function _prepareMassaction() {
125
+ $this->setMassactionIdField('banner_id');
126
+ $this->getMassactionBlock()->setFormFieldName('banner');
127
+
128
+ $this->getMassactionBlock()->addItem('delete', array(
129
+ 'label' => Mage::helper('nivobanner')->__('Delete'),
130
+ 'url' => $this->getUrl('*/*/massDelete'),
131
+ 'confirm' => Mage::helper('nivobanner')->__('Are you sure?')
132
+ ));
133
+
134
+ $statuses = Mage::getSingleton('nivobanner/status')->getOptionArray();
135
+
136
+ array_unshift($statuses, array('label' => '', 'value' => ''));
137
+ $this->getMassactionBlock()->addItem('status', array(
138
+ 'label' => Mage::helper('nivobanner')->__('Change status'),
139
+ 'url' => $this->getUrl('*/*/massStatus', array('_current' => true)),
140
+ 'additional' => array(
141
+ 'visibility' => array(
142
+ 'name' => 'status',
143
+ 'type' => 'select',
144
+ 'class' => 'required-entry',
145
+ 'label' => Mage::helper('nivobanner')->__('Status'),
146
+ 'values' => $statuses
147
+ )
148
+ )
149
+ ));
150
+ return $this;
151
+ }
152
+
153
+
154
+ public function getRowUrl($row) {
155
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
156
+ }
157
+
158
+
159
+
160
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobanner/Grid/Renderer/Image.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Sam-Sys
5
+ * @category Samsys
6
+ * @package Samsys_Nivobanner
7
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ class Samsys_Nivobanner_Block_Adminhtml_Grid_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
11
+
12
+ public function __construct() {
13
+
14
+ }
15
+
16
+ public function render(Varien_Object $row) {
17
+ return $this->_getValue($row);
18
+ }
19
+
20
+ protected function _getValue(Varien_Object $row) {
21
+ $dored = false;
22
+ $out = '';
23
+ if ($getter = $this->getColumn()->getGetter()) {
24
+ $val = $row->$getter();
25
+ }
26
+ $val = $row->getData($this->getColumn()->getIndex());
27
+ $url = Mage::helper('nivobanner')->getImageUrl($val);
28
+ $size = Mage::helper('nivobanner')->getImageThumbSize($val);
29
+ $file_extis = Mage::helper('nivobanner')->getFileExists($val);
30
+ $popLink = "popWin('$url','image','width=800,height=600,resizable=yes,scrollbars=yes')";
31
+ if (is_array($size) && $file_extis)
32
+ $out = '<a href="javascript:;" onclick="'.$popLink.'"><img src="'.$url.'" width="'.$size['width'].'" height="'.$size['height'].'" style="border: 2px solid #CCCCCC;"/></a>';
33
+ return $out;
34
+ }
35
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * sam-sys
4
+ * @category samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 Samsys Systems. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobannergroup extends Mage_Adminhtml_Block_Widget_Grid_Container {
10
+
11
+ public function __construct() {
12
+ $this->_controller = 'adminhtml_nivobannergroup';
13
+ $this->_blockGroup = 'nivobanner';
14
+ $this->_headerText = Mage::helper('nivobanner')->__('Banner Group Manager');
15
+ $this->_addButtonLabel = Mage::helper('nivobanner')->__('Add Banner Group');
16
+ parent::__construct();
17
+ }
18
+
19
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Edit.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobannergroup_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+
14
+ $this->_objectId = 'id';
15
+ $this->_blockGroup = 'nivobanner';
16
+ $this->_controller = 'adminhtml_nivobannergroup';
17
+
18
+ $this->_updateButton('save', 'label', Mage::helper('nivobanner')->__('Save Item'));
19
+ $this->_updateButton('delete', 'label', Mage::helper('nivobanner')->__('Delete Item'));
20
+
21
+ $this->_addButton('saveandcontinue', array(
22
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
23
+ 'onclick' => 'saveAndContinueEdit()',
24
+ 'class' => 'save',
25
+ ), -100);
26
+
27
+ $this->_formScripts[] = "
28
+ function toggleEditor() {
29
+ if (tinyMCE.getInstanceById('banner_content') == null) {
30
+ tinyMCE.execCommand('mceAddControl', false, 'banner_content');
31
+ } else {
32
+ tinyMCE.execCommand('mceRemoveControl', false, 'banner_content');
33
+ }
34
+ }
35
+
36
+ function saveAndContinueEdit(){
37
+ editForm.submit($('edit_form').action+'back/edit/');
38
+ }
39
+
40
+ ";
41
+ }
42
+
43
+ public function getHeaderText() {
44
+ if (Mage::registry('nivobannergroup_data') && Mage::registry('nivobannergroup_data')->getId()) {
45
+ return Mage::helper('nivobanner')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('nivobannergroup_data')->getGroupName()));
46
+ } else {
47
+ return Mage::helper('nivobanner')->__('Add Item');
48
+ }
49
+ }
50
+
51
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Edit/Form.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobannergroup_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
10
+
11
+ protected function _prepareForm() {
12
+ $form = new Varien_Data_Form(array(
13
+ 'id' => 'edit_form',
14
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
15
+ 'method' => 'post',
16
+ 'enctype' => 'multipart/form-data'
17
+ )
18
+ );
19
+
20
+ $form->setUseContainer(true);
21
+ $this->setForm($form);
22
+ $form->addField('in_bannergroup_banners', 'hidden', array(
23
+ 'name' => 'nivobannergroup_banners',
24
+ 'required' => false,
25
+ ));
26
+ return parent::_prepareForm();
27
+ }
28
+
29
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Edit/Tab/Banner.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobannergroup_Edit_Tab_Banner extends Samsys_Nivobanner_Block_Adminhtml_Widget_Grid {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+ $this->setId('bannerLeftGrid');
14
+ $this->setDefaultSort('banner_id');
15
+ $this->setUseAjax(true);
16
+ }
17
+
18
+ public function getBannergroupData() {
19
+ return Mage::registry('nivobannergroup_data');
20
+ }
21
+
22
+ protected function _prepareCollection() {
23
+ $collection = Mage::getModel('nivobanner/nivobanner')->getCollection();
24
+ $collection->getSelect()->order('banner_id');
25
+ $this->setCollection($collection);
26
+ return parent::_prepareCollection();
27
+ }
28
+
29
+ protected function _addColumnFilterToCollection($column) {
30
+ if ($this->getCollection()) {
31
+ if ($column->getId() == 'banner_triggers') {
32
+ $bannerIds = $this->_getSelectedBanners();
33
+ if (empty($bannerIds)) {
34
+ $bannerIds = 0;
35
+ }
36
+ if ($column->getFilter()->getValue()) {
37
+ $this->getCollection()->addFieldToFilter('banner_id', array('in' => $bannerIds));
38
+ } else {
39
+ if ($bannerIds) {
40
+ $this->getCollection()->addFieldToFilter('banner_id', array('nin' => $bannerIds));
41
+ }
42
+ }
43
+ } else {
44
+ parent::_addColumnFilterToCollection($column);
45
+ }
46
+ }
47
+ return $this;;
48
+ }
49
+
50
+ protected function _prepareColumns() {
51
+ $this->addColumn('banner_triggers', array(
52
+ 'header_css_class' => 'a-center',
53
+ 'type' => 'checkbox',
54
+ 'values' => $this->_getSelectedBanners(),
55
+ 'align' => 'center',
56
+ 'index' => 'banner_id'
57
+ ));
58
+ $this->addColumn('banner_id', array(
59
+ 'header' => Mage::helper('catalog')->__('ID'),
60
+ 'sortable' => true,
61
+ 'width' => '50',
62
+ 'align' => 'center',
63
+ 'index' => 'banner_id'
64
+ ));
65
+
66
+ $this->addColumn('filename', array(
67
+ 'header' => Mage::helper('nivobanner')->__('Image'),
68
+ 'align' => 'center',
69
+ 'index' => 'filename',
70
+ 'type' => 'nivobanner',
71
+ 'escape' => true,
72
+ 'sortable' => false,
73
+ 'width' => '150px',
74
+ ));
75
+
76
+ $this->addColumn('title', array(
77
+ 'header' => Mage::helper('catalog')->__('Title'),
78
+ 'index' => 'title',
79
+ 'align' => 'left',
80
+ ));
81
+
82
+ $this->addColumn('link', array(
83
+ 'header' => Mage::helper('nivobanner')->__('Link'),
84
+ 'width' => '200px',
85
+ 'index' => 'link',
86
+ ));
87
+
88
+ $this->addColumn('link_target', array(
89
+ 'header' => Mage::helper('nivobanner')->__('Link Target'),
90
+ 'width' => '100px',
91
+ 'index' => 'link_target',
92
+ 'type' => 'options',
93
+ 'options' => array(
94
+ 0 => 'Image',
95
+ 1 => 'Html',
96
+ ),
97
+ ));
98
+
99
+ $this->addColumn('sort_order', array(
100
+ 'header' => Mage::helper('nivobanner')->__('Sort Order'),
101
+ 'width' => '80px',
102
+ 'index' => 'sort_order',
103
+ 'align' => 'center',
104
+ ));
105
+ return parent::_prepareColumns();
106
+ }
107
+
108
+ public function getGridUrl() {
109
+ return $this->getUrl('*/*/nivobannergrid', array('_current' => true));
110
+ }
111
+
112
+ protected function _getSelectedBanners() {
113
+ $banners = $this->getRequest()->getPost('selected_banners');
114
+ if (is_null($banners)) {
115
+ $banners = explode(',', $this->getBannergroupData()->getBannerIds());
116
+ return (sizeof($banners) > 0 ? $banners : 0);
117
+ }
118
+ return $banners;
119
+ }
120
+
121
+ }
122
+
123
+ ?>
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Edit/Tab/Form.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobannergroup_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
10
+
11
+ protected function _prepareForm() {
12
+ $form = new Varien_Data_Form();
13
+ $this->setForm($form);
14
+ $fieldset = $form->addFieldset('nivobannergroup_form', array('legend' => Mage::helper('nivobanner')->__('Item information')));
15
+ $animations = Mage::getSingleton('nivobanner/status')->getAnimationArray();
16
+
17
+
18
+ $fieldset->addField('group_name', 'text', array(
19
+ 'label' => Mage::helper('nivobanner')->__('Banner Group Name'),
20
+ 'class' => 'required-entry',
21
+ 'required' => true,
22
+ 'name' => 'group_name',
23
+ ));
24
+
25
+ if (Mage::registry('nivobannergroup_data')->getId() == null) {
26
+ $fieldset->addField('group_code', 'text', array(
27
+ 'label' => Mage::helper('nivobanner')->__('Banner Group Code'),
28
+ 'class' => 'required-entry',
29
+ 'name' => 'group_code',
30
+ 'required' => true,
31
+ ));
32
+ }
33
+
34
+ $fieldset->addField('banner_width', 'text', array(
35
+ 'label' => Mage::helper('nivobanner')->__('Banner Width [in px]'),
36
+ 'class' => 'required-entry',
37
+ 'required' => true,
38
+ 'name' => 'banner_width',
39
+ ));
40
+
41
+ $fieldset->addField('banner_height', 'text', array(
42
+ 'label' => Mage::helper('nivobanner')->__('Banner Height [in px]'),
43
+ 'class' => 'required-entry',
44
+ 'required' => true,
45
+ 'name' => 'banner_height',
46
+ ));
47
+
48
+ $fieldset->addField('banner_effects', 'select', array(
49
+ 'label' => Mage::helper('nivobanner')->__('Banner Effect'),
50
+ 'class' => 'required-entry',
51
+ 'required' => true,
52
+ 'name' => 'banner_effects',
53
+ 'values' => $animations
54
+ ));
55
+ $fieldset->addField('animation_speed', 'text', array(
56
+ 'label' => Mage::helper('nivobanner')->__('Animation Speed'),
57
+ 'class' => 'required-entry',
58
+ 'required' => true,
59
+ 'name' => 'animation_speed',
60
+ 'after_element_html' => '<p class="note"><span>In Milliseconds [eg: 1 Second = 1000 Millisecond] </span></p>',
61
+ ));
62
+
63
+ $fieldset->addField('pause_time', 'text', array(
64
+ 'label' => Mage::helper('nivobanner')->__('Pause Time'),
65
+ 'class' => 'required-entry',
66
+ 'required' => true,
67
+ 'name' => 'pause_time',
68
+ 'after_element_html' => '<p class="note"><span>In Milliseconds [eg: 1 Second = 1000 Millisecond] </span></p>',
69
+ ));
70
+
71
+ $fieldset->addField('image_nav', 'select', array(
72
+ 'label' => Mage::helper('nivobanner')->__('Image Navigation'),
73
+ 'name' => 'image_nav',
74
+ 'values' => array(
75
+ array(
76
+ 'value' => 1,
77
+ 'label' => Mage::helper('nivobanner')->__('Yes'),
78
+ ),
79
+ array(
80
+ 'value' => 0,
81
+ 'label' => Mage::helper('nivobanner')->__('No'),
82
+ ),
83
+ ),
84
+ ));
85
+
86
+ $fieldset->addField('image_pagi', 'select', array(
87
+ 'label' => Mage::helper('nivobanner')->__('Image Pagination'),
88
+ 'name' => 'image_pagi',
89
+ 'values' => array(
90
+ array(
91
+ 'value' => 1,
92
+ 'label' => Mage::helper('nivobanner')->__('Yes'),
93
+ ),
94
+ array(
95
+ 'value' => 0,
96
+ 'label' => Mage::helper('nivobanner')->__('No'),
97
+ ),
98
+ ),
99
+ ));
100
+
101
+ $fieldset->addField('hover_pause', 'select', array(
102
+ 'label' => Mage::helper('nivobanner')->__('Pause on Mouseover'),
103
+ 'name' => 'hover_pause',
104
+ 'values' => array(
105
+ array(
106
+ 'value' => 1,
107
+ 'label' => Mage::helper('nivobanner')->__('Yes'),
108
+ ),
109
+ array(
110
+ 'value' => 0,
111
+ 'label' => Mage::helper('nivobanner')->__('No'),
112
+ ),
113
+ ),
114
+ ));
115
+
116
+ $fieldset->addField('autoplay', 'select', array(
117
+ 'label' => Mage::helper('nivobanner')->__('Autoplay Slides'),
118
+ 'name' => 'autoplay',
119
+ 'values' => array(
120
+ array(
121
+ 'value' => 1,
122
+ 'label' => Mage::helper('nivobanner')->__('Yes'),
123
+ ),
124
+ array(
125
+ 'value' => 0,
126
+ 'label' => Mage::helper('nivobanner')->__('No'),
127
+ ),
128
+ ),
129
+ ));
130
+
131
+ $fieldset->addField('theme', 'select', array(
132
+ 'label' => Mage::helper('nivobanner')->__('Theme'),
133
+ 'name' => 'theme',
134
+ 'values' => array(
135
+ array(
136
+ 'value' => 'default',
137
+ 'label' => Mage::helper('nivobanner')->__('Default'),
138
+ ),
139
+ array(
140
+ 'value' => 'dark',
141
+ 'label' => Mage::helper('nivobanner')->__('Dark'),
142
+ ),
143
+ array(
144
+ 'value' => 'light',
145
+ 'label' => Mage::helper('nivobanner')->__('Light'),
146
+ ),
147
+ array(
148
+ 'value' => 'bar',
149
+ 'label' => Mage::helper('nivobanner')->__('Bar'),
150
+ ),
151
+ ),
152
+ ));
153
+
154
+
155
+
156
+ $fieldset->addField('status', 'select', array(
157
+ 'label' => Mage::helper('nivobanner')->__('Status'),
158
+ 'class' => 'required-entry',
159
+ 'name' => 'status',
160
+ 'values' => array(
161
+ array(
162
+ 'value' => 1,
163
+ 'label' => Mage::helper('nivobanner')->__('Enabled'),
164
+ ),
165
+ array(
166
+ 'value' => 2,
167
+ 'label' => Mage::helper('nivobanner')->__('Disabled'),
168
+ ),
169
+ ),
170
+ ));
171
+
172
+ // $fieldset->addField('banner_ids', 'multiselect', array(
173
+ // 'label' => Mage::helper('nivobanner')->__('Banner Images'),
174
+ // 'class' => 'required-entry',
175
+ // 'required' => true,
176
+ // 'name' => 'banner_ids[]',
177
+ // 'values' => $bannerData,
178
+ // ));
179
+
180
+
181
+ if (Mage::getSingleton('adminhtml/session')->getBannergroupData()) {
182
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getBannergroupData());
183
+ Mage::getSingleton('adminhtml/session')->setBannergroupData(null);
184
+ } elseif (Mage::registry('nivobannergroup_data')) {
185
+ $form->setValues(Mage::registry('nivobannergroup_data')->getData());
186
+ }
187
+ return parent::_prepareForm();
188
+ }
189
+
190
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Edit/Tab/Gridbanner.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobannergroup_Edit_Tab_Gridbanner extends Mage_Adminhtml_Block_Widget_Container {
10
+
11
+ /**
12
+ * Set template
13
+ */
14
+ public function __construct() {
15
+ parent::__construct();
16
+ $this->setTemplate('nivobanner/banner.phtml');
17
+ }
18
+
19
+ public function getTabsHtml() {
20
+ return $this->getChildHtml('tabs');
21
+ }
22
+
23
+ /**
24
+ * Prepare button and grid
25
+ *
26
+ */
27
+ protected function _prepareLayout() {
28
+ $this->setChild('tabs', $this->getLayout()->createBlock('nivobanner/adminhtml_nivobannergroup_edit_tab_banner', 'nivobannergroup.grid.banner'));
29
+ return parent::_prepareLayout();
30
+ }
31
+
32
+ public function getBannergroupData() {
33
+ return Mage::registry('nivobannergroup_data');
34
+ }
35
+
36
+ public function getBannersJson() {
37
+ $banners = explode(',', $this->getBannergroupData()->getBannerIds());
38
+ if (!empty($banners) && isset($banners[0]) && $banners[0] != '') {
39
+ $data = array();
40
+ foreach ($banners as $element) {
41
+ $data[$element] = $element;
42
+ }
43
+ return Zend_Json::encode($data);
44
+ }
45
+ return '{}';
46
+ }
47
+
48
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Edit/Tabs.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobannergroup_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+ $this->setId('nivobannergroup_tabs');
14
+ $this->setDestElementId('edit_form');
15
+ $this->setTitle(Mage::helper('nivobanner')->__('Banner Group Information'));
16
+ }
17
+
18
+ protected function _beforeToHtml() {
19
+ $this->addTab('form_section', array(
20
+ 'label' => Mage::helper('nivobanner')->__('Banner Group'),
21
+ 'alt' => Mage::helper('nivobanner')->__('Banner Group'),
22
+ 'content' => $this->getLayout()->createBlock('nivobanner/adminhtml_nivobannergroup_edit_tab_form')->toHtml(),
23
+ ));
24
+
25
+ $this->addTab('grid_section', array(
26
+ 'label' => Mage::helper('nivobanner')->__('Banners'),
27
+ 'alt' => Mage::helper('nivobanner')->__('Banners'),
28
+ 'content' => $this->getLayout()->createBlock('nivobanner/adminhtml_nivobannergroup_edit_tab_gridbanner')->toHtml(),
29
+ ));
30
+
31
+ return parent::_beforeToHtml();
32
+ }
33
+
34
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Nivobannergroup/Grid.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Nivobannergroup_Grid extends Mage_Adminhtml_Block_Widget_Grid {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+ $this->setId('nivobannergroupGrid');
14
+ $this->setDefaultSort('group_id');
15
+ $this->setDefaultDir('ASC');
16
+ $this->setSaveParametersInSession(true);
17
+ }
18
+
19
+ protected function _prepareCollection() {
20
+ $collection = Mage::getModel('nivobanner/nivobannergroup')->getCollection();
21
+ //$collection->getSelect()->columns(array('banner_effect' => 'if((animation_type=0),pre_banner_effects,banner_effects)'));
22
+ $collection->getSelect()->columns();
23
+ $this->setCollection($collection);
24
+ return parent::_prepareCollection();
25
+ }
26
+
27
+ protected function _prepareColumns() {
28
+ $this->addColumn('group_id', array(
29
+ 'header' => Mage::helper('nivobanner')->__('ID'),
30
+ 'align' => 'right',
31
+ 'width' => '50px',
32
+ 'index' => 'group_id',
33
+ ));
34
+
35
+ $this->addColumn('group_name', array(
36
+ 'header' => Mage::helper('nivobanner')->__('Banner Group name'),
37
+ 'index' => 'group_name',
38
+ ));
39
+
40
+ $this->addColumn('group_code', array(
41
+ 'header' => Mage::helper('nivobanner')->__('Group code'),
42
+ 'width' => '100px',
43
+ 'index' => 'group_code',
44
+ ));
45
+
46
+ $this->addColumn('banner_width', array(
47
+ 'header' => Mage::helper('nivobanner')->__('Banner Width'),
48
+ 'width' => '100px',
49
+ 'align' => 'center',
50
+ 'index' => 'banner_width',
51
+ ));
52
+
53
+ $this->addColumn('banner_height', array(
54
+ 'header' => Mage::helper('nivobanner')->__('Banner Height'),
55
+ 'width' => '100px',
56
+ 'align' => 'center',
57
+ 'index' => 'banner_height',
58
+ ));
59
+
60
+ $this->addColumn('banner_effects', array(
61
+ 'header' => Mage::helper('nivobanner')->__('Banner Animation'),
62
+ 'width' => '100px',
63
+ 'align' => 'center',
64
+ 'index' => 'banner_effects',
65
+ ));
66
+
67
+
68
+ $this->addColumn('banner_ids', array(
69
+ 'header' => Mage::helper('nivobanner')->__('Banners Ids'),
70
+ 'width' => '50px',
71
+ 'index' => 'banner_ids',
72
+ ));
73
+
74
+
75
+
76
+ $this->addColumn('status', array(
77
+ 'header' => Mage::helper('nivobanner')->__('Status'),
78
+ 'align' => 'left',
79
+ 'width' => '80px',
80
+ 'index' => 'status',
81
+ 'type' => 'options',
82
+ 'options' => array(
83
+ 1 => 'Enabled',
84
+ 2 => 'Disabled',
85
+ ),
86
+ ));
87
+
88
+ $this->addColumn('action',
89
+ array(
90
+ 'header' => Mage::helper('nivobanner')->__('Action'),
91
+ 'width' => '50',
92
+ 'type' => 'action',
93
+ 'getter' => 'getId',
94
+ 'actions' => array(
95
+ array(
96
+ 'caption' => Mage::helper('nivobanner')->__('Edit'),
97
+ 'url' => array('base' => '*/*/edit'),
98
+ 'field' => 'id'
99
+ )
100
+ ),
101
+ 'filter' => false,
102
+ 'sortable' => false,
103
+ 'index' => 'stores',
104
+ 'is_system' => true,
105
+ ));
106
+
107
+ return parent::_prepareColumns();
108
+ }
109
+
110
+ protected function _prepareMassaction() {
111
+ $this->setMassactionIdField('group_id');
112
+ $this->getMassactionBlock()->setFormFieldName('banner');
113
+
114
+ $this->getMassactionBlock()->addItem('delete', array(
115
+ 'label' => Mage::helper('nivobanner')->__('Delete'),
116
+ 'url' => $this->getUrl('*/*/massDelete'),
117
+ 'confirm' => Mage::helper('nivobanner')->__('Are you sure?')
118
+ ));
119
+
120
+ $statuses = Mage::getSingleton('nivobanner/status')->getOptionArray();
121
+
122
+ array_unshift($statuses, array('label' => '', 'value' => ''));
123
+ $this->getMassactionBlock()->addItem('status', array(
124
+ 'label' => Mage::helper('nivobanner')->__('Change status'),
125
+ 'url' => $this->getUrl('*/*/massStatus', array('_current' => true)),
126
+ 'additional' => array(
127
+ 'visibility' => array(
128
+ 'name' => 'status',
129
+ 'type' => 'select',
130
+ 'class' => 'required-entry',
131
+ 'label' => Mage::helper('nivobanner')->__('Status'),
132
+ 'values' => $statuses
133
+ )
134
+ )
135
+ ));
136
+ return $this;
137
+ }
138
+
139
+ public function getRowUrl($row) {
140
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
141
+ }
142
+
143
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Widget/Grid.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ class Samsys_Nivobanner_Block_Adminhtml_Widget_Grid extends Mage_Adminhtml_Block_Widget_Grid {
10
+
11
+ public function addColumn($columnId, $column) {
12
+ if (is_array($column)) {
13
+ $this->_columns[$columnId] = $this->getLayout()->createBlock('nivobanner/adminhtml_widget_grid_column')
14
+ ->setData($column)
15
+ ->setGrid($this);
16
+ }
17
+ /* elseif ($column instanceof Varien_Object) {
18
+ $this->_columns[$columnId] = $column;
19
+ } */ else {
20
+ throw new Exception(Mage::helper('adminhtml')->__('Wrong column format'));
21
+ }
22
+
23
+ $this->_columns[$columnId]->setId($columnId);
24
+ $this->_lastColumnId = $columnId;
25
+ return $this;
26
+ }
27
+
28
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Widget/Grid/Column.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+
10
+ class Samsys_Nivobanner_Block_Adminhtml_Widget_Grid_Column extends Mage_Adminhtml_Block_Widget_Grid_Column {
11
+
12
+ protected function _getRendererByType() {
13
+ switch (strtolower($this->getType())) {
14
+ case 'nivobanner':
15
+ $rendererClass = 'nivobanner/adminhtml_widget_grid_column_renderer_banner';
16
+ break;
17
+ default:
18
+ $rendererClass = parent::_getRendererByType();
19
+ break;
20
+ }
21
+ return $rendererClass;
22
+ }
23
+
24
+ protected function _getFilterByType() {
25
+ switch (strtolower($this->getType())) {
26
+ case 'nivobanner':
27
+ $filterClass = 'nivobanner/adminhtml_widget_grid_column_filter_banner';
28
+ break;
29
+ default:
30
+ $filterClass = parent::_getFilterByType();
31
+ break;
32
+ }
33
+ return $filterClass;
34
+ }
35
+
36
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Widget/Grid/Column/Filter/Banner.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+
10
+ class Samsys_Nivobanner_Block_Adminhtml_Widget_Grid_Column_Filter_Banner extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Text {
11
+
12
+ }
app/code/community/Samsys/Nivobanner/Block/Adminhtml/Widget/Grid/Column/Renderer/Banner.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sam-Sys
4
+ * @category Samsys
5
+ * @package Samsys_Nivobanner
6
+ * @copyright Copyright (c) 2013-2014 sam-sys. (http://www.sam-sys.in)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+
10
+ class Samsys_Nivobanner_Block_Adminhtml_Widget_Grid_Column_Renderer_Banner extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
11
+
12
+ public function __construct() {
13
+
14
+ }
15
+
16
+ public function render(Varien_Object $row) {
17
+ return $this->_getValue($row);
18
+ }
19
+
20
+ protected function _getValue(Varien_Object $row) {
21
+ $dored = false;
22
+ $out = '';
23
+ if ($getter = $this->getColumn()->getGetter()) {
24
+ $val = $row->$getter();
25
+ }
26
+ $val = $row->getData($this->getColumn()->getIndex());
27
+ $url = Mage::helper('nivobanner')->getImageUrl($val);
28
+ $size = Mage::helper('nivobanner')->getImageThumbSize($val);
29
+ $file_extis = Mage::helper('nivobanner')->getFileExists($val);
30
+ $popLink = "popWin('$url','image','width=800,height=600,resizable=yes,scrollbars=yes')";
31
+ if (is_array($size) && $file_extis)
32
+ $out = '<a href="javascript:;" onclick="'.$popLink.'"><img src="'.$url.'" width="'.$size['width'].'" height="'.$size['height'].'" style="border: 2px solid #CCCCCC;"/></a>';
33
+ return $out;
34
+ }
35
+ }
app/code/community/Samsys/Nivobanner/Block/Nivobanner.php ADDED
@@ -0,0 +1,192 @@