Subversion Repositories bacoAlunos

Rev

Rev 1215 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="pt.estgp.estgweb.domain.Teacher" %>
<%@ page import="pt.estgp.estgweb.domain.ConfigurationImpl" %>
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ 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" %>
<jsp:useBean id="CourseUnitEvaluationForm" type="pt.estgp.estgweb.web.form.courseunits.CourseUnitEvaluationForm" scope="request"/>
<jsp:useBean id="CourseUnitView" type="pt.estgp.estgweb.domain.views.CourseUnitView" scope="request"/>
<%--<jsp:useBean id="CourseUnitProgramView" type="pt.estgp.estgweb.domain.views.CourseUnitProgramView" scope="request"/>--%>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
<div id="contentIntranet">
<div id="contentPane">
<html:errors/>
<jomm:messages/>

<script>
    //Manter a sessão activa para os docentes não perderem os dados
    ping();
</script>

<%
    IServiceManager sm = ServiceManager.getInstance();

    /*List<pt.estgp.estgweb.domain.views.CourseUnitView> otherYearUnits;
    otherYearUnits = new ArrayList<pt.estgp.estgweb.domain.views.CourseUnitView>();
    try{

        String[] names = new String[]{};
        Object[] args = new Object[]{new Long(CourseUnitView.getId())};
        otherYearUnits =
                (List<pt.estgp.estgweb.domain.views.CourseUnitView>)
                        sm.execute(RequestUtils.getRequester(request, response), "LoadUnitOtherYearsWithProgram", args, names);
        request.setAttribute("OtherYearUnits", otherYearUnits);


        names = new String[]{};
        args = new Object[]{};
        List<Teacher> teachers = (List<Teacher>)
                        sm.execute(RequestUtils.getRequester(request, response), "LoadTeachers", args, names);
        request.setAttribute("teachers", teachers);
    }catch(Exception e)
    {
        System.err.print(e.toString());
        e.printStackTrace();
    }*/

    boolean closed = CourseUnitEvaluationForm.getCourseUnitEvaluationView().getCourseUnitEvaluation().isClosed();
    boolean teacherComplete = CourseUnitEvaluationForm.getCourseUnitEvaluationView().getCourseUnitEvaluation().isTeacherComplete();
    String activeYear = DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveYearCreateTransaction();
    List<String> activeDegrees = DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveDegreesCreateTransaction();
    List<Long> activeCourseIds = DaoFactory.getConfigurationDaoImpl().getCourseUnitEvaluationActiveCourseIdsCreateTransaction();

    boolean isActiveYear = activeYear != null && CourseUnitView.getImportYear().equals(activeYear);
    boolean isActiveDegree = activeDegrees!=null && activeDegrees.contains(CourseUnitView.getCourseView().getDegree());
    boolean isActiveCourseId = activeCourseIds!=null && activeCourseIds.contains(CourseUnitView.getCourseView().getId());

    boolean activePeriod =
            CourseUnitView.isEvaluationOpenByAdmin() ||
                    (isActiveYear && (isActiveCourseId || isActiveDegree));
    boolean activePeriodRegular =
                    (isActiveYear && (isActiveCourseId || isActiveDegree));




%>
<div class="seccao">
<h2>
    <bean:message key="courseunit.evaluation"/> - <%=CourseUnitView.getName()%> / <%=CourseUnitView.getImportYear()%>

</h2>
<%
    if(!closed)
    {
%>
<p><bean:message key="courseunit.evaluation.warning"/></p>
<%
    }
%>

    <%
        boolean editCoordinatorPart = false;
        boolean editTeacherPart = false;
        pt.estgp.estgweb.domain.User u = UserSession.getUser();
        if(u.isSuperuserOrAdmin())
        {
            editCoordinatorPart = true;
            editTeacherPart = true;
        }
        else
        {
            if(u instanceof pt.estgp.estgweb.domain.Teacher)
            {
                pt.estgp.estgweb.domain.Teacher t = (pt.estgp.estgweb.domain.Teacher) u;
                if(t.isTeacherOfCourseUnit(CourseUnitView.getId()) || (CourseUnitView.getResponsableTeacher() != null && CourseUnitView.getResponsableTeacher().getId() == t.getId()))
                {
                    editTeacherPart = true;
                }
                if(CourseUnitView.getCourseView().getCoordinator() != null && (t.getId() == CourseUnitView.getCourseView().getCoordinator().getId() || t.hasRole(CourseUnitView.getCourseView().getValidationRole())))
                {
                    editCoordinatorPart = true;
                }

            }
        }
