37 lines
959 B
PHP
37 lines
959 B
PHP
|
<?php
|
||
|
class clockAdvanced {
|
||
|
public static $paramsList = array(
|
||
|
'visibility',
|
||
|
'x',
|
||
|
'y',
|
||
|
'fontFamily',
|
||
|
'fontSize',
|
||
|
'format',
|
||
|
'color'
|
||
|
);
|
||
|
|
||
|
public $params = array();
|
||
|
|
||
|
public function __construct($params){
|
||
|
$this->setParams($params);
|
||
|
echo '<script type="text/javascript" src="js/jquery.jclockAdvanced.js"></script>';
|
||
|
echo '<div class="jclockAdvanced" id="clockAdvanced" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
|
||
|
$options = '';
|
||
|
foreach (self::$paramsList as $paramName){
|
||
|
if(isset($this->params[$paramName]))
|
||
|
$options .= $paramName.' : '.$this->params[$paramName].',';
|
||
|
}
|
||
|
echo '<script>$(document).ready(function(){
|
||
|
$(\'.jclockAdvanced\').jclock({'.substr($options,0,-1).'});
|
||
|
});
|
||
|
</script>';
|
||
|
}
|
||
|
|
||
|
private function setParams($params){
|
||
|
$this->params = $params;
|
||
|
}
|
||
|
|
||
|
public static function start($params){
|
||
|
$clockAdvanced = new clockAdvanced($params);
|
||
|
}
|
||
|
}
|