45 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
class notes extends Module {
 | 
						|
 | 
						|
	protected static $paramsList = array(
 | 
						|
		'visibility'
 | 
						|
	);
 | 
						|
	
 | 
						|
	public $params = array();
 | 
						|
	
 | 
						|
	public function __construct($params){
 | 
						|
		$this->setParams($params);
 | 
						|
		echo '<script type="text/javascript" src="js/jquery.notes.js"></script>
 | 
						|
				<link rel="stylesheet" type="text/css" href="css/note.css">
 | 
						|
				<a id="addButton" class="green-button" href="add_note.html">Add a note</a>';
 | 
						|
		include '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);
 | 
						|
			}
 | 
						|
		}
 | 
						|
	}
 | 
						|
} |