Version Notes
-New Release
Download this release
Release Info
Developer | Biztech |
Extension | notification_module |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Biztech/All/Helper/Data.php +6 -0
- app/code/local/Biztech/All/Model/All.php +10 -0
- app/code/local/Biztech/All/Model/Mysql4/All.php +10 -0
- app/code/local/Biztech/All/Model/Mysql4/All/Collection.php +10 -0
- app/code/local/Biztech/All/Model/Source/Updates/Type.php +50 -0
- app/code/local/Biztech/All/Model/Status.php +15 -0
- app/code/local/Biztech/All/Model/Update.php +86 -0
- app/code/local/Biztech/All/etc/config.xml +147 -0
- app/code/local/Biztech/All/etc/system.xml +46 -0
- app/code/local/Biztech/Notification/Block/Adminhtml/Config/Form/Field/Datepicker.php +61 -0
- app/code/local/Biztech/Notification/Block/Notification.php +143 -0
- app/code/local/Biztech/Notification/Block/Styles.php +60 -0
- app/code/local/Biztech/Notification/Helper/Data.php +6 -0
- app/code/local/Biztech/Notification/Model/System/Positionnotification.php +46 -0
- app/code/local/Biztech/Notification/etc/config.xml +106 -0
- app/code/local/Biztech/Notification/etc/system.xml +119 -0
- app/design/frontend/default/default/layout/notification.xml +11 -0
- app/design/frontend/default/default/template/notification/notification.phtml +43 -0
- app/design/frontend/default/default/template/notification/styles.phtml +55 -0
- app/etc/modules/Biztech_All.xml +52 -0
- app/etc/modules/Biztech_Notification.xml +17 -0
- package.xml +27 -0
- skin/frontend/default/default/notification/images/close-note.png +0 -0
- skin/frontend/default/default/notification/images/closebox.png +0 -0
- skin/frontend/default/default/notification/images/overlay.png +0 -0
app/code/local/Biztech/All/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Biztech_All_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Biztech/All/Model/All.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Biztech_All_Model_All extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('all/all');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Biztech/All/Model/Mysql4/All.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Biztech_All_Model_Mysql4_All extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the all_id refers to the key field in your database table.
|
8 |
+
$this->_init('all/all', 'all_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Biztech/All/Model/Mysql4/All/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Biztech_All_Model_Mysql4_All_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('all/all');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Biztech/All/Model/Source/Updates/Type.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
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 |
+
*/
|
11 |
+
|
12 |
+
class Biztech_All_Model_Source_Updates_Type extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
|
13 |
+
{
|
14 |
+
const TYPE_UPDATE_RELEASE = 'UPDATE_RELEASE';
|
15 |
+
const TYPE_INSTALLED_UPDATE = 'INSTALLED_UPDATE';
|
16 |
+
public function toOptionArray()
|
17 |
+
{
|
18 |
+
return array(
|
19 |
+
array('value' => self::TYPE_INSTALLED_UPDATE, 'label' => Mage::helper('all')->__('My extensions updates')),
|
20 |
+
array('value' => self::TYPE_UPDATE_RELEASE, 'label' => Mage::helper('all')->__('All extensions updates')),
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getAllOptions()
|
25 |
+
{
|
26 |
+
return $this->toOptionArray();
|
27 |
+
}
|
28 |
+
|
29 |
+
|
30 |
+
public function getLabel($value)
|
31 |
+
{
|
32 |
+
$options = $this->toOptionArray();
|
33 |
+
foreach ($options as $v) {
|
34 |
+
if ($v['value'] == $value) {
|
35 |
+
return $v['label'];
|
36 |
+
}
|
37 |
+
}
|
38 |
+
return '';
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getGridOptions()
|
42 |
+
{
|
43 |
+
$items = $this->getAllOptions();
|
44 |
+
$out = array();
|
45 |
+
foreach ($items as $item) {
|
46 |
+
$out[$item['value']] = $item['label'];
|
47 |
+
}
|
48 |
+
return $out;
|
49 |
+
}
|
50 |
+
}
|
app/code/local/Biztech/All/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Biztech_All_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('all')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('all')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Biztech/All/Model/Update.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Biztech_All_Model_Update extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
const UPDATE_NOTIFICATION_FEED_URL = 'http://store.biztechconsultancy.com/rss/catalog/new/store_id/1/';
|
7 |
+
public function getInterests()
|
8 |
+
{
|
9 |
+
$types = @explode(',', Mage::getStoreConfig('all/all_general/interests'));
|
10 |
+
return $types;
|
11 |
+
}
|
12 |
+
public function isExtensionInstalled($code)
|
13 |
+
{
|
14 |
+
|
15 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
16 |
+
foreach ($modules as $moduleName) {
|
17 |
+
if ($moduleName == $code) {
|
18 |
+
return true;
|
19 |
+
}
|
20 |
+
}
|
21 |
+
return false;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function check()
|
25 |
+
{
|
26 |
+
if ((time() - Mage::app()->loadCache('biztech_all_updates_feed_lastcheck')) > Mage::getStoreConfig('all/all_general/check_frequency')) {
|
27 |
+
$this->refresh();
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
public function refresh()
|
32 |
+
{
|
33 |
+
$types = array();
|
34 |
+
$feedData = array();
|
35 |
+
$extensio_module = array();
|
36 |
+
try{
|
37 |
+
$xml = file_get_contents(self::UPDATE_NOTIFICATION_FEED_URL);
|
38 |
+
$xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);//LIBXML_NOCDATA LIBXML_NOWARNING
|
39 |
+
|
40 |
+
$interests = $this->getInterests();
|
41 |
+
if(!empty($interests[0])){
|
42 |
+
$isInterestedInSelfUpgrades = in_array(Biztech_All_Model_Source_Updates_Type::TYPE_INSTALLED_UPDATE, $interests);
|
43 |
+
$isInterestedInAllUpgrades = in_array(Biztech_All_Model_Source_Updates_Type::TYPE_UPDATE_RELEASE, $interests);
|
44 |
+
$modules = Mage::getConfig()->getNode('modules')->children();
|
45 |
+
$modulesArray = (array)$modules;
|
46 |
+
foreach($xml->channel->item as $keys=>$extensions) {
|
47 |
+
$types[] = (string) $extensions->update_notifications->type;
|
48 |
+
$extensions_name = (string)$extensions->update_notifications->extensions;
|
49 |
+
|
50 |
+
if((string)$extensions->update_notifications->date!=""&&(string)$extensions->update_notifications->extension_title!=""&&(string)$extensions->update_notifications->extension_content!=""&&(string)$extensions->update_notifications->product_url!=""){
|
51 |
+
if(!$isInterestedInAllUpgrades){
|
52 |
+
if ($this->isExtensionInstalled($extensions_name)) {
|
53 |
+
$feedData[] = array(
|
54 |
+
'severity' => 4,
|
55 |
+
'date_added' => (string) $extensions->update_notifications->date,
|
56 |
+
'title' => (string)$extensions->update_notifications->extension_title,
|
57 |
+
'description' => (string)$extensions->update_notifications->extension_content,
|
58 |
+
'url' => (string)$extensions->update_notifications->product_url,
|
59 |
+
);
|
60 |
+
}
|
61 |
+
} else{
|
62 |
+
$feedData[] = array(
|
63 |
+
'severity' => 4,
|
64 |
+
'date_added' => (string)$extensions->update_notifications->date,
|
65 |
+
'title' => (string)$extensions->update_notifications->extension_title,
|
66 |
+
'description' => (string)$extensions->update_notifications->extension_content,
|
67 |
+
'url' => (string)$extensions->update_notifications->product_url,
|
68 |
+
);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
if ($feedData) {
|
73 |
+
foreach($feedData as $data){
|
74 |
+
if ((array_intersect($types,$interests) && $isInterestedInSelfUpgrades)) {
|
75 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse(array($data)));
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
Mage::app()->saveCache(time(), 'biztech_all_updates_feed_lastcheck');
|
80 |
+
return true;
|
81 |
+
}
|
82 |
+
}catch (Exception $e) {
|
83 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
app/code/local/Biztech/All/etc/config.xml
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Biztech
|
5 |
+
* @package Biztech_All
|
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_All>
|
13 |
+
<version>0.1.0</version>
|
14 |
+
</Biztech_All>
|
15 |
+
</modules>
|
16 |
+
<frontend>
|
17 |
+
<routers>
|
18 |
+
<all>
|
19 |
+
<use>standard</use>
|
20 |
+
<args>
|
21 |
+
<module>Biztech_All</module>
|
22 |
+
<frontName>all</frontName>
|
23 |
+
</args>
|
24 |
+
</all>
|
25 |
+
</routers>
|
26 |
+
<!--<layout>
|
27 |
+
<updates>
|
28 |
+
<all>
|
29 |
+
<file>all.xml</file>
|
30 |
+
</all>
|
31 |
+
</updates>
|
32 |
+
</layout>-->
|
33 |
+
</frontend>
|
34 |
+
<admin>
|
35 |
+
<routers>
|
36 |
+
<all>
|
37 |
+
<use>admin</use>
|
38 |
+
<args>
|
39 |
+
<module>Biztech_All</module>
|
40 |
+
<frontName>all</frontName>
|
41 |
+
</args>
|
42 |
+
</all>
|
43 |
+
</routers>
|
44 |
+
</admin>
|
45 |
+
<adminhtml>
|
46 |
+
<!--<menu>
|
47 |
+
<all module="all">
|
48 |
+
<title>All</title>
|
49 |
+
<sort_order>71</sort_order>
|
50 |
+
<children>
|
51 |
+
<items module="all">
|
52 |
+
<title>Manage Items</title>
|
53 |
+
<sort_order>0</sort_order>
|
54 |
+
<action>all/adminhtml_all</action>
|
55 |
+
</items>
|
56 |
+
</children>
|
57 |
+
</all>
|
58 |
+
</menu> -->
|
59 |
+
<acl>
|
60 |
+
<resources>
|
61 |
+
<all>
|
62 |
+
<title>Allow Everything</title>
|
63 |
+
</all>
|
64 |
+
<admin>
|
65 |
+
<children>
|
66 |
+
<Biztech_All>
|
67 |
+
<title>All Module</title>
|
68 |
+
<sort_order>10</sort_order>
|
69 |
+
</Biztech_All>
|
70 |
+
</children>
|
71 |
+
</admin>
|
72 |
+
</resources>
|
73 |
+
</acl>
|
74 |
+
<events>
|
75 |
+
<controller_action_predispatch>
|
76 |
+
<observers>
|
77 |
+
|
78 |
+
<bzall_upds>
|
79 |
+
<type>singleton</type>
|
80 |
+
<class>all/update</class>
|
81 |
+
<method>check</method>
|
82 |
+
</bzall_upds>
|
83 |
+
</observers>
|
84 |
+
</controller_action_predispatch>
|
85 |
+
</events>
|
86 |
+
<!--<layout>
|
87 |
+
<updates>
|
88 |
+
<all>
|
89 |
+
<file>all.xml</file>
|
90 |
+
</all>
|
91 |
+
</updates>
|
92 |
+
</layout> -->
|
93 |
+
</adminhtml>
|
94 |
+
<global>
|
95 |
+
<models>
|
96 |
+
<all>
|
97 |
+
<class>Biztech_All_Model</class>
|
98 |
+
<resourceModel>all_mysql4</resourceModel>
|
99 |
+
</all>
|
100 |
+
<all_mysql4>
|
101 |
+
<class>Biztech_All_Model_Mysql4</class>
|
102 |
+
<entities>
|
103 |
+
<all>
|
104 |
+
<table>all</table>
|
105 |
+
</all>
|
106 |
+
</entities>
|
107 |
+
</all_mysql4>
|
108 |
+
</models>
|
109 |
+
<resources>
|
110 |
+
<all_setup>
|
111 |
+
<setup>
|
112 |
+
<module>Biztech_All</module>
|
113 |
+
</setup>
|
114 |
+
<connection>
|
115 |
+
<use>core_setup</use>
|
116 |
+
</connection>
|
117 |
+
</all_setup>
|
118 |
+
<all_write>
|
119 |
+
<connection>
|
120 |
+
<use>core_write</use>
|
121 |
+
</connection>
|
122 |
+
</all_write>
|
123 |
+
<all_read>
|
124 |
+
<connection>
|
125 |
+
<use>core_read</use>
|
126 |
+
</connection>
|
127 |
+
</all_read>
|
128 |
+
</resources>
|
129 |
+
<blocks>
|
130 |
+
<all>
|
131 |
+
<class>Biztech_All_Block</class>
|
132 |
+
</all>
|
133 |
+
</blocks>
|
134 |
+
<helpers>
|
135 |
+
<all>
|
136 |
+
<class>Biztech_All_Helper</class>
|
137 |
+
</all>
|
138 |
+
</helpers>
|
139 |
+
</global>
|
140 |
+
<default>
|
141 |
+
<all>
|
142 |
+
<all_general>
|
143 |
+
<check_frequency>86400</check_frequency>
|
144 |
+
</all_general>
|
145 |
+
</all>
|
146 |
+
</default>
|
147 |
+
</config>
|
app/code/local/Biztech/All/etc/system.xml
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<biztech translate="label" module="all">
|
5 |
+
<label>Biztech Extensions</label>
|
6 |
+
<sort_order>400</sort_order>
|
7 |
+
</biztech>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<all translate="label" module="all">
|
11 |
+
<label>Info</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 |
+
|
20 |
+
<all_general translate="label">
|
21 |
+
<label>General</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>10</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
<fields>
|
28 |
+
|
29 |
+
<interests translate="label">
|
30 |
+
<label>I'd like to be informed by Biztech about:</label>
|
31 |
+
<comment></comment>
|
32 |
+
<frontend_type>multiselect</frontend_type>
|
33 |
+
<sort_order>100</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>1</show_in_store>
|
37 |
+
<can_be_empty>1</can_be_empty>
|
38 |
+
<source_model>all/source_updates_type</source_model>
|
39 |
+
</interests>
|
40 |
+
|
41 |
+
</fields>
|
42 |
+
</all_general>
|
43 |
+
</groups>
|
44 |
+
</all>
|
45 |
+
</sections>
|
46 |
+
</config>
|
app/code/local/Biztech/Notification/Block/Adminhtml/Config/Form/Field/Datepicker.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Datepicker adminhtml configuration control 'model' based on the
|
4 |
+
* Mage_Adminhtml_Block_Report_Config_Form_Field_YtdStart control.
|
5 |
+
*
|
6 |
+
* Use this control to add a Magento configuration Year Month Day selector,
|
7 |
+
* configured in a system.xml as follows:
|
8 |
+
*
|
9 |
+
* <frontend_type>select</frontend_type>
|
10 |
+
* <frontend_model>notification/adminhtml_config_form_field_datepicker</frontend_model>
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
|
14 |
+
class Biztech_Notification_Block_Adminhtml_Config_Form_Field_Datepicker extends Mage_Adminhtml_Block_System_Config_Form_Field
|
15 |
+
{
|
16 |
+
|
17 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
18 |
+
{
|
19 |
+
$_years = array(null => "Year");
|
20 |
+
for($i = 0, $y = (int)date("Y"); $i < 5; $i++, $y++) {
|
21 |
+
$_years[$y] = $y;
|
22 |
+
}
|
23 |
+
|
24 |
+
$_months = array(null => "Month");
|
25 |
+
for ($i = 1; $i <= 12; $i++) {
|
26 |
+
$_months[$i] = Mage::app()->getLocale()
|
27 |
+
->date(mktime(null,null,null,$i))
|
28 |
+
->get(Zend_date::MONTH_NAME);
|
29 |
+
}
|
30 |
+
|
31 |
+
$_days = array(null => "Day");
|
32 |
+
for ($i = 1; $i <= 31; $i++) {
|
33 |
+
$_days[$i] = $i < 10 ? '0'.$i : $i;
|
34 |
+
}
|
35 |
+
|
36 |
+
if ($element->getValue()) {
|
37 |
+
$values = explode(',', $element->getValue());
|
38 |
+
} else {
|
39 |
+
$values = array();
|
40 |
+
}
|
41 |
+
|
42 |
+
$element->setName($element->getName() . '[]');
|
43 |
+
|
44 |
+
$_yearsHtml = $element->setStyle('width:75px;')
|
45 |
+
->setValues($_years)
|
46 |
+
->setValue(isset($values[0]) ? $values[0] : null)
|
47 |
+
->getElementHtml();
|
48 |
+
|
49 |
+
$_monthsHtml = $element->setStyle('width:100px;')
|
50 |
+
->setValues($_months)
|
51 |
+
->setValue(isset($values[1]) ? $values[1] : null)
|
52 |
+
->getElementHtml();
|
53 |
+
|
54 |
+
$_daysHtml = $element->setStyle('width:50px;')
|
55 |
+
->setValues($_days)
|
56 |
+
->setValue(isset($values[2]) ? $values[2] : null)
|
57 |
+
->getElementHtml();
|
58 |
+
|
59 |
+
return sprintf('%s %s %s', $_yearsHtml, $_monthsHtml, $_daysHtml);
|
60 |
+
}
|
61 |
+
}
|
app/code/local/Biztech/Notification/Block/Notification.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Biztech_Notification_Block_Notification extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
|
5 |
+
const XML_PATH_NOTIFICATION_DISPLAY = 'notification/notification_general/display';
|
6 |
+
const XML_PATH_NOTIFICATION_CONTENT = 'notification/notification_general/content';
|
7 |
+
const XML_PATH_NOTIFICATION_CLEAR_CONTROL = 'notification/notification_general/clearcontrol';
|
8 |
+
const XML_PATH_NOTIFICATION_IDENTIFIER = 'notification/notification_general/identifier';
|
9 |
+
const XML_PATH_NOTIFICATION_FIXED = 'notification/notification_general/fixed';
|
10 |
+
const XML_PATH_NOTIFICATION_START_DATE = 'notification/notification_general/start_date';
|
11 |
+
const XML_PATH_NOTIFICATION_END_DATE = 'notification/notification_general/end_date';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Check if the notifications bar should be displayed
|
15 |
+
*
|
16 |
+
* @return boolean
|
17 |
+
*/
|
18 |
+
public function showNotifications()
|
19 |
+
{
|
20 |
+
// notification bar enabled
|
21 |
+
// AND bar is either not cleared OR bar is not allowed to be cleared
|
22 |
+
// AND after start date
|
23 |
+
// AND before end date
|
24 |
+
return Mage::getStoreConfig(self::XML_PATH_NOTIFICATION_DISPLAY) &&
|
25 |
+
$this->_hasNotificationContent() &&
|
26 |
+
(!$this->isNotificationCleared() || !$this->allowClearControl()) &&
|
27 |
+
$this->_afterStartDate() &&
|
28 |
+
$this->_beforeEndDate();
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Fetches the notification bar content
|
33 |
+
*
|
34 |
+
* @return string
|
35 |
+
*/
|
36 |
+
public function getNotificationText()
|
37 |
+
{
|
38 |
+
$content = Mage::getStoreConfig(self::XML_PATH_NOTIFICATION_CONTENT);
|
39 |
+
|
40 |
+
$helper = Mage::helper('cms');
|
41 |
+
if($helper) {
|
42 |
+
$processor = $helper->getBlockTemplateProcessor();
|
43 |
+
if($processor) {
|
44 |
+
$content = $processor->filter($content);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
return $content;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns true if there is notification content to display
|
53 |
+
*
|
54 |
+
* @return boolean
|
55 |
+
*/
|
56 |
+
protected function _hasNotificationContent() {
|
57 |
+
$content = $this->getNotificationText();
|
58 |
+
return !empty($content);
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Returns true if the notification bar should be able to be closed/cleared
|
63 |
+
*
|
64 |
+
* @return boolean
|
65 |
+
*/
|
66 |
+
public function allowClearControl() {
|
67 |
+
return Mage::getStoreConfig(self::XML_PATH_NOTIFICATION_CLEAR_CONTROL);
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Returns the notification bar cookie name, which includes the current
|
72 |
+
* notification bar identifier, if any.
|
73 |
+
*
|
74 |
+
* @return string
|
75 |
+
*/
|
76 |
+
public function getNotificationClearCookieName() {
|
77 |
+
return 'clear_notification'.preg_replace("/\W/", '', Mage::getStoreConfig(self::XML_PATH_NOTIFICATION_IDENTIFIER));
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Returns true if the currently identified notification bar has been cleared
|
82 |
+
* by the client, false otherwise
|
83 |
+
*
|
84 |
+
* @return boolean
|
85 |
+
*/
|
86 |
+
public function isNotificationCleared() {
|
87 |
+
return Mage::getSingleton('core/cookie')->get($this->getNotificationClearCookieName());
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Return true if the notification bar should be fixed in place at the top
|
92 |
+
*
|
93 |
+
* @return boolean
|
94 |
+
*/
|
95 |
+
public function isFixed() {
|
96 |
+
return Mage::getStoreConfig(self::XML_PATH_NOTIFICATION_FIXED);
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Returns true if the notification bar should be displayed based on the
|
101 |
+
* start_date.
|
102 |
+
*
|
103 |
+
* @return boolean true if either no start date is defined, or the current
|
104 |
+
* date is after the start date, false otherwise.
|
105 |
+
*/
|
106 |
+
protected function _afterStartDate() {
|
107 |
+
list($year,$month,$day) = explode(',',Mage::getStoreConfig(self::XML_PATH_NOTIFICATION_START_DATE));
|
108 |
+
$str = null;
|
109 |
+
if($year) {
|
110 |
+
$str .= $year;
|
111 |
+
if($month) {
|
112 |
+
$str .= "-".$month;
|
113 |
+
if($day) $str .= "-".$day;
|
114 |
+
}
|
115 |
+
|
116 |
+
return time() >= strtotime($str); // current time is after the start date?
|
117 |
+
}
|
118 |
+
return true; // no start date set, so the notification bar is always on
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Returns true if the notification bar should be displayed based on the
|
123 |
+
* end_date.
|
124 |
+
*
|
125 |
+
* @return boolean true if either no end date is defined, or the current
|
126 |
+
* date is after the start date, false otherwise.
|
127 |
+
*/
|
128 |
+
protected function _beforeEndDate() {
|
129 |
+
list($year,$month,$day) = explode(',',Mage::getStoreConfig(self::XML_PATH_NOTIFICATION_END_DATE));
|
130 |
+
$str = null;
|
131 |
+
if($year) {
|
132 |
+
$str .= $year;
|
133 |
+
if($month) {
|
134 |
+
$str .= "-".$month;
|
135 |
+
if($day) $str .= "-".$day;
|
136 |
+
}
|
137 |
+
|
138 |
+
return time() < strtotime($str); // current time is before end date?
|
139 |
+
}
|
140 |
+
return true; // no end date set, so the notification bar is always on
|
141 |
+
}
|
142 |
+
|
143 |
+
}
|
app/code/local/Biztech/Notification/Block/Styles.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Biztech
|
4 |
+
* @package Biztech_Notification
|
5 |
+
*/
|
6 |
+
class Biztech_Notification_Block_Styles extends Mage_Core_Block_Template
|
7 |
+
{
|
8 |
+
const XML_PATH_NOTIFICATION_DEFAULT_STYLE = 'notification/notification_general/default_style';
|
9 |
+
const XML_PATH_NOTIFICATION_FIXED_MARGIN = 'notification/notification_general/fixed_margin';
|
10 |
+
const XML_NOTIFICATION_BLOCK_NAME = 'notification';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Return true if the default styling should be used
|
14 |
+
*
|
15 |
+
* @return boolean
|
16 |
+
*/
|
17 |
+
public function useDefaultStyles()
|
18 |
+
{
|
19 |
+
return Mage::getStoreConfig(self::XML_PATH_NOTIFICATION_DEFAULT_STYLE);
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Return true if the notification bar should be fixed in place at the top
|
24 |
+
*
|
25 |
+
* @return boolean
|
26 |
+
*/
|
27 |
+
public function isFixed() {
|
28 |
+
return $this->_getNotificationBlock()->isFixed();
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Returns the top margin value to apply to the body element when the
|
33 |
+
* notification bar is fixed in place
|
34 |
+
*
|
35 |
+
* @return string
|
36 |
+
*/
|
37 |
+
public function getFixedMargin() {
|
38 |
+
return Mage::getStoreConfig(self::XML_PATH_NOTIFICATION_FIXED_MARGIN);
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Check if the notifications bar should be displayed
|
43 |
+
*
|
44 |
+
* @return boolean
|
45 |
+
*/
|
46 |
+
public function showNotifications()
|
47 |
+
{
|
48 |
+
return $this->_getNotificationBlock()->showNotifications();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Return the notification bar block object, which is used to query the
|
53 |
+
* state of the notification bar configurations
|
54 |
+
*
|
55 |
+
* @return Biztech_NotificationBar_Block_Html_Notifications
|
56 |
+
*/
|
57 |
+
protected function _getNotificationBlock() {
|
58 |
+
return $this->getLayout()->getBlock(self::XML_NOTIFICATION_BLOCK_NAME);
|
59 |
+
}
|
60 |
+
}
|
app/code/local/Biztech/Notification/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Biztech_Notification_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Biztech/Notification/Model/System/Positionnotification.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* 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_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2013 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 |
+
* Used in creating options for Yes|No config value selection
|
29 |
+
*
|
30 |
+
*/
|
31 |
+
class Biztech_Notification_Model_System_Positionnotification
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Options getter
|
35 |
+
*
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function toOptionArray()
|
39 |
+
{
|
40 |
+
return array(
|
41 |
+
array('value' => 0, 'label' => 'Bottom'),
|
42 |
+
array('value' => 1, 'label' => 'Top'),
|
43 |
+
array('value' => 2, 'label' => 'Pop Up'),
|
44 |
+
);
|
45 |
+
}
|
46 |
+
}
|
app/code/local/Biztech/Notification/etc/config.xml
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Biztech
|
5 |
+
* @package Biztech_Notification
|
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_Notification>
|
13 |
+
<version>0.1.0</version>
|
14 |
+
</Biztech_Notification>
|
15 |
+
</modules>
|
16 |
+
<frontend>
|
17 |
+
<routers>
|
18 |
+
<notification>
|
19 |
+
<use>standard</use>
|
20 |
+
<args>
|
21 |
+
<module>Biztech_Notification</module>
|
22 |
+
<frontName>notification</frontName>
|
23 |
+
</args>
|
24 |
+
</notification>
|
25 |
+
</routers>
|
26 |
+
<layout>
|
27 |
+
<updates>
|
28 |
+
<notification>
|
29 |
+
<file>notification.xml</file>
|
30 |
+
</notification>
|
31 |
+
</updates>
|
32 |
+
</layout>
|
33 |
+
</frontend>
|
34 |
+
|
35 |
+
|
36 |
+
<global>
|
37 |
+
<blocks>
|
38 |
+
<notification>
|
39 |
+
<class>Biztech_Notification_Block</class>
|
40 |
+
</notification>
|
41 |
+
</blocks>
|
42 |
+
<helpers>
|
43 |
+
<notification>
|
44 |
+
<class>Biztech_Notification_Helper</class>
|
45 |
+
</notification>
|
46 |
+
</helpers>
|
47 |
+
<models>
|
48 |
+
<notification>
|
49 |
+
<class>Biztech_Notification_Model</class>
|
50 |
+
<resourceModel>notification_system</resourceModel>
|
51 |
+
</notification>
|
52 |
+
<notification_system>
|
53 |
+
<class>Biztech_Notification_Model_System</class>
|
54 |
+
<entities>
|
55 |
+
<notification>
|
56 |
+
<table>notification</table>
|
57 |
+
</notification>
|
58 |
+
</entities>
|
59 |
+
</notification_system>
|
60 |
+
</models>
|
61 |
+
</global>
|
62 |
+
<default>
|
63 |
+
<notification>
|
64 |
+
<display>0</display>
|
65 |
+
<clearcontrol>0</clearcontrol>
|
66 |
+
<default_style>1</default_style>
|
67 |
+
<fixed>1</fixed>
|
68 |
+
<fixed_margin>28px</fixed_margin>
|
69 |
+
</notification>
|
70 |
+
</default>
|
71 |
+
<adminhtml>
|
72 |
+
<acl>
|
73 |
+
<resources>
|
74 |
+
<all>
|
75 |
+
<title>Allow Everything</title>
|
76 |
+
</all>
|
77 |
+
<admin>
|
78 |
+
<children>
|
79 |
+
<Biztech_Notification>
|
80 |
+
<title>Notification ToolBar</title>
|
81 |
+
<sort_order>10</sort_order>
|
82 |
+
</Biztech_Notification>
|
83 |
+
<system>
|
84 |
+
<children>
|
85 |
+
<config>
|
86 |
+
<children>
|
87 |
+
<notification>
|
88 |
+
<title>Notification ToolBar</title>
|
89 |
+
</notification>
|
90 |
+
</children>
|
91 |
+
</config>
|
92 |
+
</children>
|
93 |
+
</system>
|
94 |
+
</children>
|
95 |
+
</admin>
|
96 |
+
</resources>
|
97 |
+
</acl>
|
98 |
+
<layout>
|
99 |
+
<updates>
|
100 |
+
<trackorder>
|
101 |
+
<file>notification.xml</file>
|
102 |
+
</trackorder>
|
103 |
+
</updates>
|
104 |
+
</layout>
|
105 |
+
</adminhtml>
|
106 |
+
</config>
|
app/code/local/Biztech/Notification/etc/system.xml
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<biztech translate="label" module="notification">
|
5 |
+
<label>Biztech Extensions</label>
|
6 |
+
<sort_order>250</sort_order>
|
7 |
+
</biztech>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<notification translate="label" module="notification">
|
11 |
+
<label>Notification</label>
|
12 |
+
<tab>biztech</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>1000</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 |
+
<notification_general translate="label">
|
20 |
+
<label>Notification</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 |
+
<display translate="label">
|
28 |
+
<label>Notification Enabled</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<sort_order>10</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 |
+
</display>
|
36 |
+
<default_style translate="label comment">
|
37 |
+
<label>Include Default Styling</label>
|
38 |
+
<comment>Disabling this allows you to more easily style the notification bar to match your theme</comment>
|
39 |
+
<frontend_type>select</frontend_type>
|
40 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
41 |
+
<sort_order>20</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 |
+
</default_style>
|
46 |
+
<content translate="label comment">
|
47 |
+
<label>Notification Content</label>
|
48 |
+
<comment>HTML is allowed. If Left Blank it will not display Notification Bar.</comment>
|
49 |
+
<frontend_type>textarea</frontend_type>
|
50 |
+
<sort_order>30</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</content>
|
55 |
+
<clearcontrol translate="label comment">
|
56 |
+
<label>Allow Notification to be Closed</label>
|
57 |
+
<comment>Enabling this will allow the user to close the notification bar</comment>
|
58 |
+
<frontend_type>select</frontend_type>
|
59 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
60 |
+
<sort_order>40</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
</clearcontrol>
|
65 |
+
|
66 |
+
<start_date translate="label comment">
|
67 |
+
<label>Start Date</label>
|
68 |
+
<comment>Optional date to start displaying the notification bar</comment>
|
69 |
+
<frontend_type>select</frontend_type>
|
70 |
+
<frontend_model>notification/adminhtml_config_form_field_datepicker</frontend_model>
|
71 |
+
<sort_order>60</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
</start_date>
|
76 |
+
<end_date translate="label comment">
|
77 |
+
<label>End Date</label>
|
78 |
+
<comment>Optional date to stop displaying the notification bar</comment>
|
79 |
+
<frontend_type>select</frontend_type>
|
80 |
+
<frontend_model>notification/adminhtml_config_form_field_datepicker</frontend_model>
|
81 |
+
<sort_order>70</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>1</show_in_website>
|
84 |
+
<show_in_store>1</show_in_store>
|
85 |
+
</end_date>
|
86 |
+
<fixed translate="label comment">
|
87 |
+
<label>Position Notification Bar</label>
|
88 |
+
<comment>Change Notification Bar Positions as per your preferences.</comment>
|
89 |
+
<frontend_type>select</frontend_type>
|
90 |
+
<source_model>notification/system_positionnotification</source_model>
|
91 |
+
<sort_order>80</sort_order>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<show_in_website>1</show_in_website>
|
94 |
+
<show_in_store>1</show_in_store>
|
95 |
+
</fixed>
|
96 |
+
<popup_title translate="label comment">
|
97 |
+
<label>Notification Bar Popup Title</label>
|
98 |
+
<comment>Set Title only when you have selected "Pop Up" for Position Notification Bar field.</comment>
|
99 |
+
<frontend_type>text</frontend_type>
|
100 |
+
<sort_order>90</sort_order>
|
101 |
+
<show_in_default>1</show_in_default>
|
102 |
+
<show_in_website>1</show_in_website>
|
103 |
+
<show_in_store>1</show_in_store>
|
104 |
+
</popup_title>
|
105 |
+
<fixed_margin translate="label comment">
|
106 |
+
<label>Fixed Body Margin</label>
|
107 |
+
<comment>Used only when Fixed Notification Bar is at Top; this must be the height of the notification bar, in CSS units. Ex. 50px</comment>
|
108 |
+
<frontend_type>text</frontend_type>
|
109 |
+
<sort_order>100</sort_order>
|
110 |
+
<show_in_default>1</show_in_default>
|
111 |
+
<show_in_website>1</show_in_website>
|
112 |
+
<show_in_store>1</show_in_store>
|
113 |
+
</fixed_margin>
|
114 |
+
</fields>
|
115 |
+
</notification_general>
|
116 |
+
</groups>
|
117 |
+
</notification>
|
118 |
+
</sections>
|
119 |
+
</config>
|
app/design/frontend/default/default/layout/notification.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<block type="notification/styles" name="notification_bar_style" as="notification_bar_style" template="notification/styles.phtml" />
|
6 |
+
</reference>
|
7 |
+
<reference name="after_body_start">
|
8 |
+
<block type="notification/notification" name="notification" template="notification/notification.phtml" />
|
9 |
+
</reference>
|
10 |
+
</default>
|
11 |
+
</layout>
|
app/design/frontend/default/default/template/notification/notification.phtml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Biztech
|
4 |
+
* @package Biztech_Notification
|
5 |
+
*/
|
6 |
+
?>
|
7 |
+
<?php if ($this->showNotifications()): ?>
|
8 |
+
<div class="bg-overlay">
|
9 |
+
<?php
|
10 |
+
$position = Mage::getStoreConfig('notification/notification_general/fixed');
|
11 |
+
if($position==1){ ?>
|
12 |
+
<div id="notification-bar" class="top"><div id="notification"><span class="notification-content"><?php echo $this->getNotificationText(); ?></span><?php if($this->allowClearControl()) : ?>
|
13 |
+
<span class="close"><img src="<?php echo $this->getSkinUrl('notification/images/close-note.png') ?>" /></span><?php endif; ?></div></div>
|
14 |
+
<?php }
|
15 |
+
|
16 |
+
elseif($position==0) { ?>
|
17 |
+
<div id="notification-bar" class="bottom"><div id="notification"><span class="notification-content"><?php echo $this->getNotificationText(); ?></span><?php if($this->allowClearControl()) : ?><span class="close"><img src="<?php echo $this->getSkinUrl('notification/images/close-note.png') ?>" /></span><?php endif; ?></div></div>
|
18 |
+
<?php }
|
19 |
+
|
20 |
+
else{ ?>
|
21 |
+
<div class="center-align">
|
22 |
+
<div class="close"></div>
|
23 |
+
<div class="pop-title">
|
24 |
+
<?php echo Mage::getStoreConfig('notification/notification_general/popup_title'); ?>
|
25 |
+
</div>
|
26 |
+
<div class="popup-container"><?php echo $this->getNotificationText(); ?></div>
|
27 |
+
</div>
|
28 |
+
<?php } ?>
|
29 |
+
|
30 |
+
<?php if($this->allowClearControl()) : ?>
|
31 |
+
<script type="text/javascript">
|
32 |
+
$$('.bg-overlay .close').first().observe('click',function(event) {
|
33 |
+
var callback = <?php echo ($this->isFixed() ? "function() { \$\$('body').first().setStyle({marginTop:0}); }" : "function(){}") ?>;
|
34 |
+
event.element().up('.bg-overlay').fade({duration:0.5, afterFinish:callback});
|
35 |
+
Mage.Cookies.set("<?php echo $this->getNotificationClearCookieName() ?>","1",new Date((new Date()).getTime() + 365*24*60*60*1000),"/");
|
36 |
+
|
37 |
+
});
|
38 |
+
$$('.center-align')[0].style.height = $$('.pop-title')[0].clientHeight+$$('.popup-container')[0].clientHeight +'px';
|
39 |
+
</script>
|
40 |
+
</div>
|
41 |
+
<?php endif; ?>
|
42 |
+
<?php endif; ?>
|
43 |
+
|
app/design/frontend/default/default/template/notification/styles.phtml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @see Biztech_Notification_Block_Html_Styles
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
<?php if($this->showNotifications()) { ?>
|
7 |
+
<?php if($this->useDefaultStyles() || $this->isFixed()) { ?>
|
8 |
+
<style type="text/css">
|
9 |
+
<?php } ?>
|
10 |
+
<?php if($this->useDefaultStyles()) { ?>
|
11 |
+
<?php /*
|
12 |
+
#notification-bar { text-align:center;background-color:#c2c2c1;color:black;line-height:normal;padding:7px 0;}
|
13 |
+
*/ ?>
|
14 |
+
#notification-bar.bottom { background: none repeat scroll 0 0 #C2C2C1; bottom: 0; color: #000; font-size: 12px;left: -2px; line-height:20px;opacity:0.9; filter:alpha(opacity=90); position: fixed; text-align: center; width: 100%; z-index: 1000;}
|
15 |
+
#notification-bar #notification { width:950px; margin:0 auto; text-align:center; position:relative; padding:16px 0px ;}
|
16 |
+
#notification-bar span.close {cursor: pointer; position:absolute; right:0px; text-decoration: none; top:14px; }
|
17 |
+
#notification-bar span.close img { vertical-align:middle;}
|
18 |
+
#notification-bar .close a { text-decoration: none; color: #ffffff; }
|
19 |
+
#notification-bar .close a:hover { text-decoration: none; }
|
20 |
+
<?php } ?>
|
21 |
+
<?php if($this->isFixed()) { ?>
|
22 |
+
<?php if($this->isFixed()!=2) { ?>
|
23 |
+
#notification-bar.top { position: fixed;top: 0; width: 100%; left:0px;z-index: 100; background: none repeat scroll 0 0 #C2C2C1; color: #000; font-size: 12px; opacity:0.9; filter:alpha(opacity=90); / }
|
24 |
+
body { margin-top: <?php echo $this->getFixedMargin() ?>; }
|
25 |
+
<?php }
|
26 |
+
else{ ?>
|
27 |
+
/* #notification-bar { position: fixed;left:50%; top: 250px; margin-left:-300px; width:600px;z-index: 100;border-bottom: 1px solid black; border:3px solid #afafae; background:#fff; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;}
|
28 |
+
#notification-bar #notification { width:600px; }
|
29 |
+
#notification-bar span.notification-close { right: -16px; top: -17px;}
|
30 |
+
.overlay-bg { display: block; position: absolute; top: 0; left: 0; height:100%; width: 100%; cursor: pointer; z-index: 1000; background: #000;opacity:0.7; filter:alpha(opacity=70); }*/
|
31 |
+
/* popup css */
|
32 |
+
.bg-overlay{background:url(<?php echo $this->getSkinUrl('/notification/images/overlay.png') ?>) 0 0 repeat; height: 100%; left: 0; position: fixed; top: 0; width: 100%; z-index: 99;}
|
33 |
+
.bg-overlay .center-align{ background: #FFFFFF; border: 5px solid #E5E4DD; left:0; top:0; margin: auto; *margin: 20% auto 0 auto; position: absolute; *position: static; right: 0; bottom: 0; text-align: center;width: 645px; }
|
34 |
+
.bg-overlay .center-align .pop-title{background: none repeat scroll 0 0 #F4F4F4; border-bottom: 1px solid #EBEBEB; font-size: 14px; font-weight: bold; padding:6px 15px; text-align:left;}
|
35 |
+
.bg-overlay .center-align button{ *margin:0 3px;}
|
36 |
+
.bg-overlay .center-align .popup-container { padding: 15px;}
|
37 |
+
.bg-overlay .close{ background:url(<?php echo $this->getSkinUrl('/notification/images/closebox.png') ?>) 0 0 no-repeat; position: absolute; width: 30px; height: 30px; top:-18px; right:-18px; cursor:pointer;}
|
38 |
+
<?php
|
39 |
+
}
|
40 |
+
} ?>
|
41 |
+
<?php if($this->useDefaultStyles() || $this->isFixed()){ ?>
|
42 |
+
</style>
|
43 |
+
<?php } ?>
|
44 |
+
<?php } ?>
|
45 |
+
|
46 |
+
<script type="text/javascript">
|
47 |
+
|
48 |
+
function popupwindow(w, h) {
|
49 |
+
var left = (screen.width/2)-(w/2);
|
50 |
+
var top = (screen.height/2)-(h/2);
|
51 |
+
return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
|
52 |
+
}
|
53 |
+
popupwindow();
|
54 |
+
|
55 |
+
</script>
|
app/etc/modules/Biztech_All.xml
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Biztech
|
5 |
+
* @package Biztech_All
|
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_All>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>local</codePool>
|
15 |
+
</Biztech_All>
|
16 |
+
</modules>
|
17 |
+
<adminhtml>
|
18 |
+
<acl>
|
19 |
+
<resources>
|
20 |
+
<all>
|
21 |
+
<title>Allow Everything</title>
|
22 |
+
</all>
|
23 |
+
<admin>
|
24 |
+
<children>
|
25 |
+
<Biztech_All>
|
26 |
+
<title>All</title>
|
27 |
+
<sort_order>10</sort_order>
|
28 |
+
</Biztech_All>
|
29 |
+
<system>
|
30 |
+
<children>
|
31 |
+
<config>
|
32 |
+
<children>
|
33 |
+
<all>
|
34 |
+
<title>All</title>
|
35 |
+
</all>
|
36 |
+
</children>
|
37 |
+
</config>
|
38 |
+
</children>
|
39 |
+
</system>
|
40 |
+
</children>
|
41 |
+
</admin>
|
42 |
+
</resources>
|
43 |
+
</acl>
|
44 |
+
<layout>
|
45 |
+
<updates>
|
46 |
+
<all>
|
47 |
+
<file>all.xml</file>
|
48 |
+
</all>
|
49 |
+
</updates>
|
50 |
+
</layout>
|
51 |
+
</adminhtml>
|
52 |
+
</config>
|
app/etc/modules/Biztech_Notification.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Biztech
|
5 |
+
* @package Biztech_Notification
|
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_Notification>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>local</codePool>
|
15 |
+
</Biztech_Notification>
|
16 |
+
</modules>
|
17 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>notification_module</name>
|
4 |
+
<version>0.1.0</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>This extension allows you to create and manage a notification bar for displaying important announcements and notices to your customers and site visitors.</summary>
|
10 |
+
<description>Overview
|
11 |
+
This extension allows you to create and manage a notification bar for displaying important announcements and notices to your customers and site visitors.
|
12 |
+

|
13 |
+
Features
|
14 |
+
• Easily configurable from System > Configuration > Biztech Extensions> Notification
|
15 |
+
• Style notification bar to match Users theme
|
16 |
+
• Notification bar content may contain plain text, HTML and template tags
|
17 |
+
• Optionally allow visitors to close and dismiss the notification bar
|
18 |
+
• Optionally set a notification start date, to set your message to automatically display on a specified date, and also set a notification end date, to hide your message automatically after this specific date 
|
19 |
+
• You can also fix the notification bar at the top of the browser, at the bottom and also can make it appear as pop up! Interesting part is that in pop up option you can set your own title also for the notification, so that it scrolls with the page, and remains always visible to the visitor (although visitor can close it anytime)!</description>
|
20 |
+
<notes>-New Release</notes>
|
21 |
+
<authors><author><name>Biztech</name><user>biztechcon</user><email>sales@biztechconsultancy.com</email></author></authors>
|
22 |
+
<date>2014-05-17</date>
|
23 |
+
<time>12:33:34</time>
|
24 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Biztech_Notification.xml" hash="72d08fbf6eae50adedea827e5ac397d8"/><file name="Biztech_All.xml" hash="f4c3b9c029e56da8f09d7d71336c00f7"/></dir></target><target name="magelocal"><dir name="Biztech"><dir name="Notification"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Datepicker.php" hash="d6341935aebfefd1082ad1eadb9459b0"/></dir></dir></dir></dir><file name="Notification.php" hash="db1ddac19ad0bf744418e6907e584fff"/><file name="Styles.php" hash="712088b7fa18a4726a136b37a64e7c22"/></dir><dir name="Helper"><file name="Data.php" hash="0017f0f712dc940360c1e7c675f440c2"/></dir><dir name="Model"><dir name="System"><file name="Positionnotification.php" hash="97869c1724b138fca4f3b891379baf31"/></dir></dir><dir name="etc"><file name="config.xml" hash="6989680496ee4a1a7a1cf717f369689d"/><file name="system.xml" hash="21a598102bd8f14c9743eafd23334acd"/></dir></dir><dir name="All"><dir name="Helper"><file name="Data.php" hash="e856726fd089e7f73ca7de450b696419"/></dir><dir name="Model"><file name="All.php" hash="a9aeeb9c6d7be9cf20414f405efc878d"/><dir name="Mysql4"><dir name="All"><file name="Collection.php" hash="a1909236183d126f38e628b85bb57e81"/></dir><file name="All.php" hash="f02542393eb26eadfb9b92d901d2ac12"/></dir><dir name="Source"><dir name="Updates"><file name="Type.php" hash="fa695bf4764c2d93c7436ed54bde89ba"/></dir></dir><file name="Status.php" hash="30a6f0da7d9d45e1082da532d5f8dabc"/><file name="Update.php" hash="83ceddbab4d621545b9c7c4bccdec7c0"/></dir><dir name="etc"><file name="config.xml" hash="27e403cedb861da03753d28527d9c664"/><file name="system.xml" hash="17262087dc933d934e09ac04cafb4c51"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="notification.xml" hash="37fcf25a8279fb5cff5f2838188de7f0"/></dir><dir name="template"><dir name="notification"><file name="notification.phtml" hash="25bd2b1bde0970a3149e8d72cf06d31b"/><file name="styles.phtml" hash="e519e6127e53d822156acd1bb4947055"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="notification"><dir name="images"><file name="close-note.png" hash="d4511392715a554859c06430eb445b28"/><file name="closebox.png" hash="f2aace763cfcc4d6f3427a8a0842e55c"/><file name="overlay.png" hash="28d610442e36fb2a71773eeb013c3660"/></dir></dir></dir></dir></dir></target></contents>
|
25 |
+
<compatible/>
|
26 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
27 |
+
</package>
|
skin/frontend/default/default/notification/images/close-note.png
ADDED
Binary file
|
skin/frontend/default/default/notification/images/closebox.png
ADDED
Binary file
|
skin/frontend/default/default/notification/images/overlay.png
ADDED
Binary file
|