Rev 1412 | Rev 1621 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1407 | jmachado | 1 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
2 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
||
1411 | jmachado | 3 | <%@ page import="pt.estgp.estgweb.web.form.questionarios.QuestionarioRespostaForm" %> |
4 | <%@ page import="java.util.List" %> |
||
5 | <%@ page import="pt.estgp.estgweb.domain.*" %> |
||
1407 | jmachado | 6 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
7 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
||
8 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
||
9 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
||
10 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
||
11 | <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> |
||
12 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
||
13 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
||
14 | <jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSessionImpl" scope="request"/> |
||
15 | <% |
||
1411 | jmachado | 16 | QuestionarioRespostaForm form = (QuestionarioRespostaForm) request.getAttribute("QuestionarioRespostaForm"); |
17 | long alunoRequesitadoId; |
||
18 | if(form != null) |
||
19 | { |
||
20 | alunoRequesitadoId = form.getAlunoRequesitadoId(); |
||
21 | } |
||
22 | else |
||
23 | { |
||
24 | alunoRequesitadoId = Long.parseLong(request.getParameter("alunoRequisitadoId")); |
||
25 | } |
||
1407 | jmachado | 26 | |
1411 | jmachado | 27 | |
28 | |||
29 | request.setAttribute("alunoRequisitadoId",alunoRequesitadoId); |
||
30 | |||
1412 | jmachado | 31 | |
1407 | jmachado | 32 | AbstractDao.getCurrentSession().beginTransaction(); |
33 | |||
34 | //todo MUDAR AQUI QUANDO HOUVER OUTROS TIPOS DE QUESTIONARIOS ASSIM CARREGA O ALUNO |
||
35 | //NAO DEVE SER PRECISO PORQUE A LISTAGEM E ESPECIFICA DO PEDAGOGICO |
||
36 | |||
37 | QuestionarioPedagogicoAlunoRequisitado alunoRequisitado |
||
38 | = DaoFactory.getQuestionarioPedagogicoAlunoRequisitadoDaoImpl().load(alunoRequesitadoId); |
||
39 | QuestionarioRespostaRequisitada respostaRequisitada |
||
40 | = alunoRequisitado.getRespostaRequisitada(); |
||
41 | |||
42 | Questionario qLoad = respostaRequisitada.getQuestionario(); |
||
43 | QuestionarioImpl questionario = (QuestionarioImpl) DaoFactory.getQuestionarioDaoImpl().narrow(qLoad); |
||
44 | |||
1412 | jmachado | 45 | request.setAttribute("questionario",questionario); |
1407 | jmachado | 46 | |
47 | if(respostaRequisitada.getUser().getId() != UserSession.getUser().getId() || (questionario.getStateEnum() != QuestionarioImpl.State.PROCESSING && |
||
48 | questionario.getStateEnum() != QuestionarioImpl.State.PROCESSING_WITH_ANSWERS)) |
||
49 | { |
||
50 | %> |
||
51 | <div class="panel panel-danger"> |
||
52 | <div class="panel-heading">ATENÇÃO</div> |
||
53 | <div class="panel-body"> |
||
54 | <div class="alert alert-danger">Lamentamos mas o questionário ao qual está a tentar responder não lhe pertence!</div> |
||
55 | </div> |
||
56 | </div> |
||
57 | <% |
||
58 | } |
||
59 | else if(respostaRequisitada.getResposta() != null) |
||
60 | { |
||
61 | %> |
||
62 | <div class="panel panel-info"> |
||
63 | <div class="panel-heading">ATENÇÃO</div> |
||
64 | <div class="panel-body"> |
||
65 | <div class="alert alert-info">O questionário que está a tentar responder já está entregue. Obrigado!</div> |
||
66 | </div> |
||
67 | </div> |
||
68 | <% |
||
69 | } |
||
70 | else |
||
71 | { |
||
72 | %> |
||
73 | |||
1411 | jmachado | 74 | <style> |
75 | .questionarioTable |
||
76 | { |
||
77 | width: 100%; |
||
78 | } |
||
79 | .questionarioTable .pergunta |
||
80 | { |
||
81 | width: 60%; |
||
82 | } |
||
83 | .questionarioTable td |
||
84 | { |
||
85 | padding: 10px; |
||
86 | |||
87 | } |
||
88 | .questionarioTable input[type=radio] |
||
89 | { |
||
90 | margin-right: 4px; |
||
91 | |||
92 | } |
||
93 | .questionarioTable tr |
||
94 | { |
||
95 | border-bottom: 1px solid #939393; |
||
96 | } |
||
97 | .questionarioTable tr.nao-respondida |
||
98 | { |
||
99 | |||
100 | } |
||
101 | .questionarioTable tr.respondida |
||
102 | { |
||
103 | |||
104 | background-color: #e2ffef; |
||
105 | } |
||
106 | |||
107 | </style> |
||
108 | <script> |
||
109 | //START SERVICE PING |
||
110 | |||
111 | |||
112 | var lastEvent = 0; |
||
113 | var lastDiferentElementEvent = 0; |
||
114 | var lastDiferentElement; |
||
115 | function addEvent(targetElementId,targetDurationElementId) |
||
116 | { |
||
117 | $("#"+targetElementId).closest("tr").removeClass("alert-warning"); |
||
118 | $("#"+targetElementId).closest("tr").removeClass("nao-respondida"); |
||
119 | $("#"+targetElementId).closest("tr").addClass("respondida"); |
||
120 | |||
121 | if(targetElementId != lastDiferentElement) |
||
122 | { |
||
123 | lastDiferentElementEvent = lastEvent; |
||
124 | lastDiferentElement = targetElementId; |
||
125 | var eventTime = new Date().getTime(); |
||
126 | $("#" + targetElementId).val(""+eventTime); |
||
127 | $("#" + targetDurationElementId).val(""+(eventTime-lastEvent)); |
||
128 | lastEvent = eventTime; |
||
129 | } |
||
130 | else |
||
131 | { |
||
132 | var eventTime = new Date().getTime(); |
||
133 | $("#" + targetElementId).val(""+eventTime); |
||
134 | $("#" + targetDurationElementId).val(""+(eventTime-lastDiferentElementEvent)); |
||
135 | lastEvent = eventTime; |
||
136 | } |
||
137 | } |
||
138 | $(document).ready( |
||
139 | function() |
||
140 | { |
||
141 | ping(); |
||
142 | var startTime = new Date().getTime(); |
||
143 | $("#timeStart").val(startTime+""); |
||
144 | lastDiferentElementEvent = startTime; |
||
145 | lastEvent = startTime; |
||
146 | lastDiferentElement = null; |
||
147 | |||
148 | $("#submeterBtn").on("click",function() |
||
149 | { |
||
150 | var end = new Date().getTime(); |
||
151 | $("#timeEnd").val(end+""); |
||
152 | $("#totalTime").val((end-startTime)+""); |
||
153 | $("#respostaForm").submit(); |
||
154 | }); |
||
155 | |||
156 | <% |
||
157 | if(request.getAttribute("respostasVazias")!= null) |
||
158 | { |
||
159 | List<String> respostasVazias = (List<String>) request.getAttribute("respostasVazias"); |
||
160 | for(String resposta: respostasVazias) |
||
161 | { |
||
162 | %> |
||
163 | $("#pergunta<%=resposta%>").removeClass("nao-respondida").addClass("alert-warning"); |
||
164 | <% |
||
165 | } |
||
166 | } |
||
167 | %> |
||
168 | } |
||
169 | ); |
||
170 | |||
171 | |||
172 | </script> |
||
173 | |||
1407 | jmachado | 174 | <div class="panel panel-default"> |
175 | <div class="panel-heading">Resposta ao Questionário de |
||
176 | <label class="label label-pill label-default" style="font-size: 1.1em"><%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getNome()%></label> |
||
177 | (<%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getCodigoUnidade()%>) |
||
178 | de <%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getCursoAfeto().getNome()%> |
||
179 | (<%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getCursoAfeto().getCodigoCurso()%>) |
||
180 | Periodo lectivo (<%=questionario.getYear()%> - <%=questionario.getSemestre()%>) |
||
181 | <br/> |
||
182 | Docente: <label class="label label-pill label-info" style="font-size: 1.1em"><%=alunoRequisitado.getTipologiaRequisitada().getNomeDocente()%> (<%=alunoRequisitado.getTipologiaRequisitada().getCdDocente()%>)</label> |
||
183 | / |
||
184 | <label class="label label-pill label-default" style="font-size: 1.1em"><%=alunoRequisitado.getTipologiaRequisitada().getDsTipologia()%> |
||
185 | </div> |
||
186 | <div class="panel-body"> |
||
1409 | jmachado | 187 | <html:errors/> |
188 | <jomm:messages/> |
||
1407 | jmachado | 189 | <div class="panel panel-default"> |
190 | <div class="panel-body"> |
||
191 | <%=qLoad.getIntroHtml()%> |
||
192 | </div> |
||
193 | <div class="panel-body"> |
||
1572 | jmachado | 194 | <p class="lead">Nas suas respostas deverá considerar 1 para nada satisfeito e 5 para muito satisfeito, exceptuando os casos de questões de esforço que estão mensuradas em horas.</p> |
1407 | jmachado | 195 | </div> |
196 | </div> |
||
197 | |||
198 | |||
199 | <html:form action="/user/questionariosPaeResposta" styleId="respostaForm"> |
||
1408 | jmachado | 200 | <input type="hidden" name="dispatch" value="submitResposta"/> |
1411 | jmachado | 201 | <html:hidden styleId="timeStart" property="resposta.timeStart"/> |
202 | <html:hidden styleId="timeEnd" property="resposta.timeEnd"/> |
||
203 | <html:hidden styleId="totalTime" property="resposta.totalTime"/> |
||
204 | <html:hidden property="alunoRequesitadoId" value="${alunoRequisitadoId}"/> |
||
1412 | jmachado | 205 | <html:hidden property="resposta.questionario.id" value="${questionario.id}"/> |
1411 | jmachado | 206 | <jsp:useBean id="QuestionarioRespostaForm" type="pt.estgp.estgweb.web.form.questionarios.QuestionarioRespostaForm" scope="request"/> |
207 | <div class="panel panel-primary"> |
||
208 | <div class="panel-heading">Identificação da Unidade Curricular</div> |
||
1407 | jmachado | 209 | <div class="panel-body"> |
1411 | jmachado | 210 | <p>Curso: <label class="label label-pill label-default" style="font-size: 1.1em"><%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getCursoAfeto().getNome()%></label> (<%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getCursoAfeto().getCodigoCurso()%>)</p> |
211 | <p>Unidade Curricular: <label class="label label-pill label-default" style="font-size: 1.1em"><%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getNome()%></label> (<%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getCodigoUnidade()%>)</p> |
||
212 | <p>Docente em Avaliação: <label class="label label-pill label-default" style="font-size: 1.1em"><%=alunoRequisitado.getTipologiaRequisitada().getNomeDocente()%></label> (<%=alunoRequisitado.getTipologiaRequisitada().getCdDocente()%>)</p> |
||
213 | <p>Tipologia de Aulas: <label class="label label-pill label-default" style="font-size: 1.1em"><%=alunoRequisitado.getTipologiaRequisitada().getDsTipologia()%></label> </p> |
||
1407 | jmachado | 214 | </div> |
215 | </div> |
||
216 | <% |
||
217 | for(int i = 1;i<=10;i++) |
||
218 | { |
||
219 | String titulo = (String) QuestionarioImpl.class.getMethod("getGroup" + i + "Title").invoke(questionario); |
||
1572 | jmachado | 220 | String groupCodeComplete = (String) QuestionarioImpl.class.getMethod("getGroup" + i + "Code").invoke(questionario); |
221 | String groupNumber = ""+i; |
||
222 | if(groupCodeComplete != null && !groupCodeComplete.startsWith("D_") && titulo != null && titulo.trim().length() > 0) |
||
1407 | jmachado | 223 | { |
224 | %> |
||
225 | <div class="panel panel-default"> |
||
226 | <div class="panel-heading"> |
||
1411 | jmachado | 227 | <%=(i)%> - <%=titulo%> |
1407 | jmachado | 228 | </div> |
229 | <div class="panel-body"> |
||
1411 | jmachado | 230 | <table class="questionarioTable"> |
1407 | jmachado | 231 | <% |
232 | for(int p = 1; p <= 40; p++) |
||
233 | { |
||
234 | request.setAttribute("p",p); |
||
235 | String pGroup = (String) QuestionarioImpl.class.getMethod("getP" + p + "Group").invoke(questionario); |
||
1572 | jmachado | 236 | if(pGroup.equals(groupNumber)) |
1407 | jmachado | 237 | { |
238 | String pergunta = (String) QuestionarioImpl.class.getMethod("getP" + p).invoke(questionario); |
||
1411 | jmachado | 239 | |
240 | String resposta = (String) QuestionarioResposta.class.getMethod("getR" + p).invoke(QuestionarioRespostaForm.getResposta()); |
||
241 | |||
242 | String naoRespondida = resposta != null && Long.parseLong(resposta) > 0 ? "respondida":" nao-respondida"; |
||
1407 | jmachado | 243 | %> |
1411 | jmachado | 244 | <tr id="pergunta${p}" class="pergunta <%=naoRespondida%>"> |
245 | <td> |
||
1407 | jmachado | 246 | |
1411 | jmachado | 247 | <%=pergunta%> |
248 | <html:hidden property="resposta.timeEventR${p}" styleId="timeEventR${p}"/> |
||
249 | <html:hidden property="resposta.timeTakenR${p}" styleId="timeTakenR${p}"/> |
||
250 | </td> |
||
251 | <td style="padding-left: 10px"><html:radio property="resposta.r${p}" value="1" onclick="addEvent('timeEventR${p}','timeTakenR${p}');">1</html:radio></td> |
||
252 | <td style="padding-left: 10px"><html:radio property="resposta.r${p}" value="2" onclick="addEvent('timeEventR${p}','timeTakenR${p}');">2</html:radio></td> |
||
253 | <td style="padding-left: 10px"><html:radio property="resposta.r${p}" value="3" onclick="addEvent('timeEventR${p}','timeTakenR${p}');">3</html:radio></td> |
||
254 | <td style="padding-left: 10px"><html:radio property="resposta.r${p}" value="4" onclick="addEvent('timeEventR${p}','timeTakenR${p}');">4</html:radio></td> |
||
255 | <td style="padding-left: 10px"><html:radio property="resposta.r${p}" value="5" onclick="addEvent('timeEventR${p}','timeTakenR${p}');">5</html:radio></td> |
||
256 | |||
1407 | jmachado | 257 | </tr> |
258 | <% |
||
259 | |||
260 | } |
||
261 | } |
||
262 | %> |
||
1572 | jmachado | 263 | |
264 | <!-- GRUPO PERGUNTAS "e" esforço e1, e2, etc--> |
||
265 | <% |
||
266 | boolean umaQuestão = false; |
||
267 | for(int e = 1; e <= 10; e++) |
||
268 | { |
||
269 | request.setAttribute("e",e); |
||
270 | String pGroup = (String) QuestionarioImpl.class.getMethod("getE" + e + "Group").invoke(questionario); |
||
271 | if(pGroup.equals(groupNumber)) |
||
272 | { |
||
273 | if(!umaQuestão) |
||
274 | { |
||
275 | umaQuestão = true; |
||
276 | %> |
||
277 | <tr> |
||
278 | <th colspan="6"> |
||
279 | Questões relativas a esforço mensuradas em horas de dedicação |
||
280 | </th> |
||
281 | </tr> |
||
282 | <% |
||
283 | } |
||
284 | String pergunta = (String) QuestionarioImpl.class.getMethod("getE" + e).invoke(questionario); |
||
285 | |||
286 | String resposta = (String) QuestionarioResposta.class.getMethod("getRe" + e).invoke(QuestionarioRespostaForm.getResposta()); |
||
287 | |||
288 | String naoRespondida = resposta != null && Long.parseLong(resposta) > 0 ? "respondida":" nao-respondida"; |
||
289 | |||
290 | //TODO VER AQUI O pergunta |
||
291 | %> |
||
292 | <tr id="perguntaE${e}" class="pergunta <%=naoRespondida%>"> |
||
293 | <td> |
||
294 | |||
295 | <%=pergunta%> |
||
296 | <html:hidden property="resposta.timeEventRe${e}" styleId="timeEventRe${e}"/> |
||
297 | <html:hidden property="resposta.timeTakenRe${e}" styleId="timeTakenRe${e}"/> |
||
298 | </td> |
||
299 | <td style="padding-left: 10px"><html:radio property="resposta.re${e}" value="1" onclick="addEvent('timeEventRe${e}','timeTakenRe${e}');">menos de 1 hora</html:radio></td> |
||
300 | <td style="padding-left: 10px"><html:radio property="resposta.re${e}" value="1" onclick="addEvent('timeEventRe${e}','timeTakenRe${e}');">1 a 5 horas</html:radio></td> |
||
301 | <td style="padding-left: 10px"><html:radio property="resposta.re${e}" value="2" onclick="addEvent('timeEventRe${e}','timeTakenRe${e}');">5 a 10 horas</html:radio></td> |
||
302 | <td style="padding-left: 10px"><html:radio property="resposta.re${e}" value="3" onclick="addEvent('timeEventRe${e}','timeTakenRe${e}');">10 a 15 horas</html:radio></td> |
||
303 | <td style="padding-left: 10px"><html:radio property="resposta.re${e}" value="4" onclick="addEvent('timeEventRe${e}','timeTakenRe${e}');">mais de 15 horas</html:radio></td> |
||
304 | |||
305 | |||
306 | </tr> |
||
307 | <% |
||
308 | |||
309 | } |
||
310 | } |
||
311 | %> |
||
1407 | jmachado | 312 | </table> |
313 | </div> |
||
314 | </div> |
||
315 | <% |
||
316 | } |
||
317 | |||
318 | } |
||
319 | %> |
||
320 | |||
321 | |||
1411 | jmachado | 322 | <button class="btn btn-success" type="button" id="submeterBtn">Submeter</button> |
1407 | jmachado | 323 | </html:form> |
324 | </div> |
||
325 | </div> |
||
326 | <% |
||
327 | } |
||
328 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
329 | %> |