Subversion Repositories bacoAlunos

Rev

Rev 1412 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1409 jmachado 1
<%@ page import="jomm.dao.impl.AbstractDao" %>
2
<%@ page import="org.hibernate.Query" %>
3
<%@ page import="pt.estgp.estgweb.domain.Questionario" %>
4
<%@ page import="pt.estgp.estgweb.domain.QuestionarioImpl" %>
5
<%@ page import="pt.estgp.estgweb.domain.QuestionarioPedagogicoCursoAfeto" %>
6
<%@ page import="pt.estgp.estgweb.domain.QuestionarioPedagogicoUnidadeCurricularAfeta" %>
7
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
8
<%@ page import="java.util.List" %>
9
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
10
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
11
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
12
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
13
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
14
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
15
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
16
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
17
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSessionImpl" scope="request"/>
18
 
19
<%
20
    String cursoAfetoId = request.getParameter("cursoAfetoId");
21
 
22
 
23
    AbstractDao.getCurrentSession().beginTransaction();
24
 
25
    QuestionarioPedagogicoCursoAfeto cursoAfeto = DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().load(Long.parseLong(cursoAfetoId));
26
    Questionario questionarioV = cursoAfeto.getQuestionario();
27
 
28
    QuestionarioImpl questionario = (QuestionarioImpl) DaoFactory.getQuestionarioDaoImpl().narrow(questionarioV);
29
    questionario.initClearances(UserSession,true);
30
    request.setAttribute("Questionario",questionario);
31
 
32
    if(!questionario.isClear(UserSession,QuestionarioImpl.QuestionarioClearancesOperation.QUESTIONARIO_SEE_DASHBOARD.name()))
33
    {
34
        return; //NAO PODE VER O PAINEL
35
    }
36
    else
37
    {
38
        Query q = AbstractDao.getCurrentSession().createQuery(
39
                "select " +
40
                        " u.codigoUnidade " +
41
                        ",u.nome " +
42
                        ",t.cdDocente " +
43
                        ",t.nomeDocente " +
44
                        ",t.dsTipologia " +
45
                        ",t.cdTurma " +
46
                        ",sum (case when u.usar = true AND rR.resposta is null then 1 else 0 end) AS porResponder " +
47
                        ",sum (case when u.usar = true AND rR.resposta is null then 0 else 1 end) AS respostasObtidas " +
48
                        ",count(distinct a.aluno)" +
49
                        " from u in class " + QuestionarioPedagogicoUnidadeCurricularAfeta.class.getName() + " " +
50
                        " join u.cursoAfeto c " +
51
                        " join u.tipologiasRequisitadas t " +
52
                        " join t.alunosRequisitados a " +
53
                        " join a.respostaRequisitada rR " +
54
                        " left join rR.resposta r " +
55
 
56
                        " where c.id = :id group by t.id order by u.nome asc");
57
        q.setLong("id",cursoAfeto.getId());
58
 
59
        List<Object[]> tipologias = q.list();
60
%>
61
 
62
<div class="col-sm-12">
63
    <table class="tablesorterfiltered">
64
        <thead>
65
            <th>Código</th>
66
            <th>Unidade</th>
67
            <th>Código Docente</th>
68
            <th class="filter-name filter-select">Docente</th>
69
            <th>Tipologia</th>
70
            <th>Turma</th>
71
            <th>Por Responder</th>
72
            <th>Respondidos</th>
73
            <th>Estudantes</th>
74
        </thead>
75
        <tbody>
76
    <%
77
 
78
        for(Object[] tipologia: tipologias)
79
        {
80
    %>
81
        <tr>
82
            <td><%=tipologia[0]%></td>
83
            <td><%=tipologia[1]%></td>
84
            <td><%=tipologia[2]%></td>
85
            <td><%=tipologia[3]%></td>
86
            <td><%=tipologia[4]%></td>
87
            <td><%=tipologia[5]%></td>
88
            <td><label class="label label-danger" style="font-size: 1em"><%=tipologia[6]%></label></td>
89
            <td><label class="label label-success" style="font-size: 1em"><%=tipologia[7]%></label></td>
90
            <td><label class="label label-info" style="font-size: 1em"><%=tipologia[8]%></label></td>
91
        </tr>
92
    <%
93
        }
94
    %>
95
        </tbody>
96
    </table>
97
 
98
</div>
99
<%
100
        AbstractDao.getCurrentSession().getTransaction().commit();
101
    }//FIM DE PAINEL CLEARED
102
%>