[ Indice ]

Riferimento incrociato di Joomla! 1.5.14 - VM 1.1.4

Servizio fornito da VMItalia
Classe:   Funzione:   Variabile:   Costante:  
Storico Ricerche +

titolo

Corpo

[chiudi]

/modules/mod_virtuemart/vm_transmenu/ -> transmenu.php (sorgente)

   1  <?php
   2  if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
   3  
   4  class TransMenu {
   5      var $parent = null;
   6  	function TransMenu(&$parent){
   7          $this->parent = $parent;
   8      }
   9  	function beginMenu(){
  10          if ($this->parent->_params->get('menu_style', 'vertical') == 'vertical')
  11              $cssfile = "transmenuv.css";
  12          else
  13              $cssfile = "transmenuh.css";
  14          echo '
  15              <link rel="stylesheet" type="text/css" href="',$this->parent->_params->get('LSPath'),'/',$cssfile,'" />
  16              <script type="text/javascript" src="',$this->parent->_params->get('LSPath'),'/transmenu.js"></script>
  17          ';
  18              $direction = "TransMenu.direction.".$this->parent->_params->get('menu_direction', "right");
  19              $position = "TransMenu.reference.".$this->parent->_params->get('menu_position', "topRight");
  20              $top = $this->parent->_params->get('p_t', 0);
  21              $left = $this->parent->_params->get('p_l', 0);
  22              $subpad_x = $this->parent->_params->get('subpad_x', 1);
  23              $subpad_y = $this->parent->_params->get('subpad_y', 0);
  24          switch ($this->parent->_params->get('menu_style', "vertical")){
  25              case 'vertical':
  26                  echo '<div id="wrap"><div id="menu">';
  27                  echo '<table cellpadding="0" cellspacing="0" border="0">';
  28                  foreach ($this->parent->children[0] as $v) {
  29                      echo "<tr><td>";
  30                      echo $this->getFirstLevelItem($v);
  31                      echo "</td></tr>";
  32                  }
  33                  echo "</table></div></div>";
  34              break;
  35              
  36              case 'horizontal':
  37              default:
  38                  echo '<div id="wrap"><div id="menu">';
  39                  echo '<table cellpadding="0" cellspacing="0" border="0"><tr>';
  40                  foreach ($this->parent->children[0] as $v) {
  41                      echo "<td>";
  42                      echo $this->getFirstLevelItem($v);
  43                      echo "</td>";
  44                  }
  45                  echo "</tr></table></div></div>";
  46  
  47              break;
  48          }
  49          echo '
  50              <script type="text/javascript">
  51              if (TransMenu.isSupported()) {
  52                  TransMenu.updateImgPath(\'',$this->parent->_params->get('LSPath'),'/\');
  53                  var ms = new TransMenuSet(',$direction,', ', $left,', ',$top,', ',$position,');
  54                  TransMenu.subpad_x = ',$subpad_x,';
  55                  TransMenu.subpad_y = ',$subpad_y,';
  56  
  57              ';
  58      }
  59  	function endMenu(){
  60          echo '
  61                  TransMenu.renderAll();
  62              }
  63              init1=function(){TransMenu.initialize();}
  64              if (window.attachEvent) {
  65                  window.attachEvent("onload", init1);
  66              }else{
  67                  TransMenu.initialize();            
  68              }
  69              </script>
  70          ';
  71      }
  72  	function genMenuItem(&$row, $level, $pos){
  73  
  74          global $Itemid, $mosConfig_live_site, $mainframe, $sess;
  75          $txt = '';
  76          $Itemid = vmRequest::getInt( 'Itemid' );
  77          switch ($row->type) {
  78              case 'separator':
  79              case 'component_item_link':
  80              break;
  81              case 'content_item_link':
  82              $temp = split("&task=view&id=", $row->link);
  83              $row->link .= '&Itemid='. $mainframe->getItemid($temp[1]);
  84              break;
  85              case 'url':
  86              if ( eregi( 'index.php\?', $row->link ) ) {
  87                  if ( !eregi( 'Itemid=', $row->link ) ) {
  88                      $row->link .= '&Itemid='. $Itemid;
  89                  }
  90              }
  91              break;
  92              case 'content_typed':
  93              default:
  94                  $row->link .= '&Itemid='. $sess->getShopItemid();
  95              break;
  96          }
  97  
  98          $row->link = vmAmpReplace( $row->link );
  99  
 100          if ( strcasecmp( substr( $row->link,0,4 ), 'http' ) ) {
 101              $row->link = sefRelToAbs( $row->link );
 102          }
 103  
 104          
 105          //echo "$row->name $row->link $level<br>";

 106          if ($level){
 107              $pmenu = "tmenu$row->parent";
 108              //echo "$pmenu.addItem(\"$row->name\", \"$row->link\");\n";

 109              $active = 0;
 110              if ( in_array($row->id, $this->parent->open) ) $active = 1;
 111              $row->link = $sess->url( SECUREURL . $row->link);
 112              echo "$pmenu.addItem(\"$row->name\", \"$row->link\", $row->browserNav, $active);\n";
 113          }
 114          else{
 115              $pmenu = "ms";
 116          }
 117          $cmenu = "tmenu$row->id";
 118          $idmenu = "menu$row->id";
 119          if ($this->parent->hasSubItems($row->id)){
 120              if ($level == 0){
 121                  echo "var $cmenu = ".$pmenu.".addMenu(document.getElementById(\"$idmenu\"));\n";
 122              }else{
 123                  echo "var $cmenu = ".$pmenu.".addMenu(".$pmenu.".items[".$pos."]);\n";
 124              }
 125          }
 126      }
 127  
 128  	function getFirstLevelItem( $mitem ) {
 129          global $Itemid, $mosConfig_live_site, $mainframe, $sess;
 130          $txt = '';
 131  
 132          switch ($mitem->type) {
 133              case 'separator':
 134              case 'component_item_link':
 135              break;
 136              case 'content_item_link':
 137              $temp = split("&task=view&id=", $mitem->link);
 138              $mitem->link .= '&Itemid='. $mainframe->getItemid($temp[1]);
 139              break;
 140              case 'url':
 141              if ( eregi( 'index.php\?', $mitem->link ) ) {
 142                  if ( !eregi( 'Itemid=', $mitem->link ) ) {
 143                      $mitem->link .= '&Itemid='. $mitem->id;
 144                  }
 145              }
 146              break;
 147              case 'content_typed':
 148              default:
 149              $mitem->link .= '&Itemid='. $sess->getShopItemid();
 150              break;
 151          }
 152  
 153          $id = 'id="menu'.$mitem->id.'"';
 154  
 155          $mitem->link = vmAmpReplace( $mitem->link );
 156  
 157          if ( strcasecmp( substr( $mitem->link,0,4 ), 'http' ) ) {
 158              $mitem->link = sefRelToAbs( $mitem->link );
 159          }
 160  
 161          $menuclass = 'mainlevel'. $this->parent->_params->get( 'class_sfx' );
 162          
 163          // Active Menu highlighting

 164          $current_itemid = trim( vmRequest::getInt( 'Itemid' ) );
 165          if ( in_array($mitem->id, $this->parent->open) ) {
 166              $menuclass = 'mainlevel_active'. $this->parent->_params->get( 'class_sfx' );
 167          }
 168  
 169          switch ($mitem->browserNav) {
 170              // cases are slightly different

 171              case 1:
 172              // open in a new window

 173              $txt = '<a href="'. $mitem->link .'" target="_blank" class="'. $menuclass .'" '. $id .'>'. $mitem->name .'</a>';
 174              break;
 175  
 176              case 2:
 177              // open in a popup window

 178              $txt = "<a href=\"#\" onclick=\"javascript: window.open('". $mitem->link ."', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"$menuclass\" ". $id .">". $mitem->name ."</a>\n";
 179              break;
 180  
 181              case 3:
 182              // don't link it

 183              $txt = '<span class="'. $menuclass .'" '. $id .'>'. $mitem->name .'</span>';
 184              break;
 185  
 186              default:    // formerly case 2
 187              // open in parent window

 188              $txt = '<a href="'. $mitem->link .'" class="'. $menuclass .'" '. $id .'>'. $mitem->name;
 189              if($this->parent->hasSubItems( $mitem->id ))          
 190                $txt .= '&nbsp;&nbsp;<img border="0" src="'.$this->parent->_params->get('LSPath').'/img/tabarrow.gif" alt="arrow" />';
 191              $txt .= '</a>';
 192              break;
 193          }
 194  
 195          if ( $this->parent->_params->get( 'menu_images' ) ) {
 196              $menu_params = new stdClass();
 197              $menu_params =& new mosParameters( $mitem->params );
 198              $menu_image = $menu_params->def( 'menu_image', -1 );
 199              if ( ( $menu_image <> '-1' ) && $menu_image ) {
 200                  $image = '<img src="'. $mosConfig_live_site .'/images/stories/'. $menu_image .'" border="0" alt="'. $mitem->name .'"/>';
 201                  if ( $this->parent->_params->get( 'menu_images_align' ) ) {
 202                      $txt = $txt .' '. $image;
 203                  } else {
 204                      $txt = $image .' '. $txt;
 205                  }
 206              }
 207          }
 208  
 209          return $txt;
 210      }
 211  }
 212  ?>


Generato il: Mon Oct 19 20:29:27 2009 Generato con PHPXref 0.7