You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ClockAdvanced.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. class clockAdvanced extends Module
  3. {
  4. protected $moduleTitle = 'Horloge Avancée';
  5. protected $paramsList = array(
  6. 'visibility',
  7. 'x',
  8. 'y',
  9. 'fontFamily',
  10. 'fontSize',
  11. 'format',
  12. 'color'
  13. );
  14. public function __construct($params){
  15. parent::__construct(__CLASS__, $params);
  16. }
  17. public function build(){
  18. echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
  19. <link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
  20. echo '<div class="jclockAdvanced" id="clockAdvanced" style="left:'.$this->getParam('x').'; top:'.$this->getParam('y').';"></div>';
  21. $options = '';
  22. foreach ($this->paramsList as $paramName){
  23. if($this->getParam($paramName) != null)
  24. $options .= $paramName.' : "'.$this->getParam($paramName).'",';
  25. }
  26. echo '<script>$(document).ready(function(){
  27. $(\'#fontFamily\').val("'.$this->getParam('fontFamily').'");
  28. $(\'#fontSize\').val("'.$this->getParam('fontSize').'");
  29. $(\'#format\').val("'.$this->getParam('format').'");
  30. $(\'#color\').val("'.$this->getParam('color').'");
  31. $(\'.jclockAdvanced\').jclock({'.substr($options,0,-1).'});
  32. });
  33. </script>';
  34. }
  35. }