Subversion Repositories bacoAlunos

Rev

Rev 1505 | Rev 1507 | 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.Course" %>
<%@ page import="pt.estgp.estgweb.domain.CourseStudiesPlan" %>
<%@ page import="pt.estgp.estgweb.domain.CourseStudiesPlanImpl" %>
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
<%@ page import="pt.estgp.estgweb.web.form.courses.CourseStudiesPlansAdminForm" %>
<%@ page import="pt.estgp.estgweb.services.courses.CoursesService" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ 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/jomm.tld" prefix="jomm"%>
<%
    //todo temos de ter aqui o id do curso para o carregar aqui mesmo

    //se queremos barras de navegação então temos de ter ser acedidos de um
    //controlador que carregue o necerrário à barra ou então assumimos que
    //o curso id esta sempre disponivel nas barras possiveis de chamar

    AbstractDao.getCurrentSession().beginTransaction();

    CourseStudiesPlanImpl planoEdicao;
    boolean ultimaVersao = true;
    Long courseId;
    Long studyPlanId;
    String versaoPlano = "Não Encontrada";
    Course course;
    if(request.getAttribute("CourseStudiesPlansAdminForm") != null)
    {
        CourseStudiesPlansAdminForm frm = (CourseStudiesPlansAdminForm) request.getAttribute("CourseStudiesPlansAdminForm");
        courseId = frm.getCourseId();
        studyPlanId = frm.getCourseStudiesPlan().getId();
        ultimaVersao = frm.isVersaoVigor();
        course = DaoFactory.getCourseDaoImpl().load(courseId);
        planoEdicao = frm.getCourseStudiesPlan();
    }
    else
    {
        courseId = Long.parseLong(request.getParameter("courseId"));
        studyPlanId = Long.parseLong(request.getParameter("studyPlanId"));
        request.setAttribute("courseId",courseId);
        request.setAttribute("studyPlanId",studyPlanId);


        course = DaoFactory.getCourseDaoImpl().load(courseId);
        planoEdicao = null;
        for(CourseStudiesPlan plan:course.getStudiesPlans())
        {
            if(plan.getId() == studyPlanId)
            {
                versaoPlano = plan.getVersion() + "";
                planoEdicao = (CourseStudiesPlanImpl) DaoFactory.getCourseStudiesPlanDaoImpl().narrow(plan);
                break;
            }
            ultimaVersao = false;
        }
        //provavelmente era mais facil ter um Form Nested com toda a informação, ou então faz-se isso numa pagina propria para editar o plano em questão
    }
    request.setAttribute("courseId",courseId);
    request.setAttribute("studyPlanId",studyPlanId);
    request.setAttribute("course",course);






    /*
    if(planoEdicao != null)
    {


    }
    */

