<?php
// Created by Ardora www.webardora.net
//COMENTARIOS-introdatos
session_cache_limiter('nocache,private');
session_start();$slogin_noauthpage = 0;$slogin_pagetitle = "";
include("cfg.php");include_once("para.php");include_once ("../".profUname.uName."/".uName."_lib.php");
error_reporting(E_ALL^E_NOTICE);
require "ardoraAjaxJson.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="gl">
<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/ardoraBasico03_ver/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../ardoraFiles/js/jquery.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="borrar" title="Borrar palabra  ">
         <span class="ui-icon ui-icon-check" style="float:left; margin:0 7px 20px 0;"></span><p>Borramos o argumento?  </p>
     </div>

     <div id="profe" title="Alumnos e alumnas:  ">
     </div>

<div id="avatar" title="Change avatar?">
   <div style="float:left; width:50px;">
   <img  id="avatarCambio" src="../ardoraWorkFiles/avatars/avatar.png" alt="avatar" width="40" height="40" />
   </div>
   <div style="float:right; width:300px; font-size:10px;">
      <form id="form1" name="form1" method="post" action="<?php echo 'addAvatar.php?user='.$slogin_Username ?>" enctype="multipart/form-data">
         <fieldset>
            <label for="imaxen" >Archivo imagen</label>
            <input name="imaxen" type="file" id="imaxen" class="ui-corner-all" accept="image/jpeg"/>
         </fieldset>
      </form>
   </div>
</div>

<div id="cabeceira">
   <div id="texto_form">
	<h1>Escribe o teu argumento.</h1>
       <p><SPAN style="font-size:14px;color:#000000">Pulsa sobre o "+" de "Si" ou "Non" e logo escribe o teu argumento, recorda que debe de ser claro, concreto e ben fundamentado. Para que se garde o teu argumento pulsa sobre o "+".</SPAN></p>
   </div>
   <div id="cabe_form" class="ui-widget-content ui-corner-all">
      <p class="ui-widget-header"> <?php echo $slogin_Username; ?> </p>
      <?php
         if (file_exists("../ardoraWorkFiles/avatars/".$slogin_Username.".jpg")){
            $arquivo="../ardoraWorkFiles/avatars/".$slogin_Username.".jpg";
         }
         else{
            $arquivo="../ardoraWorkFiles/avatars/avatar.png";
         }
         echo '<img id="imageUser" style="float:left; cursor:pointer;" src='.$arquivo.' alt="'.$slogin_Username.'" width="40" height="40" onclick="addAvatar(\''.$user.'\')" />';
       ?>
       <?php echo dameValor($slogin_Username, "NOM"); ?>
       <?php
          echo dameValor($slogin_Username, "CUR");
          echo dameValor($slogin_Username, "GRU");
       ?>
   </div>
</div>
<div class="clear"  style="padding-bottom:10px"></div>
<div class="fg-toolbar ui-widget-header ui-corner-all ui-helper-clearfix"> </div>
<div id="main">
   <div id="wave">
       <div id="commentArea">
          <?php foreach($comments as $c){showComment($c,$slogin_Username);}?>
       </div>
   <div>
</div>
<div style="float:right; margin-right:5px; margin-bottom:5px;">
   <button class="ui-button ui-widget ui-state-default ui-corner-all" onclick="addNew(<?php echo '\''.$slogin_Username.'\'' ?>)" style="margin-bottom:5px; margin-left:5px;"><span class="ui-icon ui-icon-plusthick"></span>
   </button>
</div>
</div>
<div class="clear"></div>
<div class="fg-toolbar ui-widget-header ui-corner-all ui-helper-clearfix">
<div class="fg-buttonset ui-helper-clearfix">
   <a href="../index.php" class="fg-button ui-state-default fg-button-icon-solo ui-corner-all" title="Cerrar"><span class="ui-icon ui-icon-closethick"></span> Cerrar</a>
   <a href="introDatos.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>
</div></div>
</body></html>
