Version Notes
All features are configurable from admin like width, height, auto slideshow, display next previous arrow, show caption, show navigation images, max number of slides to display, display slide content, time between two slides.
Download this release
Release Info
Developer | Etatvasoft |
Extension | Etatvasoft_Dynamic_Image_Slider |
Version | 1.5.6 |
Comparing to | |
See all releases |
Code changes from version 1.5.5 to 1.5.6
- app/code/local/Tatva/Slider/Block/Adminhtml/Slider/Edit/Tab/Form.php +2 -1
- app/code/local/Tatva/Slider/Model/Observer.php +42 -0
- app/code/local/Tatva/Slider/controllers/Adminhtml/SliderController.php +151 -119
- app/code/local/Tatva/Slider/etc/adminhtml.xml +1 -1
- app/code/local/Tatva/Slider/etc/config.xml +13 -3
- app/code/local/Tatva/Slider/etc/system.xml +0 -9
- app/design/frontend/default/default/template/slider/slider.phtml +6 -6
- package.xml +4 -4
app/code/local/Tatva/Slider/Block/Adminhtml/Slider/Edit/Tab/Form.php
CHANGED
@@ -22,7 +22,7 @@ class Tatva_Slider_Block_Adminhtml_Slider_Edit_Tab_Form extends Mage_Adminhtml_B
|
|
22 |
$after_html = '';
|
23 |
if( $slider->getFilename() )
|
24 |
{
|
25 |
-
$path = Mage::getBaseUrl('media')."customerslider/".$slider->getFilename();
|
26 |
$after_html = '<a onclick="imagePreview(slider); return false;" href="'.$path.'">
|
27 |
<img height="22" width="22" class="small-image-preview v-middle" alt="'.$slider->getFilename().'" title="'.$slider->getFilename().'" id="slider" src="'.$path.'"/>
|
28 |
</a>';
|
@@ -47,6 +47,7 @@ class Tatva_Slider_Block_Adminhtml_Slider_Edit_Tab_Form extends Mage_Adminhtml_B
|
|
47 |
'after_element_html' => $after_html,
|
48 |
'class' => (($slider->getfilename()) ? '' : 'required-entry'),
|
49 |
'required' => (($slider->getfilename()) ? false : true),
|
|
|
50 |
));
|
51 |
|
52 |
/**
|
22 |
$after_html = '';
|
23 |
if( $slider->getFilename() )
|
24 |
{
|
25 |
+
$path = Mage::getBaseUrl('media')."customerslider/original/".$slider->getFilename();
|
26 |
$after_html = '<a onclick="imagePreview(slider); return false;" href="'.$path.'">
|
27 |
<img height="22" width="22" class="small-image-preview v-middle" alt="'.$slider->getFilename().'" title="'.$slider->getFilename().'" id="slider" src="'.$path.'"/>
|
28 |
</a>';
|
47 |
'after_element_html' => $after_html,
|
48 |
'class' => (($slider->getfilename()) ? '' : 'required-entry'),
|
49 |
'required' => (($slider->getfilename()) ? false : true),
|
50 |
+
'note' => Mage::helper('slider')->__('Upload upto 5 MB'),
|
51 |
));
|
52 |
|
53 |
/**
|
app/code/local/Tatva/Slider/Model/Observer.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tatva_Slider_Model_Observer extends Varien_Event_Observer
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
}
|
7 |
+
public function saveCmsPageObserve($observer){
|
8 |
+
$filePath=Mage::getBaseDir('media').DS."customerslider".DS."original".DS;
|
9 |
+
$dir = opendir($filePath);
|
10 |
+
while ($file = readdir($dir)){
|
11 |
+
if (eregi("\.png",$file) || eregi("\.jpg",$file) || eregi("\.gif",$file) ){
|
12 |
+
$string[] = $file;
|
13 |
+
}
|
14 |
+
}
|
15 |
+
$resized_image_width = Mage::getStoreConfig('slider/slider/imagewidth');
|
16 |
+
$resized_image_height = Mage::getStoreConfig('slider/slider/imageheight');
|
17 |
+
$first_image = Mage::getBaseDir('media').DS."customerslider".DS."slider".DS.$string[0];
|
18 |
+
list($width, $height, $type, $attr) = getimagesize($first_image);
|
19 |
+
if($width != $resized_image_width || $height != $resized_image_height){
|
20 |
+
foreach($string as $value){
|
21 |
+
$imageUrl = Mage::getBaseDir('media').DS."customerslider".DS."original".DS.$value;
|
22 |
+
$thumbnail_imageUrl = Mage::getBaseDir('media').DS."customerslider".DS."thumbnail".DS.$value;
|
23 |
+
$slider_imageUrl = Mage::getBaseDir('media').DS."customerslider".DS."slider".DS.$value;
|
24 |
+
if($width != $resized_image_width || $height!=$resized_image_height ){
|
25 |
+
$imageObj = new Varien_Image($imageUrl);
|
26 |
+
$imageObj->constrainOnly(TRUE);
|
27 |
+
$imageObj->keepAspectRatio(TRUE);
|
28 |
+
$imageObj->keepFrame(FALSE);
|
29 |
+
$imageObj->resize(100, 100);
|
30 |
+
$imageObj->save($thumbnail_imageUrl);
|
31 |
+
|
32 |
+
$sliderimageObj = new Varien_Image($imageUrl);
|
33 |
+
$sliderimageObj->constrainOnly(TRUE);
|
34 |
+
$sliderimageObj->keepFrame(FALSE);
|
35 |
+
$sliderimageObj->resize($resized_image_width, $resized_image_height);
|
36 |
+
$sliderimageObj->save($slider_imageUrl);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
?>
|
app/code/local/Tatva/Slider/controllers/Adminhtml/SliderController.php
CHANGED
@@ -7,10 +7,10 @@ class Tatva_Slider_Adminhtml_SliderController extends Mage_Adminhtml_Controller_
|
|
7 |
$this->loadLayout()
|
8 |
->_setActiveMenu('slider/items')
|
9 |
->_addBreadcrumb(Mage::helper('adminhtml')->__('Slider Manager'), Mage::helper('adminhtml')->__('Slider Manager'));
|
10 |
-
|
11 |
return $this;
|
12 |
}
|
13 |
-
|
14 |
public function indexAction() {
|
15 |
$this->_initAction()
|
16 |
->renderLayout();
|
@@ -50,128 +50,145 @@ class Tatva_Slider_Adminhtml_SliderController extends Mage_Adminhtml_Controller_
|
|
50 |
$this->_forward('edit');
|
51 |
}
|
52 |
|
53 |
-
public function saveAction()
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
}
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
-
|
90 |
-
|
91 |
-
try
|
92 |
-
{
|
93 |
-
$date = date('Ymdhis');
|
94 |
-
/* Starting upload */
|
95 |
-
$uploader = new Varien_File_Uploader('filename');
|
96 |
-
|
97 |
-
// Any extention would work
|
98 |
-
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
99 |
-
$uploader->setAllowRenameFiles(false);
|
100 |
-
|
101 |
-
// Set the file upload mode
|
102 |
-
// false -> get the file directly in the specified folder
|
103 |
-
// true -> get the file in the product like folders (file.jpg will go in something like /media/f/i/file.jpg)
|
104 |
-
$uploader->setFilesDispersion(false);
|
105 |
-
|
106 |
-
$filedet = pathinfo($_FILES['filename']['name']);
|
107 |
-
|
108 |
-
// We set media as the upload dir
|
109 |
-
$path = Mage::getBaseDir('media').DS.'customerslider'.DS;
|
110 |
-
$uploader->save($path, $filedet['filename'].$date.'.'.$filedet['extension'] );
|
111 |
-
|
112 |
-
// actual path of image
|
113 |
-
$imageUrl = Mage::getBaseDir('media').DS."customerslider".DS.$filedet['filename'].$date.'.'.$filedet['extension'];
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
118 |
|
119 |
-
// resize image only if the image file exists and the resized image file doesn't exist
|
120 |
-
// the image is resized proportionally with the width/height 135px
|
121 |
-
if (!file_exists($imageResized)&&file_exists($imageUrl))
|
122 |
-
{
|
123 |
-
$imageObj = new Varien_Image($imageUrl);
|
124 |
-
$imageObj->constrainOnly(TRUE);
|
125 |
-
$imageObj->keepAspectRatio(TRUE);
|
126 |
-
$imageObj->keepFrame(FALSE);
|
127 |
-
$imageObj->resize(100, 100);
|
128 |
-
$imageObj->save($imageResized);
|
129 |
-
}
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
-
$model = Mage::getModel('slider/slider');
|
140 |
-
$model->setData($data)
|
141 |
-
->setId($this->getRequest()->getParam('id'));
|
142 |
-
|
143 |
-
try
|
144 |
-
{
|
145 |
-
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
146 |
-
$model->setCreatedTime(now())
|
147 |
-
->setUpdateTime(now());
|
148 |
-
} else {
|
149 |
-
$model->setUpdateTime(now());
|
150 |
-
}
|
151 |
-
|
152 |
-
$model->save();
|
153 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('slider')->__('Slide was successfully saved'));
|
154 |
-
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
155 |
-
|
156 |
-
if ($this->getRequest()->getParam('back')) {
|
157 |
-
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
158 |
-
return;
|
159 |
-
}
|
160 |
-
$this->_redirect('*/*/');
|
161 |
-
return;
|
162 |
-
}
|
163 |
-
catch (Exception $e)
|
164 |
-
{
|
165 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
166 |
-
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
167 |
-
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
168 |
-
return;
|
169 |
-
}
|
170 |
-
}
|
171 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('slider')->__('Unable to find item to save'));
|
172 |
-
$this->_redirect('*/*/');
|
173 |
-
}
|
174 |
-
|
175 |
public function deleteAction()
|
176 |
{
|
177 |
if( $this->getRequest()->getParam('id') > 0 )
|
@@ -181,14 +198,16 @@ class Tatva_Slider_Adminhtml_SliderController extends Mage_Adminhtml_Controller_
|
|
181 |
$model = Mage::getModel('slider/slider')->load($this->getRequest()->getParam('id'));
|
182 |
if($model->getfilename() != "")
|
183 |
{
|
184 |
-
$imageUrl = Mage::getBaseDir('media').DS."customerslider".DS.$model->getfilename();
|
185 |
|
186 |
// path of the resized image to be saved
|
187 |
// here, the resized image is saved in media/resized folder
|
|
|
188 |
$imageResized = Mage::getBaseDir('media').DS."customerslider".DS."thumbnail".DS.$model->getfilename();
|
189 |
|
190 |
if(file_exists($imageUrl))
|
191 |
{
|
|
|
192 |
unlink($imageUrl);
|
193 |
unlink($imageResized);
|
194 |
}
|
@@ -196,7 +215,7 @@ class Tatva_Slider_Adminhtml_SliderController extends Mage_Adminhtml_Controller_
|
|
196 |
|
197 |
$model->setId($this->getRequest()->getParam('id'))
|
198 |
->delete();
|
199 |
-
|
200 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Slide was successfully deleted'));
|
201 |
$this->_redirect('*/*/');
|
202 |
}
|
@@ -219,6 +238,19 @@ class Tatva_Slider_Adminhtml_SliderController extends Mage_Adminhtml_Controller_
|
|
219 |
foreach ($sliderIds as $sliderId) {
|
220 |
$slider = Mage::getModel('slider/slider')->load($sliderId);
|
221 |
$slider->delete();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
223 |
Mage::getSingleton('adminhtml/session')->addSuccess(
|
224 |
Mage::helper('adminhtml')->__(
|
7 |
$this->loadLayout()
|
8 |
->_setActiveMenu('slider/items')
|
9 |
->_addBreadcrumb(Mage::helper('adminhtml')->__('Slider Manager'), Mage::helper('adminhtml')->__('Slider Manager'));
|
10 |
+
|
11 |
return $this;
|
12 |
}
|
13 |
+
|
14 |
public function indexAction() {
|
15 |
$this->_initAction()
|
16 |
->renderLayout();
|
50 |
$this->_forward('edit');
|
51 |
}
|
52 |
|
53 |
+
public function saveAction(){
|
54 |
+
//5MB =5242880 bytes
|
55 |
+
if($_FILES['filename']['size']>5242880){
|
56 |
+
$data = $this->getRequest()->getPost();
|
57 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('slider')->__('File size exceeded'));
|
58 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
59 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
60 |
+
return;
|
61 |
+
}
|
62 |
+
else{
|
63 |
+
if ($data = $this->getRequest()->getPost()){
|
64 |
+
$collection = Mage::getModel('slider/slider')->getCollection();
|
65 |
+
$collection->addFieldToFilter('title',$data['title']);
|
66 |
+
if($this->getRequest()->getParam('id')){
|
67 |
+
$collection->addFieldToFilter('slider_id',array('neq' => $this->getRequest()->getParam('id')));
|
68 |
+
}
|
69 |
|
70 |
+
if($collection->getData()){
|
71 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('slider')->__('Slider with same title "%s" already exist.', $data['title']));
|
72 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
73 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
74 |
+
return;
|
75 |
+
}
|
|
|
76 |
|
77 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '')
|
78 |
+
{
|
79 |
+
if( $this->getRequest()->getParam('id') > 0 ){
|
80 |
+
$model = Mage::getModel('slider/slider')->load($this->getRequest()->getParam('id'));
|
81 |
+
if($model->getfilename() != ""){
|
82 |
+
$imageUrl = Mage::getBaseDir('media').DS."customerslider".DS."original".DS.$model->getfilename();
|
83 |
+
$imageResized = Mage::getBaseDir('media').DS."customerslider".DS."thumbnail".DS.$model->getfilename();
|
84 |
+
$imageSliderResized = Mage::getBaseDir('media').DS."customerslider".DS."slider".DS.$model->getfilename();
|
85 |
+
|
86 |
+
if(file_exists($imageUrl)){
|
87 |
+
unlink($imageUrl);
|
88 |
+
unlink($imageResized);
|
89 |
+
unlink($imageSliderResized);
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
try{
|
94 |
+
$date = date('Ymdhis');
|
95 |
+
$uploader = new Varien_File_Uploader('filename');
|
96 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
97 |
+
|
98 |
+
$uploader->setAllowRenameFiles(false);
|
99 |
+
|
100 |
+
// Set the file upload mode
|
101 |
+
// false -> get the file directly in the specified folder
|
102 |
+
// true -> get the file in the product like folders (file.jpg will go in something like /media/f/i/file.jpg)
|
103 |
+
$uploader->setFilesDispersion(false);
|
104 |
+
|
105 |
+
$filedet = pathinfo($_FILES['filename']['name']);
|
106 |
+
|
107 |
+
// We set media as the upload dir
|
108 |
+
$path = Mage::getBaseDir('media').DS.'customerslider'.DS.'original'.DS;
|
109 |
+
$uploader->save($path, $filedet['filename'].$date.'.'.$filedet['extension'] );
|
110 |
+
$original_image_path = $path.$filedet['filename'].$date.'.'.$filedet['extension'];
|
111 |
+
list($original_image_width, $original_image_height, $type, $attr) = getimagesize($original_image_path);
|
112 |
+
// actual path of image
|
113 |
+
$imageUrl = Mage::getBaseDir('media').DS."customerslider".DS."original".DS.$filedet['filename'].$date.'.'.$filedet['extension'];
|
114 |
+
$file = $filedet['filename'].$date.'.'.$filedet['extension'];
|
115 |
+
// path of the resized image to be saved
|
116 |
+
// here, the resized image is saved in media/resized folder
|
117 |
+
|
118 |
+
|
119 |
+
$thumbnail_imageUrl = Mage::getBaseDir('media').DS."customerslider".DS."thumbnail".DS.$file;
|
120 |
+
$slider_imageUrl = Mage::getBaseDir('media').DS."customerslider".DS."slider".DS.$file;
|
121 |
+
|
122 |
+
// resize image only if the image file exists and the resized image file doesn't exist
|
123 |
+
// the image is resized proportionally with the width/height 135px
|
124 |
+
if(file_exists($imageUrl)){
|
125 |
+
$imageObj = new Varien_Image($imageUrl);
|
126 |
+
$imageObj->constrainOnly(TRUE);
|
127 |
+
$imageObj->keepAspectRatio(TRUE);
|
128 |
+
$imageObj->keepFrame(FALSE);
|
129 |
+
$imageObj->resize(100, 100);
|
130 |
+
$imageObj->save($thumbnail_imageUrl);
|
131 |
+
|
132 |
+
$resized_image_width = Mage::getStoreConfig('slider/slider/imagewidth');
|
133 |
+
$resized_image_height = Mage::getStoreConfig('slider/slider/imageheight');
|
134 |
+
|
135 |
+
$imageObjCustom = new Varien_Image($imageUrl);
|
136 |
+
if($original_image_width!=$resized_image_width || $original_image_height!=$resized_image_height){
|
137 |
+
$imageObjCustom->constrainOnly(TRUE);
|
138 |
+
$imageObjCustom->keepFrame(FALSE);
|
139 |
+
$imageObjCustom->resize($resized_image_width, $resized_image_height);
|
140 |
+
$imageObjCustom->save($slider_imageUrl);
|
141 |
+
}
|
142 |
+
else{
|
143 |
+
$imageObjCustom->save($slider_imageUrl);
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
}
|
148 |
}
|
149 |
+
catch (Exception $e){
|
150 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
+
//this way the name is saved in DB
|
153 |
+
$data['filename'] = $filedet['filename'].$date.'.'.$filedet['extension'];
|
154 |
+
}
|
155 |
+
}
|
156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
+
$model = Mage::getModel('slider/slider');
|
159 |
+
$model->setData($data)
|
160 |
+
->setId($this->getRequest()->getParam('id'));
|
161 |
+
|
162 |
+
try{
|
163 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
164 |
+
$model->setCreatedTime(now())
|
165 |
+
->setUpdateTime(now());
|
166 |
+
} else {
|
167 |
+
$model->setUpdateTime(now());
|
168 |
+
}
|
169 |
+
$model->save();
|
170 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('slider')->__('Slide was successfully saved'));
|
171 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
172 |
+
|
173 |
+
if ($this->getRequest()->getParam('back')) {
|
174 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
175 |
+
return;
|
176 |
+
}
|
177 |
+
$this->_redirect('*/*/');
|
178 |
+
return;
|
179 |
+
}
|
180 |
+
catch (Exception $e)
|
181 |
+
{
|
182 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
183 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
184 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
185 |
+
return;
|
186 |
+
}
|
187 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('slider')->__('Unable to find item to save'));
|
188 |
+
$this->_redirect('*/*/');
|
189 |
+
}
|
190 |
+
}
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
public function deleteAction()
|
193 |
{
|
194 |
if( $this->getRequest()->getParam('id') > 0 )
|
198 |
$model = Mage::getModel('slider/slider')->load($this->getRequest()->getParam('id'));
|
199 |
if($model->getfilename() != "")
|
200 |
{
|
201 |
+
$imageUrl = Mage::getBaseDir('media').DS."customerslider".DS."original".DS.$model->getfilename();
|
202 |
|
203 |
// path of the resized image to be saved
|
204 |
// here, the resized image is saved in media/resized folder
|
205 |
+
$imageSlider = Mage::getBaseDir('media').DS."customerslider".DS."slider".DS.$model->getfilename();
|
206 |
$imageResized = Mage::getBaseDir('media').DS."customerslider".DS."thumbnail".DS.$model->getfilename();
|
207 |
|
208 |
if(file_exists($imageUrl))
|
209 |
{
|
210 |
+
unlink($imageSlider);
|
211 |
unlink($imageUrl);
|
212 |
unlink($imageResized);
|
213 |
}
|
215 |
|
216 |
$model->setId($this->getRequest()->getParam('id'))
|
217 |
->delete();
|
218 |
+
|
219 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Slide was successfully deleted'));
|
220 |
$this->_redirect('*/*/');
|
221 |
}
|
238 |
foreach ($sliderIds as $sliderId) {
|
239 |
$slider = Mage::getModel('slider/slider')->load($sliderId);
|
240 |
$slider->delete();
|
241 |
+
$imageUrl = Mage::getBaseDir('media').DS."customerslider".DS."original".DS.$slider->getfilename();
|
242 |
+
|
243 |
+
// path of the resized image to be saved
|
244 |
+
// here, the resized image is saved in media/resized folder
|
245 |
+
$imageSlider = Mage::getBaseDir('media').DS."customerslider".DS."slider".DS.$slider->getfilename();
|
246 |
+
$imageResized = Mage::getBaseDir('media').DS."customerslider".DS."thumbnail".DS.$slider->getfilename();
|
247 |
+
|
248 |
+
if(file_exists($imageUrl))
|
249 |
+
{
|
250 |
+
unlink($imageSlider);
|
251 |
+
unlink($imageUrl);
|
252 |
+
unlink($imageResized);
|
253 |
+
}
|
254 |
}
|
255 |
Mage::getSingleton('adminhtml/session')->addSuccess(
|
256 |
Mage::helper('adminhtml')->__(
|
app/code/local/Tatva/Slider/etc/adminhtml.xml
CHANGED
@@ -36,7 +36,7 @@
|
|
36 |
<config>
|
37 |
<children>
|
38 |
<slider translate="title" module="slider">
|
39 |
-
<title>
|
40 |
</slider>
|
41 |
</children>
|
42 |
</config>
|
36 |
<config>
|
37 |
<children>
|
38 |
<slider translate="title" module="slider">
|
39 |
+
<title>Slider</title>
|
40 |
</slider>
|
41 |
</children>
|
42 |
</config>
|
app/code/local/Tatva/Slider/etc/config.xml
CHANGED
@@ -34,7 +34,7 @@
|
|
34 |
</slider>
|
35 |
</routers>
|
36 |
</admin>
|
37 |
-
|
38 |
<menu>
|
39 |
<slider module="slider">
|
40 |
<title>Slider</title>
|
@@ -88,8 +88,19 @@
|
|
88 |
</slider>
|
89 |
</updates>
|
90 |
</layout>
|
91 |
-
</adminhtml
|
92 |
<global>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
<models>
|
94 |
<slider>
|
95 |
<class>Tatva_Slider_Model</class>
|
@@ -153,7 +164,6 @@
|
|
153 |
<imagewidth>900</imagewidth>
|
154 |
<imageheight>450</imageheight>
|
155 |
<left>740</left>
|
156 |
-
<top>370</top>
|
157 |
</slider>
|
158 |
</slider>
|
159 |
</default>
|
34 |
</slider>
|
35 |
</routers>
|
36 |
</admin>
|
37 |
+
<adminhtml>
|
38 |
<menu>
|
39 |
<slider module="slider">
|
40 |
<title>Slider</title>
|
88 |
</slider>
|
89 |
</updates>
|
90 |
</layout>
|
91 |
+
</adminhtml>
|
92 |
<global>
|
93 |
+
<events>
|
94 |
+
<admin_system_config_changed_section_slider>
|
95 |
+
<observers>
|
96 |
+
<Tatva_Slider_Model_Observer>
|
97 |
+
<type>model</type>
|
98 |
+
<class>Tatva_Slider_Model_Observer</class>
|
99 |
+
<method>saveCmsPageObserve</method>
|
100 |
+
</Tatva_Slider_Model_Observer>
|
101 |
+
</observers>
|
102 |
+
</admin_system_config_changed_section_slider>
|
103 |
+
</events>
|
104 |
<models>
|
105 |
<slider>
|
106 |
<class>Tatva_Slider_Model</class>
|
164 |
<imagewidth>900</imagewidth>
|
165 |
<imageheight>450</imageheight>
|
166 |
<left>740</left>
|
|
|
167 |
</slider>
|
168 |
</slider>
|
169 |
</default>
|
app/code/local/Tatva/Slider/etc/system.xml
CHANGED
@@ -134,15 +134,6 @@
|
|
134 |
<show_in_website>1</show_in_website>
|
135 |
<show_in_store>1</show_in_store>
|
136 |
</left>
|
137 |
-
<top translate="label" module="slider">
|
138 |
-
<label>Top Position For Squares</label>
|
139 |
-
<frontend_type>text</frontend_type>
|
140 |
-
<validate>validate-digits validate-greater-than-zero</validate>
|
141 |
-
<sort_order>13</sort_order>
|
142 |
-
<show_in_default>1</show_in_default>
|
143 |
-
<show_in_website>1</show_in_website>
|
144 |
-
<show_in_store>1</show_in_store>
|
145 |
-
</top>
|
146 |
</fields>
|
147 |
</slider>
|
148 |
</groups>
|
134 |
<show_in_website>1</show_in_website>
|
135 |
<show_in_store>1</show_in_store>
|
136 |
</left>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
</fields>
|
138 |
</slider>
|
139 |
</groups>
|
app/design/frontend/default/default/template/slider/slider.phtml
CHANGED
@@ -13,7 +13,6 @@
|
|
13 |
$content = Mage::getStoreConfig('slider/slider/content') ? Mage::getStoreConfig('slider/slider/content') : false;
|
14 |
$auto = Mage::getStoreConfig('slider/slider/auto') ? Mage::getStoreConfig('slider/slider/time') : 0;
|
15 |
$left = Mage::getStoreConfig('slider/slider/left') ? Mage::getStoreConfig('slider/slider/left') : 590;
|
16 |
-
$top = Mage::getStoreConfig('slider/slider/top') ? Mage::getStoreConfig('slider/slider/top') : 370;
|
17 |
$left = ($left > $width) ? 590 : $left;
|
18 |
if(!$content)
|
19 |
{
|
@@ -110,7 +109,7 @@
|
|
110 |
<a href="<?php echo $item->getSliderUrl() ?>" target="_blank">
|
111 |
<?php } ?>
|
112 |
<img src="<?php echo Mage::getBaseUrl('media') . 'customerslider/slider/' . $item->getFilename(); ?>" height="<?php echo $imageheight?>" width="<?php echo $imagewidth?>"/>
|
113 |
-
<?php if($item->getSliderUrl()){ ?>
|
114 |
</a>
|
115 |
<?php } ?>
|
116 |
<?php if($content) { ?>
|
@@ -126,10 +125,8 @@
|
|
126 |
</ul>
|
127 |
</div>
|
128 |
</div>
|
129 |
-
|
130 |
-
|
131 |
-
<?php if($square) { ?>
|
132 |
-
<ul id="primopiano_menu" style="left: <?php echo $left?>px; top:<?php echo $top?>px;">
|
133 |
<?php $i=1;foreach($slider as $item):?>
|
134 |
<li id="link_primopiano_<?php echo $i?>">
|
135 |
<a rel="<?php echo $i?>" href="#"> </a>
|
@@ -137,6 +134,9 @@
|
|
137 |
<?php $i++;endforeach;?>
|
138 |
</ul>
|
139 |
<?php } ?>
|
|
|
|
|
|
|
140 |
<?php if($title) { ?>
|
141 |
<div class="paging banscrollbg" id="mygaltop" style="width: <?php echo ($width-12) ;?>px;">
|
142 |
<ul id="gooeymenu" class="solidblockmenu">
|
13 |
$content = Mage::getStoreConfig('slider/slider/content') ? Mage::getStoreConfig('slider/slider/content') : false;
|
14 |
$auto = Mage::getStoreConfig('slider/slider/auto') ? Mage::getStoreConfig('slider/slider/time') : 0;
|
15 |
$left = Mage::getStoreConfig('slider/slider/left') ? Mage::getStoreConfig('slider/slider/left') : 590;
|
|
|
16 |
$left = ($left > $width) ? 590 : $left;
|
17 |
if(!$content)
|
18 |
{
|
109 |
<a href="<?php echo $item->getSliderUrl() ?>" target="_blank">
|
110 |
<?php } ?>
|
111 |
<img src="<?php echo Mage::getBaseUrl('media') . 'customerslider/slider/' . $item->getFilename(); ?>" height="<?php echo $imageheight?>" width="<?php echo $imagewidth?>"/>
|
112 |
+
<?php if($item->getSliderUrl()){ ?>
|
113 |
</a>
|
114 |
<?php } ?>
|
115 |
<?php if($content) { ?>
|
125 |
</ul>
|
126 |
</div>
|
127 |
</div>
|
128 |
+
<?php if($square) { ?>
|
129 |
+
<ul id="primopiano_menu" style="left: <?php echo $left?>px;">
|
|
|
|
|
130 |
<?php $i=1;foreach($slider as $item):?>
|
131 |
<li id="link_primopiano_<?php echo $i?>">
|
132 |
<a rel="<?php echo $i?>" href="#"> </a>
|
134 |
<?php $i++;endforeach;?>
|
135 |
</ul>
|
136 |
<?php } ?>
|
137 |
+
</div>
|
138 |
+
|
139 |
+
|
140 |
<?php if($title) { ?>
|
141 |
<div class="paging banscrollbg" id="mygaltop" style="width: <?php echo ($width-12) ;?>px;">
|
142 |
<ul id="gooeymenu" class="solidblockmenu">
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Etatvasoft_Dynamic_Image_Slider</name>
|
4 |
-
<version>1.5.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -14,9 +14,9 @@ All features are configurable from admin like width, height, auto slideshow, dis
|
|
14 |
</description>
|
15 |
<notes>All features are configurable from admin like width, height, auto slideshow, display next previous arrow, show caption, show navigation images, max number of slides to display, display slide content, time between two slides.</notes>
|
16 |
<authors><author><name>Etatvasoft</name><user>Etatvasoft</user><email>etatvasoft.magentodevelopment@gmail.com</email></author></authors>
|
17 |
-
<date>2013-10-
|
18 |
-
<time>
|
19 |
-
<contents><target name="magelocal"><dir name="Tatva"><dir><dir name="Slider"><dir name="Block"><dir name="Adminhtml"><dir name="Slider"><dir name="Edit"><file name="Form.php" hash="ca930481c7735510714bc08f3ed54388"/><dir name="Tab"><file name="Form.php" hash="
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Etatvasoft_Dynamic_Image_Slider</name>
|
4 |
+
<version>1.5.6</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>
|
14 |
</description>
|
15 |
<notes>All features are configurable from admin like width, height, auto slideshow, display next previous arrow, show caption, show navigation images, max number of slides to display, display slide content, time between two slides.</notes>
|
16 |
<authors><author><name>Etatvasoft</name><user>Etatvasoft</user><email>etatvasoft.magentodevelopment@gmail.com</email></author></authors>
|
17 |
+
<date>2013-10-08</date>
|
18 |
+
<time>06:14:35</time>
|
19 |
+
<contents><target name="magelocal"><dir name="Tatva"><dir><dir name="Slider"><dir name="Block"><dir name="Adminhtml"><dir name="Slider"><dir name="Edit"><file name="Form.php" hash="ca930481c7735510714bc08f3ed54388"/><dir name="Tab"><file name="Form.php" hash="fefad035dc7458398623630632bf97ad"/></dir><file name="Tabs.php" hash="caad7f9056c9c07c392980656c356871"/></dir><file name="Edit.php" hash="8a3a0fef10e2e61350a5b96d42919fc3"/><file name="Grid.php" hash="f514362d14115b3723e936728a856ce0"/></dir><file name="Slider.php" hash="d1c6599add8772e4b564fa24d0706742"/></dir><file name="Slider.php" hash="206931d8e27c6917f7a2644006780348"/></dir><dir name="Helper"><file name="Data.php" hash="1040dcdf8a42eed3e0010fed0d6128a3"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Slider"><file name="Collection.php" hash="2ae22e2c3320dd3a22c853d443cc914f"/></dir><file name="Slider.php" hash="f58a717ab3b4bd59ba605649129ca9d1"/></dir><file name="Observer.php" hash="9520d196a665079ed8df5cc44c507f93"/><file name="Slider.php" hash="0d75c8352f467422a324d68e4e8f1ccb"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SliderController.php" hash="7319225af11c304b482bc81da859c199"/></dir><file name="IndexController.php" hash="c1fc4c20c94f5c3076b1be1370add42a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a9040db3e6497a97fe64483d19ccbda1"/><file name="config.xml" hash="00c9ea879da690780a1ed37f71b832f7"/><file name="system.xml" hash="4204f6d062f59c4479439ff45c4c6772"/></dir><dir name="sql"><dir name="slider_setup"><file name="mysql4-install-0.1.0.php" hash="efd60f0f0fd9351c16c15aca41bdfb48"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="slider"><file name="slider.xml" hash="a110923b7eeb351204c9e43f6ca8e0dd"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="slider"><file name="slider.xml" hash="9651b1f4114b5f8ff1229886b4607fca"/></dir></dir><dir name="template"><dir name="slider"><file name="slider.phtml" hash="3653761241c942facc506fe172b2724f"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tatva_Slider.xml" hash="248fedac6d3c4175a2564765fde3b4a9"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="slider"><file name="slider.css" hash="dab445ad3a99959812c5af9d2865a780"/></dir></dir><dir name="images"><dir name="slider"><file name="Thumbs.db" hash="a4e466bbbb29524e0d89c23c19829437"/><file name="b_next.png" hash="d72dde0609aded61a24fa18cdca4bf7f"/><file name="b_prev.png" hash="86e333b7023d493e8024ccc6b32cd690"/><file name="bannerscrollbg.gif" hash="bd8c7ef3273a6219fd1bb56bc24cbf6d"/><file name="bluehbg.gif" hash="bdd4f53932bd952684d5d87a69c261c3"/><file name="carousel_next.png" hash="8a6d7719accc317e0dbd4a831677598c"/><file name="carousel_prev.png" hash="849d28e8873e8104c232348348c5e5b8"/><file name="content_bg.jpg" hash="e32654532856667842f9002208341e15"/><file name="next.png" hash="1b2ee17462251a2bd374a8a8a49d6ede"/><file name="next_arrow.png" hash="f395949692f96b812d41521dc8418e37"/><file name="num-act.png" hash="bead24653e91070840cec1153577ba24"/><file name="num.png" hash="4847ee03d68096c72339117db3ce981d"/><file name="prev.png" hash="e0b379b1a7db33c59cc90c4068b2ae3f"/><file name="prev_arrow.png" hash="3ba0da3255d4aac51f8bddf814abd480"/><file name="primopiano_menu.gif" hash="157cf32c6c9a103000441d1cf13768bf"/><file name="primopiano_menu2.gif" hash="2e08aa45e6ad2bd460832bf2c0c20069"/><file name="scroolbg.gif" hash="39d89710b27da072e63bbbdc474ab090"/></dir></dir><dir name="js"><dir name="slider"><file name="jquery-1.6.4.min.js" hash="fdcd59e694043785ddaebb2c688cfa64"/><file name="jquery.jcarousel.js" hash="c12b6393fdd5aa32fc572ce1594d4184"/></dir></dir></dir></dir></dir></target></contents>
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|