Jaljale_BannerSlider - Version 1.0.1

Version Notes

* Bugs fixes

Download this release

Release Info

Developer Krish
Extension Jaljale_BannerSlider
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

app/code/community/Jaljale/Banner/Block/Adminhtml/Renderer/Image.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ Class Jaljale_Banner_Block_Adminhtml_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ $value = $row->getData($this->getColumn()->getIndex());
7
+ return "<img height='100px' src='".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$value."' />";
8
+ }
9
+ }
10
+ ?>
app/code/community/Jaljale/Banner/Block/Adminhtml/Slider.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Jaljale_Banner_Block_Adminhtml_Slider extends Mage_Adminhtml_Block_Widget_Grid_Container{
5
+
6
+ public function __construct()
7
+ {
8
+
9
+ $this->_controller = "adminhtml_slider";
10
+ $this->_blockGroup = "banner";
11
+ $this->_headerText = Mage::helper("banner")->__("Slider Manager");
12
+ $this->_addButtonLabel = Mage::helper("banner")->__("Add New Item");
13
+ parent::__construct();
14
+
15
+ }
16
+
17
+ }
app/code/community/Jaljale/Banner/Block/Adminhtml/Slider/Edit.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jaljale_Banner_Block_Adminhtml_Slider_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+
8
+ parent::__construct();
9
+ $this->_objectId = "id";
10
+ $this->_blockGroup = "banner";
11
+ $this->_controller = "adminhtml_slider";
12
+ $this->_updateButton("save", "label", Mage::helper("banner")->__("Save Item"));
13
+ $this->_updateButton("delete", "label", Mage::helper("banner")->__("Delete Item"));
14
+
15
+ $this->_addButton("saveandcontinue", array(
16
+ "label" => Mage::helper("banner")->__("Save And Continue Edit"),
17
+ "onclick" => "saveAndContinueEdit()",
18
+ "class" => "save",
19
+ ), -100);
20
+
21
+
22
+
23
+ $this->_formScripts[] = "
24
+
25
+ function saveAndContinueEdit(){
26
+ editForm.submit($('edit_form').action+'back/edit/');
27
+ }
28
+ ";
29
+ }
30
+
31
+ public function getHeaderText()
32
+ {
33
+ if( Mage::registry("slider_data") && Mage::registry("slider_data")->getId() ){
34
+
35
+ return Mage::helper("banner")->__("Edit Item '%s'", $this->htmlEscape(Mage::registry("slider_data")->getId()));
36
+
37
+ }
38
+ else{
39
+
40
+ return Mage::helper("banner")->__("Add Item");
41
+
42
+ }
43
+ }
44
+ }
app/code/community/Jaljale/Banner/Block/Adminhtml/Slider/Edit/Form.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Banner_Block_Adminhtml_Slider_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ "id" => "edit_form",
8
+ "action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
9
+ "method" => "post",
10
+ "enctype" =>"multipart/form-data",
11
+ )
12
+ );
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+ }
app/code/community/Jaljale/Banner/Block/Adminhtml/Slider/Edit/Tab/Form.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Banner_Block_Adminhtml_Slider_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset("banner_form", array("legend"=>Mage::helper("banner")->__("Item information")));
10
+
11
+
12
+ $fieldset->addField('image_url', 'image', array(
13
+ 'label' => Mage::helper('banner')->__('Image Link'),
14
+ 'name' => 'image_url',
15
+ 'note' => '(*.jpg, *.png, *.gif)',
16
+ ));
17
+ $fieldset->addField("image_link", "text", array(
18
+ "label" => Mage::helper("banner")->__("Hyperlink"),
19
+ "name" => "image_link",
20
+ ));
21
+
22
+ $fieldset->addField("image_title", "text", array(
23
+ "label" => Mage::helper("banner")->__("Title"),
24
+ "name" => "image_title",
25
+ ));
26
+
27
+ $fieldset->addField("image_caption", "textarea", array(
28
+ "label" => Mage::helper("banner")->__("Caption"),
29
+ "name" => "image_caption",
30
+ ));
31
+
32
+ $fieldset->addField('is_active', 'select', array(
33
+ 'label' => Mage::helper('banner')->__('Is Active'),
34
+ 'values' => Jaljale_Banner_Block_Adminhtml_Slider_Grid::getValueArray6(),
35
+ 'name' => 'is_active',
36
+ "class" => "required-entry",
37
+ "required" => true,
38
+ ));
39
+
40
+ if (Mage::getSingleton("adminhtml/session")->getSliderData())
41
+ {
42
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getSliderData());
43
+ Mage::getSingleton("adminhtml/session")->setSliderData(null);
44
+ }
45
+ elseif(Mage::registry("slider_data")) {
46
+ $form->setValues(Mage::registry("slider_data")->getData());
47
+ }
48
+ return parent::_prepareForm();
49
+ }
50
+ }
app/code/community/Jaljale/Banner/Block/Adminhtml/Slider/Edit/Tabs.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Banner_Block_Adminhtml_Slider_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId("slider_tabs");
8
+ $this->setDestElementId("edit_form");
9
+ $this->setTitle(Mage::helper("banner")->__("Item Information"));
10
+ }
11
+ protected function _beforeToHtml()
12
+ {
13
+ $this->addTab("form_section", array(
14
+ "label" => Mage::helper("banner")->__("Item Information"),
15
+ "title" => Mage::helper("banner")->__("Item Information"),
16
+ "content" => $this->getLayout()->createBlock("banner/adminhtml_slider_edit_tab_form")->toHtml(),
17
+ ));
18
+ return parent::_beforeToHtml();
19
+ }
20
+
21
+ }
app/code/community/Jaljale/Banner/Block/Adminhtml/Slider/Grid.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jaljale_Banner_Block_Adminhtml_Slider_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId("sliderGrid");
10
+ $this->setDefaultSort("id");
11
+ $this->setDefaultDir("DESC");
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+
15
+ protected function _prepareCollection()
16
+ {
17
+ $collection = Mage::getModel("banner/slider")->getCollection();
18
+ $this->setCollection($collection);
19
+ return parent::_prepareCollection();
20
+ }
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn("id", array(
24
+ "header" => Mage::helper("banner")->__("ID"),
25
+ "align" =>"right",
26
+ "width" => "50px",
27
+ "type" => "number",
28
+ "index" => "id",
29
+ ));
30
+
31
+ $this->addColumn("image", array(
32
+ "header" => Mage::helper("banner")->__("Image"),
33
+ "index" => "image_url",
34
+ "renderer" => "jaljale_banner_Block_Adminhtml_Renderer_Image",
35
+ ));
36
+
37
+ $this->addColumn("image_title", array(
38
+ "header" => Mage::helper("banner")->__("Title"),
39
+ "index" => "image_title",
40
+ ));
41
+
42
+ $this->addColumn("image_link", array(
43
+ "header" => Mage::helper("banner")->__("Hyperlink"),
44
+ "index" => "image_link",
45
+ ));
46
+
47
+ $this->addColumn('is_active', array(
48
+ 'header' => Mage::helper('banner')->__('Is Active'),
49
+ 'index' => 'is_active',
50
+ 'type' => 'options',
51
+ 'options'=>Jaljale_Banner_Block_Adminhtml_Slider_Grid::getOptionArray6(),
52
+ ));
53
+
54
+
55
+ return parent::_prepareColumns();
56
+ }
57
+
58
+ public function getRowUrl($row)
59
+ {
60
+ return $this->getUrl("*/*/edit", array("id" => $row->getId()));
61
+ }
62
+
63
+
64
+
65
+ protected function _prepareMassaction()
66
+ {
67
+ $this->setMassactionIdField('id');
68
+ $this->getMassactionBlock()->setFormFieldName('ids');
69
+ $this->getMassactionBlock()->setUseSelectAll(true);
70
+
71
+ $this->getMassactionBlock()->addItem('remove_slider', array(
72
+ 'label'=> Mage::helper('banner')->__('Remove Slider'),
73
+ 'url' => $this->getUrl('*/adminhtml_slider/massRemove'),
74
+ 'confirm' => Mage::helper('banner')->__('Are you sure?')
75
+ ));
76
+
77
+ $this->getMassactionBlock()->addItem('active', array(
78
+ 'label'=> Mage::helper('banner')->__('Active Slider'),
79
+ 'url' => $this->getUrl('*/adminhtml_slider/massActive')
80
+ ));
81
+ $this->getMassactionBlock()->addItem('inactive', array(
82
+ 'label'=> Mage::helper('banner')->__('Inactive Slider'),
83
+ 'url' => $this->getUrl('*/adminhtml_slider/massInActive')
84
+ ));
85
+ return $this;
86
+ }
87
+
88
+ static public function getOptionArray6()
89
+ {
90
+ $data_array=array();
91
+ $data_array[0]='No';
92
+ $data_array[1]='Yes';
93
+ return($data_array);
94
+ }
95
+ static public function getValueArray6()
96
+ {
97
+ $data_array=array();
98
+ foreach(Jaljale_Banner_Block_Adminhtml_Slider_Grid::getOptionArray6() as $k=>$v){
99
+ $data_array[]=array('value'=>$k,'label'=>$v);
100
+ }
101
+ return($data_array);
102
+
103
+ }
104
+
105
+
106
+ }
app/code/community/Jaljale/Banner/Block/Index.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Banner_Block_Index extends Mage_Core_Block_Template{
3
+
4
+ public function getBanner(){
5
+ $collection = $this->getCollection();
6
+ $collection->setOrder('id','DESC');
7
+ $collection->addFieldToFilter('is_active','1');
8
+ return $collection;
9
+ }
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+ $collection = Mage::getModel('banner/slider')->getCollection();
14
+ $this->setCollection($collection);
15
+ }
16
+
17
+
18
+
19
+ }
app/code/community/Jaljale/Banner/Helper/Data.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Banner_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ function getImage($sliderimage){
5
+ return Mage::getBaseUrl('media')."/".$sliderimage->getData('image_url');
6
+
7
+ }
8
+ }
9
+
app/code/community/Jaljale/Banner/Model/Mysql4/Slider.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Banner_Model_Mysql4_Slider extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("banner/slider", "id");
7
+ }
8
+ }
app/code/community/Jaljale/Banner/Model/Mysql4/Slider/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Banner_Model_Mysql4_Slider_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("banner/slider");
7
+ }
8
+
9
+
10
+
11
+ }
12
+
app/code/community/Jaljale/Banner/Model/Slider.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jaljale_Banner_Model_Slider extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct(){
6
+
7
+ $this->_init("banner/slider");
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Jaljale/Banner/controllers/Adminhtml/SliderController.php ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jaljale_Banner_Adminhtml_SliderController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ protected function _initAction()
6
+ {
7
+ $this->loadLayout()->_setActiveMenu("banner/slider")->_addBreadcrumb(Mage::helper("adminhtml")->__("Slider Manager"),Mage::helper("adminhtml")->__("Slider Manager"));
8
+ return $this;
9
+ }
10
+ public function indexAction()
11
+ {
12
+ $this->_title($this->__("Banner"));
13
+ $this->_title($this->__("Manager Slider"));
14
+
15
+ $this->_initAction();
16
+ $this->renderLayout();
17
+ }
18
+ public function editAction()
19
+ {
20
+ $this->_title($this->__("Banner"));
21
+ $this->_title($this->__("Slider"));
22
+ $this->_title($this->__("Edit Item"));
23
+
24
+ $id = $this->getRequest()->getParam("id");
25
+ $model = Mage::getModel("banner/slider")->load($id);
26
+ if ($model->getId()) {
27
+ Mage::register("slider_data", $model);
28
+ $this->loadLayout();
29
+ $this->_setActiveMenu("banner/slider");
30
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Slider Manager"), Mage::helper("adminhtml")->__("Slider Manager"));
31
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Slider Description"), Mage::helper("adminhtml")->__("Slider Description"));
32
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
33
+ $this->_addContent($this->getLayout()->createBlock("banner/adminhtml_slider_edit"))->_addLeft($this->getLayout()->createBlock("banner/adminhtml_slider_edit_tabs"));
34
+ $this->renderLayout();
35
+ }
36
+ else {
37
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("banner")->__("Item does not exist."));
38
+ $this->_redirect("*/*/");
39
+ }
40
+ }
41
+
42
+ public function newAction()
43
+ {
44
+
45
+ $this->_title($this->__("Banner"));
46
+ $this->_title($this->__("Slider"));
47
+ $this->_title($this->__("New Item"));
48
+
49
+ $id = $this->getRequest()->getParam("id");
50
+ $model = Mage::getModel("banner/slider")->load($id);
51
+
52
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
53
+ if (!empty($data)) {
54
+ $model->setData($data);
55
+ }
56
+
57
+ Mage::register("slider_data", $model);
58
+
59
+ $this->loadLayout();
60
+ $this->_setActiveMenu("banner/slider");
61
+
62
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
63
+
64
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Slider Manager"), Mage::helper("adminhtml")->__("Slider Manager"));
65
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Slider Description"), Mage::helper("adminhtml")->__("Slider Description"));
66
+
67
+
68
+ $this->_addContent($this->getLayout()->createBlock("banner/adminhtml_slider_edit"))->_addLeft($this->getLayout()->createBlock("banner/adminhtml_slider_edit_tabs"));
69
+
70
+ $this->renderLayout();
71
+
72
+ }
73
+ public function saveAction()
74
+ {
75
+
76
+ $post_data=$this->getRequest()->getPost();
77
+
78
+
79
+ if ($post_data) {
80
+
81
+ try {
82
+
83
+
84
+ //save image
85
+ try{
86
+
87
+ if((bool)$post_data['image_url']['delete']==1) {
88
+
89
+ $post_data['image_url']='';
90
+
91
+ }
92
+ else {
93
+
94
+ unset($post_data['image_url']);
95
+
96
+ if (isset($_FILES)){
97
+
98
+ if ($_FILES['image_url']['name']) {
99
+
100
+ if($this->getRequest()->getParam("id")){
101
+ $model = Mage::getModel("banner/slider")->load($this->getRequest()->getParam("id"));
102
+ if($model->getData('image_url')){
103
+ $io = new Varien_Io_File();
104
+ $io->rm(Mage::getBaseDir('media').DS.implode(DS,explode('/',$model->getData('image_url'))));
105
+ }
106
+ }
107
+ $path = Mage::getBaseDir('media') . DS . 'banner' . DS .'slider'.DS;
108
+ $uploader = new Varien_File_Uploader('image_url');
109
+ $uploader->setAllowedExtensions(array('jpg','png','gif'));
110
+ $uploader->setAllowRenameFiles(false);
111
+ $uploader->setFilesDispersion(false);
112
+ $destFile = $path.$_FILES['image_url']['name'];
113
+ $filename = $uploader->getNewFileName($destFile);
114
+ $uploader->save($path, $filename);
115
+
116
+ $post_data['image_url']='banner/slider/'.$filename;
117
+ }
118
+ }
119
+ }
120
+
121
+ } catch (Exception $e) {
122
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
123
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
124
+ return;
125
+ }
126
+ //save image
127
+
128
+
129
+ $model = Mage::getModel("banner/slider")
130
+ ->addData($post_data)
131
+ ->setId($this->getRequest()->getParam("id"))
132
+ ->save();
133
+
134
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Slider was successfully saved"));
135
+ Mage::getSingleton("adminhtml/session")->setSliderData(false);
136
+
137
+ if ($this->getRequest()->getParam("back")) {
138
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
139
+ return;
140
+ }
141
+ $this->_redirect("*/*/");
142
+ return;
143
+ }
144
+ catch (Exception $e) {
145
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
146
+ Mage::getSingleton("adminhtml/session")->setSliderData($this->getRequest()->getPost());
147
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
148
+ return;
149
+ }
150
+
151
+ }
152
+ $this->_redirect("*/*/");
153
+ }
154
+
155
+
156
+
157
+ public function deleteAction()
158
+ {
159
+ if( $this->getRequest()->getParam("id") > 0 ) {
160
+ try {
161
+ $model = Mage::getModel("banner/slider");
162
+ $model->setId($this->getRequest()->getParam("id"))->delete();
163
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
164
+ $this->_redirect("*/*/");
165
+ }
166
+ catch (Exception $e) {
167
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
168
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
169
+ }
170
+ }
171
+ $this->_redirect("*/*/");
172
+ }
173
+
174
+
175
+ public function massRemoveAction()
176
+ {
177
+ try {
178
+ $ids = $this->getRequest()->getPost('ids', array());
179
+ foreach ($ids as $id) {
180
+ $model = Mage::getModel("banner/slider");
181
+ $model->setId($id)->delete();
182
+ }
183
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item(s) was successfully removed"));
184
+ }
185
+ catch (Exception $e) {
186
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
187
+ }
188
+ $this->_redirect('*/*/');
189
+ }
190
+ public function massActiveAction()
191
+ {
192
+
193
+ try {
194
+ $ids = $this->getRequest()->getPost('ids', array());
195
+ foreach ($ids as $id) {
196
+ $data = array('is_active'=>1);
197
+ $model = Mage::getModel("banner/slider")->load($id)->addData($data);
198
+ $model->setId($id)->save();
199
+ }
200
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item(s) was successfully actived"));
201
+ }
202
+ catch (Exception $e) {
203
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
204
+ }
205
+ $this->_redirect('*/*/');
206
+ }
207
+ public function massInActiveAction()
208
+ {
209
+
210
+ try {
211
+ $ids = $this->getRequest()->getPost('ids', array());
212
+ foreach ($ids as $id) {
213
+ $data = array('is_active'=>0);
214
+ $model = Mage::getModel("banner/slider")->load($id)->addData($data);
215
+ $model->setId($id)->save();
216
+ }
217
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item(s) was successfully inactived"));
218
+ }
219
+ catch (Exception $e) {
220
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
221
+ }
222
+ $this->_redirect('*/*/');
223
+ }
224
+
225
+ }
226
+
app/code/community/Jaljale/Banner/controllers/IndexController.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jaljale_Banner_IndexController extends Mage_Core_Controller_Front_Action{
3
+ public function IndexAction() {
4
+
5
+ $this->loadLayout();
6
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Titlename"));
7
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
8
+ $breadcrumbs->addCrumb("home", array(
9
+ "label" => $this->__("Home Page"),
10
+ "title" => $this->__("Home Page"),
11
+ "link" => Mage::getBaseUrl()
12
+ ));
13
+
14
+ $breadcrumbs->addCrumb("titlename", array(
15
+ "label" => $this->__("Titlename"),
16
+ "title" => $this->__("Titlename")
17
+ ));
18
+
19
+ $this->renderLayout();
20
+
21
+ }
22
+ }
app/code/community/Jaljale/Banner/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <slider translate="title" module="banner">
12
+ <title>Banner Slider Section</title>
13
+ <sort_order>0</sort_order>
14
+ </slider>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/community/Jaljale/Banner/etc/config.xml ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <default>
4
+ <slider>
5
+ <option>
6
+ <width>100%</width>
7
+ <height></height>
8
+ <loop>1</loop>
9
+ <speed>5000</speed>
10
+ <control>1</control>
11
+ <indicator>1</indicator>
12
+ </option>
13
+ </slider>
14
+ </default>
15
+ <modules>
16
+ <Jaljale_Banner>
17
+ <version>0.1.0</version>
18
+ </Jaljale_Banner>
19
+ </modules>
20
+ <frontend>
21
+ <routers>
22
+ <banner>
23
+ <use>standard</use>
24
+ <args>
25
+ <module>Jaljale_Banner</module>
26
+ <frontName>banner</frontName>
27
+ </args>
28
+ </banner>
29
+ </routers>
30
+ <layout>
31
+ <updates>
32
+ <banner>
33
+ <file>banner.xml</file>
34
+ </banner>
35
+ </updates>
36
+ </layout>
37
+ </frontend>
38
+ <global>
39
+ <helpers>
40
+ <banner>
41
+ <class>Jaljale_Banner_Helper</class>
42
+ </banner>
43
+ </helpers>
44
+ <blocks>
45
+ <banner>
46
+ <class>Jaljale_Banner_Block</class>
47
+ </banner>
48
+ </blocks>
49
+ <models>
50
+ <banner>
51
+ <class>Jaljale_Banner_Model</class>
52
+ <resourceModel>banner_mysql4</resourceModel>
53
+ </banner>
54
+ <banner_mysql4>
55
+ <class>Jaljale_Banner_Model_Mysql4</class>
56
+ <entities>
57
+ <slider>
58
+ <table>new_jaljale_banner_slider</table>
59
+ </slider>
60
+ </entities>
61
+ </banner_mysql4>
62
+ </models>
63
+ <resources>
64
+ <banner_setup>
65
+ <setup>
66
+ <module>Jaljale_Banner</module>
67
+ </setup>
68
+ <connection>
69
+ <use>core_setup</use>
70
+ </connection>
71
+ </banner_setup>
72
+ <banner_write>
73
+ <connection>
74
+ <use>core_write</use>
75
+ </connection>
76
+ </banner_write>
77
+ <banner_read>
78
+ <connection>
79
+ <use>core_read</use>
80
+ </connection>
81
+ </banner_read>
82
+ </resources>
83
+ </global>
84
+ <admin>
85
+ <routers>
86
+ <banner>
87
+ <use>admin</use>
88
+ <args>
89
+ <module>Jaljale_Banner</module>
90
+ <frontName>admin_banner</frontName>
91
+ </args>
92
+ </banner>
93
+ </routers>
94
+ </admin>
95
+ <adminhtml>
96
+ <menu>
97
+ <jaljale module="banner">
98
+ <title>Jaljale</title>
99
+ <sort_order>100</sort_order>
100
+ <children>
101
+ <slider module="banner">
102
+ <title>Manage Banner Slider</title>
103
+ <sort_order>0</sort_order>
104
+ <action>admin_banner/adminhtml_slider</action>
105
+ </slider>
106
+ </children>
107
+ </jaljale>
108
+ </menu>
109
+ <acl>
110
+ <resources>
111
+ <all>
112
+ <title>Allow Everything</title>
113
+ </all>
114
+ <admin>
115
+ <children>
116
+ <banner translate="title" module="banner">
117
+ <title>Banner</title>
118
+ <sort_order>1000</sort_order>
119
+ <children>
120
+ <slider translate="title">
121
+ <title>Manage Slider</title>
122
+ <sort_order>0</sort_order>
123
+ </slider>
124
+ </children>
125
+ </banner>
126
+ </children>
127
+ </admin>
128
+ </resources>
129
+ </acl>
130
+ <layout>
131
+ <updates>
132
+ <banner>
133
+ <file>banner.xml</file>
134
+ </banner>
135
+ </updates>
136
+ </layout>
137
+ </adminhtml>
138
+ </config>
app/code/community/Jaljale/Banner/etc/system.xml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <jaljale translate="label" module="banner">
5
+ <label>Jaljale</label>
6
+ <sort_order>0</sort_order>
7
+ </jaljale>
8
+ </tabs>
9
+ <sections>
10
+ <slider translate="label" module="banner">
11
+ <label>Banner Slider</label>
12
+ <tab>jaljale</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>1</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <option translate="label">
20
+ <label>Banner Slider Option</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>0</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <indicator translate="label">
28
+ <label>Display Indicators</label>
29
+ <frontend_type>radios</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>0</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <comment>Show/hide Indicators</comment>
36
+ </indicator>
37
+ <control translate="label">
38
+ <label>Display Controls</label>
39
+ <frontend_type>radios</frontend_type>
40
+ <source_model>adminhtml/system_config_source_yesno</source_model>
41
+ <sort_order>0</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
+ <comment>Show/hide Previous and Next buttons</comment>
46
+ </control>
47
+ <loop translate="label">
48
+ <label>Loop</label>
49
+ <frontend_type>radios</frontend_type>
50
+ <source_model>adminhtml/system_config_source_yesno</source_model>
51
+ <sort_order>0</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <comment>Whether the carousel should cycle continuously or have hard stops.</comment>
56
+ </loop>
57
+ <speed translate="label">
58
+ <label>Transaction Interval</label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>0</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ <comment>In milisecs (Default 5000)</comment>
65
+ </speed>
66
+ <width translate="label">
67
+ <label>Banner Width</label>
68
+ <frontend_type>text</frontend_type>
69
+ <sort_order>0</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>1</show_in_website>
72
+ <show_in_store>1</show_in_store>
73
+ <comment>Banner Width (Default 100%)</comment>
74
+ </width>
75
+ <height translate="label">
76
+ <label>Banner Height</label>
77
+ <frontend_type>text</frontend_type>
78
+ <sort_order>0</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ <comment>Banner Height (Default auto)</comment>
83
+ </height>
84
+ </fields>
85
+ </option>
86
+ </groups>
87
+ </slider>
88
+ </sections>
89
+ </config>
app/code/community/Jaljale/Banner/sql/banner_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $sql=<<<SQLTEXT
5
+ CREATE TABLE IF NOT EXISTS `new_jaljale_banner_slider` (`id` int(11) NOT NULL AUTO_INCREMENT,`image_url` varchar(250) DEFAULT NULL,`image_link` varchar(250) DEFAULT NULL,`image_title` varchar(250) DEFAULT NULL,`image_caption` varchar(250) DEFAULT NULL,`is_active` varchar(5) DEFAULT NULL, PRIMARY KEY (`id`))
6
+ SQLTEXT;
7
+
8
+ $installer->run($sql);
9
+ //demo
10
+ //Mage::getModel('core/url_rewrite')->setId(null);
11
+ //demo
12
+ $installer->endSetup();
13
+
app/design/adminhtml/default/default/layout/banner.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <banner_adminhtml_slider_index>
4
+ <reference name="content">
5
+ <block type="banner/adminhtml_slider" name="slider" />
6
+ </reference>
7
+ </banner_adminhtml_slider_index>
8
+ </layout>
app/design/frontend/base/default/layout/banner.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <banner_index_index>
4
+ <reference name="root">
5
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
6
+ </reference>
7
+ <reference name="content">
8
+ <block type="banner/index" name="banner_index" template="banner/index.phtml"/>
9
+ </reference>
10
+ </banner_index_index>
11
+ </layout>
12
+
app/design/frontend/base/default/template/banner/index.phtml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $height = Mage::getStoreConfig('slider/option/height');
4
+
5
+ $width = Mage::getStoreConfig('slider/option/width');
6
+
7
+ $speed = Mage::getStoreConfig('slider/option/speed');
8
+
9
+ $loop = Mage::getStoreConfig('slider/option/loop');
10
+ $loop = $loop == 0 ? 'false' : 'true';
11
+
12
+ $indicator = Mage::getStoreConfig('slider/option/indicator');
13
+ $indicator = $indicator == 0 ? 'none' : '';
14
+
15
+ $control = Mage::getStoreConfig('slider/option/control');
16
+ $control = $control == 0 ? 'none' : '';
17
+ ?>
18
+
19
+
20
+
21
+ <div class="container-fluid clearfix">
22
+ <div class="row">
23
+ <div class="col-sm-12" style="padding: 0px;">
24
+ <div class="slides">
25
+ <div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="<?php echo $speed; ?>" data-wrap="<?php echo $loop; ?>" style="width:<?php echo $width; ?>">
26
+ <?php $collection = $this->getBanner(); ?>
27
+
28
+ <ol class='carousel-indicators' style="display:<?php echo $indicator; ?>">
29
+ <?php
30
+ for($i=0;$i<$collection->count();$i++)
31
+ echo "<li data-target='#carousel-example-generic' data-slide-to='".$i."'></li>";
32
+ ?>
33
+ </ol>
34
+ <div class="carousel-inner">
35
+ <?php
36
+ foreach($collection as $item)
37
+ {
38
+ ?>
39
+ <div class="item"><img style="width: 100%; overflow: hidden;" src="<?php echo Mage::helper('banner')->getImage($item) ?>" alt="..." />
40
+ <div class="carousel-caption">
41
+ <h1><?php echo $item->getData('image_title'); ?></h1>
42
+ <p><?php echo $item->getData('image_caption'); ?></p>
43
+ <a href="<?php echo $item->getData('image_link'); ?>" class="button">BROWSE&lt; </a>
44
+ </div>
45
+ </div>
46
+ <?php
47
+ }
48
+ ?>
49
+ </div>
50
+ <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev" style="display:<?php echo $control; ?>">
51
+ <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
52
+ <span class="sr-only">Previous</span>
53
+ </a>
54
+ <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next" style="display:<?php echo $control; ?>">
55
+ <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
56
+ <span class="sr-only">Next</span>
57
+ </a>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ <script type="text/javascript">
64
+ jQuery(document).ready(function(){
65
+ jQuery('.carousel-inner .item').first().addClass('active');
66
+ jQuery(".carousel-indicators li").first().addClass('active');
67
+ });
68
+
69
+ </script>
package.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Jaljale_BannerSlider</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Responsive Bannerslider allows displaying custom slide show in home. Built on top of Bootstrap, it is highly customizable, user friendly and easy to use. It&#x2019;s designed and developed with responsive design. Hence, it supports different devices - Mobile, Tablet and Computers. Admin can manage the complete slideshow from the module management including images upload, update, delete.</summary>
10
+ <description>Features: &#xD;
11
+ &#xD;
12
+ * Fully dynamic and fully responsive on all mobile devices and screen size (ie mobile, tablets, desktop etc) &#xD;
13
+ * All modern browsers supported including IE7+ , Firefox , Safari and Chrome .&#xD;
14
+ * Silk effect, no Flash needed fully based on JavaScript .&#xD;
15
+ * Admin Driven module, user can add any no of images/slides&#xD;
16
+ * Easy to install, just move your app folder in Magento root folder.&#xD;
17
+ * Adjust width, height and transaction speed as per your need.&#xD;
18
+ * No programming skills required&#xD;
19
+ * Easy to install and configure</description>
20
+ <notes>* Bugs fixes</notes>
21
+ <authors><author><name>Krish</name><user>jaljale</user><email>jaljaletech@gmail.com</email></author><author><name>Subin Shrestha</name><user>sthasbin</user><email>sthasbin@jaljale.com</email></author></authors>
22
+ <date>2015-06-15</date>
23
+ <time>11:47:03</time>
24
+ <contents><target name="magecommunity"><dir name="Jaljale"><dir name="Banner"><dir name="Block"><dir name="Adminhtml"><dir name="Renderer"><file name="Image.php" hash="7bb70eb455f34a84181a39e40345e665"/></dir><dir name="Slider"><dir name="Edit"><file name="Form.php" hash="a4cf7a964dfca2d19c800e377e8acff6"/><dir name="Tab"><file name="Form.php" hash="ca46e0999a38910e4a15ba3174989599"/></dir><file name="Tabs.php" hash="0537a954a8efdf7895065d3bbff91856"/></dir><file name="Edit.php" hash="c660e27dc4ab9b066c11fe82d2d107e9"/><file name="Grid.php" hash="e65d4fd78df111b197af34daa5806707"/></dir><file name="Slider.php" hash="abc575434e4309dfc283081adc4a9423"/></dir><file name="Index.php" hash="4a7c4c98f6bb7ba4a9d80ec133af2a62"/></dir><dir name="Helper"><file name="Data.php" hash="15796a916f850baddbb650b844aa4a4a"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Slider"><file name="Collection.php" hash="b004d75dc64b2f6f0f37a8a5cfe946c0"/></dir><file name="Slider.php" hash="d535791ff1739cc3a7559914d2930916"/></dir><file name="Slider.php" hash="f5eb593cc610e960dfb8c4c231d9de7e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SliderController.php" hash="6c893bbbde1f780a5c2a9f7cfa9b0817"/></dir><file name="IndexController.php" hash="2380b268175b38e716aca991478bfe29"/></dir><dir name="etc"><file name="adminhtml.xml" hash="20ac41122a127136472f536d15cca456"/><file name="config.xml" hash="fb3b8bf0e538783bcd92ab5d6a91fba7"/><file name="system.xml" hash="090e543483af372c5e684663535d80a0"/></dir><dir name="sql"><dir name="banner_setup"><file name="mysql4-install-0.1.0.php" hash="24f54bfd573f9102dcc5e6bb2d4dd66c"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="banner.xml" hash="c0ef7852090bd32f729229adfb8ecae9"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="banner"><file name="index.phtml" hash="2983aae1f32bb9189ee6433ec40692de"/></dir></dir><dir name="layout"><file name="banner.xml" hash="b92d37f8295ff1884be5c9008c830259"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="jaljale_banner.xml" hash=""/></dir></target></contents>
25
+ <compatible/>
26
+ <dependencies><required><php><min>5.1.3</min><max>6.5.5</max></php></required></dependencies>
27
+ </package>