<?php 
session_start();
$pTipoUtilizador = $_SESSION['tipoUtilizador'];
if ($pTipoUtilizador=="anonymous" || $pTipoUtilizador=="regular") { // separa por tipo de utilizador
  require('headersubUsers.inc');
  require('menusubUsers.inc');
}
else {
  require('headersubAdmins.inc');
  require('menusubAdmins.inc');
}
?>



<hr/>



<?php
require('loginsub.php');
?>


<center>
<h3 class="maketitle">Geometric theorems Report</h3>
</center>

<hr/>

<?php
$argumento = $_GET['argumento'];

// cria uma pesquisa
$sql = "SELECT teoId,teoName,category,description,dateSubmission,bibref,userId
          FROM theorems
         WHERE teoId='$argumento'";

$resultado = mysql_query($sql,$ligacao);

$ncampos =mysql_num_fields($resultado);


$linha = mysql_fetch_assoc($resultado);

$pTeoId          = $linha['teoId'];
$pTeoName        = $linha['teoName'];
$pBibRef         = $linha['bibref'];
$pCategory       = $linha['category'];
$pDateSubmission = $linha['dateSubmission'];
$pDescription    = $linha['description'];
$pUserId         = $linha['userId'];


// Vai buscar a restante informação referente ao utilizador
$sqlUser = "SELECT userId,name,email
              FROM users
             WHERE userId='$pUserId'";

$resultadoUser = mysql_query($sqlUser,$ligacao);

$linhaUser = mysql_fetch_assoc($resultadoUser);

$pUserName         = $linhaUser['name'];
$pUserEmail         = $linhaUser['email'];


echo "<!-- ficha -->";
echo "<table width='100%' bgcolor='white' cellpadding='4' cellspacing='4'>";
echo "<tr>";
echo "<td width='100%' colspan='8' align='center'><span class='titulo'>Geometric Theorem Info</span></td>";
echo "</tr>";
echo "<tr>";
echo "<td align='left' width='25%' colspan='2'><span class='ficha'>Name of the Theorem</span></td>";
echo "<td width='50%' colspan='4'>$pTeoName</td>";
echo "<td align='left' width='12.5%' colspan='1'><span class='ficha'>Theorem's Id</span></td>";
echo "<td width='12.5%' colspan='1'>$pTeoId</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='25%' colspan='2'><span class='ficha'>Contributor's Name</span></td>";
echo "<td width='75%' colspan='6'>$pUserName</td>";
//echo "<td width='12.5%' colspan='1'><span class='ficha'>Email</span></td>";
//echo "<td width='25%' colspan='2'>$pUserEmail</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='25%' colspan='2'><span class='ficha'>Bibliographic Reference</span></td>";
echo "<td width='75%' colspan='6'>$pBibRef</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='25%' colspan='2'><span class='ficha'>Category</span> </td>";
echo "<td width='25%' colspan='2'>$pCategory</td>"; 
echo "<td width='25%' colspan='2'><span class='ficha'>Date of Submission</span></td>";
echo "<td width='25%' colspan='2'>$pDateSubmission</td>"; 
echo "</tr>";
echo "<tr>";
echo "<td width='25%' colspan='2' valign='top'><span class='ficha'>Description (LaTeX code)</span></td>";
echo "<td width='75%' colspan='6'><pre>$pDescription</pre></td>";
echo "</tr>  ";
echo "</table>";
?>

<hr/>

<?php
  require('footer.inc');
?>
