Accueil/modules/clockAdvanced/ClockAdvanced.php

37 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2010-09-20 10:44:44 +02:00
<?php
class clockAdvanced extends Module
{
protected $moduleTitle = 'Horloge Avancée';
protected $paramsList = array(
2010-09-20 10:44:44 +02:00
'visibility',
'x',
'y',
'fontFamily',
'fontSize',
'format',
'color'
);
public function __construct($params){
parent::__construct(__CLASS__, $params);
}
public function build(){
2010-09-27 12:48:53 +02:00
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
echo '<div class="jclockAdvanced" id="clockAdvanced" style="left:'.$this->getParam('x').'; top:'.$this->getParam('y').';"></div>';
2010-09-20 10:44:44 +02:00
$options = '';
foreach ($this->paramsList as $paramName){
if($this->getParam($paramName) != null)
$options .= $paramName.' : "'.$this->getParam($paramName).'",';
2010-09-20 10:44:44 +02:00
}
echo '<script>$(document).ready(function(){
$(\'#fontFamily\').val("'.$this->getParam('fontFamily').'");
$(\'#fontSize\').val("'.$this->getParam('fontSize').'");
$(\'#format\').val("'.$this->getParam('format').'");
$(\'#color\').val("'.$this->getParam('color').'");
2010-09-20 10:44:44 +02:00
$(\'.jclockAdvanced\').jclock({'.substr($options,0,-1).'});
});
</script>';
}
}