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.
48 lines
1.3 KiB
48 lines
1.3 KiB
<?php |
|
class clock extends Module { |
|
|
|
protected static $paramsList = array( |
|
'visibility', |
|
'x', |
|
'y' |
|
); |
|
|
|
public $params = array(); |
|
|
|
public function __construct($params){ |
|
$this->moduleName = get_class(); |
|
$this->pathToModule = 'modules/'.$this->moduleName.'/'; |
|
$this->setParams($params); |
|
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="jclock" id="clock" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>'; |
|
} |
|
|
|
private function setParams($params){ |
|
$this->params = $params; |
|
} |
|
|
|
public static function start($params){ |
|
$clock = new clock($params); |
|
} |
|
|
|
public function setVisibility($visibility){ |
|
// Saving the position and z-index of the note: |
|
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); |
|
|
|
$path = $xmla->xpath("//item[@id='clock']"); |
|
$path[0]->visibility = $visibility; |
|
|
|
$xmla->asXML('../'.AccueilModules::CONFIG_FILE); |
|
|
|
echo "ok"; |
|
} |
|
|
|
public static function updateConfig($updated){ |
|
foreach ($updated as $what=>$withWhat){ |
|
if(in_array($what, self::$paramsList)){ |
|
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat); |
|
} |
|
} |
|
} |
|
} |