Rev 1372 | Go to most recent revision | Details | 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 | |||
24 | <div class="panel panel-default"> |
||
25 | <div class="panel-heading"> |
||
26 | Estatisticas Unidades nos Cursos |
||
27 | </div> |
||
28 | <div class="panel-body"> |
||
29 | |||
30 | <% |
||
31 | boolean allCourses = false; |
||
32 | List<String> comissionsRoles = null; |
||
33 | if(UserSession.getUser().isSuperuserOrAdmin() || UserSession.getUser().hasRole(Globals.SERVICES_PROGRAMS_ROLE) || UserSession.getUser().hasRole(Globals.COURSE_DIRECTOR_ROLE) || UserSession.getUser().hasRole(Globals.COURSE_COORDINATOR_ROLE) || UserSession.getUser().hasRole("services")) |
||
34 | { |
||
35 | allCourses = true; |
||
36 | AbstractDao.getCurrentSession().beginTransaction(); |
||
37 | Criteria c = AbstractDao.getCurrentSession().createCriteria(CourseUnit.class) |
||
38 | .setProjection(Projections.projectionList().add(Projections.groupProperty("c.validationRole")) |
||
39 | .add(Projections.property("c.id")).add(Projections.property("c.name")).add(Projections.property("c.code"))) |
||
40 | .createAlias("course", "c") |
||
41 | .add(eq("importYear", UserSession.getNowConfiguration().getInterfaceImportYear())); |
||
42 | List<Object[]> validationRoles = c.list(); |
||
43 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
44 | comissionsRoles = new ArrayList<String>(); |
||
45 | |||
46 | %> |
||
47 | <div class="avisosWarning" style="display: none"> |
||
48 | <div class="alert alert-warning">Existem cursos sem papel de comissão atribuido |
||
49 | <button class="btn btn-warning" onclick="$('.avisos').toggle()">Ver/Ocultar Avisos</button> |
||
50 | </div> |
||
51 | </div> |
||
52 | <div class="avisos" style="display: none"> |
||
53 | <% |
||
54 | boolean avisos = false; |
||
55 | for(Object[] validationRolesObj: validationRoles) |
||
56 | { |
||
57 | String role = ((String) validationRolesObj[0]); |
||
58 | |||
59 | if(role == null || role.trim().length() == 0) |
||
60 | { |
||
61 | avisos = true; |
||
62 | %> |
||
63 | <div class="alert alert-warning">Atenção o curso <%=validationRolesObj[1]%> (<%=validationRolesObj[2]%>) não tem papel de comissão de curso associado</div> |
||
64 | <% |
||
65 | }else{ |
||
66 | comissionsRoles.add(role); |
||
67 | } |
||
68 | } |
||
69 | if(avisos) |
||
70 | { |
||
71 | %> |
||
72 | <script> |
||
73 | $(document).ready(function() |
||
74 | { |
||
75 | $(".avisosWarning").show(); |
||
76 | }); |
||
77 | </script> |
||
78 | <% |
||
79 | } |
||
80 | %> |
||
81 | </div> |
||
82 | <% |
||
83 | } |
||
84 | else |
||
85 | { |
||
86 | UserSession.getUser().getRolesList(); |
||
87 | comissionsRoles = new ArrayList<String>(); |
||
88 | for(String role: UserSession.getUser().getRolesList()) |
||
89 | { |
||
90 | if(role.startsWith(Globals.COURSE_COMMISSION_PROGRAMS_ROLES_PREFIX)) |
||
91 | comissionsRoles.add(role); |
||
92 | } |
||
93 | } |
||
94 | if(comissionsRoles.size() == 0) |
||
95 | { |
||
96 | %> |
||
97 | <div class="alert alert-warning"> |
||
98 | Lamentamos mas não têm qualquer comissão de curso associada |
||
99 | </div> |
||
100 | <% |
||
101 | } |
||
102 | else |
||
103 | { |
||
104 | %> |
||
105 | <script> |
||
106 | $(document).ready( |
||
107 | function() |
||
108 | { |
||
109 | $("#ROLE_VALIDATION_<%=comissionsRoles.get(0)%>").show(); |
||
110 | } |
||
111 | ); |
||
112 | function showRoleSeparator(role) |
||
113 | { |
||
114 | <% |
||
115 | for(String roleCourse: comissionsRoles) |
||
116 | { |
||
117 | %> |
||
118 | if(role == '<%=roleCourse%>') |
||
119 | { |
||
120 | $("#ROLE_VALIDATION_<%=roleCourse%>").show(); |
||
121 | $("#rolesSeparators<%=roleCourse%>").addClass("active"); |
||
122 | } |
||
123 | else |
||
124 | { |
||
125 | $("#ROLE_VALIDATION_<%=roleCourse%>").hide(); |
||
126 | $("#rolesSeparators<%=roleCourse%>").removeClass("active"); |
||
127 | } |
||
128 | <% |
||
129 | } |
||
130 | %> |
||
131 | } |
||
132 | </script> |
||
133 | <% |
||
134 | try |
||
135 | { |
||
136 | AbstractDao.getCurrentSession().beginTransaction(); |
||
137 | |||
138 | %> |
||
139 | <div class="dropdown"> |
||
140 | <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Escolha Comissão |
||
141 | <span class="caret"></span></button> |
||
142 | <ul class="dropdown-menu"> |
||
143 | <%--<ul class="nav nav-tabs">--%> |
||
144 | <% |
||
145 | for(String roleCourse: comissionsRoles) |
||
146 | { |
||
147 | request.setAttribute("roleCourse",roleCourse); |
||
148 | %> |
||
149 | <li id="rolesSeparators<%=roleCourse%>"><a href="javascript:showRoleSeparator('<%=roleCourse%>')"><bean:message key="user.role.${roleCourse}"/></a></li> |
||
150 | <% |
||
151 | } |
||
152 | %> |
||
153 | </ul> |
||
154 | </div> |
||
155 | |||
156 | <% |
||
157 | for(String roleCourse: comissionsRoles) |
||
158 | { |
||
159 | request.setAttribute("roleCourse",roleCourse); |
||
160 | %> |
||
161 | <div id="ROLE_VALIDATION_<%=roleCourse%>" style="display: none"> |
||
162 | <h1><bean:message key="user.role.${roleCourse}"/></h1> |
||
163 | <% |
||
164 | Criteria c = AbstractDao.getCurrentSession().createCriteria(CourseUnit.class) |
||
165 | .setProjection(Projections.projectionList() |
||
166 | .add(Projections.groupProperty("c.id")) |
||
167 | .add(Projections.property("c.name")) |
||
168 | .add(Projections.property("c.code"))) |
||
169 | .createAlias("course", "c") |
||
170 | .add(eq("importYear", UserSession.getNowConfiguration().getInterfaceImportYear())) |
||
171 | .add(eq("c.validationRole", roleCourse)); |
||
172 | List<Object[]> coursesForRole = c.list(); |
||
173 | |||
174 | if(coursesForRole.size() > 1) |
||
175 | { |
||
176 | %> |
||
177 | <div class="alert alert-info alert-small">Mais que um curso para o papel <bean:message key="user.role.${roleCourse}"/></div> |
||
178 | <% |
||
179 | } |
||
180 | %> |
||
181 | <hr/> |
||
182 | <% |
||
183 | for(Object[] courseArray: coursesForRole) |
||
184 | { |
||
185 | Long courseId = (Long) courseArray[0]; |
||
186 | String courseName = (String) courseArray[1]; |
||
187 | String courseCode = (String) courseArray[2]; |
||
188 | |||
189 | c = AbstractDao.getCurrentSession().createCriteria(CourseUnit.class) |
||
190 | .setProjection(Projections.distinct(Projections.property("id"))) |
||
191 | .createAlias("course", "c") |
||
192 | .add(eq("importYear", UserSession.getNowConfiguration().getInterfaceImportYear())) |
||
193 | .add(eq("c.id", courseId)) |
||
194 | ; |
||
195 | c.addOrder(Order.asc("name")); |
||
196 | List<Long> courseUnits = c.list(); |
||
197 | |||
198 | if(courseUnits.size() == 0) |
||
199 | { |
||
200 | %> |
||
201 | <h2><bean:message key="user.role.${roleCourse}"/> </h2> |
||
202 | <div class="alert alert-info alert-small"> |
||
203 | Não foram encontradas unidades curriculares no ano ${UserSession.nowConfiguration.interfaceImportYear} |
||
204 | </div> |
||
205 | <% |
||
206 | } |
||
207 | else |
||
208 | { |
||
209 | // |
||
210 | // List<Student> students = DaoFactory.getStudentDaoImpl().loadFromCoursesWithValidationRoles(comissionsRoles,UserSession.getNowConfiguration().getInterfaceImportYear()); |
||
211 | %> |
||
212 | <h2><%=courseName%> (<%=courseCode%>)</h2> |
||
213 | <div class="alert alert-info alert-small"> |
||
214 | Existem <%=courseUnits.size()%> unidades no ano ${UserSession.nowConfiguration.interfaceImportYear} |
||
215 | </div> |
||
216 | |||
217 | <table class="tablesorter tablesorterfiltered"> |
||
218 | <thead> |
||
219 | <tr> |
||
220 | <th>Cod.</th> |
||
221 | <th class="filter-name filter-select">Sem.</th> |
||
222 | <th>Nome</th> |
||
223 | |||
224 | |||
225 | <th>Sums</th> |
||
226 | <th>Sums Pre</th> |
||
227 | <th>Sums Falt</th> |
||
228 | |||
229 | <th>Plan</th> |
||
230 | <th class="filter-name filter-select">Ficha</th> |
||
231 | <th>Aval.Enu</th> |
||
232 | <th>Aval.Paut</th> |
||
233 | <th class="filter-name filter-select">Relat.</th> |
||
234 | <th class="filter-name filter-select">Pedag.</th> |
||
235 | |||
236 | <th>Conteud.</th> |
||
237 | <th class="filter-name filter-select">Detalhes</th> |
||
238 | |||
239 | </tr> |
||
240 | </thead> |
||
241 | <tbody> |
||
242 | <% |
||
243 | for(Long unit: courseUnits) |
||
244 | { |
||
245 | Long unitId = unit; |
||
246 | CourseUnit cu = DaoFactory.getCourseUnitDaoImpl().load(unitId); |
||
247 | request.setAttribute("cu",cu); |
||
248 | %> |
||
249 | <tr> |
||
250 | <td>${cu.code}</td> |
||
251 | <td>${cu.semestre}</td> |
||
252 | <td><html:link target="_blank" action="/user/startLoadCourseUnitFromHome?id=${cu.id}"> ${cu.name}</html:link></td> |
||
253 | <td>${cu.statdtpSumaries}</td> |
||
254 | <td>${cu.statdtpSumariesPrelancados}</td> |
||
255 | <td>${cu.statdtpSumariesMissing}</td> |
||
256 | <td>${cu.statdtpPlaneamentoFiles}</td> |
||
257 | <td><bean:message key="yes.no.${cu.statdtpFichaCurricularValid}"/></td> |
||
258 | <td>${cu.statdtpAvaliacaoEnunciadosFiles}</td> |
||
259 | <td>${cu.statdtpAvaliacaoPautasFiles}</td> |
||
260 | <td>${cu.statdtpEvaluationReportState}</td> |
||
261 | <td>${cu.statdtpInqueritoPedagogicoFiles}</td> |
||
262 | <td>${cu.statcontentsFiles}</td> |
||
263 | <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> |
||
264 | </tr> |
||
265 | <% |
||
266 | } |
||
267 | %> |
||
268 | </tbody> |
||
269 | </table> |
||
270 | |||
271 | <% |
||
272 | } |
||
273 | |||
274 | } |
||
275 | |||
276 | %> |
||
277 | </div> <!--FIM DE ROLE VALIDATION--> |
||
278 | <% |
||
279 | } |
||
280 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
281 | } |
||
282 | catch(Exception e) |
||
283 | { |
||
284 | System.out.println(e.toString()); |
||
285 | e.printStackTrace(); |
||
286 | } |
||
287 | } |
||
288 | |||
289 | %> |
||
290 | |||
291 | </div> |
||
292 | </div> |
||
293 |