4 The API for adding a menu item is this:
7 ["About"]=> <-- category
9 ["The Ninja project"]=> <-- label
12 string(64) "http://www.op5.org/community/plugin-inventory/op5-projects/ninja" <-- absolute or relative url
14 string(5) "ninja" <--- "id", or "geomap.png" (ninja/app..), or array('synergy', 'synergy.png') (ninja/modules/..)
16 int(3) <---- 0 indicates internal link, /monitor/index.php will be prepended;
17 <---- 1 indicates same host, https://monitor-server will be prepended
18 <---- 2 indicates same host, but only if site_domain is /monitor/, licensed version
19 <---- 3 indicates same host, but only if site_domain is not /monitor/, community version
26 <div
class="main-menu">
29 <div
class="logo-image"></div
>
36 $uri = str_replace($_SERVER['QUERY_STRING'], '', $_SERVER['REQUEST_URI']);
37 $uri = str_replace('?', '', $uri);
38 $uri = preg_replace('~/+~', '/', $uri);
42 foreach ($links as $section => $entry) {
43 $normalized_section_name = str_replace(' ','-',strtolower($section));
46 <li
class="supermenu-button" id
="<?php echo $normalized_section_name; ?>-button">
47 <span
class="icon-32 x32-<?php echo $normalized_section_name; ?>"></span
>
51 if (strtolower($section) == 'about') {
52 $linkstring .= '<li class="meta">'.Kohana
::config('config.product_name') . ": " . config
::get_version_info().'</li>';
53 $linkstring .= '<li class="meta">'._('Page loaded').': '.date(nagstat
::date_format()).'</li>';
54 } elseif (empty($entry)) {
63 foreach ($entry as $name => $data) {
65 /* Never have a capital o in op5 */
66 $formatted_name = preg_replace('/op5/i', 'op5', ucwords($name));
68 if( is_array($data[1]) ) {
69 $icon_image = $data[1][1];
70 $module_name = $data[1][0];
71 $id = $normalized_section_name."-".$data[1][0];
73 $icon_image = $data[1];
75 $id = $normalized_section_name."-".$data[1];
79 // Do not add white-space, line-feeds or carriage returns in here, it will screw up JavaScript .children's and .nextSibling's
81 $siteuri = url
::site($data[0], null);
82 $siteuri = preg_replace('~/+~', '/', $siteuri);
84 if (strpos($siteuri, '?')) {
85 $siteuri = substr($siteuri, 0, strpos($siteuri, '?'));
88 $linkstring .= "<li class='nav-seg'><a href='".rtrim(url
::base(true), "/").$data[0]."' id='$id' class='ninja_menu_links'>";
89 if (strpos($icon_image, '.') !== false)
90 $linkstring .= "<span class='icon-menu' style='background-image: url(".ninja
::add_path('icons/menu/'.$icon_image, $module_name).")'></span>";
92 $linkstring .= "<span class='icon-menu menu-".$icon_image."'></span>";
93 $linkstring .= "<span class='nav-seg-span'>".$formatted_name."</span></a></li>";
98 } elseif($data[2] == 1) {
99 $linkstring .= "<li class='nav-seg'><a href='".$data[0]."' id='$id' class='ninja_menu_links'>";
100 if (strpos($icon_image, '.') !== false)
101 $linkstring .= "<img src='".ninja
::add_path('icons/menu/'.$icon_image, $module_name)."' />";
103 $linkstring .= "<span class='icon-menu menu-".$icon_image."'></span>";
104 $linkstring .= "<span class='nav-seg-span'>".$formatted_name."</span></a></li>";
105 } // common external links
106 elseif(($data[2] == 2 && Kohana
::config('config.site_domain') == '/monitor/') ||
107 ($data[2] == 3 && Kohana
::config('config.site_domain') != '/monitor/')) {
109 $linkstring .= "<li class='nav-seg'><a href='".$data[0]."' id='$id' target='_blank' class='ninja_menu_links'>";
110 if (strpos($icon_image, '.') !== false)
111 $linkstring .= "<img src='".ninja
::add_path('icons/menu/'.$icon_image, $module_name)."' />";
113 $linkstring .= "<span class='icon-menu menu-".$icon_image."'></span>";
114 $linkstring .= "<span class='nav-seg-span'>".$formatted_name."</span></a></li>";
122 if ($in_menu == true) {
123 echo "<ul id='$normalized_section_name-menu' class='current-sup-menu' style='display: block'>";
125 echo "<ul id='$normalized_section_name-menu'>";