%>


    <%

        //todo é necessário um servico para ver se tem estes papeis
        if((CourseUnitView.getResponsableTeacher() != null && CourseUnitView.getResponsableTeacher().getId() == UserSession.getUser().getId())
                ||
                CourseUnitView.isOwnedBy(UserSession.getUser(),false)
                ||
                //Validation Role e o papel da comissão de curso
                UserSession.getUser().hasRole(CourseUnitView.getCourseView().getValidationRole())
                ||
                UserSession.getUser().hasRole(Globals.SERVICES_PROGRAMS_ROLE))
        {


            if(!activePeriod)
            {
%>
                <h2>O periodo de avaliação desta unidade está <label style="background-color: red">ENCERRADO</label> independentemente do seu estado de validação. Apenas a administração tem autorização de excepcionalmente abrir a ficha para edição</h2>
                <br/>
<%
            }
            if(!activePeriodRegular && activePeriod)
            {
            %>
            <h2>Esta unidade foi <label style="background-color: #00ff00">ABERTA</label> pela administração para efectuar processo de avaliação extraordinário</h2>
            <br/>
            <%
            }

            if(closed)
            {
%>
                <table>
                    <tr>
                        <td>
                            <table style="width: 100%" class="processActivity" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="processActivityTail"><img src="<%=request.getContextPath()%>/imgs/process/leftProcess.gif"/></td>
                                    <td class="processActivityName" style="width: 100%">Criado</td>
                                    <td class="processActivityArrow"><img src="<%=request.getContextPath()%>/imgs/process/rightProcess.gif"/></td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table style="width: 100%" class="processActivity" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="processActivityTail"><img src="<%=request.getContextPath()%>/imgs/process/leftProcess.gif"/></td>
                                    <td class="processActivityName" style="width: 100%">Entregue</td>
                                    <td class="processActivityArrow"><img src="<%=request.getContextPath()%>/imgs/process/rightProcess.gif"/></td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table style="width: 100%" class="processActivity" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="processActivityTail"><img src="<%=request.getContextPath()%>/imgs/process/leftProcess.gif"/></td>
                                    <td class="processActivityName" style="width: 100%">Aceite</td>
                                    <td class="processActivityArrow"><img src="<%=request.getContextPath()%>/imgs/process/rightProcess.gif"/></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <p class="success">Este formulário foi <label style="background-color: green">ACEITE</label> pela <bean:message key="user.role.${CourseUnitView.courseView.validationRole}"/></p>
<%
                if(editCoordinatorPart && activePeriod)
                {
%>
                <html:form action="/user/courseUnitEvaluationController">
                    <input type="hidden" name="dispatch" value="openEvaluation">
                    <html:hidden property="courseUnitView.id"/>

                <p>Caro <%=UserSession.getName()%>, membro da <bean:message key="user.role.${CourseUnitView.courseView.validationRole}"/>,
                    está autorizado a reabrir o relatório de avaliação para o corpo docente da unidade de ${CourseUnitView.name} poder editar.</p>
                    <input type="submit" value="Reabrir para edição (Comissão de Curso)"/> (Esta operação está disponível apenas a membros da Comissão de Curso)
                </html:form>

<%
                }
            }
            else if(!closed && teacherComplete)
            {
%>
                <h2>Relatório em estado <label style="background-color: yellow">ENTREGUE</label> à coordenação, aguarde que a coordenação aceite o relatório ou o abra novamente</h2>

                <table>
                    <tr>
                        <td>
                            <table style="width: 100%" class="processActivity" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="processActivityTail"><img src="<%=request.getContextPath()%>/imgs/process/leftProcess.gif"/></td>
                                    <td class="processActivityName" style="width: 100%">Criado</td>
                                    <td class="processActivityArrow"><img src="<%=request.getContextPath()%>/imgs/process/rightProcess.gif"/></td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table style="width: 100%" class="processActivity" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="processActivityTail"><img src="<%=request.getContextPath()%>/imgs/process/leftProcess.gif"/></td>
                                    <td class="processActivityName" style="width: 100%">Entregue</td>
                                    <td class="processActivityArrow"><img src="<%=request.getContextPath()%>/imgs/process/rightProcess.gif"/></td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table style="width: 100%" class="processActivity" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="processActivityTail"><img src="<%=request.getContextPath()%>/imgs/process/leftProcessGray.gif"/></td>
                                    <td class="processActivityNameGray" style="width: 100%">Aceite</td>
                                    <td class="processActivityArrow"><img src="<%=request.getContextPath()%>/imgs/process/rightProcessGray.gif"/></td>
                                </tr>
                            </table>
                        </td>
                    </tr>



                </table>
<%
                    if(editCoordinatorPart && activePeriod)
                    {
%>
                <html:form action="/user/courseUnitEvaluationController">
                    <input type="hidden" name="dispatch" value="openEvaluation">
                    <html:hidden property="courseUnitView.id"/>

                    <p>Caro <%=UserSession.getName()%>, membro da <bean:message key="user.role.${CourseUnitView.courseView.validationRole}"/>,
                        está autorizado a reabrir o relatório de avaliação para o corpo docente da unidade de ${CourseUnitView.name}. poder editar</p>
                    <input type="submit" value="Reverter o estado ENTREGUE (Comissão de Curso)"/> (Esta operação está disponível apenas a membros da Comissão de Curso)
                </html:form>

<%
                    }
            }
            else
            {
%>
                    <h2>Formulário em estado <label style="background-color: red">NÃO ENTREGUE</label> para edição</h2>

                    <table>
                        <tr>
                            <td>
                                <table style="width: 100%" class="processActivity" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td class="processActivityTail"><img src="<%=request.getContextPath()%>/imgs/process/leftProcess.gif"/></td>
                                        <td class="processActivityName" style="width: 100%">Criado</td>
                                        <td class="processActivityArrow"><img src="<%=request.getContextPath()%>/imgs/process/rightProcess.gif"/></td>
                                    </tr>
                                </table>
                            </td>
                            <td>
                                <table style="width: 100%" class="processActivity" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td class="processActivityTail"><img src="<%=request.getContextPath()%>/imgs/process/leftProcessGray.gif"/></td>
                                        <td class="processActivityNameGray" style="width: 100%">Entregue</td>
                                        <td class="processActivityArrow"><img src="<%=request.getContextPath()%>/imgs/process/rightProcessGray.gif"/></td>
                                    </tr>
                                </table>
                            </td>
                            <td>
                                <table style="width: 100%" class="processActivity" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td class="processActivityTail"><img src="<%=request.getContextPath()%>/imgs/process/leftProcessGray.gif"/></td>
                                        <td class="processActivityNameGray" style="width: 100%">Aceite</td>
                                        <td class="processActivityArrow"><img src="<%=request.getContextPath()%>/imgs/process/rightProcessGray.gif"/></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
<%
            }

%>


<!-- Modal -->

<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog" >
    <div class="modal-dialog" data-width="760" style="display: block; width: 760px; margin-left: -380px; margin-top: 50px;" aria-hidden="false">

        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">

                <h1 class="modal-title">Envio em curso</h1>
            </div>
            <div class="modal-body">
                <p>O relatório está a ser enviado ao sistema... por favor aguarde <img src="<%=request.getContextPath()%>/imgs/wait.gif"/></p>

            </div>
            <div class="modal-footer">

            </div>
        </div>

    </div>
</div>
    <script>
        function submitFormWaitAutoSave()
        {
            stopAutoSave = true;
            $('#myModal').modal({
                show: 'true'
            });
            //esperar se houver algum update a executar 1500 segundos é o maximo de espera
            //se a pagina não recarregar e porque a thread parou
            setTimeout("submitForm()",40000);
        }

        //function submitForm()
        //{
        //    $("#formEdit").submit();
       // }

        $( document ).ready(function() {
            <%
            if(!activePeriod)
            {
                %>
                $("#formEdit :input").attr("disabled", true);
                <%
            }
            else if(closed)
            {
            %>
                $("#formEdit :input").attr("disabled", true);
                <%
            }
            else if(!editTeacherPart && !editCoordinatorPart)
            {
                %>
                $("#formEdit :input").attr("disabled", true);
                <%
            }
            else
            {
                %>
                setTimeout("serData()",5000);
                <%
            }
            %>



        });
        var stopAutoSave = false;

        function serData()
        {
            if(stopAutoSave)
            {
                $("#formEval").submit();
                return;
            }
            else
            {
                $("#dispatch").val("saveEvaluation");
                var data = $("#formEval").serialize().replace(/%0D%0A/g, '%0A').replace(/\r?\n/g, "\r\n");
                //alert(data);

                //alert($("#dispatch").val())
                $("#autosave").html("Enviando...");
                $.ajax({
                    url: "<%=request.getContextPath()%>/user/courseUnitEvaluationController.do",
                    type: "POST",
                    data: data + "&json=true",
                    dataType: "json",
                    success: function(resposta) {
                        if(resposta.service && resposta.service == "ok")
                            $("#autosave").html("Salvo Automaticamente (Apenas Dados, não gerou PDF, para gerar PDF terá de salvar o docente)");
                        else
                            $("#autosave").html("Deve salvar o seu relatório periodicamente");
                        setTimeout("serData()",5000);
                    },
                    error: function() {
                        $("#autosave").html("Erro de comunicação, tentando novamente em 5 segundos");
                        setTimeout("serData()",5000);
                    }
                });
               /* $.post('<%=request.getContextPath()%>/user/courseUnitEvaluationController.do', data + "&json=true",
                        function(resposta)
                        {
                            if(resposta.service && resposta.service == "ok")
                                $("#autosave").html("Salvo Automaticamente (Apenas Dados, não gerou PDF, para gerar PDF terá de salvar o docente)");
                            else
                                $("#autosave").html("Deve salvar o seu relatório periodicamente");
                            setTimeout("serData()",5000);
                        }

                );*/


            }
        }

    </script>
<div>
   <a target="_blank" href="<%=request.getContextPath()%>/user/data.jsp?id=<%=CourseUnitView.getEvaluationStreamId()%>">Ver versões salvas pelos docentes</a>
</div>
<div id="formEdit">
    <html:form styleId="formEval" action="/user/courseUnitEvaluationController">
        <input type="hidden" id="dispatch" name="dispatch" value="saveEvaluation">
        <html:hidden property="id"/>
        <html:hidden property="courseUnitView.id"/>



        <%--DOCENTE--%>
    <logic:equal value="true" name="CourseUnitEvaluationForm" property="courseUnitEvaluationView.fechar">
        <p class="alert-success">Esta avaliação será publicada no DTP em formato PDF após ordens dos orgãos competentes</p>
    </logic:equal>

    <%
    if(closed || (!activePeriod && CourseUnitView.getEvaluationStreamId() !=null ))
    {
    %>
        <%
            if(editCoordinatorPart || editTeacherPart)
            {
        %>
        <p>
            <a href="<%=request.getContextPath()%>/repositoryStream/<%=CourseUnitView.getEvaluationStreamId()%>">Relatório de avaliação em PDF
                <img src="<%=request.getContextPath()%>/imgs/mime/pdf.gif"/>
            </a>
        </p>
        <%
            }
        %>
    <%
    }
    %>
    <div id="autosave"></div>
    <table class="dataTable tableDisabled" width="100%">
        <tr>
            <th colspan="2">Dados alterados pelo Docente da Unidade</th>
        </tr>

        <tr>
            <th align="right"><bean:message key="courseunit.evaluation.mapa1"/></th>
            <td  width="80%">
                <h3><bean:message key="courseunit.evaluation.mapa1.desc"/></h3>

                <table class="dataTable" width="100%">
                    <tr>
                        <th rowspan="2">
                            Nº Alunos Inscritos
                        </th>
                        <th rowspan="2">
                            Nº de alunos sem elementos de avaliação
                        </th>
                        <th colspan="5">
                            Nº de alunos aprovados em
                        </th>
                        <th rowspan="2">
                            Aprovados com a classificação entre 10 e 13 valores (%)
                        </th>
                        <th rowspan="2">
                            Aprovados com a classificação entre 14 e 16 valores (%)
                        </th>
                        <th rowspan="2">
                            Aprovados com a classificação entre 17 e 20 valores (%)
                        </th>
                    </tr>
                    <tr>
                        <th>Avaliação de frequência</th>
                        <th>Exame Época Normal</th>
                        <th>Exame Época Recurso</th>
                        <th>Exame Época Especial</th>
                        <th>Total</th>
                    </tr>
                    <tr>
                        <td align="center">
                            <html:text size="4" property="courseUnitEvaluationView.courseUnitEvaluation.numAlunosInscritos"/>
                        </td>
                        <td align="center">
                            <html:text size="4" property="courseUnitEvaluationView.courseUnitEvaluation.numAlunosSemElementosAvaliacao"/>
                        </td>
                        <td align="center">
                            <html:text size="4" property="courseUnitEvaluationView.courseUnitEvaluation.numAlunosAprovFrequencia"/>
                        </td>
                        <td align="center">
                            <html:text size="4" property="courseUnitEvaluationView.courseUnitEvaluation.numAlunosAprovNormal"/>
                        </td>
                        <td align="center">
                            <html:text size="4" property="courseUnitEvaluationView.courseUnitEvaluation.numAlunosAprovRecurso"/>
                        </td>
                        <td align="center">
                            <html:text size="4" property="courseUnitEvaluationView.courseUnitEvaluation.numAlunosAprovEspecial"/>
                        </td>
                        <td align="center">
                            <html:text size="4" property="courseUnitEvaluationView.courseUnitEvaluation.numAlunosAprovTotal"/>
                        </td>
                        <td align="center">
                            <html:text size="4" property="courseUnitEvaluationView.courseUnitEvaluation.numAlunosAprov1013"/>
                        </td>
                        <td align="center">
                            <html:text size="4" property="courseUnitEvaluationView.courseUnitEvaluation.numAlunosAprov1416"/>
                        </td>
                        <td align="center">
                            <html:text size="4" property="courseUnitEvaluationView.courseUnitEvaluation.numAlunosAprov1720"/>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <th>
                Auto-avaliação
            </th>
            <td>
                <table class="dataTable" width="100%">
                    <tr>
                        <th>Apreciação dos resultados quantitativos obtidos pelos estudantes</th>
                        <td width="80%">
                            <html:textarea style="width:100%;height: 200px" property="courseUnitEvaluationView.courseUnitEvaluation.qualApreciacaoQuantitivos"/>
                        </td>
                    </tr>
                    <tr>
                        <th>Apreciação do funcionamento da UC<br/>
                            (Condições de funcionamento da UC; problemas detetados; identificação de práticas pedagógicas de mérito ou deficientes; etc.)</th>
                        <td  width="80%">
                            <html:textarea style="width:100%;height: 200px" property="courseUnitEvaluationView.courseUnitEvaluation.qualApreciacaoUC"/>
                        </td>
                    </tr>
                    <tr>
                        <th>Apreciação do cumprimento do programa da UC<br/>
                            (Adequação das metodologias de ensino/aprendizagem utilizadas; competências efetivamente adquiridas e cumprimento dos conteúdos planificados)
                        </th>
                        <td  width="80%">
                            <html:textarea style="width:100%;height: 200px" property="courseUnitEvaluationView.courseUnitEvaluation.qualApreciacaoCumprimentoPrograma"/>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            Conclusões<br/>
                            (Pontos fortes e fracos; sugestões de melhoria e respetivo plano de ação para a sua concretização)
                        </th>
                        <td  width="80%">
                            <html:textarea style="width:100%;height: 200px" property="courseUnitEvaluationView.courseUnitEvaluation.qualConclusoes"/>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td colspan="2">
            <%

            if(activePeriod && !teacherComplete && !closed && (editCoordinatorPart || editTeacherPart))
            {
            %>

            <input type="button" value="<bean:message key="save"/>" onclick="set(form,'saveEvaluation');submitFormWaitAutoSave(form);"/>

            <%
            }

            if(activePeriod && !closed && !teacherComplete && editTeacherPart)
                {
            %>

            <input type="button" value="<bean:message key="deliverEvaluation"/>" onclick="set(form,'teacherCompleteEvaluation');submitFormWaitAutoSave(form);"/>

            <%
            }


            if(activePeriod && !closed && editCoordinatorPart)
                {
            %>

            <input type="button" value="VALIDAR e FECHAR pela Comissão de Curso" onclick="set(form,'publishEvaluation');submitFormWaitAutoSave(form);"/>
            <%
                }
            %>
            </td>

        </tr>
    </table>


</html:form>
    <%
        }
    %>
</div>
</div>
</div>
</div>

Generated by GNU Enscript 1.6.5.2.