<?php
// Created by Ardora www.webardora.net
//ArdoraFormularios-ardoraXML
//bajo licencia Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)
//para otros usos contacte con el autor
include_once ("para.php");
session_cache_limiter('nocache,private');
if ($_POST["action"] == "read") {
$xml = new DOMDocument("1.0", "utf-8");$xml->formatOutput = true;$xml->preserveWhiteSpace = false;$xml->load("../".folderWork."/".$_POST["indexKey"].".xml");$form=$xml->getElementsByTagName("form")->item(0);
$paragrafo5=$form->getElementsByTagName("paragrafo5")->item(0);
$paragrafo8=$form->getElementsByTagName("paragrafo8")->item(0);
$edit1=$form->getElementsByTagName("edit1")->item(0);
$edit2=$form->getElementsByTagName("edit2")->item(0);
$edit3=$form->getElementsByTagName("edit3")->item(0);
echo json_encode(array("paragrafo5"=>$paragrafo5->nodeValue,"paragrafo8"=>$paragrafo8->nodeValue,"edit1"=>$edit1->nodeValue,"edit2"=>$edit2->nodeValue,"edit3"=>$edit3->nodeValue));
}
if ($_POST["action"] == "indexList") {$orderName=scandir ("../".folderWork."/");for ($i = 0; $i < count($orderName); $i++) {if (strcmp ($orderName[$i],".")==0 || strcmp ($orderName[$i],"..")==0){$orderData[$i]="";} else {
$xml = new DOMDocument("1.0", "utf-8");$xml->formatOutput = true;$xml->preserveWhiteSpace = false;$xml->load("../".folderWork."/".$orderName[$i]);$form=$xml->getElementsByTagName("form")->item(0);
$orderData[$i]=$form->getElementsByTagName("edit1")->item(0)->nodeValue;
}}; array_multisort($orderData,SORT_ASC,$orderName);
for ($i = 0; $i < count($orderName); $i++) {if (strcmp ($orderName[$i],".")!=0 && strcmp ($orderName[$i],"..")!=0){$resultArray[$i]=array($orderName[$i],$orderData[$i]);}}echo json_encode($resultArray);}
?>
