Subversion Repositories bacoAlunos

Rev

Rev 1626 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1337 jmachado 1
<%@ page import="jomm.dao.impl.AbstractDao" %>
2
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
1346 jmachado 3
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
4
<%@ page import="pt.estgp.estgweb.domain.*" %>
1626 jmachado 5
<%@ page import="pt.estgp.estgweb.services.questionarios.pedagogico.UpdateCoursesAndUnitsJobService" %>
1337 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" %>
1346 jmachado 14
 
1337 jmachado 15
<%
16
    long cursoAfetoId = Long.parseLong(request.getParameter("cursoAfetoId"));
17
    AbstractDao.getCurrentSession().beginTransaction();
18
    QuestionarioPedagogicoCursoAfeto cursoAfeto = DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().load(cursoAfetoId);
19
    cursoAfeto = DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().narrow(cursoAfeto);
20
    request.setAttribute("CursoAfeto",cursoAfeto);
1346 jmachado 21
    Questionario q = cursoAfeto.getQuestionario();
22
     q = DaoFactory.getQuestionarioDaoImpl().narrow(q);
23
    ((QuestionarioImpl)q).initClearances((UserSessionImpl) UserSessionProxy.loadUserSessionFromRequest(request),false);
24
    request.setAttribute("Questionario",q);
1627 jmachado 25
 
1337 jmachado 26
%>
1346 jmachado 27
<jsp:useBean id="Questionario" type="pt.estgp.estgweb.domain.QuestionarioImpl" scope="request"/>
1338 jmachado 28
<script>
29
    $(document).ready(
30
 
31
            function()
32
            {
33
                $("#cursoAfetoTable${CursoAfeto.id} .usarCheck").each(function()
34
                {
35
                    if($(this).prop("checked"))
36
                    {
37
                        $(this).closest("td").addClass("usarChecked");
38
                        $(this).closest("td").removeClass("usarNotChecked");
39
                    }
40
                    else
41
                    {
42
                        $(this).closest("td").removeClass("usarChecked");
43
                        $(this).closest("td").addClass("usarNotChecked");
44
                    }
45
                }
46
                );
1626 jmachado 47
 
1338 jmachado 48
                $("#cursoAfetoTable${CursoAfeto.id} .vistaCheck").each(function()
49
                {
50
                    if($(this).prop("checked"))
51
                    {
52
                        $(this).closest("td").addClass("vistaChecked");
53
                        $(this).closest("td").removeClass("vistaNotChecked");
54
                    }
55
                    else
56
                    {
57
                        $(this).closest("td").removeClass("vistaChecked");
58
                        $(this).closest("td").addClass("vistaNotChecked");
59
                    }
60
                });
1378 jmachado 61
                $("#cursoAfetoTable${CursoAfeto.id} .vistaCheckProfs").each(function()
62
                {
63
                    if($(this).prop("checked"))
64
                    {
65
                        $(this).closest("td").addClass("vistaChecked");
66
                        $(this).closest("td").removeClass("vistaNotChecked");
67
                    }
68
                    else
69
                    {
70
                        $(this).closest("td").removeClass("vistaChecked");
71
                        $(this).closest("td").addClass("vistaNotChecked");
72
                    }
73
                });
1338 jmachado 74
 
75
                $("#cursoAfetoTable${CursoAfeto.id} .usarCheck").on("change",function()
76
                {
77
                    if($(this).prop("checked"))
78
                    {
79
                        $(this).closest("td").addClass("usarChecked");
80
                        $(this).closest("td").removeClass("usarNotChecked");
81
                    }
82
                    else
83
                    {
84
                        $(this).closest("td").removeClass("usarChecked");
85
                        $(this).closest("td").addClass("usarNotChecked");
86
                    }
87
                });
88
 
89
                $("#cursoAfetoTable${CursoAfeto.id} .vistaCheck").on("change",function()
90
                {
91
                    if($(this).prop("checked"))
92
                    {
93
                        $(this).closest("td").addClass("vistaChecked");
94
                        $(this).closest("td").removeClass("vistaNotChecked");
95
                    }
96
                    else
97
                    {
98
                        $(this).closest("td").removeClass("vistaChecked");
99
                        $(this).closest("td").addClass("vistaNotChecked");
100
                    }
101
                });
1378 jmachado 102
 
103
                $("#cursoAfetoTable${CursoAfeto.id} .vistaCheckProfs").on("change",function()
104
                {
105
                    if($(this).prop("checked"))
106
                    {
107
                        $(this).closest("td").addClass("vistaChecked");
108
                        $(this).closest("td").removeClass("vistaNotChecked");
109
                    }
110
                    else
111
                    {
112
                        $(this).closest("td").removeClass("vistaChecked");
113
                        $(this).closest("td").addClass("vistaNotChecked");
114
                    }
115
                });
1338 jmachado 116
            }
117
    );
