[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/e107_files/shortcode/ -> sitelinks_alt.sc (source)

   1  /*
   2  + ----------------------------------------------------------------------------+
   3  |     e107 website system
   4  |
   5  |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/sitelinks_alt.sc,v $
   6  |     $Revision: 1.37 $
   7  |     $Date: 2007/01/07 15:24:49 $
   8  |     $Author: e107steved $
   9  +----------------------------------------------------------------------------+
  10  */
  11  
  12      global $sql, $pref;
  13      $params = explode('+', $parm);
  14      if (isset($params[0]) && $params[0] && $params[0] != 'no_icons' && $params[0] != 'default') {
  15          $icon = $params[0];
  16      } else {
  17          $icon = e_IMAGE."generic/".IMODE."/arrow.png";
  18      }
  19  
  20  	function adnav_cat($cat_title, $cat_link, $cat_img, $cat_id=FALSE, $cat_open=FALSE) {
  21          global $tp;
  22  
  23          $cat_link = (strpos($cat_link, '://') === FALSE && strpos($cat_link, 'mailto:') !== 0 ? e_HTTP.$cat_link : $cat_link);
  24  
  25          if ($cat_open == 4 || $cat_open == 5){
  26              $dimen = ($cat_open == 4) ? "600,400" : "800,600";
  27              $href = " href=\"javascript:open_window('".$cat_link."',".$dimen.")\"";
  28          } else {
  29              $href = "href='".$cat_link."'";
  30          }
  31  
  32          $text = "<a class='menuButton' ".$href." ";
  33          if ($cat_img != 'no_icons') {
  34              $text .= "style='background-image: url(".$cat_img."); background-repeat: no-repeat; background-position: 3px 1px; white-space: nowrap' ";
  35          }
  36          if ($cat_id) {
  37              $text .= "onclick=\"return buttonClick(event, '".$cat_id."');\" onmouseover=\"buttonMouseover(event, '".$cat_id."');\"";
  38          }
  39          if ($cat_open == 1){
  40              $text .= " rel='external' ";
  41          }
  42          $text .= ">".$tp->toHTML($cat_title,"","defs, no_hook")."</a>";
  43          return $text;
  44      }
  45  
  46  	function adnav_main($cat_title, $cat_link, $cat_img, $cat_id=FALSE, $params, $cat_open=FALSE) {
  47          global $tp;
  48  
  49          $cat_link = (strpos($cat_link, '://') === FALSE) ? e_HTTP.$cat_link : $cat_link;
  50          $cat_link = $tp->replaceConstants($cat_link,TRUE);
  51  
  52          if ($cat_open == 4 || $cat_open == 5){
  53              $dimen = ($cat_open == 4) ? "600,400" : "800,600";
  54              $href = " href=\"javascript:open_window('".$cat_link."',".$dimen.")\"";
  55          } else {
  56              $href = "href='".$cat_link."'";
  57          }
  58  
  59          $text = "<a class='menuItem' ".$href." ";
  60          if ($cat_id) {
  61              if (isset($params[2]) && $params[2] == 'link') {
  62                  $text .= "onmouseover=\"menuItemMouseover(event, '".$cat_id."');\"";
  63              } else {
  64                  $text .= "onclick=\"return false;\" onmouseover=\"menuItemMouseover(event, '".$cat_id."');\"";
  65              }
  66          }
  67          if ($cat_open == 1){
  68              $text .= " rel='external' ";
  69          }
  70          $text .= ">";
  71          if ($cat_img != 'no_icons') {
  72              $text .= "<span class='menuItemBuffer'>".$cat_img."</span>";
  73          }
  74          $text .= "<span class='menuItemText'>".$tp->toHTML($cat_title,"","defs, no_hook")."</span>";
  75          if ($cat_id) {
  76              $text .= "<span class=\"menuItemArrow\">&#9654;</span>";
  77          }
  78          $text .= "</a>";
  79          return $text;
  80      }
  81  
  82      $js_file = ($params[1] == 'noclick') ? 'nav_menu_alt.js' : 'nav_menu.js';
  83      if (file_exists(THEME.$js_file)) {
  84          $text = "<script type='text/javascript' src='".THEME_ABS.$js_file."'></script>";
  85      } else {
  86          $text = "<script type='text/javascript' src='".e_FILE_ABS.$js_file."'></script>";
  87      }
  88      $text .= "<div class='menuBar' style='width:100%; white-space: nowrap'>";
  89  
  90      // Setup Parent/Child Arrays ---->
  91  
  92       $link_total = $sql->db_Select("links", "*", "link_class IN (".USERCLASS_LIST.") AND link_category=1 ORDER BY link_order ASC");
  93      while ($row = $sql->db_Fetch()) {
  94          if($row['link_parent'] == 0){
  95              $linklist['head_menu'][] = $row;
  96              $parents[] = $row['link_id'];
  97          }else{
  98              $pid = $row['link_parent'];
  99              $linklist['sub_'.$pid][] = $row;
 100          }
 101      }
 102  
 103  
 104      // Loops thru parents.--------->
 105      global $tp;
 106      foreach ($linklist['head_menu'] as $lk) {
 107          $lk['link_url'] = $tp -> replaceConstants($lk['link_url'],TRUE);
 108          if ($params[0] == 'no_icons') {
 109              $link_icon = 'no_icons';
 110          } else {
 111              $link_icon = $lk['link_button'] ? e_IMAGE.'icons/'.$lk['link_button'] : $icon;
 112          }
 113  
 114          $main_linkid = $lk['link_id'];
 115          if (isset($linklist['sub_'.$main_linkid])) {  // Has Children.
 116  
 117              $text .= adnav_cat($lk['link_name'], '', $link_icon, 'l_'.$main_linkid);
 118              $text .= render_sub($linklist, $main_linkid, $params, $icon);
 119  
 120          } else {
 121  
 122                // Display Parent only.
 123  
 124              $text .= adnav_cat($lk['link_name'], $lk['link_url'], $link_icon, FALSE, $lk['link_open']);
 125  
 126          }
 127      }
 128  
 129      $text .= "</div>";
 130  
 131      return $text;
 132  
 133  	function render_sub($linklist, $id, $params, $icon) {
 134          $text = "<div id='l_".$id."' class='menu' onmouseover=\"menuMouseover(event)\">";
 135              foreach ($linklist['sub_'.$id] as $sub) {
 136                  // Filter title for backwards compatibility ---->
 137  
 138                  if(substr($sub['link_name'],0,8) == "submenu."){
 139                      $tmp = explode(".",$sub['link_name']);
 140                      $subname = $tmp[2];
 141                  }else{
 142                      $subname = $sub['link_name'];
 143                  }
 144  
 145                  // Setup Child Icon --------->
 146  
 147                  if (!$sub['link_button'] && $params[0] == 'no_icons') {
 148                      $sub_icon = 'no_icons';
 149                  } else {
 150                      $sub_icon = "<img src='";
 151                      $sub_icon .= ($sub['link_button']) ? e_IMAGE.'icons/'.$sub['link_button'] : $icon;
 152                      $sub_icon .= "' alt='' style='border:0px; vertical-align:bottom; width: 16px; height: 16px' />";
 153                  }
 154                  if (isset($linklist['sub_'.$sub['link_id']])) {  // Has Children.
 155                      $sub_ids[] = $sub['link_id'];
 156                      $text .= adnav_main($subname, $sub['link_url'], $sub_icon, 'l_'.$sub['link_id'], $params, $sub['link_open']);
 157                  } else {
 158                      $text .= adnav_main($subname, $sub['link_url'], $sub_icon, null, $params, $sub['link_open']);
 159                  }
 160  
 161              }
 162              $text .= "</div>";
 163  
 164              if(isset($sub_ids) && is_array($sub_ids))
 165              {
 166                  foreach ($sub_ids as $sub_id) {
 167                      $text .= render_sub($linklist, $sub_id, $params, $icon);
 168                  }
 169              }
 170  
 171              return $text;
 172      }


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7