%>
    <div class="panel panel-default">
        <div class="panel-heading">
            Edição do plano de estudos. Versão <%=versaoPlano%> <%=ultimaVersao? "(<u>é a versão em vigor</u>)":""%> do curso de <%=course.getName()%> (<%=course.getCode()%>)

            <button data-toggle="modal" data-target="#modalNovaVersaoDePlano" title="Adicionar Versão do Plano de Estudos" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus"></span></button>
        </div>
        <div class="panel-body">

            <html:errors/>
            <jomm:messages/>

            <div class="panel panel-default">
                <div class="panel-heading">Dados do Curso</div>
                <div class="panel-body">

                    <div class="col-sm-12">Código do Curso <label class="text-info">${course.code}</label></div>
                    <div class="col-sm-12">
                        <table class="tablesorter-blue">
                            <thead>
                                <tr>
                                    <th>Língua</th>
                                    <th>Nome do Curso</th>
                                    <th>Departamento</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>PT</td>
                                    <td>${course.name}</td>
                                    <td>
                                    <%if(course.getDepartment() != null){%>${course.department.name}<%}%>
                                    </td>
                                </tr>
                                <tr>
                                    <td>EN</td>
                                    <td>${course.nameEn}</td>
                                    <td>
                                        <%if(course.getDepartment() != null){%>${course.department.nameEn}<%}%>

                                    </td>
                                </tr>
                                <tr>
                                    <td>ES</td>
                                    <td>${course.nameEs}</td>
                                    <td>
                                        <%if(course.getDepartment() != null){%>${course.department.nameEs}<%}%>
                                    </td>
                                </tr>
                                <tr>
                                    <td>FR</td>
                                    <td>${course.nameFr}</td>
                                    <td>
                                        <%if(course.getDepartment() != null){%>${course.department.nameFr}<%}%>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                   </div>

                </div>
            </div>


            <div class="panel panel-default">
                <div class="panel-heading">Plano de Estudos</div>
                <div class="panel-body">
                        <html:form action="/user/courseControllerStudiesPlan" styleClass="form-horizontal">
                            <%
                                CourseStudiesPlansAdminForm courseStudiesPlansAdminForm = (CourseStudiesPlansAdminForm) request.getAttribute("CourseStudiesPlansAdminForm");
                                if(courseStudiesPlansAdminForm.getCourseStudiesPlan().getId() <= 0)
                                {
                                    courseStudiesPlansAdminForm.setCourseStudiesPlan(planoEdicao);
                                    courseStudiesPlansAdminForm.setCourseId(courseId);
                                    courseStudiesPlansAdminForm.setVersaoVigor(ultimaVersao);
                                    courseStudiesPlansAdminForm.setPlanoEstudos(new CoursesService().loadCursoPlanoFromXml(planoEdicao.getXml()));
                                }
                            %>
                            <input type="hidden" name="dispatch" value="savePlano"/>
                            <html:hidden property="courseId"/>
                            <html:hidden property="versaoVigor"/>
                            <html:hidden property="courseStudiesPlan.id"/>

                            <div class="form-group">
                                <label class="control-label col-sm-2">Versão</label>
                                <div class="col-sm-10">
                                    <html:text styleClass="form-control" property="courseStudiesPlan.version" size="3"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-sm-2">Descrição</label>
                                <div class="col-sm-10">
                                    <html:text styleClass="form-control" property="courseStudiesPlan.versionDescription"/>
                                </div>
                            </div>

                            <nested:notEmpty  property="planoEstudos">

                                <html:hidden property="planoEstudos.siges"/>
                                <html:hidden property="planoEstudos.nome"/>
                                <html:hidden property="planoEstudos.dep"/>
                                <nested:iterate id="semestre" property="planoEstudos.semestre" type="pt.estgp.estgweb.services.courses.xsd.Curso.Semestre">
                                    <div class="panel panel-default">
                                        <div class="panel-heading">
                                            <nested:select property="id">
                                                <html:option value="S1">Semestre 1</html:option>
                                                <html:option value="S2">Semestre 2</html:option>
                                                <html:option value="S3">Semestre 3</html:option>
                                                <html:option value="S4">Semestre 4</html:option>
                                                <html:option value="S5">Semestre 5</html:option>
                                                <html:option value="S6">Semestre 6</html:option>
                                                <html:option value="T1">Trimestre 1</html:option>
                                                <html:option value="T2">Trimestre 2</html:option>
                                                <html:option value="T3">Trimestre 3</html:option>
                                                <html:option value="T4">Trimestre 4</html:option>
                                                <html:option value="T5">Trimestre 5</html:option>
                                                <html:option value="T6">Trimestre 6</html:option>
                                                <html:option value="T7">Trimestre 7</html:option>
                                                <html:option value="T8">Trimestre 8</html:option>
                                            </nested:select>
                                        </div>
                                        <div class="panel-body">

                                            <button class="btn btn-default" data-toggle="collapse" type="button" data-target=".langs">Ver Campos Multingua</button>
                                            <nested:iterate id="perfil" property="perfil" type="pt.estgp.estgweb.services.courses.xsd.Curso.Semestre.Perfil">
                                                <div class="panel panel-default">
                                                    <div class="panel-heading">
                                                        PERFIL <nested:text styleClass="form-control" property="nome"/>
                                                    </div>
                                                    <div class="panel-body">
                                                        <table class="tablesorterfiltered">
                                                            <thead>
                                                            <tr>
                                                                <th>SIGES</th>
                                                                <th>Nome</th>
                                                                <th>Total</th>
                                                                <th>T</th>
                                                                <th>TP</th>
                                                                <th>P</th>
                                                                <th>PL</th>
                                                                <th>PD</th>
                                                                <th>OT</th>
                                                                <th>E</th>
                                                                <th>S</th>
                                                                <th>TC</th>
                                                                <th>O</th>
                                                                <th>ECTS</th>
                                                                <th>URL UNIDADE</th>
                                                                <th>FICHA URL</th>
                                                            </tr>
                                                            </thead>
                                                            <tbody>
                                                            <nested:iterate id="unidade" property="unidade" type="pt.estgp.estgweb.services.courses.xsd.UnidadeType">
                                                                <tr>
                                                                    <td><nested:text styleClass="form-control" property="siges"/></td>
                                                                    <td>
                                                                        <div>
                                                                            <div class="col-sm-1">(PT)</div>
                                                                            <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nome"/></div>

                                                                            <div class="langs collapse" >
                                                                                <div class="col-sm-1">(EN)</div>
                                                                                <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeEn"/></div>
                                                                                <div class="col-sm-1">(ES)</div>
                                                                                <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeEs"/></div>
                                                                                <div class="col-sm-1">(FR)</div>
                                                                                <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeFr"/></div>
                                                                            </div>
                                                                        </div>

                                                                    </td>
                                                                    <td><nested:text styleClass="form-control" property="totalHoras"/></td>
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.t"/></td>
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.TP"/></td>
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.p"/></td>
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.PL"/></td>
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.PD"/></td>
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.OT"/></td>
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.e"/></td>
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.s"/></td>
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.TC"/></td>
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.o"/></td>
                                                                    <td><nested:text styleClass="form-control" property="ECTS"/></td>
                                                                    <td><nested:text styleClass="form-control" style="width:600px" property="urlUnidadeCurricular"/></td>
                                                                    <td><nested:text styleClass="form-control" style="width:600px" property="urlFichaCurricular"/></td>
                                                                </tr>
                                                            </nested:iterate>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>

                                            </nested:iterate>

                                            <nested:notEmpty property="unidade">
                                                <table class="tablesorterfiltered">
                                                <thead>
                                                    <tr>
                                                        <th>SIGES</th>
                                                        <th>Nome</th>
                                                        <th>Total</th>
                                                        <th>T</th>
                                                        <th>TP</th>
                                                        <th>P</th>
                                                        <th>PL</th>
                                                        <th>PD</th>
                                                        <th>OT</th>
                                                        <th>E</th>
                                                        <th>S</th>
                                                        <th>TC</th>
                                                        <th>O</th>
                                                        <th>ECTS</th>
                                                        <th>URL UNIDADE</th>
                                                        <th>FICHA URL</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <nested:iterate id="unidade" property="unidade" type="pt.estgp.estgweb.services.courses.xsd.UnidadeType">
                                                        <tr>
                                                            <td><nested:text styleClass="form-control" property="siges"/></td>
                                                            <td>
                                                                <div>
                                                                    <div class="col-sm-1">(PT)</div>
                                                                    <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nome"/></div>

                                                                    <div class="langs collapse" >
                                                                        <div class="col-sm-1">(EN)</div>
                                                                        <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeEn"/></div>
                                                                        <div class="col-sm-1">(ES)</div>
                                                                        <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeEs"/></div>
                                                                        <div class="col-sm-1">(FR)</div>
                                                                        <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeFr"/></div>
                                                                    </div>
                                                                </div>

                                                            </td>
                                                            <td><nested:text styleClass="form-control" property="totalHoras"/></td>
                                                            <td><nested:text styleClass="form-control" property="horasContacto.t"/></td>
                                                            <td><nested:text styleClass="form-control" property="horasContacto.TP"/></td>
                                                            <td><nested:text styleClass="form-control" property="horasContacto.p"/></td>
                                                            <td><nested:text styleClass="form-control" property="horasContacto.PL"/></td>
                                                            <td><nested:text styleClass="form-control" property="horasContacto.PD"/></td>
                                                            <td><nested:text styleClass="form-control" property="horasContacto.OT"/></td>
                                                            <td><nested:text styleClass="form-control" property="horasContacto.e"/></td>
                                                            <td><nested:text styleClass="form-control" property="horasContacto.s"/></td>
                                                            <td><nested:text styleClass="form-control" property="horasContacto.TC"/></td>
                                                            <td><nested:text styleClass="form-control" property="horasContacto.o"/></td>
                                                            <td><nested:text styleClass="form-control" property="ECTS"/></td>
                                                            <td><nested:text styleClass="form-control" style="width:600px" property="urlUnidadeCurricular"/></td>
                                                            <td><nested:text styleClass="form-control" style="width:600px" property="urlFichaCurricular"/></td>
                                                        </tr>
                                                    </nested:iterate>
                                                </tbody>
                                            </table>
                                            </nested:notEmpty>
                                        </div>
                                    </div>

                                </nested:iterate>

                            </nested:notEmpty>

                            <button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
                            <html:submit styleClass="btn btn-success" >Salvar</html:submit>


                        </html:form>

                </div>
            </div>
        </div>
    </div>

<%

    AbstractDao.getCurrentSession().getTransaction().commit();
%>