VCL
[ class tree: VCL ] [ index: VCL ] [ all elements ]

Source for file clock.inc.php

Documentation is available at clock.inc.php

  1. <?php
  2. /**
  3. *  This file is part of the VCL for PHP project
  4. *
  5. *  Copyright (c) 2004-2007 qadram software <support@qadram.com>
  6. *
  7. *  Checkout AUTHORS file for more information on the developers
  8. *
  9. *  This library is free software; you can redistribute it and/or
  10. *  modify it under the terms of the GNU Lesser General Public
  11. *  License as published by the Free Software Foundation; either
  12. *  version 2.1 of the License, or (at your option) any later version.
  13. *
  14. *  This library is distributed in the hope that it will be useful,
  15. *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. *  Lesser General Public License for more details.
  18. *
  19. *  You should have received a copy of the GNU Lesser General Public
  20. *  License along with this library; if not, write to the Free Software
  21. *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  22. *  USA
  23. *
  24. */
  25.  
  26. use_unit("classes.inc.php");
  27. use_unit("controls.inc.php");
  28. use_unit("extctrls.inc.php");
  29.  
  30. /**
  31.  * A Javascript clock
  32.  *
  33.  */
  34. class Clock extends Panel
  35. {
  36.         function __construct($aowner=null)
  37.         {
  38.                 //Calls inherited constructor
  39.                 parent::__construct($aowner);
  40.  
  41.                 $this->ControlStyle="csDesignEncoding=ISO-8859-1";
  42.                 $this->ControlStyle="csAcceptsControls=0";
  43.                 $this->ControlStyle="csSlowRedraw=1";                
  44.  
  45.                 $this->Width=90;
  46.                 $this->Height=90;
  47.         }
  48.  
  49.         function dumpHeaderCode()
  50.         {
  51.                 if (!defined('DYNAPI'))
  52.                 {
  53.                         echo "<script type=\"text/javascript\" src=\"".VCL_HTTP_PATH."/dynapi/src/dynapi.js\"></script>\n";
  54.                 }
  55.  
  56.                 if (!defined('DYNAPI_'.strtoupper($this->className())))
  57.                 {
  58.                         echo "<script type=\"text/javascript\">\n";
  59.                         if (!defined('DYNAPI'))
  60.                         {
  61.                                 echo "dynapi.library.setPath('".VCL_HTTP_PATH."/dynapi/src/');\n";
  62.                                 echo "dynapi.library.include('dynapi.api');\n";
  63.                                 define('DYNAPI',1);
  64.                         }
  65.                         echo "dynapi.library.include('TemplateManager');\n";
  66.                         echo "dynapi.library.include('HTMLClock');\n";
  67.                         echo "</script>\n";
  68.                         define('DYNAPI_'.strtoupper($this->className()),1);
  69.                 }
  70.         }
  71.  
  72.             private $_alarm="";
  73.  
  74.             function getAlarm(return $this->_alarm}
  75.             function setAlarm($value$this->_alarm=$value}
  76.             function defaultAlarm(return ""}
  77.  
  78.  
  79.             private $_jsonalarm ="";
  80.  
  81.             function getjsOnAlarm(return $this->_jsonalarm}
  82.             function setjsOnAlarm($value$this->_jsonalarm=$value}
  83.             function defaultjsOnAlarm(return ""}
  84.  
  85.         function dumpJsEvents()
  86.         {
  87.                 parent::dumpJsEvents();
  88.  
  89.                 $this->dumpJSEvent($this->_jsonalarm);
  90.         }
  91.  
  92.         function dumpContents()
  93.         {
  94.                 $l=0;
  95.                 $t=0;
  96.  
  97.                 if (($this->ControlState csDesigning)!=csDesigning)
  98.                 {
  99.                         $l=$this->Left;
  100.                         $t=$this->Top;
  101.                 }
  102.  
  103.                 ob_start();
  104.                 parent::dumpContents();
  105.                 $template=ob_get_contents();
  106.                 ob_end_clean();
  107.  
  108.                 $template=str_replace("</td>\n</tr>\n</table>\n","{@fld}</td>\n</tr>\n</table>\n",$template);
  109.                 $template=str_replace("'","\'",$template);
  110.                 $template=str_replace("\n","",$template);
  111.  
  112.                 echo "<script type=\"text/javascript\">\n";
  113. //                echo "var ".$this->Name."tp = new Template('<table border=\"0\"><tr><td width=\"$this->Width\" height=\"$this->Height\" align=\"center\">{@fld}</td></tr></table></center>',$l,$t,$this->Width,$this->Height,'');\n";
  114.                 echo "var ".$this->Name." = new Template('$template',$l,$t,$this->Width,$this->Height,'');\n";
  115.                 echo $this->Name.".addChild(new HTMLClock(),'fld');\n";
  116.                 if (($this->ControlState csDesigning)!=csDesigning)
  117.                 {
  118.                         if (trim($this->Alarm)!="")
  119.                         {
  120.                                 echo "$this->Name".".fld.setAlarm($this->Alarm);\n";
  121.                         }
  122.  
  123.                         if ($this->_jsonalarm!="")
  124.                         {
  125.                                 echo "$this->Name".".fld.addEventListener({ onalarm : $this->_jsonalarm });";
  126.                         }
  127.                 }
  128.  
  129. //                echo $this->Name."tp.fld.HTMLContainer.setSize(".$this->width.",".$this->Height.");\n";
  130.                 echo "dynapi.document.addChild(".$this->Name.");\n";
  131.                 echo "</script>\n";
  132.                 echo "<script type=\"text/javascript\">\n";
  133.                 echo "dynapi.document.insertChild(".$this->Name.");\n";
  134.                 echo "</script>\n";
  135.         }
  136.  
  137. }
  138.  
  139.  
  140. ?>

Documentation generated on Tue, 27 Mar 2007 13:33:31 +0200 by phpDocumentor 1.3.1