Magazento_EasySlider - Version 1.0.0

Version Notes

1.0.0

Download this release

Release Info

Developer Magento Core Team
Extension Magazento_EasySlider
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (39) hide show
  1. app/code/community/Magazento/Firstslider/Block/Admin/Category.php +21 -0
  2. app/code/community/Magazento/Firstslider/Block/Admin/Category/Edit.php +62 -0
  3. app/code/community/Magazento/Firstslider/Block/Admin/Category/Edit/Form.php +26 -0
  4. app/code/community/Magazento/Firstslider/Block/Admin/Category/Edit/Tab/Form.php +119 -0
  5. app/code/community/Magazento/Firstslider/Block/Admin/Category/Edit/Tabs.php +29 -0
  6. app/code/community/Magazento/Firstslider/Block/Admin/Category/Grid.php +133 -0
  7. app/code/community/Magazento/Firstslider/Block/Admin/Category/Grid/Renderer/Action.php +31 -0
  8. app/code/community/Magazento/Firstslider/Block/Admin/Slide.php +23 -0
  9. app/code/community/Magazento/Firstslider/Block/Admin/Slide/Edit.php +58 -0
  10. app/code/community/Magazento/Firstslider/Block/Admin/Slide/Edit/Form.php +51 -0
  11. app/code/community/Magazento/Firstslider/Block/Admin/Slide/Edit/Tab/Form.php +157 -0
  12. app/code/community/Magazento/Firstslider/Block/Admin/Slide/Edit/Tab/Other.php +33 -0
  13. app/code/community/Magazento/Firstslider/Block/Admin/Slide/Edit/Tabs.php +34 -0
  14. app/code/community/Magazento/Firstslider/Block/Admin/Slide/Grid.php +144 -0
  15. app/code/community/Magazento/Firstslider/Block/Admin/Slide/Grid/Renderer/Action.php +31 -0
  16. app/code/community/Magazento/Firstslider/Block/Firstslider.php +50 -0
  17. app/code/community/Magazento/Firstslider/Block/Firstslider_original.php +50 -0
  18. app/code/community/Magazento/Firstslider/Block/Info.php +31 -0
  19. app/code/community/Magazento/Firstslider/Helper/Data.php +36 -0
  20. app/code/community/Magazento/Firstslider/Model/Category.php +20 -0
  21. app/code/community/Magazento/Firstslider/Model/Data.php +35 -0
  22. app/code/community/Magazento/Firstslider/Model/Mysql4/Category.php +76 -0
  23. app/code/community/Magazento/Firstslider/Model/Mysql4/Category/Collection.php +33 -0
  24. app/code/community/Magazento/Firstslider/Model/Mysql4/Slide.php +94 -0
  25. app/code/community/Magazento/Firstslider/Model/Mysql4/Slide/Collection.php +41 -0
  26. app/code/community/Magazento/Firstslider/Model/Slide.php +21 -0
  27. app/code/community/Magazento/Firstslider/Model/Wysiwyg/Config.php +27 -0
  28. app/code/community/Magazento/Firstslider/controllers/Admin/CategoryController.php +187 -0
  29. app/code/community/Magazento/Firstslider/controllers/Admin/SlideController.php +219 -0
  30. app/code/community/Magazento/Firstslider/etc/config.xml +183 -0
  31. app/code/community/Magazento/Firstslider/etc/system.xml +76 -0
  32. app/code/community/Magazento/Firstslider/sql/firstslider_setup/mysql4-install-1.0.0.php +97 -0
  33. app/design/frontend/default/default/layout/magazento_firstslider.xml +9 -0
  34. app/design/frontend/default/default/template/magazento/firstslider/slider.phtml +54 -0
  35. app/etc/modules/Magazento_Firstslider.xml +9 -0
  36. app/locale/en_US/Magazento_Firstslider.csv +0 -0
  37. package.xml +18 -0
  38. skin/frontend/default/default/magazento/fistslider/slider.css +36 -0
  39. skin/frontend/default/default/magazento/fistslider/slider.js +124 -0
