news_module - Version 0.1.2

Version Notes

- Enhancements : add news section in left and right column,add news link in top links.

Download this release

Release Info

Developer Magento Core Team
Extension news_module
Version 0.1.2
Comparing to
See all releases


Code changes from version 0.1.1 to 0.1.2

Files changed (32) hide show
  1. app/code/local/Biztech/News/Block/Adminhtml/News.php +54 -54
  2. app/code/local/Biztech/News/Block/Adminhtml/News/Edit.php +66 -52
  3. app/code/local/Biztech/News/Block/Adminhtml/News/Edit/Form.php +18 -18
  4. app/code/local/Biztech/News/Block/Adminhtml/News/Edit/Tab/Form.php +70 -63
  5. app/code/local/Biztech/News/Block/Adminhtml/News/Edit/Tab/Publishingoptions.php +42 -42
  6. app/code/local/Biztech/News/Block/Adminhtml/News/Edit/Tab/Seo.php +37 -37
  7. app/code/local/Biztech/News/Block/Adminhtml/News/Edit/Tabs.php +35 -35
  8. app/code/local/Biztech/News/Block/Adminhtml/News/Grid.php +113 -107
  9. app/code/local/Biztech/News/Block/Html/Topmenu.php +0 -211
  10. app/code/local/Biztech/News/Block/News.php +70 -49
  11. app/code/local/Biztech/News/Helper/Data.php +46 -34
  12. app/code/local/Biztech/News/Model/Mysql4/News.php +9 -9
  13. app/code/local/Biztech/News/Model/Mysql4/News/Collection.php +9 -9
  14. app/code/local/Biztech/News/Model/Mysql4/Newsdata.php +9 -0
  15. app/code/local/Biztech/News/Model/Mysql4/Newsdata/Collection.php +10 -0
  16. app/code/local/Biztech/News/Model/News.php +9 -9
  17. app/code/local/Biztech/News/Model/Newsdata.php +10 -0
  18. app/code/local/Biztech/News/controllers/Adminhtml/NewsController.php +328 -217
  19. app/code/local/Biztech/News/controllers/IndexController.php +38 -61
  20. app/code/local/Biztech/News/etc/config.xml +159 -161
  21. app/code/local/Biztech/News/etc/system.xml +99 -62
  22. app/code/local/Biztech/News/sql/news_setup/mysql4-data-upgrade-0.1.1-0.1.2.php +34 -0
  23. app/code/local/Biztech/News/sql/news_setup/mysql4-install-0.1.0-0.1.1.php +28 -0
  24. app/code/local/Biztech/News/sql/news_setup/mysql4-install-0.1.0.php +27 -28
  25. app/design/adminhtml/default/default/layout/news.xml +13 -10
  26. app/design/frontend/default/default/layout/news.xml +49 -23
  27. app/design/frontend/default/default/template/news/news.phtml +15 -11
  28. app/design/frontend/default/default/template/news/news_column.phtml +44 -0
  29. app/design/frontend/default/default/template/news/newslist.phtml +31 -42
  30. app/etc/modules/Biztech_News.xml +8 -8
  31. package.xml +19 -20
  32. skin/frontend/default/default/news/css/news.css +25 -0
app/code/local/Biztech/News/Block/Adminhtml/News.php CHANGED
@@ -1,55 +1,55 @@
1
- <?php
2
- class Biztech_News_Block_Adminhtml_News extends Mage_Adminhtml_Block_Widget_Grid_Container
3
- {
4
- public function __construct()
5
- {
6
- $this->_controller = 'adminhtml_news';
7
- $this->_blockGroup = 'news';
8
- $this->_headerText = Mage::helper('news')->__('News Manager');
9
- $this->_addButtonLabel = Mage::helper('news')->__('Add News');
10
- parent::__construct();
11
- }
12
- public function _prepareLayout()
13
- {
14
- return parent::_prepareLayout();
15
- }
16
-
17
- public function getNews()
18
- {
19
- if (!$this->hasData('news')) {
20
- $this->setData('news', Mage::registry('news'));
21
- }
22
- return $this->getData('news');
23
-
24
- }
25
-
26
- protected function _beforeToHtml()
27
- {
28
- Mage::helper('news/toolbar')->create($this, array(
29
- 'default_order' => 'created_time',
30
- 'dir' => 'asc',
31
- 'limits' => Mage::helper('news')->commentsPerPage(),
32
- )
33
- );
34
-
35
- return $this;
36
- }
37
-
38
- public function getPreparedCollection()
39
- {
40
- return $this->_prepareCollection();
41
- }
42
- protected function _prepareCollection()
43
- {
44
- $collection=Mage::getModel('news/news')->getCollection()->addFieldToFilter("status",array("eq"=>1));
45
-
46
- $collection->setPageSize(10);
47
-
48
- if ($this->getRequest()->getParam('p') > 0)
49
- $collection->setCurPage($this->getRequest()->getParam('p'));
50
-
51
- $this->setData('cached_collection', $collection);
52
-
53
- return $this->getData('cached_collection');
54
- }
55
  }
1
+ <?php
2
+ class Biztech_News_Block_Adminhtml_News extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_news';
7
+ $this->_blockGroup = 'news';
8
+ $this->_headerText = Mage::helper('news')->__('News Manager');
9
+ $this->_addButtonLabel = Mage::helper('news')->__('Add News');
10
+ parent::__construct();
11
+ }
12
+ public function _prepareLayout()
13
+ {
14
+ return parent::_prepareLayout();
15
+ }
16
+
17
+ public function getNews()
18
+ {
19
+ if (!$this->hasData('news')) {
20
+ $this->setData('news', Mage::registry('news'));
21
+ }
22
+ return $this->getData('news');
23
+
24
+ }
25
+
26
+ protected function _beforeToHtml()
27
+ {
28
+ Mage::helper('news/toolbar')->create($this, array(
29
+ 'default_order' => 'created_time',
30
+ 'dir' => 'asc',
31
+ 'limits' => Mage::helper('news')->commentsPerPage(),
32
+ )
33
+ );
34
+
35
+ return $this;
36
+ }
37
+
38
+ public function getPreparedCollection()
39
+ {
40
+ return $this->_prepareCollection();
41
+ }
42
+ protected function _prepareCollection()
43
+ {
44
+ $collection=Mage::getModel('news/news')->getCollection()->addFieldToFilter("status",array("eq"=>1));
45
+
46
+ $collection->setPageSize(10);
47
+
48
+ if ($this->getRequest()->getParam('p') > 0)
49
+ $collection->setCurPage($this->getRequest()->getParam('p'));
50
+
51
+ $this->setData('cached_collection', $collection);
52
+
53
+ return $this->getData('cached_collection');
54
+ }
55
  }
app/code/local/Biztech/News/Block/Adminhtml/News/Edit.php CHANGED
@@ -1,53 +1,67 @@
1
- <?php
2
-
3
- class Biztech_News_Block_Adminhtml_News_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
- {
5
- public function __construct()
6
- {
7
- parent::__construct();
8
-
9
- $this->_objectId = 'id';
10
- $this->_blockGroup = 'news';
11
- $this->_controller = 'adminhtml_news';
12
-
13
- $this->_updateButton('save', 'label', Mage::helper('news')->__('Save News'));
14
- $this->_updateButton('delete', 'label', Mage::helper('news')->__('Delete News'));
15
-
16
- $this->_addButton('saveandcontinue', array(
17
- 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
- 'onclick' => 'saveAndContinueEdit()',
19
- 'class' => 'save',
20
- ), -100);
21
-
22
- $this->_formScripts[] = "
23
- function toggleEditor() {
24
- if (tinyMCE.getInstanceById('news_content') == null) {
25
- tinyMCE.execCommand('mceAddControl', false, 'news_content');
26
- } else {
27
- tinyMCE.execCommand('mceRemoveControl', false, 'news_content');
28
- }
29
- }
30
-
31
- function saveAndContinueEdit(){
32
- editForm.submit($('edit_form').action+'back/edit/');
33
- }
34
- ";
35
- }
36
-
37
- public function getHeaderText()
38
- {
39
- if( Mage::registry('news_data') && Mage::registry('news_data')->getId() ) {
40
- return Mage::helper('news')->__("Edit News '%s'", $this->htmlEscape(Mage::registry('news_data')->getTitle()));
41
- } else {
42
- return Mage::helper('news')->__('Add News');
43
- }
44
- }
45
- protected function _prepareLayout()
46
- {
47
- parent::_prepareLayout();
48
- if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
49
- $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
50
- }
51
- }
52
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
1
+ <?php
2
+
3
+ class Biztech_News_Block_Adminhtml_News_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'news';
11
+ $this->_controller = 'adminhtml_news';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('news')->__('Save News'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('news')->__('Delete News'));
15
+ $this->_removeButton('delete');
16
+ $this->_removeButton('back');
17
+
18
+ $id = $this->getRequest()->getParam('store', 0);
19
+ $this->_addButton('delete', array(
20
+ 'label' => Mage::helper('news')->__('Delete News'),
21
+ 'onclick' => 'confirmSetLocation(\''.Mage::helper('news')->__('Are you sure?').'\', \''.$this->getUrl('*/*/delete', array('id'=>$this->getRequest()->getParam('id'), 'store'=>$id)).'\')',
22
+ 'class' => 'delete',
23
+ ));
24
+ $this->_addButton('back', array(
25
+ 'label' => Mage::helper('news')->__('Back'),
26
+ 'onclick' => 'setLocation(\''.$this->getUrl('*/*/', array('store'=>$id)).'\')',
27
+ 'class' => 'back',
28
+ ),-1,1);
29
+
30
+ $this->_addButton('saveandcontinue', array(
31
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
32
+ 'onclick' => 'saveAndContinueEdit()',
33
+ 'class' => 'save',
34
+ ), -100);
35
+
36
+ $this->_formScripts[] = "
37
+ function toggleEditor() {
38
+ if (tinyMCE.getInstanceById('news_content') == null) {
39
+ tinyMCE.execCommand('mceAddControl', false, 'news_content');
40
+ } else {
41
+ tinyMCE.execCommand('mceRemoveControl', false, 'news_content');
42
+ }
43
+ }
44
+
45
+ function saveAndContinueEdit(){
46
+ editForm.submit($('edit_form').action+'back/edit/');
47
+ }
48
+ ";
49
+ }
50
+
51
+ public function getHeaderText()
52
+ {
53
+ if( Mage::registry('news_data') && Mage::registry('news_data')->getId() ) {
54
+ return Mage::helper('news')->__("Edit News '%s'", $this->htmlEscape(Mage::registry('news_data')->getTitle()));
55
+ } else {
56
+ return Mage::helper('news')->__('Add News');
57
+ }
58
+ }
59
+ protected function _prepareLayout()
60
+ {
61
+ parent::_prepareLayout();
62
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
63
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
64
+ }
65
+ }
66
+
67
  }
app/code/local/Biztech/News/Block/Adminhtml/News/Edit/Form.php CHANGED
@@ -1,19 +1,19 @@
1
- <?php
2
-
3
- class Biztech_News_Block_Adminhtml_News_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
- {
5
- protected function _prepareForm()
6
- {
7
- $form = new Varien_Data_Form(array(
8
- 'id' => 'edit_form',
9
- 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
- 'method' => 'post',
11
- 'enctype' => 'multipart/form-data'
12
- )
13
- );
14
-
15
- $form->setUseContainer(true);
16
- $this->setForm($form);
17
- return parent::_prepareForm();
18
- }
19
  }
1
+ <?php
2
+
3
+ class Biztech_News_Block_Adminhtml_News_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
  }
app/code/local/Biztech/News/Block/Adminhtml/News/Edit/Tab/Form.php CHANGED
@@ -1,64 +1,71 @@
1
- <?php
2
-
3
- class Biztech_News_Block_Adminhtml_News_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
- {
5
- protected function _prepareForm()
6
- {
7
- $form = new Varien_Data_Form();
8
- $this->setForm($form);
9
- $fieldset = $form->addFieldset('news_form', array('legend'=>Mage::helper('news')->__('News information')));
10
-
11
- $fieldset->addField('title', 'text', array(
12
- 'label' => Mage::helper('news')->__('Title'),
13
- 'class' => 'required-entry',
14
- 'required' => true,
15
- 'name' => 'title',
16
- ));
17
-
18
- $fieldset->addField('status', 'select', array(
19
- 'label' => Mage::helper('news')->__('Published?'),
20
- 'name' => 'status',
21
- 'values' => array(
22
- array(
23
- 'value' => 1,
24
- 'label' => Mage::helper('news')->__('Yes'),
25
- ),
26
-
27
- array(
28
- 'value' => 2,
29
- 'label' => Mage::helper('news')->__('No'),
30
- ),
31
- ),
32
- ));
33
-
34
- $fieldset->addField('intro', 'editor', array(
35
- 'name' => 'intro',
36
- 'label' => Mage::helper('news')->__('Intro'),
37
- 'title' => Mage::helper('news')->__('Intro'),
38
- 'style' => 'width:700px; height:500px;',
39
- 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('files_browser_window_url'=> $this->getBaseUrl().'admin/cms_wysiwyg_images/index/',)),
40
- 'wysiwyg' => true,
41
- 'required' => true,
42
- ));
43
-
44
-
45
- $fieldset->addField('news_content', 'editor', array(
46
- 'name' => 'news_content',
47
- 'label' => Mage::helper('news')->__('Content'),
48
- 'title' => Mage::helper('news')->__('Content'),
49
- 'style' => 'width:700px; height:500px;',
50
- 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('files_browser_window_url'=> $this->getBaseUrl().'admin/cms_wysiwyg_images/index/',)),
51
- 'wysiwyg' => true,
52
- 'required' => true,
53
- ));
54
-
55
- if ( Mage::getSingleton('adminhtml/session')->getNewsData() )
56
- {
57
- $form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
58
- Mage::getSingleton('adminhtml/session')->setNewsData(null);
59
- } elseif ( Mage::registry('news_data') ) {
60
- $form->setValues(Mage::registry('news_data')->getData());
61
- }
62
- return parent::_prepareForm();
63
- }
 
 
 
 
 
 
 
64
  }
