Subversion Repositories bacoAlunos

Rev

Rev 187 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@ page import="jomm.dao.impl.AbstractDao" %>
<%@ page import="pt.estgp.estgweb.domain.Teacher" %>
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
<%@ page import="pt.estgp.estgweb.domain.CourseUnit" %>
<%@ page contentType="text/html" %>
<%@ page pageEncoding="UTF-8" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<html:html locale="true">
<head>
    <title>Consulta de Unidades Curriculares</title>
    <link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/style.css"/>

</head>
<body class="small" marginwidth="0" marginheight="0" bgcolor="#ffffff" topmargin="0" leftmargin="0"
      style="text-align:center">
<table align="center">
<tr>
<td align="center">
<div id="body">

<table id="page">
<tr>
    <td>
        <div id="header">
            <jsp:include page="layout/header.jsp"/>
        </div>
    </td>
</tr>
<tr>
<td id="content">
<h1>Bem vindo à página de consulta de unidades curriculares</h1>
<br>

<div class="listCircleWhite">
    <ul>
        <li>
            Por favor confirme as suas unidades curriculares e informe caso seja detectado algum
            erro
        </li>
        <li>
            O objectivo desta consulta é identificar erros de importação do sistema SIGES na nova plataforma do sitio da
            ESTG
        </li>
        <li>
            Obrigado pela disponibilidade
        </li>
    </ul>
</div>
<div class="portalContent">
<p>Exemplo:</p>
<p>est12345</p>
<p>ou então o seu número de BI</p>
<form action="units.jsp">
    <p>USERNAME NETPA: <input type="text" name="sigesTeacherCode">
    <p>ou número de BI: <input type="text" name="bi"> </p>
    <p><input type="submit"/></p>
</form>
<div>
<%
    try
    {
        AbstractDao.getCurrentSession().beginTransaction();
        String code = request.getParameter("sigesTeacherCode");
        String bi = request.getParameter("bi");
        if((code ==  null && code.length()  == 0) || ( bi == null &&  bi.length() == 0))
        {
%>
<div class="statusERROR">
    <p>Por favor coloque o código de docente ou o número de bilhete de identidade</p>
</div>
<%
}
else
{
    try
    {
        Teacher teacher;
        if(code.startsWith("est"))
            code = code.substring(3);
        if(code != null && code.trim().length()>0)
            teacher = DaoFactory.getTeacherDaoImpl().loadBySigesCode(Integer.parseInt(code));
        else
            teacher = DaoFactory.getTeacherDaoImpl().loadByBi(bi);



        if (teacher == null)
        {
%>
<div class="statusERROR">
    <p>Docente não encontrado</p>
</div>
<%
}
else
{
    teacher.setUnitCheck(true);
%>
<p>Docente: <%=teacher.getName()%>
</p>

<p>Email: <%=teacher.getEmail()%>
</p>
<%
    if (teacher.getTeachedUnits() == null || teacher.getTeachedUnits().size() == 0)
    {
%>
<div class="statusERROR">
    <p>Não tem quaisquer unidades curriculares associadas</p>
</div>
<%
}
else
{
%>
<table border="1">
    <tr>
        <th>
            Código de Curso
        </th>
        <th>
            Curso
        </th>
        <th>
            Unidade
        </th>
        <th>
            Semestre
        </th>
    </tr>
    <%
        for (CourseUnit cu : teacher.getTeachedUnits())
        {
    %>
    <tr>
        <td>
            <%=cu.getCourseCode()%>
        </td>
        <td>
            <%=cu.getCourseName()%>
        </td>
        <td>
            <%=cu.getName()%>
        </td>
        <td>
            <%=cu.getSemestre()%>
        </td>
    </tr>
    <%
        }
    %>
</table>
<%

        }
    }

}
catch (NumberFormatException e)
{
%>
<div class="statusERROR">
    <p>Por favor introduza um número</p>
</div>
<%
            }
        }

        AbstractDao.getCurrentSession().getTransaction().commit();
    }
    catch (Throwable e)

    {
        response.sendError(500);
    }
%>
</div>
<ul class="statusERROR" style="font-size:1.1em">
    <li>Por favor informe a equipa de desenvolvimento (<a href="mailto:jmachado@estgp.pt">jmachado@estgp.pt</a>) caso algum erro tenha sido detectado, em caso de estar tudo ok não é necessário feedback</li>
</ul>
</div>

</td>
</tr>
</table>
<div id="footer">
    <jsp:include page="layout/footer.jsp"/>
</div>
</div>
</td>
</tr>
</table>
</body>
</html:html>