forkel_bars - Version 1.0.1

Version Notes

===== 1.0.1 =====
* Display each notification bar for a specific admin user role.

===== 1.0.0 =====
* Initial version of this module

Download this release

Release Info

Developer Tobias Forkel
Extension forkel_bars
Version 1.0.1
Comparing to
See all releases


Code changes from version 1.0.0 to 1.0.1

app/code/community/Forkel/Bars/Block/Adminhtml/Index/Edit/Form.php CHANGED
@@ -59,8 +59,6 @@ class Forkel_Bars_Block_Adminhtml_Index_Edit_Form extends Mage_Adminhtml_Block_W
59
  'name' => 'server_id',
60
  'label' => $this->__('Server'),
61
  'title' => $this->__('Server'),
62
- 'required' => false,
63
- 'value' => $model->getId(),
64
  'values' => Mage::getSingleton('forkel_bars/server')->getOptionArray()
65
  ));
66
 
@@ -105,10 +103,19 @@ class Forkel_Bars_Block_Adminhtml_Index_Edit_Form extends Mage_Adminhtml_Block_W
105
  )
106
  ));
107
 
 
 
 
 
 
 
 
 
 
108
  $form->setValues($model->getData());
109
  $form->setUseContainer(true);
110
  $this->setForm($form);
111
 
112
  return parent::_prepareForm();
113
  }
114
- }
59
  'name' => 'server_id',
60
  'label' => $this->__('Server'),
61
  'title' => $this->__('Server'),
 
 
62
  'values' => Mage::getSingleton('forkel_bars/server')->getOptionArray()
63
  ));
64
 
103
  )
104
  ));
105
 
106
+ $fieldset->addField('admin_role_id', 'multiselect', array(
107
+ 'name' => 'admin_role_id',
108
+ 'label' => $this->__('Admin Role'),
109
+ 'title' => $this->__('Admin Role'),
110
+ 'values' => Mage::getSingleton('forkel_bars/roles')->getOptionArray(),
111
+ 'note' => $this->__('Restrict for a specific admin role.'),
112
+ 'style' => 'height: 120px;'
113
+ ));
114
+
115
  $form->setValues($model->getData());
116
  $form->setUseContainer(true);
117
  $this->setForm($form);
118
 
119
  return parent::_prepareForm();
120
  }
121
+ }
app/code/community/Forkel/Bars/Block/Adminhtml/Notification.php CHANGED
@@ -12,10 +12,8 @@ class Forkel_Bars_Block_Adminhtml_Notification extends Mage_Core_Block_Template
12
  {
13
  public function getNotification()
14
  {
15
- $helper = Mage::helper(Forkel_Bars_Helper_Data::MODULE_KEY);
16
-
17
  return Mage::getSingleton(Forkel_Bars_Helper_Data::MODEL_INDEX)->loadByHostname(
18
- $helper->getHostname()
19
  );
20
  }
21
 
@@ -28,7 +26,6 @@ class Forkel_Bars_Block_Adminhtml_Notification extends Mage_Core_Block_Template
28
  */
29
  public function getBackgroundLighter($hex = '', $diff = '50')
30
  {
31
- return Forkel_Bars_Helper_Data::hexColorLighter($hex, $diff);
32
  }
33
-
34
  }
12
  {
13
  public function getNotification()
14
  {
 
 
15
  return Mage::getSingleton(Forkel_Bars_Helper_Data::MODEL_INDEX)->loadByHostname(
16
+ Mage::helper(Forkel_Bars_Helper_Data::MODULE_KEY)->getHostname()
17
  );
18
  }
19
 
26
  */
27
  public function getBackgroundLighter($hex = '', $diff = '50')
28
  {
29
+ return Mage::helper(Forkel_Bars_Helper_Data::MODULE_KEY)->hexColorLighter($hex, $diff);
30
  }
 
31
  }
app/code/community/Forkel/Bars/Changelog.txt CHANGED
@@ -7,6 +7,8 @@
7
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
  */
9
 
10
- ===== 1.0.0 =====
 
11
 
 
12
  * Initial version of this module
7
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
  */
9
 
10
+ ===== 1.0.1 =====
11
+ * Display each notification bar for a specific admin user role.
12
 
13
+ ===== 1.0.0 =====
14
  * Initial version of this module