1
+ <?php
2
+
3
+ class Biztech_News_Block_Adminhtml_News_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $store = $this->getRequest()->getParam('store', 0);
10
+ $fieldset = $form->addFieldset('news_form', array('legend'=>Mage::helper('news')->__('News information')));
11
+
12
+ $fieldset->addField('title', 'text', array(
13
+ 'label' => Mage::helper('news')->__('Title'),
14
+ 'class' => 'required-entry',
15
+ 'required' => true,
16
+ 'name' => 'title',
17
+ ));
18
+
19
+ $fieldset->addField('status', 'select', array(
20
+ 'label' => Mage::helper('news')->__('Published?'),
21
+ 'name' => 'status',
22
+ 'values' => array(
23
+ array(
24
+ 'value' => 1,
25
+ 'label' => Mage::helper('news')->__('Yes'),
26
+ ),
27
+
28
+ array(
29
+ 'value' => 2,
30
+ 'label' => Mage::helper('news')->__('No'),
31
+ ),
32
+ ),
33
+ ));
34
+
35
+ $fieldset->addField('intro', 'editor', array(
36
+ 'name' => 'intro',
37
+ 'label' => Mage::helper('news')->__('Intro'),
38
+ 'title' => Mage::helper('news')->__('Intro'),
39
+ 'style' => 'width:700px; height:500px;',
40
+ 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('files_browser_window_url'=> $this->getBaseUrl().'admin/cms_wysiwyg_images/index/',)),
41
+ 'wysiwyg' => true,
42
+ 'required' => true,
43
+ ));
44
+
45
+
46
+ $fieldset->addField('news_content', 'editor', array(
47
+ 'name' => 'news_content',
48
+ 'label' => Mage::helper('news')->__('Content'),
49
+ 'title' => Mage::helper('news')->__('Content'),
50
+ 'style' => 'width:700px; height:500px;',
51
+ 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('files_browser_window_url'=> $this->getBaseUrl().'admin/cms_wysiwyg_images/index/',)),
52
+ 'wysiwyg' => true,
53
+ 'required' => true,
54
+ ));
55
+ $fieldset->addField('store_id', 'hidden', array(
56
+ 'label' => Mage::helper('news')->__('Store Id'),
57
+ 'required' => false,
58
+ 'name' => 'store_id'
59
+ ));
60
+
61
+ if ( Mage::getSingleton('adminhtml/session')->getNewsData() )
62
+ {
63
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
64
+ Mage::getSingleton('adminhtml/session')->setNewsData(null);
65
+ } elseif ( Mage::registry('news_data') ) {
66
+ Mage::registry('news_data')->setData('store_id',$store);
67
+ $form->setValues(Mage::registry('news_data')->getData());
68
+ }
69
+ return parent::_prepareForm();
70
+ }
71
  }
app/code/local/Biztech/News/Block/Adminhtml/News/Edit/Tab/Publishingoptions.php CHANGED
@@ -1,43 +1,43 @@
1
- <?php
2
-
3
- class Biztech_News_Block_Adminhtml_News_Edit_Tab_Publishingoptions extends Mage_Adminhtml_Block_Widget_Form
4
- {
5
- protected function _prepareForm()
6
- {
7
- $form = new Varien_Data_Form();
8
- $this->setForm($form);
9
- $fieldset = $form->addFieldset('news_form', array('legend'=>Mage::helper('news')->__('News information')));
10
-
11
- $fieldset->addField('date_to_publish', 'date', array(
12
- 'label' => Mage::helper('news')->__('Start publishing on'),
13
- 'tabindex' => 1,
14
- 'after_element_html' =>"<button type='button' class='scalable' onclick=\"$('date_to_publish').setValue('')\">Clear</button>",
15
- 'image' => $this->getSkinUrl('images/grid-cal.gif'),
16
- 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
17
- 'required' => true,
18
- 'name' => 'date_to_publish',
19
- ));
20
-
21
- $fieldset->addField('date_to_unpublish', 'date', array(
22
- 'label' => Mage::helper('news')->__('End publishing on'),
23
- 'tabindex' => 1,
24
- 'after_element_html' =>"<button type='button' class='scalable' onclick=\"$('date_to_unpublish').setValue('')\">Clear</button>",
25
- 'image' => $this->getSkinUrl('images/grid-cal.gif'),
26
- 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
27
- 'required' => true,
28
- 'name' => 'date_to_unpublish',
29
- ));
30
-
31
-
32
-
33
-
34
- if ( Mage::getSingleton('adminhtml/session')->getNewsData() )
35
- {
36
- $form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
37
- Mage::getSingleton('adminhtml/session')->setNewsData(null);
38
- } elseif ( Mage::registry('news_data') ) {
39
- $form->setValues(Mage::registry('news_data')->getData());
40
- }
41
- return parent::_prepareForm();
42
- }
43
  }
1
+ <?php
2
+
3
+ class Biztech_News_Block_Adminhtml_News_Edit_Tab_Publishingoptions extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('news_form', array('legend'=>Mage::helper('news')->__('News information')));
10
+
11
+ $fieldset->addField('date_to_publish', 'date', array(
12
+ 'label' => Mage::helper('news')->__('Start publishing on'),
13
+ 'tabindex' => 1,
14
+ 'after_element_html' =>"<button type='button' class='scalable' onclick=\"$('date_to_publish').setValue('')\">Clear</button>",
15
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
16
+ 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
17
+ 'required' => true,
18
+ 'name' => 'date_to_publish',
19
+ ));
20
+
21
+ $fieldset->addField('date_to_unpublish', 'date', array(
22
+ 'label' => Mage::helper('news')->__('End publishing on'),
23
+ 'tabindex' => 1,
24
+ 'after_element_html' =>"<button type='button' class='scalable' onclick=\"$('date_to_unpublish').setValue('')\">Clear</button>",
25
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
26
+ 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
27
+ 'required' => true,
28
+ 'name' => 'date_to_unpublish',
29
+ ));
30
+
31
+
32
+
33
+
34
+ if ( Mage::getSingleton('adminhtml/session')->getNewsData() )
35
+ {
36
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
37
+ Mage::getSingleton('adminhtml/session')->setNewsData(null);
38
+ } elseif ( Mage::registry('news_data') ) {
39
+ $form->setValues(Mage::registry('news_data')->getData());
40
+ }
41
+ return parent::_prepareForm();
42
+ }
43
  }
app/code/local/Biztech/News/Block/Adminhtml/News/Edit/Tab/Seo.php CHANGED
@@ -1,38 +1,38 @@
1
- <?php
2
-
3
- class Biztech_News_Block_Adminhtml_News_Edit_Tab_Seo extends Mage_Adminhtml_Block_Widget_Form
4
- {
5
- protected function _prepareForm()
6
- {
7
- $form = new Varien_Data_Form();
8
- $this->setForm($form);
9
- $fieldset = $form->addFieldset('news_form', array('legend'=>Mage::helper('news')->__('News information')));
10
-
11
-
12
- $fieldset->addField('browser_title', 'text', array(
13
- 'label' => Mage::helper('news')->__('Page Title'),
14
- 'required' => false,
15
- 'name' => 'browser_title',
16
- ));
17
- $fieldset->addField('seo_keywords', 'textarea', array(
18
- 'label' => Mage::helper('news')->__('Keywords'),
19
- 'required' => false,
20
- 'name' => 'seo_keywords',
21
- ));
22
- $fieldset->addField('seo_description', 'textarea', array(
23
- 'label' => Mage::helper('news')->__('Description'),
24
- 'required' => false,
25
- 'name' => 'seo_description',
26
- ));
27
-
28
-
29
- if ( Mage::getSingleton('adminhtml/session')->getNewsData() )
30
- {
31
- $form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
32
- Mage::getSingleton('adminhtml/session')->setNewsData(null);
33
- } elseif ( Mage::registry('news_data') ) {
34
- $form->setValues(Mage::registry('news_data')->getData());
35
- }
36
- return parent::_prepareForm();
37
- }
38
  }
1
+ <?php
2
+
3
+ class Biztech_News_Block_Adminhtml_News_Edit_Tab_Seo extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('news_form', array('legend'=>Mage::helper('news')->__('News information')));
10
+
11
+
12
+ $fieldset->addField('browser_title', 'text', array(
13
+ 'label' => Mage::helper('news')->__('Page Title'),
14
+ 'required' => false,
15
+ 'name' => 'browser_title',
16
+ ));
17
+ $fieldset->addField('seo_keywords', 'textarea', array(
18
+ 'label' => Mage::helper('news')->__('Keywords'),
19
+ 'required' => false,
20
+ 'name' => 'seo_keywords',
21
+ ));
22
+ $fieldset->addField('seo_description', 'textarea', array(
23
+ 'label' => Mage::helper('news')->__('Description'),
24
+ 'required' => false,
25
+ 'name' => 'seo_description',
26
+ ));
27
+
28
+
29
+ if ( Mage::getSingleton('adminhtml/session')->getNewsData() )
30
+ {
31
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
32
+ Mage::getSingleton('adminhtml/session')->setNewsData(null);
33
+ } elseif ( Mage::registry('news_data') ) {
34
+ $form->setValues(Mage::registry('news_data')->getData());
35
+ }
36
+ return parent::_prepareForm();
37
+ }
38
  }
app/code/local/Biztech/News/Block/Adminhtml/News/Edit/Tabs.php CHANGED
@@ -1,36 +1,36 @@
1
- <?php
2
-
3
- class Biztech_News_Block_Adminhtml_News_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
- {
5
-
6
- public function __construct()
7
- {
8
- parent::__construct();
9
- $this->setId('news_tabs');
10
- $this->setDestElementId('edit_form');
11
- $this->setTitle(Mage::helper('news')->__('News Information'));
12
- }
13
-
14
- protected function _beforeToHtml()
15
- {
16
- $this->addTab('form_section', array(
17
- 'label' => Mage::helper('news')->__('News Information'),
18
- 'title' => Mage::helper('news')->__('News Information'),
19
- 'content' => $this->getLayout()->createBlock('news/adminhtml_news_edit_tab_form')->toHtml(),
20
- ));
21
-
22
- $this->addTab('publishing_options', array(
23
- 'label' => Mage::helper('news')->__('Publishing Options'),
24
- 'title' => Mage::helper('news')->__('Publishing Options'),
25
- 'content' => $this->getLayout()->createBlock('news/adminhtml_news_edit_tab_publishingoptions')->toHtml(),
26
- ));
27
-
28
- $this->addTab('seo', array(
29
- 'label' => Mage::helper('news')->__('Seo Options'),
30
- 'title' => Mage::helper('news')->__('Seo Options'),
31
- 'content' => $this->getLayout()->createBlock('news/adminhtml_news_edit_tab_seo')->toHtml(),
32
- ));
33
-
34
- return parent::_beforeToHtml();
35
- }
36
  }
1
+ <?php
2
+
3
+ class Biztech_News_Block_Adminhtml_News_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('news_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('news')->__('News Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('news')->__('News Information'),
18
+ 'title' => Mage::helper('news')->__('News Information'),
19
+ 'content' => $this->getLayout()->createBlock('news/adminhtml_news_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ $this->addTab('publishing_options', array(
23
+ 'label' => Mage::helper('news')->__('Publishing Options'),
24
+ 'title' => Mage::helper('news')->__('Publishing Options'),
25
+ 'content' => $this->getLayout()->createBlock('news/adminhtml_news_edit_tab_publishingoptions')->toHtml(),
26
+ ));
27
+
28
+ $this->addTab('seo', array(
29
+ 'label' => Mage::helper('news')->__('Seo Options'),
30
+ 'title' => Mage::helper('news')->__('Seo Options'),
31
+ 'content' => $this->getLayout()->createBlock('news/adminhtml_news_edit_tab_seo')->toHtml(),
32
+ ));
33
+
34
+ return parent::_beforeToHtml();
35
+ }
36
  }
app/code/local/Biztech/News/Block/Adminhtml/News/Grid.php CHANGED
@@ -1,108 +1,114 @@
1
- <?php
2
-
3
- class Biztech_News_Block_Adminhtml_News_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
- {
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setId('newsGrid');
9
- $this->setDefaultSort('news_id');
10
- $this->setDefaultDir('ASC');
11
- $this->setSaveParametersInSession(true);
12
- }
13
-
14
- protected function _prepareCollection()
15
- {
16
- $collection = Mage::getModel('news/news')->getCollection();
17
- $this->setCollection($collection);
18
- return parent::_prepareCollection();
19
- }
20
-
21
- protected function _prepareColumns()
22
- {
23
- $this->addColumn('news_id', array(
24
- 'header' => Mage::helper('news')->__('ID'),
25
- 'align' =>'right',
26
- 'width' => '50px',
27
- 'index' => 'news_id',
28
- ));
29
-
30
- $this->addColumn('title', array(
31
- 'header' => Mage::helper('news')->__('Title'),
32
- 'align' =>'left',
33
- 'index' => 'title',
34
- ));
35
-
36
- $this->addColumn('status', array(
37
- 'header' => Mage::helper('news')->__('Status'),
38
- 'align' => 'left',
39
- 'width' => '80px',
40
- 'index' => 'status',
41
- 'type' => 'options',
42
- 'options' => array(
43
- 1 => 'Enabled',
44
- 2 => 'Disabled',
45
- ),
46
- ));
47
-
48
- $this->addColumn('action',
49
- array(
50
- 'header' => Mage::helper('news')->__('Action'),
51
- 'width' => '100',
52
- 'type' => 'action',
53
- 'getter' => 'getId',
54
- 'actions' => array(
55
- array(
56
- 'caption' => Mage::helper('news')->__('Edit'),
57
- 'url' => array('base'=> '*/*/edit'),
58
- 'field' => 'id'
59
- )
60
- ),
61
- 'filter' => false,
62
- 'sortable' => false,
63
- 'index' => 'stores',
64
- 'is_system' => true,
65
- ));
66
-
67
- $this->addExportType('*/*/exportCsv', Mage::helper('news')->__('CSV'));
68
- $this->addExportType('*/*/exportXml', Mage::helper('news')->__('XML'));
69
-
70
- return parent::_prepareColumns();
71
- }
72
-
73
- protected function _prepareMassaction()
74
- {
75
- $this->setMassactionIdField('news_id');
76
- $this->getMassactionBlock()->setFormFieldName('news');
77
-
78
- $this->getMassactionBlock()->addItem('delete', array(
79
- 'label' => Mage::helper('news')->__('Delete'),
80
- 'url' => $this->getUrl('*/*/massDelete'),
81
- 'confirm' => Mage::helper('news')->__('Are you sure?')
82
- ));
83
-
84
- $statuses = Mage::getSingleton('news/status')->getOptionArray();
85
-
86
- array_unshift($statuses, array('label'=>'', 'value'=>''));
87
- $this->getMassactionBlock()->addItem('status', array(
88
- 'label'=> Mage::helper('news')->__('Change status'),
89
- 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
90
- 'additional' => array(
91
- 'visibility' => array(
92
- 'name' => 'status',
93
- 'type' => 'select',
94
- 'class' => 'required-entry',
95
- 'label' => Mage::helper('news')->__('Status'),
96
- 'values' => $statuses
97
- )
98
- )
99
- ));
100
- return $this;
101
- }
102
-
103
- public function getRowUrl($row)
104
- {
105
- return $this->getUrl('*/*/edit', array('id' => $row->getId()));
106
- }
107
-
 
 
 
 
 
 
108
  }
