Accueil/modules/search/Search.php

62 lines
1.8 KiB
PHP
Raw Normal View History

2010-09-27 12:48:53 +02:00
<?php
class search 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 '<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/search.css">
<script type="text/javascript" src="'.$this->pathToModule.'js/jquery.search.js"></script>
<form id="searchForm" method="post">
<fieldset>
<input id="s" type="text" />
<input type="submit" value="Submit" id="submitButton" class="searchbutton" />
<ul class="icons">
<li class="web" title="Web Search" data-searchType="web">Web</li>
<li class="images" title="Image Search" data-searchType="images">Images</li>
<li class="news" title="News Search" data-searchType="news">News</li>
<li class="videos" title="Video Search" data-searchType="video">Videos</li>
</ul>
</fieldset>
</form>';
}
private function setParams($params){
$this->params = $params;
}
public static function start($params){
$search = new search($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='search']");
$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);
}
}
}
}