Subversion Repositories bacoAlunos

Rev

Rev 1341 | Rev 1378 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@ page import="jomm.dao.impl.AbstractDao" %>
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
<%@ page import="pt.estgp.estgweb.domain.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>

<%
    long cursoAfetoId = Long.parseLong(request.getParameter("cursoAfetoId"));
    AbstractDao.getCurrentSession().beginTransaction();
    QuestionarioPedagogicoCursoAfeto cursoAfeto = DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().load(cursoAfetoId);
    cursoAfeto = DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().narrow(cursoAfeto);
    request.setAttribute("CursoAfeto",cursoAfeto);
    Questionario q = cursoAfeto.getQuestionario();
     q = DaoFactory.getQuestionarioDaoImpl().narrow(q);
    ((QuestionarioImpl)q).initClearances((UserSessionImpl) UserSessionProxy.loadUserSessionFromRequest(request),false);
    request.setAttribute("Questionario",q);
%>
<jsp:useBean id="Questionario" type="pt.estgp.estgweb.domain.QuestionarioImpl" scope="request"/>
<script>
    $(document).ready(

            function()
            {
                $("#cursoAfetoTable${CursoAfeto.id} .usarCheck").each(function()
                {
                    if($(this).prop("checked"))
                    {
                        $(this).closest("td").addClass("usarChecked");
                        $(this).closest("td").removeClass("usarNotChecked");
                    }
                    else
                    {
                        $(this).closest("td").removeClass("usarChecked");
                        $(this).closest("td").addClass("usarNotChecked");
                    }
                }
                );
                $("#cursoAfetoTable${CursoAfeto.id} .vistaCheck").each(function()
                {
                    if($(this).prop("checked"))
                    {
                        $(this).closest("td").addClass("vistaChecked");
                        $(this).closest("td").removeClass("vistaNotChecked");
                    }
                    else
                    {
                        $(this).closest("td").removeClass("vistaChecked");
                        $(this).closest("td").addClass("vistaNotChecked");
                    }
                });

                $("#cursoAfetoTable${CursoAfeto.id} .usarCheck").on("change",function()
                {
                    if($(this).prop("checked"))
                    {
                        $(this).closest("td").addClass("usarChecked");
                        $(this).closest("td").removeClass("usarNotChecked");
                    }
                    else
                    {
                        $(this).closest("td").removeClass("usarChecked");
                        $(this).closest("td").addClass("usarNotChecked");
                    }
                });

                $("#cursoAfetoTable${CursoAfeto.id} .vistaCheck").on("change",function()
                {
                    if($(this).prop("checked"))
                    {
                        $(this).closest("td").addClass("vistaChecked");
                        $(this).closest("td").removeClass("vistaNotChecked");
                    }
                    else
                    {
                        $(this).closest("td").removeClass("vistaChecked");
                        $(this).closest("td").addClass("vistaNotChecked");
                    }
                });
            }
    );
