You are here

function footermap_get_menu in footermap: a footer site map 5

Same name and namespace in other branches
  1. 5.2 footermap.module \footermap_get_menu()
  2. 6 footermap.module \footermap_get_menu()
  3. 7 footermap.module \footermap_get_menu()
1 call to footermap_get_menu()
footermap_footer in ./footermap.module

File

./footermap.module, line 128

Code

function footermap_get_menu($mid, $level, $hastree, &$temp, $limit) {
  if ($limit != 0 && $level > $limit) {
    return 0;
  }

  /* if( $level > 1 ) { $tab = $level * 5; }
     else { $tab = 1; } */

  /* left over from some tabbing experiment i did.  leaving it alone for now */
  $a = 0;
  if ($paths) {
    $r = db_query("SELECT menu.*, (SELECT dst FROM url_alias WHERE src = menu.path) AS alias FROM menu WHERE pid = {$mid} ORDER BY pid,weight") or die(db_error());
  }
  else {
    $r = db_query("SELECT * FROM menu WHERE pid = {$mid} ORDER BY pid,weight") or die(db_error());
  }
  while ($h = db_fetch_object($r)) {
    if ($level == 2) {
      $a = 1;
    }
    if ($h->alias) {
      $h->path = $h->alias;
    }
    if ($h->path == "/") {
      $h->path = $base_url;
    }
    else {
      if (preg_match("/^http|www|gopher|https|mailto|ftp|file|news/", $h->path) == 0 && $h->path != "") {

        /* we need not match external links */
        $h->path = base_path() . $h->path;
      }
      else {
      }
    }
    if ($level > 1 && $h->path != "" && dechex($h->type) % 10 != 0) {
      $temp .= "\t<span class=\"footermap-item\"><a href=\"{$h->path}\">{$h->title}</a> &#xb7; </span>";
    }
    else {
      if ($h->path != "" && dechex($h->type) % 10 != 0) {
        $temp .= "<span class=\"footermap-submenu\"><a href=\"{$h->path}\">{$h->title}</a> &#xb7; </span>";
      }
      else {
        if (variable_get('menu_headers', 0) == 0 && dechex($h->type) % 10 != 0) {
          $temp .= "<span>{$h->title} &#xb7;</span>";
        }
      }
    }
    $i = footermap_get_menu($h->mid, $level + 1, $a, $temp, $limit);
    if ($i > 0) {

      /* let's make this consistant with drupal-4-7, is it ok? */
      $temp .= "<br>\n";
      $temp = preg_replace("/&#xb7; (\\S+)\$/", "\$1", $temp);
    }
  }
  return $a;
}