1
+ <?php
2
+
3
+ class Biztech_News_Block_Adminhtml_News_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('newsGrid');
9
+ $this->setDefaultSort('news_id');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $store = $this->getRequest()->getParam('store', 0);
17
+
18
+ $prefix = Mage::getConfig()->getTablePrefix();
19
+
20
+ $collection = Mage::getModel('news/news')->getCollection();
21
+
22
+ $collection->getSelect()->joinLeft($prefix.'news_data', 'main_table.news_id ='.$prefix.'news_data.news_id AND '.$prefix.'news_data.store_id = '.$store,array('status','title','news_content','intro','date_to_publish','date_to_unpublish',));
23
+ $this->setCollection($collection);
24
+ return parent::_prepareCollection();
25
+ }
26
+
27
+ protected function _prepareColumns()
28
+ {
29
+ $this->addColumn('news_id', array(
30
+ 'header' => Mage::helper('news')->__('ID'),
31
+ 'align' =>'right',
32
+ 'width' => '50px',
33
+ 'index' => 'news_id',
34
+ ));
35
+
36
+ $this->addColumn('title', array(
37
+ 'header' => Mage::helper('news')->__('Title'),
38
+ 'align' =>'left',
39
+ 'index' => 'title',
40
+ ));
41
+
42
+ $this->addColumn('status', array(
43
+ 'header' => Mage::helper('news')->__('Status'),
44
+ 'align' => 'left',
45
+ 'width' => '80px',
46
+ 'index' => 'status',
47
+ 'type' => 'options',
48
+ 'options' => array(
49
+ 1 => 'Enabled',
50
+ 2 => 'Disabled',
51
+ ),
52
+ ));
53
+
54
+ $this->addColumn('action',
55
+ array(
56
+ 'header' => Mage::helper('news')->__('Action'),
57
+ 'width' => '100',
58
+ 'type' => 'action',
59
+ 'getter' => 'getId',
60
+ 'actions' => array(
61
+ array(
62
+ 'caption' => Mage::helper('news')->__('Edit'),
63
+ 'url' => array('base'=> '*/*/edit','params' => array('store' => $this->getRequest()->getParam('store', 0))),
64
+ 'field' => 'id'
65
+ )
66
+ ),
67
+ 'filter' => false,
68
+ 'sortable' => false,
69
+ 'index' => 'stores',
70
+ 'is_system' => true,
71
+ ));
72
+
73
+ $this->addExportType('*/*/exportCsv', Mage::helper('news')->__('CSV'));
74
+ $this->addExportType('*/*/exportXml', Mage::helper('news')->__('XML'));
75
+
76
+ return parent::_prepareColumns();
77
+ }
78
+
79
+ protected function _prepareMassaction()
80
+ {
81
+ $this->setMassactionIdField('news_id');
82
+ $this->getMassactionBlock()->setFormFieldName('news');
83
+
84
+ $this->getMassactionBlock()->addItem('delete', array(
85
+ 'label' => Mage::helper('news')->__('Delete'),
86
+ 'url' => $this->getUrl('*/*/massDelete', array('store'=>$this->getRequest()->getParam('store', 0))),
87
+ 'confirm' => Mage::helper('news')->__('Are you sure?')
88
+ ));
89
+
90
+ $statuses = Mage::getSingleton('news/status')->getOptionArray();
91
+
92
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
93
+ $this->getMassactionBlock()->addItem('status', array(
94
+ 'label'=> Mage::helper('news')->__('Change status'),
95
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true,'store'=>$this->getRequest()->getParam('store', 0))),
96
+ 'additional' => array(
97
+ 'visibility' => array(
98
+ 'name' => 'status',
99
+ 'type' => 'select',
100
+ 'class' => 'required-entry',
101
+ 'label' => Mage::helper('news')->__('Status'),
102
+ 'values' => $statuses
103
+ )
104
+ )
105
+ ));
106
+ return $this;
107
+ }
108
+
109
+ public function getRowUrl($row)
110
+ {
111
+ return $this->getUrl('*/*/edit', array('id' => $row->getId(),'store'=>$this->getRequest()->getParam('store', 0)));
112
+ }
113
+
114
  }
app/code/local/Biztech/News/Block/Html/Topmenu.php DELETED
@@ -1,211 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Page
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Top menu block
29
- *
30
- * @category Mage
31
- * @package Mage_Page
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Biztech_News_Block_Html_Topmenu extends Mage_Core_Block_Template
35
- {
36
- /**
37
- * Top menu data tree
38
- *
39
- * @var Varien_Data_Tree_Node
40
- */
41
- protected $_menu;
42
-
43
- /**
44
- * Init top menu tree structure
45
- */
46
- public function _construct()
47
- {
48
- $this->_menu = new Varien_Data_Tree_Node(array(), 'root', new Varien_Data_Tree());
49
- }
50
-
51
- /**
52
- * Get top menu html
53
- *
54
- * @param string $outermostClass
55
- * @param string $childrenWrapClass
56
- * @return string
57
- */
58
- public function getHtml($outermostClass = '', $childrenWrapClass = '')
59
- {
60
- Mage::dispatchEvent('page_block_html_topmenu_gethtml_before', array(
61
- 'menu' => $this->_menu
62
- ));
63
-
64
- $this->_menu->setOutermostClass($outermostClass);
65
- $this->_menu->setChildrenWrapClass($childrenWrapClass);
66
-
67
- $html = $this->_getHtml($this->_menu, $childrenWrapClass);
68
-
69
- Mage::dispatchEvent('page_block_html_topmenu_gethtml_after', array(
70
- 'menu' => $this->_menu,
71
- 'html' => $html
72
- ));
73
-
74
- if(Mage::getStoreConfig('news/news_general/enabled') == 1)
75
- {
76
- $active = ($this->getRequest()->getRouteName()=='news' ? 'active' : '');
77
- $html .= "<li class='$outermostItemClass $active'><a class='$outermostItemClass' href='" . Mage::getUrl('news') . "'><span>" . Mage::helper('news')->__('News') . "</span></a></li>";
78
- }
79
- return $html;
80
- }
81
-
82
- /**
83
- * Recursively generates top menu html from data that is specified in $menuTree
84
- *
85
- * @param Varien_Data_Tree_Node $menuTree
86
- * @param string $childrenWrapClass
87
- * @return string
88
- */
89
- protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
90
- {
91
- $html = '';
92
-
93
- $children = $menuTree->getChildren();
94
- $parentLevel = $menuTree->getLevel();
95
- $childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
96
-
97
- $counter = 1;
98
- $childrenCount = $children->count();
99
-
100
- $parentPositionClass = $menuTree->getPositionClass();
101
- $itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
102
-
103
- foreach ($children as $child) {
104
-
105
- $child->setLevel($childLevel);
106
- $child->setIsFirst($counter == 1);
107
- $child->setIsLast($counter == $childrenCount);
108
- $child->setPositionClass($itemPositionClassPrefix . $counter);
109
-
110
- $outermostClassCode = '';
111
- $outermostClass = $menuTree->getOutermostClass();
112
-
113
- if ($childLevel == 0 && $outermostClass) {
114
- $outermostClassCode = ' class="' . $outermostClass . '" ';
115
- $child->setClass($outermostClass);
116
- }
117
-
118
- $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
119
- $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>'
120
- . $this->escapeHtml($child->getName()) . '</span></a>';
121
-
122
- if ($child->hasChildren()) {
123
- if (!empty($childrenWrapClass)) {
124
- $html .= '<div class="' . $childrenWrapClass . '">';
125
- }
126
- $html .= '<ul class="level' . $childLevel . '">';
127
- $html .= $this->_getHtml($child, $childrenWrapClass);
128
- $html .= '</ul>';
129
-
130
- if (!empty($childrenWrapClass)) {
131
- $html .= '</div>';
132
- }
133
- }
134
- $html .= '</li>';
135
-
136
- $counter++;
137
- }
138
-
139
- return $html;
140
- }
141
-
142
- /**
143
- * Generates string with all attributes that should be present in menu item element
144
- *
145
- * @param Varien_Data_Tree_Node $item
146
- * @return string
147
- */
148
- protected function _getRenderedMenuItemAttributes(Varien_Data_Tree_Node $item)
149
- {
150
- $html = '';
151
- $attributes = $this->_getMenuItemAttributes($item);
152
-
153
- foreach ($attributes as $attributeName => $attributeValue) {
154
- $html .= ' ' . $attributeName . '="' . str_replace('"', '\"', $attributeValue) . '"';
155
- }
156
-
157
- return $html;
158
- }
159
-
160
- /**
161
- * Returns array of menu item's attributes
162
- *
163
- * @param Varien_Data_Tree_Node $item
164
- * @return array
165
- */
166
- protected function _getMenuItemAttributes(Varien_Data_Tree_Node $item)
167
- {
168
- $menuItemClasses = $this->_getMenuItemClasses($item);
169
- $attributes = array(
170
- 'class' => implode(' ', $menuItemClasses)
171
- );
172
-
173
- return $attributes;
174
- }
175
-
176
- /**
177
- * Returns array of menu item's classes
178
- *
179
- * @param Varien_Data_Tree_Node $item
180
- * @return array
181
- */
182
- protected function _getMenuItemClasses(Varien_Data_Tree_Node $item)
183
- {
184
- $classes = array();
185
-
186
- $classes[] = 'level' . $item->getLevel();
187
- $classes[] = $item->getPositionClass();
188
-
189
- if ($item->getIsFirst()) {
190
- $classes[] = 'first';
191
- }
192
-
193
- if ($item->getIsActive()) {
194
- $classes[] = 'active';
195
- }
196
-
197
- if ($item->getIsLast()) {
198
- $classes[] = 'last';
199
- }
200
-
201
- if ($item->getClass()) {
202
- $classes[] = $item->getClass();
203
- }
204
-
205
- if ($item->hasChildren()) {
206
- $classes[] = 'parent';
207
- }
208
-
209
- return $classes;
210
- }
211
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Biztech/News/Block/News.php CHANGED
@@ -1,50 +1,71 @@
1
- <?php
2
- class Biztech_News_Block_News extends Mage_Core_Block_Template
3
- {
4
- public function _prepareLayout()
5
- {
6
-
7
- return parent::_prepareLayout();
8
- }
9
-
10
- public function getNews()
11
- {
12
- $id = $this->getRequest()->getParam("id");
13
- $news = Mage::getModel('news/news')->load($id);
14
- return $news;
15
-
16
- }
17
-
18
- protected function _beforeToHtml()
19
- {
20
- Mage::helper('news/toolbar')->create($this, array(
21
- 'default_order' => 'created_time',
22
- 'dir' => 'asc',
23
- 'limits' => Mage::helper('news')->commentsPerPage(),
24
- )
25
- );
26
-
27
- return $this;
28
- }
29
-
30
- public function getPreparedCollection()
31
- {
32
- return $this->_prepareCollection();
33
- }
34
- protected function _prepareCollection()
35
- {
36
-
37
- $collection=Mage::getModel('news/news')->getCollection()->addFieldToFilter("status",array("eq"=>1))->addFieldToFilter("date_to_unpublish",array("gteq"=>date('Y-m-d 00:00:00')))->addFieldToFilter("date_to_publish",array("lt"=>date('Y-m-d 23:59:59')));
38
-
39
- $collection->setPageSize(10);
40
-
41
- if ($this->getRequest()->getParam('p') > 0)
42
- $collection->setCurPage($this->getRequest()->getParam('p'));
43
-
44
- $this->setData('cached_collection', $collection);
45
-
46
-
47
- return $this->getData('cached_collection');
48
- }
49
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  }
1
+ <?php
2
+ class Biztech_News_Block_News extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+
7
+ return parent::_prepareLayout();
8
+ }
9
+
10
+ public function getNews()
11
+ {
12
+
13
+
14
+ $store = Mage::app()->getStore()->getId();
15
+ $news = Mage::getModel("news/news");
16
+ $newsId = $this->getRequest()->getParam("id");
17
+ $news->load($newsId,"news_id");
18
+
19
+ $model_text = Mage::getModel('news/newsdata')->getCollection()->addFieldToFilter('store_id',$store)->addFieldToFilter('news_id',$newsId)->getData();
20
+ $text_data = $model_text[0];
21
+ $news = $news->setTitle($text_data['title'])
22
+ ->setNewsContent($text_data['news_content'])
23
+ ->setStatus($text_data['status'])
24
+ ->setIntro($text_data['intro'])
25
+ ->setDateToPublish($text_data['date_to_publish'])
26
+ ->setDateToUnpublish($text_data['date_to_unpublish'])
27
+ ->setBrowserTitle($text_data['browser_title'])
28
+ ->setSeoKeywords($text_data['seo_keywords'])
29
+ ->setSeoDescription($text_data['seo_description']);
30
+
31
+ $this->setData('news',$news);
32
+
33
+ return $news;
34
+
35
+
36
+
37
+ }
38
+
39
+ protected function _beforeToHtml()
40
+ {
41
+ Mage::helper('news/toolbar')->create($this, array(
42
+ 'default_order' => 'created_time',
43
+ 'dir' => 'asc',
44
+ 'limits' => Mage::helper('news')->commentsPerPage(),
45
+ )
46
+ );
47
+
48
+ return $this;
49
+ }
50
+
51
+ public function getPreparedCollection()
52
+ {
53
+ return $this->_prepareCollection();
54
+ }
55
+ protected function _prepareCollection()
56
+ {
57
+
58
+
59
+ $collection = Mage::helper('news')->getNewsCollection();
60
+ $collection->setPageSize(10);
61
+
62
+ if ($this->getRequest()->getParam('p') > 0)
63
+ $collection->setCurPage($this->getRequest()->getParam('p'));
64
+
65
+ $this->setData('cached_collection', $collection);
66
+
67
+
68
+ return $this->getData('cached_collection');
69
+ }
70
+
71
  }
