Ajout de la reserve de liens et du passage reserve -> liste
This commit is contained in:
12
ajax/loadReserve.php
Normal file
12
ajax/loadReserve.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?
|
||||
include '../class/Links.php';
|
||||
if($links_xml = simplexml_load_file('../'.links::LINKS_FILE)){
|
||||
$links = $links_xml->reserve;
|
||||
foreach($links as $label){
|
||||
echo '<ul id="reserveiconlist">';
|
||||
foreach($label->link as $link){
|
||||
echo '<li class="item" id="'.$link->title.'"><a href="'.$link->url.'" class="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
|
||||
}
|
||||
echo '</ul> ';
|
||||
}
|
||||
}
|
19
ajax/reserveToList.php
Normal file
19
ajax/reserveToList.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?
|
||||
$reserve = $_POST['reserve'];
|
||||
|
||||
$doc = new DOMDocument;
|
||||
$doc->load('../db/links.xml');
|
||||
|
||||
$xpath = new DOMXpath($doc);
|
||||
|
||||
// Buffering and deleting moved element
|
||||
foreach($xpath->query('reserve/link[title = "'.$reserve.'"]') as $node) {
|
||||
$buffer = $node;
|
||||
$node->parentNode->removeChild($node);
|
||||
}
|
||||
|
||||
$searchLabel = $xpath->query('label');
|
||||
$lastLabel = $searchLabel->length -1;
|
||||
|
||||
$searchLabel->item($lastLabel)->appendChild($buffer);
|
||||
$doc->save('../db/links.xml');
|
Reference in New Issue
Block a user