Beispiel #1
0
 function location_menu($array)
 {
     global $config;
     ksort($array['entries']);
     echo '<ul style="" class="dropdown-menu" style="min-width: 250px;">';
     if (count($array['entries']) > "3") {
         foreach ($array['entries'] as $entry => $entry_data) {
             if ($entry_data['level'] == "location_country") {
                 $code = $entry;
                 $entry = country_from_code($entry);
                 $image = '<i class="flag flag-' . $code . '" alt="' . $entry . '"></i>';
             } elseif ($entry_data['level'] == "location") {
                 echo '            <li><a href="' . generate_url(array('page' => 'devices', 'location' => urlencode($entry))) . '/"><i class="menu-icon oicon-building"></i> ' . $entry . ' (' . $entry_data['count'] . ')</a></li>';
                 continue;
             }
             echo '<li class="dropdown-submenu"><a href="' . generate_url(array('page' => 'devices', $entry_data['level'] => urlencode($entry))) . '/">
         ' . $image . ' ' . $entry . '(' . $entry_data['count'] . ')</a>';
             location_menu($entry_data);
             echo '</li>';
         }
     } else {
         $new_entry_array = array();
         foreach ($array['entries'] as $new_entry => $new_entry_data) {
             if ($new_entry_data['level'] == "location_country") {
                 $code = $new_entry;
                 $new_entry = country_from_code($new_entry);
                 $image = '<i class="flag flag-' . $code . '" alt="' . $new_entry . '"></i> ';
             } elseif ($new_entry_data['level'] == "location") {
                 echo '            <li><a href="' . generate_url(array('page' => 'devices', 'location' => urlencode($new_entry))) . '/"><i class="menu-icon oicon-building"></i> ' . $new_entry . ' (' . $new_entry_data['count'] . ')</a></li>';
                 continue;
             }
             echo '<li class="nav-header">' . $image . $new_entry . '</li>';
             foreach ($new_entry_data['entries'] as $sub_entry => $sub_entry_data) {
                 if (is_array($sub_entry_data['entries'])) {
                     echo '<li class="dropdown-submenu"><a style="" href="' . generate_url(array('page' => 'devices', $sub_entry_data['level'] => urlencode($sub_entry))) . '/">
             <i class="menu-icon oicon-building"></i> ' . $sub_entry . '(' . $sub_entry_data['count'] . ')</a>';
                     location_menu($sub_entry_data);
                 } else {
                     echo '            <li><a href="' . generate_url(array('page' => 'devices', 'location' => urlencode($sub_entry))) . '/"><i class="menu-icon oicon-building"></i> ' . $sub_entry . ' (' . $sub_entry_data['count'] . ')</a></li>';
                 }
                 echo '</li>';
             }
         }
     }
     echo '</ul>';
 }
 function location_menu($array)
 {
     global $config;
     ksort($array['entries']);
     echo '<ul class="dropdown-menu">';
     if (count($array['entries']) > "3") {
         foreach ($array['entries'] as $entry => $entry_data) {
             if ($entry_data['level'] == "location_country") {
                 $code = $entry;
                 $entry = country_from_code($entry);
                 $image = '<i class="flag flag-' . $code . '" alt="' . $entry . '"></i>';
             } elseif ($entry_data['level'] == "location") {
                 $name = $entry == '' ? '[[UNKNOWN]]' : htmlspecialchars($entry);
                 echo '            <li><a href="' . generate_location_url($entry) . '"><i class="menu-icon oicon-building-small"></i> ' . $name . '&nbsp[' . $entry_data['count'] . ']</a></li>';
                 continue;
             }
             echo '<li class="dropdown-submenu"><a href="' . generate_url(array('page' => 'devices', $entry_data['level'] => urlencode($entry))) . '"><i class="menu-icon oicon-building"></i> ' . $entry . '&nbsp[' . $entry_data['count'] . ']</a>';
             location_menu($entry_data);
             echo '</li>';
         }
     } else {
         $new_entry_array = array();
         foreach ($array['entries'] as $new_entry => $new_entry_data) {
             if ($new_entry_data['level'] == "location_country") {
                 $code = $new_entry;
                 $new_entry = country_from_code($new_entry);
                 $image = '<i class="flag flag-' . $code . '" alt="' . $new_entry . '"></i> ';
             } elseif ($new_entry_data['level'] == "location") {
                 $name = $new_entry == '' ? '[[UNKNOWN]]' : htmlspecialchars($new_entry);
                 echo '            <li><a href="' . generate_location_url($new_entry) . '"><i class="menu-icon oicon-building-small"></i> ' . $name . '&nbsp[' . $new_entry_data['count'] . ']</a></li>';
                 continue;
             }
             echo '<li class="nav-header">' . $image . $new_entry . '</li>';
             foreach ($new_entry_data['entries'] as $sub_entry => $sub_entry_data) {
                 if (is_array($sub_entry_data['entries'])) {
                     echo '<li class="dropdown-submenu"><a style="" href="' . generate_url(array('page' => 'devices', $sub_entry_data['level'] => urlencode($sub_entry))) . '">
             <i class="menu-icon oicon-building"></i> ' . $sub_entry . '&nbsp[' . $sub_entry_data['count'] . ']</a>';
                     location_menu($sub_entry_data);
                 } else {
                     $name = $sub_entry == '' ? '[[UNKNOWN]]' : htmlspecialchars($sub_entry);
                     echo '            <li><a href="' . generate_location_url($sub_entry) . '"><i class="menu-icon oicon-building-small"></i> ' . $name . '&nbsp[' . $sub_entry_data['count'] . ']</a></li>';
                 }
                 echo '</li>';
             }
         }
     }
     echo '</ul>';
 }