Rev 1409 | Rev 1412 | 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 | |||
1407 | jmachado | 31 | AbstractDao.getCurrentSession().beginTransaction(); |
32 | |||
33 | //todo MUDAR AQUI QUANDO HOUVER OUTROS TIPOS DE QUESTIONARIOS ASSIM CARREGA O ALUNO |
||
34 | //NAO DEVE SER PRECISO PORQUE A LISTAGEM E ESPECIFICA DO PEDAGOGICO |
||
35 | |||
36 | QuestionarioPedagogicoAlunoRequisitado alunoRequisitado |
||
37 | = DaoFactory.getQuestionarioPedagogicoAlunoRequisitadoDaoImpl().load(alunoRequesitadoId); |
||
38 | QuestionarioRespostaRequisitada respostaRequisitada |
||
39 | = alunoRequisitado.getRespostaRequisitada(); |
||
40 | |||
41 | Questionario qLoad = respostaRequisitada.getQuestionario(); |
||
42 | QuestionarioImpl questionario = (QuestionarioImpl) DaoFactory.getQuestionarioDaoImpl().narrow(qLoad); |
||
43 | |||
44 | |||
45 | |||
46 | if(respostaRequisitada.getUser().getId() != UserSession.getUser().getId() || (questionario.getStateEnum() != QuestionarioImpl.State.PROCESSING && |
||
47 | questionario.getStateEnum() != QuestionarioImpl.State.PROCESSING_WITH_ANSWERS)) |
||
48 | { |
||
49 | %> |
||
50 | <div class="panel panel-danger"> |
||
51 | <div class="panel-heading">ATENÇÃO</div> |
||
52 | <div class="panel-body"> |
||
53 | <div class="alert alert-danger">Lamentamos mas o questionário ao qual está a tentar responder não lhe pertence!</div> |
||
54 | </div> |
||
55 | </div> |
||
56 | <% |
||
57 | } |
||
58 | else if(respostaRequisitada.getResposta() != null) |
||
59 | { |
||
60 | %> |
||
61 | <div class="panel panel-info"> |
||
62 | <div class="panel-heading">ATENÇÃO</div> |
||
63 | <div class="panel-body"> |
||
64 | <div class="alert alert-info">O questionário que está a tentar responder já está entregue. Obrigado!</div> |
||
65 | </div> |
||
66 | </div> |
||
67 | <% |
||
68 | } |
||
69 | else |
||
70 | { |
||
71 | %> |
||
72 | |||
1411 | jmachado | 73 | <style> |
74 | .questionarioTable |
||
75 | { |
||
76 | width: 100%; |
||
77 | } |
||
78 | .questionarioTable .pergunta |
||
79 | { |
||
80 | width: 60%; |
||
81 | } |
||
82 | .questionarioTable td |
||
83 | { |
||
84 | padding: 10px; |
||
85 | |||
86 | } |
||
87 | .questionarioTable input[type=radio] |
||
88 | { |
||
89 | margin-right: 4px; |
||
90 | |||
91 | } |
||
92 | .questionarioTable tr |
||
93 | { |
||
94 | border-bottom: 1px solid #939393; |
||
95 | } |
||
96 | .questionarioTable tr.nao-respondida |
||
97 | { |
||
98 | |||
99 | } |
||
100 | .questionarioTable tr.respondida |
||
101 | { |
||
102 | |||
103 | background-color: #e2ffef; |
||
104 | } |
||
105 | |||
106 | </style> |
||
107 | <script> |
||
108 | //START SERVICE PING |
||
109 | |||
110 | |||
111 | var lastEvent = 0; |
||
112 | var lastDiferentElementEvent = 0; |
||
113 | var lastDiferentElement; |
||
114 | function addEvent(targetElementId,targetDurationElementId) |
||
115 | { |
||
116 | $("#"+targetElementId).closest("tr").removeClass("alert-warning"); |
||
117 | $("#"+targetElementId).closest("tr").removeClass("nao-respondida"); |
||
118 | $("#"+targetElementId).closest("tr").addClass("respondida"); |
||
119 | |||
120 | if(targetElementId != lastDiferentElement) |
||
121 | { |
||
122 | lastDiferentElementEvent = lastEvent; |
||
123 | lastDiferentElement = targetElementId; |
||
124 | var eventTime = new Date().getTime(); |
||
125 | $("#" + targetElementId).val(""+eventTime); |
||
126 | $("#" + targetDurationElementId).val(""+(eventTime-lastEvent)); |
||
127 | lastEvent = eventTime; |
||
128 | } |
||
129 | else |
||
130 | { |
||
131 | var eventTime = new Date().getTime(); |
||
132 | $("#" + targetElementId).val(""+eventTime); |
||
133 | $("#" + targetDurationElementId).val(""+(eventTime-lastDiferentElementEvent)); |
||
134 | lastEvent = eventTime; |
||
135 | } |
||
136 | } |
||
137 | $(document).ready( |
||
138 | function() |
||
139 | { |
||
140 | ping(); |
||
141 | var startTime = new Date().getTime(); |
||
142 | $("#timeStart").val(startTime+""); |
||
143 | lastDiferentElementEvent = startTime; |
||
144 | lastEvent = startTime; |
||
145 | lastDiferentElement = null; |
||
146 | |||
147 | $("#submeterBtn").on("click",function() |
||
148 | { |
||
149 | var end = new Date().getTime(); |
||
150 | $("#timeEnd").val(end+""); |
||
151 | $("#totalTime").val((end-startTime)+""); |
||
152 | $("#respostaForm").submit(); |
||
153 | }); |
||
154 | |||
155 | <% |
||
156 | if(request.getAttribute("respostasVazias")!= null) |
||
157 | { |
||
158 | List<String> respostasVazias = (List<String>) request.getAttribute("respostasVazias"); |
||
159 | for(String resposta: respostasVazias) |
||
160 | { |
||
161 | %> |
||
162 | $("#pergunta<%=resposta%>").removeClass("nao-respondida").addClass("alert-warning"); |
||
163 | <% |
||
164 | } |
||
165 | } |
||
166 | %> |
||
167 | } |
||
168 | ); |
||
169 | |||
170 | |||
171 | </script> |
||
172 | |||
1407 | jmachado | 173 | <div class="panel panel-default"> |
174 | <div class="panel-heading">Resposta ao Questionário de |
||
175 | <label class="label label-pill label-default" style="font-size: 1.1em"><%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getNome()%></label> |
||
176 | (<%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getCodigoUnidade()%>) |
||
177 | de <%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getCursoAfeto().getNome()%> |
||
178 | (<%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getCursoAfeto().getCodigoCurso()%>) |
||
179 | Periodo lectivo (<%=questionario.getYear()%> - <%=questionario.getSemestre()%>) |
||
180 | <br/> |
||
181 | Docente: <label class="label label-pill label-info" style="font-size: 1.1em"><%=alunoRequisitado.getTipologiaRequisitada().getNomeDocente()%> (<%=alunoRequisitado.getTipologiaRequisitada().getCdDocente()%>)</label> |
||
182 | / |
||
183 | <label class="label label-pill label-default" style="font-size: 1.1em"><%=alunoRequisitado.getTipologiaRequisitada().getDsTipologia()%> |
||
184 | </div> |
||
185 | <div class="panel-body"> |
||
1409 | jmachado | 186 | <html:errors/> |
187 | <jomm:messages/> |
||
1407 | jmachado | 188 | <div class="panel panel-default"> |
189 | <div class="panel-body"> |
||
190 | <%=qLoad.getIntroHtml()%> |
||
191 | </div> |
||
192 | <div class="panel-body"> |
||
193 | <p class="lead">Nas suas respostas deverá considerar 1 para nada satisfeito e 5 para muito satisfeito</p> |
||
194 | </div> |
||
195 | </div> |
||
196 | |||
197 | |||
198 | <html:form action="/user/questionariosPaeResposta" styleId="respostaForm"> |
||
1408 | jmachado | 199 | <input type="hidden" name="dispatch" value="submitResposta"/> |
1411 | jmachado | 200 | <html:hidden styleId="timeStart" property="resposta.timeStart"/> |
201 | <html:hidden styleId="timeEnd" property="resposta.timeEnd"/> |
||
202 | <html:hidden styleId="totalTime" property="resposta.totalTime"/> |
||
203 | <html:hidden property="alunoRequesitadoId" value="${alunoRequisitadoId}"/> |
||
204 | <jsp:useBean id="QuestionarioRespostaForm" type="pt.estgp.estgweb.web.form.questionarios.QuestionarioRespostaForm" scope="request"/> |
||
205 | <div class="panel panel-primary"> |
||
206 | <div class="panel-heading">Identificação da Unidade Curricular</div> |
||
1407 | jmachado | 207 | <div class="panel-body"> |
1411 | jmachado | 208 | <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> |
209 | <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> |
||
210 | <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> |
||
211 | <p>Tipologia de Aulas: <label class="label label-pill label-default" style="font-size: 1.1em"><%=alunoRequisitado.getTipologiaRequisitada().getDsTipologia()%></label> </p> |
||
1407 | jmachado | 212 | </div> |
213 | </div> |
||
214 | <% |
||
215 | for(int i = 1;i<=10;i++) |
||
216 | { |
||
217 | String titulo = (String) QuestionarioImpl.class.getMethod("getGroup" + i + "Title").invoke(questionario); |
||
1411 | jmachado | 218 | String groupCode = ""+i; |
1407 | jmachado | 219 | if(titulo != null && titulo.trim().length() > 0) |
220 | { |
||
221 | %> |
||
222 | <div class="panel panel-default"> |
||
223 | <div class="panel-heading"> |
||
1411 | jmachado | 224 | <%=(i)%> - <%=titulo%> |
1407 | jmachado | 225 | </div> |
226 | <div class="panel-body"> |
||
1411 | jmachado | 227 | <table class="questionarioTable"> |
1407 | jmachado | 228 | <% |
229 | for(int p = 1; p <= 40; p++) |
||
230 | { |
||
231 | request.setAttribute("p",p); |
||
232 | String pGroup = (String) QuestionarioImpl.class.getMethod("getP" + p + "Group").invoke(questionario); |
||
233 | if(pGroup.equals(groupCode)) |
||
234 | { |
||
235 | String pergunta = (String) QuestionarioImpl.class.getMethod("getP" + p).invoke(questionario); |
||
1411 | jmachado | 236 | |
237 | String resposta = (String) QuestionarioResposta.class.getMethod("getR" + p).invoke(QuestionarioRespostaForm.getResposta()); |
||
238 | |||
239 | String naoRespondida = resposta != null && Long.parseLong(resposta) > 0 ? "respondida":" nao-respondida"; |
||
1407 | jmachado | 240 | %> |
1411 | jmachado | 241 | <tr id="pergunta${p}" class="pergunta <%=naoRespondida%>"> |
242 | <td> |
||
1407 | jmachado | 243 | |
1411 | jmachado | 244 | <%=pergunta%> |
245 | <html:hidden property="resposta.timeEventR${p}" styleId="timeEventR${p}"/> |
||
246 | <html:hidden property="resposta.timeTakenR${p}" styleId="timeTakenR${p}"/> |
||
247 | </td> |
||
248 | <td style="padding-left: 10px"><html:radio property="resposta.r${p}" value="1" onclick="addEvent('timeEventR${p}','timeTakenR${p}');">1</html:radio></td> |
||
249 | <td style="padding-left: 10px"><html:radio property="resposta.r${p}" value="2" onclick="addEvent('timeEventR${p}','timeTakenR${p}');">2</html:radio></td> |
||
250 | <td style="padding-left: 10px"><html:radio property="resposta.r${p}" value="3" onclick="addEvent('timeEventR${p}','timeTakenR${p}');">3</html:radio></td> |
||
251 | <td style="padding-left: 10px"><html:radio property="resposta.r${p}" value="4" onclick="addEvent('timeEventR${p}','timeTakenR${p}');">4</html:radio></td> |
||
252 | <td style="padding-left: 10px"><html:radio property="resposta.r${p}" value="5" onclick="addEvent('timeEventR${p}','timeTakenR${p}');">5</html:radio></td> |
||
253 | |||
1407 | jmachado | 254 | </tr> |
255 | <% |
||
256 | |||
257 | } |
||
258 | } |
||
259 | %> |
||
260 | </table> |
||
261 | </div> |
||
262 | </div> |
||
263 | <% |
||
264 | } |
||
265 | |||
266 | } |
||
267 | %> |
||
268 | |||
269 | |||
1411 | jmachado | 270 | <button class="btn btn-success" type="button" id="submeterBtn">Submeter</button> |
1407 | jmachado | 271 | </html:form> |
272 | </div> |
||
273 | </div> |
||
274 | <% |
||
275 | } |
||
276 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
277 | %> |