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

Source for file LAutoEffectPanel.php

Documentation is available at LAutoEffectPanel.php

  1. <?php
  2. <?php
  3. /**
  4.  * class file.
  5.  *
  6.  * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
  7.  * @copyright 2005, diemeisterei GmbH. All rights reserved.
  8.  * @author $Author: schmunk $
  9.  * @version $Revision: 313 $  $Date: 2006-07-30 21:04:58 +0000 (So, 30 Jul 2006) $
  10.  * @package Phundament.Components
  11.  * @subpackage ActiveControls
  12.  */
  13.  
  14. /**
  15.  * Adds script.aclo.us effects to a TActivePanel
  16.  *
  17.  * @package System.Web.UI.ActiveControls
  18.  */
  19.  
  20. class LAutoEffectPanel extends TActivePanel
  21. {
  22.     public function setEffectDelay($value)
  23.     {
  24.         $this->setViewState('EffectDelay'$value'');
  25.     }
  26.     public function getEffectDelay()
  27.     {
  28.         return $this->getViewState('EffectDelay'250);
  29.     }
  30.  
  31.     public function setEffectDuration($value)
  32.     {
  33.         $this->setViewState('EffectDuration'$value'');
  34.     }
  35.     public function getEffectDuration()
  36.     {
  37.         return $this->getViewState('EffectDuration'500);
  38.     }
  39.  
  40.     public function setVisibleDelay($value)
  41.     {
  42.         $this->setViewState('VisibleDelay'$value'');
  43.     }
  44.     public function getVisibleDelay()
  45.     {
  46.         return $this->getViewState('VisibleDelay'150);
  47.     }
  48.  
  49.     function onPreRender($param)
  50.     {
  51.         parent::onPreRender($param);
  52.  
  53.         if ($this->Page->getClientSupportsJavaScript(== false || $this->Visible == falsereturn// this may work in the future
  54.  
  55.         $this->setId(uniqid("LAutoEffectPanel"))// set Id for DOM trre
  56.  
  57.         // use global counter (in the same order PRADO renders components)
  58.         $GLOBALS["LAutoEffectCounter"(isset($GLOBALS['LAutoEffectCounter'])?$GLOBALS['LAutoEffectCounter']:0);
  59.         $GLOBALS["LAutoEffectCounter"]++;
  60.  
  61.         // calculate delays
  62.         $effectDelay $GLOBALS["LAutoEffectCounter"]*$this->getEffectDelay();
  63.         $visibleDelay $effectDelay+$this->getVisibleDelay();
  64.  
  65.         // set the comoponent invisible, not display: none, so space is reserved
  66.         $this->Style->setStyleField("visibility","hidden");
  67.         $this->Style->setStyleField("width","auto");
  68.         $this->Style->setStyleField("position","relative");
  69.  
  70.         // add & attach script event
  71.         $script "
  72.             Event.OnLoad(function() //execute this function when page fully loads
  73.             {
  74.                 window.setTimeout('$(\'".$this->ClientId."\').style.visibility = \'visible\';', ".$visibleDelay.");
  75.                  window.setTimeout('new Effect.Appear(\'".$this->ClientId."\', {duration: ".($this->getEffectDuration()/1000).", from:0, to:1});', ".$effectDelay.");
  76.             })";
  77.  
  78.         $scripta "//alert('now');
  79. //document.getElementById('".$this->ClientId."').style.visibility = 'visible';
  80. //new Effect.Appear('".$this->ClientId."', {duration: ".($this->getEffectDuration()/1000).", from:0, to:1});
  81.  
  82. window.setTimeout('document.getElementById(\'".$this->ClientId."\').style.visibility = \'visible\';', ".$visibleDelay.");
  83. //window.setTimeout('new Effect.Appear(\'".$this->ClientId."\', {duration: ".($this->getEffectDuration()/1000).", from:0, to:1});', ".$effectDelay.");";
  84.         $scriptMgr $this->getPage()->getClientScript();
  85.         $scriptMgr->registerEndScript(uniqid("LAutoEffectPanel")$script);
  86.     }
  87. }
  88.  
  89. ?>

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