</script>
    <table id="cursoAfetoTable${CursoAfeto.id}" class="tablesorter-blue">
        <thead>
        <tr>
            <th></th>
            <th>Codigo</th>
            <th>Nome</th>
            <%--<th>Tipologias Manuais</th>--%>
            <th>Turmas</th>
            <th>Docentes</th>
            <th>Estudantes</th>
            <th>Alertas</th>
            <th>Docentes s/ sumario</th>
            <th>Turmas s/ sumario</th>
            <th>Usar</th>
            <th>Vista</th>
            <th>Obs.</th>
        </tr>
        </thead>
        <tbody>
            <logic:iterate id="unidade" name="CursoAfeto" property="unidadesAfetas" type="pt.estgp.estgweb.domain.QuestionarioPedagogicoUnidadeCurricularAfetaImpl">
                 <tr id="unidadeAfetaRow${unidade.id}">
                     <td>
                         <script>
                             $(document).ready(
                                     function()
                                     {
                                         $('#tipologias${unidade.id}').on('shown.bs.collapse', function () {
                                             $("#tipologias${unidade.id}Button .glyphicon").removeClass("glyphicon-zoom-in").addClass("glyphicon-zoom-out");
                                         });
                                         $('#tipologias${unidade.id}').on('hidden.bs.collapse', function () {
                                             $("#tipologias${unidade.id}Button .glyphicon").removeClass("glyphicon-zoom-out").addClass("glyphicon-zoom-in");
                                         });

                                         $("#unidadeAfetaRow${unidade.id} .usarCheck").on("change",function(){
                                            var val =$(this).prop("checked") ? "true" : "false";
                                            var op = "usar";
                                            setUnidadeAfetaVar('${CursoAfeto.id}','${unidade.id}',op,val,$(this).closest("td"));
                                         });
                                         $("#unidadeAfetaRow${unidade.id} .vistaCheck").on("change",function()
                                         {
                                             var val =$(this).prop("checked") ? "true" : "false";
                                             var op = "vista";
                                             setUnidadeAfetaVar('${CursoAfeto.id}','${unidade.id}',op,val,$(this).closest("td"));
                                         });
                                     }

                             );
                         </script>
                         <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>
                         <script>
                             $(document).ready(
                                     function(){
                                         $.post("<%=request.getContextPath()%>/user/questionarios/pedagogicoEstudante/pedagogicoCourseCheckUnidadeAfeta.jsp?unidadeAfetaId=${unidade.id}", function(data) {
                                             $("#tipologias${unidade.id} .tipologias")
                                                     .html(data);
                                             evaluateTableSortersInside("#tipologias${unidade.id} .tipologias");
                                         });
                                     }
                             );
                         </script>
                     </td>
                    <td>${unidade.codigoUnidade}</td>
                    <td>
                        <html:link target="_blank"  action="/user/startLoadCourseUnitFromHome.do?id=${unidade.courseUnit.id}">
                            ${unidade.nome}
                        </html:link>
                    </td>
                   <%-- <td>${unidade.addedTipologias}</td>--%>
                    <td>
                        <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">
                            ${unidade.turmas}
                        </a>
                    <td>
                        <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">
                            ${unidade.profs}
                        </a>

                    </td>
                     <td>

                         <%
                             CourseUnitImpl courseUnitImpl = (CourseUnitImpl) DaoFactory.getCourseUnitDaoImpl().narrow(unidade.getCourseUnit());
                             int students = courseUnitImpl.studentsSize();
                             int studentsTurmasSize = courseUnitImpl.studentsTurmaSize();
                             if(students != studentsTurmasSize)
                             {
                                 unidade.setMarked(true);
                                 if(unidade.getObs() != null && unidade.getObs().indexOf("Nº Estudantes")< 0)
                                    unidade.setObs("Nº Estudantes diferente Somatorio Estudantes das turmas");
                         %>
                         <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">
                         <%=students%>
                         </a>
                         !=
                         <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">
                                     <%=studentsTurmasSize%>
                         </a>
                         <span class="glyphicon glyphicon-alert"></span>

                         <%
                         }
                         else
                         {
                         %>
                         <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">
                             <%=students%>
                         </a>
                         <%
                             }
                         %>

                     </td>
                    <td>
                        <logic:equal value="true" name="unidade" property="marked">
                            <span class="glyphicon glyphicon-alert"></span>
                        </logic:equal>
                    </td>
                    <td>${unidade.profsWithoutTurma}</td>
                    <td>${unidade.turmaWithoutProf}</td>
                    <td>
                        <baco:clearOperation name="Questionario" op="QUESTIONARIO_CHANGE_ASSIGNEMENTS">
                            <html:checkbox styleClass="usarCheck" name="unidade" property="usar"/>
                        </baco:clearOperation>
                    </td>
                    <td>
                        <baco:clearOperation name="Questionario" op="QUESTIONARIO_CHANGE_ASSIGNEMENTS">
                            <html:checkbox styleClass="vistaCheck" name="unidade" property="vista"/>
                        </baco:clearOperation>
                    </td>
                    <td id="editObsTd${unidade.id}" <%=unidade.getObs() != null && unidade.getObs().trim().length() > 0 ? "class=\"obsContent\"":""%>>
                         <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>
                    </td>
                </tr>
                <tr class="collapse" id="tipologias${unidade.id}">
                    <td></td>
                    <td colspan="10" class="tipologias" style="padding-left: 25px">

                        <div class="panel panel-default">
                            <div class="panel-body">
                                <p>Por favor aguarde um momento, o sistema está a carregar as tipologias <img src="<%=request.getContextPath()%>/imgs/wait.gif"/></p>
                            </div>
                        </div>
                    </td>
                </tr>
            <%
                    //DaoFactory.getQuestionarioPedagogicoUnidadeCurricularAfetaDaoImpl().evict(unidade);
            %>
            </logic:iterate>
        </tbody>
    </table>

<%
    DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().evict(cursoAfeto);
    AbstractDao.getCurrentSession().getTransaction().commit();
%>

Generated by GNU Enscript 1.6.5.2.