home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / modules / forums / classoverlib.php < prev    next >
Encoding:
PHP Script  |  2002-09-16  |  6.4 KB  |  455 lines

  1. <?
  2.  
  3.     /*
  4.  
  5.     This is version 1.11 of class.overlib for php (http://www.php.net) 
  6.  
  7.     written 1999, 2000, 2001 Patrick Hess <hess@dland.de>
  8.  
  9.     This software is distributed under GPL.
  10.  
  11.     overLib is from Eric Bosrup (http://www.bosrup.com/web/overlib/)
  12.  
  13.     This class is just a driver/container, so most of this wonderful
  14.  
  15.     work is done by Eric Bosrup! Keep this in mind...
  16.  
  17.     */
  18.  
  19.  
  20.  
  21.     class Overlib {
  22.  
  23.       var $ol_path          = "modules/Forums";
  24.  
  25.       var $ol_sticky        = false;
  26.  
  27.       var $ol_align            = 0;
  28.  
  29.       var $ol_valign        = 0;
  30.  
  31.       var $ol_fgcolor       = "#fcfcfc";
  32.  
  33.       var $ol_bgcolor       = "#0080C0";
  34.  
  35.       var $ol_capcolor      = "#ffffff";
  36.  
  37.       var $ol_textcolor     = "";
  38.  
  39.       var $ol_closecolor    = "";
  40.  
  41.       var $ol_textfont      = "";
  42.  
  43.       var $ol_captionfont   = "";
  44.  
  45.       var $ol_closefont     = "";
  46.  
  47.       var $ol_textsize      = 0;
  48.  
  49.       var $ol_captionsize   = 0;
  50.  
  51.       var $ol_closesize     = 0;
  52.  
  53.       var $ol_height        = 0;
  54.  
  55.       var $ol_width         = 0;
  56.  
  57.       var $ol_border        = 3;
  58.  
  59.       var $ol_offsetx       = 0;
  60.  
  61.       var $ol_offsety       = 0;
  62.  
  63.       var $ol_fgbackground  = "";
  64.  
  65.       var $ol_bgbackground  = "";
  66.  
  67.       var $ol_closetext     = "Close";
  68.  
  69.       var $ol_close         = true;
  70.  
  71.       var $ol_noclosetext   = false;
  72.  
  73.       var $ol_autostatus    = false;
  74.  
  75.       var $ol_autostatuscap = false;
  76.  
  77.       var $ol_capicon       = "images/forum/question.gif";
  78.  
  79.       var $ol_snapx         = 0;
  80.  
  81.       var $ol_snapy         = 0;
  82.  
  83.       var $ol_padxl         = 0;
  84.  
  85.       var $ol_padxr         = 0;
  86.  
  87.       var $ol_padyt         = 0;
  88.  
  89.       var $ol_padyb         = 0;
  90.  
  91.       var $ol_fixy          = 0;
  92.  
  93.       var $ol_background    = "";
  94.  
  95.       var $ol_fullhtml      = false;
  96.  
  97.       var $ol_timeout    = -1;
  98.  
  99.       var $ol_delay        = -1;
  100.  
  101.       var $ol_vauto         = false;
  102.  
  103.       var $ol_hauto         = false;
  104.  
  105.  
  106.  
  107.       function overLib($path = "") {
  108.  
  109.           if (strlen($path)) $this->ol_path = $path;
  110.  
  111. ?>
  112.  
  113. <nolink rel='stylesheet' href=<? echo "'$this->ol_path/overlib.css' "; ?> 
  114.  
  115.       type='text/css'>
  116.  
  117. <div id='overDiv' style='position:absolute; visibility:hide; z-index: 1000;'>
  118.  
  119. </div>
  120.  
  121. <script language='javascript' src=<? echo "'$this->ol_path/overlib.js'"; ?>>
  122.  
  123. </script>
  124.  
  125. <?
  126.  
  127.       }
  128.  
  129.  
  130.  
  131.       function set($var, $value) {
  132.  
  133.         $v = "ol_$var";
  134.  
  135.         $this->$v = $value;
  136.  
  137.       }
  138.  
  139.  
  140.  
  141.       function get($var) {
  142.  
  143.         $v = "ol_$var";
  144.  
  145.         return($this->$v);
  146.  
  147.       }
  148.  
  149.  
  150.  
  151.       function over($text, $title = "", $status = "")
  152.  
  153.       {
  154.  
  155.         $cmd = "'$text'";
  156.  
  157.  
  158.  
  159.         if(strlen($title)) 
  160.  
  161.         $cmd .= ", CAPTION, '$title'";
  162.  
  163.  
  164.  
  165.         if(strlen($status)) 
  166.  
  167.         $cmd .= ", STATUS, '$status'";
  168.  
  169.  
  170.  
  171.         if($this->ol_sticky)    
  172.  
  173.         $cmd .= ", STICKY";
  174.  
  175.  
  176.  
  177.         if($this->ol_align) {
  178.  
  179.         switch($this->ol_align) {
  180.  
  181.             case 1: $cmd .= ", LEFT";    break;
  182.  
  183.             case 2: $cmd .= ", CENTER";    break;
  184.  
  185.             case 3: $cmd .= ", RIGHT";    break;
  186.  
  187.             default:             break;
  188.  
  189.         }
  190.  
  191.         }
  192.  
  193.  
  194.  
  195.         if($this->ol_valign) {
  196.  
  197.         switch($this->ol_valign) {
  198.  
  199.             case 1: $cmd .= ", ABOVE";    break;
  200.  
  201.             case 2: $cmd .= ", BELOW";    break;
  202.  
  203.             default:             break;
  204.  
  205.         }
  206.  
  207.         }
  208.  
  209.  
  210.  
  211.         if (strlen($this->ol_fgbackground)) {
  212.  
  213.         $cmd .= ", FGCOLOR, '', FGBACKGROUND, '$this->ol_fgbackground'";
  214.  
  215.         } else {
  216.  
  217.             if (strlen($this->ol_fgcolor))
  218.  
  219.             $cmd .= ", FGCOLOR, '$this->ol_fgcolor'";
  220.  
  221.         }
  222.  
  223.  
  224.  
  225.         if (strlen($this->ol_bgbackground)) {
  226.  
  227.         $cmd .= ", BGCOLOR, '', BGBACKGROUND, '$this->ol_bgbackground'";
  228.  
  229.         } else {
  230.  
  231.             if (strlen($this->ol_bgcolor))
  232.  
  233.             $cmd .= ", BGCOLOR, '$this->ol_bgcolor'";
  234.  
  235.         }
  236.  
  237.  
  238.  
  239.         if (strlen($this->ol_capcolor))
  240.  
  241.         $cmd .= ", CAPCOLOR, '$this->ol_capcolor'";
  242.  
  243.  
  244.  
  245.         if (strlen($this->ol_textcolor))
  246.  
  247.         $cmd .= ", TEXTCOLOR, '$this->ol_textcolor'";
  248.  
  249.  
  250.  
  251.         if (strlen($this->ol_closecolor))
  252.  
  253.         $cmd .= ", CLOSECOLOR, '$this->ol_closecolor'";
  254.  
  255.  
  256.  
  257.         if (strlen($this->ol_textfont))
  258.  
  259.         $cmd .= ", TEXTFONT, '$this->ol_textfont'";
  260.  
  261.  
  262.  
  263.         if (strlen($this->ol_captionfont))
  264.  
  265.         $cmd .= ", CAPTIONFONT, '$this->ol_captionfont'";
  266.  
  267.  
  268.  
  269.         if (strlen($this->ol_closefont))
  270.  
  271.         $cmd .= ", CLOSEFONT, '$this->ol_closefont'";
  272.  
  273.  
  274.  
  275.         if ($this->ol_textsize)
  276.  
  277.         $cmd .= ", TEXTSIZE, $this->ol_textsize";
  278.  
  279.  
  280.  
  281.         if ($this->ol_captionsize)
  282.  
  283.         $cmd .= ", CAPTIONSIZE, $this->ol_captionsize";
  284.  
  285.  
  286.  
  287.         if ($this->ol_closesize)
  288.  
  289.         $cmd .= ", CLOSESIZE, $this->ol_closesize";
  290.  
  291.  
  292.  
  293.         if ($this->ol_width)
  294.  
  295.         $cmd .= ", WIDTH, $this->ol_width";
  296.  
  297.  
  298.  
  299.         if ($this->ol_height)
  300.  
  301.         $cmd .= ", HEIGHT, $this->ol_height";
  302.  
  303.  
  304.  
  305.         if ($this->ol_border >= 0)
  306.  
  307.         $cmd .= ", BORDER, $this->ol_border";
  308.  
  309.  
  310.  
  311.         if ($this->ol_offsetx)
  312.  
  313.         $cmd .= ", OFFSETX, $this->ol_offsetx";
  314.  
  315.  
  316.  
  317.         if ($this->ol_offsety)
  318.  
  319.         $cmd .= ", OFFSETY, $this->ol_offsety";
  320.  
  321.  
  322.  
  323.         if (strlen($this->ol_closetext))
  324.  
  325.         $cmd .= ", CLOSETEXT, '$this->ol_closetext'";
  326.  
  327.  
  328.  
  329.         if ($this->ol_noclose)
  330.  
  331.         $cmd .= ", NOCLOSETEXT";
  332.  
  333.  
  334.  
  335.         if ($this->ol_autostatus)
  336.  
  337.         $cmd .= ", AUTOSTATUS";
  338.  
  339.  
  340.  
  341.         if ($this->ol_autostatuscap)
  342.  
  343.         $cmd .= ", AUTOSTATUSCAP";
  344.  
  345.  
  346.  
  347.         if (strlen($this->ol_capicon))
  348.  
  349.         $cmd .= ", CAPICON, '$this->ol_capicon'";
  350.  
  351.  
  352.  
  353.         if ($this->ol_snapx)
  354.  
  355.         $cmd .= ", SNAPX, $this->ol_snapx";
  356.  
  357.  
  358.  
  359.         if ($this->ol_snapy)
  360.  
  361.         $cmd .= ", SNAPY, $this->ol_snapy";
  362.  
  363.  
  364.  
  365.         if ($this->ol_fixy)
  366.  
  367.         $cmd .= ", FIXY, $this->ol_fixy";
  368.  
  369.  
  370.  
  371.         if ($this->ol_padxl || $this->ol_padxr)
  372.  
  373.         $cmd .= ", PADX, $this->ol_padxl, $this->ol_padxr";
  374.  
  375.  
  376.  
  377.         if ($this->ol_padyt || $this->ol_padyb)
  378.  
  379.         $cmd .= ", PADY, $this->ol_padyt, $this->ol_padyb";
  380.  
  381.  
  382.  
  383.         if (strlen($this->ol_background))
  384.  
  385.         $cmd .= ", BACKGROUND, '$this->ol_background'";
  386.  
  387.  
  388.  
  389.         if ($this->ol_fullhtml)
  390.  
  391.         $cmd .= ", FULLHTML";
  392.  
  393.  
  394.  
  395.         if ($this->ol_timeout >= 0)
  396.  
  397.         $cmd .= ", TIMEOUT, $this->ol_timeout";
  398.  
  399.  
  400.  
  401.         if ($this->ol_delay >= 0)
  402.  
  403.         $cmd .= ", DELAY, $this->ol_delay";
  404.  
  405.  
  406.  
  407.         if ($this->ol_hauto) {
  408.  
  409.         $cmd .= ", HAUTO";
  410.  
  411.         $this->ol_hauto = false;
  412.  
  413.         }
  414.  
  415.  
  416.  
  417.         if ($this->ol_vauto) {
  418.  
  419.         $cmd .= ", VAUTO";
  420.  
  421.         $this->ol_hauto = false;
  422.  
  423.         }
  424.  
  425.  
  426.  
  427.         $output=" onMouseOver=\"return overlib($cmd);\" ";
  428.  
  429.         $output.=" onMouseOut=\"nd();\" ";
  430.  
  431.  
  432.  
  433.         return ($output);
  434.  
  435.       }
  436.  
  437.  
  438.  
  439.       function pover ($text, $title = "", $status = "") 
  440.  
  441.       {
  442.  
  443.         echo $this->over($text, $title, $status);
  444.  
  445.       }
  446.  
  447.     }
  448.  
  449. ?>
  450.  
  451.  
  452.  
  453.  
  454.  
  455.