<?php
//Created by ARDORA www.webardora.net
//COMENTARIOS-index.php
include("php/cfg.php");
   error_reporting(E_ALL^E_NOTICE);
   session_cache_limiter("nocache,private");
   require "php/functions.php";
$file = simplexml_load_file(xmlFile);
   $comments=array();
   $js_history='';
   foreach ($file->entrada as $entrada) {
      $valor = array(
      "id" => $entrada -> id,
      "parent" => $entrada -> father,
      "usr" => $entrada -> usr,
      "comment" => $entrada ->comment,
      "dt" => $entrada -> dt,
   );
   if($valor["parent"]==0){
      $comments[$valor["id"]-1] = $valor;
   } else
   {
      if(!$comments[$valor["parent"]-1]) continue;
         $comments[$valor["parent"]-1]["replies"][] = $valor;
      }
         $js_history.='addHistory({id:"'.$valor["id"].'"});'.PHP_EOL;
   }
   $js_history='<script type="text/javascript">'.$js_history.'</script>';
?>

<!DOCTYPE html>
<html lang="es">
<head><meta charset="utf-8"/><title></title>
<link rel="stylesheet" type="text/css" href="css/ardoraComentarios.css" />
<!--CSS--><link type="text/css" href="ardoraFiles/ui-themes/webardora4/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="ardoraFiles/js/jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="ardoraFiles/js/jquery-ui.min.js"></script>
<script src="ardoraFiles/js/jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript" src="js/ardoraComentarios.js"></script>
<?php echo $js_history; ?>
</head><body>
<div id="cabeceira">
	<h1>La descripción</h1>
       <p><SPAN style="font-size:14px; color:#000000">Vamos a crear aquí unha relación de palabras que nos sirvan luego para describir organizadamente a una persona. Cada uno aportaremos palabras o expresiones que pudiésemos emplear en cada parte de la descripción.</SPAN><br>
</p>
</div>

<div id="divFull">
<div id="main">
<div class="fg-toolbar ui-widget-header ui-corner-all ui-helper-clearfix">
   <div class="fg-buttonset ui-helper-clearfix">
   <a href="php/introDatos.php" class="fg-button ui-state-default fg-button-icon-solo ui-corner-all" title="Editar"><span class="ui-icon ui-icon-pencil"></span>Editar</a>
   <a href="index.php" class="fg-button ui-state-default fg-button-icon-solo ui-corner-all" title="Recargar"><span class="ui-icon ui-icon-refresh"></span>Recargar</a>
<a id="ButFull" class="fg-button ui-state-default fg-button-icon-solo  ui-corner-all" title="Pantalla completa"><span class="ui-icon ui-icon-extlink"></span>Pantalla completa</a>
    </div>
</div>
     <div id="wave">
         <div id="commentArea">
            <?php foreach($comments as $c){ showComment($c,"");}?>
         </div>
     </div>
</div>
</div>
</body></html>
