Rev 1474 | 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> |
||
1474 | jmachado | 73 | <th>Alunos com Respos. %</th> |
74 | <th>Alunos com Respos.</th> |
||
1426 | jmachado | 75 | <th>Alunos</th> |
1476 | jmachado | 76 | <baco:hasRole role="admin,all,questionarios.gerais,questionarios.admin,pedagogicCouncil.president,administrativeCouncil.director"> |
1426 | jmachado | 77 | <th></th> |
1476 | jmachado | 78 | </baco:hasRole> |
1409 | jmachado | 79 | </thead> |
80 | <tbody> |
||
81 | <% |
||
82 | |||
83 | for(Object[] tipologia: tipologias) |
||
84 | { |
||
1474 | jmachado | 85 | if(((Long)tipologia[8]).longValue() > 0) |
86 | { |
||
1409 | jmachado | 87 | %> |
88 | <tr> |
||
89 | <td><%=tipologia[0]%></td> |
||
90 | <td><%=tipologia[1]%></td> |
||
91 | <td><%=tipologia[2]%></td> |
||
92 | <td><%=tipologia[3]%></td> |
||
93 | <td><%=tipologia[4]%></td> |
||
94 | <td><%=tipologia[5]%></td> |
||
1474 | jmachado | 95 | <td> |
96 | <% |
||
97 | int percentage = (int) (100.0 * ( ((float)((Long)tipologia[7]).longValue()/((float)((Long)tipologia[8]).longValue())))); |
||
98 | String percentageColor = "danger"; |
||
99 | if(percentage < 20) |
||
100 | percentageColor = "danger"; |
||
101 | else if(percentage < 40) |
||
102 | percentageColor = "warning"; |
||
103 | else if(percentage < 60) |
||
104 | percentageColor = "info"; |
||
105 | else |
||
106 | percentageColor = "success"; |
||
107 | %> |
||
108 | <div class="progress"> |
||
109 | <div class="progress-bar progress-bar-<%=percentageColor%>" role="progressbar" aria-valuenow="<%=percentage%>" |
||
110 | aria-valuemin="0" aria-valuemax="100" style="width:<%=percentage%>%"> |
||
111 | <%=percentage%>% |
||
1476 | jmachado | 112 | <span class="icon icon-users"> </span> |
1474 | jmachado | 113 | </div> |
114 | </div> |
||
115 | |||
116 | </td> |
||
1476 | jmachado | 117 | <td><label class="label label-<%=percentageColor%>" style="font-size: 1em"><%=tipologia[7]%></label> <span class="icon icon-user"> </span></td> |
118 | <td><label class="label label-primary" style="font-size: 1em"><%=tipologia[8]%></label> <span class="icon icon-users"> </span></td> |
||
119 | <baco:hasRole role="admin,all,questionarios.gerais,questionarios.admin,pedagogicCouncil.president,administrativeCouncil.director"> |
||
1426 | jmachado | 120 | <td> |
121 | <% |
||
122 | Long unidadeId = (Long) tipologia[9]; |
||
123 | request.setAttribute("unidadeId",unidadeId); |
||
124 | %> |
||
125 | <% |
||
126 | String nomeCursoEncoded = URLEncoder.encode(tipologia[1] + "(" + tipologia[0] + ")", "ISO-8859-1"); |
||
127 | request.setAttribute("nomeUnidadeEncoded",nomeCursoEncoded); |
||
128 | %> |
||
129 | <html:link styleClass="btn btn-default" action="/user/startQuestionariosPaeMessagePedagogico.do?questionarioId=${Questionario.id}&formDescription=Mensagem para os alunos: ${nomeUnidadeEncoded}&targetDispatch=sendEmailQuestionarioUnidadeAfeta&cursoAfetoOrUnidadeAfetaOrQuestionarioAfetoId=${unidadeId}"> |
||
130 | <span class="glyphicon glyphicon-envelope"> </span> |
||
131 | </html:link> |
||
132 | </td> |
||
1476 | jmachado | 133 | </baco:hasRole> |
1409 | jmachado | 134 | </tr> |
135 | <% |
||
1474 | jmachado | 136 | } |
1409 | jmachado | 137 | } |
138 | %> |
||
139 | </tbody> |
||
140 | </table> |
||
141 | |||
142 | </div> |
||
143 | <% |
||
144 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
145 | }//FIM DE PAINEL CLEARED |
||
146 | %> |