Lanot_EasyBanner - Version 1.0.0.2

Version Notes

First release of module:
1. Managing banners and banner categories
2. Prepared widget for banners rotation
Uploaded for Magento Connect 2.0

Download this release

Release Info

Developer Lanot
Extension Lanot_EasyBanner
Version 1.0.0.2
Comparing to
See all releases


Code changes from version 1.0.0.0 to 1.0.0.2

Files changed (40) hide show
  1. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner.php +52 -52
  2. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner/Edit.php +81 -81
  3. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner/Edit/Form.php +47 -47
  4. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner/Edit/Tab/Categories.php +113 -113
  5. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner/Edit/Tab/Main.php +199 -199
  6. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner/Edit/Tabs.php +69 -69
  7. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner/Grid.php +41 -41
  8. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category.php +51 -51
  9. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category/Edit.php +83 -83
  10. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category/Edit/Form.php +47 -47
  11. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category/Edit/Tab/Banners.php +113 -113
  12. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category/Edit/Tab/Main.php +122 -122
  13. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category/Edit/Tabs.php +69 -69
  14. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category/Grid.php +41 -41
  15. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Grid/Abstract.php +310 -310
  16. app/code/community/Lanot/EasyBanner/Block/Adminhtml/Renderer/Banner.php +83 -83
  17. app/code/community/Lanot/EasyBanner/Block/Banner/Renderer/Abstract.php +99 -99
  18. app/code/community/Lanot/EasyBanner/Block/Banner/Renderer/Flash.php +53 -53
  19. app/code/community/Lanot/EasyBanner/Block/Banner/Renderer/Image.php +45 -45
  20. app/code/community/Lanot/EasyBanner/Block/Widget/Banners.php +89 -89
  21. app/code/community/Lanot/EasyBanner/Controller/Adminhtml/AbstractController.php +315 -315
  22. app/code/community/Lanot/EasyBanner/Helper/Admin.php +34 -34
  23. app/code/community/Lanot/EasyBanner/Helper/Data.php +103 -103
  24. app/code/community/Lanot/EasyBanner/Model/Banner.php +277 -277
  25. app/code/community/Lanot/EasyBanner/Model/Category.php +141 -141
  26. app/code/community/Lanot/EasyBanner/Model/Mysql4/Banner.php +128 -128
  27. app/code/community/Lanot/EasyBanner/Model/Mysql4/Banner/Collection.php +82 -82
  28. app/code/community/Lanot/EasyBanner/Model/Mysql4/Category.php +129 -129
  29. app/code/community/Lanot/EasyBanner/Model/Mysql4/Category/Collection.php +37 -37
  30. app/code/community/Lanot/EasyBanner/controllers/Adminhtml/BannerController.php +73 -73
  31. app/code/community/Lanot/EasyBanner/controllers/Adminhtml/CategoryController.php +73 -73
  32. app/code/community/Lanot/EasyBanner/etc/adminhtml.xml +97 -97
  33. app/code/community/Lanot/EasyBanner/etc/config.xml +109 -109
  34. app/code/community/Lanot/EasyBanner/etc/system.xml +77 -77
  35. app/code/community/Lanot/EasyBanner/etc/widget.xml +37 -37
  36. app/code/community/Lanot/EasyBanner/sql/lanot_easybanner_setup/mysql4-install-1.0.0.0.php +79 -79
  37. app/design/adminhtml/default/default/layout/lanot_easybanner.xml +110 -110
  38. app/design/frontend/base/default/template/lanot/easybanner/banners.phtml +22 -22
  39. app/etc/modules/Lanot_EasyBanner.xml +8 -8
  40. package.xml +6 -5
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner.php CHANGED
@@ -1,52 +1,52 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Banners List admin grid container
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Banner
27
- extends Mage_Adminhtml_Block_Widget_Grid_Container
28
- {
29
- /**
30
- * Block constructor
31
- */
32
- public function __construct()
33
- {
34
- $this->_blockGroup = 'lanot_easybanner';
35
- $this->_controller = 'adminhtml_banner';
36
- $this->_headerText = $this->_getHelper()->__('Manage Banners');
37
-
38
- parent::__construct();
39
-
40
- if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_banner/save')) {
41
- $this->_updateButton('add', 'label', $this->_getHelper()->__('Add New Banner'));
42
- } else {
43
- $this->_removeButton('add');
44
- }
45
- }
46
-
47
- protected function _getHelper()
48
- {
49
- return Mage::helper('lanot_easybanner');
50
- }
51
- }
52
-
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Banners List admin grid container
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Banner
27
+ extends Mage_Adminhtml_Block_Widget_Grid_Container
28
+ {
29
+ /**
30
+ * Block constructor
31
+ */
32
+ public function __construct()
33
+ {
34
+ $this->_blockGroup = 'lanot_easybanner';
35
+ $this->_controller = 'adminhtml_banner';
36
+ $this->_headerText = $this->_getHelper()->__('Manage Banners');
37
+
38
+ parent::__construct();
39
+
40
+ if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_banner/save')) {
41
+ $this->_updateButton('add', 'label', $this->_getHelper()->__('Add New Banner'));
42
+ } else {
43
+ $this->_removeButton('add');
44
+ }
45
+ }
46
+
47
+ protected function _getHelper()
48
+ {
49
+ return Mage::helper('lanot_easybanner');
50
+ }
51
+ }
52
+
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner/Edit.php CHANGED
@@ -1,81 +1,81 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Banner Banner admin edit form container
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Banner_Edit
27
- extends Mage_Adminhtml_Block_Widget_Form_Container
28
- {
29
- /**
30
- * Initialize edit form container
31
- *
32
- */
33
- public function __construct()
34
- {
35
- $this->_objectId = 'id';
36
- $this->_blockGroup = 'lanot_easybanner';
37
- $this->_controller = 'adminhtml_banner';
38
-
39
- parent::__construct();
40
-
41
- //check permissions
42
- if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_banner/save')) {
43
- $this->_updateButton('save', 'label', $this->_getHelper()->__('Save Banner Item'));
44
- $this->_addButton('saveandcontinue', array(
45
- 'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
46
- 'onclick' => 'saveAndContinueEdit()',
47
- 'class' => 'save',
48
- ), -100);
49
-
50
- $this->_formScripts[] = "
51
- function saveAndContinueEdit(){
52
- editForm.submit($('edit_form').action+'back/edit/');
53
- }";
54
- } else {
55
- $this->_removeButton('save');
56
- }
57
-
58
- if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_banner/delete')) {
59
- $this->_updateButton('delete', 'label', $this->_getHelper()->__('Delete Banner Item'));
60
- } else {
61
- $this->_removeButton('delete');
62
- }
63
- }
64
-
65
- public function getHeaderText()
66
- {
67
- $header = $this->_getHelper()->__('New Banner Item');
68
- $model = $this->_getHelper()->getBannerItemInstance();
69
-
70
- if ($model->getId()) {
71
- $title = $this->escapeHtml($model->getTitle());
72
- $header = $this->_getHelper()->__("Edit Banner Item '%s'", $title);
73
- }
74
- return $header;
75
- }
76
-
77
- protected function _getHelper()
78
- {
79
- return Mage::helper('lanot_easybanner');
80
- }
81
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Banner Banner admin edit form container
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Banner_Edit
27
+ extends Mage_Adminhtml_Block_Widget_Form_Container
28
+ {
29
+ /**
30
+ * Initialize edit form container
31
+ *
32
+ */
33
+ public function __construct()
34
+ {
35
+ $this->_objectId = 'id';
36
+ $this->_blockGroup = 'lanot_easybanner';
37
+ $this->_controller = 'adminhtml_banner';
38
+
39
+ parent::__construct();
40
+
41
+ //check permissions
42
+ if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_banner/save')) {
43
+ $this->_updateButton('save', 'label', $this->_getHelper()->__('Save Banner Item'));
44
+ $this->_addButton('saveandcontinue', array(
45
+ 'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
46
+ 'onclick' => 'saveAndContinueEdit()',
47
+ 'class' => 'save',
48
+ ), -100);
49
+
50
+ $this->_formScripts[] = "
51
+ function saveAndContinueEdit(){
52
+ editForm.submit($('edit_form').action+'back/edit/');
53
+ }";
54
+ } else {
55
+ $this->_removeButton('save');
56
+ }
57
+
58
+ if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_banner/delete')) {
59
+ $this->_updateButton('delete', 'label', $this->_getHelper()->__('Delete Banner Item'));
60
+ } else {
61
+ $this->_removeButton('delete');
62
+ }
63
+ }
64
+
65
+ public function getHeaderText()
66
+ {
67
+ $header = $this->_getHelper()->__('New Banner Item');
68
+ $model = $this->_getHelper()->getBannerItemInstance();
69
+
70
+ if ($model->getId()) {
71
+ $title = $this->escapeHtml($model->getTitle());
72
+ $header = $this->_getHelper()->__("Edit Banner Item '%s'", $title);
73
+ }
74
+ return $header;
75
+ }
76
+
77
+ protected function _getHelper()
78
+ {
79
+ return Mage::helper('lanot_easybanner');
80
+ }
81
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner/Edit/Form.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Banner admin edit form block
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Banner_Edit_Form
27
- extends Mage_Adminhtml_Block_Widget_Form
28
- {
29
- /**
30
- * Prepare FORM action
31
- *
32
- * @return Lanot_EasyBanner_Block_Adminhtml_Banner_Edit
33
- */
34
- protected function _prepareForm()
35
- {
36
- $form = new Varien_Data_Form(array(
37
- 'id' => 'edit_form',
38
- 'action' => $this->getUrl('*/*/save'),
39
- 'method' => 'post',
40
- 'enctype' => 'multipart/form-data'
41
- ));
42
-
43
- $form->setUseContainer(true);
44
- $this->setForm($form);
45
- return parent::_prepareForm();
46
- }
47
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Banner admin edit form block
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Banner_Edit_Form
27
+ extends Mage_Adminhtml_Block_Widget_Form
28
+ {
29
+ /**
30
+ * Prepare FORM action
31
+ *
32
+ * @return Lanot_EasyBanner_Block_Adminhtml_Banner_Edit
33
+ */
34
+ protected function _prepareForm()
35
+ {
36
+ $form = new Varien_Data_Form(array(
37
+ 'id' => 'edit_form',
38
+ 'action' => $this->getUrl('*/*/save'),
39
+ 'method' => 'post',
40
+ 'enctype' => 'multipart/form-data'
41
+ ));
42
+
43
+ $form->setUseContainer(true);
44
+ $this->setForm($form);
45
+ return parent::_prepareForm();
46
+ }
47
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner/Edit/Tab/Categories.php CHANGED
@@ -1,113 +1,113 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Category admin edit form main tab block
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Banner_Edit_Tab_Categories
27
- extends Lanot_EasyBanner_Block_Adminhtml_Category_Grid
28
- {
29
- protected $_aclSection = 'manage_banner';
30
- protected $_isTabGrid = true;
31
- protected $_columnPrefix = 'categories_';
32
- protected $_checkboxFieldName = 'categories_in_selected';
33
- protected $_bannerItemParam = 'banner_id';
34
-
35
- /** @var Lanot_EasyBanner_Model_Banner */
36
- protected $_bannerItem = null;
37
-
38
- /**
39
- * Init Grid default properties
40
- *
41
- */
42
- public function __construct()
43
- {
44
- parent::__construct();
45
-
46
- if ($this->_getBannerItem()->getId()) {
47
- $this->setDefaultFilter(array('in_selected' => 1));
48
- }
49
- }
50
-
51
- /**
52
- * Checks when this block is readonly
53
- *
54
- * @return boolean
55
- */
56
- public function isReadonly()
57
- {
58
- return !$this->_getAclHelper()->isActionAllowed($this->_aclSection . '/save');
59
- }
60
-
61
- /**
62
- * Checks when this block is not available
63
- *
64
- * @return boolean
65
- */
66
- public function isMassActionAllowed()
67
- {
68
- return false;
69
- }
70
-
71
- /**
72
- * @return string
73
- */
74
- public function getGridUrl()
75
- {
76
- return $this->getUrl('*/*/ajaxcategoriesgridonly', array('_current' => true));
77
- }
78
-
79
- /**
80
- * Retrieve selected categories
81
- *
82
- * @return array
83
- */
84
- public function getSelectedLinks()
85
- {
86
- return $this->_getBannerItem()->getSelectedCategories();
87
- }
88
-
89
- /**
90
- * @return Lanot_EasyBanner_Model_Banner|null
91
- */
92
- protected function _getBannerItem()
93
- {
94
- if ($this->_bannerItem !== null) {
95
- return $this->_bannerItem;
96
- }
97
-
98
- $itemId = $this->getRequest()->getParam($this->_bannerItemParam);
99
- $this->_bannerItem = $this->_getBannerItemModel();
100
- if ($itemId) {
101
- $this->_bannerItem->load($itemId);
102
- }
103
- return $this->_bannerItem;
104
- }
105
-
106
- /**
107
- * @return Lanot_EasyBanner_Model_Banner
108
- */
109
- protected function _getBannerItemModel()
110
- {
111
- return Mage::getSingleton('lanot_easybanner/banner');
112
- }
113
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Category admin edit form main tab block
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Banner_Edit_Tab_Categories
27
+ extends Lanot_EasyBanner_Block_Adminhtml_Category_Grid
28
+ {
29
+ protected $_aclSection = 'manage_banner';
30
+ protected $_isTabGrid = true;
31
+ protected $_columnPrefix = 'categories_';
32
+ protected $_checkboxFieldName = 'categories_in_selected';
33
+ protected $_bannerItemParam = 'banner_id';
34
+
35
+ /** @var Lanot_EasyBanner_Model_Banner */
36
+ protected $_bannerItem = null;
37
+
38
+ /**
39
+ * Init Grid default properties
40
+ *
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+
46
+ if ($this->_getBannerItem()->getId()) {
47
+ $this->setDefaultFilter(array('in_selected' => 1));
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Checks when this block is readonly
53
+ *
54
+ * @return boolean
55
+ */
56
+ public function isReadonly()
57
+ {
58
+ return !$this->_getAclHelper()->isActionAllowed($this->_aclSection . '/save');
59
+ }
60
+
61
+ /**
62
+ * Checks when this block is not available
63
+ *
64
+ * @return boolean
65
+ */
66
+ public function isMassActionAllowed()
67
+ {
68
+ return false;
69
+ }
70
+
71
+ /**
72
+ * @return string
73
+ */
74
+ public function getGridUrl()
75
+ {
76
+ return $this->getUrl('*/*/ajaxcategoriesgridonly', array('_current' => true));
77
+ }
78
+
79
+ /**
80
+ * Retrieve selected categories
81
+ *
82
+ * @return array
83
+ */
84
+ public function getSelectedLinks()
85
+ {
86
+ return $this->_getBannerItem()->getSelectedCategories();
87
+ }
88
+
89
+ /**
90
+ * @return Lanot_EasyBanner_Model_Banner|null
91
+ */
92
+ protected function _getBannerItem()
93
+ {
94
+ if ($this->_bannerItem !== null) {
95
+ return $this->_bannerItem;
96
+ }
97
+
98
+ $itemId = $this->getRequest()->getParam($this->_bannerItemParam);
99
+ $this->_bannerItem = $this->_getBannerItemModel();
100
+ if ($itemId) {
101
+ $this->_bannerItem->load($itemId);
102
+ }
103
+ return $this->_bannerItem;
104
+ }
105
+
106
+ /**
107
+ * @return Lanot_EasyBanner_Model_Banner
108
+ */
109
+ protected function _getBannerItemModel()
110
+ {
111
+ return Mage::getSingleton('lanot_easybanner/banner');
112
+ }
113
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner/Edit/Tab/Main.php CHANGED
@@ -1,199 +1,199 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Banner admin edit form main tab block
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Banner_Edit_Tab_Main
27
- extends Mage_Adminhtml_Block_Widget_Form
28
- implements Mage_Adminhtml_Block_Widget_Tab_Interface
29
- {
30
- protected $_idPrefix = 'banner_main_';
31
-
32
- /**
33
- * @return Lanot_EasyBanner_Model_Banner
34
- */
35
- protected function _getItemModel()
36
- {
37
- return $this->_getHelper()->getBannerItemInstance();
38
- }
39
-
40
- /**
41
- * Prepare form elements for tab
42
- *
43
- * @return Mage_Adminhtml_Block_Widget_Form
44
- */
45
- protected function _prepareForm()
46
- {
47
- $model = $this->_getItemModel();
48
- $extensions = $model->getAllowedExtensions();
49
- $bannerHtml = '';
50
-
51
- /**
52
- * Checking if user have permissions to save information
53
- */
54
- if ($this->_getAclHelper()->isActionAllowed($this->_aclSection . '/save')) {
55
- $isElementDisabled = false;
56
- } else {
57
- $isElementDisabled = true;
58
- }
59
-
60
- $form = new Varien_Data_Form();
61
- $form->setHtmlIdPrefix('banner_main_');
62
-
63
- $fieldset = $form->addFieldset('base_fieldset', array(
64
- 'legend' => $this->_getHelper()->__('Banner Item Info')
65
- ));
66
- //apply additional renderers
67
- $this->_addElementTypes($fieldset);
68
-
69
- if ($model->getId()) {
70
- $fieldset->addField('banner_id', 'hidden', array(
71
- 'name' => 'id',
72
- ));
73
- }
74
-
75
- if ($model->getType()) {
76
- $bannerHtml = $this->_getHelper()
77
- ->getBannerRenderer($model->getType())
78
- ->disableClick()
79
- ->setBanner($model)
80
- ->render();
81
- if (!empty($bannerHtml)) {
82
- $style = 'width: 100%; overflow: hidden; margin: 15px 0px 0px 0px;';
83
- $bannerHtml = "<div style='{$style}'>{$bannerHtml}</div>";
84
- }
85
- }
86
-
87
- $fieldset->addField('is_active', 'select', array(
88
- 'name' => 'is_active',
89
- 'label' => $this->_getHelper()->__('Is Active'),
90
- 'required' => true,
91
- 'options' => $model->getAvailableStatuses(),
92
- 'style' => 'width: 150px',
93
- 'disabled' => $isElementDisabled,
94
- ));
95
-
96
- $fieldset->addField('title', 'text', array(
97
- 'name' => 'title',
98
- 'label' => $this->_getHelper()->__('Title'),
99
- 'required' => true,
100
- 'disabled' => $isElementDisabled,
101
- ));
102
-
103
- $fieldset->addField('description', 'textarea', array(
104
- 'name' => 'description',
105
- 'label' => $this->_getHelper()->__('Description'),
106
- 'title' => $this->_getHelper()->__('Description'),
107
- 'required' => false,
108
- 'disabled' => $isElementDisabled,
109
- ));
110
-
111
- $fieldset->addField('url', 'text', array(
112
- 'name' => 'url',
113
- 'label' => $this->_getHelper()->__('Url'),
114
- 'disabled' => $isElementDisabled,
115
- ));
116
-
117
- $fieldset->addField('width', 'text', array(
118
- 'name' => 'width',
119
- 'label' => $this->_getHelper()->__('Banner Width (px)'),
120
- 'disabled' => $isElementDisabled,
121
- 'style' => 'width: 50px',
122
- 'required' => true,
123
- ));
124
-
125
- $fieldset->addField('height', 'text', array(
126
- 'name' => 'height',
127
- 'label' => $this->_getHelper()->__('Banner Height (px)'),
128
- 'disabled' => $isElementDisabled,
129
- 'style' => 'width: 50px',
130
- 'required' => true,
131
- ));
132
-
133
- $fieldset->addField('path', 'banner', array(
134
- 'name' => 'banner_file',
135
- 'label' => $this->_getHelper()->__('File'),
136
- 'comment' => $this->_getHelper()->__('Allowed extensions: %s', implode(',', $extensions)),
137
- 'required' => true,
138
- 'disabled' => $isElementDisabled,
139
- 'style' => 'width: 200px;',
140
- ))->setBannerHtml($bannerHtml);
141
-
142
- Mage::dispatchEvent('adminhtml_easybanner_banner_edit_tab_main_prepare_form', array('form' => $form));
143
-
144
- $form->setValues($model->getData());
145
- //$form->setUseContainer(true);
146
- $this->setForm($form);
147
-
148
-
149
- return parent::_prepareForm();
150
- }
151
-
152
- public function getTabLabel()
153
- {
154
- return $this->_getHelper()->__('Banner Info');
155
- }
156
-
157
- public function getTabTitle()
158
- {
159
- return $this->_getHelper()->__('Banner Info');
160
- }
161
-
162
- public function canShowTab()
163
- {
164
- return true;
165
- }
166
-
167
- public function isHidden()
168
- {
169
- return false;
170
- }
171
-
172
- /**
173
- * Retrieve predefined additional element types
174
- *
175
- * @return array
176
- */
177
- protected function _getAdditionalElementTypes()
178
- {
179
- return array(
180
- 'banner' => Mage::getConfig()->getBlockClassName('lanot_easybanner/adminhtml_renderer_banner')
181
- );
182
- }
183
-
184
- /**
185
- * @return Lanot_EasyBanner_Helper_Data
186
- */
187
- protected function _getHelper()
188
- {
189
- return Mage::helper('lanot_easybanner');
190
- }
191
-
192
- /**
193
- * @return Lanot_EasyBanner_Helper_Admin
194
- */
195
- protected function _getAclHelper()
196
- {
197
- return Mage::helper('lanot_easybanner/admin');
198
- }
199
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Banner admin edit form main tab block
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Banner_Edit_Tab_Main
27
+ extends Mage_Adminhtml_Block_Widget_Form
28
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
29
+ {
30
+ protected $_idPrefix = 'banner_main_';
31
+
32
+ /**
33
+ * @return Lanot_EasyBanner_Model_Banner
34
+ */
35
+ protected function _getItemModel()
36
+ {
37
+ return $this->_getHelper()->getBannerItemInstance();
38
+ }
39
+
40
+ /**
41
+ * Prepare form elements for tab
42
+ *
43
+ * @return Mage_Adminhtml_Block_Widget_Form
44
+ */
45
+ protected function _prepareForm()
46
+ {
47
+ $model = $this->_getItemModel();
48
+ $extensions = $model->getAllowedExtensions();
49
+ $bannerHtml = '';
50
+
51
+ /**
52
+ * Checking if user have permissions to save information
53
+ */
54
+ if ($this->_getAclHelper()->isActionAllowed($this->_aclSection . '/save')) {
55
+ $isElementDisabled = false;
56
+ } else {
57
+ $isElementDisabled = true;
58
+ }
59
+
60
+ $form = new Varien_Data_Form();
61
+ $form->setHtmlIdPrefix('banner_main_');
62
+
63
+ $fieldset = $form->addFieldset('base_fieldset', array(
64
+ 'legend' => $this->_getHelper()->__('Banner Item Info')
65
+ ));
66
+ //apply additional renderers
67
+ $this->_addElementTypes($fieldset);
68
+
69
+ if ($model->getId()) {
70
+ $fieldset->addField('banner_id', 'hidden', array(
71
+ 'name' => 'id',
72
+ ));
73
+ }
74
+
75
+ if ($model->getType()) {
76
+ $bannerHtml = $this->_getHelper()
77
+ ->getBannerRenderer($model->getType())
78
+ ->disableClick()
79
+ ->setBanner($model)
80
+ ->render();
81
+ if (!empty($bannerHtml)) {
82
+ $style = 'width: 100%; overflow: hidden; margin: 15px 0px 0px 0px;';
83
+ $bannerHtml = "<div style='{$style}'>{$bannerHtml}</div>";
84
+ }
85
+ }
86
+
87
+ $fieldset->addField('is_active', 'select', array(
88
+ 'name' => 'is_active',
89
+ 'label' => $this->_getHelper()->__('Is Active'),
90
+ 'required' => true,
91
+ 'options' => $model->getAvailableStatuses(),
92
+ 'style' => 'width: 150px',
93
+ 'disabled' => $isElementDisabled,
94
+ ));
95
+
96
+ $fieldset->addField('title', 'text', array(
97
+ 'name' => 'title',
98
+ 'label' => $this->_getHelper()->__('Title'),
99
+ 'required' => true,
100
+ 'disabled' => $isElementDisabled,
101
+ ));
102
+
103
+ $fieldset->addField('description', 'textarea', array(
104
+ 'name' => 'description',
105
+ 'label' => $this->_getHelper()->__('Description'),
106
+ 'title' => $this->_getHelper()->__('Description'),
107
+ 'required' => false,
108
+ 'disabled' => $isElementDisabled,
109
+ ));
110
+
111
+ $fieldset->addField('url', 'text', array(
112
+ 'name' => 'url',
113
+ 'label' => $this->_getHelper()->__('Url'),
114
+ 'disabled' => $isElementDisabled,
115
+ ));
116
+
117
+ $fieldset->addField('width', 'text', array(
118
+ 'name' => 'width',
119
+ 'label' => $this->_getHelper()->__('Banner Width (px)'),
120
+ 'disabled' => $isElementDisabled,
121
+ 'style' => 'width: 50px',
122
+ 'required' => true,
123
+ ));
124
+
125
+ $fieldset->addField('height', 'text', array(
126
+ 'name' => 'height',
127
+ 'label' => $this->_getHelper()->__('Banner Height (px)'),
128
+ 'disabled' => $isElementDisabled,
129
+ 'style' => 'width: 50px',
130
+ 'required' => true,
131
+ ));
132
+
133
+ $fieldset->addField('path', 'banner', array(
134
+ 'name' => 'banner_file',
135
+ 'label' => $this->_getHelper()->__('File'),
136
+ 'comment' => $this->_getHelper()->__('Allowed extensions: %s', implode(',', $extensions)),
137
+ 'required' => true,
138
+ 'disabled' => $isElementDisabled,
139
+ 'style' => 'width: 200px;',
140
+ ))->setBannerHtml($bannerHtml);
141
+
142
+ Mage::dispatchEvent('adminhtml_easybanner_banner_edit_tab_main_prepare_form', array('form' => $form));
143
+
144
+ $form->setValues($model->getData());
145
+ //$form->setUseContainer(true);
146
+ $this->setForm($form);
147
+
148
+
149
+ return parent::_prepareForm();
150
+ }
151
+
152
+ public function getTabLabel()
153
+ {
154
+ return $this->_getHelper()->__('Banner Info');
155
+ }
156
+
157
+ public function getTabTitle()
158
+ {
159
+ return $this->_getHelper()->__('Banner Info');
160
+ }
161
+
162
+ public function canShowTab()
163
+ {
164
+ return true;
165
+ }
166
+
167
+ public function isHidden()
168
+ {
169
+ return false;
170
+ }
171
+
172
+ /**
173
+ * Retrieve predefined additional element types
174
+ *
175
+ * @return array
176
+ */
177
+ protected function _getAdditionalElementTypes()
178
+ {
179
+ return array(
180
+ 'banner' => Mage::getConfig()->getBlockClassName('lanot_easybanner/adminhtml_renderer_banner')
181
+ );
182
+ }
183
+
184
+ /**
185
+ * @return Lanot_EasyBanner_Helper_Data
186
+ */
187
+ protected function _getHelper()
188
+ {
189
+ return Mage::helper('lanot_easybanner');
190
+ }
191
+
192
+ /**
193
+ * @return Lanot_EasyBanner_Helper_Admin
194
+ */
195
+ protected function _getAclHelper()
196
+ {
197
+ return Mage::helper('lanot_easybanner/admin');
198
+ }
199
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner/Edit/Tabs.php CHANGED
@@ -1,69 +1,69 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Banner admin edit tabs block
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Banner_Edit_Tabs
27
- extends Mage_Adminhtml_Block_Widget_Tabs
28
- {
29
- /**
30
- * Initialize tabs and define tabs block settings
31
- *
32
- */
33
- public function __construct()
34
- {
35
- parent::__construct();
36
-
37
- $this->setId('page_tabs');
38
- $this->setDestElementId('edit_form');
39
- $this->setTitle($this->_getHelper()->__('Banner Info'));
40
- }
41
-
42
- /**
43
- * @return Lanot_EasyBanner_Helper_Data
44
- */
45
- protected function _getHelper()
46
- {
47
- return Mage::helper('lanot_easybanner');
48
- }
49
-
50
- protected function _prepareLayout()
51
- {
52
- $this->addTab('main', array(
53
- 'label' => $this->_getHelper()->__('Banner info'),
54
- 'content' => $this->getLayout()->createBlock('lanot_easybanner/adminhtml_banner_edit_tab_main')->toHtml(),
55
- ));
56
-
57
- $params = array(
58
- '_current' => true,
59
- 'banner_id' => (int) $this->_getHelper()->getBannerItemInstance()->getId(),
60
- );
61
- $this->addTab('categories', array(
62
- 'label' => $this->_getHelper()->__('Categories'),
63
- 'url' => $this->getUrl('*/*/ajaxcategoriesgrid', $params),
64
- 'class' => 'ajax',
65
- ));
66
-
67
- return parent::_prepareLayout();
68
- }
69
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Banner admin edit tabs block
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Banner_Edit_Tabs
27
+ extends Mage_Adminhtml_Block_Widget_Tabs
28
+ {
29
+ /**
30
+ * Initialize tabs and define tabs block settings
31
+ *
32
+ */
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+
37
+ $this->setId('page_tabs');
38
+ $this->setDestElementId('edit_form');
39
+ $this->setTitle($this->_getHelper()->__('Banner Info'));
40
+ }
41
+
42
+ /**
43
+ * @return Lanot_EasyBanner_Helper_Data
44
+ */
45
+ protected function _getHelper()
46
+ {
47
+ return Mage::helper('lanot_easybanner');
48
+ }
49
+
50
+ protected function _prepareLayout()
51
+ {
52
+ $this->addTab('main', array(
53
+ 'label' => $this->_getHelper()->__('Banner info'),
54
+ 'content' => $this->getLayout()->createBlock('lanot_easybanner/adminhtml_banner_edit_tab_main')->toHtml(),
55
+ ));
56
+
57
+ $params = array(
58
+ '_current' => true,
59
+ 'banner_id' => (int) $this->_getHelper()->getBannerItemInstance()->getId(),
60
+ );
61
+ $this->addTab('categories', array(
62
+ 'label' => $this->_getHelper()->__('Categories'),
63
+ 'url' => $this->getUrl('*/*/ajaxcategoriesgrid', $params),
64
+ 'class' => 'ajax',
65
+ ));
66
+
67
+ return parent::_prepareLayout();
68
+ }
69
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Banner/Grid.php CHANGED
@@ -1,41 +1,41 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Banners list admin grid
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Banner_Grid
27
- extends Lanot_EasyBanner_Block_Adminhtml_Grid_Abstract
28
- {
29
- protected $_gridId = 'easybanner_banners_list_grid';
30
- protected $_entityIdField = 'banner_id';
31
- protected $_itemParam = 'banner_id';
32
- protected $_formFieldName = 'banner';
33
-
34
- /**
35
- * @return Lanot_EasyBanner_Model_Banner
36
- */
37
- protected function _getItemModel()
38
- {
39
- return Mage::getSingleton('lanot_easybanner/banner');
40
- }
41
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Banners list admin grid
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Banner_Grid
27
+ extends Lanot_EasyBanner_Block_Adminhtml_Grid_Abstract
28
+ {
29
+ protected $_gridId = 'easybanner_banners_list_grid';
30
+ protected $_entityIdField = 'banner_id';
31
+ protected $_itemParam = 'banner_id';
32
+ protected $_formFieldName = 'banner';
33
+
34
+ /**
35
+ * @return Lanot_EasyBanner_Model_Banner
36
+ */
37
+ protected function _getItemModel()
38
+ {
39
+ return Mage::getSingleton('lanot_easybanner/banner');
40
+ }
41
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category.php CHANGED
@@ -1,51 +1,51 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Categories List admin grid container
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Category
27
- extends Mage_Adminhtml_Block_Widget_Grid_Container
28
- {
29
- /**
30
- * Block constructor
31
- */
32
- public function __construct()
33
- {
34
- $this->_blockGroup = 'lanot_easybanner';
35
- $this->_controller = 'adminhtml_category';
36
- $this->_headerText = Mage::helper('lanot_easybanner')->__('Manage Categories');
37
-
38
- parent::__construct();
39
-
40
- if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_category/save')) {
41
- $this->_updateButton('add', 'label', $this->_getHelper()->__('Add New Category'));
42
- } else {
43
- $this->_removeButton('add');
44
- }
45
- }
46
-
47
- protected function _getHelper()
48
- {
49
- return Mage::helper('lanot_easybanner');
50
- }
51
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Categories List admin grid container
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Category
27
+ extends Mage_Adminhtml_Block_Widget_Grid_Container
28
+ {
29
+ /**
30
+ * Block constructor
31
+ */
32
+ public function __construct()
33
+ {
34
+ $this->_blockGroup = 'lanot_easybanner';
35
+ $this->_controller = 'adminhtml_category';
36
+ $this->_headerText = Mage::helper('lanot_easybanner')->__('Manage Categories');
37
+
38
+ parent::__construct();
39
+
40
+ if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_category/save')) {
41
+ $this->_updateButton('add', 'label', $this->_getHelper()->__('Add New Category'));
42
+ } else {
43
+ $this->_removeButton('add');
44
+ }
45
+ }
46
+
47
+ protected function _getHelper()
48
+ {
49
+ return Mage::helper('lanot_easybanner');
50
+ }
51
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category/Edit.php CHANGED
@@ -1,83 +1,83 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Banner Category admin edit form container
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Category_Edit
27
- extends Mage_Adminhtml_Block_Widget_Form_Container
28
- {
29
- /**
30
- * Initialize edit form container
31
- *
32
- */
33
- public function __construct()
34
- {
35
- $this->_objectId = 'id';
36
- $this->_blockGroup = 'lanot_easybanner';
37
- $this->_controller = 'adminhtml_category';
38
-
39
- parent::__construct();
40
-
41
- //check permissions
42
- if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_category/save')) {
43
- $this->_updateButton('save', 'label', $this->_getHelper()->__('Save Category Item'));
44
- $this->_addButton('saveandcontinue', array(
45
- 'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
46
- 'onclick' => 'saveAndContinueEdit()',
47
- 'class' => 'save',
48
- ), -100);
49
-
50
-
51
- $this->_formScripts[] = "
52
- function saveAndContinueEdit(){
53
- editForm.submit($('edit_form').action+'back/edit/');
54
- }
55
- ";
56
- } else {
57
- $this->_removeButton('save');
58
- }
59
-
60
- if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_category/delete')) {
61
- $this->_updateButton('delete', 'label', $this->_getHelper()->__('Delete Category Item'));
62
- } else {
63
- $this->_removeButton('delete');
64
- }
65
- }
66
-
67
- public function getHeaderText()
68
- {
69
- $header = $this->_getHelper()->__('New Category Item');
70
- $model = $this->_getHelper()->getCategoryItemInstance();
71
-
72
- if ($model->getId()) {
73
- $title = $this->escapeHtml($model->getTitle());
74
- $header = $this->_getHelper()->__("Edit Category Item '%s'", $title);
75
- }
76
- return $header;
77
- }
78
-
79
- protected function _getHelper()
80
- {
81
- return Mage::helper('lanot_easybanner');
82
- }
83
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Banner Category admin edit form container
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Category_Edit
27
+ extends Mage_Adminhtml_Block_Widget_Form_Container
28
+ {
29
+ /**
30
+ * Initialize edit form container
31
+ *
32
+ */
33
+ public function __construct()
34
+ {
35
+ $this->_objectId = 'id';
36
+ $this->_blockGroup = 'lanot_easybanner';
37
+ $this->_controller = 'adminhtml_category';
38
+
39
+ parent::__construct();
40
+
41
+ //check permissions
42
+ if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_category/save')) {
43
+ $this->_updateButton('save', 'label', $this->_getHelper()->__('Save Category Item'));
44
+ $this->_addButton('saveandcontinue', array(
45
+ 'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
46
+ 'onclick' => 'saveAndContinueEdit()',
47
+ 'class' => 'save',
48
+ ), -100);
49
+
50
+
51
+ $this->_formScripts[] = "
52
+ function saveAndContinueEdit(){
53
+ editForm.submit($('edit_form').action+'back/edit/');
54
+ }
55
+ ";
56
+ } else {
57
+ $this->_removeButton('save');
58
+ }
59
+
60
+ if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_category/delete')) {
61
+ $this->_updateButton('delete', 'label', $this->_getHelper()->__('Delete Category Item'));
62
+ } else {
63
+ $this->_removeButton('delete');
64
+ }
65
+ }
66
+
67
+ public function getHeaderText()
68
+ {
69
+ $header = $this->_getHelper()->__('New Category Item');
70
+ $model = $this->_getHelper()->getCategoryItemInstance();
71
+
72
+ if ($model->getId()) {
73
+ $title = $this->escapeHtml($model->getTitle());
74
+ $header = $this->_getHelper()->__("Edit Category Item '%s'", $title);
75
+ }
76
+ return $header;
77
+ }
78
+
79
+ protected function _getHelper()
80
+ {
81
+ return Mage::helper('lanot_easybanner');
82
+ }
83
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category/Edit/Form.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Category admin edit form block
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Category_Edit_Form
27
- extends Mage_Adminhtml_Block_Widget_Form
28
- {
29
- /**
30
- * Prepare FORM action
31
- *
32
- * @return Lanot_EasyBanner_Block_Adminhtml_Category_Edit
33
- */
34
- protected function _prepareForm()
35
- {
36
- $form = new Varien_Data_Form(array(
37
- 'id' => 'edit_form',
38
- 'action' => $this->getUrl('*/*/save'),
39
- 'method' => 'post',
40
- 'enctype' => 'multipart/form-data'
41
- ));
42
-
43
- $form->setUseContainer(true);
44
- $this->setForm($form);
45
- return parent::_prepareForm();
46
- }
47
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Category admin edit form block
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Category_Edit_Form
27
+ extends Mage_Adminhtml_Block_Widget_Form
28
+ {
29
+ /**
30
+ * Prepare FORM action
31
+ *
32
+ * @return Lanot_EasyBanner_Block_Adminhtml_Category_Edit
33
+ */
34
+ protected function _prepareForm()
35
+ {
36
+ $form = new Varien_Data_Form(array(
37
+ 'id' => 'edit_form',
38
+ 'action' => $this->getUrl('*/*/save'),
39
+ 'method' => 'post',
40
+ 'enctype' => 'multipart/form-data'
41
+ ));
42
+
43
+ $form->setUseContainer(true);
44
+ $this->setForm($form);
45
+ return parent::_prepareForm();
46
+ }
47
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category/Edit/Tab/Banners.php CHANGED
@@ -1,113 +1,113 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Category admin edit form main tab block
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Category_Edit_Tab_Banners
27
- extends Lanot_EasyBanner_Block_Adminhtml_Banner_Grid
28
- {
29
- protected $_aclSection = 'manage_category';
30
- protected $_isTabGrid = true;
31
- protected $_columnPrefix = 'banners_';
32
- protected $_checkboxFieldName = 'banners_in_selected';
33
- protected $_categoryItemParam = 'category_id';
34
-
35
- /** @var Lanot_EasyBanner_Model_Category */
36
- protected $_categoryItem = null;
37
-
38
- /**
39
- * Init Grid default properties
40
- *
41
- */
42
- public function __construct()
43
- {
44
- parent::__construct();
45
-
46
- if ($this->_getCategoryItem()->getId()) {
47
- $this->setDefaultFilter(array('in_selected' => 1));
48
- }
49
- }
50
-
51
- /**
52
- * Checks when this block is readonly
53
- *
54
- * @return boolean
55
- */
56
- public function isReadonly()
57
- {
58
- return !$this->_getAclHelper()->isActionAllowed($this->_aclSection . '/save');
59
- }
60
-
61
- /**
62
- * Checks when this block is not available
63
- *
64
- * @return boolean
65
- */
66
- public function isMassActionAllowed()
67
- {
68
- return false;
69
- }
70
-
71
- /**
72
- * @return string
73
- */
74
- public function getGridUrl()
75
- {
76
- return $this->getUrl('*/*/ajaxbannersgridonly', array('_current' => true));
77
- }
78
-
79
- /**
80
- * Retrieve selected banners
81
- *
82
- * @return array
83
- */
84
- public function getSelectedLinks()
85
- {
86
- return $this->_getCategoryItem()->getSelectedBanners();
87
- }
88
-
89
- /**
90
- * @return Lanot_EasyBanner_Model_Banner|null
91
- */
92
- protected function _getCategoryItem()
93
- {
94
- if ($this->_categoryItem !== null) {
95
- return $this->_categoryItem;
96
- }
97
-
98
- $itemId = $this->getRequest()->getParam($this->_categoryItemParam);
99
- $this->_categoryItem = $this->_getCategoryItemModel();
100
- if ($itemId) {
101
- $this->_categoryItem->load($itemId);
102
- }
103
- return $this->_categoryItem;
104
- }
105
-
106
- /**
107
- * @return Lanot_EasyBanner_Model_Category
108
- */
109
- protected function _getCategoryItemModel()
110
- {
111
- return Mage::getSingleton('lanot_easybanner/category');
112
- }
113
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Category admin edit form main tab block
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Category_Edit_Tab_Banners
27
+ extends Lanot_EasyBanner_Block_Adminhtml_Banner_Grid
28
+ {
29
+ protected $_aclSection = 'manage_category';
30
+ protected $_isTabGrid = true;
31
+ protected $_columnPrefix = 'banners_';
32
+ protected $_checkboxFieldName = 'banners_in_selected';
33
+ protected $_categoryItemParam = 'category_id';
34
+
35
+ /** @var Lanot_EasyBanner_Model_Category */
36
+ protected $_categoryItem = null;
37
+
38
+ /**
39
+ * Init Grid default properties
40
+ *
41
+ */
42
+ public function __construct()
43
+ {
44
+ parent::__construct();
45
+
46
+ if ($this->_getCategoryItem()->getId()) {
47
+ $this->setDefaultFilter(array('in_selected' => 1));
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Checks when this block is readonly
53
+ *
54
+ * @return boolean
55
+ */
56
+ public function isReadonly()
57
+ {
58
+ return !$this->_getAclHelper()->isActionAllowed($this->_aclSection . '/save');
59
+ }
60
+
61
+ /**
62
+ * Checks when this block is not available
63
+ *
64
+ * @return boolean
65
+ */
66
+ public function isMassActionAllowed()
67
+ {
68
+ return false;
69
+ }
70
+
71
+ /**
72
+ * @return string
73
+ */
74
+ public function getGridUrl()
75
+ {
76
+ return $this->getUrl('*/*/ajaxbannersgridonly', array('_current' => true));
77
+ }
78
+
79
+ /**
80
+ * Retrieve selected banners
81
+ *
82
+ * @return array
83
+ */
84
+ public function getSelectedLinks()
85
+ {
86
+ return $this->_getCategoryItem()->getSelectedBanners();
87
+ }
88
+
89
+ /**
90
+ * @return Lanot_EasyBanner_Model_Banner|null
91
+ */
92
+ protected function _getCategoryItem()
93
+ {
94
+ if ($this->_categoryItem !== null) {
95
+ return $this->_categoryItem;
96
+ }
97
+
98
+ $itemId = $this->getRequest()->getParam($this->_categoryItemParam);
99
+ $this->_categoryItem = $this->_getCategoryItemModel();
100
+ if ($itemId) {
101
+ $this->_categoryItem->load($itemId);
102
+ }
103
+ return $this->_categoryItem;
104
+ }
105
+
106
+ /**
107
+ * @return Lanot_EasyBanner_Model_Category
108
+ */
109
+ protected function _getCategoryItemModel()
110
+ {
111
+ return Mage::getSingleton('lanot_easybanner/category');
112
+ }
113
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category/Edit/Tab/Main.php CHANGED
@@ -1,122 +1,122 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Category admin edit form main tab block
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Category_Edit_Tab_Main
27
- extends Mage_Adminhtml_Block_Widget_Form
28
- implements Mage_Adminhtml_Block_Widget_Tab_Interface
29
- {
30
- /**
31
- * Prepare form elements for tab
32
- *
33
- * @return Mage_Adminhtml_Block_Widget_Form
34
- */
35
- protected function _prepareForm()
36
- {
37
- /* @var $model Lanot_EasyBanner_Model_Category */
38
- $model = $this->_getHelper()->getCategoryItemInstance();
39
-
40
- /**
41
- * Checking if user have permissions to save information
42
- */
43
- if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_category/save')) {
44
- $isElementDisabled = false;
45
- } else {
46
- $isElementDisabled = true;
47
- }
48
-
49
- $form = new Varien_Data_Form();
50
-
51
- $form->setHtmlIdPrefix('category_main_');
52
-
53
- $fieldset = $form->addFieldset('base_fieldset', array(
54
- 'legend' => $this->_getHelper()->__('Category Item Info')
55
- ));
56
-
57
- if ($model->getId()) {
58
- $fieldset->addField('category_id', 'hidden', array(
59
- 'name' => 'id',
60
- ));
61
- }
62
-
63
- $fieldset->addField('title', 'text', array(
64
- 'name' => 'title',
65
- 'label' => $this->_getHelper()->__('Title'),
66
- 'title' => $this->_getHelper()->__('Title'),
67
- 'required' => true,
68
- 'disabled' => $isElementDisabled
69
- ));
70
-
71
- $fieldset->addField('description', 'textarea', array(
72
- 'name' => 'description',
73
- 'label' => $this->_getHelper()->__('Description'),
74
- 'title' => $this->_getHelper()->__('Description'),
75
- 'required' => false,
76
- 'disabled' => $isElementDisabled,
77
- 'style' => 'height: 100px',
78
- ));
79
-
80
- $fieldset->addField('is_active', 'select', array(
81
- 'name' => 'is_active',
82
- 'label' => $this->_getHelper()->__('Is Active'),
83
- 'title' => $this->_getHelper()->__('Is Active'),
84
- 'required' => true,
85
- 'disabled' => $isElementDisabled,
86
- 'options' => $model->getAvailableStatuses(),
87
- ));
88
-
89
- $form->setValues($model->getData());
90
-
91
- Mage::dispatchEvent('adminhtml_easybanner_category_edit_tab_main_prepare_form', array('form' => $form));
92
-
93
- $this->setForm($form);
94
-
95
- return parent::_prepareForm();
96
- }
97
-
98
- public function getTabLabel()
99
- {
100
- return $this->_getHelper()->__('Category Info');
101
- }
102
-
103
- public function getTabTitle()
104
- {
105
- return $this->_getHelper()->__('Category Info');
106
- }
107
-
108
- public function canShowTab()
109
- {
110
- return true;
111
- }
112
-
113
- public function isHidden()
114
- {
115
- return false;
116
- }
117
-
118
- protected function _getHelper()
119
- {
120
- return Mage::helper('lanot_easybanner');
121
- }
122
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Category admin edit form main tab block
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Category_Edit_Tab_Main
27
+ extends Mage_Adminhtml_Block_Widget_Form
28
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
29
+ {
30
+ /**
31
+ * Prepare form elements for tab
32
+ *
33
+ * @return Mage_Adminhtml_Block_Widget_Form
34
+ */
35
+ protected function _prepareForm()
36
+ {
37
+ /* @var $model Lanot_EasyBanner_Model_Category */
38
+ $model = $this->_getHelper()->getCategoryItemInstance();
39
+
40
+ /**
41
+ * Checking if user have permissions to save information
42
+ */
43
+ if (Mage::helper('lanot_easybanner/admin')->isActionAllowed('manage_category/save')) {
44
+ $isElementDisabled = false;
45
+ } else {
46
+ $isElementDisabled = true;
47
+ }
48
+
49
+ $form = new Varien_Data_Form();
50
+
51
+ $form->setHtmlIdPrefix('category_main_');
52
+
53
+ $fieldset = $form->addFieldset('base_fieldset', array(
54
+ 'legend' => $this->_getHelper()->__('Category Item Info')
55
+ ));
56
+
57
+ if ($model->getId()) {
58
+ $fieldset->addField('category_id', 'hidden', array(
59
+ 'name' => 'id',
60
+ ));
61
+ }
62
+
63
+ $fieldset->addField('title', 'text', array(
64
+ 'name' => 'title',
65
+ 'label' => $this->_getHelper()->__('Title'),
66
+ 'title' => $this->_getHelper()->__('Title'),
67
+ 'required' => true,
68
+ 'disabled' => $isElementDisabled
69
+ ));
70
+
71
+ $fieldset->addField('description', 'textarea', array(
72
+ 'name' => 'description',
73
+ 'label' => $this->_getHelper()->__('Description'),
74
+ 'title' => $this->_getHelper()->__('Description'),
75
+ 'required' => false,
76
+ 'disabled' => $isElementDisabled,
77
+ 'style' => 'height: 100px',
78
+ ));
79
+
80
+ $fieldset->addField('is_active', 'select', array(
81
+ 'name' => 'is_active',
82
+ 'label' => $this->_getHelper()->__('Is Active'),
83
+ 'title' => $this->_getHelper()->__('Is Active'),
84
+ 'required' => true,
85
+ 'disabled' => $isElementDisabled,
86
+ 'options' => $model->getAvailableStatuses(),
87
+ ));
88
+
89
+ $form->setValues($model->getData());
90
+
91
+ Mage::dispatchEvent('adminhtml_easybanner_category_edit_tab_main_prepare_form', array('form' => $form));
92
+
93
+ $this->setForm($form);
94
+
95
+ return parent::_prepareForm();
96
+ }
97
+
98
+ public function getTabLabel()
99
+ {
100
+ return $this->_getHelper()->__('Category Info');
101
+ }
102
+
103
+ public function getTabTitle()
104
+ {
105
+ return $this->_getHelper()->__('Category Info');
106
+ }
107
+
108
+ public function canShowTab()
109
+ {
110
+ return true;
111
+ }
112
+
113
+ public function isHidden()
114
+ {
115
+ return false;
116
+ }
117
+
118
+ protected function _getHelper()
119
+ {
120
+ return Mage::helper('lanot_easybanner');
121
+ }
122
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category/Edit/Tabs.php CHANGED
@@ -1,69 +1,69 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Category admin edit tabs block
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Category_Edit_Tabs
27
- extends Mage_Adminhtml_Block_Widget_Tabs
28
- {
29
- /**
30
- * Initialize tabs and define tabs block settings
31
- *
32
- */
33
- public function __construct()
34
- {
35
- parent::__construct();
36
-
37
- $this->setId('page_tabs');
38
- $this->setDestElementId('edit_form');
39
- $this->setTitle($this->_getHelper()->__('Category Info'));
40
- }
41
-
42
- /**
43
- * @return Lanot_EasyBanner_Helper_Data
44
- */
45
- protected function _getHelper()
46
- {
47
- return Mage::helper('lanot_easybanner');
48
- }
49
-
50
- protected function _prepareLayout()
51
- {
52
- $this->addTab('main', array(
53
- 'label' => $this->_getHelper()->__('Category info'),
54
- 'content' => $this->getLayout()->createBlock('lanot_easybanner/adminhtml_category_edit_tab_main')->toHtml(),
55
- ));
56
-
57
- $params = array(
58
- '_current' => true,
59
- 'category_id' => (int) $this->_getHelper()->getCategoryItemInstance()->getId(),
60
- );
61
- $this->addTab('banners', array(
62
- 'label' => $this->_getHelper()->__('Banners'),
63
- 'url' => $this->getUrl('*/*/ajaxbannersgrid', $params),
64
- 'class' => 'ajax',
65
- ));
66
-
67
- return parent::_prepareLayout();
68
- }
69
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Category admin edit tabs block
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Category_Edit_Tabs
27
+ extends Mage_Adminhtml_Block_Widget_Tabs
28
+ {
29
+ /**
30
+ * Initialize tabs and define tabs block settings
31
+ *
32
+ */
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+
37
+ $this->setId('page_tabs');
38
+ $this->setDestElementId('edit_form');
39
+ $this->setTitle($this->_getHelper()->__('Category Info'));
40
+ }
41
+
42
+ /**
43
+ * @return Lanot_EasyBanner_Helper_Data
44
+ */
45
+ protected function _getHelper()
46
+ {
47
+ return Mage::helper('lanot_easybanner');
48
+ }
49
+
50
+ protected function _prepareLayout()
51
+ {
52
+ $this->addTab('main', array(
53
+ 'label' => $this->_getHelper()->__('Category info'),
54
+ 'content' => $this->getLayout()->createBlock('lanot_easybanner/adminhtml_category_edit_tab_main')->toHtml(),
55
+ ));
56
+
57
+ $params = array(
58
+ '_current' => true,
59
+ 'category_id' => (int) $this->_getHelper()->getCategoryItemInstance()->getId(),
60
+ );
61
+ $this->addTab('banners', array(
62
+ 'label' => $this->_getHelper()->__('Banners'),
63
+ 'url' => $this->getUrl('*/*/ajaxbannersgrid', $params),
64
+ 'class' => 'ajax',
65
+ ));
66
+
67
+ return parent::_prepareLayout();
68
+ }
69
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Category/Grid.php CHANGED
@@ -1,41 +1,41 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Categories list admin grid
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Category_Grid
27
- extends Lanot_EasyBanner_Block_Adminhtml_Grid_Abstract
28
- {
29
- protected $_gridId = 'easybanner_categories_list_grid';
30
- protected $_entityIdField = 'category_id';
31
- protected $_itemParam = 'category_id';
32
- protected $_formFieldName = 'category';
33
-
34
- /**
35
- * @return Lanot_EasyBanner_Model_Category
36
- */
37
- protected function _getItemModel()
38
- {
39
- return Mage::getSingleton('lanot_easybanner/category');
40
- }
41
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Categories list admin grid
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Category_Grid
27
+ extends Lanot_EasyBanner_Block_Adminhtml_Grid_Abstract
28
+ {
29
+ protected $_gridId = 'easybanner_categories_list_grid';
30
+ protected $_entityIdField = 'category_id';
31
+ protected $_itemParam = 'category_id';
32
+ protected $_formFieldName = 'category';
33
+
34
+ /**
35
+ * @return Lanot_EasyBanner_Model_Category
36
+ */
37
+ protected function _getItemModel()
38
+ {
39
+ return Mage::getSingleton('lanot_easybanner/category');
40
+ }
41
+ }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Grid/Abstract.php CHANGED
@@ -1,311 +1,311 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Banners list admin grid
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Grid_Abstract
27
- extends Mage_Adminhtml_Block_Widget_Grid
28
- {
29
- protected $_gridId = 'easybanner_list_grid';
30
- protected $_entityIdField = 'entity_id';
31
- protected $_itemParam = 'entity_id';
32
- protected $_formFieldName = 'entity';
33
- protected $_columnPrefix = '';
34
- protected $_checkboxFieldName = 'in_selected';
35
- protected $_isTabGrid = false;
36
-
37
- /** @var Mage_Core_Model_Abstract */
38
- protected $_item = null;
39
-
40
- /**
41
- * Init Grid default properties
42
- *
43
- */
44
- public function __construct()
45
- {
46
- parent::__construct();
47
-
48
- $this->setId($this->_gridId);
49
- $this->setDefaultSort('sort_order');
50
- $this->setDefaultDir('ASC');
51
- $this->setSaveParametersInSession(true);
52
- $this->setUseAjax(true);
53
-
54
- if ($this->isReadonly()) {
55
- $this->setFilterVisibility(false);
56
- }
57
- }
58
-
59
- /**
60
- * @return this
61
- */
62
- protected function _prepareCollection()
63
- {
64
- $collection = $this->_getItemModel()->getCollection();
65
-
66
- //filter colelction if it show in tab
67
- if ($this->_isTabGrid && $this->isReadonly()) {
68
- $valueIds = $this->getSelectedLinks();
69
- if (empty($valueIds)) {
70
- $valueIds = array(0);
71
- }
72
- $collection->addFieldToFilter($this->_entityIdField, array('in' => $valueIds));
73
- }
74
-
75
- $this->setCollection($collection);
76
-
77
- return parent::_prepareCollection();
78
- }
79
-
80
- /**
81
- * @param $row
82
- * @return string
83
- */
84
- public function getRowUrl($row)
85
- {
86
- return (!$this->_isTabGrid) ? $this->getUrl('*/*/edit', array('id' => $row->getId())) : '#';
87
- }
88
-
89
- /**
90
- * @return string
91
- */
92
- public function getGridUrl()
93
- {
94
- return (!$this->_isTabGrid) ?
95
- $this->getUrl('*/*/grid', array('_current' => true)) :
96
- $this->getUrl('*/*/ajaxgridonly', array('_current' => true));
97
- }
98
-
99
- /**
100
- * Prepare Grid columns
101
- *
102
- * @return Lanot_EasyBanner_Block_Adminhtml_Banner_Grid
103
- */
104
- protected function _prepareColumns()
105
- {
106
- if ($this->_isTabGrid) {
107
- $this->addColumn('in_selected', array(
108
- 'header_css_class' => 'a-center',
109
- 'type' => 'checkbox',
110
- 'name' => 'in_selected',
111
- 'values' => $this->getSelectedLinks(),
112
- 'align' => 'center',
113
- 'index' => $this->_entityIdField,
114
- ));
115
- }
116
-
117
- $this->addColumn($this->_entityIdField, array(
118
- 'header' => $this->_getHelper()->__('ID'),
119
- 'index' => $this->_entityIdField,
120
- 'type' => 'number',
121
- 'width' => '50px',
122
- ));
123
-
124
- $this->addColumn('title', array(
125
- 'header' => $this->_getHelper()->__('Title'),
126
- 'index' => 'title',
127
- ));
128
-
129
- $this->addColumn('is_active', array(
130
- 'header' => $this->_getHelper()->__('Active'),
131
- 'index' => 'is_active',
132
- 'type' => 'options',
133
- 'options' => $this->_getItemModel()->getAvailableStatuses(),
134
- 'width' => '100px',
135
- ));
136
-
137
- $this->addColumn('updated_at', array(
138
- 'header' => $this->_getHelper()->__('Updated'),
139
- 'index' => 'updated_at',
140
- 'width' => '150px',
141
- ));
142
-
143
- if (!$this->_isTabGrid) {
144
- $this->addColumn('action',
145
- array(
146
- 'header' => $this->_getHelper()->__('Action'),
147
- 'width' => '70px',
148
- 'align' => 'center',
149
- 'type' => 'action',
150
- 'getter' => 'getId',
151
- 'actions' => array(
152
- array(
153
- 'caption' => $this->_getHelper()->__('Edit'),
154
- 'url' => array('base' => '*/*/edit'),
155
- 'field' => 'id'
156
- )
157
- ),
158
- 'filter' => false,
159
- 'sortable' => false,
160
- 'index' => 'banner',
161
- ));
162
- }
163
-
164
- return parent::_prepareColumns();
165
- }
166
-
167
-
168
- /**
169
- * @return Lanot_EasyBanner_Block_Adminhtml_Grid_Abstract
170
- */
171
- protected function _prepareMassaction()
172
- {
173
- if (!$this->isMassActionAllowed()) {
174
- return $this;
175
- }
176
-
177
- $this->setMassactionIdField($this->_entityIdField);
178
- $this->getMassactionBlock()->setFormFieldName($this->_formFieldName);
179
-
180
- $this->getMassactionBlock()->addItem('delete', array(
181
- 'label' => $this->_getHelper()->__('Delete'),
182
- 'confirm' => $this->_getHelper()->__('Are you sure?'),
183
- 'url' => $this->getUrl('*/*/mass', array('type' => 'delete')),
184
- ));
185
-
186
- $this->getMassactionBlock()->addItem('active_enable', array(
187
- 'label' => $this->_getHelper()->__('Enable'),
188
- 'url' => $this->getUrl('*/*/mass', array('type' => 'enable'))
189
- ));
190
-
191
- $this->getMassactionBlock()->addItem('active_disable', array(
192
- 'label' => $this->_getHelper()->__('Disable'),
193
- 'url' => $this->getUrl('*/*/mass', array('type' => 'disable'))
194
- ));
195
-
196
- return $this;
197
- }
198
-
199
- /**
200
- * @return Lanot_EasyBanner_Helper_Data
201
- */
202
- protected function _getHelper()
203
- {
204
- return Mage::helper('lanot_easybanner');
205
- }
206
-
207
- /**
208
- * @return Lanot_EasyBanner_Helper_Admin
209
- */
210
- protected function _getAclHelper()
211
- {
212
- return Mage::helper('lanot_easybanner/admin');
213
- }
214
-
215
- /**
216
- * Retrieve selected categories
217
- *
218
- * @return array
219
- */
220
- public function getSelectedLinks()
221
- {
222
- return $this->_getItem()->getSelectedLinks();
223
- }
224
-
225
- /**
226
- * Add column to grid
227
- *
228
- * @param string $columnId
229
- * @param array || Varien_Object $column
230
- * @return Mage_Adminhtml_Block_Widget_Grid
231
- */
232
- public function addColumn($columnId, $column)
233
- {
234
- return parent::addColumn($this->_columnPrefix . $columnId, $column);
235
- }
236
-
237
- /**
238
- * @return Lanot_EasyBanner_Model_Banner|null
239
- */
240
- protected function _getItem()
241
- {
242
- if ($this->_item !== null) {
243
- return $this->_item;
244
- }
245
-
246
- $itemId = $this->getRequest()->getParam($this->_itemParam);
247
- $this->_item = $this->_getItemModel();
248
- if ($itemId) {
249
- $this->_item->load($itemId);
250
- }
251
- return $this->_item;
252
- }
253
-
254
- /**
255
- * @param $column
256
- * @return Lanot_EasyBanner_Block_Adminhtml_Grid_Abstract
257
- */
258
- protected function _addColumnFilterToCollection($column)
259
- {
260
- if (!$this->_isTabGrid) {
261
- return $this;
262
- }
263
-
264
- // Set custom filter by selected values
265
- if ($column->getId() == $this->_checkboxFieldName) {
266
- $valueIds = $this->getSelectedLinks();
267
- if (empty($valueIds)) {
268
- $valueIds = 0;
269
- }
270
-
271
- if ($column->getFilter()->getValue()) {
272
- $this->getCollection()->addFieldToFilter($this->_entityIdField, array('in' => $valueIds));
273
- } else {
274
- if($valueIds) {
275
- $this->getCollection()->addFieldToFilter($this->_entityIdField, array('nin' => $valueIds));
276
- }
277
- }
278
- } else {
279
- parent::_addColumnFilterToCollection($column);
280
- }
281
- return $this;
282
- }
283
-
284
- /**
285
- * Checks when this block is readonly
286
- *
287
- * @return boolean
288
- */
289
- public function isReadonly()
290
- {
291
- return false;
292
- }
293
-
294
- /**
295
- * Checks when this block is not available
296
- *
297
- * @return boolean
298
- */
299
- public function isMassActionAllowed()
300
- {
301
- return true;
302
- }
303
-
304
- /**
305
- * @return Mage_Core_Model_Abstract
306
- */
307
- protected function _getItemModel()
308
- {
309
- return null;
310
- }
311
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Banners list admin grid
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Grid_Abstract
27
+ extends Mage_Adminhtml_Block_Widget_Grid
28
+ {
29
+ protected $_gridId = 'easybanner_list_grid';
30
+ protected $_entityIdField = 'entity_id';
31
+ protected $_itemParam = 'entity_id';
32
+ protected $_formFieldName = 'entity';
33
+ protected $_columnPrefix = '';
34
+ protected $_checkboxFieldName = 'in_selected';
35
+ protected $_isTabGrid = false;
36
+
37
+ /** @var Mage_Core_Model_Abstract */
38
+ protected $_item = null;
39
+
40
+ /**
41
+ * Init Grid default properties
42
+ *
43
+ */
44
+ public function __construct()
45
+ {
46
+ parent::__construct();
47
+
48
+ $this->setId($this->_gridId);
49
+ $this->setDefaultSort('sort_order');
50
+ $this->setDefaultDir('ASC');
51
+ $this->setSaveParametersInSession(true);
52
+ $this->setUseAjax(true);
53
+
54
+ if ($this->isReadonly()) {
55
+ $this->setFilterVisibility(false);
56
+ }
57
+ }
58
+
59
+ /**
60
+ * @return this
61
+ */
62
+ protected function _prepareCollection()
63
+ {
64
+ $collection = $this->_getItemModel()->getCollection();
65
+
66
+ //filter colelction if it show in tab
67
+ if ($this->_isTabGrid && $this->isReadonly()) {
68
+ $valueIds = $this->getSelectedLinks();
69
+ if (empty($valueIds)) {
70
+ $valueIds = array(0);
71
+ }
72
+ $collection->addFieldToFilter($this->_entityIdField, array('in' => $valueIds));
73
+ }
74
+
75
+ $this->setCollection($collection);
76
+
77
+ return parent::_prepareCollection();
78
+ }
79
+
80
+ /**
81
+ * @param $row
82
+ * @return string
83
+ */
84
+ public function getRowUrl($row)
85
+ {
86
+ return (!$this->_isTabGrid) ? $this->getUrl('*/*/edit', array('id' => $row->getId())) : '#';
87
+ }
88
+
89
+ /**
90
+ * @return string
91
+ */
92
+ public function getGridUrl()
93
+ {
94
+ return (!$this->_isTabGrid) ?
95
+ $this->getUrl('*/*/grid', array('_current' => true)) :
96
+ $this->getUrl('*/*/ajaxgridonly', array('_current' => true));
97
+ }
98
+
99
+ /**
100
+ * Prepare Grid columns
101
+ *
102
+ * @return Lanot_EasyBanner_Block_Adminhtml_Banner_Grid
103
+ */
104
+ protected function _prepareColumns()
105
+ {
106
+ if ($this->_isTabGrid) {
107
+ $this->addColumn('in_selected', array(
108
+ 'header_css_class' => 'a-center',
109
+ 'type' => 'checkbox',
110
+ 'name' => 'in_selected',
111
+ 'values' => $this->getSelectedLinks(),
112
+ 'align' => 'center',
113
+ 'index' => $this->_entityIdField,
114
+ ));
115
+ }
116
+
117
+ $this->addColumn($this->_entityIdField, array(
118
+ 'header' => $this->_getHelper()->__('ID'),
119
+ 'index' => $this->_entityIdField,
120
+ 'type' => 'number',
121
+ 'width' => '50px',
122
+ ));
123
+
124
+ $this->addColumn('title', array(
125
+ 'header' => $this->_getHelper()->__('Title'),
126
+ 'index' => 'title',
127
+ ));
128
+
129
+ $this->addColumn('is_active', array(
130
+ 'header' => $this->_getHelper()->__('Active'),
131
+ 'index' => 'is_active',
132
+ 'type' => 'options',
133
+ 'options' => $this->_getItemModel()->getAvailableStatuses(),
134
+ 'width' => '100px',
135
+ ));
136
+
137
+ $this->addColumn('updated_at', array(
138
+ 'header' => $this->_getHelper()->__('Updated'),
139
+ 'index' => 'updated_at',
140
+ 'width' => '150px',
141
+ ));
142
+
143
+ if (!$this->_isTabGrid) {
144
+ $this->addColumn('action',
145
+ array(
146
+ 'header' => $this->_getHelper()->__('Action'),
147
+ 'width' => '70px',
148
+ 'align' => 'center',
149
+ 'type' => 'action',
150
+ 'getter' => 'getId',
151
+ 'actions' => array(
152
+ array(
153
+ 'caption' => $this->_getHelper()->__('Edit'),
154
+ 'url' => array('base' => '*/*/edit'),
155
+ 'field' => 'id'
156
+ )
157
+ ),
158
+ 'filter' => false,
159
+ 'sortable' => false,
160
+ 'index' => 'banner',
161
+ ));
162
+ }
163
+
164
+ return parent::_prepareColumns();
165
+ }
166
+
167
+
168
+ /**
169
+ * @return Lanot_EasyBanner_Block_Adminhtml_Grid_Abstract
170
+ */
171
+ protected function _prepareMassaction()
172
+ {
173
+ if (!$this->isMassActionAllowed()) {
174
+ return $this;
175
+ }
176
+
177
+ $this->setMassactionIdField($this->_entityIdField);
178
+ $this->getMassactionBlock()->setFormFieldName($this->_formFieldName);
179
+
180
+ $this->getMassactionBlock()->addItem('delete', array(
181
+ 'label' => $this->_getHelper()->__('Delete'),
182
+ 'confirm' => $this->_getHelper()->__('Are you sure?'),
183
+ 'url' => $this->getUrl('*/*/mass', array('type' => 'delete')),
184
+ ));
185
+
186
+ $this->getMassactionBlock()->addItem('active_enable', array(
187
+ 'label' => $this->_getHelper()->__('Enable'),
188
+ 'url' => $this->getUrl('*/*/mass', array('type' => 'enable'))
189
+ ));
190
+
191
+ $this->getMassactionBlock()->addItem('active_disable', array(
192
+ 'label' => $this->_getHelper()->__('Disable'),
193
+ 'url' => $this->getUrl('*/*/mass', array('type' => 'disable'))
194
+ ));
195
+
196
+ return $this;
197
+ }
198
+
199
+ /**
200
+ * @return Lanot_EasyBanner_Helper_Data
201
+ */
202
+ protected function _getHelper()
203
+ {
204
+ return Mage::helper('lanot_easybanner');
205
+ }
206
+
207
+ /**
208
+ * @return Lanot_EasyBanner_Helper_Admin
209
+ */
210
+ protected function _getAclHelper()
211
+ {
212
+ return Mage::helper('lanot_easybanner/admin');
213
+ }
214
+
215
+ /**
216
+ * Retrieve selected categories
217
+ *
218
+ * @return array
219
+ */
220
+ public function getSelectedLinks()
221
+ {
222
+ return $this->_getItem()->getSelectedLinks();
223
+ }
224
+
225
+ /**
226
+ * Add column to grid
227
+ *
228
+ * @param string $columnId
229
+ * @param array || Varien_Object $column
230
+ * @return Mage_Adminhtml_Block_Widget_Grid
231
+ */
232
+ public function addColumn($columnId, $column)
233
+ {
234
+ return parent::addColumn($this->_columnPrefix . $columnId, $column);
235
+ }
236
+
237
+ /**
238
+ * @return Lanot_EasyBanner_Model_Banner|null
239
+ */
240
+ protected function _getItem()
241
+ {
242
+ if ($this->_item !== null) {
243
+ return $this->_item;
244
+ }
245
+
246
+ $itemId = $this->getRequest()->getParam($this->_itemParam);
247
+ $this->_item = $this->_getItemModel();
248
+ if ($itemId) {
249
+ $this->_item->load($itemId);
250
+ }
251
+ return $this->_item;
252
+ }
253
+
254
+ /**
255
+ * @param $column
256
+ * @return Lanot_EasyBanner_Block_Adminhtml_Grid_Abstract
257
+ */
258
+ protected function _addColumnFilterToCollection($column)
259
+ {
260
+ if (!$this->_isTabGrid) {
261
+ return $this;
262
+ }
263
+
264
+ // Set custom filter by selected values
265
+ if ($column->getId() == $this->_checkboxFieldName) {
266
+ $valueIds = $this->getSelectedLinks();
267
+ if (empty($valueIds)) {
268
+ $valueIds = 0;
269
+ }
270
+
271
+ if ($column->getFilter()->getValue()) {
272
+ $this->getCollection()->addFieldToFilter($this->_entityIdField, array('in' => $valueIds));
273
+ } else {
274
+ if($valueIds) {
275
+ $this->getCollection()->addFieldToFilter($this->_entityIdField, array('nin' => $valueIds));
276
+ }
277
+ }
278
+ } else {
279
+ parent::_addColumnFilterToCollection($column);
280
+ }
281
+ return $this;
282
+ }
283
+
284
+ /**
285
+ * Checks when this block is readonly
286
+ *
287
+ * @return boolean
288
+ */
289
+ public function isReadonly()
290
+ {
291
+ return false;
292
+ }
293
+
294
+ /**
295
+ * Checks when this block is not available
296
+ *
297
+ * @return boolean
298
+ */
299
+ public function isMassActionAllowed()
300
+ {
301
+ return true;
302
+ }
303
+
304
+ /**
305
+ * @return Mage_Core_Model_Abstract
306
+ */
307
+ protected function _getItemModel()
308
+ {
309
+ return null;
310
+ }
311
  }
app/code/community/Lanot/EasyBanner/Block/Adminhtml/Renderer/Banner.php CHANGED
@@ -1,84 +1,84 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Image Renderer
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Block_Adminhtml_Renderer_Banner extends Varien_Data_Form_Element_Image
27
- {
28
-
29
- /**
30
- * Enter description here...
31
- *
32
- * @return string
33
- */
34
- public function getElementHtml()
35
- {
36
- $html = '';
37
- if ($this->getComment()) {
38
- $html .= sprintf('<div>%s</div>', $this->getComment());
39
- }
40
-
41
- $url = '';
42
- if ($this->getValue()) {
43
- $url = $this->_getUrl();
44
-
45
- if( !preg_match("/^http\:\/\/|https\:\/\//", $url) ) {
46
- $url = Mage::getBaseUrl('media') . $url;
47
- }
48
- }
49
- $this->setClass('input-file');
50
- $html.= Varien_Data_Form_Element_Abstract::getElementHtml();
51
- $html.= $this->_getDeleteCheckbox();
52
- $html.= $this->getBannerHtml();
53
-
54
- return $html;
55
- }
56
-
57
- /**
58
- * Enter description here...
59
- *
60
- * @return string
61
- */
62
- protected function _getDeleteCheckbox()
63
- {
64
- $html = '';
65
- if ($this->getValue()) {
66
- $label = $this->_getHelper()->__('Delete File');
67
- $html .= '<span style="display:block;">';
68
- $html .= '<input type="checkbox" name="'.parent::getName().'[delete]" value="1" class="checkbox" id="'.$this->getHtmlId().'_delete"'.($this->getDisabled() ? ' disabled="disabled"': '').'/>';
69
- $html .= '<label for="'.$this->getHtmlId().'_delete"'.($this->getDisabled() ? ' class="disabled"' : '').'> '.$label.'</label>';
70
- $html .= $this->_getHiddenInput();
71
- $html .= '</span>';
72
- }
73
-
74
- return $html;
75
- }
76
-
77
- /**
78
- * @return Lanot_EasyBanner_Helper_Data
79
- */
80
- protected function _getHelper()
81
- {
82
- return Mage::helper('lanot_easybanner');
83
- }
84
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Image Renderer
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Block_Adminhtml_Renderer_Banner extends Varien_Data_Form_Element_Image
27
+ {
28
+
29
+ /**
30
+ * Enter description here...
31
+ *
32
+ * @return string
33
+ */
34
+ public function getElementHtml()
35
+ {
36
+ $html = '';
37
+ if ($this->getComment()) {
38
+ $html .= sprintf('<div>%s</div>', $this->getComment());
39
+ }
40
+
41
+ $url = '';
42
+ if ($this->getValue()) {
43
+ $url = $this->_getUrl();
44
+
45
+ if( !preg_match("/^http\:\/\/|https\:\/\//", $url) ) {
46
+ $url = Mage::getBaseUrl('media') . $url;
47
+ }
48
+ }
49
+ $this->setClass('input-file');
50
+ $html.= Varien_Data_Form_Element_Abstract::getElementHtml();
51
+ $html.= $this->_getDeleteCheckbox();
52
+ $html.= $this->getBannerHtml();
53
+
54
+ return $html;
55
+ }
56
+
57
+ /**
58
+ * Enter description here...
59
+ *
60
+ * @return string
61
+ */
62
+ protected function _getDeleteCheckbox()
63
+ {
64
+ $html = '';
65
+ if ($this->getValue()) {
66
+ $label = $this->_getHelper()->__('Delete File');
67
+ $html .= '<span style="display:block;">';
68
+ $html .= '<input type="checkbox" name="'.parent::getName().'[delete]" value="1" class="checkbox" id="'.$this->getHtmlId().'_delete"'.($this->getDisabled() ? ' disabled="disabled"': '').'/>';
69
+ $html .= '<label for="'.$this->getHtmlId().'_delete"'.($this->getDisabled() ? ' class="disabled"' : '').'> '.$label.'</label>';
70
+ $html .= $this->_getHiddenInput();
71
+ $html .= '</span>';
72
+ }
73
+
74
+ return $html;
75
+ }
76
+
77
+ /**
78
+ * @return Lanot_EasyBanner_Helper_Data
79
+ */
80
+ protected function _getHelper()
81
+ {
82
+ return Mage::helper('lanot_easybanner');
83
+ }
84
  }
app/code/community/Lanot/EasyBanner/Block/Banner/Renderer/Abstract.php CHANGED
@@ -1,100 +1,100 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- class Lanot_EasyBanner_Block_Banner_Renderer_Abstract
22
- {
23
- /** @var Lanot_EasyBanner_Model_Banner */
24
- protected $_banner = null;
25
-
26
- /** @var bool */
27
- protected $_disabledClick = false;
28
-
29
- /**
30
- * @param Lanot_EasyBanner_Model_Banner $banner
31
- * @return Lanot_EasyBanner_Block_Banner_Renderer_Abstract
32
- */
33
- public function setBanner(Lanot_EasyBanner_Model_Banner $banner)
34
- {
35
- $this->_banner = $banner;
36
- return $this;
37
- }
38
-
39
- /**
40
- * @return string
41
- */
42
- public function render()
43
- {
44
- }
45
-
46
- /**
47
- * @return Lanot_EasyBanner_Helper_Data
48
- */
49
- protected function _getHelper()
50
- {
51
- return Mage::helper('lanot_easybanner');
52
- }
53
-
54
- /**
55
- * @param $data
56
- * @param null $allowedTags
57
- * @return mixed
58
- */
59
- protected function htmlEscape($data, $allowedTags = null)
60
- {
61
- return Mage::helper('core')->escapeHtml($data, $allowedTags);
62
- }
63
-
64
- /**
65
- * @param $html
66
- * @return string
67
- */
68
- protected function _wrapHtml($html)
69
- {
70
- if ($this->_banner->getUrl() && !$this->_disabledClick) {
71
- $html = sprintf('<a href="%s" %s>%s</a>', $this->_banner->getUrl(), $this->_getLinkAttributes(), $html);
72
- }
73
- return $html;
74
- }
75
-
76
- /**
77
- * @return string
78
- */
79
- protected function _getLinkAttributes()
80
- {
81
- $attrs = array();
82
- if ($this->_getHelper()->canShowNewWindow()) {
83
- $attrs[] = 'target="_blank"';
84
- }
85
-
86
- if ($this->_banner->getTitle()) {
87
- $attrs[] = 'title="' . $this->htmlEscape($this->_banner->getTitle()) . '"';
88
- }
89
- return implode(' ', $attrs);
90
- }
91
-
92
- /**
93
- * @return Lanot_EasyBanner_Block_Banner_Renderer_Abstract
94
- */
95
- public function disableClick()
96
- {
97
- $this->_disabledClick = true;
98
- return $this;
99
- }
100
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Lanot_EasyBanner_Block_Banner_Renderer_Abstract
22
+ {
23
+ /** @var Lanot_EasyBanner_Model_Banner */
24
+ protected $_banner = null;
25
+
26
+ /** @var bool */
27
+ protected $_disabledClick = false;
28
+
29
+ /**
30
+ * @param Lanot_EasyBanner_Model_Banner $banner
31
+ * @return Lanot_EasyBanner_Block_Banner_Renderer_Abstract
32
+ */
33
+ public function setBanner(Lanot_EasyBanner_Model_Banner $banner)
34
+ {
35
+ $this->_banner = $banner;
36
+ return $this;
37
+ }
38
+
39
+ /**
40
+ * @return string
41
+ */
42
+ public function render()
43
+ {
44
+ }
45
+
46
+ /**
47
+ * @return Lanot_EasyBanner_Helper_Data
48
+ */
49
+ protected function _getHelper()
50
+ {
51
+ return Mage::helper('lanot_easybanner');
52
+ }
53
+
54
+ /**
55
+ * @param $data
56
+ * @param null $allowedTags
57
+ * @return mixed
58
+ */
59
+ protected function htmlEscape($data, $allowedTags = null)
60
+ {
61
+ return Mage::helper('core')->escapeHtml($data, $allowedTags);
62
+ }
63
+
64
+ /**
65
+ * @param $html
66
+ * @return string
67
+ */
68
+ protected function _wrapHtml($html)
69
+ {
70
+ if ($this->_banner->getUrl() && !$this->_disabledClick) {
71
+ $html = sprintf('<a href="%s" %s>%s</a>', $this->_banner->getUrl(), $this->_getLinkAttributes(), $html);
72
+ }
73
+ return $html;
74
+ }
75
+
76
+ /**
77
+ * @return string
78
+ */
79
+ protected function _getLinkAttributes()
80
+ {
81
+ $attrs = array();
82
+ if ($this->_getHelper()->canShowNewWindow()) {
83
+ $attrs[] = 'target="_blank"';
84
+ }
85
+
86
+ if ($this->_banner->getTitle()) {
87
+ $attrs[] = 'title="' . $this->htmlEscape($this->_banner->getTitle()) . '"';
88
+ }
89
+ return implode(' ', $attrs);
90
+ }
91
+
92
+ /**
93
+ * @return Lanot_EasyBanner_Block_Banner_Renderer_Abstract
94
+ */
95
+ public function disableClick()
96
+ {
97
+ $this->_disabledClick = true;
98
+ return $this;
99
+ }
100
  }
app/code/community/Lanot/EasyBanner/Block/Banner/Renderer/Flash.php CHANGED
@@ -1,54 +1,54 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- class Lanot_EasyBanner_Block_Banner_Renderer_Flash
22
- extends Lanot_EasyBanner_Block_Banner_Renderer_Abstract
23
- {
24
- public function render()
25
- {
26
- $attributes = array();
27
- if ($this->_banner->getWidth()) {
28
- $attributes[] = 'width="' . $this->_banner->getWidth() . '"';
29
- }
30
-
31
- if ($this->_banner->getHeight()) {
32
- $attributes[] = 'height="' . $this->_banner->getHeight() . '"';
33
- }
34
-
35
- $code = ''.
36
- '<object type="application/x-shockwave-flash"
37
- data="' . $this->_banner->getPathUrl() . '"
38
- classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
39
- codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0"
40
- ' . implode(' ', $attributes) . '>
41
- <param name="movie" value="' . $this->_banner->getPathUrl() . '">
42
- <param name="wmode" value="opaque">
43
- <param name="quality" value="high">
44
- <embed src="' . $this->_banner->getPathUrl() . '" ' . implode(' ', $attributes) . '
45
- wmode="opaque"
46
- quality="high"
47
- type="application/x-shockwave-flash"
48
- pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
49
- />
50
- </object>';
51
-
52
- return $this->_wrapHtml($code);
53
- }
54
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Lanot_EasyBanner_Block_Banner_Renderer_Flash
22
+ extends Lanot_EasyBanner_Block_Banner_Renderer_Abstract
23
+ {
24
+ public function render()
25
+ {
26
+ $attributes = array();
27
+ if ($this->_banner->getWidth()) {
28
+ $attributes[] = 'width="' . $this->_banner->getWidth() . '"';
29
+ }
30
+
31
+ if ($this->_banner->getHeight()) {
32
+ $attributes[] = 'height="' . $this->_banner->getHeight() . '"';
33
+ }
34
+
35
+ $code = ''.
36
+ '<object type="application/x-shockwave-flash"
37
+ data="' . $this->_banner->getPathUrl() . '"
38
+ classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
39
+ codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0"
40
+ ' . implode(' ', $attributes) . '>
41
+ <param name="movie" value="' . $this->_banner->getPathUrl() . '">
42
+ <param name="wmode" value="opaque">
43
+ <param name="quality" value="high">
44
+ <embed src="' . $this->_banner->getPathUrl() . '" ' . implode(' ', $attributes) . '
45
+ wmode="opaque"
46
+ quality="high"
47
+ type="application/x-shockwave-flash"
48
+ pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
49
+ />
50
+ </object>';
51
+
52
+ return $this->_wrapHtml($code);
53
+ }
54
  }
app/code/community/Lanot/EasyBanner/Block/Banner/Renderer/Image.php CHANGED
@@ -1,46 +1,46 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- class Lanot_EasyBanner_Block_Banner_Renderer_Image
22
- extends Lanot_EasyBanner_Block_Banner_Renderer_Abstract
23
- {
24
- public function render()
25
- {
26
- $attributes = array();
27
- $attributes[] = 'src="' . $this->_banner->getPathUrl() . '"';
28
-
29
- if ($this->_banner->getWidth()) {
30
- $attributes[] = 'width="' . $this->_banner->getWidth() . '"';
31
- }
32
-
33
- if ($this->_banner->getHeight()) {
34
- $attributes[] = 'height="' . $this->_banner->getHeight() . '"';
35
- }
36
-
37
- if ($this->_banner->getClass()) {
38
- $attributes[] = 'class="' . $this->_banner->getClass() . '"';
39
- }
40
-
41
- if ($this->_banner->getTitle()) {
42
- $attributes[] = 'alt="' . $this->htmlEscape($this->_banner->getTitle()) . '"';
43
- }
44
- return $this->_wrapHtml('<img ' . implode(' ', $attributes). '/>');
45
- }
46
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Lanot_EasyBanner_Block_Banner_Renderer_Image
22
+ extends Lanot_EasyBanner_Block_Banner_Renderer_Abstract
23
+ {
24
+ public function render()
25
+ {
26
+ $attributes = array();
27
+ $attributes[] = 'src="' . $this->_banner->getPathUrl() . '"';
28
+
29
+ if ($this->_banner->getWidth()) {
30
+ $attributes[] = 'width="' . $this->_banner->getWidth() . '"';
31
+ }
32
+
33
+ if ($this->_banner->getHeight()) {
34
+ $attributes[] = 'height="' . $this->_banner->getHeight() . '"';
35
+ }
36
+
37
+ if ($this->_banner->getClass()) {
38
+ $attributes[] = 'class="' . $this->_banner->getClass() . '"';
39
+ }
40
+
41
+ if ($this->_banner->getTitle()) {
42
+ $attributes[] = 'alt="' . $this->htmlEscape($this->_banner->getTitle()) . '"';
43
+ }
44
+ return $this->_wrapHtml('<img ' . implode(' ', $attributes). '/>');
45
+ }
46
  }
app/code/community/Lanot/EasyBanner/Block/Widget/Banners.php CHANGED
@@ -1,90 +1,90 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- class Lanot_EasyBanner_Block_Widget_Banners
22
- extends Mage_Core_Block_Template
23
- implements Mage_Widget_Block_Interface
24
- {
25
- /** @var Lanot_EasyBanner_Model_Mysql4_Banner_Collection */
26
- protected $_collection = null;
27
-
28
- protected function _construct()
29
- {
30
- parent::_construct();
31
- $this->setTemplate('lanot/easybanner/banners.phtml');
32
- }
33
-
34
- /**
35
- * @return Lanot_EasyBanner_Model_Mysql4_Banner_Collection
36
- */
37
- public function getItems()
38
- {
39
- if ($this->_collection !== null) {
40
- return $this->_collection;
41
- }
42
-
43
- $this->_collection = $this->_getModel()->getCollection()
44
- ->useActive();///load only active banners
45
-
46
- //set filter by category id
47
- if ($this->getCategoryId()) {
48
- $this->_collection->useCategory((int)$this->getCategoryId());
49
- }
50
- //check use random
51
- if ($this->getRandom()) {
52
- $this->_collection->useRandom();
53
- } else {
54
- $this->_collection->useLast();
55
- }
56
- //set limit
57
- if ($this->getLimit()) {
58
- $this->_collection->setPageSize((int)$this->getLimit());
59
- }
60
- return $this->_collection->load();
61
- }
62
-
63
- /**
64
- * @param Lanot_EasyBanner_Model_Banner
65
- * @return string
66
- */
67
- public function render($item)
68
- {
69
- return $this->_getHelper()
70
- ->getBannerRenderer($item->getType())
71
- ->setBanner($item)
72
- ->render();
73
- }
74
-
75
- /**
76
- * @return Lanot_EasyBanner_Model_Banner
77
- */
78
- protected function _getModel()
79
- {
80
- return Mage::getModel('lanot_easybanner/banner');
81
- }
82
-
83
- /**
84
- * @return Lanot_EasyBanner_Helpe_Data
85
- */
86
- protected function _getHelper()
87
- {
88
- return Mage::helper('lanot_easybanner');
89
- }
90
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Lanot_EasyBanner_Block_Widget_Banners
22
+ extends Mage_Core_Block_Template
23
+ implements Mage_Widget_Block_Interface
24
+ {
25
+ /** @var Lanot_EasyBanner_Model_Mysql4_Banner_Collection */
26
+ protected $_collection = null;
27
+
28
+ protected function _construct()
29
+ {
30
+ parent::_construct();
31
+ $this->setTemplate('lanot/easybanner/banners.phtml');
32
+ }
33
+
34
+ /**
35
+ * @return Lanot_EasyBanner_Model_Mysql4_Banner_Collection
36
+ */
37
+ public function getItems()
38
+ {
39
+ if ($this->_collection !== null) {
40
+ return $this->_collection;
41
+ }
42
+
43
+ $this->_collection = $this->_getModel()->getCollection()
44
+ ->useActive();///load only active banners
45
+
46
+ //set filter by category id
47
+ if ($this->getCategoryId()) {
48
+ $this->_collection->useCategory((int)$this->getCategoryId());
49
+ }
50
+ //check use random
51
+ if ($this->getRandom()) {
52
+ $this->_collection->useRandom();
53
+ } else {
54
+ $this->_collection->useLast();
55
+ }
56
+ //set limit
57
+ if ($this->getLimit()) {
58
+ $this->_collection->setPageSize((int)$this->getLimit());
59
+ }
60
+ return $this->_collection->load();
61
+ }
62
+
63
+ /**
64
+ * @param Lanot_EasyBanner_Model_Banner
65
+ * @return string
66
+ */
67
+ public function render($item)
68
+ {
69
+ return $this->_getHelper()
70
+ ->getBannerRenderer($item->getType())
71
+ ->setBanner($item)
72
+ ->render();
73
+ }
74
+
75
+ /**
76
+ * @return Lanot_EasyBanner_Model_Banner
77
+ */
78
+ protected function _getModel()
79
+ {
80
+ return Mage::getModel('lanot_easybanner/banner');
81
+ }
82
+
83
+ /**
84
+ * @return Lanot_EasyBanner_Helpe_Data
85
+ */
86
+ protected function _getHelper()
87
+ {
88
+ return Mage::helper('lanot_easybanner');
89
+ }
90
  }
app/code/community/Lanot/EasyBanner/Controller/Adminhtml/AbstractController.php CHANGED
@@ -1,315 +1,315 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- class Lanot_EasyBanner_Controller_Adminhtml_AbstractController
22
- extends Mage_Adminhtml_Controller_Action
23
- {
24
- protected $_msgTitle = 'Items';
25
- protected $_msgHeader = 'Items';
26
- protected $_msgItemDoesNotExist = 'Item does not exist.';
27
- protected $_msgItemNotFound = 'Unable to find an item. #%s';
28
- protected $_msgItemEdit = 'Edit Item';
29
- protected $_msgItemNew = 'New Item';
30
- protected $_msgItemSaved = 'The item has been saved.';
31
- protected $_msgItemDeleted = 'The item has been deleted.';
32
- protected $_msgError = 'An error occurred while edit the item. %s';
33
- protected $_msgErrorItems = 'An error occurred while edit the items. %s';
34
- protected $_msgItems = 'The items %s has been';
35
-
36
- protected $_aclSection = null;
37
-
38
- /**
39
- * Check the permission to run it
40
- *
41
- * @return boolean
42
- */
43
- protected function _isAllowed()
44
- {
45
- switch ($this->getRequest()->getActionName()) {
46
- case 'new':
47
- case 'edit':
48
- case 'save':
49
- case 'mass':
50
- return $this->_getAclHelper()->isActionAllowed($this->_aclSection . '/save');
51
- break;
52
- case 'delete':
53
- return $this->_getAclHelper()->isActionAllowed($this->_aclSection . '/delete');
54
- break;
55
- default:
56
- return $this->_getAclHelper()->isActionAllowed($this->_aclSection);
57
- break;
58
- }
59
- }
60
-
61
- /**
62
- * Init actions
63
- *
64
- * @return Lanot_EasyBanner_Controller_Adminhtml_AbstractController
65
- */
66
- protected function _initAction()
67
- {
68
- // load layout, set active menu and breadcrumbs
69
- $this->loadLayout()
70
- ->_setActiveMenu('lanot/lanot_easybanner')
71
- ->_addBreadcrumb(
72
- $this->_getHelper()->__($this->_msgTitle),
73
- $this->_getHelper()->__($this->_msgTitle)
74
- )
75
- ->_addBreadcrumb(
76
- $this->_getHelper()->__($this->_msgHeader),
77
- $this->_getHelper()->__($this->_msgHeader)
78
- );
79
-
80
- return $this;
81
- }
82
-
83
- /**
84
- * Index action
85
- */
86
- public function indexAction()
87
- {
88
- $this->_title($this->__($this->_msgTitle))
89
- ->_title($this->__($this->_msgHeader))
90
- ->_initAction()
91
- ->renderLayout();
92
- }
93
-
94
- /**
95
- * Grid action
96
- */
97
- public function gridAction()
98
- {
99
- $this->loadLayout();
100
- $this->renderLayout();
101
- }
102
-
103
- /**
104
- * Create new Item
105
- */
106
- public function newAction()
107
- {
108
- $this->_forward('edit');
109
- }
110
-
111
- /**
112
- * Edit item
113
- */
114
- public function editAction()
115
- {
116
- $this->_title($this->__($this->_msgTitle))
117
- ->_title($this->__($this->_msgHeader));
118
-
119
- // 1. instance model
120
- $model = $this->_getItemModel();
121
-
122
- // 2. if exists id, check it and load data
123
- $itemId = $this->getRequest()->getParam('id');
124
- if ($itemId) {
125
- $model->load($itemId);
126
- if (!$model->getId()) {
127
- $this->_getSession()->addError($this->_getHelper()->__($this->_msgItemNotFound, $itemId));
128
- return $this->_redirect('*/*/');
129
- }
130
- // prepare title
131
- $this->_title($model->getTitle());
132
- $breadCrumb = $this->_getHelper()->__($this->_msgItemEdit);
133
- } else {
134
- $this->_title($this->_getHelper()->__($this->_msgItemNew));
135
- $breadCrumb = $this->_getHelper()->__($this->_msgItemNew);
136
- }
137
- // 3. Set entered data if was error when we do save
138
- $data = $this->_getSession()->getFormData(true);
139
- if (!empty($data)) {
140
- $model->addData($data);
141
- }
142
- // 4. Register model to use later in blocks
143
- $this->_registerItem($model);
144
-
145
- // Init breadcrumbs
146
- $this->_initAction()->_addBreadcrumb($breadCrumb, $breadCrumb);
147
-
148
- // 5. render layout
149
- $this->renderLayout();
150
- }
151
-
152
- /**
153
- * Save action
154
- */
155
- public function saveAction()
156
- {
157
- $redirectPath = '*/*';
158
- $redirectParams = array();
159
- $hasError = false;
160
- // check if data sent
161
- $data = $this->getRequest()->getPost();
162
- if ($data) {
163
- //1. instance model
164
- $model = $this->_getItemModel();
165
- //2. if exists id, try to load data
166
- $itemId = $this->getRequest()->getParam('id');
167
- if ($itemId) {
168
- $model->load($itemId);
169
- }
170
- $model->addData($data);
171
-
172
- try {
173
- //3. save the data
174
- $model->save();
175
- //4. display success message
176
- $msg = $this->_getHelper()->__($this->_msgItemSaved);
177
- $this->_getSession()->addSuccess($msg);
178
- //5. check if 'Save and Continue'
179
- if ($this->getRequest()->getParam('back')) {
180
- $redirectPath = '*/*/edit';
181
- $redirectParams = array('id' => $model->getId());
182
- }
183
- } catch (Mage_Core_Exception $e) {
184
- $this->_getSession()->addError($e->getMessage());
185
- } catch (Exception $e) {
186
- $msg = $this->_getHelper()->__($this->_msgError);
187
- $this->_getSession()->addException($e, $msg);
188
- }
189
- //6. check if errors happened
190
- if ($hasError) {
191
- $this->_getSession()->setFormData($data);
192
- $redirectPath = '*/*/edit';
193
- $redirectParams = array('id' => $this->getRequest()->getParam('id'));
194
- }
195
- }
196
- //7. go to grid or edit form
197
- $this->_redirect($redirectPath, $redirectParams);
198
- }
199
-
200
- /**
201
- * Delete action
202
- */
203
- public function deleteAction()
204
- {
205
- $itemId = $this->getRequest()->getParam('id');
206
- if ($itemId) {
207
- try {
208
- // 1. instance model
209
- $model = $this->_getItemModel();
210
- // 2. if exists id, load data
211
- $model->load($itemId);
212
- // 3. check if elements exists
213
- if (!$model->getId()) {
214
- $msg = $this->_getHelper()->__($this->_msgItemDoesNotExist);
215
- Mage::throwException($msg);
216
- }
217
- // 4. delete banner
218
- $model->delete();
219
- // display success message
220
- $msg = $this->_getHelper()->__($this->_msgItemDeleted);
221
- $this->_getSession()->addSuccess($msg);
222
- } catch (Mage_Core_Exception $e) {
223
- $this->_getSession()->addError($e->getMessage());
224
- } catch (Exception $e) {
225
- $msg = $this->_getHelper()->__($this->_msgError, $e->getMessage());
226
- $this->_getSession()->addException($e, $msg);
227
- }
228
- }
229
- // 5. go to grid
230
- $this->_redirect('*/*/');
231
- }
232
-
233
- /**
234
- *
235
- */
236
- public function massAction()
237
- {
238
- $msg = '';
239
- $key = $this->getRequest()->getParam('massaction_prepare_key');
240
- $itemIds = $this->getRequest()->getParam($key);
241
- $type = $this->getRequest()->getParam('type');
242
- $active = $this->_getItemModel()->getStatusDisabled();
243
-
244
- if (is_array($itemIds) && count($itemIds)) {
245
- try {
246
- foreach($itemIds as $itemId) {
247
- // 1. instance banner model
248
- $model = $this->_getItemModel();
249
- // 2. if exists id, load data
250
- $model->load($itemId);
251
- // 3. check if elements exists
252
- if (!$model->getId()) {
253
- Mage::throwException($this->_getHelper()->__($this->_msgItemNotFound));
254
- }
255
- // 4. main logic
256
- switch ($type) {
257
- case 'enable':
258
- $active = $this->_getItemModel()->getStatusEnabled();
259
- case 'disable':
260
- $model->setIsActive($active);
261
- $model->save();
262
- $msg = $this->_msgItems .
263
- (($active == $this->_getItemModel()->getStatusDisabled()) ? ' enabled' : ' disabled') . '.';
264
- break;
265
- case 'delete':
266
- $model->delete();
267
- $msg = $this->_msgItems . ' deleted.';
268
- break;
269
- }
270
- }
271
- // display success message
272
- $this->_getSession()->addSuccess($this->_getHelper()->__($msg, implode(', ', $itemIds)));
273
- } catch (Mage_Core_Exception $e) {
274
- $this->_getSession()->addError($e->getMessage());
275
- } catch (Exception $e) {
276
- $this->_getSession()->addException($e, $this->_getHelper()->__($this->_msgErrorItems,$e->getMessage()));
277
- }
278
- }
279
- // 5. go to grid
280
- $this->_redirect('*/*/');
281
- }
282
-
283
- /**
284
- * @return Lanot_EasyBanner_Helper_Data
285
- */
286
- protected function _getHelper()
287
- {
288
- return Mage::helper('lanot_easybanner');
289
- }
290
-
291
- /**
292
- * @return Lanot_EasyBanner_Helper_Admin
293
- */
294
- protected function _getAclHelper()
295
- {
296
- return Mage::helper('lanot_easybanner/admin');
297
- }
298
-
299
- /**
300
- * @return Mage_Core_Model_Abstract
301
- */
302
- protected function _getItemModel()
303
- {
304
- return null;
305
- }
306
-
307
- /**
308
- * @param Mage_Core_Model_Abstract $model
309
- * @return Lanot_EasyBanner_Controller_Adminhtml_AbstractController
310
- */
311
- protected function _registerItem(Mage_Core_Model_Abstract $model)
312
- {
313
- return $this;
314
- }
315
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Lanot_EasyBanner_Controller_Adminhtml_AbstractController
22
+ extends Mage_Adminhtml_Controller_Action
23
+ {
24
+ protected $_msgTitle = 'Items';
25
+ protected $_msgHeader = 'Items';
26
+ protected $_msgItemDoesNotExist = 'Item does not exist.';
27
+ protected $_msgItemNotFound = 'Unable to find an item. #%s';
28
+ protected $_msgItemEdit = 'Edit Item';
29
+ protected $_msgItemNew = 'New Item';
30
+ protected $_msgItemSaved = 'The item has been saved.';
31
+ protected $_msgItemDeleted = 'The item has been deleted.';
32
+ protected $_msgError = 'An error occurred while edit the item. %s';
33
+ protected $_msgErrorItems = 'An error occurred while edit the items. %s';
34
+ protected $_msgItems = 'The items %s has been';
35
+
36
+ protected $_aclSection = null;
37
+
38
+ /**
39
+ * Check the permission to run it
40
+ *
41
+ * @return boolean
42
+ */
43
+ protected function _isAllowed()
44
+ {
45
+ switch ($this->getRequest()->getActionName()) {
46
+ case 'new':
47
+ case 'edit':
48
+ case 'save':
49
+ case 'mass':
50
+ return $this->_getAclHelper()->isActionAllowed($this->_aclSection . '/save');
51
+ break;
52
+ case 'delete':
53
+ return $this->_getAclHelper()->isActionAllowed($this->_aclSection . '/delete');
54
+ break;
55
+ default:
56
+ return $this->_getAclHelper()->isActionAllowed($this->_aclSection);
57
+ break;
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Init actions
63
+ *
64
+ * @return Lanot_EasyBanner_Controller_Adminhtml_AbstractController
65
+ */
66
+ protected function _initAction()
67
+ {
68
+ // load layout, set active menu and breadcrumbs
69
+ $this->loadLayout()
70
+ ->_setActiveMenu('lanot/lanot_easybanner')
71
+ ->_addBreadcrumb(
72
+ $this->_getHelper()->__($this->_msgTitle),
73
+ $this->_getHelper()->__($this->_msgTitle)
74
+ )
75
+ ->_addBreadcrumb(
76
+ $this->_getHelper()->__($this->_msgHeader),
77
+ $this->_getHelper()->__($this->_msgHeader)
78
+ );
79
+
80
+ return $this;
81
+ }
82
+
83
+ /**
84
+ * Index action
85
+ */
86
+ public function indexAction()
87
+ {
88
+ $this->_title($this->__($this->_msgTitle))
89
+ ->_title($this->__($this->_msgHeader))
90
+ ->_initAction()
91
+ ->renderLayout();
92
+ }
93
+
94
+ /**
95
+ * Grid action
96
+ */
97
+ public function gridAction()
98
+ {
99
+ $this->loadLayout();
100
+ $this->renderLayout();
101
+ }
102
+
103
+ /**
104
+ * Create new Item
105
+ */
106
+ public function newAction()
107
+ {
108
+ $this->_forward('edit');
109
+ }
110
+
111
+ /**
112
+ * Edit item
113
+ */
114
+ public function editAction()
115
+ {
116
+ $this->_title($this->__($this->_msgTitle))
117
+ ->_title($this->__($this->_msgHeader));
118
+
119
+ // 1. instance model
120
+ $model = $this->_getItemModel();
121
+
122
+ // 2. if exists id, check it and load data
123
+ $itemId = $this->getRequest()->getParam('id');
124
+ if ($itemId) {
125
+ $model->load($itemId);
126
+ if (!$model->getId()) {
127
+ $this->_getSession()->addError($this->_getHelper()->__($this->_msgItemNotFound, $itemId));
128
+ return $this->_redirect('*/*/');
129
+ }
130
+ // prepare title
131
+ $this->_title($model->getTitle());
132
+ $breadCrumb = $this->_getHelper()->__($this->_msgItemEdit);
133
+ } else {
134
+ $this->_title($this->_getHelper()->__($this->_msgItemNew));
135
+ $breadCrumb = $this->_getHelper()->__($this->_msgItemNew);
136
+ }
137
+ // 3. Set entered data if was error when we do save
138
+ $data = $this->_getSession()->getFormData(true);
139
+ if (!empty($data)) {
140
+ $model->addData($data);
141
+ }
142
+ // 4. Register model to use later in blocks
143
+ $this->_registerItem($model);
144
+
145
+ // Init breadcrumbs
146
+ $this->_initAction()->_addBreadcrumb($breadCrumb, $breadCrumb);
147
+
148
+ // 5. render layout
149
+ $this->renderLayout();
150
+ }
151
+
152
+ /**
153
+ * Save action
154
+ */
155
+ public function saveAction()
156
+ {
157
+ $redirectPath = '*/*';
158
+ $redirectParams = array();
159
+ $hasError = false;
160
+ // check if data sent
161
+ $data = $this->getRequest()->getPost();
162
+ if ($data) {
163
+ //1. instance model
164
+ $model = $this->_getItemModel();
165
+ //2. if exists id, try to load data
166
+ $itemId = $this->getRequest()->getParam('id');
167
+ if ($itemId) {
168
+ $model->load($itemId);
169
+ }
170
+ $model->addData($data);
171
+
172
+ try {
173
+ //3. save the data
174
+ $model->save();
175
+ //4. display success message
176
+ $msg = $this->_getHelper()->__($this->_msgItemSaved);
177
+ $this->_getSession()->addSuccess($msg);
178
+ //5. check if 'Save and Continue'
179
+ if ($this->getRequest()->getParam('back')) {
180
+ $redirectPath = '*/*/edit';
181
+ $redirectParams = array('id' => $model->getId());
182
+ }
183
+ } catch (Mage_Core_Exception $e) {
184
+ $this->_getSession()->addError($e->getMessage());
185
+ } catch (Exception $e) {
186
+ $msg = $this->_getHelper()->__($this->_msgError);
187
+ $this->_getSession()->addException($e, $msg);
188
+ }
189
+ //6. check if errors happened
190
+ if ($hasError) {
191
+ $this->_getSession()->setFormData($data);
192
+ $redirectPath = '*/*/edit';
193
+ $redirectParams = array('id' => $this->getRequest()->getParam('id'));
194
+ }
195
+ }
196
+ //7. go to grid or edit form
197
+ $this->_redirect($redirectPath, $redirectParams);
198
+ }
199
+
200
+ /**
201
+ * Delete action
202
+ */
203
+ public function deleteAction()
204
+ {
205
+ $itemId = $this->getRequest()->getParam('id');
206
+ if ($itemId) {
207
+ try {
208
+ // 1. instance model
209
+ $model = $this->_getItemModel();
210
+ // 2. if exists id, load data
211
+ $model->load($itemId);
212
+ // 3. check if elements exists
213
+ if (!$model->getId()) {
214
+ $msg = $this->_getHelper()->__($this->_msgItemDoesNotExist);
215
+ Mage::throwException($msg);
216
+ }
217
+ // 4. delete banner
218
+ $model->delete();
219
+ // display success message
220
+ $msg = $this->_getHelper()->__($this->_msgItemDeleted);
221
+ $this->_getSession()->addSuccess($msg);
222
+ } catch (Mage_Core_Exception $e) {
223
+ $this->_getSession()->addError($e->getMessage());
224
+ } catch (Exception $e) {
225
+ $msg = $this->_getHelper()->__($this->_msgError, $e->getMessage());
226
+ $this->_getSession()->addException($e, $msg);
227
+ }
228
+ }
229
+ // 5. go to grid
230
+ $this->_redirect('*/*/');
231
+ }
232
+
233
+ /**
234
+ *
235
+ */
236
+ public function massAction()
237
+ {
238
+ $msg = '';
239
+ $key = $this->getRequest()->getParam('massaction_prepare_key');
240
+ $itemIds = $this->getRequest()->getParam($key);
241
+ $type = $this->getRequest()->getParam('type');
242
+ $active = $this->_getItemModel()->getStatusDisabled();
243
+
244
+ if (is_array($itemIds) && count($itemIds)) {
245
+ try {
246
+ foreach($itemIds as $itemId) {
247
+ // 1. instance banner model
248
+ $model = $this->_getItemModel();
249
+ // 2. if exists id, load data
250
+ $model->load($itemId);
251
+ // 3. check if elements exists
252
+ if (!$model->getId()) {
253
+ Mage::throwException($this->_getHelper()->__($this->_msgItemNotFound));
254
+ }
255
+ // 4. main logic
256
+ switch ($type) {
257
+ case 'enable':
258
+ $active = $this->_getItemModel()->getStatusEnabled();
259
+ case 'disable':
260
+ $model->setIsActive($active);
261
+ $model->save();
262
+ $msg = $this->_msgItems .
263
+ (($active == $this->_getItemModel()->getStatusDisabled()) ? ' enabled' : ' disabled') . '.';
264
+ break;
265
+ case 'delete':
266
+ $model->delete();
267
+ $msg = $this->_msgItems . ' deleted.';
268
+ break;
269
+ }
270
+ }
271
+ // display success message
272
+ $this->_getSession()->addSuccess($this->_getHelper()->__($msg, implode(', ', $itemIds)));
273
+ } catch (Mage_Core_Exception $e) {
274
+ $this->_getSession()->addError($e->getMessage());
275
+ } catch (Exception $e) {
276
+ $this->_getSession()->addException($e, $this->_getHelper()->__($this->_msgErrorItems,$e->getMessage()));
277
+ }
278
+ }
279
+ // 5. go to grid
280
+ $this->_redirect('*/*/');
281
+ }
282
+
283
+ /**
284
+ * @return Lanot_EasyBanner_Helper_Data
285
+ */
286
+ protected function _getHelper()
287
+ {
288
+ return Mage::helper('lanot_easybanner');
289
+ }
290
+
291
+ /**
292
+ * @return Lanot_EasyBanner_Helper_Admin
293
+ */
294
+ protected function _getAclHelper()
295
+ {
296
+ return Mage::helper('lanot_easybanner/admin');
297
+ }
298
+
299
+ /**
300
+ * @return Mage_Core_Model_Abstract
301
+ */
302
+ protected function _getItemModel()
303
+ {
304
+ return null;
305
+ }
306
+
307
+ /**
308
+ * @param Mage_Core_Model_Abstract $model
309
+ * @return Lanot_EasyBanner_Controller_Adminhtml_AbstractController
310
+ */
311
+ protected function _registerItem(Mage_Core_Model_Abstract $model)
312
+ {
313
+ return $this;
314
+ }
315
+ }
app/code/community/Lanot/EasyBanner/Helper/Admin.php CHANGED
@@ -1,34 +1,34 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- class Lanot_EasyBanner_Helper_Admin
22
- extends Mage_Core_Helper_Abstract
23
- {
24
- /**
25
- * Check permission for passed action
26
- *
27
- * @param string $action
28
- * @return bool
29
- */
30
- public function isActionAllowed($action)
31
- {
32
- return Mage::getSingleton('admin/session')->isAllowed('lanot/lanot_easybanner/' . $action);
33
- }
34
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Lanot_EasyBanner_Helper_Admin
22
+ extends Mage_Core_Helper_Abstract
23
+ {
24
+ /**
25
+ * Check permission for passed action
26
+ *
27
+ * @param string $action
28
+ * @return bool
29
+ */
30
+ public function isActionAllowed($action)
31
+ {
32
+ return Mage::getSingleton('admin/session')->isAllowed('lanot/lanot_easybanner/' . $action);
33
+ }
34
+ }
app/code/community/Lanot/EasyBanner/Helper/Data.php CHANGED
@@ -1,103 +1,103 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- class Lanot_EasyBanner_Helper_Data
22
- extends Mage_Core_Helper_Abstract
23
- {
24
- const XML_NODE_RENDERERS = 'lanot_easybanner/renderers/%s';
25
- const XML_NODE_CONFIG = 'lanot_easybanner/view/%s';
26
-
27
- /**
28
- * @return Lanot_EasyBanner_Model_Category
29
- */
30
- public function getCategoryItemInstance()
31
- {
32
- return Mage::registry('easy.banner.category.item');
33
- }
34
-
35
- /**
36
- * @return Lanot_EasyBanner_Model_Banner
37
- */
38
- public function getBannerItemInstance()
39
- {
40
- return Mage::registry('easy.banner.banner.item');
41
- }
42
-
43
- /**
44
- * @return bool
45
- */
46
- public function isEnabled() {
47
- return (bool)Mage::getStoreConfig(sprintf(self::XML_NODE_CONFIG, 'enabled'), Mage::app()->getStore()->getId());
48
- }
49
-
50
- /**
51
- * @return bool
52
- */
53
- public function canShowNewWindow()
54
- {
55
- return (bool)Mage::getStoreConfig(sprintf(self::XML_NODE_CONFIG, 'new_window'), Mage::app()->getStore()->getId());
56
- }
57
-
58
- /**
59
- * @return string
60
- */
61
- public function getBlockCssClass()
62
- {
63
- return (string)Mage::getStoreConfig(sprintf(self::XML_NODE_CONFIG, 'block_css_class'), Mage::app()->getStore()->getId());
64
- }
65
-
66
- /**
67
- * @return string
68
- */
69
- public function getItemCssClass()
70
- {
71
- return (string)Mage::getStoreConfig(sprintf(self::XML_NODE_CONFIG, 'item_css_class'), Mage::app()->getStore()->getId());
72
- }
73
-
74
- /**
75
- * @return string
76
- */
77
- public function getTitleCssClass()
78
- {
79
- return (string)Mage::getStoreConfig(sprintf(self::XML_NODE_CONFIG, 'title_css_class'), Mage::app()->getStore()->getId());
80
- }
81
-
82
- /**
83
- * @return Lanot_EasyBanner_Block_Banner_Renderer_Abstract
84
- */
85
- public function getBannerRenderer($type)
86
- {
87
- $path = sprintf(self::XML_NODE_RENDERERS, $type);
88
- $type = (string) Mage::getConfig()->getNode($path);
89
- if (!$type) {
90
- Mage::throwException($this->__('Could not retrieve xml node %s', $path));
91
- }
92
- return $this->_getBlock($type);
93
- }
94
-
95
- /**
96
- * @param $type
97
- * @return object
98
- */
99
- protected function _getBlock($type)
100
- {
101
- return Mage::getBlockSingleton($type);
102
- }
103
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Lanot_EasyBanner_Helper_Data
22
+ extends Mage_Core_Helper_Abstract
23
+ {
24
+ const XML_NODE_RENDERERS = 'lanot_easybanner/renderers/%s';
25
+ const XML_NODE_CONFIG = 'lanot_easybanner/view/%s';
26
+
27
+ /**
28
+ * @return Lanot_EasyBanner_Model_Category
29
+ */
30
+ public function getCategoryItemInstance()
31
+ {
32
+ return Mage::registry('easy.banner.category.item');
33
+ }
34
+
35
+ /**
36
+ * @return Lanot_EasyBanner_Model_Banner
37
+ */
38
+ public function getBannerItemInstance()
39
+ {
40
+ return Mage::registry('easy.banner.banner.item');
41
+ }
42
+
43
+ /**
44
+ * @return bool
45
+ */
46
+ public function isEnabled() {
47
+ return (bool)Mage::getStoreConfig(sprintf(self::XML_NODE_CONFIG, 'enabled'), Mage::app()->getStore()->getId());
48
+ }
49
+
50
+ /**
51
+ * @return bool
52
+ */
53
+ public function canShowNewWindow()
54
+ {
55
+ return (bool)Mage::getStoreConfig(sprintf(self::XML_NODE_CONFIG, 'new_window'), Mage::app()->getStore()->getId());
56
+ }
57
+
58
+ /**
59
+ * @return string
60
+ */
61
+ public function getBlockCssClass()
62
+ {
63
+ return (string)Mage::getStoreConfig(sprintf(self::XML_NODE_CONFIG, 'block_css_class'), Mage::app()->getStore()->getId());
64
+ }
65
+
66
+ /**
67
+ * @return string
68
+ */
69
+ public function getItemCssClass()
70
+ {
71
+ return (string)Mage::getStoreConfig(sprintf(self::XML_NODE_CONFIG, 'item_css_class'), Mage::app()->getStore()->getId());
72
+ }
73
+
74
+ /**
75
+ * @return string
76
+ */
77
+ public function getTitleCssClass()
78
+ {
79
+ return (string)Mage::getStoreConfig(sprintf(self::XML_NODE_CONFIG, 'title_css_class'), Mage::app()->getStore()->getId());
80
+ }
81
+
82
+ /**
83
+ * @return Lanot_EasyBanner_Block_Banner_Renderer_Abstract
84
+ */
85
+ public function getBannerRenderer($type)
86
+ {
87
+ $path = sprintf(self::XML_NODE_RENDERERS, $type);
88
+ $type = (string) Mage::getConfig()->getNode($path);
89
+ if (!$type) {
90
+ Mage::throwException($this->__('Could not retrieve xml node %s', $path));
91
+ }
92
+ return $this->_getBlock($type);
93
+ }
94
+
95
+ /**
96
+ * @param $type
97
+ * @return object
98
+ */
99
+ protected function _getBlock($type)
100
+ {
101
+ return Mage::getBlockSingleton($type);
102
+ }
103
+ }
app/code/community/Lanot/EasyBanner/Model/Banner.php CHANGED
@@ -1,277 +1,277 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- class Lanot_EasyBanner_Model_Banner
22
- extends Mage_Core_Model_Abstract
23
- {
24
- const STATUS_ENABLED = 1;
25
- const STATUS_DISABLED = 0;
26
-
27
- /**
28
- * @var array
29
- */
30
- protected $_extensions = null;
31
-
32
- /**
33
- * @var string
34
- */
35
- protected $_selectedCategories = null;
36
-
37
- protected function _construct()
38
- {
39
- $this->_init('lanot_easybanner/banner');
40
- }
41
-
42
- /**
43
- * @return Lanot_EasyBanner_Helper_Data
44
- */
45
- protected function _getHelper()
46
- {
47
- return Mage::helper('lanot_easybanner');
48
- }
49
-
50
- /**
51
- * @return array
52
- */
53
- public function getAvailableStatuses()
54
- {
55
- return array(
56
- self::STATUS_ENABLED => $this->_getHelper()->__('Enabled'),
57
- self::STATUS_DISABLED => $this->_getHelper()->__('Disabled'),
58
- );
59
- }
60
-
61
- /**
62
- * @return int
63
- */
64
- public function getStatusDisabled()
65
- {
66
- return self::STATUS_DISABLED;
67
- }
68
-
69
- /**
70
- * @return int
71
- */
72
- public function getStatusEnabled()
73
- {
74
- return self::STATUS_ENABLED;
75
- }
76
-
77
- /**
78
- * @return array
79
- */
80
- public function getAllowedExtensionsAndTypes()
81
- {
82
- $this->prepareExtensions();
83
- return $this->_extensions;
84
-
85
- }
86
-
87
- /**
88
- * @return array
89
- */
90
- public function getAllowedExtensions()
91
- {
92
- $this->prepareExtensions();
93
- return array_keys($this->_extensions);
94
- }
95
-
96
- /**
97
- * @return array
98
- */
99
- public function prepareExtensions()
100
- {
101
- if ($this->_extensions !== null) {
102
- return $this->_extensions;
103
- }
104
-
105
- $this->_extensions = array();
106
- $node = Mage::getConfig()->getNode('default/lanot_easybanner/extensions/allowed');
107
- if ($node) {
108
- foreach($node->asCanonicalArray() as $type => $exts) {
109
- foreach($exts as $ext => $val) {
110
- $this->_extensions[$ext] = $type;
111
- }
112
- }
113
- }
114
- return $this->_extensions;
115
- }
116
-
117
- /**
118
- * Filesystem directory path of banners
119
- * relatively to media folder
120
- *
121
- * @return string
122
- */
123
- public function getMediaPath()
124
- {
125
- return 'lanot/easybanner';
126
- }
127
-
128
- /**
129
- * Filesystem full directory path of banners
130
- * relatively to media folder
131
- *
132
- * @return string
133
- */
134
- public function getFullMediaPath()
135
- {
136
- return Mage::getBaseDir('media') . '/' . $this->getMediaPath();
137
- }
138
-
139
- /**
140
- * @return string
141
- */
142
- public function getPathUrl()
143
- {
144
- return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) .
145
- $this->getMediaPath() .
146
- $this->getPath();
147
- }
148
-
149
- /**
150
- * @return array
151
- */
152
- public function getSelectedCategories()
153
- {
154
- if (null === $this->_selectedCategories) {
155
- $this->_selectedCategories = $this->getResource()->getSelectedCategories($this);
156
-
157
- }
158
- return $this->_selectedCategories;
159
- }
160
-
161
- /**
162
- * @return Lanot_EasyBanner_Model_Banner
163
- */
164
- protected function _beforeSave()
165
- {
166
- parent::_beforeSave();
167
-
168
- if ($this->isObjectNew()) {
169
- $this->setData('created_at', Varien_Date::now());
170
- }
171
- $this->setData('updated_at', Varien_Date::now());
172
-
173
- $this->_prepareFileInfo();
174
- $this->_prepareCategories();
175
-
176
- return $this;
177
- }
178
-
179
- /**
180
- * @param $key
181
- * @return null
182
- */
183
- protected function _uploadFile($key)
184
- {
185
- $file = null;
186
- if(empty($_FILES[$key]['name'])) {
187
- return null;
188
- }
189
- try {
190
- //prepare uploader to upload
191
- $uploader = new Varien_File_Uploader($key);
192
- $uploader->setAllowedExtensions($this->getAllowedExtensions());
193
- $uploader->setAllowCreateFolders(true);
194
- $uploader->setAllowRenameFiles(true);
195
- $uploader->setFilesDispersion(true);
196
- // save the image to path
197
- $result = $uploader->save($this->getFullMediaPath());
198
- if (isset($result['file'])) {
199
- $file = $result['file'];
200
- }
201
- } catch (Exception $e) {
202
- Mage::logException($e);
203
- Mage::throwException($e);
204
- }
205
- return $file;
206
- }
207
-
208
- /**
209
- * @param $file
210
- * @return bool
211
- */
212
- protected function _deleteFile($file)
213
- {
214
- $filename = $this->getFullMediaPath() . $file;
215
- $io = new Varien_Io_File();
216
- if ($io->fileExists($filename)) {
217
- return $io->rm($filename);
218
- }
219
- return false;
220
- }
221
-
222
- /**
223
- * @param $path
224
- * @return mixed
225
- */
226
- protected function _getExtension($path)
227
- {
228
- return pathinfo($path, PATHINFO_EXTENSION);
229
- }
230
-
231
- /**
232
- * @return Lanot_EasyBanner_Model_Banner
233
- */
234
- protected function _prepareFileInfo()
235
- {
236
- //upload file
237
- $fileData = $this->getBannerFile();
238
- $isPathDeleted = (is_array($fileData) && !empty($fileData['delete']));
239
- if ($isPathDeleted) {
240
- $this->_deleteFile($this->getPath());
241
- $this->setPath(null);
242
- $this->setType(null);
243
- } elseif (!empty($_FILES['banner_file']['name'])){
244
- $oldPath = $this->getPath();
245
-
246
- $path = $this->_uploadFile('banner_file');
247
- $this->setPath($path);
248
-
249
- $ext = $this->_getExtension($path);
250
- $extByType = $this->getAllowedExtensionsAndTypes();
251
- $type = null;
252
- if ($ext && !empty($extByType[$ext])) {
253
- $type = $extByType[$ext];
254
- }
255
- $this->setType($type);
256
-
257
- if (null !== $oldPath) {
258
- $this->_deleteFile($oldPath);
259
- }
260
- }
261
- return $this;
262
- }
263
-
264
- /**
265
- * @return Lanot_EasyBanner_Model_Banner
266
- */
267
- protected function _prepareCategories()
268
- {
269
- $categories = $this->getCategories();
270
- if (is_string($categories) && !empty($categories)) {
271
- $this->setCategories(Mage::helper('adminhtml/js')->decodeGridSerializedInput($categories));
272
- } elseif (null !== $categories) {
273
- $this->setCategories(array());
274
- }
275
- return $this;
276
- }
277
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Lanot_EasyBanner_Model_Banner
22
+ extends Mage_Core_Model_Abstract
23
+ {
24
+ const STATUS_ENABLED = 1;
25
+ const STATUS_DISABLED = 0;
26
+
27
+ /**
28
+ * @var array
29
+ */
30
+ protected $_extensions = null;
31
+
32
+ /**
33
+ * @var string
34
+ */
35
+ protected $_selectedCategories = null;
36
+
37
+ protected function _construct()
38
+ {
39
+ $this->_init('lanot_easybanner/banner');
40
+ }
41
+
42
+ /**
43
+ * @return Lanot_EasyBanner_Helper_Data
44
+ */
45
+ protected function _getHelper()
46
+ {
47
+ return Mage::helper('lanot_easybanner');
48
+ }
49
+
50
+ /**
51
+ * @return array
52
+ */
53
+ public function getAvailableStatuses()
54
+ {
55
+ return array(
56
+ self::STATUS_ENABLED => $this->_getHelper()->__('Enabled'),
57
+ self::STATUS_DISABLED => $this->_getHelper()->__('Disabled'),
58
+ );
59
+ }
60
+
61
+ /**
62
+ * @return int
63
+ */
64
+ public function getStatusDisabled()
65
+ {
66
+ return self::STATUS_DISABLED;
67
+ }
68
+
69
+ /**
70
+ * @return int
71
+ */
72
+ public function getStatusEnabled()
73
+ {
74
+ return self::STATUS_ENABLED;
75
+ }
76
+
77
+ /**
78
+ * @return array
79
+ */
80
+ public function getAllowedExtensionsAndTypes()
81
+ {
82
+ $this->prepareExtensions();
83
+ return $this->_extensions;
84
+
85
+ }
86
+
87
+ /**
88
+ * @return array
89
+ */
90
+ public function getAllowedExtensions()
91
+ {
92
+ $this->prepareExtensions();
93
+ return array_keys($this->_extensions);
94
+ }
95
+
96
+ /**
97
+ * @return array
98
+ */
99
+ public function prepareExtensions()
100
+ {
101
+ if ($this->_extensions !== null) {
102
+ return $this->_extensions;
103
+ }
104
+
105
+ $this->_extensions = array();
106
+ $node = Mage::getConfig()->getNode('default/lanot_easybanner/extensions/allowed');
107
+ if ($node) {
108
+ foreach($node->asCanonicalArray() as $type => $exts) {
109
+ foreach($exts as $ext => $val) {
110
+ $this->_extensions[$ext] = $type;
111
+ }
112
+ }
113
+ }
114
+ return $this->_extensions;
115
+ }
116
+
117
+ /**
118
+ * Filesystem directory path of banners
119
+ * relatively to media folder
120
+ *
121
+ * @return string
122
+ */
123
+ public function getMediaPath()
124
+ {
125
+ return 'lanot/easybanner';
126
+ }
127
+
128
+ /**
129
+ * Filesystem full directory path of banners
130
+ * relatively to media folder
131
+ *
132
+ * @return string
133
+ */
134
+ public function getFullMediaPath()
135
+ {
136
+ return Mage::getBaseDir('media') . '/' . $this->getMediaPath();
137
+ }
138
+
139
+ /**
140
+ * @return string
141
+ */
142
+ public function getPathUrl()
143
+ {
144
+ return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) .
145
+ $this->getMediaPath() .
146
+ $this->getPath();
147
+ }
148
+
149
+ /**
150
+ * @return array
151
+ */
152
+ public function getSelectedCategories()
153
+ {
154
+ if (null === $this->_selectedCategories) {
155
+ $this->_selectedCategories = $this->getResource()->getSelectedCategories($this);
156
+
157
+ }
158
+ return $this->_selectedCategories;
159
+ }
160
+
161
+ /**
162
+ * @return Lanot_EasyBanner_Model_Banner
163
+ */
164
+ protected function _beforeSave()
165
+ {
166
+ parent::_beforeSave();
167
+
168
+ if ($this->isObjectNew()) {
169
+ $this->setData('created_at', Varien_Date::now());
170
+ }
171
+ $this->setData('updated_at', Varien_Date::now());
172
+
173
+ $this->_prepareFileInfo();
174
+ $this->_prepareCategories();
175
+
176
+ return $this;
177
+ }
178
+
179
+ /**
180
+ * @param $key
181
+ * @return null
182
+ */
183
+ protected function _uploadFile($key)
184
+ {
185
+ $file = null;
186
+ if(empty($_FILES[$key]['name'])) {
187
+ return null;
188
+ }
189
+ try {
190
+ //prepare uploader to upload
191
+ $uploader = new Varien_File_Uploader($key);
192
+ $uploader->setAllowedExtensions($this->getAllowedExtensions());
193
+ $uploader->setAllowCreateFolders(true);
194
+ $uploader->setAllowRenameFiles(true);
195
+ $uploader->setFilesDispersion(true);
196
+ // save the image to path
197
+ $result = $uploader->save($this->getFullMediaPath());
198
+ if (isset($result['file'])) {
199
+ $file = $result['file'];
200
+ }
201
+ } catch (Exception $e) {
202
+ Mage::logException($e);
203
+ Mage::throwException($e);
204
+ }
205
+ return $file;
206
+ }
207
+
208
+ /**
209
+ * @param $file
210
+ * @return bool
211
+ */
212
+ protected function _deleteFile($file)
213
+ {
214
+ $filename = $this->getFullMediaPath() . $file;
215
+ $io = new Varien_Io_File();
216
+ if ($io->fileExists($filename)) {
217
+ return $io->rm($filename);
218
+ }
219
+ return false;
220
+ }
221
+
222
+ /**
223
+ * @param $path
224
+ * @return mixed
225
+ */
226
+ protected function _getExtension($path)
227
+ {
228
+ return pathinfo($path, PATHINFO_EXTENSION);
229
+ }
230
+
231
+ /**
232
+ * @return Lanot_EasyBanner_Model_Banner
233
+ */
234
+ protected function _prepareFileInfo()
235
+ {
236
+ //upload file
237
+ $fileData = $this->getBannerFile();
238
+ $isPathDeleted = (is_array($fileData) && !empty($fileData['delete']));
239
+ if ($isPathDeleted) {
240
+ $this->_deleteFile($this->getPath());
241
+ $this->setPath(null);
242
+ $this->setType(null);
243
+ } elseif (!empty($_FILES['banner_file']['name'])){
244
+ $oldPath = $this->getPath();
245
+
246
+ $path = $this->_uploadFile('banner_file');
247
+ $this->setPath($path);
248
+
249
+ $ext = $this->_getExtension($path);
250
+ $extByType = $this->getAllowedExtensionsAndTypes();
251
+ $type = null;
252
+ if ($ext && !empty($extByType[$ext])) {
253
+ $type = $extByType[$ext];
254
+ }
255
+ $this->setType($type);
256
+
257
+ if (null !== $oldPath) {
258
+ $this->_deleteFile($oldPath);
259
+ }
260
+ }
261
+ return $this;
262
+ }
263
+
264
+ /**
265
+ * @return Lanot_EasyBanner_Model_Banner
266
+ */
267
+ protected function _prepareCategories()
268
+ {
269
+ $categories = $this->getCategories();
270
+ if (is_string($categories) && !empty($categories)) {
271
+ $this->setCategories(Mage::helper('adminhtml/js')->decodeGridSerializedInput($categories));
272
+ } elseif (null !== $categories) {
273
+ $this->setCategories(array());
274
+ }
275
+ return $this;
276
+ }
277
+ }
app/code/community/Lanot/EasyBanner/Model/Category.php CHANGED
@@ -1,141 +1,141 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- class Lanot_EasyBanner_Model_Category extends Mage_Core_Model_Abstract
22
- {
23
- const STATUS_ENABLED = 1;
24
- const STATUS_DISABLED = 0;
25
-
26
- /**
27
- * @var string
28
- */
29
- protected $_selectedBanners = null;
30
-
31
- /**
32
- *
33
- */
34
- protected function _construct()
35
- {
36
- $this->_init('lanot_easybanner/category');
37
- }
38
-
39
- /**
40
- * @return Lanot_EasyBanner_Helper_Data
41
- */
42
- protected function _getHelper()
43
- {
44
- return Mage::helper('lanot_easybanner');
45
- }
46
-
47
- /**
48
- * @return array
49
- */
50
- public function getAvailableStatuses()
51
- {
52
- return array(
53
- self::STATUS_ENABLED => $this->_getHelper()->__('Enabled'),
54
- self::STATUS_DISABLED => $this->_getHelper()->__('Disabled'),
55
- );
56
- }
57
-
58
- /**
59
- * @return int
60
- */
61
- public function getStatusDisabled()
62
- {
63
- return self::STATUS_DISABLED;
64
- }
65
-
66
- /**
67
- * @return int
68
- */
69
- public function getStatusEnabled()
70
- {
71
- return self::STATUS_ENABLED;
72
- }
73
-
74
- /**
75
- * @param bool $addEmpty
76
- * @return array
77
- */
78
- public function toOptionArray($addEmpty = true)
79
- {
80
- /** @var $collection Lanot_EasyBanner_Model_Mysql4_Category_Collection */
81
- $collection = $this->getCollection();
82
- $options = array();
83
- if ($addEmpty) {
84
- $options[] = array(
85
- 'label' => $this->_getHelper()->__('-- Please Select a Category --'),
86
- 'value' => ''
87
- );
88
- }
89
- foreach ($collection as $category) {
90
- $options[] = array(
91
- 'label' => $category->getTitle(),
92
- 'value' => $category->getId()
93
- );
94
- }
95
-
96
- return $options;
97
- }
98
-
99
- /**
100
- * @return Lanot_EasyBanner_Model_Category
101
- */
102
- protected function _beforeSave()
103
- {
104
- parent::_beforeSave();
105
-
106
- if ($this->isObjectNew()) {
107
- $this->setData('created_at', Varien_Date::now());
108
- }
109
- $this->setData('updated_at', Varien_Date::now());
110
- $this->_prepareBanners();
111
-
112
- return $this;
113
- }
114
-
115
- /**
116
- * @return array
117
- */
118
- public function getSelectedBanners()
119
- {
120
- if (null === $this->_selectedBanners) {
121
- $this->_selectedBanners = $this->getResource()->getSelectedBanners($this);
122
-
123
- }
124
- return $this->_selectedBanners;
125
- }
126
-
127
- /**
128
- * @return Lanot_EasyBanner_Model_Category
129
- */
130
- protected function _prepareBanners()
131
- {
132
- $banners = $this->getBanners();
133
- if (is_string($banners) && !empty($banners)) {
134
- $this->setBanners(Mage::helper('adminhtml/js')->decodeGridSerializedInput($banners));
135
- } elseif (null !== $banners) {
136
- $this->setBanners(array());
137
- }
138
- return $this;
139
- }
140
- }
141
-
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Lanot_EasyBanner_Model_Category extends Mage_Core_Model_Abstract
22
+ {
23
+ const STATUS_ENABLED = 1;
24
+ const STATUS_DISABLED = 0;
25
+
26
+ /**
27
+ * @var string
28
+ */
29
+ protected $_selectedBanners = null;
30
+
31
+ /**
32
+ *
33
+ */
34
+ protected function _construct()
35
+ {
36
+ $this->_init('lanot_easybanner/category');
37
+ }
38
+
39
+ /**
40
+ * @return Lanot_EasyBanner_Helper_Data
41
+ */
42
+ protected function _getHelper()
43
+ {
44
+ return Mage::helper('lanot_easybanner');
45
+ }
46
+
47
+ /**
48
+ * @return array
49
+ */
50
+ public function getAvailableStatuses()
51
+ {
52
+ return array(
53
+ self::STATUS_ENABLED => $this->_getHelper()->__('Enabled'),
54
+ self::STATUS_DISABLED => $this->_getHelper()->__('Disabled'),
55
+ );
56
+ }
57
+
58
+ /**
59
+ * @return int
60
+ */
61
+ public function getStatusDisabled()
62
+ {
63
+ return self::STATUS_DISABLED;
64
+ }
65
+
66
+ /**
67
+ * @return int
68
+ */
69
+ public function getStatusEnabled()
70
+ {
71
+ return self::STATUS_ENABLED;
72
+ }
73
+
74
+ /**
75
+ * @param bool $addEmpty
76
+ * @return array
77
+ */
78
+ public function toOptionArray($addEmpty = true)
79
+ {
80
+ /** @var $collection Lanot_EasyBanner_Model_Mysql4_Category_Collection */
81
+ $collection = $this->getCollection();
82
+ $options = array();
83
+ if ($addEmpty) {
84
+ $options[] = array(
85
+ 'label' => $this->_getHelper()->__('-- Please Select a Category --'),
86
+ 'value' => ''
87
+ );
88
+ }
89
+ foreach ($collection as $category) {
90
+ $options[] = array(
91
+ 'label' => $category->getTitle(),
92
+ 'value' => $category->getId()
93
+ );
94
+ }
95
+
96
+ return $options;
97
+ }
98
+
99
+ /**
100
+ * @return Lanot_EasyBanner_Model_Category
101
+ */
102
+ protected function _beforeSave()
103
+ {
104
+ parent::_beforeSave();
105
+
106
+ if ($this->isObjectNew()) {
107
+ $this->setData('created_at', Varien_Date::now());
108
+ }
109
+ $this->setData('updated_at', Varien_Date::now());
110
+ $this->_prepareBanners();
111
+
112
+ return $this;
113
+ }
114
+
115
+ /**
116
+ * @return array
117
+ */
118
+ public function getSelectedBanners()
119
+ {
120
+ if (null === $this->_selectedBanners) {
121
+ $this->_selectedBanners = $this->getResource()->getSelectedBanners($this);
122
+
123
+ }
124
+ return $this->_selectedBanners;
125
+ }
126
+
127
+ /**
128
+ * @return Lanot_EasyBanner_Model_Category
129
+ */
130
+ protected function _prepareBanners()
131
+ {
132
+ $banners = $this->getBanners();
133
+ if (is_string($banners) && !empty($banners)) {
134
+ $this->setBanners(Mage::helper('adminhtml/js')->decodeGridSerializedInput($banners));
135
+ } elseif (null !== $banners) {
136
+ $this->setBanners(array());
137
+ }
138
+ return $this;
139
+ }
140
+ }
141
+
app/code/community/Lanot/EasyBanner/Model/Mysql4/Banner.php CHANGED
@@ -1,129 +1,129 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Banner item resource model
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Model_Mysql4_Banner
27
- extends Mage_Core_Model_Mysql4_Abstract
28
- {
29
- /**
30
- * Initialize connection and define main table and primary key
31
- */
32
- protected function _construct()
33
- {
34
- $this->_init('lanot_easybanner/banner', 'banner_id');
35
- }
36
-
37
- /**
38
- * @param Mage_Core_Model_Abstract $object
39
- * @return Mage_Core_Model_Resource_Db_Abstract
40
- */
41
- protected function _afterSave(Mage_Core_Model_Abstract $object)
42
- {
43
- $this->_saveCategories($object);
44
-
45
- return $this;
46
- }
47
-
48
- /**
49
- * @return string
50
- */
51
- protected function _getLinkTable()
52
- {
53
- return $this->getTable('lanot_easybanner/banner_category');
54
- }
55
-
56
- /**
57
- * @param Mage_Core_Model_Abstract $object
58
- * @return array
59
- */
60
- public function getSelectedCategories(Mage_Core_Model_Abstract $object)
61
- {
62
- $select = $this->getReadConnection()
63
- ->select()
64
- ->from($this->_getLinkTable(), array('category_id'))
65
- ->where('banner_id=?', $object->getId());
66
-
67
- return $this->getReadConnection()->fetchCol($select);
68
- }
69
-
70
-
71
- /**
72
- * @param Mage_Core_Model_Abstract $object
73
- * @return Lanot_EasyBanner_Model_Mysql4_Banner
74
- */
75
- protected function _saveCategories(Mage_Core_Model_Abstract $object)
76
- {
77
- //there is no any changes
78
- if (null === $object->getCategories()) {
79
- return $this;
80
- }
81
-
82
- $oldCategories = $object->getSelectedCategories($object);
83
- $newCategories = $object->getCategories();
84
-
85
- $insertCategories = array_diff($newCategories, $oldCategories);
86
- $deleteCategories = array_diff($oldCategories, $newCategories);
87
-
88
- if (!empty($insertCategories)) {
89
- $this->_insertCategories($object, $insertCategories);
90
- }
91
- if (!empty($deleteCategories)) {
92
- $this->_deleteCategories($object, $deleteCategories);
93
- }
94
-
95
- return $this;
96
- }
97
-
98
- /**
99
- * @param Mage_Core_Model_Abstract $object
100
- * @param array $categoryIds
101
- * @return Lanot_EasyBanner_Model_Mysql4_Banner
102
- */
103
- protected function _insertCategories(Mage_Core_Model_Abstract $object, array $categoryIds)
104
- {
105
- $data = array();
106
- foreach($categoryIds as $categoryId) {
107
- $data[] = array('banner_id' => $object->getId(), 'category_id' => $categoryId);
108
- }
109
-
110
- $this->_getWriteAdapter()->insertArray($this->_getLinkTable(), array('banner_id', 'category_id'), $data);
111
-
112
- return $this;
113
- }
114
-
115
- /**
116
- * @param Mage_Core_Model_Abstract $object
117
- * @param array $categoryIds
118
- * @return Lanot_EasyBanner_Model_Mysql4_Banner
119
- */
120
- protected function _deleteCategories(Mage_Core_Model_Abstract $object, array $categoryIds)
121
- {
122
- $where = $this->_getWriteAdapter()->quoteInto('banner_id = ?', $object->getId());
123
- $where.= $this->_getWriteAdapter()->quoteInto(' AND category_id IN (?)', $categoryIds);
124
- $this->_getWriteAdapter()->delete($this->_getLinkTable(), $where);
125
-
126
- return $this;
127
- }
128
- }
129
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Banner item resource model
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Model_Mysql4_Banner
27
+ extends Mage_Core_Model_Mysql4_Abstract
28
+ {
29
+ /**
30
+ * Initialize connection and define main table and primary key
31
+ */
32
+ protected function _construct()
33
+ {
34
+ $this->_init('lanot_easybanner/banner', 'banner_id');
35
+ }
36
+
37
+ /**
38
+ * @param Mage_Core_Model_Abstract $object
39
+ * @return Mage_Core_Model_Resource_Db_Abstract
40
+ */
41
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
42
+ {
43
+ $this->_saveCategories($object);
44
+
45
+ return $this;
46
+ }
47
+
48
+ /**
49
+ * @return string
50
+ */
51
+ protected function _getLinkTable()
52
+ {
53
+ return $this->getTable('lanot_easybanner/banner_category');
54
+ }
55
+
56
+ /**
57
+ * @param Mage_Core_Model_Abstract $object
58
+ * @return array
59
+ */
60
+ public function getSelectedCategories(Mage_Core_Model_Abstract $object)
61
+ {
62
+ $select = $this->getReadConnection()
63
+ ->select()
64
+ ->from($this->_getLinkTable(), array('category_id'))
65
+ ->where('banner_id=?', $object->getId());
66
+
67
+ return $this->getReadConnection()->fetchCol($select);
68
+ }
69
+
70
+
71
+ /**
72
+ * @param Mage_Core_Model_Abstract $object
73
+ * @return Lanot_EasyBanner_Model_Mysql4_Banner
74
+ */
75
+ protected function _saveCategories(Mage_Core_Model_Abstract $object)
76
+ {
77
+ //there is no any changes
78
+ if (null === $object->getCategories()) {
79
+ return $this;
80
+ }
81
+
82
+ $oldCategories = $object->getSelectedCategories($object);
83
+ $newCategories = $object->getCategories();
84
+
85
+ $insertCategories = array_diff($newCategories, $oldCategories);
86
+ $deleteCategories = array_diff($oldCategories, $newCategories);
87
+
88
+ if (!empty($insertCategories)) {
89
+ $this->_insertCategories($object, $insertCategories);
90
+ }
91
+ if (!empty($deleteCategories)) {
92
+ $this->_deleteCategories($object, $deleteCategories);
93
+ }
94
+
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * @param Mage_Core_Model_Abstract $object
100
+ * @param array $categoryIds
101
+ * @return Lanot_EasyBanner_Model_Mysql4_Banner
102
+ */
103
+ protected function _insertCategories(Mage_Core_Model_Abstract $object, array $categoryIds)
104
+ {
105
+ $data = array();
106
+ foreach($categoryIds as $categoryId) {
107
+ $data[] = array('banner_id' => $object->getId(), 'category_id' => $categoryId);
108
+ }
109
+
110
+ $this->_getWriteAdapter()->insertArray($this->_getLinkTable(), array('banner_id', 'category_id'), $data);
111
+
112
+ return $this;
113
+ }
114
+
115
+ /**
116
+ * @param Mage_Core_Model_Abstract $object
117
+ * @param array $categoryIds
118
+ * @return Lanot_EasyBanner_Model_Mysql4_Banner
119
+ */
120
+ protected function _deleteCategories(Mage_Core_Model_Abstract $object, array $categoryIds)
121
+ {
122
+ $where = $this->_getWriteAdapter()->quoteInto('banner_id = ?', $object->getId());
123
+ $where.= $this->_getWriteAdapter()->quoteInto(' AND category_id IN (?)', $categoryIds);
124
+ $this->_getWriteAdapter()->delete($this->_getLinkTable(), $where);
125
+
126
+ return $this;
127
+ }
128
+ }
129
 
app/code/community/Lanot/EasyBanner/Model/Mysql4/Banner/Collection.php CHANGED
@@ -1,83 +1,83 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Banners collection
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Model_Mysql4_Banner_Collection
27
- extends Mage_Core_Model_Mysql4_Collection_Abstract
28
- {
29
- /**
30
- * Define collection model
31
- */
32
- protected function _construct()
33
- {
34
- $this->_init('lanot_easybanner/banner');
35
- }
36
-
37
- /**
38
- * @return Lanot_EasyBanner_Model_Mysql4_Banner_Collection
39
- */
40
- public function useCategory($categoryId)
41
- {
42
- $this->join(array('bc' => 'lanot_easybanner/banner_category'),
43
- 'main_table.banner_id=bc.banner_id AND bc.category_id = ' . (int) $categoryId, array());
44
-
45
- $this->join(array('c' => 'lanot_easybanner/category'),
46
- 'c.category_id = bc.category_id AND c.is_active = ' .
47
- (int) Lanot_EasyBanner_Model_Category::STATUS_ENABLED, array());
48
-
49
- return $this;
50
- }
51
-
52
- /**
53
- * @return Lanot_EasyBanner_Model_Mysql4_Banner_Collection
54
- */
55
- public function useRandom()
56
- {
57
- $this->getSelect()->order(new Zend_Db_Expr('RAND()'));
58
-
59
- return $this;
60
- }
61
-
62
- /**
63
- * @return Lanot_EasyBanner_Model_Mysql4_Banner_Collection
64
- */
65
- public function useLast()
66
- {
67
- $this->setOrder('main_table.banner_id','DESC');
68
-
69
- return $this;
70
- }
71
-
72
- /**
73
- * @return Lanot_EasyBanner_Model_Mysql4_Banner_Collection
74
- */
75
- public function useActive()
76
- {
77
- $this->addFilter('main_table.is_active',
78
- Lanot_EasyBanner_Model_Banner::STATUS_ENABLED);
79
-
80
- return $this;
81
- }
82
- }
83
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Banners collection
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Model_Mysql4_Banner_Collection
27
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
28
+ {
29
+ /**
30
+ * Define collection model
31
+ */
32
+ protected function _construct()
33
+ {
34
+ $this->_init('lanot_easybanner/banner');
35
+ }
36
+
37
+ /**
38
+ * @return Lanot_EasyBanner_Model_Mysql4_Banner_Collection
39
+ */
40
+ public function useCategory($categoryId)
41
+ {
42
+ $this->join(array('bc' => 'lanot_easybanner/banner_category'),
43
+ 'main_table.banner_id=bc.banner_id AND bc.category_id = ' . (int) $categoryId, array());
44
+
45
+ $this->join(array('c' => 'lanot_easybanner/category'),
46
+ 'c.category_id = bc.category_id AND c.is_active = ' .
47
+ (int) Lanot_EasyBanner_Model_Category::STATUS_ENABLED, array());
48
+
49
+ return $this;
50
+ }
51
+
52
+ /**
53
+ * @return Lanot_EasyBanner_Model_Mysql4_Banner_Collection
54
+ */
55
+ public function useRandom()
56
+ {
57
+ $this->getSelect()->order(new Zend_Db_Expr('RAND()'));
58
+
59
+ return $this;
60
+ }
61
+
62
+ /**
63
+ * @return Lanot_EasyBanner_Model_Mysql4_Banner_Collection
64
+ */
65
+ public function useLast()
66
+ {
67
+ $this->setOrder('main_table.banner_id','DESC');
68
+
69
+ return $this;
70
+ }
71
+
72
+ /**
73
+ * @return Lanot_EasyBanner_Model_Mysql4_Banner_Collection
74
+ */
75
+ public function useActive()
76
+ {
77
+ $this->addFilter('main_table.is_active',
78
+ Lanot_EasyBanner_Model_Banner::STATUS_ENABLED);
79
+
80
+ return $this;
81
+ }
82
+ }
83
 
app/code/community/Lanot/EasyBanner/Model/Mysql4/Category.php CHANGED
@@ -1,130 +1,130 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Banner Category item resource model
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Model_Mysql4_Category
27
- //extends Mage_Core_Model_Resource_Db_Abstract
28
- extends Mage_Core_Model_Mysql4_Abstract
29
- {
30
- /**
31
- * Initialize connection and define main table and primary key
32
- */
33
- protected function _construct()
34
- {
35
- $this->_init('lanot_easybanner/category', 'category_id');
36
- }
37
-
38
- /**
39
- * @param Mage_Core_Model_Abstract $object
40
- * @return Mage_Core_Model_Resource_Db_Abstract
41
- */
42
- protected function _afterSave(Mage_Core_Model_Abstract $object)
43
- {
44
- $this->_saveBanners($object);
45
-
46
- return $this;
47
- }
48
-
49
- /**
50
- * @return string
51
- */
52
- protected function _getLinkTable()
53
- {
54
- return $this->getTable('lanot_easybanner/banner_category');
55
- }
56
-
57
- /**
58
- * @param Mage_Core_Model_Abstract $object
59
- * @return array
60
- */
61
- public function getSelectedBanners(Mage_Core_Model_Abstract $object)
62
- {
63
- $select = $this->getReadConnection()
64
- ->select()
65
- ->from($this->_getLinkTable(), array('banner_id'))
66
- ->where('category_id=?', $object->getId());
67
-
68
- return $this->getReadConnection()->fetchCol($select);
69
- }
70
-
71
- /**
72
- * @param Mage_Core_Model_Abstract $object
73
- * @return Lanot_EasyBanner_Model_Mysql4_Banner
74
- */
75
- protected function _saveBanners(Mage_Core_Model_Abstract $object)
76
- {
77
- //there is no any changes
78
- if (null === $object->getBanners()) {
79
- return $this;
80
- }
81
-
82
- $oldBanners = $object->getSelectedBanners($object);
83
- $newBanners = $object->getBanners();
84
-
85
- $insertBanners = array_diff($newBanners, $oldBanners);
86
- $deleteBanners = array_diff($oldBanners, $newBanners);
87
-
88
- if (!empty($insertBanners)) {
89
- $this->_insertBanners($object, $insertBanners);
90
- }
91
- if (!empty($deleteBanners)) {
92
- $this->_deleteBanners($object, $deleteBanners);
93
- }
94
-
95
- return $this;
96
- }
97
-
98
- /**
99
- * @param Mage_Core_Model_Abstract $object
100
- * @param array $bannerIds
101
- * @return Lanot_EasyBanner_Model_Mysql4_Banner
102
- */
103
- protected function _insertBanners(Mage_Core_Model_Abstract $object, array $bannerIds)
104
- {
105
- $data = array();
106
- foreach($bannerIds as $bannerId) {
107
- $data[] = array('banner_id' => $bannerId, 'category_id' => $object->getId());
108
- }
109
-
110
- $this->_getWriteAdapter()->insertArray($this->_getLinkTable(), array('banner_id', 'category_id'), $data);
111
-
112
- return $this;
113
- }
114
-
115
- /**
116
- * @param Mage_Core_Model_Abstract $object
117
- * @param array $bannerIds
118
- * @return Lanot_EasyBanner_Model_Mysql4_Banner
119
- */
120
- protected function _deleteBanners(Mage_Core_Model_Abstract $object, array $bannerIds)
121
- {
122
- $where = $this->_getWriteAdapter()->quoteInto('category_id = ?', $object->getId());
123
- $where.= $this->_getWriteAdapter()->quoteInto(' AND banner_id IN (?)', $bannerIds);
124
- $this->_getWriteAdapter()->delete($this->_getLinkTable(), $where);
125
-
126
- return $this;
127
- }
128
-
129
- }
130
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Banner Category item resource model
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Model_Mysql4_Category
27
+ //extends Mage_Core_Model_Resource_Db_Abstract
28
+ extends Mage_Core_Model_Mysql4_Abstract
29
+ {
30
+ /**
31
+ * Initialize connection and define main table and primary key
32
+ */
33
+ protected function _construct()
34
+ {
35
+ $this->_init('lanot_easybanner/category', 'category_id');
36
+ }
37
+
38
+ /**
39
+ * @param Mage_Core_Model_Abstract $object
40
+ * @return Mage_Core_Model_Resource_Db_Abstract
41
+ */
42
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
43
+ {
44
+ $this->_saveBanners($object);
45
+
46
+ return $this;
47
+ }
48
+
49
+ /**
50
+ * @return string
51
+ */
52
+ protected function _getLinkTable()
53
+ {
54
+ return $this->getTable('lanot_easybanner/banner_category');
55
+ }
56
+
57
+ /**
58
+ * @param Mage_Core_Model_Abstract $object
59
+ * @return array
60
+ */
61
+ public function getSelectedBanners(Mage_Core_Model_Abstract $object)
62
+ {
63
+ $select = $this->getReadConnection()
64
+ ->select()
65
+ ->from($this->_getLinkTable(), array('banner_id'))
66
+ ->where('category_id=?', $object->getId());
67
+
68
+ return $this->getReadConnection()->fetchCol($select);
69
+ }
70
+
71
+ /**
72
+ * @param Mage_Core_Model_Abstract $object
73
+ * @return Lanot_EasyBanner_Model_Mysql4_Banner
74
+ */
75
+ protected function _saveBanners(Mage_Core_Model_Abstract $object)
76
+ {
77
+ //there is no any changes
78
+ if (null === $object->getBanners()) {
79
+ return $this;
80
+ }
81
+
82
+ $oldBanners = $object->getSelectedBanners($object);
83
+ $newBanners = $object->getBanners();
84
+
85
+ $insertBanners = array_diff($newBanners, $oldBanners);
86
+ $deleteBanners = array_diff($oldBanners, $newBanners);
87
+
88
+ if (!empty($insertBanners)) {
89
+ $this->_insertBanners($object, $insertBanners);
90
+ }
91
+ if (!empty($deleteBanners)) {
92
+ $this->_deleteBanners($object, $deleteBanners);
93
+ }
94
+
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * @param Mage_Core_Model_Abstract $object
100
+ * @param array $bannerIds
101
+ * @return Lanot_EasyBanner_Model_Mysql4_Banner
102
+ */
103
+ protected function _insertBanners(Mage_Core_Model_Abstract $object, array $bannerIds)
104
+ {
105
+ $data = array();
106
+ foreach($bannerIds as $bannerId) {
107
+ $data[] = array('banner_id' => $bannerId, 'category_id' => $object->getId());
108
+ }
109
+
110
+ $this->_getWriteAdapter()->insertArray($this->_getLinkTable(), array('banner_id', 'category_id'), $data);
111
+
112
+ return $this;
113
+ }
114
+
115
+ /**
116
+ * @param Mage_Core_Model_Abstract $object
117
+ * @param array $bannerIds
118
+ * @return Lanot_EasyBanner_Model_Mysql4_Banner
119
+ */
120
+ protected function _deleteBanners(Mage_Core_Model_Abstract $object, array $bannerIds)
121
+ {
122
+ $where = $this->_getWriteAdapter()->quoteInto('category_id = ?', $object->getId());
123
+ $where.= $this->_getWriteAdapter()->quoteInto(' AND banner_id IN (?)', $bannerIds);
124
+ $this->_getWriteAdapter()->delete($this->_getLinkTable(), $where);
125
+
126
+ return $this;
127
+ }
128
+
129
+ }
130
 
app/code/community/Lanot/EasyBanner/Model/Mysql4/Category/Collection.php CHANGED
@@ -1,38 +1,38 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Banners collection
23
- *
24
- * @author Lanot
25
- */
26
- class Lanot_EasyBanner_Model_Mysql4_Category_Collection
27
- extends Mage_Core_Model_Mysql4_Collection_Abstract
28
- {
29
- /**
30
- * Define collection model
31
- */
32
- protected function _construct()
33
- {
34
- $this->_init('lanot_easybanner/category');
35
- }
36
- }
37
-
38
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Banners collection
23
+ *
24
+ * @author Lanot
25
+ */
26
+ class Lanot_EasyBanner_Model_Mysql4_Category_Collection
27
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
28
+ {
29
+ /**
30
+ * Define collection model
31
+ */
32
+ protected function _construct()
33
+ {
34
+ $this->_init('lanot_easybanner/category');
35
+ }
36
+ }
37
+
38
 
app/code/community/Lanot/EasyBanner/controllers/Adminhtml/BannerController.php CHANGED
@@ -1,73 +1,73 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- class Lanot_EasyBanner_Adminhtml_BannerController
22
- extends Lanot_EasyBanner_Controller_Adminhtml_AbstractController
23
- {
24
- protected $_msgTitle = 'Banners';
25
- protected $_msgHeader = 'Manage Banners';
26
- protected $_msgItemDoesNotExist = 'The Banner item does not exist.';
27
- protected $_msgItemNotFound = 'Unable to find the category item. #%s';
28
- protected $_msgItemEdit = 'Edit Banner Item';
29
- protected $_msgItemNew = 'New Banner Item';
30
- protected $_msgItemSaved = 'The Banner item has been saved.';
31
- protected $_msgItemDeleted = 'The Banner item has been deleted';
32
- protected $_msgError = 'An error occurred while edit the Banner item. %s';
33
- protected $_msgErrorItems = 'An error occurred while edit the Banner items. %s';
34
- protected $_msgItems = 'The Banner items %s has been';
35
-
36
- protected $_aclSection = 'manage_banner';
37
-
38
- /**
39
- * @return Mage_Core_Model_Abstract
40
- */
41
- protected function _getItemModel()
42
- {
43
- return Mage::getModel('lanot_easybanner/banner');
44
- }
45
-
46
- /**
47
- * @param Mage_Core_Model_Abstract $model
48
- * @return Lanot_EasyBanner_Controller_Adminhtml_AbstractController
49
- */
50
- protected function _registerItem(Mage_Core_Model_Abstract $model)
51
- {
52
- Mage::register('easy.banner.banner.item', $model);
53
- return $this;
54
- }
55
-
56
- /**
57
- * Grid ajax action
58
- */
59
- public function ajaxcategoriesgridAction()
60
- {
61
- $this->loadLayout();
62
- $this->renderLayout();
63
- }
64
-
65
- /**
66
- * Grid ajax action
67
- */
68
- public function ajaxcategoriesgridonlyAction()
69
- {
70
- $this->loadLayout();
71
- $this->renderLayout();
72
- }
73
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Lanot_EasyBanner_Adminhtml_BannerController
22
+ extends Lanot_EasyBanner_Controller_Adminhtml_AbstractController
23
+ {
24
+ protected $_msgTitle = 'Banners';
25
+ protected $_msgHeader = 'Manage Banners';
26
+ protected $_msgItemDoesNotExist = 'The Banner item does not exist.';
27
+ protected $_msgItemNotFound = 'Unable to find the category item. #%s';
28
+ protected $_msgItemEdit = 'Edit Banner Item';
29
+ protected $_msgItemNew = 'New Banner Item';
30
+ protected $_msgItemSaved = 'The Banner item has been saved.';
31
+ protected $_msgItemDeleted = 'The Banner item has been deleted';
32
+ protected $_msgError = 'An error occurred while edit the Banner item. %s';
33
+ protected $_msgErrorItems = 'An error occurred while edit the Banner items. %s';
34
+ protected $_msgItems = 'The Banner items %s has been';
35
+
36
+ protected $_aclSection = 'manage_banner';
37
+
38
+ /**
39
+ * @return Mage_Core_Model_Abstract
40
+ */
41
+ protected function _getItemModel()
42
+ {
43
+ return Mage::getModel('lanot_easybanner/banner');
44
+ }
45
+
46
+ /**
47
+ * @param Mage_Core_Model_Abstract $model
48
+ * @return Lanot_EasyBanner_Controller_Adminhtml_AbstractController
49
+ */
50
+ protected function _registerItem(Mage_Core_Model_Abstract $model)
51
+ {
52
+ Mage::register('easy.banner.banner.item', $model);
53
+ return $this;
54
+ }
55
+
56
+ /**
57
+ * Grid ajax action
58
+ */
59
+ public function ajaxcategoriesgridAction()
60
+ {
61
+ $this->loadLayout();
62
+ $this->renderLayout();
63
+ }
64
+
65
+ /**
66
+ * Grid ajax action
67
+ */
68
+ public function ajaxcategoriesgridonlyAction()
69
+ {
70
+ $this->loadLayout();
71
+ $this->renderLayout();
72
+ }
73
+ }
app/code/community/Lanot/EasyBanner/controllers/Adminhtml/CategoryController.php CHANGED
@@ -1,73 +1,73 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- class Lanot_EasyBanner_Adminhtml_CategoryController
22
- extends Lanot_EasyBanner_Controller_Adminhtml_AbstractController
23
- {
24
- protected $_msgTitle = 'Banners';
25
- protected $_msgHeader = 'Manage Categories';
26
- protected $_msgItemDoesNotExist = 'The Category item does not exist.';
27
- protected $_msgItemNotFound = 'Unable to find the category item. #%s';
28
- protected $_msgItemEdit = 'Edit Category Item';
29
- protected $_msgItemNew = 'New Category Item';
30
- protected $_msgItemSaved = 'The Category item has been saved.';
31
- protected $_msgItemDeleted = 'The Category item has been deleted';
32
- protected $_msgError = 'An error occurred while edit the Category item. %s';
33
- protected $_msgErrorItems = 'An error occurred while edit the Category items. %s';
34
- protected $_msgItems = 'The Category items %s has been';
35
-
36
- protected $_aclSection = 'manage_category';
37
-
38
- /**
39
- * @return Mage_Core_Model_Abstract
40
- */
41
- protected function _getItemModel()
42
- {
43
- return Mage::getModel('lanot_easybanner/category');
44
- }
45
-
46
- /**
47
- * @param Mage_Core_Model_Abstract $model
48
- * @return Lanot_EasyBanner_Controller_Adminhtml_AbstractController
49
- */
50
- protected function _registerItem(Mage_Core_Model_Abstract $model)
51
- {
52
- Mage::register('easy.banner.category.item', $model);
53
- return $this;
54
- }
55
-
56
- /**
57
- * Grid ajax action
58
- */
59
- public function ajaxbannersgridAction()
60
- {
61
- $this->loadLayout();
62
- $this->renderLayout();
63
- }
64
-
65
- /**
66
- * Grid ajax action
67
- */
68
- public function ajaxbannersgridonlyAction()
69
- {
70
- $this->loadLayout();
71
- $this->renderLayout();
72
- }
73
- }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Lanot_EasyBanner_Adminhtml_CategoryController
22
+ extends Lanot_EasyBanner_Controller_Adminhtml_AbstractController
23
+ {
24
+ protected $_msgTitle = 'Banners';
25
+ protected $_msgHeader = 'Manage Categories';
26
+ protected $_msgItemDoesNotExist = 'The Category item does not exist.';
27
+ protected $_msgItemNotFound = 'Unable to find the category item. #%s';
28
+ protected $_msgItemEdit = 'Edit Category Item';
29
+ protected $_msgItemNew = 'New Category Item';
30
+ protected $_msgItemSaved = 'The Category item has been saved.';
31
+ protected $_msgItemDeleted = 'The Category item has been deleted';
32
+ protected $_msgError = 'An error occurred while edit the Category item. %s';
33
+ protected $_msgErrorItems = 'An error occurred while edit the Category items. %s';
34
+ protected $_msgItems = 'The Category items %s has been';
35
+
36
+ protected $_aclSection = 'manage_category';
37
+
38
+ /**
39
+ * @return Mage_Core_Model_Abstract
40
+ */
41
+ protected function _getItemModel()
42
+ {
43
+ return Mage::getModel('lanot_easybanner/category');
44
+ }
45
+
46
+ /**
47
+ * @param Mage_Core_Model_Abstract $model
48
+ * @return Lanot_EasyBanner_Controller_Adminhtml_AbstractController
49
+ */
50
+ protected function _registerItem(Mage_Core_Model_Abstract $model)
51
+ {
52
+ Mage::register('easy.banner.category.item', $model);
53
+ return $this;
54
+ }
55
+
56
+ /**
57
+ * Grid ajax action
58
+ */
59
+ public function ajaxbannersgridAction()
60
+ {
61
+ $this->loadLayout();
62
+ $this->renderLayout();
63
+ }
64
+
65
+ /**
66
+ * Grid ajax action
67
+ */
68
+ public function ajaxbannersgridonlyAction()
69
+ {
70
+ $this->loadLayout();
71
+ $this->renderLayout();
72
+ }
73
+ }
app/code/community/Lanot/EasyBanner/etc/adminhtml.xml CHANGED
@@ -1,98 +1,98 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Magento admin config
5
- *
6
- * @author Lanot
7
- */
8
- -->
9
- <config>
10
-
11
- <menu>
12
- <lanot translate="title">
13
- <title>Lanot</title>
14
- <sort_order>65</sort_order>
15
- <children>
16
- <lanot_easybanner translate="title">
17
- <title>Banners</title>
18
- <sort_order>50</sort_order>
19
- <children>
20
- <manage_banner translate="title" module="lanot_easybanner">
21
- <title>Manage Banners</title>
22
- <action>lanot_easybanner/adminhtml_banner</action>
23
- <sort_order>10</sort_order>
24
- </manage_banner>
25
- <manage_category translate="title" module="lanot_easybanner">
26
- <title>Manage Categories</title>
27
- <action>lanot_easybanner/adminhtml_category</action>
28
- <sort_order>20</sort_order>
29
- </manage_category>
30
- </children>
31
- </lanot_easybanner>
32
- </children>
33
- </lanot>
34
- </menu>
35
-
36
- <acl>
37
- <resources>
38
- <admin>
39
- <children>
40
- <lanot>
41
- <title>Lanot</title>
42
- <sort_order>65</sort_order>
43
- <children>
44
- <lanot_easybanner translate="title" module="lanot_easybanner">
45
- <title>Lanot Banners</title>
46
- <sort_order>65</sort_order>
47
- <children>
48
- <manage_banner translate="title">
49
- <title>Manage Banners</title>
50
- <sort_order>0</sort_order>
51
- <children>
52
- <save translate="title">
53
- <title>Save Banners</title>
54
- <sort_order>0</sort_order>
55
- </save>
56
- <delete translate="title">
57
- <title>Delete Banners</title>
58
- <sort_order>10</sort_order>
59
- </delete>
60
- </children>
61
- </manage_banner>
62
- <manage_category translate="title">
63
- <title>Manage Categories</title>
64
- <sort_order>0</sort_order>
65
- <children>
66
- <save translate="title">
67
- <title>Save Categories</title>
68
- <sort_order>0</sort_order>
69
- </save>
70
- <delete translate="title">
71
- <title>Delete Categories</title>
72
- <sort_order>10</sort_order>
73
- </delete>
74
- </children>
75
- </manage_category>
76
- </children>
77
- </lanot_easybanner>
78
- </children>
79
- </lanot>
80
-
81
- <system>
82
- <children>
83
- <config>
84
- <children>
85
- <lanot_easybanner translate="title" module="lanot_easybanner">
86
- <title>Lanot EasyBanner Configuration</title>
87
- </lanot_easybanner>
88
- </children>
89
- </config>
90
- </children>
91
- </system>
92
-
93
- </children>
94
- </admin>
95
- </resources>
96
- </acl>
97
-
98
  </config>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento admin config
5
+ *
6
+ * @author Lanot
7
+ */
8
+ -->
9
+ <config>
10
+
11
+ <menu>
12
+ <lanot translate="title">
13
+ <title>Lanot</title>
14
+ <sort_order>65</sort_order>
15
+ <children>
16
+ <lanot_easybanner translate="title">
17
+ <title>Banners</title>
18
+ <sort_order>50</sort_order>
19
+ <children>
20
+ <manage_banner translate="title" module="lanot_easybanner">
21
+ <title>Manage Banners</title>
22
+ <action>lanot_easybanner/adminhtml_banner</action>
23
+ <sort_order>10</sort_order>
24
+ </manage_banner>
25
+ <manage_category translate="title" module="lanot_easybanner">
26
+ <title>Manage Categories</title>
27
+ <action>lanot_easybanner/adminhtml_category</action>
28
+ <sort_order>20</sort_order>
29
+ </manage_category>
30
+ </children>
31
+ </lanot_easybanner>
32
+ </children>
33
+ </lanot>
34
+ </menu>
35
+
36
+ <acl>
37
+ <resources>
38
+ <admin>
39
+ <children>
40
+ <lanot>
41
+ <title>Lanot</title>
42
+ <sort_order>65</sort_order>
43
+ <children>
44
+ <lanot_easybanner translate="title" module="lanot_easybanner">
45
+ <title>Lanot Banners</title>
46
+ <sort_order>65</sort_order>
47
+ <children>
48
+ <manage_banner translate="title">
49
+ <title>Manage Banners</title>
50
+ <sort_order>0</sort_order>
51
+ <children>
52
+ <save translate="title">
53
+ <title>Save Banners</title>
54
+ <sort_order>0</sort_order>
55
+ </save>
56
+ <delete translate="title">
57
+ <title>Delete Banners</title>
58
+ <sort_order>10</sort_order>
59
+ </delete>
60
+ </children>
61
+ </manage_banner>
62
+ <manage_category translate="title">
63
+ <title>Manage Categories</title>
64
+ <sort_order>0</sort_order>
65
+ <children>
66
+ <save translate="title">
67
+ <title>Save Categories</title>
68
+ <sort_order>0</sort_order>
69
+ </save>
70
+ <delete translate="title">
71
+ <title>Delete Categories</title>
72
+ <sort_order>10</sort_order>
73
+ </delete>
74
+ </children>
75
+ </manage_category>
76
+ </children>
77
+ </lanot_easybanner>
78
+ </children>
79
+ </lanot>
80
+
81
+ <system>
82
+ <children>
83
+ <config>
84
+ <children>
85
+ <lanot_easybanner translate="title" module="lanot_easybanner">
86
+ <title>Lanot EasyBanner Configuration</title>
87
+ </lanot_easybanner>
88
+ </children>
89
+ </config>
90
+ </children>
91
+ </system>
92
+
93
+ </children>
94
+ </admin>
95
+ </resources>
96
+ </acl>
97
+
98
  </config>
app/code/community/Lanot/EasyBanner/etc/config.xml CHANGED
@@ -1,110 +1,110 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
-
4
- <modules>
5
- <Lanot_EasyBanner>
6
- <version>1.0.0.0</version>
7
- </Lanot_EasyBanner>
8
- </modules>
9
-
10
- <global>
11
-
12
- <helpers>
13
- <lanot_easybanner>
14
- <class>Lanot_EasyBanner_Helper</class>
15
- </lanot_easybanner>
16
- </helpers>
17
-
18
- <blocks>
19
- <lanot_easybanner>
20
- <class>Lanot_EasyBanner_Block</class>
21
- </lanot_easybanner>
22
- </blocks>
23
-
24
- <models>
25
- <lanot_easybanner>
26
- <class>Lanot_EasyBanner_Model</class>
27
- <resourceModel>lanot_easybanner_resource</resourceModel>
28
- </lanot_easybanner>
29
-
30
- <lanot_easybanner_resource>
31
- <class>Lanot_EasyBanner_Model_Mysql4</class>
32
- <entities>
33
- <banner>
34
- <table>lanot_easybanner_banner</table>
35
- </banner>
36
- <category>
37
- <table>lanot_easybanner_category</table>
38
- </category>
39
- <banner_category>
40
- <table>lanot_easybanner_banner_category</table>
41
- </banner_category>
42
- </entities>
43
- </lanot_easybanner_resource>
44
- </models>
45
-
46
- <!-- MySQL INSTALL SCRIPTS -->
47
- <resources>
48
- <lanot_easybanner_setup>
49
- <setup>
50
- <module>Lanot_EasyBanner</module>
51
- </setup>
52
- </lanot_easybanner_setup>
53
- </resources>
54
- <!-- /MySQL INSTALL SCRIPTS -->
55
- </global>
56
-
57
- <adminhtml>
58
- <layout>
59
- <updates>
60
- <lanot_easybanner>
61
- <file>lanot_easybanner.xml</file>
62
- </lanot_easybanner>
63
- </updates>
64
- </layout>
65
- </adminhtml>
66
-
67
- <admin>
68
- <routers>
69
- <lanot_easybanner>
70
- <use>admin</use>
71
- <args>
72
- <module>Lanot_EasyBanner</module>
73
- <frontName>lanot_easybanner</frontName>
74
- </args>
75
- </lanot_easybanner>
76
- </routers>
77
- </admin>
78
-
79
- <lanot_easybanner>
80
- <renderers>
81
- <image>lanot_easybanner/banner_renderer_image</image>
82
- <flash>lanot_easybanner/banner_renderer_flash</flash>
83
- </renderers>
84
- </lanot_easybanner>
85
-
86
- <default>
87
- <lanot_easybanner>
88
- <extensions>
89
- <allowed>
90
- <image>
91
- <jpg>1</jpg>
92
- <jpeg>1</jpeg>
93
- <png>1</png>
94
- <gif>1</gif>
95
- </image>
96
- <flash>
97
- <swf>1</swf>
98
- </flash>
99
- </allowed>
100
- </extensions>
101
- <view>
102
- <enabled>1</enabled>
103
- <new_window>1</new_window>
104
- <block_css_class>block-banner</block_css_class>
105
- <item_css_class>block-content</item_css_class>
106
- <!-- <title_css_class>page-title</title_css_class> -->
107
- </view>
108
- </lanot_easybanner>
109
- </default>
110
  </config>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+
4
+ <modules>
5
+ <Lanot_EasyBanner>
6
+ <version>1.0.0.2</version>
7
+ </Lanot_EasyBanner>
8
+ </modules>
9
+
10
+ <global>
11
+
12
+ <helpers>
13
+ <lanot_easybanner>
14
+ <class>Lanot_EasyBanner_Helper</class>
15
+ </lanot_easybanner>
16
+ </helpers>
17
+
18
+ <blocks>
19
+ <lanot_easybanner>
20
+ <class>Lanot_EasyBanner_Block</class>
21
+ </lanot_easybanner>
22
+ </blocks>
23
+
24
+ <models>
25
+ <lanot_easybanner>
26
+ <class>Lanot_EasyBanner_Model</class>
27
+ <resourceModel>lanot_easybanner_resource</resourceModel>
28
+ </lanot_easybanner>
29
+
30
+ <lanot_easybanner_resource>
31
+ <class>Lanot_EasyBanner_Model_Mysql4</class>
32
+ <entities>
33
+ <banner>
34
+ <table>lanot_easybanner_banner</table>
35
+ </banner>
36
+ <category>
37
+ <table>lanot_easybanner_category</table>
38
+ </category>
39
+ <banner_category>
40
+ <table>lanot_easybanner_banner_category</table>
41
+ </banner_category>
42
+ </entities>
43
+ </lanot_easybanner_resource>
44
+ </models>
45
+
46
+ <!-- MySQL INSTALL SCRIPTS -->
47
+ <resources>
48
+ <lanot_easybanner_setup>
49
+ <setup>
50
+ <module>Lanot_EasyBanner</module>
51
+ </setup>
52
+ </lanot_easybanner_setup>
53
+ </resources>
54
+ <!-- /MySQL INSTALL SCRIPTS -->
55
+ </global>
56
+
57
+ <adminhtml>
58
+ <layout>
59
+ <updates>
60
+ <lanot_easybanner>
61
+ <file>lanot_easybanner.xml</file>
62
+ </lanot_easybanner>
63
+ </updates>
64
+ </layout>
65
+ </adminhtml>
66
+
67
+ <admin>
68
+ <routers>
69
+ <lanot_easybanner>
70
+ <use>admin</use>
71
+ <args>
72
+ <module>Lanot_EasyBanner</module>
73
+ <frontName>lanot_easybanner</frontName>
74
+ </args>
75
+ </lanot_easybanner>
76
+ </routers>
77
+ </admin>
78
+
79
+ <lanot_easybanner>
80
+ <renderers>
81
+ <image>lanot_easybanner/banner_renderer_image</image>
82
+ <flash>lanot_easybanner/banner_renderer_flash</flash>
83
+ </renderers>
84
+ </lanot_easybanner>
85
+
86
+ <default>
87
+ <lanot_easybanner>
88
+ <extensions>
89
+ <allowed>
90
+ <image>
91
+ <jpg>1</jpg>
92
+ <jpeg>1</jpeg>
93
+ <png>1</png>
94
+ <gif>1</gif>
95
+ </image>
96
+ <flash>
97
+ <swf>1</swf>
98
+ </flash>
99
+ </allowed>
100
+ </extensions>
101
+ <view>
102
+ <enabled>1</enabled>
103
+ <new_window>1</new_window>
104
+ <block_css_class>block-banner</block_css_class>
105
+ <item_css_class>block-content</item_css_class>
106
+ <!-- <title_css_class>page-title</title_css_class> -->
107
+ </view>
108
+ </lanot_easybanner>
109
+ </default>
110
  </config>
app/code/community/Lanot/EasyBanner/etc/system.xml CHANGED
@@ -1,77 +1,77 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <tabs>
4
- <lanot translate="label">
5
- <label>Lanot Extensions</label>
6
- <sort_order>200</sort_order>
7
- </lanot>
8
- </tabs>
9
- <sections>
10
- <lanot_easybanner>
11
- <class>separator-top</class>
12
- <label>Easy Banner</label>
13
- <tab>lanot</tab>
14
- <frontend_type>text</frontend_type>
15
- <sort_order>500</sort_order>
16
- <show_in_default>1</show_in_default>
17
- <show_in_website>1</show_in_website>
18
- <show_in_store>1</show_in_store>
19
- <groups>
20
- <view translate="label">
21
- <label>Banner Settings</label>
22
- <frontend_type>text</frontend_type>
23
- <sort_order>10</sort_order>
24
- <show_in_default>1</show_in_default>
25
- <show_in_website>1</show_in_website>
26
- <show_in_store>1</show_in_store>
27
- <fields>
28
- <enabled translate="label">
29
- <label>Enable Banners On Frontend</label>
30
- <frontend_type>select</frontend_type>
31
- <source_model>adminhtml/system_config_source_yesno</source_model>
32
- <sort_order>10</sort_order>
33
- <show_in_default>1</show_in_default>
34
- <show_in_website>1</show_in_website>
35
- <show_in_store>1</show_in_store>
36
- </enabled>
37
- <new_window translate="label">
38
- <label>Open new page by click in new window </label>
39
- <frontend_type>select</frontend_type>
40
- <source_model>adminhtml/system_config_source_yesno</source_model>
41
- <sort_order>30</sort_order>
42
- <show_in_default>1</show_in_default>
43
- <show_in_website>1</show_in_website>
44
- <show_in_store>1</show_in_store>
45
- </new_window>
46
- <block_css_class translate="label">
47
- <label>Banners block CSS class</label>
48
- <frontend_type>text</frontend_type>
49
- <sort_order>40</sort_order>
50
- <show_in_default>1</show_in_default>
51
- <show_in_website>1</show_in_website>
52
- <show_in_store>1</show_in_store>
53
- </block_css_class>
54
- <item_css_class translate="label">
55
- <label>Banners item CSS class</label>
56
- <frontend_type>text</frontend_type>
57
- <sort_order>40</sort_order>
58
- <show_in_default>1</show_in_default>
59
- <show_in_website>1</show_in_website>
60
- <show_in_store>1</show_in_store>
61
- </item_css_class>
62
- <!--
63
- <title_css_class translate="label">
64
- <label>Banners Widget Title CSS class</label>
65
- <frontend_type>text</frontend_type>
66
- <sort_order>40</sort_order>
67
- <show_in_default>1</show_in_default>
68
- <show_in_website>1</show_in_website>
69
- <show_in_store>1</show_in_store>
70
- </title_css_class>
71
- -->
72
- </fields>
73
- </view>
74
- </groups>
75
- </lanot_easybanner>
76
- </sections>
77
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <lanot translate="label">
5
+ <label>Lanot Extensions</label>
6
+ <sort_order>200</sort_order>
7
+ </lanot>
8
+ </tabs>
9
+ <sections>
10
+ <lanot_easybanner>
11
+ <class>separator-top</class>
12
+ <label>Easy Banner</label>
13
+ <tab>lanot</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>500</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <view translate="label">
21
+ <label>Banner Settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>10</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+ <enabled translate="label">
29
+ <label>Enable Banners On Frontend</label>
30
+ <frontend_type>select</frontend_type>
31
+ <source_model>adminhtml/system_config_source_yesno</source_model>
32
+ <sort_order>10</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </enabled>
37
+ <new_window translate="label">
38
+ <label>Open new page by click in new window </label>
39
+ <frontend_type>select</frontend_type>
40
+ <source_model>adminhtml/system_config_source_yesno</source_model>
41
+ <sort_order>30</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </new_window>
46
+ <block_css_class translate="label">
47
+ <label>Banners block CSS class</label>
48
+ <frontend_type>text</frontend_type>
49
+ <sort_order>40</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </block_css_class>
54
+ <item_css_class translate="label">
55
+ <label>Banners item CSS class</label>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>40</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ </item_css_class>
62
+ <!--
63
+ <title_css_class translate="label">
64
+ <label>Banners Widget Title CSS class</label>
65
+ <frontend_type>text</frontend_type>
66
+ <sort_order>40</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ </title_css_class>
71
+ -->
72
+ </fields>
73
+ </view>
74
+ </groups>
75
+ </lanot_easybanner>
76
+ </sections>
77
+ </config>
app/code/community/Lanot/EasyBanner/etc/widget.xml CHANGED
@@ -1,38 +1,38 @@
1
- <?xml version="1.0"?>
2
- <widgets>
3
- <lanot_easybanner type="lanot_easybanner/widget_banners" translate="name">
4
- <name>Lanot Banner</name>
5
- <description>Displays Banners By Category</description>
6
- <parameters>
7
- <category_id translate="label">
8
- <required>1</required>
9
- <visible>1</visible>
10
- <label>Banners Category</label>
11
- <type>select</type>
12
- <source_model>lanot_easybanner/category</source_model>
13
- </category_id>
14
- <limit translate="label">
15
- <required>1</required>
16
- <visible>1</visible>
17
- <label>Banners Count</label>
18
- <type>text</type>
19
- <style>width: 50px;</style>
20
- <value>1</value>
21
- </limit>
22
- <random translate="label">
23
- <visible>1</visible>
24
- <label>Show Random</label>
25
- <type>select</type>
26
- <source_model>adminhtml/system_config_source_yesno</source_model>
27
- </random>
28
- <!--
29
- <show_title translate="label">
30
- <visible>1</visible>
31
- <label>Show Widget Title</label>
32
- <type>select</type>
33
- <source_model>adminhtml/system_config_source_yesno</source_model>
34
- </show_title>
35
- -->
36
- </parameters>
37
- </lanot_easybanner>
38
  </widgets>
1
+ <?xml version="1.0"?>
2
+ <widgets>
3
+ <lanot_easybanner type="lanot_easybanner/widget_banners" translate="name">
4
+ <name>Lanot Banner</name>
5
+ <description>Displays Banners By Category</description>
6
+ <parameters>
7
+ <category_id translate="label">
8
+ <required>1</required>
9
+ <visible>1</visible>
10
+ <label>Banners Category</label>
11
+ <type>select</type>
12
+ <source_model>lanot_easybanner/category</source_model>
13
+ </category_id>
14
+ <limit translate="label">
15
+ <required>1</required>
16
+ <visible>1</visible>
17
+ <label>Banners Count</label>
18
+ <type>text</type>
19
+ <style>width: 50px;</style>
20
+ <value>1</value>
21
+ </limit>
22
+ <random translate="label">
23
+ <visible>1</visible>
24
+ <label>Show Random</label>
25
+ <type>select</type>
26
+ <source_model>adminhtml/system_config_source_yesno</source_model>
27
+ </random>
28
+ <!--
29
+ <show_title translate="label">
30
+ <visible>1</visible>
31
+ <label>Show Widget Title</label>
32
+ <type>select</type>
33
+ <source_model>adminhtml/system_config_source_yesno</source_model>
34
+ </show_title>
35
+ -->
36
+ </parameters>
37
+ </lanot_easybanner>
38
  </widgets>
app/code/community/Lanot/EasyBanner/sql/lanot_easybanner_setup/mysql4-install-1.0.0.0.php CHANGED
@@ -1,79 +1,79 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Lanot
16
- * @package Lanot_EasyBanner
17
- * @copyright Copyright (c) 2012 Lanot
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- $installer = $this;
22
-
23
- $installer->startSetup();
24
-
25
- //tables definition
26
- $bannerTable = $installer->getTable('lanot_easybanner/banner');
27
- $categoryTable = $installer->getTable('lanot_easybanner/category');
28
- $bannerCategoryTable = $installer->getTable('lanot_easybanner/banner_category');
29
-
30
- //create table for banner
31
- $installer->run("
32
- DROP TABLE IF EXISTS `{$bannerTable}`;
33
- CREATE TABLE `{$bannerTable}` (
34
- `banner_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Banner ID',
35
- `is_active` tinyint DEFAULT 0,
36
- `title` varchar(255) NOT NULL,
37
- `description` mediumtext DEFAULT NULL,
38
- `path` varchar(255) DEFAULT NULL,
39
- `url` varchar(255) DEFAULT NULL,
40
- `type` varchar(8) DEFAULT NULL,
41
- `width` smallint DEFAULT NULL,
42
- `height` smallint DEFAULT NULL,
43
- `created_at` timestamp NULL DEFAULT NULL COMMENT 'Creation Time',
44
- `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update Time',
45
- PRIMARY KEY (`banner_id`)
46
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Banners Entity Table';
47
- ");
48
-
49
-
50
- //create table for banner category
51
- $installer->run("
52
- DROP TABLE IF EXISTS `{$categoryTable}`;
53
- CREATE TABLE `{$categoryTable}` (
54
- `category_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Category ID',
55
- `is_active` tinyint DEFAULT 0,
56
- `title` varchar(255) DEFAULT NULL,
57
- `description` tinytext,
58
- `created_at` timestamp NULL DEFAULT NULL COMMENT 'Creation Time',
59
- `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update Time',
60
- PRIMARY KEY (`category_id`)
61
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Banner Category Table';
62
- ");
63
-
64
-
65
- //create table for banners to categories
66
- $installer->run("
67
- DROP TABLE IF EXISTS `{$bannerCategoryTable}`;
68
- CREATE TABLE `{$bannerCategoryTable}` (
69
- `banner_id` int(10) unsigned NOT NULL COMMENT 'Banner Attachment ID',
70
- `category_id` int(10) unsigned NOT NULL COMMENT 'Banner Category ID',
71
- PRIMARY KEY (`banner_id`, `category_id`),
72
- KEY `IDX_EASYBANER_BANER_ID` (`banner_id`),
73
- KEY `IDX_EASYBANER_CATEGORY_ID` (`category_id`),
74
- CONSTRAINT `FK_EASYBANNER_CATEGORY_BANER_ID` FOREIGN KEY (`banner_id`) REFERENCES `{$bannerTable}` (`banner_id`) ON DELETE CASCADE ON UPDATE CASCADE,
75
- CONSTRAINT `FK_EASYBANNER_CATEGORY_CATEGORY_ID` FOREIGN KEY (`category_id`) REFERENCES `{$categoryTable}` (`category_id`) ON DELETE CASCADE ON UPDATE CASCADE
76
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Banners To Categories Table';
77
- ");
78
-
79
- $installer->endSetup();
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Lanot
16
+ * @package Lanot_EasyBanner
17
+ * @copyright Copyright (c) 2012 Lanot
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ $installer = $this;
22
+
23
+ $installer->startSetup();
24
+
25
+ //tables definition
26
+ $bannerTable = $installer->getTable('lanot_easybanner/banner');
27
+ $categoryTable = $installer->getTable('lanot_easybanner/category');
28
+ $bannerCategoryTable = $installer->getTable('lanot_easybanner/banner_category');
29
+
30
+ //create table for banner
31
+ $installer->run("
32
+ DROP TABLE IF EXISTS `{$bannerTable}`;
33
+ CREATE TABLE `{$bannerTable}` (
34
+ `banner_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Banner ID',
35
+ `is_active` tinyint DEFAULT 0,
36
+ `title` varchar(255) NOT NULL,
37
+ `description` mediumtext DEFAULT NULL,
38
+ `path` varchar(255) DEFAULT NULL,
39
+ `url` varchar(255) DEFAULT NULL,
40
+ `type` varchar(8) DEFAULT NULL,
41
+ `width` smallint DEFAULT NULL,
42
+ `height` smallint DEFAULT NULL,
43
+ `created_at` timestamp NULL DEFAULT NULL COMMENT 'Creation Time',
44
+ `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update Time',
45
+ PRIMARY KEY (`banner_id`)
46
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Banners Entity Table';
47
+ ");
48
+
49
+
50
+ //create table for banner category
51
+ $installer->run("
52
+ DROP TABLE IF EXISTS `{$categoryTable}`;
53
+ CREATE TABLE `{$categoryTable}` (
54
+ `category_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Category ID',
55
+ `is_active` tinyint DEFAULT 0,
56
+ `title` varchar(255) DEFAULT NULL,
57
+ `description` tinytext,
58
+ `created_at` timestamp NULL DEFAULT NULL COMMENT 'Creation Time',
59
+ `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update Time',
60
+ PRIMARY KEY (`category_id`)
61
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Banner Category Table';
62
+ ");
63
+
64
+
65
+ //create table for banners to categories
66
+ $installer->run("
67
+ DROP TABLE IF EXISTS `{$bannerCategoryTable}`;
68
+ CREATE TABLE `{$bannerCategoryTable}` (
69
+ `banner_id` int(10) unsigned NOT NULL COMMENT 'Banner Attachment ID',
70
+ `category_id` int(10) unsigned NOT NULL COMMENT 'Banner Category ID',
71
+ PRIMARY KEY (`banner_id`, `category_id`),
72
+ KEY `IDX_EASYBANER_BANER_ID` (`banner_id`),
73
+ KEY `IDX_EASYBANER_CATEGORY_ID` (`category_id`),
74
+ CONSTRAINT `FK_EASYBANNER_CATEGORY_BANER_ID` FOREIGN KEY (`banner_id`) REFERENCES `{$bannerTable}` (`banner_id`) ON DELETE CASCADE ON UPDATE CASCADE,
75
+ CONSTRAINT `FK_EASYBANNER_CATEGORY_CATEGORY_ID` FOREIGN KEY (`category_id`) REFERENCES `{$categoryTable}` (`category_id`) ON DELETE CASCADE ON UPDATE CASCADE
76
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Banners To Categories Table';
77
+ ");
78
+
79
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/lanot_easybanner.xml CHANGED
@@ -1,111 +1,111 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Magento backend layout
5
- *
6
- * @author Lanot
7
- */
8
- -->
9
- <layout>
10
-
11
- <!-- ADMIN CATEGORIES -->
12
- <lanot_easybanner_adminhtml_category_index>
13
- <reference name="content">
14
- <block type="lanot_easybanner/adminhtml_category" name="easybanner_category" />
15
- </reference>
16
- </lanot_easybanner_adminhtml_category_index>
17
-
18
- <lanot_easybanner_adminhtml_category_grid>
19
- <block type="lanot_easybanner/adminhtml_category_grid" name="root"/>
20
- </lanot_easybanner_adminhtml_category_grid>
21
-
22
- <lanot_easybanner_adminhtml_category_new>
23
- <update handle="lanot_easybanner_adminhtml_category_edit" />
24
- </lanot_easybanner_adminhtml_category_new>
25
-
26
- <lanot_easybanner_adminhtml_category_edit>
27
- <reference name="content">
28
- <block type="lanot_easybanner/adminhtml_category_edit" name="easybanner_category_edit" />
29
- </reference>
30
- <reference name="left">
31
- <block type="lanot_easybanner/adminhtml_category_edit_tabs" name="category_edit_tabs" />
32
- </reference>
33
- </lanot_easybanner_adminhtml_category_edit>
34
-
35
- <lanot_easybanner_adminhtml_category_ajaxbannersgrid>
36
- <block type="core/text_list" name="root" output="toHtml">
37
- <block type="lanot_easybanner/adminhtml_category_edit_tab_banners" name="banner.edit.tab.grid"/>
38
- <block type="adminhtml/widget_grid_serializer" name="banner_grid_serializer">
39
- <reference name="banner_grid_serializer">
40
- <action method="initSerializerBlock">
41
- <grid_block_name>banner.edit.tab.grid</grid_block_name>
42
- <data_callback>getSelectedLinks</data_callback>
43
- <hidden_input_name>banners</hidden_input_name>
44
- <reload_param_name>banners</reload_param_name>
45
- </action>
46
- </reference>
47
- </block>
48
- </block>
49
- </lanot_easybanner_adminhtml_category_ajaxbannersgrid>
50
-
51
- <lanot_easybanner_adminhtml_category_ajaxbannersgridonly>
52
- <block type="core/text_list" name="root" output="toHtml">
53
- <block type="lanot_easybanner/adminhtml_category_edit_tab_banners" name="banner.edit.tab.grid"/>
54
- </block>
55
- </lanot_easybanner_adminhtml_category_ajaxbannersgridonly>
56
- <!-- /ADMIN CATEGORIES -->
57
-
58
-
59
-
60
- <!-- ADMIN BANNERS -->
61
- <lanot_easybanner_adminhtml_banner_index>
62
- <reference name="content">
63
- <block type="lanot_easybanner/adminhtml_banner" name="easybanner_banner" />
64
- </reference>
65
- </lanot_easybanner_adminhtml_banner_index>
66
-
67
- <lanot_easybanner_adminhtml_banner_grid>
68
- <block type="lanot_easybanner/adminhtml_banner_grid" name="root"/>
69
- </lanot_easybanner_adminhtml_banner_grid>
70
-
71
- <adminhtml_news_grid>
72
- <block type="magentostudy_news/adminhtml_news_grid" name="root"/>
73
- </adminhtml_news_grid>
74
-
75
- <lanot_easybanner_adminhtml_banner_new>
76
- <update handle="lanot_easybanner_adminhtml_banner_edit" />
77
- </lanot_easybanner_adminhtml_banner_new>
78
-
79
- <lanot_easybanner_adminhtml_banner_edit>
80
- <reference name="content">
81
- <block type="lanot_easybanner/adminhtml_banner_edit" name="easybanner_banner_edit" />
82
- </reference>
83
- <reference name="left">
84
- <block type="lanot_easybanner/adminhtml_banner_edit_tabs" name="banner_edit_tabs" />
85
- </reference>
86
- </lanot_easybanner_adminhtml_banner_edit>
87
-
88
- <lanot_easybanner_adminhtml_banner_ajaxcategoriesgrid>
89
- <block type="core/text_list" name="root" output="toHtml">
90
- <block type="lanot_easybanner/adminhtml_banner_edit_tab_categories" name="category.edit.tab.grid"/>
91
- <block type="adminhtml/widget_grid_serializer" name="category_grid_serializer">
92
- <reference name="category_grid_serializer">
93
- <action method="initSerializerBlock">
94
- <grid_block_name>category.edit.tab.grid</grid_block_name>
95
- <data_callback>getSelectedLinks</data_callback>
96
- <hidden_input_name>categories</hidden_input_name>
97
- <reload_param_name>categories</reload_param_name>
98
- </action>
99
- </reference>
100
- </block>
101
- </block>
102
- </lanot_easybanner_adminhtml_banner_ajaxcategoriesgrid>
103
-
104
- <lanot_easybanner_adminhtml_banner_ajaxcategoriesgridonly>
105
- <block type="core/text_list" name="root" output="toHtml">
106
- <block type="lanot_easybanner/adminhtml_banner_edit_tab_categories" name="category.edit.tab.grid"/>
107
- </block>
108
- </lanot_easybanner_adminhtml_banner_ajaxcategoriesgridonly>
109
- <!-- /ADMIN BANNERS -->
110
-
111
  </layout>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento backend layout
5
+ *
6
+ * @author Lanot
7
+ */
8
+ -->
9
+ <layout>
10
+
11
+ <!-- ADMIN CATEGORIES -->
12
+ <lanot_easybanner_adminhtml_category_index>
13
+ <reference name="content">
14
+ <block type="lanot_easybanner/adminhtml_category" name="easybanner_category" />
15
+ </reference>
16
+ </lanot_easybanner_adminhtml_category_index>
17
+
18
+ <lanot_easybanner_adminhtml_category_grid>
19
+ <block type="lanot_easybanner/adminhtml_category_grid" name="root"/>
20
+ </lanot_easybanner_adminhtml_category_grid>
21
+
22
+ <lanot_easybanner_adminhtml_category_new>
23
+ <update handle="lanot_easybanner_adminhtml_category_edit" />
24
+ </lanot_easybanner_adminhtml_category_new>
25
+
26
+ <lanot_easybanner_adminhtml_category_edit>
27
+ <reference name="content">
28
+ <block type="lanot_easybanner/adminhtml_category_edit" name="easybanner_category_edit" />
29
+ </reference>
30
+ <reference name="left">
31
+ <block type="lanot_easybanner/adminhtml_category_edit_tabs" name="category_edit_tabs" />
32
+ </reference>
33
+ </lanot_easybanner_adminhtml_category_edit>
34
+
35
+ <lanot_easybanner_adminhtml_category_ajaxbannersgrid>
36
+ <block type="core/text_list" name="root" output="toHtml">
37
+ <block type="lanot_easybanner/adminhtml_category_edit_tab_banners" name="banner.edit.tab.grid"/>
38
+ <block type="adminhtml/widget_grid_serializer" name="banner_grid_serializer">
39
+ <reference name="banner_grid_serializer">
40
+ <action method="initSerializerBlock">
41
+ <grid_block_name>banner.edit.tab.grid</grid_block_name>
42
+ <data_callback>getSelectedLinks</data_callback>
43
+ <hidden_input_name>banners</hidden_input_name>
44
+ <reload_param_name>banners</reload_param_name>
45
+ </action>
46
+ </reference>
47
+ </block>
48
+ </block>
49
+ </lanot_easybanner_adminhtml_category_ajaxbannersgrid>
50
+
51
+ <lanot_easybanner_adminhtml_category_ajaxbannersgridonly>
52
+ <block type="core/text_list" name="root" output="toHtml">
53
+ <block type="lanot_easybanner/adminhtml_category_edit_tab_banners" name="banner.edit.tab.grid"/>
54
+ </block>
55
+ </lanot_easybanner_adminhtml_category_ajaxbannersgridonly>
56
+ <!-- /ADMIN CATEGORIES -->
57
+
58
+
59
+
60
+ <!-- ADMIN BANNERS -->
61
+ <lanot_easybanner_adminhtml_banner_index>
62
+ <reference name="content">
63
+ <block type="lanot_easybanner/adminhtml_banner" name="easybanner_banner" />
64
+ </reference>
65
+ </lanot_easybanner_adminhtml_banner_index>
66
+
67
+ <lanot_easybanner_adminhtml_banner_grid>
68
+ <block type="lanot_easybanner/adminhtml_banner_grid" name="root"/>
69
+ </lanot_easybanner_adminhtml_banner_grid>
70
+
71
+ <adminhtml_news_grid>
72
+ <block type="magentostudy_news/adminhtml_news_grid" name="root"/>
73
+ </adminhtml_news_grid>
74
+
75
+ <lanot_easybanner_adminhtml_banner_new>
76
+ <update handle="lanot_easybanner_adminhtml_banner_edit" />
77
+ </lanot_easybanner_adminhtml_banner_new>
78
+
79
+ <lanot_easybanner_adminhtml_banner_edit>
80
+ <reference name="content">
81
+ <block type="lanot_easybanner/adminhtml_banner_edit" name="easybanner_banner_edit" />
82
+ </reference>
83
+ <reference name="left">
84
+ <block type="lanot_easybanner/adminhtml_banner_edit_tabs" name="banner_edit_tabs" />
85
+ </reference>
86
+ </lanot_easybanner_adminhtml_banner_edit>
87
+
88
+ <lanot_easybanner_adminhtml_banner_ajaxcategoriesgrid>
89
+ <block type="core/text_list" name="root" output="toHtml">
90
+ <block type="lanot_easybanner/adminhtml_banner_edit_tab_categories" name="category.edit.tab.grid"/>
91
+ <block type="adminhtml/widget_grid_serializer" name="category_grid_serializer">
92
+ <reference name="category_grid_serializer">
93
+ <action method="initSerializerBlock">
94
+ <grid_block_name>category.edit.tab.grid</grid_block_name>
95
+ <data_callback>getSelectedLinks</data_callback>
96
+ <hidden_input_name>categories</hidden_input_name>
97
+ <reload_param_name>categories</reload_param_name>
98
+ </action>
99
+ </reference>
100
+ </block>
101
+ </block>
102
+ </lanot_easybanner_adminhtml_banner_ajaxcategoriesgrid>
103
+
104
+ <lanot_easybanner_adminhtml_banner_ajaxcategoriesgridonly>
105
+ <block type="core/text_list" name="root" output="toHtml">
106
+ <block type="lanot_easybanner/adminhtml_banner_edit_tab_categories" name="category.edit.tab.grid"/>
107
+ </block>
108
+ </lanot_easybanner_adminhtml_banner_ajaxcategoriesgridonly>
109
+ <!-- /ADMIN BANNERS -->
110
+
111
  </layout>
app/design/frontend/base/default/template/lanot/easybanner/banners.phtml CHANGED
@@ -1,23 +1,23 @@
1
- <?php
2
- /** @var $this Lanot_EasyBanner_Block_Widget_Category */
3
- /** @var $helper Lanot_EasyBanner_Data_Helper */
4
- $helper = Mage::helper('lanot_easybanner');
5
- $bclass = $helper->getBlockCssClass();
6
- $iclass = $helper->getItemCssClass();
7
- $tclass = $helper->getTitleCssClass();
8
-
9
- if ($this->getItems()):
10
- ?>
11
- <div <?php if($bclass):?>class="<?php echo $bclass?>"<?php endif;?>>
12
- <?php if ($this->getShowTitle() && $this->getTitle()):?>
13
- <div <?php if($tclass):?>class="<?php echo $tclass?>"<?php endif;?>>
14
- <?php echo $this->getTitle() ;?>
15
- </div>
16
- <?php endif; ?>
17
- <?php foreach($this->getItems() as $item): ?>
18
- <div <?php if($iclass):?>class="<?php echo $iclass?>"<?php endif;?>>
19
- <?php echo $this->render($item)?>
20
- </div>
21
- <?php endforeach; ?>
22
- </div>
23
  <?php endif;?>
1
+ <?php
2
+ /** @var $this Lanot_EasyBanner_Block_Widget_Category */
3
+ /** @var $helper Lanot_EasyBanner_Data_Helper */
4
+ $helper = Mage::helper('lanot_easybanner');
5
+ $bclass = $helper->getBlockCssClass();
6
+ $iclass = $helper->getItemCssClass();
7
+ $tclass = $helper->getTitleCssClass();
8
+
9
+ if ($this->getItems()):
10
+ ?>
11
+ <div <?php if($bclass):?>class="<?php echo $bclass?>"<?php endif;?>>
12
+ <?php if ($this->getShowTitle() && $this->getTitle()):?>
13
+ <div <?php if($tclass):?>class="<?php echo $tclass?>"<?php endif;?>>
14
+ <?php echo $this->getTitle() ;?>
15
+ </div>
16
+ <?php endif; ?>
17
+ <?php foreach($this->getItems() as $item): ?>
18
+ <div <?php if($iclass):?>class="<?php echo $iclass?>"<?php endif;?>>
19
+ <?php echo $this->render($item)?>
20
+ </div>
21
+ <?php endforeach; ?>
22
+ </div>
23
  <?php endif;?>
app/etc/modules/Lanot_EasyBanner.xml CHANGED
@@ -1,9 +1,9 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <modules>
4
- <Lanot_EasyBanner>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </Lanot_EasyBanner>
8
- </modules>
9
  </config>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Lanot_EasyBanner>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Lanot_EasyBanner>
8
+ </modules>
9
  </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Lanot_EasyBanner</name>
4
- <version>1.0.0.0</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
@@ -14,11 +14,12 @@
14
  2. Prepared widget for banners rotation</description>
15
  <notes>First release of module:&#xD;
16
  1. Managing banners and banner categories&#xD;
17
- 2. Prepared widget for banners rotation</notes>
 
18
  <authors><author><name>Lanot</name><user>Lanot</user><email>lanot.biz@gmail.com</email></author></authors>
19
- <date>2012-12-23</date>
20
- <time>13:32:59</time>
21
- <contents><target name="mageetc"><dir name="modules"><file name="Lanot_EasyBanner.xml" hash="bedb067b409b6169246f17e241bc2ccc"/></dir></target><target name="magecommunity"><dir name="Lanot"><dir name="EasyBanner"><dir name="Block"><dir name="Adminhtml"><dir name="Banner"><dir name="Edit"><file name="Form.php" hash="d1ffee79ed0a8998202f66b603f15848"/><dir name="Tab"><file name="Categories.php" hash="2e377f10ba95f087fb6ddb4ac7996f98"/><file name="Main.php" hash="2cfcb70f05589c7225b04de1d9e17675"/></dir><file name="Tabs.php" hash="8bd0bab44fb0101ffcf1ebf72cfcf3c7"/></dir><file name="Edit.php" hash="5c2748ef1c300ae7253530dca4ced37e"/><file name="Grid.php" hash="650d020ca39686e4482b906ad4d9e1f6"/></dir><file name="Banner.php" hash="6ebc22c420e00713f99c70a3a1e18d95"/><dir name="Category"><dir name="Edit"><file name="Form.php" hash="02e2b86061f49d8d2721073dd8392317"/><dir name="Tab"><file name="Banners.php" hash="feb17b4df56e2f0478492222136b4efa"/><file name="Main.php" hash="6d46ee0dfa6d5ade0f647bef6e843672"/></dir><file name="Tabs.php" hash="0ac505d8ea7b8b7140534b66693d1a12"/></dir><file name="Edit.php" hash="792776dbe9e859e113fde534f730fbe2"/><file name="Grid.php" hash="ad94540e1a7008f2772d1186a2c5bb5a"/></dir><file name="Category.php" hash="1406d96caefe8867f366f31be5cd836e"/><dir name="Grid"><file name="Abstract.php" hash="e22ff10e8fa414bf6bf36f09cf05dbfb"/></dir><dir name="Renderer"><file name="Banner.php" hash="3c81b92b136b9c075b8819779538ade7"/></dir></dir><dir name="Banner"><dir name="Renderer"><file name="Abstract.php" hash="95d47ea32fd0d6873c93160ab91c67c2"/><file name="Flash.php" hash="896944a0db3b4758b409b925b0c91a11"/><file name="Image.php" hash="6fd5888a20cb1db7ce43d82354913ee0"/></dir></dir><dir name="Widget"><file name="Banners.php" hash="cd82aed5e00205a51964d9072db4ad6d"/></dir></dir><dir name="Controller"><dir name="Adminhtml"><file name="AbstractController.php" hash="05b20b95eb2725828bff9cec03724aaf"/></dir></dir><dir name="Helper"><file name="Admin.php" hash="dda4102632d96825ef7e26125f57cbdd"/><file name="Data.php" hash="b277be880586aa59cd620a276d736a9a"/></dir><dir name="Model"><file name="Banner.php" hash="7731d967da91ea67aa4eef8d9935913c"/><file name="Category.php" hash="b6ccfd21372ba8e6e5b9eef7f56f532d"/><dir name="Mysql4"><dir name="Banner"><file name="Collection.php" hash="77dbb9ecd065837600726f669ce74227"/></dir><file name="Banner.php" hash="5293f98a6bbd0ddbe1a1662b42e210e2"/><dir name="Category"><file name="Collection.php" hash="eda58acef3e1cb03867eb433ff7344b0"/></dir><file name="Category.php" hash="1e1c31ba100939060fcd3771df8c7eeb"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="BannerController.php" hash="762da47a05b2f3bec7a9fa6f027a545f"/><file name="CategoryController.php" hash="5e2f05c8690db38a25574c96db73883f"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9f6b791408dadb41c2cf609e19a60996"/><file name="config.xml" hash="bea80b6329422b177229265be94dfdf1"/><file name="system.xml" hash="d10558245bb0474a49e5e5acce7a9013"/><file name="widget.xml" hash="883b153963f8ef767a2d3f5dcf3166b6"/></dir><dir name="sql"><dir name="lanot_easybanner_setup"><file name="mysql4-install-1.0.0.0.php" hash="ba6378c2a0508f5f00d894551387c597"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="lanot_easybanner.xml" hash="1e0ff239656b2dabdc83dff8e85b7233"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="lanot"><dir name="easybanner"><file name="banners.phtml" hash="8c38ce0969c92828bb0e273da4567a46"/></dir></dir></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
24
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Lanot_EasyBanner</name>
4
+ <version>1.0.0.2</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
14
  2. Prepared widget for banners rotation</description>
15
  <notes>First release of module:&#xD;
16
  1. Managing banners and banner categories&#xD;
17
+ 2. Prepared widget for banners rotation&#xD;
18
+ Uploaded for Magento Connect 2.0</notes>
19
  <authors><author><name>Lanot</name><user>Lanot</user><email>lanot.biz@gmail.com</email></author></authors>
20
+ <date>2012-12-27</date>
21
+ <time>08:54:31</time>
22
+ <contents><target name="mageetc"><dir name="modules"><file name="Lanot_EasyBanner.xml" hash="273ba017ba61426ff63b69f81ceadf17"/></dir></target><target name="magecommunity"><dir name="Lanot"><dir name="EasyBanner"><dir name="Block"><dir name="Adminhtml"><dir name="Banner"><dir name="Edit"><file name="Form.php" hash="625c5be13eefa416166822c5e9808735"/><dir name="Tab"><file name="Categories.php" hash="f0257286002d647ec20ad6e8fda6a519"/><file name="Main.php" hash="3fd4c0e29e647fa8c0d5b21ddc1a9aa2"/></dir><file name="Tabs.php" hash="fad2873cc2a30d9e96f3011321bd2967"/></dir><file name="Edit.php" hash="5e917f1c195f41328c404a1b50c42b81"/><file name="Grid.php" hash="f118b433daa7616279c41207da81f84e"/></dir><file name="Banner.php" hash="86f631a4e53cdc33ecde372603f10383"/><dir name="Category"><dir name="Edit"><file name="Form.php" hash="a0a5880c32be1c48bd656df9927770d2"/><dir name="Tab"><file name="Banners.php" hash="f3e4f0add2a4dd34a2f9850175d2d8c1"/><file name="Main.php" hash="372908671d41a36e3acc8d653ef25508"/></dir><file name="Tabs.php" hash="0bbd1e95ff227b9b3dea47df4896aaca"/></dir><file name="Edit.php" hash="d21f4789e92be2ee956d468c1301f078"/><file name="Grid.php" hash="46fcc38c036253c5174554204bb07770"/></dir><file name="Category.php" hash="5d7b4d0a98da5a5760a5ee0dd7ffcd14"/><dir name="Grid"><file name="Abstract.php" hash="2ff7abe0c35704adda90d41eaa80b38b"/></dir><dir name="Renderer"><file name="Banner.php" hash="3fc757bc4544b80c2cceccb85f5a9495"/></dir></dir><dir name="Banner"><dir name="Renderer"><file name="Abstract.php" hash="0c95b8dcc6718cece7ba1e92cfb73a04"/><file name="Flash.php" hash="3518ac7397f70e289885b1329026ecf7"/><file name="Image.php" hash="00793dd76a9b5b7bc94e643fc47ae205"/></dir></dir><dir name="Widget"><file name="Banners.php" hash="b4dbf8fecee3f04118c07482316d2f67"/></dir></dir><dir name="Controller"><dir name="Adminhtml"><file name="AbstractController.php" hash="f3001e1295876a407eb52af61a4d7228"/></dir></dir><dir name="Helper"><file name="Admin.php" hash="24f06226a48455294475be1dec8f95a8"/><file name="Data.php" hash="b04e281337d392437e58c6df452abe1c"/></dir><dir name="Model"><file name="Banner.php" hash="267f3cdd61d61d8422ec5d375591d776"/><file name="Category.php" hash="bdc1eb1c3a4f41e7203dad6ce61cd516"/><dir name="Mysql4"><dir name="Banner"><file name="Collection.php" hash="f5ee02abc66ae5196d9e58f0dfdfdb60"/></dir><file name="Banner.php" hash="3b130f81fab23450f2941a61465eb315"/><dir name="Category"><file name="Collection.php" hash="13a499e8951138bd82a4e381ffc01f9c"/></dir><file name="Category.php" hash="5cd283cc2f69699f15e31f3ce77668c2"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="BannerController.php" hash="3265afb9bd376eb1f5b7c816aeeba2cb"/><file name="CategoryController.php" hash="6330b90002bffad43e512a123f3b7fc2"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="45883fcc010c975f8dc8d59f1b551c51"/><file name="config.xml" hash="e11b1d3412ed500465d1bfdddab8a062"/><file name="system.xml" hash="14b36d1b55e5cb18ee35b93a636e4967"/><file name="widget.xml" hash="5f55fb3c9b308936c3fe2a1f7cabbd37"/></dir><dir name="sql"><dir name="lanot_easybanner_setup"><file name="mysql4-install-1.0.0.0.php" hash="186135eeadca5ed3b8590561c9dcf19b"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="lanot_easybanner.xml" hash="94542a0c03411ab9703b374407bebd17"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="lanot"><dir name="easybanner"><file name="banners.phtml" hash="6d1879f31e40c2462056852af645650f"/></dir></dir></dir></dir></dir></dir></target></contents>
23
  <compatible/>
24
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
25
  </package>