118
</script>
119
    <table id="cursoAfetoTable${CursoAfeto.id}" class="tablesorter-blue">
1337 jmachado 120
        <thead>
121
        <tr>
1338 jmachado 122
            <th></th>
1337 jmachado 123
            <th>Codigo</th>
124
            <th>Nome</th>
1338 jmachado 125
            <%--<th>Tipologias Manuais</th>--%>
1337 jmachado 126
            <th>Turmas</th>
127
            <th>Docentes</th>
1338 jmachado 128
            <th>Estudantes</th>
129
            <th>Alertas</th>
1341 jmachado 130
            <th>Docentes s/ sumario</th>
131
            <th>Turmas s/ sumario</th>
1626 jmachado 132
            <th>Escluidas</th>
1338 jmachado 133
            <th>Usar</th>
1395 jmachado 134
            <th>Alunos OK</th>
135
            <th>Profs OK</th>
1338 jmachado 136
            <th>Obs.</th>
1422 jmachado 137
            <th data-toggle="tooltip" data-placement="top" title="Tipologias Requisitadas para Responder">Tip. Req</th>
138
            <th data-toggle="tooltip" data-placement="top" title="Respostas Requisitadas para Responder">Resp. Req</th>
1337 jmachado 139
        </tr>
140
        </thead>
141
        <tbody>
142
            <logic:iterate id="unidade" name="CursoAfeto" property="unidadesAfetas" type="pt.estgp.estgweb.domain.QuestionarioPedagogicoUnidadeCurricularAfetaImpl">
1626 jmachado 143
                 <%
144
                     if(unidade.checkSincronizationDirty())
145
                     {
146
                        UpdateCoursesAndUnitsJobService.updateCountersUnidadeAfeta(unidade);
147
                     }
1627 jmachado 148
 
1626 jmachado 149
                 %>
1338 jmachado 150
                 <tr id="unidadeAfetaRow${unidade.id}">
151
                     <td>
152
                         <script>
153
                             $(document).ready(
154
                                     function()
155
                                     {
156
                                         $('#tipologias${unidade.id}').on('shown.bs.collapse', function () {
157
                                             $("#tipologias${unidade.id}Button .glyphicon").removeClass("glyphicon-zoom-in").addClass("glyphicon-zoom-out");
158
                                         });
159
                                         $('#tipologias${unidade.id}').on('hidden.bs.collapse', function () {
160
                                             $("#tipologias${unidade.id}Button .glyphicon").removeClass("glyphicon-zoom-out").addClass("glyphicon-zoom-in");
161
                                         });
162
 
163
                                         $("#unidadeAfetaRow${unidade.id} .usarCheck").on("change",function(){
164
                                            var val =$(this).prop("checked") ? "true" : "false";
165
                                            var op = "usar";
166
                                            setUnidadeAfetaVar('${CursoAfeto.id}','${unidade.id}',op,val,$(this).closest("td"));
167
                                         });
168
                                         $("#unidadeAfetaRow${unidade.id} .vistaCheck").on("change",function()
169
                                         {
170
                                             var val =$(this).prop("checked") ? "true" : "false";
171
                                             var op = "vista";
172
                                             setUnidadeAfetaVar('${CursoAfeto.id}','${unidade.id}',op,val,$(this).closest("td"));
173
                                         });
1378 jmachado 174
                                         $("#unidadeAfetaRow${unidade.id} .vistaCheckProfs").on("change",function()
175
                                         {
176
                                             var val =$(this).prop("checked") ? "true" : "false";
177
                                             var op = "vistaProfs";
178
                                             setUnidadeAfetaVar('${CursoAfeto.id}','${unidade.id}',op,val,$(this).closest("td"));
179
                                         });
180
 
1338 jmachado 181
                                     }
182
 
183
                             );
184
                         </script>
185
                         <button id="tipologias${unidade.id}Button" class="btn btn-default btn-small" type="button" data-toggle="collapse" data-target="#tipologias${unidade.id}"><span class="glyphicon glyphicon-zoom-in"></span></button>
186
                         <script>
187
                             $(document).ready(
188
                                     function(){
1627 jmachado 189
                                         $.post("<%=request.getContextPath()%>/user/questionarios/pedagogicoEstudante/pedagogicoCourseCheckUnidadeAfeta.jsp?unidadeAfetaId=${unidade.id}", function(data)
190
                                         {
1338 jmachado 191
                                             $("#tipologias${unidade.id} .tipologias")
192
                                                     .html(data);
193
                                             evaluateTableSortersInside("#tipologias${unidade.id} .tipologias");
194
                                         });
195
                                     }
196
                             );