app/code/community/Forkel/Bars/Model/Index.php CHANGED
@@ -22,7 +22,13 @@ class Forkel_Bars_Model_Index extends Mage_Core_Model_Abstract
22
  */
23
  public function loadByHostname($hostname = '', $status = 1)
24
  {
 
 
 
25
  $collection = $this->getCollection();
 
 
 
26
  $collection->getSelect()->join(array(
27
  'server'=> 'forkel_bars_server'),
28
  'main_table.server_id = server.id', array(
@@ -30,7 +36,6 @@ class Forkel_Bars_Model_Index extends Mage_Core_Model_Abstract
30
  )
31
  );
32
 
33
- $collection->addFieldToFilter('status', $status);
34
  $collection->addFieldToFilter('hostname', $hostname);
35
 
36
  return $collection->getFirstItem();
22
  */
23
  public function loadByHostname($hostname = '', $status = 1)
24
  {
25
+ $session = Mage::getSingleton('admin/session');
26
+ $role_id = implode('', $session->getUser()->getRoles());
27
+
28
  $collection = $this->getCollection();
29
+ $collection->addFieldToFilter('admin_role_id', array('finset' => $role_id));
30
+ $collection->addFieldToFilter('status', $status);
31
+
32
  $collection->getSelect()->join(array(
33
  'server'=> 'forkel_bars_server'),
34
  'main_table.server_id = server.id', array(
36
  )
37
  );
38
 
 
39
  $collection->addFieldToFilter('hostname', $hostname);
40
 
41
  return $collection->getFirstItem();
app/code/community/Forkel/Bars/Model/Roles.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Model_Roles extends Mage_Core_Model_Abstract
12
+ {
13
+ protected function _construct()
14
+ {
15
+ $this->_init('admin/roles');
16
+ }
17
+
18
+ /**
19
+ * Return all collection as an option array
20
+ *
21
+ * @return array
22
+ */
23
+ public function getOptionArray()
24
+ {
25
+ $options = array();
26
+
27
+ $collection = $this->getCollection();
28
+
29
+ foreach ($collection as $value)
30
+ {
31
+ $options[] = array(
32
+ 'value' => $value->getRoleId(),
33
+ 'label' => $value->getRoleName()
34
+ );
35
+ }
36
+
37
+ return $options;
38
+ }
39
+ }
app/code/community/Forkel/Bars/controllers/Adminhtml/Forkel/Bars/IndexController.php CHANGED
@@ -81,6 +81,16 @@ class Forkel_Bars_Adminhtml_Forkel_Bars_IndexController extends Mage_Adminhtml_C
81
  {
82
  $model = Mage::getSingleton(Forkel_Bars_Helper_Data::MODEL_INDEX);
83
 
 
 
 
 
 
 
 
 
 
 
84
  $model->setData($postData);
85
  $model->save();
86
 
81
  {
82
  $model = Mage::getSingleton(Forkel_Bars_Helper_Data::MODEL_INDEX);
83
 
84
+ foreach ($postData as $key => $value)
85
+ {
86
+ if (is_array($value))
87
+ {
88
+ $postData[$key] = implode(',', $this->getRequest()->getParam($key));
89
+ }
90
+ }
91
+
92
+ Mage::log($postData);
93
+
94
  $model->setData($postData);
95
  $model->save();
96
 
app/code/community/Forkel/Bars/data/forkel_bars_setup/data-install-1.0.0.php CHANGED
@@ -20,7 +20,8 @@ if ($model->getCollection()->count() == 0)
20
  'color' => '#a94442',
21
  'color_background' => '#f2dede',
22
  'server_id' => 4,
23
- 'status' => 1
 
24
  ),
25
  array(
26
  'name' => 'Please!',
@@ -28,7 +29,8 @@ if ($model->getCollection()->count() == 0)
28
  'color' => '#715630',
29
  'color_background' => '#f5ce96',
30
  'server_id' => 3,
31
- 'status' => 1
 
32
  ),
33
  array(
34
  'name' => 'Well ...',
@@ -36,7 +38,8 @@ if ($model->getCollection()->count() == 0)
36
  'color' => '#31708f',
37
  'color_background' => '#d9edf7',
38
  'server_id' => 2,
39
- 'status' => 1
 
40
  ),
41
  array(
42
  'name' => 'Good!',
@@ -44,7 +47,8 @@ if ($model->getCollection()->count() == 0)
44
  'color' => '#3c763d',
45
  'color_background' => '#dff0d8',
46
  'server_id' => 1,
47
- 'status' => 1
 
48
  )
49
  );
50
 
20
  'color' => '#a94442',
21
  'color_background' => '#f2dede',
22
  'server_id' => 4,
23
+ 'status' => 1,
24
+ 'admin_role_id' => 1
25
  ),
26
  array(
27
  'name' => 'Please!',
29
  'color' => '#715630',
30
  'color_background' => '#f5ce96',
31
  'server_id' => 3,
32
+ 'status' => 1,
33
+ 'admin_role_id' => 1,
34
  ),
35
  array(
36
  'name' => 'Well ...',
38
  'color' => '#31708f',
39
  'color_background' => '#d9edf7',
40
  'server_id' => 2,
41
+ 'status' => 1,
42
+ 'admin_role_id' => 1
43
  ),
44
  array(
45
  'name' => 'Good!',
47
  'color' => '#3c763d',
48
  'color_background' => '#dff0d8',
49
  'server_id' => 1,
50
+ 'status' => 1,
51
+ 'admin_role_id' => 1
52
  )
53
  );
