| 
<?php
 //######################################################################
 //##### TITLE       :: CLASS LINKROW
 //##### FILE        :: class_linkrow.php
 //##### PROJECT        :: WebVision
 //##### RELATED DOCUMENT ::
 //##### DESCRIPTION   ::
 //#####     Generate a button row easily
 //##### AUTHOR      :: Mark Quah
 //##### REVISION     ::
 //######################################################################
 class LINKROW
 {
 var $no_item=0;
 
 function LINKROW()
 {   //----- INITIALIZE DATA
 $this->no_item = 0;
 } // end AUTH
 
 function AddColumn()
 {    $this->AddItem("COLUMNMARKER", "", "");
 }
 
 function AddItem($desc, $href, $style="")
 {   global $HTTP_SERVER_VARS;
 $this->item[$this->no_item]["DESC"] = $desc;
 $this->item[$this->no_item]["HREF"] = $href;
 $this->item[$this->no_item]["STYLE"]= ($style==""? "": "class=".$style);
 $this->no_item ++;
 }
 
 function GenDropTable()
 {   // Global variable
 global $HTTP_SERVER_VARS;
 // IE/Netscape difference javascript
 echo "<script>\n";
 echo "if (document.all)\n";
 echo "   divTag=document.all;\n";
 echo "else  divTag=document.getElementsByTagName('DIV');\n";
 echo "</script>\n";
 // Set up table layout
 $out = "<TABLE CELLSPACING=0 CELLPADDING=0>\n<TR>\n\t";
 $new_col=TRUE;
 $close_col = FALSE;
 $row=0;
 $div_id="UNIQUED";
 // display huttons
 for ($i = 0 ; $i < $this->no_item; $i ++)
 {   // Check does it need to generate a new column
 if ( $this->item[$i]['DESC'] == "COLUMNMARKER")
 {   $new_col=TRUE;
 // Do we need to close previous column?
 if ($row > 0)
 {  $out .= "</DIV></TD>\n";
 }
 $row ++;
 }
 else
 {
 $cell_style = $this->item[$i]['STYLE'];
 if ( $new_col == TRUE )
 {   // start print out new col
 $out .= "<TD ALIGN=LEFT>\n";
 $extension="onmouseover=\"divTag.$div_id$row.style.display='block'\" ".
 "onmouseout=\"divTag.$div_id$row.style.display='none' \" ";
 $out .= "<DIV $cell_style \n\t$extension>\n";
 $out .= $this->DisplayItem($i)."<BR>\n";
 $out .= "</DIV>\n";
 $out .= "<DIV ID=$div_id$row style='display: none; position: absolute;' $extension>\n";
 $new_col=FALSE;
 }
 // other item
 else
 {   // Display the field
 $out .= "<DIV $cell_style>".$this->DisplayItem($i)."</DIV>";
 }
 }
 } // end foreach
 if ($row > 0)
 $out .= "</DIV></TD>";
 $out .= "</TABLE>";
 return $out;
 } // GenDropTable
 
 function DisplayItem($item_no)
 {   // Display HREF as a link
 $href=$this->item[$item_no]['HREF'];
 $desc=$this->item[$item_no]['DESC'];
 $out = ($href ? "<A HREF='$href'>$desc</A>" : $desc );
 return $out;
 }
 } // END CLASS LINKMENU
 
 ?>
 
 
 |