app/code/local/Biztech/News/Helper/Data.php CHANGED
@@ -1,35 +1,47 @@
1
- <?php
2
-
3
- class Biztech_News_Helper_Data extends Mage_Core_Helper_Abstract
4
- {
5
- public function getNewsUrl(){
6
- return $this->_getUrl('news/index');
7
- }
8
- public function commentsPerPage($store = null)
9
- {
10
- $count = 10;
11
-
12
- if (!$count) {
13
- return self::DEFAULT_PAGE_COUNT;
14
- }
15
-
16
- return $count;
17
- }
18
- public function defaultPostSort($store = null)
19
- {
20
- return "ASC";
21
- }
22
- public function getEnabled()
23
- {
24
- return true;
25
- }
26
- public function filterWYS($text)
27
- {
28
- $processorModelName = version_compare(Mage::getVersion(), '1.3.3.0', '>') ? 'widget/template_filter' : 'core/email_template_filter';
29
- $processor = Mage::getModel($processorModelName);
30
- if ($processor instanceof Mage_Core_Model_Email_Template_Filter) {
31
- return $processor->filter($text);
32
- }
33
- return $text;
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
1
+ <?php
2
+
3
+ class Biztech_News_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function getNewsUrl(){
6
+ return $this->_getUrl('news/index');
7
+ }
8
+ public function commentsPerPage($store = null)
9
+ {
10
+ $count = 10;
11
+
12
+ if (!$count) {
13
+ return self::DEFAULT_PAGE_COUNT;
14
+ }
15
+
16
+ return $count;
17
+ }
18
+ public function defaultPostSort($store = null)
19
+ {
20
+ return "ASC";
21
+ }
22
+ public function getEnabled()
23
+ {
24
+ return true;
25
+ }
26
+ public function filterWYS($text)
27
+ {
28
+ $processorModelName = version_compare(Mage::getVersion(), '1.3.3.0', '>') ? 'widget/template_filter' : 'core/email_template_filter';
29
+ $processor = Mage::getModel($processorModelName);
30
+ if ($processor instanceof Mage_Core_Model_Email_Template_Filter) {
31
+ return $processor->filter($text);
32
+ }
33
+ return $text;
34
+ }
35
+
36
+ public function getNewsCollection()
37
+ {
38
+ $store = Mage::app()->getStore()->getId();
39
+ $prefix = Mage::getConfig()->getTablePrefix();
40
+ $collection = Mage::getModel('news/news')->getCollection();
41
+ $collection->getSelect()->join($prefix.'news_data', 'main_table.news_id ='.$prefix.'news_data.news_id AND '.$prefix.'news_data.store_id = '.$store.' AND '.$prefix.'news_data.status = 1',array('status','title','news_content','intro','store_id','date_to_publish','date_to_unpublish','browser_title','seo_keywords','seo_description'));
42
+
43
+ $collection->addFieldToFilter("date_to_unpublish",array("gteq"=>date('Y-m-d 00:00:00')))->addFieldToFilter("date_to_publish",array("lt"=>date('Y-m-d 23:59:59')));
44
+
45
+ return $collection;
46
+ }
47
  }
app/code/local/Biztech/News/Model/Mysql4/News.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- class Biztech_News_Model_Mysql4_News extends Mage_Core_Model_Mysql4_Abstract
4
- {
5
- public function _construct()
6
- {
7
- // Note that the news_id refers to the key field in your database table.
8
- $this->_init('news/news', 'news_id');
9
- }
10
  }
1
+ <?php
2
+
3
+ class Biztech_News_Model_Mysql4_News extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the news_id refers to the key field in your database table.
8
+ $this->_init('news/news', 'news_id');
9
+ }
10
  }
app/code/local/Biztech/News/Model/Mysql4/News/Collection.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- class Biztech_News_Model_Mysql4_News_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
- {
5
- public function _construct()
6
- {
7
- parent::_construct();
8
- $this->_init('news/news');
9
- }
10
  }
1
+ <?php
2
+
3
+ class Biztech_News_Model_Mysql4_News_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('news/news');
9
+ }
10
  }
app/code/local/Biztech/News/Model/Mysql4/Newsdata.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Biztech_News_Model_Mysql4_Newsdata extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('news/newsdata', 'text_id');
8
+ }
9
+ }
app/code/local/Biztech/News/Model/Mysql4/Newsdata/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Biztech_News_Model_Mysql4_Newsdata_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('news/newsdata');
9
+ }
10
+ }
app/code/local/Biztech/News/Model/News.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- class Biztech_News_Model_News extends Mage_Core_Model_Abstract
4
- {
5
- public function _construct()
6
- {
7
- parent::_construct();
8
- $this->_init('news/news');
9
- }
10
  }
1
+ <?php
2
+
3
+ class Biztech_News_Model_News extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('news/news');
9
+ }
10
  }