54
 
app/code/community/Forkel/Bars/etc/config.xml CHANGED
@@ -13,7 +13,7 @@
13
  <config>
14
  <modules>
15
  <Forkel_Bars>
16
- <version>1.0.0</version>
17
  </Forkel_Bars>
18
  </modules>
19
  <global>
13
  <config>
14
  <modules>
15
  <Forkel_Bars>
16
+ <version>1.0.1</version>
17
  </Forkel_Bars>
18
  </modules>
19
  <global>
app/code/community/Forkel/Bars/sql/forkel_bars_setup/install-1.0.0.php CHANGED
@@ -34,6 +34,9 @@ if ($installer->getConnection()->isTableExists($table) != true)
34
  'nullable' => false,
35
  'default' => 0,
36
  ), 'Status')
 
 
 
37
  ->addColumn('server_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
38
  'unsigned' => true,
39
  'nullable' => false,
34
  'nullable' => false,
35
  'default' => 0,
36
  ), 'Status')
37
+ ->addColumn('admin_role_id', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
38
+ 'nullable' => false,
39
+ ), 'Admin Role')
40
  ->addColumn('server_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
41
  'unsigned' => true,
42
  'nullable' => false,
app/code/community/Forkel/Bars/sql/forkel_bars_setup/upgrade-1.0.0-1.0.1.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* @var $installer Mage_Core_Model_Resource_Setup */
4
+ $installer = $this;
5
+ $installer->startSetup();
6
+
7
+ /**
8
+ * Create table 'forkel_bars_index'
9
+ */
10
+ $table = $installer->getTable('forkel_bars/index');
11
+
12
+ $installer->getConnection()
13
+ ->addColumn($table,
14
+ 'admin_role_id',
15
+ array(
16
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
17
+ 'nullable' => true,
18
+ 'comment' => 'Admin Role'
19
+ )
20
+ );
21
+
22
+ $installer->endSetup();
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>forkel_bars</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/OSL-3.0">Open Software License v. 3.0 (OSL-3.0)</license>
7
  <channel>community</channel>
@@ -61,12 +61,15 @@
61
  &#xD;
62
  &lt;h3&gt;Support&lt;/h3&gt;&#xD;
63
  &lt;p&gt;This module is provided as-is with no warranty or support. Purchase a Warranty and Support Package on &lt;a href="http://www.tobiasforkel.de"&gt;http://www.tobiasforkel.de&lt;/a&gt; starting from $50.&lt;/p&gt;</description>
64
- <notes>===== 1.0.0 =====&#xD;
 
 
 
65
  * Initial version of this module</notes>
66
  <authors><author><name>Tobias Forkel</name><user>tforkel</user><email>magento@tobiasforkel.de</email></author></authors>
67
- <date>2015-12-09</date>
68
- <time>20:55:44</time>
69
- <contents><target name="magecommunity"><dir name="Forkel"><dir name="Bars"><dir name="Block"><dir name="Adminhtml"><dir name="Index"><dir name="Edit"><file name="Form.php" hash="1b86ba9f110e560373d2cc33723a7eb7"/></dir><file name="Edit.php" hash="0103c7c1c3459fce8605ed20abbd6e78"/><file name="Grid.php" hash="5a2dbf65cda4161d3b4d077302ec2e9f"/></dir><file name="Index.php" hash="525509035f5c44c2d8adc0967a052415"/><file name="Notification.php" hash="da66304399e22f2bf203682f51bb1c01"/><dir name="Server"><dir name="Edit"><file name="Form.php" hash="a8ff7f4a34ce5102188317b863bdeda6"/></dir><file name="Edit.php" hash="27810453296f514b1f381dbb1841ce43"/><file name="Grid.php" hash="8a70811620d424cfe3a4c162024a1d13"/></dir><file name="Server.php" hash="c993f4e4212e3b3ca3513ebb501def4a"/></dir></dir><file name="Changelog.txt" hash="8a221ad06ab6f1fc7d5b55d7dec0db89"/><dir name="controllers"><dir name="Adminhtml"><dir name="Forkel"><dir name="Bars"><file name="IndexController.php" hash="70d0294b4feff567a79c387bad277aae"/><file name="ServerController.php" hash="1da8c0ef1465fdad96aaed34a74818ee"/></dir></dir></dir></dir><dir name="data"><dir name="forkel_bars_setup"><file name="data-install-1.0.0.php" hash="8f874c404b7f7a0883d9246b14cf81c0"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8731d3ad2f9ebc933f327f73d4332922"/><file name="config.xml" hash="cc8a74b4774cfe28a6a5cde69e803de7"/></dir><dir name="Helper"><file name="Data.php" hash="3db6cae062e3ea960b0095ce25608202"/></dir><dir name="Model"><file name="Index.php" hash="51d5e63b8a6861fc7c840a3313dde979"/><dir name="Resource"><dir name="Index"><file name="Collection.php" hash="1c9b8c4157f07777058eea128c683426"/></dir><file name="Index.php" hash="16f51afe18dba2f4bf1146ae1bf2a73a"/><dir name="Server"><file name="Collection.php" hash="da06239337f1b586285df29fd308200e"/></dir><file name="Server.php" hash="11141fe5a4646eda013b85e2e1ec7d07"/></dir><file name="Server.php" hash="1b373759e53211ad488d2b5bf1ba2344"/></dir><dir name="sql"><dir name="forkel_bars_setup"><file name="install-1.0.0.php" hash="733fb4e58306eb6d1e4506a9006546c7"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="forkel"><file name="bars.xml" hash="906e48ef8ad9dd4cf2bb21f46ca7cf24"/></dir></dir><dir name="template"><dir name="forkel"><dir name="bars"><dir><dir name="adminhtml"><file name="notification.phtml" hash="e2e7540c99badb581da8cf7aa1d44b78"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Forkel_Bars.xml" hash="1b36f833bbcf2b4061f775a0a95dbdfe"/></dir></target><target name="mage"><dir name="js"><dir name="community"><dir name="forkel_bars"><file name="main.js" hash="475948c3771853ead0aecca7c229776a"/></dir></dir></dir></target><target name="magelocal"><dir name="de_DE"><file name="Forkel_Bars.csv" hash=""/></dir><dir name="en_US"><file name="Forkel_Bars.csv" hash=""/></dir></target></contents>
70
  <compatible/>
71
  <dependencies><required><php><min>5.4.0</min><max>5.6.16</max></php></required></dependencies>
72
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>forkel_bars</name>
4
+ <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/OSL-3.0">Open Software License v. 3.0 (OSL-3.0)</license>
7
  <channel>community</channel>
61
  &#xD;
62
  &lt;h3&gt;Support&lt;/h3&gt;&#xD;
63
  &lt;p&gt;This module is provided as-is with no warranty or support. Purchase a Warranty and Support Package on &lt;a href="http://www.tobiasforkel.de"&gt;http://www.tobiasforkel.de&lt;/a&gt; starting from $50.&lt;/p&gt;</description>
64
+ <notes>===== 1.0.1 =====&#xD;
65
+ * Display each notification bar for a specific admin user role.&#xD;
66
+ &#xD;
67
+ ===== 1.0.0 =====&#xD;
68
  * Initial version of this module</notes>
69
  <authors><author><name>Tobias Forkel</name><user>tforkel</user><email>magento@tobiasforkel.de</email></author></authors>
70
+ <date>2016-01-04</date>
71
+ <time>21:01:14</time>
72
+ <contents><target name="magecommunity"><dir name="Forkel"><dir name="Bars"><dir name="Block"><dir name="Adminhtml"><dir name="Index"><dir name="Edit"><file name="Form.php" hash="98183881e27d929e1a5b43aaaecd611c"/></dir><file name="Edit.php" hash="0103c7c1c3459fce8605ed20abbd6e78"/><file name="Grid.php" hash="5a2dbf65cda4161d3b4d077302ec2e9f"/></dir><file name="Index.php" hash="525509035f5c44c2d8adc0967a052415"/><file name="Notification.php" hash="0dcf5550a6838bbcbce1fed5bfb501f4"/><dir name="Server"><dir name="Edit"><file name="Form.php" hash="a8ff7f4a34ce5102188317b863bdeda6"/></dir><file name="Edit.php" hash="27810453296f514b1f381dbb1841ce43"/><file name="Grid.php" hash="8a70811620d424cfe3a4c162024a1d13"/></dir><file name="Server.php" hash="c993f4e4212e3b3ca3513ebb501def4a"/></dir></dir><file name="Changelog.txt" hash="649f1a2bb472938650ac3576fbe2a89b"/><dir name="controllers"><dir name="Adminhtml"><dir name="Forkel"><dir name="Bars"><file name="IndexController.php" hash="c6caff3224fd46a067e92b2a69e6f3fe"/><file name="ServerController.php" hash="1da8c0ef1465fdad96aaed34a74818ee"/></dir></dir></dir></dir><dir name="data"><dir name="forkel_bars_setup"><file name="data-install-1.0.0.php" hash="aa5f4bfd3543c266eb498890e42397a0"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8731d3ad2f9ebc933f327f73d4332922"/><file name="config.xml" hash="f6756cc9bd5c7dded5913902ed646d21"/></dir><dir name="Helper"><file name="Data.php" hash="3db6cae062e3ea960b0095ce25608202"/></dir><dir name="Model"><file name="Index.php" hash="4dd69936a248504bbf28d2ea4f672093"/><dir name="Resource"><dir name="Index"><file name="Collection.php" hash="1c9b8c4157f07777058eea128c683426"/></dir><file name="Index.php" hash="16f51afe18dba2f4bf1146ae1bf2a73a"/><dir name="Server"><file name="Collection.php" hash="da06239337f1b586285df29fd308200e"/></dir><file name="Server.php" hash="11141fe5a4646eda013b85e2e1ec7d07"/></dir><file name="Roles.php" hash="037b30f230e133eb28f73bcb44b7a7db"/><file name="Server.php" hash="1b373759e53211ad488d2b5bf1ba2344"/></dir><dir name="sql"><dir name="forkel_bars_setup"><file name="install-1.0.0.php" hash="ca8634919a6ed6221172f81b2613a416"/><file name="upgrade-1.0.0-1.0.1.php" hash="f0c2d80d5b645570758b42aa744a45b2"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="forkel"><file name="bars.xml" hash="906e48ef8ad9dd4cf2bb21f46ca7cf24"/></dir></dir><dir name="template"><dir name="forkel"><dir name="bars"><dir><dir name="adminhtml"><file name="notification.phtml" hash="e2e7540c99badb581da8cf7aa1d44b78"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Forkel_Bars.xml" hash="1b36f833bbcf2b4061f775a0a95dbdfe"/></dir></target><target name="mage"><dir name="js"><dir name="community"><dir name="forkel_bars"><file name="main.js" hash="475948c3771853ead0aecca7c229776a"/></dir></dir></dir></target><target name="magelocal"><dir name="de_DE"><file name="Forkel_Bars.csv" hash=""/></dir><dir name="en_US"><file name="Forkel_Bars.csv" hash=""/></dir></target></contents>
73
  <compatible/>
74
  <dependencies><required><php><min>5.4.0</min><max>5.6.16</max></php></required></dependencies>
75
  </package>