51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
class notes extends Module {
|
|
|
|
protected $moduleName;
|
|
protected $moduleTitle;
|
|
protected $pathToModule;
|
|
|
|
protected static $paramsList = array(
|
|
'visibility'
|
|
);
|
|
|
|
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" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">
|
|
<a id="addButton" class="green-button" href="'.$this->pathToModule.'includes/add_note.html">Add a note</a>';
|
|
include $this->pathToModule.'includes/notes_extract.php';
|
|
}
|
|
|
|
private function setParams($params){
|
|
$this->params = $params;
|
|
}
|
|
|
|
public static function start($params){
|
|
$notes = new notes($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='notes']");
|
|
$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);
|
|
}
|
|
}
|
|
}
|
|
} |