197
                         </script>
198
                     </td>
1337 jmachado 199
                    <td>${unidade.codigoUnidade}</td>
200
                    <td>
201
                        <html:link target="_blank"  action="/user/startLoadCourseUnitFromHome.do?id=${unidade.courseUnit.id}">
202
                            ${unidade.nome}
203
                        </html:link>
204
                    </td>
1338 jmachado 205
                   <%-- <td>${unidade.addedTipologias}</td>--%>
1337 jmachado 206
                    <td>
1346 jmachado 207
                        <a href="#" data-href="<%=request.getContextPath()%>/user/questionarios/pedagogicoEstudante/listCunitTurmas.jsp?courseUnitId=${unidade.courseUnit.id}" data-title="Turmas da Unidade ${unidade.nome} (${unidade.codigoUnidade}) do curso de ${CursoAfeto.nome} (${CursoAfeto.codigoCurso})" data-toggle="modal" data-target="#modalAjaxRequest">
1337 jmachado 208
                            ${unidade.turmas}
209
                        </a>
210
                    <td>
211
                        <a href="#" data-href="<%=request.getContextPath()%>/user/courseunits/teachersInfo.jsp?courseUnitId=${unidade.courseUnit.id}" data-title="Docentes da unidade de ${unidade.nome} (${unidade.codigoUnidade}) do curso de ${CursoAfeto.nome} (${CursoAfeto.codigoCurso})" data-toggle="modal" data-target="#modalAjaxRequest">
212
                            ${unidade.profs}
213
                        </a>
214
 
215
                    </td>
1338 jmachado 216
                     <td>
1341 jmachado 217
 
218
                         <%
1627 jmachado 219
                             CourseUnitImpl courseUnitImpl = (CourseUnitImpl) DaoFactory.getCourseUnitDaoImpl().narrow(unidade.getCourseUnit());
220
 
1626 jmachado 221
                             try{
1341 jmachado 222
                             int students = courseUnitImpl.studentsSize();
223
                             int studentsTurmasSize = courseUnitImpl.studentsTurmaSize();
224
                             if(students != studentsTurmasSize)
225
                             {
226
                                 unidade.setMarked(true);
227
                                 if(unidade.getObs() != null && unidade.getObs().indexOf("Nº Estudantes")< 0)
1396 jmachado 228
                                    unidade.addObs(" - Nº Estudantes diferente Somatorio Estudantes das turmas");
1341 jmachado 229
                         %>
1338 jmachado 230
                         <a href="#" data-href="<%=request.getContextPath()%>/user/courseunits/listStudentsService.jsp?courseUnitView.id=${unidade.courseUnit.id}" data-title="Alunos da unidade de ${unidade.nome} (${unidade.codigoUnidade}) do curso de ${CursoAfeto.nome} (${CursoAfeto.codigoCurso})" data-toggle="modal" data-target="#modalAjaxRequest">
1341 jmachado 231
                         <%=students%>
1338 jmachado 232
                         </a>
1341 jmachado 233
                         !=
234
                         <a href="#" data-href="<%=request.getContextPath()%>/user/courseunits/listStudentsService.jsp?courseUnitView.id=${unidade.courseUnit.id}" data-title="Alunos da unidade de ${unidade.nome} (${unidade.codigoUnidade}) do curso de ${CursoAfeto.nome} (${CursoAfeto.codigoCurso})" data-toggle="modal" data-target="#modalAjaxRequest">
235
                                     <%=studentsTurmasSize%>
236
                         </a>
237
                         <span class="glyphicon glyphicon-alert"></span>
238
 
239
                         <%
1626 jmachado 240
                             }
241
                             else
242
                             {
1341 jmachado 243
                         %>
244
                         <a href="#" data-href="<%=request.getContextPath()%>/user/courseunits/listStudentsService.jsp?courseUnitView.id=${unidade.courseUnit.id}" data-title="Alunos da unidade de ${unidade.nome} (${unidade.codigoUnidade}) do curso de ${CursoAfeto.nome} (${CursoAfeto.codigoCurso})" data-toggle="modal" data-target="#modalAjaxRequest">
245
                             <%=students%>
246
                         </a>
247
                         <%
248
                             }
1627 jmachado 249
                             }
250
                             catch(Throwable e)
251
                             {
252
                                 System.out.println("Session: open:" + AbstractDao.getCurrentSession().isOpen() + " connected:" + AbstractDao.getCurrentSession().isConnected() +" CU:" + courseUnitImpl.getId() + " : " + e.toString());
253
 
254
                             }
1341 jmachado 255
                         %>
256
 
