Rev 1373 | Rev 1525 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1354 | jmachado | 1 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
2 | <%@ page import="org.hibernate.Criteria" %> |
||
3 | <%@ page import="org.hibernate.criterion.Order" %> |
||
4 | <%@ page import="org.hibernate.criterion.Projections" %> |
||
5 | <%@ page import="pt.estgp.estgweb.Globals" %> |
||
6 | <%@ page import="pt.estgp.estgweb.domain.Course" %> |
||
7 | <%@ page import="pt.estgp.estgweb.domain.CourseUnit" %> |
||
8 | <%@ page import="static org.hibernate.criterion.Restrictions.eq" %> |
||
9 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
||
10 | <%@ page import="static org.hibernate.criterion.Restrictions.eq" %> |
||
11 | <%@ page import="static org.hibernate.criterion.Restrictions.or" %> |
||
12 | <%@ page import="static org.hibernate.criterion.Restrictions.*" %> |
||
13 | <%@ page import="java.util.ArrayList" %> |
||
14 | <%@ page import="java.util.List" %> |
||
15 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
||
16 | <%@ taglib uri="/WEB-INF/baco.tld" prefix="baco" %> |
||
17 | <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> |
||
18 | <%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %> |
||
19 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> |
||
20 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> |
||
21 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> |
||
22 | <jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSessionImpl" scope="request"/> |
||
23 | |||
1372 | jmachado | 24 | <% |
25 | String all = request.getParameter("all"); |
||
26 | %> |
||
1354 | jmachado | 27 | <div class="panel panel-default"> |
28 | <div class="panel-heading"> |
||
29 | Estatisticas Unidades nos Cursos |
||
30 | </div> |
||
31 | <div class="panel-body"> |
||
32 | |||
33 | <% |
||
34 | boolean allCourses = false; |
||
35 | List<String> comissionsRoles = null; |
||
1379 | jmachado | 36 | if(UserSession.getUser().isSuperuserOrAdmin() || UserSession.getUser().hasRole(Globals.SERVICES_PROGRAMS_ROLE) || UserSession.getUser().hasRole("services")) |
1354 | jmachado | 37 | { |
38 | allCourses = true; |
||
39 | AbstractDao.getCurrentSession().beginTransaction(); |
||
40 | Criteria c = AbstractDao.getCurrentSession().createCriteria(CourseUnit.class) |
||
41 | .setProjection(Projections.projectionList().add(Projections.groupProperty("c.validationRole")) |
||
42 | .add(Projections.property("c.id")).add(Projections.property("c.name")).add(Projections.property("c.code"))) |
||
43 | .createAlias("course", "c") |
||
44 | .add(eq("importYear", UserSession.getNowConfiguration().getInterfaceImportYear())); |
||
45 | List<Object[]> validationRoles = c.list(); |
||
46 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
47 | comissionsRoles = new ArrayList<String>(); |
||
48 | |||
49 | %> |
||
50 | <div class="avisosWarning" style="display: none"> |
||
51 | <div class="alert alert-warning">Existem cursos sem papel de comissão atribuido |
||
52 | <button class="btn btn-warning" onclick="$('.avisos').toggle()">Ver/Ocultar Avisos</button> |
||
53 | </div> |
||
54 | </div> |
||
55 | <div class="avisos" style="display: none"> |
||
56 | <% |
||
57 | boolean avisos = false; |
||
58 | for(Object[] validationRolesObj: validationRoles) |
||
59 | { |
||
60 | String role = ((String) validationRolesObj[0]); |
||
61 | |||
62 | if(role == null || role.trim().length() == 0) |
||
63 | { |
||
64 | avisos = true; |
||
65 | %> |
||
66 | <div class="alert alert-warning">Atenção o curso <%=validationRolesObj[1]%> (<%=validationRolesObj[2]%>) não tem papel de comissão de curso associado</div> |
||
67 | <% |
||
68 | }else{ |
||
69 | comissionsRoles.add(role); |
||
70 | } |
||
71 | } |
||
72 | if(avisos) |
||
73 | { |
||
74 | %> |
||
75 | <script> |
||
76 | $(document).ready(function() |
||
77 | { |
||
78 | $(".avisosWarning").show(); |
||
79 | }); |
||
80 | </script> |
||
81 | <% |
||
82 | } |
||
83 | %> |
||
84 | </div> |
||
85 | <% |
||
86 | } |
||
87 | else |
||
88 | { |
||
89 | UserSession.getUser().getRolesList(); |
||
90 | comissionsRoles = new ArrayList<String>(); |
||
91 | for(String role: UserSession.getUser().getRolesList()) |
||
92 | { |
||
93 | if(role.startsWith(Globals.COURSE_COMMISSION_PROGRAMS_ROLES_PREFIX)) |
||
94 | comissionsRoles.add(role); |
||
95 | } |
||
96 | } |
||
97 | if(comissionsRoles.size() == 0) |
||
98 | { |
||
99 | %> |
||
100 | <div class="alert alert-warning"> |
||
101 | Lamentamos mas não têm qualquer comissão de curso associada |
||
102 | </div> |
||
103 | <% |
||
104 | } |
||
105 | else |
||
106 | { |
||
107 | %> |
||
108 | <script> |
||
109 | $(document).ready( |
||
110 | function() |
||
111 | { |
||
112 | $("#ROLE_VALIDATION_<%=comissionsRoles.get(0)%>").show(); |
||
113 | } |
||
114 | ); |
||
115 | function showRoleSeparator(role) |
||
116 | { |
||
117 | <% |
||
118 | for(String roleCourse: comissionsRoles) |
||
119 | { |
||
120 | %> |
||
121 | if(role == '<%=roleCourse%>') |
||
122 | { |
||
123 | $("#ROLE_VALIDATION_<%=roleCourse%>").show(); |
||
124 | $("#rolesSeparators<%=roleCourse%>").addClass("active"); |
||
125 | } |
||
126 | else |
||
127 | { |
||
128 | $("#ROLE_VALIDATION_<%=roleCourse%>").hide(); |
||
129 | $("#rolesSeparators<%=roleCourse%>").removeClass("active"); |
||
130 | } |
||
131 | <% |
||
132 | } |
||
133 | %> |
||
134 | } |
||
135 | </script> |
||
136 | <% |
||
137 | try |
||
138 | { |
||
139 | AbstractDao.getCurrentSession().beginTransaction(); |
||
140 | |||
1372 | jmachado | 141 | if(all == null) |
142 | { |
||
1354 | jmachado | 143 | %> |
1372 | jmachado | 144 | <div class="row"> |
145 | <div class="dropdown col-sm-3"> |
||
146 | <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Escolha Comissão |
||
147 | <span class="caret"></span></button> |
||
148 | <ul class="dropdown-menu"> |
||
149 | <%--<ul class="nav nav-tabs">--%> |
||
150 | <% |
||
151 | for(String roleCourse: comissionsRoles) |
||
152 | { |
||
153 | request.setAttribute("roleCourse",roleCourse); |
||
154 | %> |
||
155 | <li id="rolesSeparators<%=roleCourse%>"><a href="javascript:showRoleSeparator('<%=roleCourse%>')"><bean:message key="user.role.${roleCourse}"/></a></li> |
||
156 | <% |
||
157 | } |
||
158 | %> |
||
159 | </ul> |
||
160 | </div> |
||
161 | <div class="col-sm-3"> |
||
162 | <html:link styleClass="btn btn-default" action="/user/startLoadCourseCourseUnitsStatistics?all=true">Mostrar Tudo na mesma tabela</html:link> |
||
163 | </div> |
||
1354 | jmachado | 164 | </div> |
165 | |||
166 | <% |
||
1372 | jmachado | 167 | } |
168 | else if(all!=null && all.equals("true")) |
||
169 | { |
||
170 | %> |
||
171 | <html:link styleClass="btn btn-default" action="/user/startLoadCourseCourseUnitsStatistics">Filtrar por Comissão de Curso</html:link> |
||
172 | <table class="tablesorter tablesorterfiltered"> |
||
173 | <thead> |
||
174 | <tr> |
||
175 | <th>Cod Curso.</th> |
||
176 | <th class="filter-name filter-select">Curso</th> |
||
177 | <th>Cod.</th> |
||
178 | <th class="filter-name filter-select">Sem.</th> |
||
179 | <th>Nome</th> |
||
180 | |||
181 | |||
182 | <th>Sums</th> |
||
183 | <th>Sums Pre</th> |
||
184 | <th>Sums Falt</th> |
||
185 | |||
1373 | jmachado | 186 | <th>Plan.</th> |
1372 | jmachado | 187 | <th class="filter-name filter-select">Ficha</th> |
188 | <th>Aval.Enu</th> |
||
189 | <th>Aval.Paut</th> |
||
190 | <th class="filter-name filter-select">Relat.</th> |
||
191 | <th class="filter-name filter-select">Pedag.</th> |
||
192 | |||
193 | <th>Conteud.</th> |
||
194 | <th class="filter-name filter-select">Detalhes</th> |
||
195 | |||
196 | </tr> |
||
197 | </thead> |
||
198 | <tbody> |
||
199 | <% |
||
200 | } |
||
1354 | jmachado | 201 | for(String roleCourse: comissionsRoles) |
202 | { |
||
203 | request.setAttribute("roleCourse",roleCourse); |
||
1372 | jmachado | 204 | if(all == null) |
205 | { |
||
1354 | jmachado | 206 | %> |
207 | <div id="ROLE_VALIDATION_<%=roleCourse%>" style="display: none"> |
||
208 | <h1><bean:message key="user.role.${roleCourse}"/></h1> |
||
209 | <% |
||
1372 | jmachado | 210 | } |
1354 | jmachado | 211 | Criteria c = AbstractDao.getCurrentSession().createCriteria(CourseUnit.class) |
212 | .setProjection(Projections.projectionList() |
||
213 | .add(Projections.groupProperty("c.id")) |
||
214 | .add(Projections.property("c.name")) |
||
215 | .add(Projections.property("c.code"))) |
||
216 | .createAlias("course", "c") |
||
217 | .add(eq("importYear", UserSession.getNowConfiguration().getInterfaceImportYear())) |
||
218 | .add(eq("c.validationRole", roleCourse)); |
||
219 | List<Object[]> coursesForRole = c.list(); |
||
220 | |||
1372 | jmachado | 221 | if(all==null && coursesForRole.size() > 1) |
1354 | jmachado | 222 | { |
223 | %> |
||
224 | <div class="alert alert-info alert-small">Mais que um curso para o papel <bean:message key="user.role.${roleCourse}"/></div> |
||
225 | <% |
||
226 | } |
||
1372 | jmachado | 227 | if(all == null) |
228 | { |
||
1354 | jmachado | 229 | %> |
230 | <hr/> |
||
231 | <% |
||
1372 | jmachado | 232 | } |
233 | |||
234 | |||
1354 | jmachado | 235 | for(Object[] courseArray: coursesForRole) |
236 | { |
||
237 | Long courseId = (Long) courseArray[0]; |
||
238 | String courseName = (String) courseArray[1]; |
||
239 | String courseCode = (String) courseArray[2]; |
||
240 | |||
241 | c = AbstractDao.getCurrentSession().createCriteria(CourseUnit.class) |
||
242 | .setProjection(Projections.distinct(Projections.property("id"))) |
||
243 | .createAlias("course", "c") |
||
244 | .add(eq("importYear", UserSession.getNowConfiguration().getInterfaceImportYear())) |
||
245 | .add(eq("c.id", courseId)) |
||
246 | ; |
||
247 | c.addOrder(Order.asc("name")); |
||
248 | List<Long> courseUnits = c.list(); |
||
249 | |||
1372 | jmachado | 250 | if(all==null && courseUnits.size() == 0) |
1354 | jmachado | 251 | { |
252 | %> |
||
253 | <h2><bean:message key="user.role.${roleCourse}"/> </h2> |
||
254 | <div class="alert alert-info alert-small"> |
||
255 | Não foram encontradas unidades curriculares no ano ${UserSession.nowConfiguration.interfaceImportYear} |
||
256 | </div> |
||
257 | <% |
||
258 | } |
||
259 | else |
||
260 | { |
||
261 | // |
||
262 | // List<Student> students = DaoFactory.getStudentDaoImpl().loadFromCoursesWithValidationRoles(comissionsRoles,UserSession.getNowConfiguration().getInterfaceImportYear()); |
||
1372 | jmachado | 263 | if(all == null) |
264 | { |
||
1354 | jmachado | 265 | %> |
266 | <h2><%=courseName%> (<%=courseCode%>)</h2> |
||
267 | <div class="alert alert-info alert-small"> |
||
268 | Existem <%=courseUnits.size()%> unidades no ano ${UserSession.nowConfiguration.interfaceImportYear} |
||
269 | </div> |
||
270 | |||
271 | <table class="tablesorter tablesorterfiltered"> |
||
272 | <thead> |
||
273 | <tr> |
||
274 | <th>Cod.</th> |
||
275 | <th class="filter-name filter-select">Sem.</th> |
||
276 | <th>Nome</th> |
||
277 | |||
278 | |||
279 | <th>Sums</th> |
||
280 | <th>Sums Pre</th> |
||
281 | <th>Sums Falt</th> |
||
282 | |||
283 | <th>Plan</th> |
||
284 | <th class="filter-name filter-select">Ficha</th> |
||
285 | <th>Aval.Enu</th> |
||
286 | <th>Aval.Paut</th> |
||
287 | <th class="filter-name filter-select">Relat.</th> |
||
288 | <th class="filter-name filter-select">Pedag.</th> |
||
289 | |||
290 | <th>Conteud.</th> |
||
291 | <th class="filter-name filter-select">Detalhes</th> |
||
292 | |||
293 | </tr> |
||
294 | </thead> |
||
295 | <tbody> |
||
296 | <% |
||
1372 | jmachado | 297 | } |
1354 | jmachado | 298 | for(Long unit: courseUnits) |
299 | { |
||
300 | Long unitId = unit; |
||
301 | CourseUnit cu = DaoFactory.getCourseUnitDaoImpl().load(unitId); |
||
302 | request.setAttribute("cu",cu); |
||
303 | %> |
||
304 | <tr> |
||
1372 | jmachado | 305 | <% |
306 | if(all != null && all.equals("true")) |
||
307 | { |
||
308 | %> |
||
309 | <td><%=courseCode%></td> |
||
310 | <td><%=courseName%></td> |
||
311 | <% |
||
312 | } |
||
313 | %> |
||
1354 | jmachado | 314 | <td>${cu.code}</td> |
315 | <td>${cu.semestre}</td> |
||
316 | <td><html:link target="_blank" action="/user/startLoadCourseUnitFromHome?id=${cu.id}"> ${cu.name}</html:link></td> |
||
317 | <td>${cu.statdtpSumaries}</td> |
||
318 | <td>${cu.statdtpSumariesPrelancados}</td> |
||
319 | <td>${cu.statdtpSumariesMissing}</td> |
||
320 | <td>${cu.statdtpPlaneamentoFiles}</td> |
||
321 | <td><bean:message key="yes.no.${cu.statdtpFichaCurricularValid}"/></td> |
||
322 | <td>${cu.statdtpAvaliacaoEnunciadosFiles}</td> |
||
323 | <td>${cu.statdtpAvaliacaoPautasFiles}</td> |
||
324 | <td>${cu.statdtpEvaluationReportState}</td> |
||
325 | <td>${cu.statdtpInqueritoPedagogicoFiles}</td> |
||
326 | <td>${cu.statcontentsFiles}</td> |
||
327 | <td><button class="btn btn-default" data-href="<%=request.getContextPath()%>/user/courseunits/statsAjax.jsp?courseUnitId=${cu.id}" data-title="Estatisticas da Unidade ${cu.name} (${cu.code})" data-toggle="modal" data-target="#modalAjaxRequest"><span class="glyphicon glyphicon-zoom-in"/></button> </td> |
||
328 | </tr> |
||
329 | <% |
||
330 | } |
||
1372 | jmachado | 331 | |
332 | if(all == null) |
||
333 | { |
||
334 | %> |
||
335 | |||
1354 | jmachado | 336 | </tbody> |
337 | </table> |
||
338 | |||
339 | <% |
||
1372 | jmachado | 340 | } |
1354 | jmachado | 341 | } |
342 | |||
343 | } |
||
344 | |||
1372 | jmachado | 345 | if(all == null) |
346 | { |
||
1354 | jmachado | 347 | %> |
348 | </div> <!--FIM DE ROLE VALIDATION--> |
||
349 | <% |
||
1372 | jmachado | 350 | } |
351 | |||
1354 | jmachado | 352 | } |
1372 | jmachado | 353 | if(all != null && all.equals("true")) |
354 | { |
||
355 | %> |
||
356 | </tbody> |
||
357 | </table> |
||
358 | <% |
||
359 | } |
||
1354 | jmachado | 360 | AbstractDao.getCurrentSession().getTransaction().commit(); |
361 | } |
||
362 | catch(Exception e) |
||
363 | { |
||
364 | System.out.println(e.toString()); |
||
365 | e.printStackTrace(); |
||
366 | } |
||
367 | } |
||
368 | |||
369 | %> |
||
370 | |||
371 | </div> |
||
372 | </div> |
||
373 |