diff --git a/ajax/update-links-order.php b/ajax/update-links-order.php new file mode 100644 index 0000000..d7c3e4e --- /dev/null +++ b/ajax/update-links-order.php @@ -0,0 +1,36 @@ +$value){ + if($value == $itemMoved) + $itemIndex = (int)$index; +} + +$itemAfter = ''; +if(isset($orderArray[$itemIndex+1])) + $itemAfter = $orderArray[$itemIndex+1]; + +$doc = new DOMDocument; +$doc->load('../db/links.xml'); + +$xpath = new DOMXpath($doc); + +// Buffering and deleting moved element +foreach($xpath->query('label/link[title = "'.$itemMoved.'"]') as $node) { + $buffer = $node; + $node->parentNode->removeChild($node); +} + +if($itemAfter != ''){ + $searchLabel = $xpath->query('label[@id="'.$label.'"]/link[title = "'.$itemAfter.'"]')->item(0); + $searchLabel->parentNode->insertBefore($buffer, $searchLabel); +}else{ + $searchLabel = $xpath->query('label[@id="'.$label.'"]'); + $searchLabel->item(0)->appendChild($buffer); +} +$doc->save('../db/links.xml'); \ No newline at end of file diff --git a/class/Links.php b/class/Links.php index b2eb07a..c6c54f3 100644 --- a/class/Links.php +++ b/class/Links.php @@ -5,54 +5,27 @@ class links { 'visibility' ); + const LINKS_FILE = 'db/links.xml'; + public $params = array(); public function __construct($params){ $this->setParams($params); - echo '
- Google Apps - -
- - Media - -
- - Desk Accessories - -
- - Entertainment - -
- -
'; + echo ' +
'; + if($links_xml = simplexml_load_file(self::LINKS_FILE)){ + $links = $links_xml->label; + foreach($links as $label){ + echo ''.$label['id'].' + +
'; + } + } + echo '
'; } private function setParams($params){ @@ -63,7 +36,23 @@ class links { $links = new links($params); } - public static function updateConfig($updated){ + public function setLink($link){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.self::LINKS_FILE); + + $path = $xmla->xpath("//item[@id='weather']"); + $path[0]->x = $x; + + $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); + } + } } } \ No newline at end of file diff --git a/class/Search.php b/class/Search.php index 5090ca5..5b7bcf3 100644 --- a/class/Search.php +++ b/class/Search.php @@ -12,7 +12,7 @@ class search extends Module {
- +