Ajout de la fonctionnalité d'upload de module.
This commit is contained in:
25
modules/notes/ajax/delete-notes.php
Normal file
25
modules/notes/ajax/delete-notes.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?// Escaping the input data:
|
||||
|
||||
$rid = $_POST['id'];
|
||||
$explodeid = explode("-",$rid);
|
||||
$id = intval($explodeid[1]);
|
||||
|
||||
|
||||
$xmla = simplexml_load_file('../db/notes.xml');
|
||||
|
||||
$target = false;
|
||||
$i = 0;
|
||||
|
||||
foreach ($xmla->note as $s) {
|
||||
if ($s['id']==$id) { $target = $i; break; }
|
||||
$i++;
|
||||
}
|
||||
if ($target !== false) {
|
||||
unset($xmla->note[$target]);
|
||||
}
|
||||
|
||||
$xmla->asXML('../db/notes.xml');
|
||||
|
||||
$target++;
|
||||
echo $target;
|
||||
?>
|
29
modules/notes/ajax/post-notes.php
Normal file
29
modules/notes/ajax/post-notes.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?// Escaping the input data:
|
||||
|
||||
$body = $_POST['body'];
|
||||
$color = $_POST['color'];
|
||||
$zindex = $_POST['zindex'];
|
||||
$nb = 1;
|
||||
|
||||
$xmla = simplexml_load_file('../db/notes.xml');
|
||||
$field_count = count($xmla->note);
|
||||
/*foreach($xmla->note as $test){
|
||||
if($nb < $test['id']){$nb=$test['id'];}
|
||||
}*/
|
||||
|
||||
$test = $xmla->note;
|
||||
for($i=0;$i<$field_count;$i++){
|
||||
if($nb <= $test[$i]['id']) $nb = $test[$i]['id']+1;
|
||||
}
|
||||
|
||||
$newnote = $xmla->addChild('note');
|
||||
$newnote->addAttribute("id", $nb);
|
||||
$newnote->addChild('text', $body);
|
||||
$newnote->addChild('color', $color);
|
||||
$newnote->addChild('zindex', $zindex);
|
||||
$newnote->addChild('top', '0');
|
||||
$newnote->addChild('left', '0');
|
||||
$xmla->asXML('../db/notes.xml');
|
||||
|
||||
echo $nb;
|
||||
?>
|
Reference in New Issue
Block a user