app/code/local/Biztech/News/Model/Newsdata.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Biztech_News_Model_Newsdata extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('news/newsdata');
9
+ }
10
+ }
app/code/local/Biztech/News/controllers/Adminhtml/NewsController.php CHANGED
@@ -1,218 +1,329 @@
1
- <?php
2
-
3
- class Biztech_News_Adminhtml_NewsController extends Mage_Adminhtml_Controller_action
4
- {
5
-
6
- protected function _initAction() {
7
- $this->loadLayout()
8
- ->_setActiveMenu('news/items')
9
- ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
-
11
- return $this;
12
- }
13
-
14
- public function indexAction() {
15
- $this->_initAction()
16
- ->renderLayout();
17
- }
18
-
19
- public function editAction() {
20
- $id = $this->getRequest()->getParam('id');
21
- $model = Mage::getModel('news/news')->load($id);
22
-
23
- if ($model->getId() || $id == 0) {
24
- $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
25
- if (!empty($data)) {
26
- $model->setData($data);
27
- }
28
-
29
- Mage::register('news_data', $model);
30
-
31
- $this->loadLayout();
32
- $this->_setActiveMenu('news/items');
33
-
34
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
35
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
36
-
37
- $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
38
-
39
- $this->_addContent($this->getLayout()->createBlock('news/adminhtml_news_edit'))
40
- ->_addLeft($this->getLayout()->createBlock('news/adminhtml_news_edit_tabs'));
41
-
42
- $this->renderLayout();
43
- } else {
44
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('news')->__('Item does not exist'));
45
- $this->_redirect('*/*/');
46
- }
47
- }
48
-
49
- public function newAction() {
50
- $this->_forward('edit');
51
- }
52
-
53
- public function saveAction() {
54
- if ($data = $this->getRequest()->getPost()) {
55
-
56
- if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
57
- try {
58
-
59
- $uploader = new Varien_File_Uploader('filename');
60
-
61
- $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
62
- $uploader->setAllowRenameFiles(false);
63
-
64
-
65
- $uploader->setFilesDispersion(false);
66
-
67
- $path = Mage::getBaseDir('media') . DS ;
68
- $uploader->save($path, $_FILES['filename']['name'] );
69
-
70
- } catch (Exception $e) {
71
-
72
- }
73
- $data['filename'] = $_FILES['filename']['name'];
74
- }
75
-
76
- $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
77
- try {
78
- $publish_date = Mage::app()->getLocale()->date($data['date_to_publish'], $format, null, false);
79
- $unpublish_date = Mage::app()->getLocale()->date($data['date_to_unpublish'], $format, null, false);
80
- }
81
- catch (Exception $e)
82
- {
83
- Mage::getSingleton('adminhtml/session')->addError("Invalid Date");
84
- $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
85
- return;
86
- }
87
-
88
- $model = Mage::getModel('news/news');
89
- $model->setData($data)
90
- ->setId($this->getRequest()->getParam('id'));
91
-
92
- try {
93
- if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
94
- $model->setCreatedTime(now())
95
- ->setUpdateTime(now());
96
- } else {
97
- $model->setUpdateTime(now());
98
- }
99
-
100
- $model->save();
101
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('news')->__('News was successfully saved'));
102
- Mage::getSingleton('adminhtml/session')->setFormData(false);
103
-
104
- if ($this->getRequest()->getParam('back')) {
105
- $this->_redirect('*/*/edit', array('id' => $model->getId()));
106
- return;
107
- }
108
- $this->_redirect('*/*/');
109
- return;
110
- } catch (Exception $e) {
111
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
112
- Mage::getSingleton('adminhtml/session')->setFormData($data);
113
- $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
114
- return;
115
- }
116
- }
117
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('news')->__('Unable to find item to save'));
118
- $this->_redirect('*/*/');
119
- }
120
-
121
- public function deleteAction() {
122
- if( $this->getRequest()->getParam('id') > 0 ) {
123
- try {
124
- $model = Mage::getModel('news/news');
125
-
126
- $model->setId($this->getRequest()->getParam('id'))
127
- ->delete();
128
-
129
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
130
- $this->_redirect('*/*/');
131
- } catch (Exception $e) {
132
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
133
- $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
134
- }
135
- }
136
- $this->_redirect('*/*/');
137
- }
138
-
139
- public function massDeleteAction() {
140
- $newsIds = $this->getRequest()->getParam('news');
141
- if(!is_array($newsIds)) {
142
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
143
- } else {
144
- try {
145
- foreach ($newsIds as $newsId) {
146
- $news = Mage::getModel('news/news')->load($newsId);
147
- $news->delete();
148
- }
149
- Mage::getSingleton('adminhtml/session')->addSuccess(
150
- Mage::helper('adminhtml')->__(
151
- 'Total of %d record(s) were successfully deleted', count($newsIds)
152
- )
153
- );
154
- } catch (Exception $e) {
155
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
156
- }
157
- }
158
- $this->_redirect('*/*/index');
159
- }
160
-
161
- public function massStatusAction()
162
- {
163
- $newsIds = $this->getRequest()->getParam('news');
164
- if(!is_array($newsIds)) {
165
- Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
166
- } else {
167
- try {
168
- foreach ($newsIds as $newsId) {
169
- $news = Mage::getSingleton('news/news')
170
- ->load($newsId)
171
- ->setStatus($this->getRequest()->getParam('status'))
172
- ->setIsMassupdate(true)
173
- ->save();
174
- }
175
- $this->_getSession()->addSuccess(
176
- $this->__('Total of %d record(s) were successfully updated', count($newsIds))
177
- );
178
- } catch (Exception $e) {
179
- $this->_getSession()->addError($e->getMessage());
180
- }
181
- }
182
- $this->_redirect('*/*/index');
183
- }
184
-
185
- public function exportCsvAction()
186
- {
187
- $fileName = 'news.csv';
188
- $content = $this->getLayout()->createBlock('news/adminhtml_news_grid')
189
- ->getCsv();
190
-
191
- $this->_sendUploadResponse($fileName, $content);
192
- }
193
-
194
- public function exportXmlAction()
195
- {
196
- $fileName = 'news.xml';
197
- $content = $this->getLayout()->createBlock('news/adminhtml_news_grid')
198
- ->getXml();
199
-
200
- $this->_sendUploadResponse($fileName, $content);
201
- }
202
-
203
- protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
204
- {
205
- $response = $this->getResponse();
206
- $response->setHeader('HTTP/1.1 200 OK','');
207
- $response->setHeader('Pragma', 'public', true);
208
- $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
209
- $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
210
- $response->setHeader('Last-Modified', date('r'));
211
- $response->setHeader('Accept-Ranges', 'bytes');
212
- $response->setHeader('Content-Length', strlen($content));
213
- $response->setHeader('Content-type', $contentType);
214
- $response->setBody($content);
215
- $response->sendResponse();
216
- die;
217
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  }
1
+ <?php
2
+
3
+ class Biztech_News_Adminhtml_NewsController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('news/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('News Manager'), Mage::helper('adminhtml')->__('News Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function editAction() {
20
+
21
+ $store = $this->getRequest()->getParam('store', 0);
22
+ $id = $this->getRequest()->getParam('id');
23
+ $model = Mage::getModel('news/news')->load($id);
24
+
25
+ $model_text = Mage::getModel('news/newsdata')->getCollection()->addFieldToFilter('store_id',$store)->addFieldToFilter('news_id',$model->getNewsId())->getData();
26
+
27
+ if(count($model_text) == 0)
28
+ {
29
+ $model_text = Mage::getModel('news/newsdata')->getCollection()->addFieldToFilter('store_id',0)->addFieldToFilter('news_id',$model->getNewsId())->getData();
30
+ }
31
+
32
+ $text_data = $model_text[0];
33
+ $model = $model->setTitle($text_data['title'])
34
+ ->setNewsContent($text_data['news_content'])
35
+ ->setStatus($text_data['status'])
36
+ ->setIntro($text_data['intro'])
37
+ ->setDateToPublish($text_data['date_to_publish'])
38
+ ->setDateToUnpublish($text_data['date_to_unpublish'])
39
+ ->setBrowserTitle($text_data['browser_title'])
40
+ ->setSeoKeywords($text_data['seo_keywords'])
41
+ ->setSeoDescription($text_data['seo_description']);
42
+
43
+
44
+ if ($model->getId() || $id == 0) {
45
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
46
+ if (!empty($data)) {
47
+ $model->setData($data);
48
+ $model_text->setData($data);
49
+ }
50
+
51
+ Mage::register('news_data', $model);
52
+
53
+ $this->loadLayout();
54
+ $this->_setActiveMenu('news/items');
55
+
56
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('News Manager'), Mage::helper('adminhtml')->__('News Manager'));
57
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
58
+
59
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
60
+
61
+ $this->_addContent($this->getLayout()->createBlock('news/adminhtml_news_edit'))
62
+ ->_addLeft($this->getLayout()->createBlock('adminhtml/store_switcher'))
63
+ ->_addLeft($this->getLayout()->createBlock('news/adminhtml_news_edit_tabs'));
64
+
65
+ $this->renderLayout();
66
+ } else {
67
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('news')->__('News does not exist'));
68
+ $this->_redirect('*/*/',array('store'=>$store));
69
+ }
70
+ }
71
+
72
+ public function newAction() {
73
+ $this->_forward('edit');
74
+ }
75
+
76
+ public function saveAction() {
77
+ if ($data = $this->getRequest()->getPost()) {
78
+
79
+ if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
80
+ try {
81
+
82
+ $uploader = new Varien_File_Uploader('filename');
83
+
84
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
85
+ $uploader->setAllowRenameFiles(false);
86
+
87
+
88
+ $uploader->setFilesDispersion(false);
89
+
90
+ $path = Mage::getBaseDir('media') . DS ;
91
+ $uploader->save($path, $_FILES['filename']['name'] );
92
+
93
+ } catch (Exception $e) {
94
+
95
+ }
96
+ $data['filename'] = $_FILES['filename']['name'];
97
+ }
98
+
99
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
100
+ try {
101
+ $publish_date = Mage::app()->getLocale()->date($data['date_to_publish'], $format, null, false);
102
+ $unpublish_date = Mage::app()->getLocale()->date($data['date_to_unpublish'], $format, null, false);
103
+ }
104
+ catch (Exception $e)
105
+ {
106
+ Mage::getSingleton('adminhtml/session')->addError("Invalid Date");
107
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id'),'store'=>$data['store_id']));
108
+ return;
109
+ }
110
+
111
+ $data['date_to_publish'] = date('Y-m-d H:i:s', strtotime($data['date_to_publish']));
112
+ $data['date_to_unpublish'] = date('Y-m-d H:i:s', strtotime($data['date_to_unpublish']));
113
+ $model = Mage::getModel('news/news');
114
+ $model->setData($data)
115
+ ->setId($this->getRequest()->getParam('id'));
116
+
117
+
118
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
119
+ $model->setCreatedTime(now())
120
+ ->setUpdateTime(now());
121
+ } else {
122
+ $model->setUpdateTime(now());
123
+ }
124
+
125
+
126
+ $model->save();
127
+
128
+ $model_text = Mage::getModel('news/newsdata');
129
+
130
+ $collection_text = Mage::getModel('news/newsdata')->getCollection()->addFieldToFilter('news_id',$model->getNewsId());
131
+
132
+ if(!$this->getRequest()->getParam('id')){
133
+
134
+ $model_text->setData($data)->setNewsId($model->getNewsId())->setStoreId(0);
135
+ $model_text->save();
136
+ foreach (Mage::app()->getWebsites() as $website) {
137
+ foreach ($website->getGroups() as $group) {
138
+ $stores = $group->getStores();
139
+ foreach ($stores as $store) {
140
+ $model_text->setData($data)->setNewsId($model->getNewsId())->setStoreId($store->getId());
141
+ $model_text->save();
142
+
143
+ }
144
+ }
145
+ }
146
+ }else{
147
+
148
+ if($data['store_id'] == 0){
149
+ $text_data = Mage::getModel('news/newsdata')->getCollection()->addFieldToFilter('news_id',$model->getNewsId())->addFieldToFilter('store_id',$data['store_id'])->getData();
150
+
151
+
152
+ $model_text->setData($data)->setNewsId($model->getNewsId())->setTextId($text_data[0]['text_id'])->setStoreId($data['store_id']);
153
+ $model_text->save();
154
+ foreach (Mage::app()->getWebsites() as $website) {
155
+ foreach ($website->getGroups() as $group) {
156
+ $stores = $group->getStores();
157
+ foreach ($stores as $store) {
158
+ $collection_text = '';
159
+ $text_data = '';
160
+ $collection_text = Mage::getModel('news/newsdata')->getCollection()->addFieldToFilter('news_id',$model->getNewsId());
161
+ $text_data = $collection_text->addFieldToFilter('store_id',$store->getId())->getData();
162
+ $model_text->setData($data)->setNewsId($model->getNewsId())->setTextId($text_data[0]['text_id'])->setStoreId($store->getId());
163
+ $model_text->save();
164
+ }
165
+ }
166
+ }
167
+
168
+ }else{
169
+ $text_data = $collection_text->addFieldToFilter('store_id',$data['store_id'])->getData();
170
+ $model_text->setData($data)->setNewsId($model->getNewsId())->setTextId($text_data[0]['text_id'])->setStoreId($data['store_id']);
171
+ $model_text->save();
172
+ }
173
+ }
174
+
175
+
176
+ try {
177
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
178
+ $model->setCreatedTime(now())
179
+ ->setUpdateTime(now());
180
+ } else {
181
+ $model->setUpdateTime(now());
182
+ }
183
+
184
+ $model->save();
185
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('news')->__('News was successfully saved'));
186
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
187
+
188
+ if ($this->getRequest()->getParam('back')) {
189
+ $this->_redirect('*/*/edit', array('id' => $model->getId(),'store'=>$data['store_id']));
190
+ return;
191
+ }
192
+ $this->_redirect('*/*/',array('store'=>$data['store_id']));
193
+ return;
194
+ } catch (Exception $e) {
195
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
196
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
197
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id'),'store'=>$data['store_id']));
198
+ return;
199
+ }
200
+ }
201
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('news')->__('Unable to find item to save'));
202
+ $this->_redirect('*/*/');
203
+ }
204
+
205
+ public function deleteAction() {
206
+ if( $this->getRequest()->getParam('id') > 0 ) {
207
+ try {
208
+ $model = Mage::getModel('news/news');
209
+
210
+ $model->setId($this->getRequest()->getParam('id'))
211
+ ->delete();
212
+
213
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
214
+ $this->_redirect('*/*/');
215
+ } catch (Exception $e) {
216
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
217
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
218
+ }
219
+ }
220
+ $this->_redirect('*/*/');
221
+ }
222
+
223
+ public function massDeleteAction() {
224
+ $newsIds = $this->getRequest()->getParam('news');
225
+ if(!is_array($newsIds)) {
226
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
227
+ } else {
228
+ try {
229
+ foreach ($newsIds as $newsId) {
230
+ $news = Mage::getModel('news/news')->load($newsId);
231
+ $news->delete();
232
+ }
233
+ Mage::getSingleton('adminhtml/session')->addSuccess(
234
+ Mage::helper('adminhtml')->__(
235
+ 'Total of %d record(s) were successfully deleted', count($newsIds)
236
+ )
237
+ );
238
+ } catch (Exception $e) {
239
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
240
+ }
241
+ }
242
+ $this->_redirect('*/*/index');
243
+ }
244
+
245
+ public function massStatusAction()
246
+ {
247
+ $store_id = $this->getRequest()->getParam('store', 0);
248
+ $newsIds = $this->getRequest()->getParam('news');
249
+ if(!is_array($newsIds)) {
250
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
251
+ } else {
252
+ try {
253
+ foreach ($newsIds as $newsId) {
254
+ $model_text = Mage::getModel('news/newsdata');
255
+ $collection_text = Mage::getModel('news/newsdata')->getCollection()->addFieldToFilter('news_id',$newsId);
256
+ if($store_id != 0){
257
+ $text_data = $collection_text->addFieldToFilter('store_id',$store_id)->getData();
258
+ $model_text->setTextId($text_data[0]['text_id'])->setStoreId($store_id)
259
+ ->setStatus($this->getRequest()->getParam('status'))
260
+ ->setIsMassupdate(true)
261
+ ->save();
262
+ }else
263
+ {
264
+ $text_data = $collection_text->addFieldToFilter('store_id',0)->getData();
265
+ $model_text->setTextId($text_data[0]['text_id'])->setStoreId(0)
266
+ ->setStatus($this->getRequest()->getParam('status'))
267
+ ->setIsMassupdate(true)
268
+ ->save();
269
+ foreach (Mage::app()->getWebsites() as $website) {
270
+ foreach ($website->getGroups() as $group) {
271
+ $stores = $group->getStores();
272
+ foreach ($stores as $store) {
273
+ $collection_text = '';
274
+ $collection_text = Mage::getModel('news/newsdata')->getCollection()->addFieldToFilter('news_id',$newsId);
275
+ $text_data = $collection_text->addFieldToFilter('store_id',$store->getId())->getData();
276
+ $model_text->setTextId($text_data[0]['text_id'])->setStoreId($store->getId())
277
+ ->setStatus($this->getRequest()->getParam('status'))
278
+ ->setIsMassupdate(true)
279
+ ->save();
280
+ }
281
+ }
282
+ }
283
+ }
284
+
285
+ }
286
+ $this->_getSession()->addSuccess(
287
+ $this->__('Total of %d record(s) were successfully updated', count($newsIds))
288
+ );
289
+ } catch (Exception $e) {
290
+ $this->_getSession()->addError($e->getMessage());
291
+ }
292
+ }
293
+ $this->_redirect('*/*/index',array('store'=>$store_id));
294
+ }
295
+
296
+ public function exportCsvAction()
297
+ {
298
+ $fileName = 'news.csv';
299
+ $content = $this->getLayout()->createBlock('news/adminhtml_news_grid')
300
+ ->getCsv();
301
+
302
+ $this->_sendUploadResponse($fileName, $content);
303
+ }
304
+
305
+ public function exportXmlAction()
306
+ {
307
+ $fileName = 'news.xml';
308
+ $content = $this->getLayout()->createBlock('news/adminhtml_news_grid')
309
+ ->getXml();
310
+
311
+ $this->_sendUploadResponse($fileName, $content);
312
+ }
313
+
314
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
315
+ {
316
+ $response = $this->getResponse();
317
+ $response->setHeader('HTTP/1.1 200 OK','');
318
+ $response->setHeader('Pragma', 'public', true);
319
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
320
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
321
+ $response->setHeader('Last-Modified', date('r'));
322
+ $response->setHeader('Accept-Ranges', 'bytes');
323
+ $response->setHeader('Content-Length', strlen($content));
324
+ $response->setHeader('Content-type', $contentType);
325
+ $response->setBody($content);
326
+ $response->sendResponse();
327
+ die;
328
+ }
329
  }
app/code/local/Biztech/News/controllers/IndexController.php CHANGED
@@ -1,62 +1,39 @@
1
- <?php
2
- class Biztech_News_IndexController extends Mage_Core_Controller_Front_Action
3
- {
4
- public function indexAction()
5
- {
6
-
7
- $news_id = $this->getRequest()->getParam('id');
8
- if($news_id != null && $news_id != '') {
9
- $news = Mage::getModel('news/news')->load($news_id)->getData();
10
- if($news['status']==2)
11
- {
12
- $this->_redirect('news.html');
13
- }
14
- } else {
15
- $news = null;
16
- }
17
-
18
- if($news == null) {
19
- $resource = Mage::getSingleton('core/resource');
20
- $read= $resource->getConnection('core_read');
21
- $newsTable = $resource->getTableName('news');
22
- $select = $read->select()
23
- ->from($newsTable,array('news_id','title','news_content','status'))
24
- ->where('status',1)
25
- ->order('created_time DESC') ;
26
- $news = $read->fetchRow($select);
27
- }
28
- Mage::register('news', $news);
29
- $this->loadLayout();
30
-
31
- $root = $this->getLayout()->getBlock('root');
32
- $template = Mage::getStoreConfig('news/news_general/news_list_page_layout');
33
- $root->setTemplate($template);
34
- if($news['seo_keywords'] != "")
35
- $this->getLayout()->getBlock('head')->setTitle($news['seo_keywords']);
36
- if($news['seo_description'] != "")
37
- $this->getLayout()->getBlock('head')->setKeywords($news['seo_description']);
38
- $this->renderLayout();
39
- }
40
-
41
- public function viewAction()
42
- {
43
- $id = $this->getRequest()->getParam("id");
44
- if($id)
45
- {
46
- $this->getLayout()->createBlock('news/news')->setData(array("id"=>$id))->setTemplate('news/news.phtml')->toHtml();
47
- }
48
- $this->loadLayout();
49
-
50
- $root = $this->getLayout()->getBlock('root');
51
- $template = Mage::getStoreConfig('news/news_general/news_detail_page_layout');
52
- $root->setTemplate($template);
53
- $news = Mage::getModel('news/news')->load($id)->getData();
54
- if($news['browser_title'] != "")
55
- $this->getLayout()->getBlock('head')->setTitle($news['browser_title']);
56
- if($news['seo_keywords'] != "")
57
- $this->getLayout()->getBlock('head')->setKeywords($news['seo_keywords']);
58
- if($news['seo_description'] != "")
59
- $this->getLayout()->getBlock('head')->setDescription($news['seo_description']);
60
- $this->renderLayout();
61
- }
62
  }