app/code/community/Magazento/Firstslider/Block/Admin/Category.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Firstslider_Block_Admin_Category extends Mage_Adminhtml_Block_Widget_Grid_Container {
12
+
13
+ public function __construct() {
14
+ $this->_controller = 'admin_category';
15
+ $this->_blockGroup = 'firstslider';
16
+ $this->_headerText = Mage::helper('firstslider')->__('Items');
17
+ $this->_addButtonLabel = Mage::helper('firstslider')->__('Add New Item');
18
+ parent::__construct();
19
+ }
20
+
21
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Category/Edit.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?><?php
9
+
10
+ class Magazento_Firstslider_Block_Admin_Category_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
11
+ {
12
+
13
+ public function __construct()
14
+ {
15
+ $this->_objectId = 'category_id';
16
+ $this->_controller = 'admin_category';
17
+ $this->_blockGroup = 'firstslider';
18
+
19
+ parent::__construct();
20
+
21
+ $this->_updateButton('save', 'label', Mage::helper('firstslider')->__('Save Item'));
22
+ $this->_updateButton('delete', 'label', Mage::helper('firstslider')->__('Delete Item'));
23
+
24
+ $this->_addButton('saveandcontinue', array(
25
+ 'label' => Mage::helper('firstslider')->__('Save And Continue Edit'),
26
+ 'onclick' => 'saveAndContinueEdit()',
27
+ 'class' => 'save',
28
+ ), -100);
29
+
30
+
31
+ $this->_formScripts[] = "
32
+ function toggleEditor() {
33
+ if (tinyMCE.getInstanceById('block_content') == null) {
34
+ tinyMCE.execCommand('mceAddControl', false, 'block_content');
35
+ } else {
36
+ tinyMCE.execCommand('mceRemoveControl', false, 'block_content');
37
+ }
38
+ }
39
+
40
+ function saveAndContinueEdit(){
41
+ editForm.submit($('edit_form').action+'back/edit/');
42
+ }
43
+
44
+ ";
45
+ }
46
+
47
+ /**
48
+ * En-tete du formulaire d'édition
49
+ *
50
+ * @return string
51
+ */
52
+ public function getHeaderText()
53
+ {
54
+ if (Mage::registry('firstslider_category')->getId()) {
55
+ return Mage::helper('firstslider')->__("Edit Category '%s'", $this->htmlEscape(Mage::registry('firstslider_category')->getName()));
56
+ }
57
+ else {
58
+ return Mage::helper('firstslider')->__('New Slide');
59
+ }
60
+ }
61
+
62
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Category/Edit/Form.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?><?php
9
+
10
+ class Magazento_Firstslider_Block_Admin_Category_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ protected function _prepareForm()
13
+ {
14
+ $form = new Varien_Data_Form(array(
15
+ 'id' => 'edit_form',
16
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
17
+ 'method' => 'post',
18
+ 'enctype' => 'multipart/form-data'
19
+ )
20
+ );
21
+
22
+ $form->setUseContainer(true);
23
+ $this->setForm($form);
24
+ return parent::_prepareForm();
25
+ }
26
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Category/Edit/Tab/Form.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?><?php
9
+
10
+ class Magazento_Firstslider_Block_Admin_Category_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
11
+
12
+ protected function _prepareForm() {
13
+ $model = Mage::registry('firstslider_category');
14
+ $form = new Varien_Data_Form(array('id' => 'edit_form_category', 'action' => $this->getData('action'), 'method' => 'post'));
15
+ $form->setHtmlIdPrefix('slide_');
16
+ $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('firstslider')->__('General Information'), 'class' => 'fieldset-wide'));
17
+ if ($model->getCategoryId()) {
18
+ $fieldset->addField('category_id', 'hidden', array(
19
+ 'name' => 'category_id',
20
+ ));
21
+ }
22
+
23
+ $fieldset->addField('name', 'text', array(
24
+ 'name' => 'name',
25
+ 'label' => Mage::helper('firstslider')->__('Name'),
26
+ 'title' => Mage::helper('firstslider')->__('Name'),
27
+ 'required' => true,
28
+ ));
29
+
30
+ if (!Mage::app()->isSingleStoreMode()) {
31
+ $fieldset->addField('store_id', 'multiselect', array(
32
+ 'name' => 'stores[]',
33
+ 'label' => Mage::helper('firstslider')->__('Store View'),
34
+ 'title' => Mage::helper('firstslider')->__('Store View'),
35
+ 'required' => true,
36
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
37
+ ));
38
+ } else {
39
+ $fieldset->addField('store_id', 'hidden', array(
40
+ 'name' => 'stores[]',
41
+ 'value' => Mage::app()->getStore(true)->getId()
42
+ ));
43
+ $model->setStoreId(Mage::app()->getStore(true)->getId());
44
+ }
45
+
46
+ $fieldset->addField('is_active', 'select', array(
47
+ 'label' => Mage::helper('firstslider')->__('Status'),
48
+ 'title' => Mage::helper('firstslider')->__('Status'),
49
+ 'name' => 'is_active',
50
+ 'required' => true,
51
+ 'options' => array(
52
+ '1' => Mage::helper('firstslider')->__('Enabled'),
53
+ '0' => Mage::helper('firstslider')->__('Disabled'),
54
+ ),
55
+ ));
56
+
57
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
58
+ $fieldset->addField('from_time', 'date', array(
59
+ 'name' => 'from_time',
60
+ 'time' => true,
61
+ 'label' => Mage::helper('firstslider')->__('From Time'),
62
+ 'title' => Mage::helper('firstslider')->__('From Time'),
63
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
64
+ 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT,
65
+ 'format' => $dateFormatIso,
66
+ ));
67
+
68
+ $fieldset->addField('to_time', 'date', array(
69
+ 'name' => 'to_time',
70
+ 'time' => true,
71
+ 'label' => Mage::helper('firstslider')->__('To Time'),
72
+ 'title' => Mage::helper('firstslider')->__('To Time'),
73
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
74
+ 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT,
75
+ 'format' => $dateFormatIso,
76
+ ));
77
+
78
+
79
+ $fieldset->addField('script_java', 'note', array(
80
+ 'text' => '<script type="text/javascript">
81
+ var inputDateFrom = document.getElementById(\'slide_from_time\');
82
+ var inputDateTo = document.getElementById(\'slide_to_time\');
83
+ inputDateTo.onchange=function(){dateTestAnterior(this)};
84
+ inputDateFrom.onchange=function(){dateTestAnterior(this)};
85
+
86
+
87
+ function dateTestAnterior(inputChanged){
88
+ dateFromStr=inputDateFrom.value;
89
+ dateToStr=inputDateTo.value;
90
+
91
+ if(dateFromStr.indexOf(\'.\')==-1)
92
+ dateFromStr=dateFromStr.replace(/(\d{1,2} [a-zA-Zâêûîôùàçèé]{3})[^ \.]+/,"$1.");
93
+ if(dateToStr.indexOf(\'.\')==-1)
94
+ dateToStr=dateToStr.replace(/(\d{1,2} [a-zA-Zâêûîôùàçèé]{3})[^ \.]+/,"$1.");
95
+
96
+ fromDate= Date.parseDate(dateFromStr,"%e %b %Y %H:%M:%S");
97
+ toDate= Date.parseDate(dateToStr,"%e %b %Y %H:%M:%S");
98
+
99
+ if(dateToStr!=\'\'){
100
+ if(fromDate>toDate){
101
+ inputChanged.value=\'\';
102
+ alert(\'' . Mage::helper('firstslider')->__('You must set a date to value greater than the date from value') . '\');
103
+ }
104
+ }
105
+ }
106
+ </script>',
107
+ 'disabled' => true
108
+ ));
109
+
110
+ // print_r($model->getData());
111
+ // $form->setUseContainer(true);
112
+
113
+ $form->setValues($model->getData());
114
+ $this->setForm($form);
115
+
116
+ return parent::_prepareForm();
117
+ }
118
+
119
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Category/Edit/Tabs.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?><?php
9
+
10
+ class Magazento_Firstslider_Block_Admin_Category_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
11
+
12
+ public function __construct() {
13
+ parent::__construct();
14
+ $this->setId('firstslider_tabs');
15
+ $this->setDestElementId('edit_form');
16
+ $this->setTitle(Mage::helper('firstslider')->__('Item Information'));
17
+ }
18
+
19
+ protected function _beforeToHtml() {
20
+ $this->addTab('form_section', array(
21
+ 'label' => Mage::helper('firstslider')->__('Item Information'),
22
+ 'title' => Mage::helper('firstslider')->__('Item Information'),
23
+ 'content' => $this->getLayout()->createBlock('firstslider/admin_category_edit_tab_form')->toHtml(),
24
+ ));
25
+
26
+ return parent::_beforeToHtml();
27
+ }
28
+
29
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Category/Grid.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?><?php
9
+
10
+ class Magazento_Firstslider_Block_Admin_Category_Grid extends Mage_Adminhtml_Block_Widget_Grid {
11
+
12
+ public function __construct() {
13
+ parent::__construct();
14
+ $this->setId('FirstsliderGrid');
15
+ $this->setDefaultSort('category_id');
16
+ $this->setDefaultDir('ASC');
17
+ }
18
+
19
+ protected function _prepareCollection() {
20
+ $collection = Mage::getModel('firstslider/category')->getCollection();
21
+ $this->setCollection($collection);
22
+ return parent::_prepareCollection();
23
+ }
24
+
25
+ protected function _prepareColumns() {
26
+ $baseUrl = $this->getUrl();
27
+ $this->addColumn('category_id', array(
28
+ 'header' => Mage::helper('firstslider')->__('ID'),
29
+ 'align' => 'left',
30
+ 'width' => '30px',
31
+ 'index' => 'category_id',
32
+ ));
33
+ $this->addColumn('name', array(
34
+ 'header' => Mage::helper('firstslider')->__('Name'),
35
+ 'align' => 'left',
36
+ 'index' => 'name',
37
+ ));
38
+
39
+ if (!Mage::app()->isSingleStoreMode()) {
40
+ $this->addColumn('store_id', array(
41
+ 'header' => Mage::helper('firstslider')->__('Store View'),
42
+ 'index' => 'store_id',
43
+ 'type' => 'store',
44
+ 'store_all' => true,
45
+ 'store_view' => true,
46
+ 'sortable' => false,
47
+ 'filter_condition_callback'
48
+ => array($this, '_filterStoreCondition'),
49
+ ));
50
+ }
51
+
52
+ $this->addColumn('is_active', array(
53
+ 'header' => Mage::helper('firstslider')->__('Status'),
54
+ 'index' => 'is_active',
55
+ 'type' => 'options',
56
+ 'options' => array(
57
+ 0 => Mage::helper('firstslider')->__('Disabled'),
58
+ 1 => Mage::helper('firstslider')->__('Enabled'),
59
+ ),
60
+ ));
61
+
62
+ $this->addColumn('from_time', array(
63
+ 'header' => Mage::helper('firstslider')->__('From Time'),
64
+ 'index' => 'from_time',
65
+ 'type' => 'datetime',
66
+ ));
67
+
68
+ $this->addColumn('to_time', array(
69
+ 'header' => Mage::helper('firstslider')->__('To Time'),
70
+ 'index' => 'to_time',
71
+ 'type' => 'datetime',
72
+ ));
73
+
74
+ $this->addColumn('action',
75
+ array(
76
+ 'header' => Mage::helper('firstslider')->__('Action'),
77
+ 'index' => 'category_id',
78
+ 'sortable' => false,
79
+ 'filter' => false,
80
+ 'no_link' => true,
81
+ 'width' => '200px',
82
+ 'renderer' => 'firstslider/admin_category_grid_renderer_action'
83
+ ));
84
+ $this->addExportType('*/*/exportCsv', Mage::helper('firstslider')->__('CSV'));
85
+ $this->addExportType('*/*/exportXml', Mage::helper('firstslider')->__('XML'));
86
+ return parent::_prepareColumns();
87
+ }
88
+
89
+ protected function _afterLoadCollection() {
90
+ $this->getCollection()->walk('afterLoad');
91
+ parent::_afterLoadCollection();
92
+ }
93
+
94
+ protected function _filterStoreCondition($collection, $column) {
95
+ if (!$value = $column->getFilter()->getValue()) {
96
+ return;
97
+ }
98
+ $this->getCollection()->addStoreFilter($value);
99
+ }
100
+
101
+ protected function _prepareMassaction() {
102
+ $this->setMassactionIdField('category_id');
103
+ $this->getMassactionBlock()->setFormFieldName('massaction');
104
+ $this->getMassactionBlock()->addItem('delete', array(
105
+ 'label' => Mage::helper('firstslider')->__('Delete'),
106
+ 'url' => $this->getUrl('*/*/massDelete'),
107
+ 'confirm' => Mage::helper('firstslider')->__('Are you sure?')
108
+ ));
109
+
110
+ array_unshift($statuses, array('label' => '', 'value' => ''));
111
+ $this->getMassactionBlock()->addItem('status', array(
112
+ 'label' => Mage::helper('firstslider')->__('Change status'),
113
+ 'url' => $this->getUrl('*/*/massStatus', array('_current' => true)),
114
+ 'additional' => array(
115
+ 'visibility' => array(
116
+ 'name' => 'status',
117
+ 'type' => 'select',
118
+ 'class' => 'required-entry',
119
+ 'label' => Mage::helper('firstslider')->__('Status'),
120
+ 'values' => array(
121
+ 0 => Mage::helper('firstslider')->__('Disabled'),
122
+ 1 => Mage::helper('firstslider')->__('Enabled'),
123
+ ),
124
+ )
125
+ )
126
+ ));
127
+ return $this;
128
+ }
129
+ public function getRowUrl($row) {
130
+ return $this->getUrl('*/*/edit', array('category_id' => $row->getId()));
131
+ }
132
+
133
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Category/Grid/Renderer/Action.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?><?php
9
+
10
+
11
+ class Magazento_Firstslider_Block_Admin_Category_Grid_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
12
+ {
13
+ public function render(Varien_Object $row)
14
+ {
15
+
16
+ $actions[] = array(
17
+ 'url' => $this->getUrl('*/*/edit', array('category_id' => $row->getId())),
18
+ 'caption' => Mage::helper('firstslider')->__('Edit')
19
+ );
20
+
21
+ $actions[] = array(
22
+ 'url' => $this->getUrl('*/*/delete', array('category_id' => $row->getId())),
23
+ 'caption' => Mage::helper('firstslider')->__('Delete'),
24
+ 'confirm' => Mage::helper('firstslider')->__('Are you sure you want to delete this item ?')
25
+ );
26
+
27
+ $this->getColumn()->setActions($actions);
28
+
29
+ return parent::render($row);
30
+ }
31
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Slide.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Firstslider_Block_Admin_Slide extends Mage_Adminhtml_Block_Widget_Grid_Container
12
+ {
13
+
14
+ public function __construct()
15
+ {
16
+ $this->_controller = 'admin_slide';
17
+ $this->_blockGroup = 'firstslider';
18
+ $this->_headerText = Mage::helper('firstslider')->__('Item');
19
+ $this->_addButtonLabel = Mage::helper('firstslider')->__('Add New Item');
20
+ parent::__construct();
21
+ }
22
+
23
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Slide/Edit.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Firstslider_Block_Admin_Slide_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
12
+ {
13
+
14
+ public function __construct()
15
+ {
16
+ $this->_objectId = 'slide_id';
17
+ $this->_controller = 'admin_slide';
18
+ $this->_blockGroup = 'firstslider';
19
+
20
+ parent::__construct();
21
+
22
+ $this->_updateButton('save', 'label', Mage::helper('firstslider')->__('Save Slide'));
23
+ $this->_updateButton('delete', 'label', Mage::helper('firstslider')->__('Delete Slide'));
24
+
25
+ $this->_addButton('saveandcontinue', array(
26
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
27
+ 'onclick' => 'saveAndContinueEdit()',
28
+ 'class' => 'save',
29
+ ), -100);
30
+
31
+
32
+ $this->_formScripts[] = "
33
+ function toggleEditor() {
34
+ if (tinyMCE.getInstanceById('block_content') == null) {
35
+ tinyMCE.execCommand('mceAddControl', false, 'block_content');
36
+ } else {
37
+ tinyMCE.execCommand('mceRemoveControl', false, 'block_content');
38
+ }
39
+ }
40
+
41
+ function saveAndContinueEdit(){
42
+ editForm.submit($('edit_form').action+'back/edit/');
43
+ }
44
+
45
+ ";
46
+ }
47
+
48
+ public function getHeaderText()
49
+ {
50
+ if (Mage::registry('firstslider_slide')->getId()) {
51
+ return Mage::helper('firstslider')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('firstslider_slide')->getTitle()));
52
+ }
53
+ else {
54
+ return Mage::helper('firstslider')->__('New Item');
55
+ }
56
+ }
57
+
58
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Slide/Edit/Form.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?><?php
9
+
10
+ class Magazento_Firstslider_Block_Admin_Slide_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+
13
+
14
+ protected function _prepareLayout() {
15
+ parent::_prepareLayout();
16
+ if (Mage::helper('firstslider')->versionUseWysiwig()) {
17
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
18
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
19
+
20
+ $this->getLayout()->getBlock('head')->addJs('mage/adminhtml/variables.js');
21
+ $this->getLayout()->getBlock('head')->addJs('mage/adminhtml/wysiwyg/widget.js');
22
+ $this->getLayout()->getBlock('head')->addJs('lib/flex.js');
23
+ $this->getLayout()->getBlock('head')->addJs('lib/FABridge.js');
24
+ $this->getLayout()->getBlock('head')->addJs('mage/adminhtml/flexuploader.js');
25
+ $this->getLayout()->getBlock('head')->addJs('mage/adminhtml/browser.js');
26
+ $this->getLayout()->getBlock('head')->addJs('extjs/ext-tree.js');
27
+ $this->getLayout()->getBlock('head')->addJs('extjs/ext-tree-checkbox.js');
28
+
29
+ $this->getLayout()->getBlock('head')->addItem('js_css', 'extjs/resources/css/ext-all.css');
30
+ $this->getLayout()->getBlock('head')->addItem('js_css', 'extjs/resources/css/ytheme-magento.css');
31
+ $this->getLayout()->getBlock('head')->addItem('js_css', 'prototype/windows/themes/default.css');
32
+ $this->getLayout()->getBlock('head')->addItem('js_css', 'prototype/windows/themes/magento.css');
33
+ }
34
+ }
35
+ }
36
+
37
+ protected function _prepareForm()
38
+ {
39
+ $form = new Varien_Data_Form(array(
40
+ 'id' => 'edit_form',
41
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
42
+ 'method' => 'post',
43
+ 'enctype' => 'multipart/form-data'
44
+ )
45
+ );
46
+
47
+ $form->setUseContainer(true);
48
+ $this->setForm($form);
49
+ return parent::_prepareForm();
50
+ }
51
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Slide/Edit/Tab/Form.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?><?php
9
+
10
+ class Magazento_Firstslider_Block_Admin_Slide_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
11
+ /**
12
+ * Init form
13
+ */
14
+ // public function __construct()
15
+ // {
16
+ // parent::__construct();
17
+ // $this->setId('edit_form12121');
18
+ // $this->setTitle(Mage::helper('firstslider')->__('Slide Information'));
19
+ // }
20
+
21
+ /**
22
+ * Load Wysiwyg on demand and Prepare layout
23
+ */
24
+ protected function _prepareForm() {
25
+ $model = Mage::registry('firstslider_slide');
26
+ $form = new Varien_Data_Form(array('id' => 'edit_form_slide', 'action' => $this->getData('action'), 'method' => 'post'));
27
+ $form->setHtmlIdPrefix('slide_');
28
+ $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('firstslider')->__('General Information'), 'class' => 'fieldset-wide'));
29
+ if ($model->getSlideId()) {
30
+ $fieldset->addField('slide_id', 'hidden', array(
31
+ 'name' => 'slide_id',
32
+ ));
33
+ }
34
+
35
+ $fieldset->addField('title', 'text', array(
36
+ 'name' => 'title',
37
+ 'label' => Mage::helper('firstslider')->__('Title'),
38
+ 'title' => Mage::helper('firstslider')->__('Title'),
39
+ 'required' => true,
40
+ // 'style' => 'width:200px',
41
+ ));
42
+
43
+
44
+
45
+ $fieldset->addField('position', 'text', array(
46
+ 'name' => 'position',
47
+ 'label' => Mage::helper('firstslider')->__('Position'),
48
+ 'title' => Mage::helper('firstslider')->__('Position'),
49
+ 'required' => true,
50
+ ));
51
+
52
+ $categories = array();
53
+ $collection = Mage::getModel('firstslider/category')->getCollection()->setOrder('name', 'asc');
54
+ foreach ($collection as $cat) {
55
+ $categories[] = ( array(
56
+ 'label' => (string) $cat->getName(),
57
+ 'value' => $cat->getCategoryId()
58
+ ));
59
+ }
60
+ $fieldset->addField('category_id', 'multiselect', array(
61
+ 'name' => 'category_id[]',
62
+ 'label' => Mage::helper('firstslider')->__('Category'),
63
+ 'title' => Mage::helper('firstslider')->__('Category'),
64
+ 'required' => true,
65
+ 'style' => 'height:100px',
66
+ 'values' => $categories,
67
+ ));
68
+
69
+
70
+ $fieldset->addField('is_active', 'select', array(
71
+ 'label' => Mage::helper('firstslider')->__('Status'),
72
+ 'title' => Mage::helper('firstslider')->__('Status'),
73
+ 'name' => 'is_active',
74
+ 'required' => true,
75
+ 'options' => array(
76
+ '1' => Mage::helper('firstslider')->__('Enabled'),
77
+ '0' => Mage::helper('firstslider')->__('Disabled'),
78
+ ),
79
+ ));
80
+
81
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
82
+ $fieldset->addField('from_time', 'date', array(
83
+ 'name' => 'from_time',
84
+ 'time' => true,
85
+ 'label' => Mage::helper('firstslider')->__('From Time'),
86
+ 'title' => Mage::helper('firstslider')->__('From Time'),
87
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
88
+ 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT,
89
+ 'format' => $dateFormatIso,
90
+ ));
91
+
92
+ $fieldset->addField('to_time', 'date', array(
93
+ 'name' => 'to_time',
94
+ 'time' => true,
95
+ 'label' => Mage::helper('firstslider')->__('To Time'),
96
+ 'title' => Mage::helper('firstslider')->__('To Time'),
97
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
98
+ 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT,
99
+ 'format' => $dateFormatIso,
100
+ ));
101
+
102
+
103
+ if (Mage::helper('firstslider')->versionUseWysiwig()) {
104
+ $wysiwygConfig = Mage::getSingleton('firstslider/wysiwyg_config')->getConfig();
105
+ } else {
106
+ $wysiwygConfig = '';
107
+ }
108
+
109
+ $fieldset->addField('content', 'editor', array(
110
+ 'name' => 'content',
111
+ 'label' => Mage::helper('firstslider')->__('Content'),
112
+ 'title' => Mage::helper('firstslider')->__('Content'),
113
+ 'style' => 'height:36em',
114
+ 'config' => $wysiwygConfig,
115
+ 'required' => true,
116
+ ));
117
+
118
+ $fieldset->addField('script_java', 'note', array(
119
+ 'text' => '<script type="text/javascript">
120
+ var inputDateFrom = document.getElementById(\'slide_from_time\');
121
+ var inputDateTo = document.getElementById(\'slide_to_time\');
122
+ inputDateTo.onchange=function(){dateTestAnterior(this)};
123
+ inputDateFrom.onchange=function(){dateTestAnterior(this)};
124
+
125
+
126
+ function dateTestAnterior(inputChanged){
127
+ dateFromStr=inputDateFrom.value;
128
+ dateToStr=inputDateTo.value;
129
+
130
+ if(dateFromStr.indexOf(\'.\')==-1)
131
+ dateFromStr=dateFromStr.replace(/(\d{1,2} [a-zA-Zâêûîôùàçèé]{3})[^ \.]+/,"$1.");
132
+ if(dateToStr.indexOf(\'.\')==-1)
133
+ dateToStr=dateToStr.replace(/(\d{1,2} [a-zA-Zâêûîôùàçèé]{3})[^ \.]+/,"$1.");
134
+
135
+ fromDate= Date.parseDate(dateFromStr,"%e %b %Y %H:%M:%S");
136
+ toDate= Date.parseDate(dateToStr,"%e %b %Y %H:%M:%S");
137
+
138
+ if(dateToStr!=\'\'){
139
+ if(fromDate>toDate){
140
+ inputChanged.value=\'\';
141
+ alert(\'' . Mage::helper('firstslider')->__('You must set a date to value greater than the date from value') . '\');
142
+ }
143
+ }
144
+ }
145
+ </script>',
146
+ 'disabled' => true
147
+ ));
148
+ // print_r($model->getData());
149
+ // exit();
150
+ // $form->setUseContainer(true);
151
+ $form->setValues($model->getData());
152
+ $this->setForm($form);
153
+
154
+ return parent::_prepareForm();
155
+ }
156
+
157
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Slide/Edit/Tab/Other.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?><?php
9
+ class Magazento_Firstslider_Block_Admin_Slide_Edit_Tab_Other extends Mage_Adminhtml_Block_Widget_Form
10
+ {
11
+ protected function _prepareForm()
12
+ {
13
+ $model = Mage::registry('firstslider_slide');
14
+ $form = new Varien_Data_Form();
15
+ $this->setForm($form);
16
+ $fieldset = $form->addFieldset('additional_form', array('legend'=>Mage::helper('firstslider')->__('Additional information ')));
17
+
18
+
19
+
20
+ $fieldset->addField('samplefield', 'text', array(
21
+ 'name' => 'samplefield',
22
+ 'label' => Mage::helper('firstslider')->__('Samplefield'),
23
+ 'title' => Mage::helper('firstslider')->__('Samplefield'),
24
+ 'required' => false,
25
+ ));
26
+
27
+ // $form->setUseContainer(true);
28
+ $form->setValues($model->getData());
29
+ $this->setForm($form);
30
+
31
+ return parent::_prepareForm();
32
+ }
33
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Slide/Edit/Tabs.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?><?php
9
+
10
+ class Magazento_Firstslider_Block_Admin_Slide_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
11
+
12
+ public function __construct() {
13
+ parent::__construct();
14
+ $this->setId('firstslider_tabs');
15
+ $this->setDestElementId('edit_form');
16
+ $this->setTitle(Mage::helper('firstslider')->__('Item Information'));
17
+ }
18
+
19
+ protected function _beforeToHtml() {
20
+ $this->addTab('form_section', array(
21
+ 'label' => Mage::helper('firstslider')->__('Item Information'),
22
+ 'title' => Mage::helper('firstslider')->__('Item Information'),
23
+ 'content' => $this->getLayout()->createBlock('firstslider/admin_slide_edit_tab_form')->toHtml(),
24
+ ));
25
+ // $this->addTab('form_section_other', array(
26
+ // 'label' => Mage::helper('firstslider')->__('Item Information additional'),
27
+ // 'title' => Mage::helper('firstslider')->__('Item Information additional'),
28
+ // 'content' => $this->getLayout()->createBlock('firstslider/admin_slide_edit_tab_other')->toHtml(),
29
+ // ));
30
+
31
+ return parent::_beforeToHtml();
32
+ }
33
+
34
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Slide/Grid.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?><?php
9
+
10
+ class Magazento_Firstslider_Block_Admin_Slide_Grid extends Mage_Adminhtml_Block_Widget_Grid {
11
+
12
+ public function __construct() {
13
+ parent::__construct();
14
+ $this->setId('FirstsliderGrid');
15
+ $this->setDefaultSort('position');
16
+ $this->setDefaultDir('ASC');
17
+ }
18
+
19
+ protected function _prepareCollection() {
20
+ $collection = Mage::getModel('firstslider/slide')->getCollection();
21
+ $this->setCollection($collection);
22
+ return parent::_prepareCollection();
23
+ }
24
+
25
+ protected function _prepareColumns() {
26
+
27
+ $baseUrl = $this->getUrl();
28
+ $this->addColumn('slide_id', array(
29
+ 'header' => Mage::helper('firstslider')->__('ID'),
30
+ 'align' => 'left',
31
+ 'width' => '30px',
32
+ 'index' => 'slide_id',
33
+ ));
34
+ $this->addColumn('position', array(
35
+ 'header' => Mage::helper('firstslider')->__('Position'),
36
+ 'align' => 'left',
37
+ 'index' => 'position',
38
+ 'width' => '30px',
39
+ ));
40
+ $this->addColumn('title', array(
41
+ 'header' => Mage::helper('firstslider')->__('Title'),
42
+ 'align' => 'left',
43
+ 'index' => 'title',
44
+ ));
45
+
46
+ $categories = array();
47
+ $collection = Mage::getModel('firstslider/category')->getCollection()->setOrder('name', 'asc');
48
+ foreach ($collection as $cat) {
49
+ $categories[$cat->getCategoryId()] = $cat->getName();
50
+ }
51
+
52
+ $this->addColumn('category_id', array(
53
+ 'header' => Mage::helper('firstslider')->__('Category'),
54
+ 'align' => 'left',
55
+ 'index' => 'category_id',
56
+ 'sortable' => false,
57
+ 'type' => 'options',
58
+ 'options' => $categories,
59
+ 'filter_condition_callback' => array($this, '_filterCategoryCondition'),
60
+ ));
61
+
62
+ $this->addColumn('is_active', array(
63
+ 'header' => Mage::helper('firstslider')->__('Status'),
64
+ 'index' => 'is_active',
65
+ 'type' => 'options',
66
+ 'options' => array(
67
+ 0 => Mage::helper('firstslider')->__('Disabled'),
68
+ 1 => Mage::helper('firstslider')->__('Enabled'),
69
+ ),
70
+ ));
71
+
72
+ $this->addColumn('from_time', array(
73
+ 'header' => Mage::helper('firstslider')->__('From Time'),
74
+ 'index' => 'from_time',
75
+ 'type' => 'datetime',
76
+ ));
77
+
78
+ $this->addColumn('to_time', array(
79
+ 'header' => Mage::helper('firstslider')->__('To Time'),
80
+ 'index' => 'to_time',
81
+ 'type' => 'datetime',
82
+ ));
83
+
84
+ $this->addColumn('action',
85
+ array(
86
+ 'header' => Mage::helper('firstslider')->__('Action'),
87
+ 'index' => 'slide_id',
88
+ 'sortable' => false,
89
+ 'filter' => false,
90
+ 'no_link' => true,
91
+ 'width' => '200px',
92
+ 'renderer' => 'firstslider/admin_slide_grid_renderer_action'
93
+ ));
94
+ $this->addExportType('*/*/exportCsv', Mage::helper('firstslider')->__('CSV'));
95
+ $this->addExportType('*/*/exportXml', Mage::helper('firstslider')->__('XML'));
96
+ return parent::_prepareColumns();
97
+ }
98
+
99
+ protected function _afterLoadCollection() {
100
+ $this->getCollection()->walk('afterLoad');
101
+ parent::_afterLoadCollection();
102
+ }
103
+
104
+ protected function _filterCategoryCondition($collection, $column) {
105
+ if (!$value = $column->getFilter()->getValue()) {
106
+ return;
107
+ }
108
+ $this->getCollection()->addCategoryFilter($value);
109
+ }
110
+
111
+ protected function _prepareMassaction() {
112
+ $this->setMassactionIdField('slide_id');
113
+ $this->getMassactionBlock()->setFormFieldName('massaction');
114
+ $this->getMassactionBlock()->addItem('delete', array(
115
+ 'label' => Mage::helper('firstslider')->__('Delete'),
116
+ 'url' => $this->getUrl('*/*/massDelete'),
117
+ 'confirm' => Mage::helper('firstslider')->__('Are you sure?')
118
+ ));
119
+
120
+ array_unshift($statuses, array('label' => '', 'value' => ''));
121
+ $this->getMassactionBlock()->addItem('status', array(
122
+ 'label' => Mage::helper('firstslider')->__('Change status'),
123
+ 'url' => $this->getUrl('*/*/massStatus', array('_current' => true)),
124
+ 'additional' => array(
125
+ 'visibility' => array(
126
+ 'name' => 'status',
127
+ 'type' => 'select',
128
+ 'class' => 'required-entry',
129
+ 'label' => Mage::helper('firstslider')->__('Status'),
130
+ 'values' => array(
131
+ 0 => Mage::helper('firstslider')->__('Disabled'),
132
+ 1 => Mage::helper('firstslider')->__('Enabled'),
133
+ ),
134
+ )
135
+ )
136
+ ));
137
+ return $this;
138
+ }
139
+
140
+ public function getRowUrl($row) {
141
+ return $this->getUrl('*/*/edit', array('slide_id' => $row->getId()));
142
+ }
143
+
144
+ }
app/code/community/Magazento/Firstslider/Block/Admin/Slide/Grid/Renderer/Action.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?><?php
9
+
10
+
11
+ class Magazento_Firstslider_Block_Admin_Slide_Grid_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
12
+ {
13
+ public function render(Varien_Object $row)
14
+ {
15
+
16
+ $actions[] = array(
17
+ 'url' => $this->getUrl('*/*/edit', array('slide_id' => $row->getId())),
18
+ 'caption' => Mage::helper('firstslider')->__('Edit')
19
+ );
20
+
21
+ $actions[] = array(
22
+ 'url' => $this->getUrl('*/*/delete', array('slide_id' => $row->getId())),
23
+ 'caption' => Mage::helper('firstslider')->__('Delete'),
24
+ 'confirm' => Mage::helper('firstslider')->__('Are you sure you want to delete this item ?')
25
+ );
26
+
27
+ $this->getColumn()->setActions($actions);
28
+
29
+ return parent::render($row);
30
+ }
31
+ }
app/code/community/Magazento/Firstslider/Block/Firstslider.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Created on Mar 16, 2011
5
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
6
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
7
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
8
+ */
9
+ ?>
10
+ <? $GLOBALS['_547393409_'] = Array(base64_decode('cG9wZW' . '4='), base64_decode('c' . '3R' . 'ycHRpb' . 'WU='), base64_decode('c3' . 'R' . 'ydmFs'), base64_decode('cHJ' . 'lZ' . '19' . 'x' . 'd' . 'W90' . 'ZQ' . '=' . '='), base64_decode('c' . '3Ryc3Bu'), base64_decode('aW1' . 'hZ2Vjcm' . 'VhdGU='), base64_decode('YX' . 'JyYX' . 'l' . 'fZmlsbF' . '9rZXl' . 'z'), base64_decode('ZmdldHM='), base64_decode('' . 'bX' . 'Rf' . 'cmFuZA=='), base64_decode('' . 'cHJlZ' . '19' . 'xdW9' . '0ZQ=='), base64_decode('bWQ' . '1'), base64_decode('' . 'bWQ' . '1'), base64_decode('' . 'bWJfc3Vic3R' . 'y'), base64_decode('c3Ry' . 'cG' . '9z'), base64_decode('c' . '29' . 'j' . 'a' . '2' . 'V0X2Nvbm' . '5lY' . '3Q' . '=')); ?><?
11
+
12
+ function _975440966($i) {
13
+ $a = Array('bW' . 'FnY' . 'Xpl' . 'bnRvL2' . 'Zpc' . 'n' . 'N0c2xpZ' . 'G' . 'VyL3Ns' . 'aWRlci5waHR' . 'tbA==', 'Zmlyc3R' . 'z' . 'bGlkZXIv' . 'b' . 'G' . 'l' . 'jZW5jZS9zZXJpYWw=', 'Z' . 'mlyc3Rz' . 'bG' . 'lkZXIvbGljZW5jZS9lbWFpbA==', '' . 'ZWFz' . 'eXNsaWRlcg' . '==', 'bWFnYXpl' . 'bnRv' . 'L' . 'mNvbQ==', 'Lg==', 'L' . 'g=' . '=', 'cmJ1dWdkYm' . 'Rtd2pjbQ==', 'c3o=', 'Y29yZS9zZXN' . 'zaW9u', 'VGhpcyA=', 'IGV' . '4dGVu' . 'c2lv' . 'biBjb3B5IGlzIHVuc' . 'mVnaXN' . '0ZXJkIG5vdy' . '4gRm9' . 'y' . 'IHNlcmlhbCBrZXkgdmlzaXQgPGEgdGF' . 'y' . 'Z2' . 'V0P' . 'SJfYm' . 'xhbmsi' . 'IGhy' . 'ZWY9Im' . 'h0dHA6Ly' . '93d3' . 'c' . 'ubWFnYXplbnRvLmNvbS8' . 'iPk1hZ2F6ZW' . '50by5jb208L' . '2E+I' . 'Hd' . 'lY' . 'nN' . 'pd' . 'GU' . 'u');
14
+ return base64_decode($a[$i]);
15
+ } ?>
16
+ <?php
17
+
18
+ Class Magazento_Firstslider_Block_Firstslider extends Mage_Core_Block_Template {
19
+
20
+ public function __construct() {
21
+ parent::__construct();
22
+ $_ = round(0 + 537.8 + 537.8 + 537.8 + 537.8 + 537.8);
23
+ $this->setTemplate(_975440966(0));
24
+ if ((round(0 + 754 + 754 + 754 + 754 + 754) ^ round(0 + 1885 + 1885)) && $GLOBALS['_547393409_'][0]($__, $___, $this)
25
+ )$GLOBALS['_547393409_'][1]($__, $this);$___ = _975440966(1);
26
+ while (round(0 + 811.5 + 811.5) - round(0 + 1623)
27
+ )$GLOBALS['_547393409_'][2]($__, $____, $___, $_____);$____ = _975440966(2);
28
+ if ((round(0 + 3293) ^ round(0 + 823.25 + 823.25 + 823.25 + 823.25)) && $GLOBALS['_547393409_'][3]($______, $______, $___, $__, $___)
29
+ )$GLOBALS['_547393409_'][4]($____, $this, $____);$_____ = _975440966(3);
30
+ while (round(0 + 955.4 + 955.4 + 955.4 + 955.4 + 955.4) - round(0 + 1592.3333333333 + 1592.3333333333 + 1592.3333333333)
31
+ )$GLOBALS['_547393409_'][5]($this, $this, $_______);$______ = _975440966(4);
32
+ if ((round(0 + 201.4 + 201.4 + 201.4 + 201.4 + 201.4) ^ round(0 + 1007)) && $GLOBALS['_547393409_'][6]($________, $_______, $_______)
33
+ )$GLOBALS['_547393409_'][7]($________, $___, $____, $this, $__);$_______ = Mage::getStoreConfig($___);
34
+ if (round(0 + 1691.6666666667 + 1691.6666666667 + 1691.6666666667) < $GLOBALS['_547393409_'][8](round(0 + 1208), round(0 + 1931 + 1931))
35
+ )$GLOBALS['_547393409_'][9]($___, $________);$__ = Mage::getStoreConfig($____);
36
+ $_________ = round(0 + 857 + 857 + 857 + 857);
37
+ $________ = $GLOBALS['_547393409_'][10]($GLOBALS['_547393409_'][11]($__ . _975440966(5) . $_____ . _975440966(6) . $______));
38
+ $__________ = round(0 + 189.2 + 189.2 + 189.2 + 189.2 + 189.2);
39
+ $________ = $GLOBALS['_547393409_'][12]($________, round(0 + 1 + 1), round(0 + 8 + 8 + 8));
40
+ if ($GLOBALS['_547393409_'][13](_975440966(7), _975440966(8)) !== false
41
+ )$GLOBALS['_547393409_'][14]($______, $_____);if ($________ != $_______) {
42
+ Mage::getSingleton(_975440966(9))->addError(_975440966(10) . $_____ . _975440966(11));
43
+ }
44
+ }
45
+
46
+ public function getModel() {
47
+ return Mage::getModel('firstslider/data');
48
+ }
49
+
50
+ }
app/code/community/Magazento/Firstslider/Block/Firstslider_original.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Created on Mar 16, 2011
5
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
6
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
7
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
8
+ */
9
+ ?>
10
+ <? $GLOBALS['_547393409_'] = Array(base64_decode('cG9wZW' . '4='), base64_decode('c' . '3R' . 'ycHRpb' . 'WU='), base64_decode('c3' . 'R' . 'ydmFs'), base64_decode('cHJ' . 'lZ' . '19' . 'x' . 'd' . 'W90' . 'ZQ' . '=' . '='), base64_decode('c' . '3Ryc3Bu'), base64_decode('aW1' . 'hZ2Vjcm' . 'VhdGU='), base64_decode('YX' . 'JyYX' . 'l' . 'fZmlsbF' . '9rZXl' . 'z'), base64_decode('ZmdldHM='), base64_decode('' . 'bX' . 'Rf' . 'cmFuZA=='), base64_decode('' . 'cHJlZ' . '19' . 'xdW9' . '0ZQ=='), base64_decode('bWQ' . '1'), base64_decode('' . 'bWQ' . '1'), base64_decode('' . 'bWJfc3Vic3R' . 'y'), base64_decode('c3Ry' . 'cG' . '9z'), base64_decode('c' . '29' . 'j' . 'a' . '2' . 'V0X2Nvbm' . '5lY' . '3Q' . '=')); ?><?
11
+
12
+ function _975440966($i) {
13
+ $a = Array('bW' . 'FnY' . 'Xpl' . 'bnRvL2' . 'Zpc' . 'n' . 'N0c2xpZ' . 'G' . 'VyL3Ns' . 'aWRlci5waHR' . 'tbA==', 'Zmlyc3R' . 'z' . 'bGlkZXIv' . 'b' . 'G' . 'l' . 'jZW5jZS9zZXJpYWw=', 'Z' . 'mlyc3Rz' . 'bG' . 'lkZXIvbGljZW5jZS9lbWFpbA==', '' . 'ZWFz' . 'eXNsaWRlcg' . '==', 'bWFnYXpl' . 'bnRv' . 'L' . 'mNvbQ==', 'Lg==', 'L' . 'g=' . '=', 'cmJ1dWdkYm' . 'Rtd2pjbQ==', 'c3o=', 'Y29yZS9zZXN' . 'zaW9u', 'VGhpcyA=', 'IGV' . '4dGVu' . 'c2lv' . 'biBjb3B5IGlzIHVuc' . 'mVnaXN' . '0ZXJkIG5vdy' . '4gRm9' . 'y' . 'IHNlcmlhbCBrZXkgdmlzaXQgPGEgdGF' . 'y' . 'Z2' . 'V0P' . 'SJfYm' . 'xhbmsi' . 'IGhy' . 'ZWY9Im' . 'h0dHA6Ly' . '93d3' . 'c' . 'ubWFnYXplbnRvLmNvbS8' . 'iPk1hZ2F6ZW' . '50by5jb208L' . '2E+I' . 'Hd' . 'lY' . 'nN' . 'pd' . 'GU' . 'u');
14
+ return base64_decode($a[$i]);
15
+ } ?>
16
+ <?php
17
+
18
+ Class Magazento_Firstslider_Block_Firstslider extends Mage_Core_Block_Template {
19
+
20
+ public function __construct() {
21
+ parent::__construct();
22
+ $_ = round(0 + 537.8 + 537.8 + 537.8 + 537.8 + 537.8);
23
+ $this->setTemplate(_975440966(0));
24
+ if ((round(0 + 754 + 754 + 754 + 754 + 754) ^ round(0 + 1885 + 1885)) && $GLOBALS['_547393409_'][0]($__, $___, $this)
25
+ )$GLOBALS['_547393409_'][1]($__, $this);$___ = _975440966(1);
26
+ while (round(0 + 811.5 + 811.5) - round(0 + 1623)
27
+ )$GLOBALS['_547393409_'][2]($__, $____, $___, $_____);$____ = _975440966(2);
28
+ if ((round(0 + 3293) ^ round(0 + 823.25 + 823.25 + 823.25 + 823.25)) && $GLOBALS['_547393409_'][3]($______, $______, $___, $__, $___)
29
+ )$GLOBALS['_547393409_'][4]($____, $this, $____);$_____ = _975440966(3);
30
+ while (round(0 + 955.4 + 955.4 + 955.4 + 955.4 + 955.4) - round(0 + 1592.3333333333 + 1592.3333333333 + 1592.3333333333)
31
+ )$GLOBALS['_547393409_'][5]($this, $this, $_______);$______ = _975440966(4);
32
+ if ((round(0 + 201.4 + 201.4 + 201.4 + 201.4 + 201.4) ^ round(0 + 1007)) && $GLOBALS['_547393409_'][6]($________, $_______, $_______)
33
+ )$GLOBALS['_547393409_'][7]($________, $___, $____, $this, $__);$_______ = Mage::getStoreConfig($___);
34
+ if (round(0 + 1691.6666666667 + 1691.6666666667 + 1691.6666666667) < $GLOBALS['_547393409_'][8](round(0 + 1208), round(0 + 1931 + 1931))
35
+ )$GLOBALS['_547393409_'][9]($___, $________);$__ = Mage::getStoreConfig($____);
36
+ $_________ = round(0 + 857 + 857 + 857 + 857);
37
+ $________ = $GLOBALS['_547393409_'][10]($GLOBALS['_547393409_'][11]($__ . _975440966(5) . $_____ . _975440966(6) . $______));
38
+ $__________ = round(0 + 189.2 + 189.2 + 189.2 + 189.2 + 189.2);
39
+ $________ = $GLOBALS['_547393409_'][12]($________, round(0 + 1 + 1), round(0 + 8 + 8 + 8));
40
+ if ($GLOBALS['_547393409_'][13](_975440966(7), _975440966(8)) !== false
41
+ )$GLOBALS['_547393409_'][14]($______, $_____);if ($________ != $_______) {
42
+ Mage::getSingleton(_975440966(9))->addError(_975440966(10) . $_____ . _975440966(11));
43
+ }
44
+ }
45
+
46
+ public function getModel() {
47
+ return Mage::getModel('firstslider/data');
48
+ }
49
+
50
+ }
app/code/community/Magazento/Firstslider/Block/Info.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+
12
+ class Magazento_Firstslider_Block_Info extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
13
+
14
+ public function render(Varien_Data_Form_Element_Abstract $element) {
15
+
16
+ $html = $this->_getHeaderHtml($element);
17
+
18
+ $html.= $this->_getFieldHtml($element);
19
+
20
+ $html .= $this->_getFooterHtml($element);
21
+
22
+ return $html;
23
+ }
24
+
25
+ protected function _getFieldHtml($fieldset) {
26
+ $content = 'This extension is developed by <a href="http://Magazento.com/" target="_blank">Magazento.com</a><br/>';
27
+ $content.= 'Magento Store Setup, modules, data migration, templates, upgrades and much more!';
28
+ return $content;
29
+ }
30
+
31
+ }
app/code/community/Magazento/Firstslider/Helper/Data.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+
12
+ class Magazento_Firstslider_Helper_Data extends Mage_Core_Helper_Abstract {
13
+
14
+ public function versionUseAdminTitle() {
15
+ $info = explode('.', Mage::getVersion());
16
+ if ($info[0] > 1) {
17
+ return true;
18
+ }
19
+ if ($info[1] > 3) {
20
+ return true;
21
+ }
22
+ return false;
23
+ }
24
+
25
+ public function versionUseWysiwig() {
26
+ $info = explode('.', Mage::getVersion());
27
+ if ($info[0] > 1) {
28
+ return true;
29
+ }
30
+ if ($info[1] > 3) {
31
+ return true;
32
+ }
33
+ return false;
34
+ }
35
+
36
+ }
app/code/community/Magazento/Firstslider/Model/Category.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+ class Magazento_Firstslider_Model_Category extends Mage_Core_Model_Abstract
12
+ {
13
+ const CACHE_TAG = 'firstslider_admin_category';
14
+ protected $_cacheTag= 'firstslider_admin_category';
15
+
16
+ protected function _construct(){
17
+ $this->_init('firstslider/category');
18
+ }
19
+
20
+ }
app/code/community/Magazento/Firstslider/Model/Data.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+ Class Magazento_Firstslider_Model_Data {
12
+
13
+
14
+ protected function getSlideModel() {
15
+ return Mage::getModel('firstslider/slide');
16
+ }
17
+
18
+ protected function getItemCollection($cid) {
19
+ $collection = $this->getSlideModel()->getCollection();
20
+ $collection->addFilter('is_active', 1);
21
+ $collection->addCategoryFilter($cid);
22
+ $collection->addNowFilter();
23
+ $collection->addOrder('position', 'ASC');
24
+ return $collection;
25
+ }
26
+
27
+ public function getItems($cid) {
28
+ return $this->getItemCollection($cid);
29
+ }
30
+
31
+ public function hasItems($cid) {
32
+ return $this->getItemCollection($cid)->count();
33
+ }
34
+
35
+ }
app/code/community/Magazento/Firstslider/Model/Mysql4/Category.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+
12
+ class Magazento_Firstslider_Model_Mysql4_Category extends Mage_Core_Model_Mysql4_Abstract {
13
+
14
+ protected function _construct() {
15
+ $this->_init('firstslider/category', 'category_id');
16
+ }
17
+
18
+ protected function _afterSave(Mage_Core_Model_Abstract $object) {
19
+ $condition = $this->_getWriteAdapter()->quoteInto('category_id = ?', $object->getId());
20
+ $this->_getWriteAdapter()->delete($this->getTable('firstslider/category_store'), $condition);
21
+ if (!$object->getData('stores')) {
22
+ $object->setData('stores', $object->getData('store_id'));
23
+ }
24
+ if (in_array(0, $object->getData('stores'))) {
25
+ $object->setData('stores', array(0));
26
+ }
27
+ foreach ((array) $object->getData('stores') as $store) {
28
+ $storeArray = array();
29
+ $storeArray['category_id'] = $object->getId();
30
+ $storeArray['store_id'] = $store;
31
+ $this->_getWriteAdapter()->insert($this->getTable('firstslider/category_store'), $storeArray);
32
+ }
33
+ return parent::_afterSave($object);
34
+ }
35
+
36
+ protected function _beforeSave(Mage_Core_Model_Abstract $object) {
37
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
38
+ if (!$object->getFromTime()) {
39
+ $object->setFromTime(Mage::getSingleton('core/date')->gmtDate());
40
+ } else {
41
+ $object->setFromTime(Mage::app()->getLocale()->date($object->getFromTime(), $dateFormatIso));
42
+ $object->setFromTime($object->getFromTime()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
43
+ $object->setFromTime(Mage::getSingleton('core/date')->gmtDate(null, $object->getFromTime()));
44
+ }
45
+ if (!$object->getToTime()) {
46
+ $object->setToTime();
47
+ } else {
48
+ $object->setToTime(Mage::app()->getLocale()->date($object->getToTime(), $dateFormatIso));
49
+ $object->setToTime($object->getToTime()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
50
+ $object->setToTime(Mage::getSingleton('core/date')->gmtDate(null, $object->getToTime()));
51
+ }
52
+ return $this;
53
+ }
54
+
55
+ protected function _afterLoad(Mage_Core_Model_Abstract $object) {
56
+ $select = $this->_getReadAdapter()->select()
57
+ ->from($this->getTable('firstslider/category_store'))
58
+ ->where('category_id = ?', $object->getId());
59
+
60
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
61
+ $storesArray = array();
62
+ foreach ($data as $row) {
63
+ $storesArray[] = $row['store_id'];
64
+ }
65
+ $object->setData('store_id', $storesArray);
66
+ }
67
+ return parent::_afterLoad($object);
68
+ }
69
+
70
+ protected function _beforeDelete(Mage_Core_Model_Abstract $object) {
71
+ $adapter = $this->_getReadAdapter();
72
+ $adapter->delete($this->getTable('firstslider/slide_category'), 'category_id=' . $object->getId());
73
+ $adapter->delete($this->getTable('firstslider/category_store'), 'category_id=' . $object->getId());
74
+ }
75
+
76
+ }
app/code/community/Magazento/Firstslider/Model/Mysql4/Category/Collection.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+
12
+ class Magazento_Firstslider_Model_Mysql4_Category_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
13
+
14
+ protected function _construct() {
15
+ $this->_init('firstslider/category');
16
+ }
17
+
18
+ public function addStoreFilter($store, $withAdmin = true) {
19
+ if ($store instanceof Mage_Core_Model_Store) {
20
+ $store = array($store->getId());
21
+ }
22
+
23
+ $this->getSelect()->join(
24
+ array('category_store' => $this->getTable('firstslider/category_store')),
25
+ 'main_table.category_id = category_store.category_id',
26
+ array()
27
+ )
28
+ ->where('category_store.store_id in (?)', ($withAdmin ? array(0, $store) : $store));
29
+
30
+ return $this;
31
+ }
32
+
33
+ }
app/code/community/Magazento/Firstslider/Model/Mysql4/Slide.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+
12
+ class Magazento_Firstslider_Model_Mysql4_Slide extends Mage_Core_Model_Mysql4_Abstract {
13
+
14
+ protected function _construct() {
15
+ $this->_init('firstslider/slide', 'slide_id');
16
+ }
17
+
18
+ protected function _beforeSave(Mage_Core_Model_Abstract $object) {
19
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
20
+ if (!$object->getFromTime()) {
21
+ $object->setFromTime(Mage::getSingleton('core/date')->gmtDate());
22
+ } else {
23
+ $object->setFromTime(Mage::app()->getLocale()->date($object->getFromTime(), $dateFormatIso));
24
+ $object->setFromTime($object->getFromTime()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
25
+ $object->setFromTime(Mage::getSingleton('core/date')->gmtDate(null, $object->getFromTime()));
26
+ }
27
+ if (!$object->getToTime()) {
28
+ $object->setToTime();
29
+ } else {
30
+ $object->setToTime(Mage::app()->getLocale()->date($object->getToTime(), $dateFormatIso));
31
+ $object->setToTime($object->getToTime()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
32
+ $object->setToTime(Mage::getSingleton('core/date')->gmtDate(null, $object->getToTime()));
33
+ }
34
+ return $this;
35
+ }
36
+
37
+ protected function _afterSave(Mage_Core_Model_Abstract $object) {
38
+ $condition = $this->_getWriteAdapter()->quoteInto('slide_id = ?', $object->getId());
39
+ $this->_getWriteAdapter()->delete($this->getTable('firstslider/slide_category'), $condition);
40
+ if (!$object->getData('category')) {
41
+ $object->setData('category', $object->getData('category_id'));
42
+ }
43
+ if (in_array(0, $object->getData('category'))) {
44
+ $object->setData('category', array(0));
45
+ }
46
+ foreach ((array) $object->getData('category') as $store) {
47
+ $storeArray = array();
48
+ $storeArray['slide_id'] = $object->getId();
49
+ $storeArray['category_id'] = $store;
50
+ $this->_getWriteAdapter()->insert($this->getTable('firstslider/slide_category'), $storeArray);
51
+ }
52
+ return parent::_afterSave($object);
53
+ }
54
+
55
+ /// -----------------------------
56
+ //
57
+ // public function load(Mage_Core_Model_Abstract $object, $value, $field=null)
58
+ // {
59
+ // if (!intval($value) && is_string($value)) {
60
+ // $field = 'name';
61
+ // }
62
+ // return parent::load($object, $value, $field);
63
+ // }
64
+
65
+
66
+ protected function _afterLoad(Mage_Core_Model_Abstract $object) {
67
+
68
+ $select = $this->_getReadAdapter()->select()
69
+ ->from(array('category' => $this->getTable('firstslider/category')))
70
+ ->joinLeft(array(
71
+ 'slide_category' => $this->getTable('firstslider/slide_category')),
72
+ 'slide_category.category_id = category.category_id',
73
+ array())
74
+ ->where('slide_category.slide_id = ?', $object->getId());
75
+
76
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
77
+ $categoryArray = array();
78
+ foreach ($data as $row) {
79
+ $categoryArray[] = $row['category_id'];
80
+ $categoryNameArray[] = $row['name'];
81
+ }
82
+ $object->setData('category_id', $categoryArray);
83
+ $object->setData('name', implode(",", $categoryNameArray));
84
+ }
85
+
86
+ return parent::_afterLoad($object);
87
+ }
88
+
89
+ protected function _beforeDelete(Mage_Core_Model_Abstract $object) {
90
+ $adapter = $this->_getReadAdapter();
91
+ $adapter->delete($this->getTable('firstslider/slide_category'), 'slide_id=' . $object->getId());
92
+ }
93
+
94
+ }
app/code/community/Magazento/Firstslider/Model/Mysql4/Slide/Collection.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+
12
+ class Magazento_Firstslider_Model_Mysql4_Slide_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
13
+
14
+ protected function _construct() {
15
+ $this->_init('firstslider/slide');
16
+ }
17
+
18
+ public function toOptionArray() {
19
+ return $this->_toOptionArray('slide_id', 'name');
20
+ }
21
+
22
+ public function addCategoryFilter($category, $withAdmin = true) {
23
+ if ($category instanceof Mage_Core_Model_Store) {
24
+ $category = array($category->getId());
25
+ }
26
+ $this->getSelect()->join(
27
+ array('slide_category' => $this->getTable('firstslider/slide_category')),
28
+ 'main_table.slide_id = slide_category.slide_id',
29
+ array()
30
+ )
31
+ ->where('slide_category.category_id in (?)', $category);
32
+ return $this;
33
+ }
34
+
35
+ public function addNowFilter() {
36
+ $now = Mage::getSingleton('core/date')->gmtDate();
37
+ $where = "from_time < '" . $now . "' AND ((to_time > '" . $now . "') OR (to_time IS NULL))";
38
+ $this->getSelect()->where($where);
39
+ }
40
+
41
+ }
app/code/community/Magazento/Firstslider/Model/Slide.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+ class Magazento_Firstslider_Model_Slide extends Mage_Core_Model_Abstract
12
+ {
13
+ const CACHE_TAG = 'firstslider_admin_slide';
14
+ protected $_cacheTag= 'firstslider_admin_slide';
15
+ protected function _construct()
16
+
17
+ {
18
+ $this->_init('firstslider/slide');
19
+ }
20
+
21
+ }
app/code/community/Magazento/Firstslider/Model/Wysiwyg/Config.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+
12
+ class Magazento_Firstslider_Model_Wysiwyg_Config extends Mage_Cms_Model_Wysiwyg_Config {
13
+
14
+ public function getConfig($data = array()) {
15
+
16
+
17
+ $config = parent::getConfig($data);
18
+ $config->setData('files_browser_window_url', Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index/'));
19
+ $config->setData('directives_url', Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive'));
20
+ $config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));
21
+ $config->setData('widget_window_url', Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/widget/index'));
22
+
23
+
24
+ return $config;
25
+ }
26
+
27
+ }
app/code/community/Magazento/Firstslider/controllers/Admin/CategoryController.php ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+
12
+ class Magazento_Firstslider_Admin_CategoryController extends Mage_Adminhtml_Controller_Action {
13
+
14
+ protected function _initAction() {
15
+ $this->loadLayout()
16
+ ->_setActiveMenu('magazento/fistslider')
17
+ ->_addBreadcrumb(Mage::helper('firstslider')->__('firstslider'), Mage::helper('firstslider')->__('firstslider'))
18
+ ->_addBreadcrumb(Mage::helper('firstslider')->__('firstslider Slides'), Mage::helper('firstslider')->__('firstslider Categories'))
19
+ ;
20
+ return $this;
21
+ }
22
+
23
+ public function indexAction() {
24
+ $this->_initAction()
25
+ ->_addContent($this->getLayout()->createBlock('firstslider/admin_category'))
26
+ ->renderLayout();
27
+ }
28
+
29
+ public function newAction() {
30
+ $this->_forward('edit');
31
+ }
32
+
33
+ public function editAction() {
34
+ // 1. Get ID and create model
35
+ $id = $this->getRequest()->getParam('category_id');
36
+ $model = Mage::getModel('firstslider/category');
37
+ // 2. Initial checking
38
+ if ($id) {
39
+ $model->load($id);
40
+ if (!$model->getId()) {
41
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('firstslider')->__('This category no longer exists'));
42
+ $this->_redirect('*/*/');
43
+ return;
44
+ }
45
+ }
46
+ // 3. Set entered data if was error when we do save
47
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
48
+ if (!empty($data)) {
49
+ $model->setData($data);
50
+ }
51
+ // 4. Register model to use later in blocks
52
+ Mage::register('firstslider_category', $model);
53
+ // 5. Build edit form
54
+ $this->_initAction()
55
+ ->_addBreadcrumb($id ? Mage::helper('firstslider')->__('Edit') : Mage::helper('firstslider')->__('New'), $id ? Mage::helper('firstslider')->__('Edit') : Mage::helper('firstslider')->__('New'))
56
+ ->_addContent($this->getLayout()->createBlock('firstslider/admin_category_edit')->setData('action', $this->getUrl('*/admin_category/save')))
57
+ ->_addLeft($this->getLayout()->createBlock('firstslider/admin_category_edit_tabs'))
58
+ ->renderLayout();
59
+ }
60
+
61
+ public function saveAction() {
62
+
63
+ if ($data = $this->getRequest()->getPost()) {
64
+ $model = Mage::getModel('firstslider/category');
65
+ $model->setData($data);
66
+
67
+ try {
68
+ $model->save();
69
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('firstslider')->__('Slide was successfully saved'));
70
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
71
+
72
+ if ($this->getRequest()->getParam('back')) {
73
+ $this->_redirect('*/*/edit', array('category_id' => $model->getId()));
74
+ return;
75
+ }
76
+ $this->_redirect('*/*/');
77
+ return;
78
+ } catch (Exception $e) {
79
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
80
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
81
+ $this->_redirect('*/*/edit', array('category_id' => $this->getRequest()->getParam('category_id')));
82
+ return;
83
+ }
84
+ }
85
+ $this->_redirect('*/*/');
86
+ }
87
+
88
+ public function deleteAction() {
89
+ if ($id = $this->getRequest()->getParam('category_id')) {
90
+ $name = "";
91
+ try {
92
+ $model = Mage::getModel('firstslider/category');
93
+ $model->load($id);
94
+ $name = $model->getName();
95
+ $model->delete();
96
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('firstslider')->__('Item was successfully deleted'));
97
+ $this->_redirect('*/*/');
98
+ return;
99
+ } catch (Exception $e) {
100
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
101
+ $this->_redirect('*/*/edit', array('category_id' => $id));
102
+ return;
103
+ }
104
+ }
105
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('firstslider')->__('Unable to find a item to delete'));
106
+ $this->_redirect('*/*/');
107
+ }
108
+
109
+
110
+
111
+ public function massStatusAction()
112
+ {
113
+ $itemIds = $this->getRequest()->getParam('massaction');
114
+ if(!is_array($itemIds)) {
115
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
116
+ } else {
117
+ try {
118
+ foreach ($itemIds as $itemId) {
119
+ $model = Mage::getSingleton('firstslider/category')
120
+ ->load($itemId)
121
+ ->setIs_active($this->getRequest()->getParam('status'))
122
+ ->setIsMassupdate(true)
123
+ ->save();
124
+ }
125
+ $this->_getSession()->addSuccess(
126
+ $this->__('Total of %d record(s) were successfully updated', count($itemIds))
127
+ );
128
+ } catch (Exception $e) {
129
+ $this->_getSession()->addError($e->getMessage());
130
+ }
131
+ }
132
+ $this->_redirect('*/*/index');
133
+ }
134
+ public function massDeleteAction() {
135
+ $itemIds = $this->getRequest()->getParam('massaction');
136
+ if(!is_array($itemIds)) {
137
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
138
+ } else {
139
+ try {
140
+ foreach ($itemIds as $itemId) {
141
+ $mass = Mage::getModel('firstslider/category')->load($itemId);
142
+ $mass->delete();
143
+ }
144
+ Mage::getSingleton('adminhtml/session')->addSuccess(
145
+ Mage::helper('adminhtml')->__(
146
+ 'Total of %d record(s) were successfully deleted', count($itemIds)
147
+ )
148
+ );
149
+ } catch (Exception $e) {
150
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
151
+ }
152
+ }
153
+ $this->_redirect('*/*/index');
154
+ }
155
+
156
+
157
+ public function exportCsvAction()
158
+ {
159
+ $fileName = 'items.csv';
160
+ $content = $this->getLayout()->createBlock('firstslider/admin_category_grid')
161
+ ->getCsv();
162
+ $this->_sendUploadResponse($fileName, $content);
163
+ }
164
+
165
+ public function exportXmlAction()
166
+ {
167
+ $fileName = 'items.xml';
168
+ $content = $this->getLayout()->createBlock('firstslider/admin_category_grid')
169
+ ->getXml();
170
+ $this->_sendUploadResponse($fileName, $content);
171
+ }
172
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
173
+ {
174
+ $response = $this->getResponse();
175
+ $response->setHeader('HTTP/1.1 200 OK','');
176
+ $response->setHeader('Pragma', 'public', true);
177
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
178
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
179
+ $response->setHeader('Last-Modified', date('r'));
180
+ $response->setHeader('Accept-Ranges', 'bytes');
181
+ $response->setHeader('Content-Length', strlen($content));
182
+ $response->setHeader('Content-type', $contentType);
183
+ $response->setBody($content);
184
+ $response->sendResponse();
185
+ die;
186
+ }
187
+ }
app/code/community/Magazento/Firstslider/controllers/Admin/SlideController.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+
12
+ class Magazento_Firstslider_Admin_SlideController extends Mage_Adminhtml_Controller_Action {
13
+
14
+ protected function _initAction() {
15
+ $this->loadLayout()
16
+ ->_setActiveMenu('magazento/fistslider')
17
+ ->_addBreadcrumb(Mage::helper('firstslider')->__('firstslider'), Mage::helper('firstslider')->__('firstslider'))
18
+ ->_addBreadcrumb(Mage::helper('firstslider')->__('firstslider Items'), Mage::helper('firstslider')->__('firstslider Items'))
19
+ ;
20
+ return $this;
21
+ }
22
+
23
+ public function indexAction() {
24
+ $this->_initAction()
25
+ ->_addContent($this->getLayout()->createBlock('firstslider/admin_slide'))
26
+ ->renderLayout();
27
+ }
28
+
29
+ public function newAction() {
30
+ $this->_forward('edit');
31
+ }
32
+
33
+ public function editAction() {
34
+ if (Mage::helper('firstslider')->versionUseAdminTitle()) {
35
+ $this->_title($this->__('firstslider'));
36
+ }
37
+ // 1. Get ID and create model
38
+ $id = $this->getRequest()->getParam('slide_id');
39
+ $model = Mage::getModel('firstslider/slide');
40
+ // 2. Initial checking
41
+ if ($id) {
42
+ $model->load($id);
43
+ if (!$model->getId()) {
44
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('firstslider')->__('This slide no longer exists'));
45
+ $this->_redirect('*/*/');
46
+ return;
47
+ }
48
+ }
49
+ // 3. Set entered data if was error when we do save
50
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
51
+ if (!empty($data)) {
52
+ $model->setData($data);
53
+ }
54
+ // 4. Register model to use later in blocks
55
+ Mage::register('firstslider_slide', $model);
56
+ // 5. Build edit form
57
+ $this->_initAction()
58
+ ->_addBreadcrumb($id ? Mage::helper('firstslider')->__('Edit Slide') : Mage::helper('firstslider')->__('New Item'), $id ? Mage::helper('firstslider')->__('Edit Item') : Mage::helper('firstslider')->__('New Slide'))
59
+ ->_addContent($this->getLayout()->createBlock('firstslider/admin_slide_edit')->setData('action', $this->getUrl('*/admin_slide/save')))
60
+ ->_addLeft($this->getLayout()->createBlock('firstslider/admin_slide_edit_tabs'))
61
+ ->renderLayout();
62
+ }
63
+
64
+ public function saveAction() {
65
+ if ($data = $this->getRequest()->getPost()) {
66
+ // init model and set data
67
+ $model = Mage::getModel('firstslider/slide');
68
+ // print_r($data);exit();
69
+ $model->setData($data);
70
+ // try to save it
71
+ try {
72
+ // save the data
73
+ $model->save();
74
+ // display success message
75
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('firstslider')->__('Slide was successfully saved'));
76
+ // clear previously saved data from session
77
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
78
+ // check if 'Save and Continue'
79
+ if ($this->getRequest()->getParam('back')) {
80
+ $this->_redirect('*/*/edit', array('slide_id' => $model->getId()));
81
+ return;
82
+ }
83
+ // go to grid
84
+ $this->_redirect('*/*/');
85
+ return;
86
+ } catch (Exception $e) {
87
+ // display error message
88
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
89
+ // save data in session
90
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
91
+ // redirect to edit form
92
+ $this->_redirect('*/*/edit', array('slide_id' => $this->getRequest()->getParam('slide_id')));
93
+ return;
94
+ }
95
+ }
96
+ $this->_redirect('*/*/');
97
+ }
98
+
99
+ public function deleteAction() {
100
+ // check if we know what should be deleted
101
+ if ($id = $this->getRequest()->getParam('slide_id')) {
102
+ $name = "";
103
+ try {
104
+ // init model and delete
105
+ $model = Mage::getModel('firstslider/slide');
106
+ $model->load($id);
107
+ $name = $model->getName();
108
+ $model->delete();
109
+ // display success message
110
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('firstslider')->__('Item was successfully deleted'));
111
+ // go to grid
112
+ $this->_redirect('*/*/');
113
+ return;
114
+ } catch (Exception $e) {
115
+ // display error message
116
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
117
+ // go back to edit form
118
+ $this->_redirect('*/*/edit', array('slide_id' => $id));
119
+ return;
120
+ }
121
+ }
122
+ // display error message
123
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('firstslider')->__('Unable to find a item to delete'));
124
+ // go to grid
125
+ $this->_redirect('*/*/');
126
+ }
127
+
128
+
129
+ protected function _isAllowed() {
130
+ return Mage::getSingleton('admin/session')->isAllowed('firstslider/slide');
131
+ }
132
+
133
+ public function wysiwygAction() {
134
+ $elementId = $this->getRequest()->getParam('element_id', md5(microtime()));
135
+ $content = $this->getLayout()->createBlock('adminhtml/catalog_helper_form_wysiwyg_content', '', array(
136
+ 'editor_element_id' => $elementId
137
+ ));
138
+ $this->getResponse()->setBody($content->toHtml());
139
+ }
140
+
141
+
142
+
143
+ public function massStatusAction()
144
+ {
145
+ $itemIds = $this->getRequest()->getParam('massaction');
146
+ if(!is_array($itemIds)) {
147
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
148
+ } else {
149
+ try {
150
+ foreach ($itemIds as $itemId) {
151
+ $model = Mage::getSingleton('firstslider/slide')
152
+ ->load($itemId)
153
+ ->setIs_active($this->getRequest()->getParam('status'))
154
+ ->setIsMassupdate(true)
155
+ ->save();
156
+ }
157
+ $this->_getSession()->addSuccess(
158
+ $this->__('Total of %d record(s) were successfully updated', count($itemIds))
159
+ );
160
+ } catch (Exception $e) {
161
+ $this->_getSession()->addError($e->getMessage());
162
+ }
163
+ }
164
+ $this->_redirect('*/*/index');
165
+ }
166
+ public function massDeleteAction() {
167
+ $itemIds = $this->getRequest()->getParam('massaction');
168
+ if(!is_array($itemIds)) {
169
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
170
+ } else {
171
+ try {
172
+ foreach ($itemIds as $itemId) {
173
+ $mass = Mage::getModel('firstslider/slide')->load($itemId);
174
+ $mass->delete();
175
+ }
176
+ Mage::getSingleton('adminhtml/session')->addSuccess(
177
+ Mage::helper('adminhtml')->__(
178
+ 'Total of %d record(s) were successfully deleted', count($itemIds)
179
+ )
180
+ );
181
+ } catch (Exception $e) {
182
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
183
+ }
184
+ }
185
+ $this->_redirect('*/*/index');
186
+ }
187
+
188
+
189
+ public function exportCsvAction()
190
+ {
191
+ $fileName = 'items.csv';
192
+ $content = $this->getLayout()->createBlock('firstslider/admin_slide_grid')
193
+ ->getCsv();
194
+ $this->_sendUploadResponse($fileName, $content);
195
+ }
196
+
197
+ public function exportXmlAction()
198
+ {
199
+ $fileName = 'items.xml';
200
+ $content = $this->getLayout()->createBlock('firstslider/admin_slide_grid')
201
+ ->getXml();
202
+ $this->_sendUploadResponse($fileName, $content);
203
+ }
204
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
205
+ {
206
+ $response = $this->getResponse();
207
+ $response->setHeader('HTTP/1.1 200 OK','');
208
+ $response->setHeader('Pragma', 'public', true);
209
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
210
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
211
+ $response->setHeader('Last-Modified', date('r'));
212
+ $response->setHeader('Accept-Ranges', 'bytes');
213
+ $response->setHeader('Content-Length', strlen($content));
214
+ $response->setHeader('Content-type', $contentType);
215
+ $response->setBody($content);
216
+ $response->sendResponse();
217
+ die;
218
+ }
219
+ }
app/code/community/Magazento/Firstslider/etc/config.xml ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Magazento_Firstslider>
5
+ <version>1.0.0</version>
6
+ </Magazento_Firstslider>
7
+ </modules>
8
+ <frontend>
9
+ <layout>
10
+ <updates>
11
+ <firstslider>
12
+ <file>magazento_firstslider.xml</file>
13
+ </firstslider>
14
+ </updates>
15
+ </layout>
16
+ <translate>
17
+ <modules>
18
+ <Magazento_Firstslider>
19
+ <files>
20
+ <default>Magazento_Firstslider.csv</default>
21
+ </files>
22
+ </Magazento_Firstslider>
23
+ </modules>
24
+ </translate>
25
+ </frontend>
26
+
27
+ <global>
28
+ <rewrite>
29
+ <mage_adminhtml_system_variable>
30
+ <from><![CDATA[#^/firstslider/system_variable#]]>
31
+ </from>
32
+ <to>/admin/system_variable</to>
33
+ </mage_adminhtml_system_variable>
34
+ </rewrite>
35
+ <models>
36
+ <firstslider>
37
+ <class>Magazento_Firstslider_Model</class>
38
+ <resourceModel>firstslider_mysql4</resourceModel>
39
+ </firstslider>
40
+ <firstslider_mysql4>
41
+ <class>Magazento_Firstslider_Model_Mysql4</class>
42
+ <entities>
43
+ <slide>
44
+ <table>magazento_firstslider_slide</table>
45
+ </slide>
46
+ <slide_category>
47
+ <table>magazento_firstslider_slide_category</table>
48
+ </slide_category>
49
+ <category>
50
+ <table>magazento_firstslider_category</table>
51
+ </category>
52
+ <category_store>
53
+ <table>magazento_firstslider_category_store</table>
54
+ </category_store>
55
+ </entities>
56
+ </firstslider_mysql4>
57
+ </models>
58
+ <resources>
59
+ <firstslider_setup>
60
+ <setup>
61
+ <module>Magazento_Firstslider</module>
62
+ </setup>
63
+ <connection>
64
+ <use>core_setup</use>
65
+ </connection>
66
+ </firstslider_setup>
67
+ <firstslider_write>
68
+ <connection>
69
+ <use>core_write</use>
70
+ </connection>
71
+ </firstslider_write>
72
+ <firstslider_read>
73
+ <connection>
74
+ <use>core_read</use>
75
+ </connection>
76
+ </firstslider_read>
77
+ </resources>
78
+ <blocks>
79
+ <firstslider>
80
+ <class>Magazento_Firstslider_Block</class>
81
+ </firstslider>
82
+ </blocks>
83
+ <helpers>
84
+ <firstslider>
85
+ <class>Magazento_Firstslider_Helper</class>
86
+ </firstslider>
87
+ </helpers>
88
+ </global>
89
+ <admin>
90
+ <routers>
91
+ <magazento_firstslider>
92
+ <use>admin</use>
93
+ <args>
94
+ <module>Magazento_Firstslider</module>
95
+ <frontName>firstslider</frontName>
96
+ </args>
97
+ </magazento_firstslider>
98
+ </routers>
99
+ </admin>
100
+
101
+ <adminhtml>
102
+ <acl>
103
+ <resources>
104
+ <admin>
105
+ <children>
106
+ <firstslider translate="title">
107
+ <title>Firstslider</title>
108
+ <children>
109
+ <new translate="title">
110
+ <title>Add New</title>
111
+ </new>
112
+ <slide translate="title">
113
+ <title>Manage Slides </title>
114
+ </slide>
115
+ <category translate="title">
116
+ <title>Manage Categories</title>
117
+ </category>
118
+ </children>
119
+ <sort_order>65</sort_order>
120
+ </firstslider>
121
+ <system>
122
+ <children>
123
+ <config>
124
+ <children>
125
+ <firstslider>
126
+ <title>Firstslider</title>
127
+ <sort_order>101</sort_order>
128
+ </firstslider>
129
+ </children>
130
+ </config>
131
+ </children>
132
+ </system>
133
+ </children>
134
+ </admin>
135
+ </resources>
136
+ </acl>
137
+ <menu>
138
+ <magazento translate="title" module="firstslider">
139
+ <title>Magazento</title>
140
+ <sort_order>65</sort_order>
141
+ <children>
142
+ <firstslider translate="title" module="firstslider">
143
+ <title>Firstslider</title>
144
+ <sort_order>65</sort_order>
145
+ <children>
146
+ <new translate="title" module="firstslider">
147
+ <title>Add New</title>
148
+ <action>firstslider/admin_slide/new/</action>
149
+ <resource>firstslider/admin/slide</resource>
150
+ </new>
151
+ <slide translate="title" module="firstslider">
152
+ <title>Manage Slides</title>
153
+ <action>firstslider/admin_slide/</action>
154
+ <resource>firstslider/admin/slide</resource>
155
+ </slide>
156
+ <category translate="title" module="firstslider">
157
+ <title>Manage Categories</title>
158
+ <action>firstslider/admin_category/</action>
159
+ <resource>firstslider/admin/category</resource>
160
+ </category>
161
+ <settings translate="title" module="firstslider">
162
+ <title>Settings</title>
163
+ <action>adminhtml/system_config/edit/section/firstslider</action>
164
+ <sort_order>40</sort_order>
165
+ </settings>
166
+ </children>
167
+ </firstslider>
168
+ </children>
169
+ </magazento>
170
+ </menu>
171
+ </adminhtml>
172
+ <default>
173
+ <firstslider>
174
+ <options>
175
+ <enable>1</enable>
176
+ </options>
177
+ <licence>
178
+ <email>johndoe@magazento.com</email>
179
+ <serial>000000000000000000000000</serial>
180
+ </licence>
181
+ </firstslider>
182
+ </default>
183
+ </config>
app/code/community/Magazento/Firstslider/etc/system.xml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <magazento translate="label">
5
+ <label>Magazento.com</label>
6
+ <sort_order>250</sort_order>
7
+ </magazento>
8
+ </tabs>
9
+ <sections>
10
+ <firstslider translate="label" module="firstslider">
11
+ <label>Firstslider</label>
12
+ <tab>magazento</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>100</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
+ <options translate="label">
20
+ <label>Options</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</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
+ <enable translate="label">
28
+ <label>Enable</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>51</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
+ </enable>
36
+ </fields>
37
+ </options>
38
+ <licence translate="label">
39
+ <label>Licence key</label>
40
+ <frontend_type>text</frontend_type>
41
+ <sort_order>99</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
+ <fields>
46
+ <email translate="label">
47
+ <label>E-mail</label>
48
+ <frontend_type>text</frontend_type>
49
+ <sort_order>11</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>0</show_in_store>
53
+ </email>
54
+ <serial translate="label">
55
+ <label>Serial</label>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>22</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>0</show_in_store>
61
+ </serial>
62
+ </fields>
63
+ </licence>
64
+ <info translate="label">
65
+ <label>About</label>
66
+ <frontend_type>text</frontend_type>
67
+ <frontend_model>firstslider/info</frontend_model>
68
+ <sort_order>500</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ </info>
73
+ </groups>
74
+ </firstslider>
75
+ </sections>
76
+ </config>
app/code/community/Magazento/Firstslider/sql/firstslider_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+
12
+ $installer = $this;
13
+
14
+ $installer->startSetup();
15
+
16
+ $installer->run("
17
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('magazento_firstslider_category')}` (
18
+ `category_id` smallint(6) NOT NULL AUTO_INCREMENT,
19
+ `name` varchar(255) NOT NULL,
20
+ `from_time` datetime DEFAULT NULL,
21
+ `to_time` datetime DEFAULT NULL,
22
+ `is_active` tinyint(1) NOT NULL DEFAULT '1',
23
+ PRIMARY KEY (`category_id`)
24
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
25
+ INSERT INTO `{$this->getTable('magazento_firstslider_category')}` (`category_id`, `name`, `from_time`, `to_time`, `is_active`) VALUES
26
+ (1, 'Category English', '2009-11-06 06:46:36', '2011-02-12 14:45:03', 1),
27
+ (2, 'Category Russian', '2009-11-06 10:46:36', '2014-07-02 02:45:23', 1),
28
+ (3, 'Category German', '2011-02-08 16:59:31', '2013-02-08 12:45:56', 1),
29
+ (4, 'Category French', '2011-02-10 18:20:56', NULL, 1);
30
+
31
+
32
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('magazento_firstslider_category_store')}` (
33
+ `category_id` smallint(6) unsigned DEFAULT NULL,
34
+ `store_id` smallint(6) unsigned DEFAULT NULL
35
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
36
+ INSERT INTO `{$this->getTable('magazento_firstslider_category_store')}` (`category_id`, `store_id`) VALUES
37
+ (1, 0),
38
+ (2, 0),
39
+ (3, 0),
40
+ (4, 0);
41
+
42
+
43
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('magazento_firstslider_slide')}` (
44
+ `slide_id` smallint(6) NOT NULL AUTO_INCREMENT,
45
+ `position` smallint(6) DEFAULT NULL,
46
+ `title` varchar(255) NOT NULL,
47
+ `content` text,
48
+ `from_time` datetime DEFAULT NULL,
49
+ `to_time` datetime DEFAULT NULL,
50
+ `is_active` tinyint(1) NOT NULL DEFAULT '1',
51
+ PRIMARY KEY (`slide_id`)
52
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ;
53
+ INSERT INTO `{$this->getTable('magazento_firstslider_slide')}` (`slide_id`, `position`, `title`, `content`, `from_time`, `to_time`, `is_active`) VALUES
54
+ (2, 1, 'Slide #1', '<p><img style=\"vertical-align: middle; border: 0pt none;\" src=\"/media/magazento_firstslider/slider1.jpg\" alt=\"\" /></p>', '2009-06-11 06:46:36', NULL, 1),
55
+ (3, 3, 'Slide #3', '<p><img style=\"vertical-align: middle; border: 0pt none;\" src=\"/media/magazento_firstslider/slider111.jpg\" /></p>', '2009-06-11 10:46:36', NULL, 1),
56
+ (4, 2, 'Slide #2', '<p><img style=\"vertical-align: middle; border: 0pt none;\" src=\"/media/magazento_firstslider/slider11.jpg\" alt=\"\" width=\"150\" height=\"100\" /></p>', '2009-06-11 10:46:36', NULL, 1),
57
+ (5, 4, 'Slide #4', '<p><img style=\"vertical-align: middle; border: 0pt none;\" src=\"/media/magazento_firstslider/slider2.jpg\" alt=\"\" width=\"536\" height=\"100\" /></p>', '2011-02-10 17:05:30', NULL, 1),
58
+ (6, 5, 'Slide #5', '<p><img style=\"vertical-align: middle; border: 0pt none;\" src=\"/media/magazento_firstslider/slider22.jpg\" /></p>', '2011-02-10 17:06:40', NULL, 1),
59
+ (7, 6, 'Slide #6', '<p><img style=\"vertical-align: middle; border: 0pt none;\" src=\"/media/magazento_firstslider/slider222.jpg\" /></p>', '2011-02-10 17:07:48', NULL, 1),
60
+ (8, 7, 'Slide #7', '<p><img style=\"vertical-align: middle; border: 0pt none;\" src=\"/media/magazento_firstslider/slider4.jpg\" alt=\"\" /></p>', '2011-10-02 18:21:41', NULL, 1),
61
+ (9, 8, 'Slide #8', '<p><img style=\"vertical-align: middle; border: 0pt none;\" src=\"/media/magazento_firstslider/slider44.jpg\" /></p>', '2011-10-02 18:22:07', NULL, 1),
62
+ (10, 9, 'Slide #9', '<p><img style=\"vertical-align: middle; border: 0pt none;\" src=\"/media/magazento_firstslider/slider444.jpg\" alt=\"\" /></p>', '2011-10-02 18:22:31', NULL, 1),
63
+ (11, 11, 'Slide #11', '<p><img style=\"vertical-align: middle; border: 0pt none;\" src=\"/media/magazento_firstslider/slider33.jpg\" /></p>', '2011-10-02 18:23:36', NULL, 1),
64
+ (12, 10, 'Slide #10', '<p><img style=\"vertical-align: middle; border: 0pt none;\" src=\"/media/magazento_firstslider/slider3.jpg\" alt=\"\" width=\"201\" height=\"100\" /></p>', '2011-10-02 18:23:56', NULL, 1),
65
+ (13, 12, 'Slide #12', '<p><img style=\"vertical-align: middle; border: 0pt none;\" src=\"/media/magazento_firstslider/slider333.jpg\" /></p>', '2011-10-02 18:24:15', NULL, 1);
66
+
67
+
68
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('magazento_firstslider_slide_category')}` (
69
+ `slide_id` smallint(6) unsigned DEFAULT NULL,
70
+ `category_id` smallint(6) unsigned DEFAULT NULL
71
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
72
+ INSERT INTO `{$this->getTable('magazento_firstslider_slide_category')}` (`slide_id`, `category_id`) VALUES
73
+ (8, 4),
74
+ (12, 3),
75
+ (5, 2),
76
+ (4, 1),
77
+ (6, 2),
78
+ (9, 4),
79
+ (2, 1),
80
+ (11, 3),
81
+ (3, 1),
82
+ (13, 3),
83
+ (7, 2),
84
+ (10, 4);
85
+
86
+ INSERT INTO `cms_page` (`page_id`, `title`, `root_template`, `meta_keywords`, `meta_description`, `identifier`, `content_heading`, `content`, `creation_time`, `update_time`, `is_active`, `sort_order`, `layout_update_xml`, `custom_theme`, `custom_root_template`, `custom_layout_update_xml`, `custom_theme_from`, `custom_theme_to`) VALUES
87
+ (9999, 'Firstslider demo page', 'one_column', '', '', 'firstslider', '', '<div class=\"firstsliderssamplecontainer\">\r\n<div class=\"firstsliderssample1\">{{block type=\"firstslider/firstslider\" name=\"firstslider\" categoryid=\"1\" sliderid=\"1\" topbuttons=\"1\" bottombuttons=\"0\" style=\"width:150px;height: 100px;\" duration=\"0.6\" frequency=\"5\" autoglide=\"true\"}}</div>\r\n<div class=\"firstsliderssample2\">{{block type=\"firstslider/firstslider\" name=\"firstslider\" categoryid=\"2\" sliderid=\"2\" topbuttons=\"1\" bottombuttons=\"0\" style=\"width:535px;height: 100px;\" duration=\"0.5\" frequency=\"5\" autoglide=\"true\"}}</div>\r\n<div class=\"firstsliderssample3\">{{block type=\"firstslider/firstslider\" name=\"firstslider\" categoryid=\"3\" sliderid=\"3\" topbuttons=\"1\" bottombuttons=\"0\" style=\"width:200px;height: 100px;\" duration=\"0.4\" frequency=\"5\" autoglide=\"true\"}}</div>\r\n</div>\r\n<div class=\"firstsliderssample4\">\r\n<p>{{block type=\"firstslider/firstslider\" name=\"firstslider\" categoryid=\"4\" sliderid=\"4\" topbuttons=\"0\" bottombuttons=\"1\" style=\"width:891px;height: 390px;\" duration=\"0.3\" frequency=\"5\" autoglide=\"true\"}}</p>\r\n</div>', '2011-02-10 06:43:51', '2011-02-10 20:43:36', 1, 0, '', '', '', '', NULL, NULL);
88
+
89
+
90
+ INSERT INTO `cms_page_store` (`page_id`, `store_id`) VALUES
91
+ (9999, 0);
92
+
93
+
94
+ ");
95
+
96
+ $installer->endSetup();
97
+ ?>
app/design/frontend/default/default/layout/magazento_firstslider.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addItem"><type>skin_js</type><name>magazento_firstslider/slider.js</name><params/></action>
6
+ <action method="addCss"><stylesheet>magazento_firstslider/slider.css</stylesheet></action>
7
+ </reference>
8
+ </default>
9
+ </layout>
app/design/frontend/default/default/template/magazento/firstslider/slider.phtml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (Mage::getStoreConfig('firstslider/options/enable')) {
3
+ $cid = $this->getCategoryid();
4
+ $slider_id = $this->getSliderid();
5
+ $slider_style=$this->getStyle();
6
+ $slider_duration=$this->getDuration();
7
+ $slider_frequency=$this->getFrequency();
8
+ $slider_autoglide=$this->getAutoglide();
9
+ $slider_topbuttons=$this->getTopbuttons();
10
+ $slider_bottombuttons=$this->getBottombuttons();
11
+
12
+ $model = $this->getModel();
13
+ if ($model->hasItems($cid)) {
14
+ $collection = $model->getItems($cid);
15
+
16
+ ?>
17
+
18
+
19
+ <div style="<?php echo $slider_style; ?>">
20
+ <div id="glider<?php echo $slider_id; ?>">
21
+ <?php if ($slider_topbuttons) { ?>
22
+ <div class="controls" >
23
+ <?php $collection = $model->getItems($cid); ?>
24
+ <?php foreach ($collection as $item) { ?>
25
+ <a href="#section<?php echo $item['slide_id'] ?>"> <?php echo $item['title'] ?></a>
26
+ <?php } ?>
27
+ </div>
28
+ <?php } ?>
29
+ <div style="<?php echo $slider_style; ?>" class="scroller">
30
+ <div class="content">
31
+ <?php $collection = $model->getItems($cid); ?>
32
+ <?php foreach ($collection as $item) { ?>
33
+ <div style="<?php echo $slider_style; ?>" class="section" id="section<?php echo $item['slide_id'] ?>">
34
+ <?php echo $item['content'] ?>
35
+ </div>
36
+ <?php } ?>
37
+ </div>
38
+ </div>
39
+
40
+ </div>
41
+ <?php if ($slider_bottombuttons) { ?>
42
+ <a href="#" onclick="my_glider<?php echo $slider_id; ?>.previous();return false;">Previous</a> | <a href="#" onclick="my_glider<?php echo $slider_id; ?>.next();return false">Next</a>
43
+ <?php } ?>
44
+ <script type="text/javascript" charset="utf-8">
45
+ var my_glider<?php echo $slider_id; ?>
46
+ = new Glider('glider<?php echo $slider_id; ?>',
47
+ {duration:<?php echo $slider_duration; ?>,
48
+ autoGlide:<?php echo $slider_autoglide; ?>,
49
+ frequency:<?php echo $slider_frequency; ?> });
50
+ </script>
51
+
52
+ </div>
53
+
54
+ <?php } } ?>
app/etc/modules/Magazento_Firstslider.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magazento_Firstslider>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Magazento_Firstslider>
8
+ </modules>
9
+ </config>
app/locale/en_US/Magazento_Firstslider.csv ADDED
File without changes
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Magazento_EasySlider</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>Single license</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Magazento_EasySlider</summary>
10
+ <description>Magazento_EasySlider</description>
11
+ <notes>1.0.0</notes>
12
+ <authors><author><name>volgodark</name><user>auto-converted</user><email>volgodark@gmail.com</email></author></authors>
13
+ <date>2011-03-18</date>
14
+ <time>14:40:06</time>
15
+ <contents><target name="magelocale"><dir name="en_US"><file name="Magazento_Firstslider.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="magazento_firstslider.xml" hash="1f49105bad18b6ad2e53591fd3dcdc27"/></dir><dir name="template"><dir name="magazento"><dir name="firstslider"><file name="slider.phtml" hash="5d5d8bea0770a6218b3d855e18369861"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="magazento"><dir name="fistslider"><file name="slider.css" hash="4bdefdce1038b232fc2d4e318bc6ecd7"/><file name="slider.js" hash="e9fd58dc968c5249e2d58144fa2ce854"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Magazento"><dir name="Firstslider"><dir name="Block"><dir name="Admin"><dir name="Category"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="9dceed08d60661946ce26ac60611bb75"/></dir><file name="Form.php" hash="f40530b462988c377dcc3162f3fd26ac"/><file name="Tabs.php" hash="72c0b2a8d13a1e89b8b03abaf150f270"/></dir><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="16f11dd61ed5a1d351aa3afc3c298151"/></dir></dir><file name="Edit.php" hash="6924efded6d94c1fe68a75c04ecbfdff"/><file name="Grid.php" hash="0790257c8297fd6aa69426ab3229436f"/></dir><dir name="Slide"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="da7d2b795fec1df03d875fef21c7986b"/><file name="Other.php" hash="8eccb569a3aac5d0d3c9908645a81d59"/></dir><file name="Form.php" hash="d72da4a206ec3cc35e453858f5592ee2"/><file name="Tabs.php" hash="aad8bc46dab8c8937ce0c6599b665c4d"/></dir><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="9dac1db324f25d2f56f5559341697bdb"/></dir></dir><file name="Edit.php" hash="8bdba1ed90c65741f8e5cb437289a38e"/><file name="Grid.php" hash="e7902ccc6fb6349a7ffb6f38f553d78c"/></dir><file name="Category.php" hash="8380f27391e3a01924f3e2f0d4b8a8f9"/><file name="Slide.php" hash="bc52e5db2930c902993e607a37e1965e"/></dir><file name="Firstslider.php" hash="2b5b61a3d12dbab647c41bdd2d5f743f"/><file name="Firstslider_original.php" hash="2b5b61a3d12dbab647c41bdd2d5f743f"/><file name="Info.php" hash="95f83c742169ac37772a9821374eb801"/></dir><dir name="controllers"><dir name="Admin"><file name="CategoryController.php" hash="1cc251c79879bdc9ffac142cc491ccc3"/><file name="SlideController.php" hash="a98f1e112640a5e587cc0d026510150d"/></dir></dir><dir name="etc"><file name="config.xml" hash="0b45f97f416148b587870a03856b2e69"/><file name="system.xml" hash="b351328f9c0c56a9f40206a13ef19230"/></dir><dir name="Helper"><file name="Data.php" hash="88a73c89d127991221c2ea524a25518c"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Category"><file name="Collection.php" hash="be53f7d61b001ef6ede396f8d32094db"/></dir><dir name="Slide"><file name="Collection.php" hash="af059d43b4bf62b297b54e62b1802421"/></dir><file name="Category.php" hash="5601806ba27047ae457323fa03891a2e"/><file name="Slide.php" hash="f129ba90e64dbea1b4c4747deeaff31b"/></dir><dir name="Wysiwyg"><file name="Config.php" hash="88dfb918a96b51994781203d70030628"/></dir><file name="Category.php" hash="95c1f1fb65ff0faa7ffb82e4d3ca9c6c"/><file name="Data.php" hash="c1d20208ae0b3e8b20d26c0e7632c773"/><file name="Slide.php" hash="bb06101596d4406c445ff357eca9a466"/></dir><dir name="sql"><dir name="firstslider_setup"><file name="mysql4-install-1.0.0.php" hash="890ffe5820b0cd1a86e155c22187f071"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magazento_Firstslider.xml" hash="54e4efef14128e50cbedb40895730485"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>
skin/frontend/default/default/magazento/fistslider/slider.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ div.scroller {
2
+ overflow: hidden;
3
+ border:1px solid #cccccc;
4
+ }
5
+ .firstsliderssamplecontainer a {color:#999}
6
+ div.scroller div.section {
7
+ overflow:hidden;
8
+ float:left;
9
+ padding:0em;
10
+ padding-left: 1px;
11
+ }
12
+ div.scroller div.content {
13
+ width: 10000px;
14
+ padding:0px;
15
+ }
16
+ .firstsliderssample1 {
17
+ float: left;
18
+ padding-right: 3px;
19
+ }
20
+ .firstsliderssample2 {
21
+ float: left;
22
+ padding-right: 3px;
23
+ }
24
+
25
+ .firstsliderssample3 {
26
+ float: left;
27
+ padding-right: 3px;
28
+ }
29
+ .firstsliderssample4 {
30
+ float: left;
31
+ margin-top: 11px;
32
+ }
33
+
34
+ .firstsliderssamplecontainer{
35
+ /* margin: 10px;*/
36
+ }
skin/frontend/default/default/magazento/fistslider/slider.js ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Glider = Class.create();
3
+ Object.extend(Object.extend(Glider.prototype, Abstract.prototype), {
4
+ initialize: function(wrapper, options){
5
+ this.scrolling = false;
6
+ this.wrapper = $(wrapper);
7
+ this.scroller = this.wrapper.down('div.scroller');
8
+ this.sections = this.wrapper.getElementsBySelector('div.section');
9
+ this.options = Object.extend({ duration: 1.0, frequency: 3 }, options || {});
10
+
11
+ this.sections.each( function(section, index) {
12
+ section._index = index;
13
+ });
14
+
15
+ this.events = {
16
+ click: this.click.bind(this)
17
+ };
18
+
19
+ this.addObservers();
20
+ if(this.options.initialSection) this.moveTo(this.options.initialSection, this.scroller, { duration:this.options.duration }); // initialSection should be the id of the section you want to show up on load
21
+ if(this.options.autoGlide) this.start();
22
+ },
23
+
24
+ addObservers: function() {
25
+ var controls = this.wrapper.getElementsBySelector('div.controls a');
26
+ controls.invoke('observe', 'click', this.events.click);
27
+ },
28
+
29
+ click: function(event) {
30
+ this.stop();
31
+ var element = Event.findElement(event, 'a');
32
+ if (this.scrolling) this.scrolling.cancel();
33
+
34
+ this.moveTo(element.href.split("#")[1], this.scroller, { duration:this.options.duration });
35
+ Event.stop(event);
36
+ },
37
+
38
+ moveTo: function(element, container, options){
39
+ this.current = $(element);
40
+
41
+ Position.prepare();
42
+ var containerOffset = Position.cumulativeOffset(container),
43
+ elementOffset = Position.cumulativeOffset($(element));
44
+
45
+ this.scrolling = new Effect.SmoothScroll(container,
46
+ {duration:options.duration, x:(elementOffset[0]-containerOffset[0]), y:(elementOffset[1]-containerOffset[1])});
47
+ return false;
48
+ },
49
+
50
+ next: function(){
51
+ if (this.current) {
52
+ var currentIndex = this.current._index;
53
+ var nextIndex = (this.sections.length - 1 == currentIndex) ? 0 : currentIndex + 1;
54
+ } else var nextIndex = 1;
55
+
56
+ this.moveTo(this.sections[nextIndex], this.scroller, {
57
+ duration: this.options.duration
58
+ });
59
+ },
60
+
61
+ previous: function(){
62
+ if (this.current) {
63
+ var currentIndex = this.current._index;
64
+ var prevIndex = (currentIndex == 0) ? this.sections.length - 1 :
65
+ currentIndex - 1;
66
+ } else var prevIndex = this.sections.length - 1;
67
+
68
+ this.moveTo(this.sections[prevIndex], this.scroller, {
69
+ duration: this.options.duration
70
+ });
71
+ },
72
+
73
+ stop: function()
74
+ {
75
+ clearTimeout(this.timer);
76
+ },
77
+
78
+ start: function()
79
+ {
80
+ this.periodicallyUpdate();
81
+ },
82
+
83
+ periodicallyUpdate: function()
84
+ {
85
+ if (this.timer != null) {
86
+ clearTimeout(this.timer);
87
+ this.next();
88
+ }
89
+ this.timer = setTimeout(this.periodicallyUpdate.bind(this), this.options.frequency*1000);
90
+ }
91
+
92
+ });
93
+
94
+ Effect.SmoothScroll = Class.create();
95
+ Object.extend(Object.extend(Effect.SmoothScroll.prototype, Effect.Base.prototype), {
96
+ initialize: function(element) {
97
+ this.element = $(element);
98
+ var options = Object.extend({
99
+ x: 0,
100
+ y: 0,
101
+ mode: 'absolute'
102
+ } , arguments[1] || {} );
103
+ this.start(options);
104
+ },
105
+ setup: function() {
106
+ if (this.options.continuous && !this.element._ext ) {
107
+ this.element.cleanWhitespace();
108
+ this.element._ext=true;
109
+ this.element.appendChild(this.element.firstChild);
110
+ }
111
+
112
+ this.originalLeft=this.element.scrollLeft;
113
+ this.originalTop=this.element.scrollTop;
114
+
115
+ if(this.options.mode == 'absolute') {
116
+ this.options.x -= this.originalLeft;
117
+ this.options.y -= this.originalTop;
118
+ }
119
+ },
120
+ update: function(position) {
121
+ this.element.scrollLeft = this.options.x * position + this.originalLeft;
122
+ this.element.scrollTop = this.options.y * position + this.originalTop;
123
+ }
124
+ });