XOOPS  2.6.0
decorator.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  */
11 
22 {
23  public function accessFilter(&$accessFilter)
24  {
25  }
26 
27  public function decorateMenu(&$menu)
28  {
29  }
30 
31  public function end(&$menus)
32  {
33  $ret = array();
34  foreach ($menus as $menu) {
35  if (!preg_match('/{(MODULE\|.*)}/i', $menu['title'], $reg)) {
36  $ret[] = $menu;
37  continue;
38  }
39  $result = array_map('strtolower', explode('|', $reg[1]));
40  $moduleMenus = self::getModuleMenus($result[1], $menu['pid']);
41  foreach ($moduleMenus as $mMenu) {
42  $ret[] = $mMenu;
43  }
44  }
45  $menus = $ret;
46  }
47 
48  public function hasAccess($menu, &$hasAccess)
49  {
50  }
51 
52  public function start()
53  {
54  }
55 
56  protected function getModuleMenus($dirname, $pid)
57  {
58  static $id = -1;
61  $ret = array();
62 
63  /* @var $plugin MenusPluginInterface */
64  if ($plugin = \Xoops\Module\Plugin::getPlugin($dirname, 'menus')) {
65  if (is_array($subMenus = $plugin->subMenus())) {
66  foreach ($subMenus as $menu) {
67  $obj = $helper->getHandlerMenu()->create();
68  $obj->setVar('title', $menu['name']);
69  $obj->setVar('alt_title', $menu['name']);
70  $obj->setVar('link', $xoops->url("modules/{$dirname}/{$menu['url']}"));
71  $obj->setVar('id', $id);
72  $obj->setVar('pid', $pid);
73  $ret[] = $obj->getValues();
74  $id--;
75  }
76  }
77  }
78  return $ret;
79  }
80 }
static getInstance()
Definition: Xoops.php:160
$result
Definition: pda.php:33
$pid
Definition: admin_menu.php:37
static getInstance()
Definition: helper.php:34
$xoops
Definition: admin.php:25
$id
Definition: admin_menu.php:36
accessFilter(&$accessFilter)
Definition: decorator.php:23
hasAccess($menu, &$hasAccess)
Definition: decorator.php:48
$menu
$helper
$dirname
Definition: backend.php:38
getModuleMenus($dirname, $pid)
Definition: decorator.php:56