1
+ <?php
2
+ class Biztech_News_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+
8
+ $root = $this->getLayout()->getBlock('root');
9
+ $template = Mage::getStoreConfig('news/news_general/news_list_page_layout');
10
+ $root->setTemplate($template);
11
+
12
+ $this->renderLayout();
13
+ }
14
+
15
+ public function viewAction()
16
+ {
17
+ $id = $this->getRequest()->getParam("id");
18
+ if($id)
19
+ {
20
+ $this->getLayout()->createBlock('news/news')->setData(array("id"=>$id))->setTemplate('news/news.phtml')->toHtml();
21
+ }
22
+ $this->loadLayout();
23
+
24
+ $root = $this->getLayout()->getBlock('root');
25
+ $template = Mage::getStoreConfig('news/news_general/news_detail_page_layout');
26
+ $root->setTemplate($template);
27
+
28
+ $store = Mage::app()->getStore()->getId();
29
+ $news = Mage::getModel('news/newsdata')->getCollection()->addFieldToFilter('store_id',$store)->addFieldToFilter('news_id',$id)->getData();
30
+
31
+ if($news[0]['browser_title'] != "")
32
+ $this->getLayout()->getBlock('head')->setTitle($news[0]['browser_title']);
33
+ if($news[0]['seo_keywords'] != "")
34
+ $this->getLayout()->getBlock('head')->setKeywords($news[0]['seo_keywords']);
35
+ if($news[0]['seo_description'] != "")
36
+ $this->getLayout()->getBlock('head')->setDescription($news[0]['seo_description']);
37
+ $this->renderLayout();
38
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
app/code/local/Biztech/News/etc/config.xml CHANGED
@@ -1,162 +1,160 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Biztech_News>
5
- <version>0.1.1</version>
6
- </Biztech_News>
7
- </modules>
8
- <frontend>
9
- <routers>
10
- <news>
11
- <use>standard</use>
12
- <args>
13
- <module>Biztech_News</module>
14
- <frontName>news</frontName>
15
- </args>
16
- </news>
17
- </routers>
18
- <layout>
19
- <updates>
20
- <news>
21
- <file>news.xml</file>
22
- </news>
23
- </updates>
24
- </layout>
25
- <translate>
26
- <modules>
27
- <Biztech_News>
28
- <files>
29
- <default>Biztech_News.csv</default>
30
- </files>
31
- </Biztech_News>
32
- </modules>
33
- </translate>
34
- </frontend>
35
- <admin>
36
- <routers>
37
- <news>
38
- <use>admin</use>
39
- <args>
40
- <module>Biztech_News</module>
41
- <frontName>news</frontName>
42
- </args>
43
- </news>
44
- </routers>
45
- </admin>
46
- <adminhtml>
47
- <menu>
48
- <news module="news">
49
- <title>News</title>
50
- <sort_order>71</sort_order>
51
- <children>
52
- <items module="news">
53
- <title>Manage News</title>
54
- <sort_order>0</sort_order>
55
- <action>news/adminhtml_news</action>
56
- </items>
57
- </children>
58
- </news>
59
- </menu>
60
- <acl>
61
- <resources>
62
- <all>
63
- <title>Allow Everything</title>
64
- </all>
65
- <admin>
66
- <children>
67
- <Biztech_News>
68
- <title>News Module</title>
69
- <sort_order>10</sort_order>
70
- </Biztech_News>
71
- <system>
72
- <children>
73
- <config>
74
- <children>
75
- <news>
76
- <title>News</title>
77
- </news>
78
- </children>
79
- </config>
80
- </children>
81
- </system>
82
- </children>
83
- </admin>
84
- </resources>
85
- </acl>
86
- <layout>
87
- <updates>
88
- <news>
89
- <file>news.xml</file>
90
- </news>
91
- </updates>
92
- </layout>
93
- <translate>
94
- <modules>
95
- <Biztech_News>
96
- <files>
97
- <default>Biztech_News.csv</default>
98
- </files>
99
- </Biztech_News>
100
- </modules>
101
- </translate>
102
- </adminhtml>
103
- <global>
104
- <models>
105
- <news>
106
- <class>Biztech_News_Model</class>
107
- <resourceModel>news_mysql4</resourceModel>
108
- </news>
109
- <news_mysql4>
110
- <class>Biztech_News_Model_Mysql4</class>
111
- <entities>
112
- <news>
113
- <table>news</table>
114
- </news>
115
- </entities>
116
- </news_mysql4>
117
- </models>
118
- <resources>
119
- <news_setup>
120
- <setup>
121
- <module>Biztech_News</module>
122
- </setup>
123
- <connection>
124
- <use>core_setup</use>
125
- </connection>
126
- </news_setup>
127
- <news_write>
128
- <connection>
129
- <use>core_write</use>
130
- </connection>
131
- </news_write>
132
- <news_read>
133
- <connection>
134
- <use>core_read</use>
135
- </connection>
136
- </news_read>
137
- </resources>
138
- <blocks>
139
- <news>
140
- <class>Biztech_News_Block</class>
141
- </news>
142
- <page>
143
- <rewrite>
144
- <html_topmenu>Biztech_News_Block_Html_Topmenu</html_topmenu>
145
- </rewrite>
146
- </page>
147
- </blocks>
148
- <helpers>
149
- <news>
150
- <class>Biztech_News_Helper</class>
151
- </news>
152
- </helpers>
153
- </global>
154
- <default>
155
- <news>
156
- <news_general>
157
- <news_list_page_layout>1column</news_list_page_layout>
158
- <news_detail_page_layout>1column</news_detail_page_layout>
159
- </news_general>
160
- </news>
161
- </default>
162
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Biztech_News>
5
+ <version>0.1.2</version>
6
+ </Biztech_News>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <news>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Biztech_News</module>
14
+ <frontName>news</frontName>
15
+ </args>
16
+ </news>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <news>
21
+ <file>news.xml</file>
22
+ </news>
23
+ </updates>
24
+ </layout>
25
+ <translate>
26
+ <modules>
27
+ <Biztech_News>
28
+ <files>
29
+ <default>Biztech_News.csv</default>
30
+ </files>
31
+ </Biztech_News>
32
+ </modules>
33
+ </translate>
34
+ </frontend>
35
+ <admin>
36
+ <routers>
37
+ <news>
38
+ <use>admin</use>
39
+ <args>
40
+ <module>Biztech_News</module>
41
+ <frontName>news</frontName>
42
+ </args>
43
+ </news>
44
+ </routers>
45
+ </admin>
46
+ <adminhtml>
47
+ <menu>
48
+ <news module="news">
49
+ <title>News</title>
50
+ <sort_order>71</sort_order>
51
+ <children>
52
+ <items module="news">
53
+ <title>Manage News</title>
54
+ <sort_order>0</sort_order>
55
+ <action>news/adminhtml_news</action>
56
+ </items>
57
+ </children>
58
+ </news>
59
+ </menu>
60
+ <acl>
61
+ <resources>
62
+ <all>
63
+ <title>Allow Everything</title>
64
+ </all>
65
+ <admin>
66
+ <children>
67
+ <Biztech_News>
68
+ <title>News Module</title>
69
+ <sort_order>10</sort_order>
70
+ </Biztech_News>
71
+ <system>
72
+ <children>
73
+ <config>
74
+ <children>
75
+ <news>
76
+ <title>News</title>
77
+ </news>
78
+ </children>
79
+ </config>
80
+ </children>
81
+ </system>
82
+ </children>
83
+ </admin>
84
+ </resources>
85
+ </acl>
86
+ <layout>
87
+ <updates>
88
+ <news>
89
+ <file>news.xml</file>
90
+ </news>
91
+ </updates>
92
+ </layout>
93
+ <translate>
94
+ <modules>
95
+ <Biztech_News>
96
+ <files>
97
+ <default>Biztech_News.csv</default>
98
+ </files>
99
+ </Biztech_News>
100
+ </modules>
101
+ </translate>
102
+ </adminhtml>
103
+ <global>
104
+ <models>
105
+ <news>
106
+ <class>Biztech_News_Model</class>
107
+ <resourceModel>news_mysql4</resourceModel>
108
+ </news>
109
+ <news_mysql4>
110
+ <class>Biztech_News_Model_Mysql4</class>
111
+ <entities>
112
+ <news>
113
+ <table>news</table>
114
+ </news>
115
+ <newsdata>
116
+ <table>news_data</table>
117
+ </newsdata>
118
+ </entities>
119
+ </news_mysql4>
120
+ </models>
121
+ <resources>
122
+ <news_setup>
123
+ <setup>
124
+ <module>Biztech_News</module>
125
+ </setup>
126
+ <connection>
127
+ <use>core_setup</use>
128
+ </connection>
129
+ </news_setup>
130
+ <news_write>
131
+ <connection>
132
+ <use>core_write</use>
133
+ </connection>
134
+ </news_write>
135
+ <news_read>
136
+ <connection>
137
+ <use>core_read</use>
138
+ </connection>
139
+ </news_read>
140
+ </resources>
141
+ <blocks>
142
+ <news>
143
+ <class>Biztech_News_Block</class>
144
+ </news>
145
+ </blocks>
146
+ <helpers>
147
+ <news>
148
+ <class>Biztech_News_Helper</class>
149
+ </news>
150
+ </helpers>
151
+ </global>
152
+ <default>
153
+ <news>
154
+ <news_general>
155
+ <news_list_page_layout>1column</news_list_page_layout>
156
+ <news_detail_page_layout>1column</news_detail_page_layout>
157
+ </news_general>
158
+ </news>
159
+ </default>
 
 
160
  </config>
app/code/local/Biztech/News/etc/system.xml CHANGED
@@ -1,62 +1,99 @@
1
- <?xml version="1.0" encoding="UTF-8" ?>
2
- <config>
3
- <tabs>
4
- <biztech translate="label" module="news">
5
- <label>Biztech Extensions</label>
6
- <sort_order>400</sort_order>
7
- </biztech>
8
- </tabs>
9
- <sections>
10
- <news translate="label" module="news">
11
- <label>News</label>
12
- <tab>biztech</tab>
13
- <frontend_type>text</frontend_type>
14
- <sort_order>10</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
- <news_general translate="label">
20
- <label>General</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
- <enabled translate="label">
28
- <label>Enabled</label>
29
- <frontend_type>select</frontend_type>
30
- <source_model>adminhtml/system_config_source_yesno</source_model>
31
- <sort_order>1</sort_order>
32
- <show_in_default>1</show_in_default>
33
- <show_in_website>1</show_in_website>
34
- <show_in_store>1</show_in_store>
35
- <comment>Select Yes to enable this feature.</comment>
36
- </enabled>
37
- <news_list_page_layout translate="label">
38
- <label>Page Layout for list page</label>
39
- <frontend_type>select</frontend_type>
40
- <source_model>Biztech_News_Block_Adminhtml_Model_System_Config_Source_PageLayout</source_model>
41
- <sort_order>2</sort_order>
42
- <show_in_default>1</show_in_default>
43
- <show_in_website>1</show_in_website>
44
- <show_in_store>1</show_in_store>
45
- <comment>Choose page layout for news list page.</comment>
46
- </news_list_page_layout>
47
- <news_detail_page_layout translate="label">
48
- <label>Page Layout for detail page</label>
49
- <frontend_type>select</frontend_type>
50
- <source_model>Biztech_News_Block_Adminhtml_Model_System_Config_Source_PageLayout</source_model>
51
- <sort_order>3</sort_order>
52
- <show_in_default>1</show_in_default>
53
- <show_in_website>1</show_in_website>
54
- <show_in_store>1</show_in_store>
55
- <comment>Choose page layout for news detail page.</comment>
56
- </news_detail_page_layout>
57
- </fields>
58
- </news_general>
59
- </groups>
60
- </news>
61
- </sections>
62
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <config>
3
+ <tabs>
4
+ <biztech translate="label" module="news">
5
+ <label>Biztech Extensions</label>
6
+ <sort_order>400</sort_order>
7
+ </biztech>
8
+ </tabs>
9
+ <sections>
10
+ <news translate="label" module="news">
11
+ <label>News</label>
12
+ <tab>biztech</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>10</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
+ <news_general translate="label">
20
+ <label>General</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
+ <enabled translate="label">
28
+ <label>Enabled</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>1</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <comment>Select Yes to enable this feature.</comment>
36
+ </enabled>
37
+ <news_list_page_layout translate="label">
38
+ <label>Page Layout for list page</label>
39
+ <frontend_type>select</frontend_type>
40
+ <source_model>Biztech_News_Block_Adminhtml_Model_System_Config_Source_PageLayout</source_model>
41
+ <sort_order>2</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ <comment>Choose page layout for news list page.</comment>
46
+ </news_list_page_layout>
47
+ <news_detail_page_layout translate="label">
48
+ <label>Page Layout for detail page</label>
49
+ <frontend_type>select</frontend_type>
50
+ <source_model>Biztech_News_Block_Adminhtml_Model_System_Config_Source_PageLayout</source_model>
51
+ <sort_order>3</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <comment>Choose page layout for news detail page.</comment>
56
+ </news_detail_page_layout>
57
+ <news_show_toplink translate="label">
58
+ <label>Show link in Top-links</label>
59
+ <frontend_type>select</frontend_type>
60
+ <source_model>adminhtml/system_config_source_yesno</source_model>
61
+ <sort_order>4</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ </news_show_toplink>
66
+ <news_show_left_column translate="label">
67
+ <label>Show News in Left Column</label>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>adminhtml/system_config_source_yesno</source_model>
70
+ <sort_order>5</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </news_show_left_column>
75
+
76
+ <news_show_right_column translate="label">
77
+ <label>Show News in Right Column</label>
78
+ <frontend_type>select</frontend_type>
79
+ <source_model>adminhtml/system_config_source_yesno</source_model>
80
+ <sort_order>6</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </news_show_right_column>
85
+ <no_of_news_column translate="label">
86
+ <label>News count in column</label>
87
+ <frontend_type>text</frontend_type>
88
+ <sort_order>7</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ <comment>No. of news shows in column</comment>
93
+ </no_of_news_column>
94
+ </fields>
95
+ </news_general>
96
+ </groups>
97
+ </news>
98
+ </sections>
99
+ </config>
app/code/local/Biztech/News/sql/news_setup/mysql4-data-upgrade-0.1.1-0.1.2.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('news_data')};
10
+ CREATE TABLE {$this->getTable('news_data')} (
11
+ `text_id` int(11) unsigned NOT NULL auto_increment,
12
+ `news_id` int(11) unsigned NOT NULL ,
13
+ `store_id` int(11) NOT NULL default '0',
14
+ `title` varchar(255) NOT NULL default '',
15
+ `news_content` text NOT NULL default '',
16
+ `status` smallint(6) NOT NULL default '0',
17
+ `intro` text NOT NULL default '',
18
+ `date_to_publish` datetime NULL,
19
+ `date_to_unpublish` datetime NULL,
20
+ `browser_title` varchar(255) NOT NULL default '',
21
+ `seo_keywords` varchar(255) NOT NULL default '',
22
+ `seo_description` varchar(255) NOT NULL default '',
23
+
24
+ PRIMARY KEY (`text_id`)
25
+ ) ENGINE=InnoDB;
26
+
27
+ ALTER TABLE `{$this->getTable('news')}` DROP `title`, DROP `news_content`, DROP `status`, DROP `intro`, DROP `date_to_publish`, DROP `date_to_unpublish`, DROP `browser_title`, DROP `seo_keywords`, DROP `seo_description`;
28
+
29
+ ALTER TABLE `{$this->getTable('news_data')}` ADD INDEX ( `news_id` );
30
+
31
+ ALTER TABLE `{$this->getTable('news_data')}` ADD FOREIGN KEY ( `news_id` ) REFERENCES `{$this->getTable('news')}` (`news_id`) ON DELETE CASCADE ON UPDATE CASCADE ;");
32
+
33
+
34
+ $installer->endSetup();
app/code/local/Biztech/News/sql/news_setup/mysql4-install-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('news')};
10
+ CREATE TABLE {$this->getTable('news')} (
11
+ `news_id` int(11) unsigned NOT NULL auto_increment,
12
+ `title` varchar(255) NOT NULL default '',
13
+ `news_content` text NOT NULL default '',
14
+ `status` smallint(6) NOT NULL default '0',
15
+ `created_time` datetime NULL,
16
+ `update_time` datetime NULL,
17
+ `intro` text NOT NULL default '',
18
+ `date_to_publish` datetime NULL,
19
+ `date_to_unpublish` datetime NULL,
20
+ `browser_title` varchar(255) NOT NULL default '',
21
+ `seo_keywords` varchar(255) NOT NULL default '',
22
+ `seo_description` varchar(255) NOT NULL default '',
23
+ PRIMARY KEY (`news_id`)
24
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
25
+
26
+ ");
27
+
28
+ $installer->endSetup();
app/code/local/Biztech/News/sql/news_setup/mysql4-install-0.1.0.php CHANGED
@@ -1,29 +1,28 @@
1
- <?php
2
-
3
- $installer = $this;
4
-
5
- $installer->startSetup();
6
-
7
- $installer->run("
8
-
9
- -- DROP TABLE IF EXISTS {$this->getTable('news')};
10
- CREATE TABLE {$this->getTable('news')} (
11
- `news_id` int(11) unsigned NOT NULL auto_increment,
12
- `title` varchar(255) NOT NULL default '',
13
- `filename` varchar(255) NOT NULL default '',
14
- `news_content` text NOT NULL default '',
15
- `status` smallint(6) NOT NULL default '0',
16
- `created_time` datetime NULL,
17
- `update_time` datetime NULL,
18
- `intro` text NOT NULL default '',
19
- `date_to_publish` datetime NULL,
20
- `date_to_unpublish` datetime NULL,
21
- `browser_title` varchar(255) NOT NULL default '',
22
- `seo_keywords` varchar(255) NOT NULL default '',
23
- `seo_description` varchar(255) NOT NULL default '',
24
- PRIMARY KEY (`news_id`)
25
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
26
-
27
- ");
28
-
29
  $installer->endSetup();
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('news')};
10
+ CREATE TABLE {$this->getTable('news')} (
11
+ `news_id` int(11) unsigned NOT NULL auto_increment,
12
+ `title` varchar(255) NOT NULL default '',
13
+ `news_content` text NOT NULL default '',
14
+ `status` smallint(6) NOT NULL default '0',
15
+ `created_time` datetime NULL,
16
+ `update_time` datetime NULL,
17
+ `intro` text NOT NULL default '',
18
+ `date_to_publish` datetime NULL,
19
+ `date_to_unpublish` datetime NULL,
20
+ `browser_title` varchar(255) NOT NULL default '',
21
+ `seo_keywords` varchar(255) NOT NULL default '',
22
+ `seo_description` varchar(255) NOT NULL default '',
23
+ PRIMARY KEY (`news_id`)
24
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
25
+
26
+ ");
27
+
 
28
  $installer->endSetup();
app/design/adminhtml/default/default/layout/news.xml CHANGED
@@ -1,11 +1,14 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <news_adminhtml_news_index>
4
- <reference name="content">
5
- <block type="news/adminhtml_news" name="news" />
6
- </reference>
7
- </news_adminhtml_news_index>
8
- <news_adminhtml_news_edit>
9
- <update handle="editor" />
10
- </news_adminhtml_news_edit>
 
 
 
11
  </layout>
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <news_adminhtml_news_index>
4
+ <reference name="content">
5
+ <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
6
+ <action method="setUseConfirm"><params>0</params></action>
7
+ </block>
8
+ <block type="news/adminhtml_news" name="news" />
9
+ </reference>
10
+ </news_adminhtml_news_index>
11
+ <news_adminhtml_news_edit>
12
+ <update handle="editor" />
13
+ </news_adminhtml_news_edit>
14
  </layout>
app/design/frontend/default/default/layout/news.xml CHANGED
@@ -1,24 +1,50 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
-
4
- <default>
5
- </default>
6
- <news_index_index>
7
- <reference name="root">
8
- <action method="setTemplate"><template>page/1column.phtml</template></action>
9
- </reference>
10
- <reference name="content">
11
- <block type="news/news" name="news" template="news/newslist.phtml" />
12
- </reference>
13
-
14
- </news_index_index>
15
-
16
- <news_index_view>
17
- <reference name="root">
18
- <action method="setTemplate"><template>page/1column.phtml</template></action>
19
- </reference>
20
- <reference name="content">
21
- <block type="news/news" name="news.view" template="news/news.phtml"/>
22
- </reference>
23
- </news_index_view>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  </layout>
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <default>
5
+ <reference name="head">
6
+ <action method="addItem"><type>skin_css</type><name>news/css/news.css</name><params/></action>
7
+ </reference>
8
+ <reference name="top.links">
9
+ <action method="addLink" translate="label title" module="news" ifconfig="news/news_general/news_show_toplink" ><label>News</label><url helper="news/getNewsUrl"/><title>News</title><prepare/><urlParams/><position>20</position></action>
10
+ </reference>
11
+ <reference name="left">
12
+ <block type="news/news" name="news_left_column" after="-" >
13
+ <action method="setTemplate" ifconfig="news/news_general/news_show_left_column">
14
+ <template>news/news_column.phtml</template>
15
+ </action>
16
+ </block>
17
+ </reference>
18
+ <reference name="right">
19
+ <block type="news/news" name="news_right_column" after="-" >
20
+ <action method="setTemplate" ifconfig="news/news_general/news_show_right_column">
21
+ <template>news/news_column.phtml</template>
22
+ </action>
23
+ </block>
24
+ </reference>
25
+ </default>
26
+ <news_index_index>
27
+ <reference name="root">
28
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
29
+ </reference>
30
+ <reference name="content">
31
+ <block type="news/news" name="news" template="news/newslist.phtml" />
32
+ </reference>
33
+ <reference name="left">
34
+ <remove name="news_left_column"/>
35
+ </reference>
36
+ <reference name="right">
37
+ <remove name="news_right_column"/>
38
+ </reference>
39
+
40
+ </news_index_index>
41
+
42
+ <news_index_view>
43
+ <reference name="root">
44
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
45
+ </reference>
46
+ <reference name="content">
47
+ <block type="news/news" name="news.view" template="news/news.phtml"/>
48
+ </reference>
49
+ </news_index_view>
50
  </layout>
app/design/frontend/default/default/template/news/news.phtml CHANGED
@@ -1,12 +1,16 @@
1
- <?php
2
- if(Mage::getStoreConfig('news/news_general/enabled') == 1):
3
- ?>
4
- <?php $news = $this->getNews(); ?>
5
- <div class="page-title"><h1><?php echo $news['title'];?></h1></div>
6
- <p><?php echo $news['news_content'];?></p>
7
- <?php
8
- else:
9
- $url = Mage::getBaseUrl();
10
- Mage::app()->getFrontController()->getResponse()->setRedirect($url);
11
- endif;
 
 
 
 
12
  ?>
1
+ <?php
2
+ if(Mage::getStoreConfig('news/news_general/enabled') == 1):
3
+ ?>
4
+ <?php $news = $this->getNews(); ?>
5
+ <?php if(($news->getDateToUnpublish() >= date('Y-m-d 00:00:00')) && ($news->getDateToPublish()<date('Y-m-d 23:59:59'))){ ?>
6
+ <div class="page-title"><h1><?php echo $news['title'];?></h1></div>
7
+ <p><?php echo $news['news_content'];?></p>
8
+ <?php }else{ ?>
9
+ <div><h4><?php echo $this->__('No News Found.'); ?></h4></div>
10
+ <?php } ?>
11
+ <?php
12
+ else:
13
+ $url = Mage::getBaseUrl();
14
+ Mage::app()->getFrontController()->getResponse()->setRedirect($url);
15
+ endif;
16
  ?>
app/design/frontend/default/default/template/news/news_column.phtml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $news_count = Mage::getStoreConfig('news/news_general/no_of_news_column');
3
+ if(Mage::getStoreConfig('news/news_general/enabled') == 1):
4
+ $i = 0;
5
+ $collection = $this->getCachedCollection();
6
+ $count = count($collection);
7
+ if($count !==0 && $news_count>0):
8
+ ?>
9
+ <div class="block block-poll news-extra-block ">
10
+ <div class="block-title">
11
+ <strong><span>Latest News</span></strong>
12
+ </div>
13
+ <div class="block-content">
14
+ <ul class="news-list">
15
+ <?php $cnt = 0; foreach ($collection as $news_item): ?>
16
+ <?php
17
+
18
+ if($news_count == ''){ $news_count = 3; }
19
+ if($cnt < $news_count){
20
+ ?>
21
+ <li>
22
+ <label><a href="<?php echo $this->getUrl('news/index/view').'?id='.$news_item->getNewsId(); ?>"><?php echo $news_item->getTitle(); ?></a></label>
23
+ </li>
24
+ <?php
25
+ }else{ break; }
26
+ $cnt++;
27
+ ?>
28
+ <?php endforeach; ?>
29
+ </ul>
30
+ <div class="actions" >
31
+ <a href="<?php echo $this->getUrl('news/index') ?>" style="float: right;"><?php echo $this->__("View All"); ?></a>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ <script type="text/javascript">decorateGeneric($$('ul.news-list li'), ['odd','even','first','last'])</script>
36
+ <?php else: ?>
37
+ <div><h4><?php echo $this->__('No News to publish.'); ?></h4></div>
38
+ <?php endif; ?>
39
+ <?php
40
+ else:
41
+ $url = Mage::getBaseUrl();
42
+ Mage::app()->getFrontController()->getResponse()->setRedirect($url);
43
+ endif;
44
+ ?>
app/design/frontend/default/default/template/news/newslist.phtml CHANGED
@@ -1,43 +1,32 @@
1
- <?php
2
- if(Mage::getStoreConfig('news/news_general/enabled') == 1):
3
- $i = 0;
4
- $collection = $this->getCachedCollection();
5
- $count = count($collection);
6
- if($count !==0):
7
- ?>
8
- <?php
9
- $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
10
- $breadcrumbs->addCrumb('home',array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home Page'),'link'=>Mage::getBaseUrl()));
11
- $breadcrumbs->addCrumb('News', array('label'=>'News','title'=>'News'));
12
- echo $this->getLayout()->getBlock('breadcrumbs')->toHtml();
13
- ?>
14
-
15
- <?php foreach ($collection as $news_item):
16
- $class='';
17
-
18
- if ($i==0):
19
- $class='first';
20
- elseif ($i==$count-1):
21
- $class='last';
22
- endif;
23
- ?>
24
- <div class="<?php echo $class ?> news-block block">
25
- <div class="copy">
26
- <h3><?php echo $news_item->getTitle(); ?></h3><p><?php echo $news_item->getIntro(); ?></p>
27
- <p class="read-more"><a href="<?php echo $this->getUrl('*/*/view').'?id='.$news_item->getNewsId(); ?>"><?php echo $this->__('Read more') ?></a></p>
28
- </div>
29
- </div>
30
- <?php endforeach; ?>
31
-
32
- <?php echo $this->getChildHtml('Biztech_news_toolbar'); ?>
33
- <?php
34
- else:
35
- ?>
36
- <div><h4><?php echo $this->__('No News to publish.'); ?></h4></div>
37
- <?php endif; ?>
38
- <?php
39
- else:
40
- $url = Mage::getBaseUrl();
41
- Mage::app()->getFrontController()->getResponse()->setRedirect($url);
42
- endif;
43
  ?>
1
+ <?php
2
+ if(Mage::getStoreConfig('news/news_general/enabled') == 1):
3
+ $i = 0;
4
+ $collection = $this->getCachedCollection();
5
+ $count = count($collection);
6
+ if($count !==0):
7
+ ?>
8
+ <?php
9
+ $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
10
+ $breadcrumbs->addCrumb('home',array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home Page'),'link'=>Mage::getBaseUrl()));
11
+ $breadcrumbs->addCrumb('News', array('label'=>'News','title'=>'News'));
12
+ echo $this->getLayout()->getBlock('breadcrumbs')->toHtml();
13
+ ?>
14
+
15
+ <?php foreach ($collection as $news_item): ?>
16
+ <div class="news-block block">
17
+ <h3 class="title"><?php echo $news_item->getTitle(); ?></h3>
18
+ <div class="desc"><?php echo $news_item->getIntro(); ?><a href="<?php echo $this->getUrl('*/*/view').'?id='.$news_item->getNewsId(); ?>"><?php echo $this->__('Read more') ?></a></div>
19
+
20
+ </div>
21
+ <?php endforeach; ?>
22
+
23
+ <?php echo $this->getChildHtml('Biztech_news_toolbar'); ?>
24
+ <?php else: ?>
25
+ <div><h4><?php echo $this->__('No News to publish.'); ?></h4></div>
26
+ <?php endif; ?>
27
+ <?php
28
+ else:
29
+ $url = Mage::getBaseUrl();
30
+ Mage::app()->getFrontController()->getResponse()->setRedirect($url);
31
+ endif;
 
 
 
 
 
 
 
 
 
 
 
32
  ?>
app/etc/modules/Biztech_News.xml CHANGED
@@ -6,12 +6,12 @@
6
  * @author ModuleCreator
7
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
  */
9
- -->
10
- <config>
11
- <modules>
12
- <Biztech_News>
13
- <active>true</active>
14
- <codePool>local</codePool>
15
- </Biztech_News>
16
- </modules>
17
  </config>
6
  * @author ModuleCreator
7
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
  */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Biztech_News>
13
+ <active>true</active>
14
+ <codePool>local</codePool>
15
+ </Biztech_News>
16
+ </modules>
17
  </config>
package.xml CHANGED
@@ -1,30 +1,29 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>news_module</name>
4
- <version>0.1.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>The News Module Extension allows you to display news on your website for viewers</summary>
10
- <description>The News Module Extension allows you to display news on your website for viewers. News can be anything like if there is any update in your products, if you have included any new product in your e-store, if you are providing any special offers in any of your products etc all can be displayed in the news section.&#xD;
11
- A separate section for news helps your client to easily get through recent happenings in your online store. The extension is very easy to install, configure and use. It allows you to manage news from the admin panel. You can easily add and edit any news entries. It helps you to display various ads, products and news on your website effortlessly.&#xD;
12
- Features of News Module Extension.&#xD;
13
- &#x2022; After installing this extension a separate menu will be created for News on your website that will help viewers to easily go to the News section of your website.&#xD;
14
- &#x2022; News page will show latest ten updates and the details of the updates can be viewed by clicking on the read more link that will redirect the customers to the details page of that particular news.&#xD;
15
- &#x2022; You can create news and it is up to you when you want to publish it. There is provision for this facility in the admin side, go to News-&gt;Manage News-&gt;News information, there specify yes/no in the published attribute as needed.&#xD;
16
- &#x2022; Possibility for publishing a particular news for given period of time is also available. This can be set from News-&gt;Manage News-&gt;Publishing Options. Here set the start and end data for the news has to be published.&#xD;
17
- &#x2022; The extension also allows you optimize your news page by allowing you to set the page title, keywords and description. &#xD;
18
- &#x2022; Page layout can be set both for the news list pages and news detail page as desired. The layouts that this extension provides are 1 column, 2columns-right, 2columns-left and 3columns&#xD;
19
- &#xD;
20
- &#xD;
21
- This extension can also be used as a blog on your website. Magento News Extension will help you make your store more interactive and will keep your visitors familiar with the latest business updates and developments.&#xD;
22
- </description>
23
- <notes>-Change in news admin settings - add textarea for seo details</notes>
24
- <authors><author><name>Biztech</name><user>biztechcon</user><email>sales@biztechconsultancy.com</email></author></authors>
25
- <date>2013-09-17</date>
26
- <time>05:58:48</time>
27
- <contents><target name="mageetc"><dir name="modules"><file name="Biztech_News.xml" hash="2066527c7cb941ff29c3abc04cf2e1e7"/></dir></target><target name="magelocal"><dir name="Biztech"><dir name="News"><dir name="Block"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="PageLayout.php" hash="cb053c3354269872be9355a36f0bd7ca"/></dir></dir></dir></dir><dir name="News"><dir name="Edit"><file name="Form.php" hash="14e4a7813dd84774463806fd7b340a6a"/><dir name="Tab"><file name="Form.php" hash="01fb481131c9ed25d5e6219e8381f0dd"/><file name="Publishingoptions.php" hash="9266e52bcf666df0ac86b93077f755b2"/><file name="Seo.php" hash="e23f61b0dddeba20f285390c30e4016c"/></dir><file name="Tabs.php" hash="b7d5f7ba0923a08f9c7dda82ca9533dd"/></dir><file name="Edit.php" hash="9cc35195704b7980f8f1c4f996655d35"/><file name="Grid.php" hash="ebe5136870ab89a4b164c4af8b0dc5ae"/></dir><file name="News.php" hash="6d55288c8e492529babed70d7693cee3"/></dir><dir name="Html"><file name="Topmenu.php" hash="20ecd9eb22aea35a7c5c05afb180a5eb"/></dir><file name="News.php" hash="3e4c83c3038290af7f55232a1a8e0c13"/><dir name="Product"><file name="Toolbar.php" hash="5ea2be422632936d999f2feb662c5efb"/></dir></dir><dir name="Helper"><file name="Data.php" hash="041b029a330619d0410b9a10d97ff99a"/><file name="Toolbar.php" hash="f43815d9de8ec838ef60ac235b7ad87a"/></dir><dir name="Model"><dir name="Mysql4"><dir name="News"><file name="Collection.php" hash="d94ba8224386db37166a42c818741816"/></dir><file name="News.php" hash="105de65e8142848237a86c148d7c50a9"/></dir><file name="News.php" hash="8936030acfbccc9af2d2962ca14d4178"/><file name="Status.php" hash="fddbc75ce090257b57a1c6ca4e6c6f08"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="NewsController.php" hash="995ed407e8cb40cd19e47d733b7d252b"/></dir><file name="IndexController.php" hash="7b84f01a54d1b4155a1b5f8006a0c13d"/></dir><dir name="etc"><file name="config.xml" hash="6ba168bc39719a863eefc4321179d47e"/><file name="system.xml" hash="1bb49bcbdde576d08549701b4d3d9e4b"/></dir><dir name="sql"><dir name="news_setup"><file name="mysql4-install-0.1.0.php" hash="64b4d2aa617e50e51c5ab8bed45ce2af"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="news.xml" hash="a5d673a49630a02e12e16d3d20118e1f"/></dir><dir name="template"><dir name="news"><file name="news.phtml" hash="189b9c77d457d2c6a2609d5cf10e95c2"/><file name="newslist.phtml" hash="8184e2ad62b2660621c56179b2353b85"/><file name="toolbar.phtml" hash="0de79f32306c8132f346ec129a6677f3"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="news.xml" hash="71a6b06b143def9feaa53156aafe6bc2"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Biztech_News.csv" hash="c578fa43638898d8d2c1d65df58ff295"/></dir><dir name="de_DE"><file name="Biztech_News.csv" hash="62e4bad7e4e3f835a5813b63399cedd6"/></dir><dir name="it_IT"><file name="Biztech_News.csv" hash="c6beab4c9b1daa5d01833d94dd897bc6"/></dir><dir name="fr_FR"><file name="Biztech_News.csv" hash="d35888dc2041bd3fd59300c3cdd69c25"/></dir><dir name="nl_NL"><file name="Biztech_News.csv" hash="6dbc51ef667406f9663ae15531cd36d1"/></dir><dir name="en_GB"><file name="Biztech_News.csv" hash="574cce2d0ffc262275570ed185642bee"/></dir></target></contents>
28
  <compatible/>
29
- <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
30
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>news_module</name>
4
+ <version>0.1.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>The News Module Extension allows you to display news on your website for viewers</summary>
10
+ <description>The News Module Extension allows you to display news on your website for viewers. News can be anything like if there is any update in your products, if you have included any new product in your e-store, if you are providing any special offers in any of your products etc all can be displayed in the news section.
11
+ A separate section for news helps your client to easily get through recent happenings in your online store. The extension is very easy to install, configure and use. It allows you to manage news from the admin panel. You can easily add and edit any news entries. It helps you to display various ads, products and news on your website effortlessly.
12
+ Features of News Module Extension.
13
+ &#x2022; After installing this extension a separate menu will be created for News on your website that will help viewers to easily go to the News section of your website.
14
+ &#x2022; News page will show latest ten updates and the details of the updates can be viewed by clicking on the read more link that will redirect the customers to the details page of that particular news.
15
+ &#x2022; You can create news and it is up to you when you want to publish it. There is provision for this facility in the admin side, go to News-&gt;Manage News-&gt;News information, there specify yes/no in the published attribute as needed.
16
+ &#x2022; Possibility for publishing a particular news for given period of time is also available. This can be set from News-&gt;Manage News-&gt;Publishing Options. Here set the start and end data for the news has to be published.
17
+ &#x2022; The extension also allows you optimize your news page by allowing you to set the page title, keywords and description.
18
+ &#x2022; Page layout can be set both for the news list pages and news detail page as desired. The layouts that this extension provides are 1 column, 2columns-right, 2columns-left and 3columns
19
+
20
+
21
+ This extension can also be used as a blog on your website. Magento News Extension will help you make your store more interactive and will keep your visitors familiar with the latest business updates and developments.</description>
22
+ <notes>- Enhancements : add news section in left and right column,add news link in top links.</notes>
23
+ <authors><author><name>Biztech</name><user>auto-converted</user><email>sales@biztechconsultancy.com</email></author></authors>
24
+ <date>2014-04-14</date>
25
+ <time>11:27:04</time>
26
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="news.xml" hash="536c0c031ffe4dfad4eaadbf1c4c49a0"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="news.xml" hash="9eb9b5e94d01dee6bf6d77a9678fe6e3"/></dir><dir name="template"><dir name="news"><file name="news.phtml" hash="9636e1182123bed96ce6e18825cf165c"/><file name="newslist.phtml" hash="e66b11c15ac9e944d7630b161a03c238"/><file name="news_column.phtml" hash="a17c122180a3d43e289993696b4af5e3"/><file name="toolbar.phtml" hash="0de79f32306c8132f346ec129a6677f3"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Biztech"><dir name="News"><dir name="Block"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="PageLayout.php" hash="cb053c3354269872be9355a36f0bd7ca"/></dir></dir></dir></dir><dir name="News"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="f25ebc276528468e1e33e7b5468cf1ee"/><file name="Publishingoptions.php" hash="66581d748b118a6a071d380096b8acfc"/><file name="Seo.php" hash="6783a433b07c65cd39b50b6593eb82cc"/></dir><file name="Form.php" hash="e11cccad6ab78db02c0572a87095c2ce"/><file name="Tabs.php" hash="34d69626f96cb4996ac77f7d53c0e737"/></dir><file name="Edit.php" hash="de0a846c4282f23cba46dddbf339ed5c"/><file name="Grid.php" hash="84dba3b6aff018826ba72d942b739eb6"/></dir><file name="News.php" hash="e1c8876d179e0ab43a9e78ccdd8237b7"/></dir><dir name="Product"><file name="Toolbar.php" hash="5ea2be422632936d999f2feb662c5efb"/></dir><file name="News.php" hash="a58240923e8bc653100682a855828add"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="NewsController.php" hash="4b4c83e8cf3817f255bb09f1f611b182"/></dir><file name="IndexController.php" hash="ccc70398574fcf18b80e4863a0ea252e"/></dir><dir name="etc"><file name="config.xml" hash="976a8915ca8598fa1aadb89e2d936e72"/><file name="system.xml" hash="e4ccd313c664f5389ed243af176ba08d"/></dir><dir name="Helper"><file name="Data.php" hash="2e8259219814efd9a0bfc14f63520b6b"/><file name="Toolbar.php" hash="f43815d9de8ec838ef60ac235b7ad87a"/></dir><dir name="Model"><dir name="Mysql4"><dir name="News"><file name="Collection.php" hash="e3c39884261fde3c7432eb0517bfc3b1"/></dir><dir name="Newsdata"><file name="Collection.php" hash="4fd9ec9ed7cd8b0449dfbcebcd8515c9"/></dir><file name="News.php" hash="e0bbfff96aa96114103ab7a1b24d287e"/><file name="Newsdata.php" hash="3289ead04862785a7a662a21818ae80a"/></dir><file name="News.php" hash="a696eb4c7834e76c88c0fbd19ec8bb32"/><file name="Newsdata.php" hash="63f5c9a9676a0bb5777c63cfc5b4a854"/><file name="Status.php" hash="fddbc75ce090257b57a1c6ca4e6c6f08"/></dir><dir name="sql"><dir name="news_setup"><file name="mysql4-data-upgrade-0.1.1-0.1.2.php" hash="a16d0abdf897d0f84a6b5ba84c805902"/><file name="mysql4-install-0.1.0-0.1.1.php" hash="1fc1c2bb4f2d4613c60b11853727b26c"/><file name="mysql4-install-0.1.0.php" hash="1fc1c2bb4f2d4613c60b11853727b26c"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Biztech_News.csv" hash="62e4bad7e4e3f835a5813b63399cedd6"/></dir><dir name="en_GB"><file name="Biztech_News.csv" hash="574cce2d0ffc262275570ed185642bee"/></dir><dir name="en_US"><file name="Biztech_News.csv" hash="c578fa43638898d8d2c1d65df58ff295"/></dir><dir name="fr_FR"><file name="Biztech_News.csv" hash="d35888dc2041bd3fd59300c3cdd69c25"/></dir><dir name="it_IT"><file name="Biztech_News.csv" hash="c6beab4c9b1daa5d01833d94dd897bc6"/></dir><dir name="nl_NL"><file name="Biztech_News.csv" hash="6dbc51ef667406f9663ae15531cd36d1"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="news"><dir name="css"><file name="news.css" hash="6797c103396f7d949c5591530bb053ab"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Biztech_News.xml" hash="08583d8823339c393e23691da97730fb"/></dir></target></contents>
 
27
  <compatible/>
28
+ <dependencies/>
29
  </package>
skin/frontend/default/default/news/css/news.css ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .news-block{
2
+ background: #fff; padding: 10px;
3
+ }
4
+ .news-block .title{
5
+ padding: 0px; margin: 0px 0px 7px 0px; font-size: 14px; color: #2F2F2F;
6
+ }
7
+ .news-block .desc{
8
+ padding: 0px; margin: 0px 0px 7px 0px; font-size: 12px; color: #2F2F2F;
9
+ }
10
+ .news-block a, .news-block p{
11
+ display: inline;
12
+ }
13
+ .news-block a{color: #E26703; padding-left: 5px; font-weight: bold; text-decoration: none;
14
+ }
15
+
16
+ .news-extra-block{
17
+
18
+ }
19
+
20
+ .news-extra-block .block-title strong {
21
+ background-image: url("../../images/i_block-subscribe.gif")
22
+ }
23
+ .news-extra-block .block-content a{
24
+ color: #777777; font-weight: bold; text-decoration: none; font-size: 12px;
25
+ }