ND_EasyConfig - Version 0.1.2

Version Notes

Easiest way to access System -> Configuration menu

Download this release

Release Info

Developer Nikul Doshi
Extension ND_EasyConfig
Version 0.1.2
Comparing to
See all releases


Code changes from version 0.1.1 to 0.1.2

app/code/local/ND/EasyConfig/Block/Adminhtml/Page/Menu.php CHANGED
@@ -4,8 +4,17 @@ class ND_EasyConfig_Block_Adminhtml_Page_Menu extends Mage_Adminhtml_Block_Page_
4
  protected $_tabs = null;
5
  protected $_configMenu = null;
6
 
7
- protected function _construct()
8
  {
 
 
 
 
 
 
 
 
 
9
  parent::_construct();
10
  $this->prepareConfigMenu();
11
  }
@@ -109,14 +118,79 @@ class ND_EasyConfig_Block_Adminhtml_Page_Menu extends Mage_Adminhtml_Block_Page_
109
  }
110
  }
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  public function getMenuLevel($menu, $level = 0)
113
  {
114
  $html = '<ul ' . (!$level ? 'id="nav"' : '') . '>' . PHP_EOL;
115
  foreach ($menu as $item) {
116
- $isConfig = ($item['label']=='Configuration') ? true : false;
117
  if($isConfig) {
118
  $item['children'] = $this->_configMenu;
119
- }
120
  $html .= '<li ' . ((!empty($item['children']) || $isConfig) ? 'onmouseover="Element.addClassName(this,\'over\')" '
121
  . 'onmouseout="Element.removeClassName(this,\'over\')"' : '') . ' class="'
122
  . (!$level && !empty($item['active']) ? ' active' : '') . ' '
4
  protected $_tabs = null;
5
  protected $_configMenu = null;
6
 
7
+ /*protected function _prepareLayout()
8
  {
9
+ parent::_prepareLayout();
10
+ $currentVersion = Mage::getVersion();
11
+ if(version_compare($currentVersion,'1.7.0.0','<')) {
12
+ $this->setTemplate('easyconfigmenu/page/menu.phtml');
13
+ }
14
+ }*/
15
+
16
+ protected function _construct()
17
+ {
18
  parent::_construct();
19
  $this->prepareConfigMenu();
20
  }
118
  }
119
  }
120
 
121
+ protected function _buildMenuArray(Varien_Simplexml_Element $parent=null, $path='', $level=0)
122
+ {
123
+ if (is_null($parent)) {
124
+ $parent = Mage::getSingleton('admin/config')->getAdminhtmlConfig()->getNode('menu');
125
+ }
126
+
127
+ $parentArr = array();
128
+ $sortOrder = 0;
129
+ foreach ($parent->children() as $childName => $child) {
130
+ if (1 == $child->disabled) {
131
+ continue;
132
+ }
133
+
134
+ $aclResource = 'admin/' . ($child->resource ? (string)$child->resource : $path . $childName);
135
+ if (!$this->_checkAcl($aclResource)) {
136
+ continue;
137
+ }
138
+
139
+ if ($child->depends && !$this->_checkDepends($child->depends)) {
140
+ continue;
141
+ }
142
+
143
+ $menuArr = array();
144
+
145
+ $menuArr['label'] = $this->_getHelperValue($child);
146
+
147
+ $menuArr['sort_order'] = $child->sort_order ? (int)$child->sort_order : $sortOrder;
148
+
149
+ if ($child->action) {
150
+ $menuArr['url'] = $this->_url->getUrl((string)$child->action, array('_cache_secret_key' => true));
151
+ } else {
152
+ $menuArr['url'] = '#';
153
+ $menuArr['click'] = 'return false';
154
+ }
155
+
156
+ $isConfig = ($menuArr['label']=='Configuration') ? true : false;
157
+ if($isConfig) {
158
+ $menuArr['children'] = $this->_configMenu;
159
+ }
160
+
161
+ $menuArr['active'] = ($this->getActive()==$path.$childName)
162
+ || (strpos($this->getActive(), $path.$childName.'/')===0);
163
+
164
+ $menuArr['level'] = $level;
165
+
166
+ if ($child->children) {
167
+ $menuArr['children'] = $this->_buildMenuArray($child->children, $path.$childName.'/', $level+1);
168
+ }
169
+ $parentArr[$childName] = $menuArr;
170
+
171
+ $sortOrder++;
172
+ }
173
+
174
+ uasort($parentArr, array($this, '_sortMenu'));
175
+
176
+ while (list($key, $value) = each($parentArr)) {
177
+ $last = $key;
178
+ }
179
+ if (isset($last)) {
180
+ $parentArr[$last]['last'] = true;
181
+ }
182
+
183
+ return $parentArr;
184
+ }
185
+
186
  public function getMenuLevel($menu, $level = 0)
187
  {
188
  $html = '<ul ' . (!$level ? 'id="nav"' : '') . '>' . PHP_EOL;
189
  foreach ($menu as $item) {
190
+ /*$isConfig = ($item['label']=='Configuration') ? true : false;
191
  if($isConfig) {
192
  $item['children'] = $this->_configMenu;
193
+ }*/
194
  $html .= '<li ' . ((!empty($item['children']) || $isConfig) ? 'onmouseover="Element.addClassName(this,\'over\')" '
195
  . 'onmouseout="Element.removeClassName(this,\'over\')"' : '') . ' class="'
196
  . (!$level && !empty($item['active']) ? ' active' : '') . ' '
app/code/local/ND/EasyConfig/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <ND_EasyConfig>
5
- <version>0.1.1</version>
6
  </ND_EasyConfig>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <ND_EasyConfig>
5
+ <version>0.1.2</version>
6
  </ND_EasyConfig>
7
  </modules>
8
  <global>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ND_EasyConfig</name>
4
- <version>0.1.1</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -19,9 +19,9 @@ It will add sub-menu of all config sections in System menu on hover of configura
19
  &lt;/ul&gt;</description>
20
  <notes>Easiest way to access System -&gt; Configuration menu</notes>
21
  <authors><author><name>Nikul Doshi</name><user>nikulonline</user><email>nikulonline@gmail.com</email></author></authors>
22
- <date>2016-02-29</date>
23
- <time>08:32:13</time>
24
- <contents><target name="magelocal"><dir name="ND"><dir name="EasyConfig"><dir name="Block"><dir name="Adminhtml"><dir name="Page"><file name="Menu.php" hash="c06db2a55d1ffc156819786e663654d1"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="77d5fcbd65fedf767b9406209087afc4"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ND_EasyConfig.xml" hash="5b8d7a1f322e7240d15b9b559631defc"/></dir></target></contents>
25
  <compatible/>
26
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
27
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ND_EasyConfig</name>
4
+ <version>0.1.2</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
19
  &lt;/ul&gt;</description>
20
  <notes>Easiest way to access System -&gt; Configuration menu</notes>
21
  <authors><author><name>Nikul Doshi</name><user>nikulonline</user><email>nikulonline@gmail.com</email></author></authors>
22
+ <date>2016-03-15</date>
23
+ <time>06:40:34</time>
24
+ <contents><target name="magelocal"><dir name="ND"><dir name="EasyConfig"><dir name="Block"><dir name="Adminhtml"><dir name="Page"><file name="Menu.php" hash="0905b0f9e83017c578e5c7427c3cdba2"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="251c9b8179858f0f12f62ae8d1f8d1c7"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ND_EasyConfig.xml" hash="5b8d7a1f322e7240d15b9b559631defc"/></dir></target></contents>
25
  <compatible/>
26
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
27
  </package>