1338 jmachado 257
                     </td>
1337 jmachado 258
                    <td>
259
                        <logic:equal value="true" name="unidade" property="marked">
260
                            <span class="glyphicon glyphicon-alert"></span>
261
                        </logic:equal>
262
                    </td>
1626 jmachado 263
                    <td>${unidade.profsWithoutTurma}</td><%--PROFS SEM SUMARIO--%>
264
                    <td>${unidade.turmaWithoutProf}</td><%--Turmas Sem Sumario--%>
265
                    <td>${unidade.excludedTipologias}</td>
1337 jmachado 266
                    <td>
1395 jmachado 267
                        <baco:clearOperation name="Questionario" op="QUESTIONARIO_CHANGE_ASSIGNEMENTS_USE_UNIT">
1346 jmachado 268
                            <html:checkbox styleClass="usarCheck" name="unidade" property="usar"/>
269
                        </baco:clearOperation>
1403 jmachado 270
                        <baco:notClearOperation name="Questionario" op="QUESTIONARIO_CHANGE_ASSIGNEMENTS_USE_UNIT">
271
                            <html:checkbox styleClass="usarCheck" name="unidade" property="usar" disabled="true"/>
272
                        </baco:notClearOperation>
1337 jmachado 273
                    </td>
1338 jmachado 274
                    <td>
1346 jmachado 275
                        <baco:clearOperation name="Questionario" op="QUESTIONARIO_CHANGE_ASSIGNEMENTS">
276
                            <html:checkbox styleClass="vistaCheck" name="unidade" property="vista"/>
277
                        </baco:clearOperation>
1378 jmachado 278
                        <baco:notClearOperation name="Questionario" op="QUESTIONARIO_CHANGE_ASSIGNEMENTS">
279
                            <html:checkbox disabled="true" styleClass="vistaCheck" name="unidade" property="vista"/>
280
                        </baco:notClearOperation>
1338 jmachado 281
                    </td>
1378 jmachado 282
                    <td>
283
                         <baco:clearOperation name="Questionario" op="QUESTIONARIO_CHANGE_ASSIGNEMENTS_CHECK_TEACHERS">
284
                             <html:checkbox styleClass="vistaCheckProfs" name="unidade" property="vistaProfs"/>
285
                         </baco:clearOperation>
286
                        <baco:notClearOperation name="Questionario" op="QUESTIONARIO_CHANGE_ASSIGNEMENTS_CHECK_TEACHERS">
287
                            <html:checkbox disabled="true" styleClass="vistaCheckProfs" name="unidade" property="vistaProfs"/>
288
                        </baco:notClearOperation>
289
                    </td>
1340 jmachado 290
                    <td id="editObsTd${unidade.id}" <%=unidade.getObs() != null && unidade.getObs().trim().length() > 0 ? "class=\"obsContent\"":""%>>
1346 jmachado 291
                         <button class="btn btn-warning btn-small" type="button" data-href="<%=request.getContextPath()%>/user/questionarios/pedagogicoEstudante/questionarioObsEdit.jsp?unidadeAfetaId=${unidade.id}&targetSetVarId=editObsTd${unidade.id}" data-title="Observações para a unidade ${unidade.nome} (${unidade.codigoUnidade}) do curso de ${CursoAfeto.nome} (${CursoAfeto.codigoCurso})" data-toggle="modal" data-target="#modalAjaxRequest"><span class="glyphicon glyphicon-pencil"></span></button>
1338 jmachado 292
                    </td>
1394 jmachado 293
                     <td><%=unidade.getStatTipologiasRequisitadas()%></td>
294
                     <td><%=unidade.getStatRespostasRequisitadas()%></td>
1337 jmachado 295
                </tr>
296
                <tr class="collapse" id="tipologias${unidade.id}">
1338 jmachado 297
                    <td></td>
1422 jmachado 298
                    <td colspan="14" class="tipologias" style="padding-left: 25px">
1337 jmachado 299
 
300
                        <div class="panel panel-default">
301
                            <div class="panel-body">
302
                                <p>Por favor aguarde um momento, o sistema está a carregar as tipologias <img src="<%=request.getContextPath()%>/imgs/wait.gif"/></p>
303
                            </div>
304
                        </div>
305
                    </td>
306
                </tr>
307
            <%
1341 jmachado 308
                    //DaoFactory.getQuestionarioPedagogicoUnidadeCurricularAfetaDaoImpl().evict(unidade);
1337 jmachado 309
            %>
310
            </logic:iterate>
311
        </tbody>
312
    </table>
313
 
314
<%
315
    DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().evict(cursoAfeto);
316
    AbstractDao.getCurrentSession().getTransaction().commit();
317
%>