Subversion Repositories bacoAlunos

Rev

Rev 1412 | Rev 1474 | Go to most recent revision | Details | Compare with Previous | 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" %>
1426 jmachado 8
<%@ page import="java.net.URLEncoder" %>
1409 jmachado 9
<%@ page import="java.util.List" %>
10
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
11
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
12
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
13
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
14
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
15
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
16
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
17
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
18
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSessionImpl" scope="request"/>
19
 
20
<%
21
    String cursoAfetoId = request.getParameter("cursoAfetoId");
22
 
23
 
24
    AbstractDao.getCurrentSession().beginTransaction();
25
 
26
    QuestionarioPedagogicoCursoAfeto cursoAfeto = DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().load(Long.parseLong(cursoAfetoId));
27
    Questionario questionarioV = cursoAfeto.getQuestionario();
28
 
29
    QuestionarioImpl questionario = (QuestionarioImpl) DaoFactory.getQuestionarioDaoImpl().narrow(questionarioV);
30
    questionario.initClearances(UserSession,true);
31
    request.setAttribute("Questionario",questionario);
32
 
33
    if(!questionario.isClear(UserSession,QuestionarioImpl.QuestionarioClearancesOperation.QUESTIONARIO_SEE_DASHBOARD.name()))
34
    {
35
        return; //NAO PODE VER O PAINEL
36
    }
37
    else
38
    {
39
        Query q = AbstractDao.getCurrentSession().createQuery(
40
                "select " +
41
                        " u.codigoUnidade " +
42
                        ",u.nome " +
43
                        ",t.cdDocente " +
44
                        ",t.nomeDocente " +
45
                        ",t.dsTipologia " +
46
                        ",t.cdTurma " +
47
                        ",sum (case when u.usar = true AND rR.resposta is null then 1 else 0 end) AS porResponder " +
48
                        ",sum (case when u.usar = true AND rR.resposta is null then 0 else 1 end) AS respostasObtidas " +
49
                        ",count(distinct a.aluno)" +
1426 jmachado 50
                        ",u.id" +
1409 jmachado 51
                        " from u in class " + QuestionarioPedagogicoUnidadeCurricularAfeta.class.getName() + " " +
52
                        " join u.cursoAfeto c " +
53
                        " join u.tipologiasRequisitadas t " +
54
                        " join t.alunosRequisitados a " +
55
                        " join a.respostaRequisitada rR " +
56
                        " left join rR.resposta r " +
57
 
58
                        " where c.id = :id group by t.id order by u.nome asc");
59
        q.setLong("id",cursoAfeto.getId());
60
 
61
        List<Object[]> tipologias = q.list();
62
%>
63
 
64
<div class="col-sm-12">
65
    <table class="tablesorterfiltered">
66
        <thead>
67
            <th>Código</th>
68
            <th>Unidade</th>
69
            <th>Código Docente</th>
70
            <th class="filter-name filter-select">Docente</th>
71
            <th>Tipologia</th>
72
            <th>Turma</th>
1426 jmachado 73
            <th>Por Resp.</th>
74
            <th>Resp.</th>
75
            <th>Alunos</th>
76
            <th></th>
1409 jmachado 77
        </thead>
78
        <tbody>
79
    <%
80
 
81
        for(Object[] tipologia: tipologias)
82
        {
83
    %>
84
        <tr>
85
            <td><%=tipologia[0]%></td>
86
            <td><%=tipologia[1]%></td>
87
            <td><%=tipologia[2]%></td>
88
            <td><%=tipologia[3]%></td>
89
            <td><%=tipologia[4]%></td>
90
            <td><%=tipologia[5]%></td>
91
            <td><label class="label label-danger" style="font-size: 1em"><%=tipologia[6]%></label></td>
1412 jmachado 92
            <td><label class="label <%=((Long)tipologia[7]) > 0 ? "label-success":"label-warning"%>" style="font-size: 1em"><%=tipologia[7]%></label></td>
1409 jmachado 93
            <td><label class="label label-info" style="font-size: 1em"><%=tipologia[8]%></label></td>
1426 jmachado 94
            <td>
95
                <%
96
                    Long unidadeId = (Long) tipologia[9];
97
                    request.setAttribute("unidadeId",unidadeId);
98
                %>
99
                <%
100
                    String nomeCursoEncoded = URLEncoder.encode(tipologia[1] + "(" + tipologia[0] + ")", "ISO-8859-1");
101
                    request.setAttribute("nomeUnidadeEncoded",nomeCursoEncoded);
102
                %>
103
                <html:link styleClass="btn btn-default" action="/user/startQuestionariosPaeMessagePedagogico.do?questionarioId=${Questionario.id}&formDescription=Mensagem para os alunos: ${nomeUnidadeEncoded}&targetDispatch=sendEmailQuestionarioUnidadeAfeta&cursoAfetoOrUnidadeAfetaOrQuestionarioAfetoId=${unidadeId}">
104
                    <span class="glyphicon glyphicon-envelope"> </span>
105
                </html:link>
106
            </td>
1409 jmachado 107
        </tr>
108
    <%
109
        }
110
    %>
111
        </tbody>
112
    </table>
113
 
114
</div>
115
<%
116
        AbstractDao.getCurrentSession().getTransaction().commit();
117
    }//FIM DE PAINEL CLEARED
118
%>