<?php
// Created by Ardora www.webardora.net
//COMENTARIOS-introdatos
session_start();
$slogin_noauthpage = 0;
$slogin_pagetitle = "";
include("cfg.php");include_once("para.php");include_once ("../".profUname.uName."/".uName."_lib.php");
include_once ("dameDatos.php");
session_cache_limiter('nocache,private');
error_reporting(E_ALL^E_NOTICE);
require "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>.: Chuvia de ideas :: A clasificación dos seres vivos :.</title>
<link rel="stylesheet" type="text/css" href="../css/ardoraComentarios.css" />
<!--CSS--><link type="text/css" href="../ardoraFiles/ui-themes/ardoraBasico03_lar/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>Borrar a palabra?  </p>
     </div>

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

<div id="avatar" title="Cambiar 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" >Arquivo imaxe</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></h1>
       <p><SPAN style="font-size:14px; color:#000000">Preme sobre o primeiro botón co signo + e engade a túa idea.</SPAN><br>
</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="Pechar"><span class="ui-icon ui-icon-closethick"></span> Pechar</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>
   <?php
          $tipo=dameValor($slogin_Username, "TIP");
          if (($tipo=="profe") || ($tipo=="admin")){
             echo '<a href="#" class="fg-button ui-state-default fg-button-icon-solo ui-corner-all" title="Alumnos e alumnas:" style="float:right" onclick="window.open(\'taboaAlumnado.php\',\'_blank\')" margin-right:"30px">';
             echo '<span class="ui-icon ui-icon-person"></span>Alumnos e alumnas:</a>';
          }
   ?>
</div></div>
</body></html>
