Phundament-Packages
[ class tree: Phundament-Packages ] [ index: Phundament-Packages ] [ all elements ]

Source for file LImageButton.php

Documentation is available at LImageButton.php

  1. <?php
  2.  
  3.  
  4. /**
  5.  * class file.
  6.  *
  7.  * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
  8.  * @copyright 2005, diemeisterei GmbH. All rights reserved.
  9.  * @author $Author: schmunk $
  10.  * @version $Revision: 640 $  $Date: 2007-02-25 15:42:41 +0100 (Sun, 25 Feb 2007) $
  11.  * @package Phundament.Packages
  12.  * @subpackage LContainer
  13.  */
  14.  
  15. /**
  16.  * Displays an Image Button that has an overlib help text
  17.  *
  18.  * @package System.Web.UI.WebControls
  19.  * @subpackage Admin
  20.  */
  21.  
  22. class LImageButton extends TImageButton
  23. {
  24.     /**
  25.      * Turn overlib help system on/off
  26.      */
  27.     private $overlib_enabled;
  28.  
  29.  
  30.     /**
  31.      * @return wheter overlib tooltips are enablead or not
  32.      */
  33.     public function getOverlibEnabled()
  34.     {
  35.         return $this->getViewState("OL_enable"true);
  36.     }
  37.  
  38.     /**
  39.      * @param string 
  40.      */
  41.     public function setOverlibEnabled($value)
  42.     {
  43.         $this->setViewState("OL_enable"$valuetrue);
  44.     }
  45.  
  46.     /**
  47.      * @return overlib tooltip
  48.      */
  49.     public function getOverlibToolTip()
  50.     {
  51.         return $this->getViewState("OL_tt");
  52.     }
  53.  
  54.     /**
  55.      * @param string 
  56.      */
  57.     public function setOverlibToolTip($value)
  58.     {
  59.         $this->setViewState("OL_tt"$value);
  60.     }
  61.  
  62.     /**
  63.      * prepares tooltip if enabled
  64.      */
  65.     public function onPreRender($param)
  66.     {
  67.         parent::onPreRender($param);
  68.  
  69.         if ($this->OverlibEnabled && $this->ToolTip && !$this->OverlibToolTip)
  70.         {
  71.             $this->parseToolTip();
  72.             if ($this->OverlibEnabled)
  73.             {
  74.                 $this->OverlibToolTip $this->ToolTip;
  75.                 $this->ToolTip "";
  76.             }
  77.         }
  78.  
  79.         if ($this->OverlibEnabled)
  80.         {
  81.             $script_url $this->publishAsset("overlib/overlib.js");
  82.             $bg_url $this->publishAsset("icons/bg_75black.png");
  83.             $scriptMgr $this->Page->ClientScript;
  84.             $scriptMgr->registerScriptFile("overlib"$script_url);
  85.             $ol "RELX, 10, RELY, -10, WIDTH, '500', HEIGHT, '30', TEXTFONT, 'Arial', TEXTSIZE, '1.3em', TEXTCOLOR, '#FFFFFF', BACKGROUND, '$bg_url'";
  86.             $this->Attributes->add("onmouseover""overlib('".$this->getOverlibToolTip()."', $ol);");
  87.             $this->Attributes->add("onmouseout""nd();");
  88.         }
  89.     }
  90.  
  91.  
  92.  
  93.     /**
  94.      * @ignore
  95.      */
  96.     private function parseToolTip()
  97.     {
  98.         // find brick & cell
  99.         $brick $this->Parent;
  100.         while($brick && !($brick instanceof LBrick)) $brick $brick->Parent;
  101.         $cell $this->Parent;
  102.         while($cell && !($cell instanceof LCell)) $cell $cell->Parent;
  103.  
  104.         $my_smarty array();
  105.         if (is_object($brick))
  106.         {
  107.             $my_smarty["{brick_id}"$brick->BrickObject->getId();
  108.             $my_smarty["{brick_name}"$brick->getDescriptiveName();
  109.         }
  110.         if (is_object($cell))
  111.         {
  112.             $my_smarty["{cell_position}"$cell->getId();
  113.         }
  114.         $this->setToolTip(strtr($this->getToolTip()$my_smarty));
  115.     }
  116.  
  117. }
  118. ?>

Documentation generated on Sun, 25 Feb 2007 16:10:41 +0100 by phpDocumentor 1.3.1