Subversion Repositories bacoAlunos

Rev

Rev 1506 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1505 jmachado 1
<%@ page import="jomm.dao.impl.AbstractDao" %>
2
<%@ page import="pt.estgp.estgweb.domain.Course" %>
3
<%@ page import="pt.estgp.estgweb.domain.CourseStudiesPlan" %>
4
<%@ page import="pt.estgp.estgweb.domain.CourseStudiesPlanImpl" %>
5
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
6
<%@ page import="pt.estgp.estgweb.web.form.courses.CourseStudiesPlansAdminForm" %>
7
<%@ page import="pt.estgp.estgweb.services.courses.CoursesService" %>
8
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
9
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
10
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
11
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
12
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
13
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
14
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
15
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm"%>
16
<%
17
    //todo temos de ter aqui o id do curso para o carregar aqui mesmo
18
 
19
    //se queremos barras de navegação então temos de ter ser acedidos de um
20
    //controlador que carregue o necerrário à barra ou então assumimos que
21
    //o curso id esta sempre disponivel nas barras possiveis de chamar
22
 
23
    AbstractDao.getCurrentSession().beginTransaction();
24
 
25
    CourseStudiesPlanImpl planoEdicao;
26
    boolean ultimaVersao = true;
27
    Long courseId;
28
    Long studyPlanId;
29
    String versaoPlano = "Não Encontrada";
30
    Course course;
31
    if(request.getAttribute("CourseStudiesPlansAdminForm") != null)
32
    {
33
        CourseStudiesPlansAdminForm frm = (CourseStudiesPlansAdminForm) request.getAttribute("CourseStudiesPlansAdminForm");
34
        courseId = frm.getCourseId();
35
        studyPlanId = frm.getCourseStudiesPlan().getId();
36
        ultimaVersao = frm.isVersaoVigor();
37
        course = DaoFactory.getCourseDaoImpl().load(courseId);
38
        planoEdicao = frm.getCourseStudiesPlan();
39
    }
40
    else
41
    {
42
        courseId = Long.parseLong(request.getParameter("courseId"));
43
        studyPlanId = Long.parseLong(request.getParameter("studyPlanId"));
44
        request.setAttribute("courseId",courseId);
45
        request.setAttribute("studyPlanId",studyPlanId);
46
 
47
 
48
        course = DaoFactory.getCourseDaoImpl().load(courseId);
49
        planoEdicao = null;
50
        for(CourseStudiesPlan plan:course.getStudiesPlans())
51
        {
52
            if(plan.getId() == studyPlanId)
53
            {
54
                versaoPlano = plan.getVersion() + "";
55
                planoEdicao = (CourseStudiesPlanImpl) DaoFactory.getCourseStudiesPlanDaoImpl().narrow(plan);
56
                break;
57
            }
58
            ultimaVersao = false;
59
        }
60
        //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
61
    }
62
    request.setAttribute("courseId",courseId);
63
    request.setAttribute("studyPlanId",studyPlanId);
64
    request.setAttribute("course",course);
65
 
66
 
67
 
68
 
69
 
70
 
71
    /*
72
    if(planoEdicao != null)
73
    {
74
 
75
 
76
    }
77
    */
78
 
79
%>
80
    <div class="panel panel-default">
81
        <div class="panel-heading">
82
            Edição do plano de estudos. Versão <%=versaoPlano%> <%=ultimaVersao? "(<u>é a versão em vigor</u>)":""%> do curso de <%=course.getName()%> (<%=course.getCode()%>)
83
 
84
            <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>
85
        </div>
86
        <div class="panel-body">
87
 
88
            <html:errors/>
89
            <jomm:messages/>
90
 
91
            <div class="panel panel-default">
92
                <div class="panel-heading">Dados do Curso</div>
93
                <div class="panel-body">
94
 
95
                    <div class="col-sm-12">Código do Curso <label class="text-info">${course.code}</label></div>
96
                    <div class="col-sm-12">
97
                        <table class="tablesorter-blue">
98
                            <thead>
99
                                <tr>
100
                                    <th>Língua</th>
101
                                    <th>Nome do Curso</th>
102
                                    <th>Departamento</th>
103
                                </tr>
104
                            </thead>
105
                            <tbody>
106
                                <tr>
107
                                    <td>PT</td>
108
                                    <td>${course.name}</td>
109
                                    <td>
110
                                    <%if(course.getDepartment() != null){%>${course.department.name}<%}%>
111
                                    </td>
112
                                </tr>
113
                                <tr>
114
                                    <td>EN</td>
115
                                    <td>${course.nameEn}</td>
116
                                    <td>
117
                                        <%if(course.getDepartment() != null){%>${course.department.nameEn}<%}%>
118
 
119
                                    </td>
120
                                </tr>
121
                                <tr>
122
                                    <td>ES</td>
123
                                    <td>${course.nameEs}</td>
124
                                    <td>
125
                                        <%if(course.getDepartment() != null){%>${course.department.nameEs}<%}%>
126
                                    </td>
127
                                </tr>
128
                                <tr>
129
                                    <td>FR</td>
130
                                    <td>${course.nameFr}</td>
131
                                    <td>
132
                                        <%if(course.getDepartment() != null){%>${course.department.nameFr}<%}%>
133
                                    </td>
134
                                </tr>
135
                            </tbody>
136
                        </table>
137
                   </div>
138
 
139
                </div>
140
            </div>
141
 
142
 
143
            <div class="panel panel-default">
144
                <div class="panel-heading">Plano de Estudos</div>
145
                <div class="panel-body">
146
                        <html:form action="/user/courseControllerStudiesPlan" styleClass="form-horizontal">
147
                            <%
148
                                CourseStudiesPlansAdminForm courseStudiesPlansAdminForm = (CourseStudiesPlansAdminForm) request.getAttribute("CourseStudiesPlansAdminForm");
149
                                if(courseStudiesPlansAdminForm.getCourseStudiesPlan().getId() <= 0)
150
                                {
151
                                    courseStudiesPlansAdminForm.setCourseStudiesPlan(planoEdicao);
152
                                    courseStudiesPlansAdminForm.setCourseId(courseId);
153
                                    courseStudiesPlansAdminForm.setVersaoVigor(ultimaVersao);
154
                                    courseStudiesPlansAdminForm.setPlanoEstudos(new CoursesService().loadCursoPlanoFromXml(planoEdicao.getXml()));
155
                                }
156
                            %>
157
                            <input type="hidden" name="dispatch" value="savePlano"/>
158
                            <html:hidden property="courseId"/>
159
                            <html:hidden property="versaoVigor"/>
160
                            <html:hidden property="courseStudiesPlan.id"/>
161
 
162
                            <div class="form-group">
163
                                <label class="control-label col-sm-2">Versão</label>
164
                                <div class="col-sm-10">
165
                                    <html:text styleClass="form-control" property="courseStudiesPlan.version" size="3"/>
166
                                </div>
167
                            </div>
168
                            <div class="form-group">
169
                                <label class="control-label col-sm-2">Descrição</label>
170
                                <div class="col-sm-10">
171
                                    <html:text styleClass="form-control" property="courseStudiesPlan.versionDescription"/>
172
                                </div>
173
                            </div>
174
 
175
                            <nested:notEmpty  property="planoEstudos">
176
 
177
                                <html:hidden property="planoEstudos.siges"/>
178
                                <html:hidden property="planoEstudos.nome"/>
179
                                <html:hidden property="planoEstudos.dep"/>
180
                                <nested:iterate id="semestre" property="planoEstudos.semestre" type="pt.estgp.estgweb.services.courses.xsd.Curso.Semestre">
181
                                    <div class="panel panel-default">
182
                                        <div class="panel-heading">
183
                                            <nested:text property="id"/>
184
                                        </div>
185
                                        <div class="panel-body">
186
 
187
                                            <button class="btn btn-default" data-toggle="collapse" type="button" data-target=".langs">Ver Campos Multingua</button>
188
                                            <nested:iterate id="perfil" property="perfil" type="pt.estgp.estgweb.services.courses.xsd.Curso.Semestre.Perfil">
189
                                                <div class="panel panel-default">
190
                                                    <div class="panel-heading">
191
                                                        PERFIL <nested:text styleClass="form-control" property="nome"/>
192
                                                    </div>
193
                                                    <div class="panel-body">
194
                                                        <table class="tablesorterfiltered">
195
                                                            <thead>
196
                                                            <tr>
197
                                                                <th>SIGES</th>
198
                                                                <th>Nome</th>
199
                                                                <th>Total</th>
200
                                                                <th>T</th>
201
                                                                <th>TP</th>
202
                                                                <th>P</th>
203
                                                                <th>PL</th>
204
                                                                <th>PD</th>
205
                                                                <th>OT</th>
206
                                                                <th>E</th>
207
                                                                <th>S</th>
208
                                                                <th>TC</th>
209
                                                                <th>O</th>
210
                                                                <th>ECTS</th>
211
                                                                <th>URL UNIDADE</th>
212
                                                                <th>FICHA URL</th>
213
                                                            </tr>
214
                                                            </thead>
215
                                                            <tbody>
216
                                                            <nested:iterate id="unidade" property="unidade" type="pt.estgp.estgweb.services.courses.xsd.UnidadeType">
217
                                                                <tr>
218
                                                                    <td><nested:text styleClass="form-control" property="siges"/></td>
219
                                                                    <td>
220
                                                                        <div>
221
                                                                            <div class="col-sm-1">(PT)</div>
222
                                                                            <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nome"/></div>
223
 
224
                                                                            <div class="langs collapse" >
225
                                                                                <div class="col-sm-1">(EN)</div>
226
                                                                                <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeEn"/></div>
227
                                                                                <div class="col-sm-1">(ES)</div>
228
                                                                                <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeEs"/></div>
229
                                                                                <div class="col-sm-1">(FR)</div>
230
                                                                                <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeFr"/></div>
231
                                                                            </div>
232
                                                                        </div>
233
 
234
                                                                    </td>
235
                                                                    <td><nested:text styleClass="form-control" property="totalHoras"/></td>
236
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.t"/></td>
237
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.TP"/></td>
238
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.p"/></td>
239
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.PL"/></td>
240
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.PD"/></td>
241
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.OT"/></td>
242
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.e"/></td>
243
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.s"/></td>
244
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.TC"/></td>
245
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.o"/></td>
246
                                                                    <td><nested:text styleClass="form-control" property="ECTS"/></td>
247
                                                                    <td><nested:text styleClass="form-control" style="width:600px" property="urlUnidadeCurricular"/></td>
248
                                                                    <td><nested:text styleClass="form-control" style="width:600px" property="urlFichaCurricular"/></td>
249
                                                                </tr>
250
                                                            </nested:iterate>
251
                                                            </tbody>
252
                                                        </table>
253
                                                    </div>
254
                                                </div>
255
 
256
                                            </nested:iterate>
257
 
258
                                            <nested:notEmpty property="unidade">
259
                                                <table class="tablesorterfiltered">
260
                                                <thead>
261
                                                    <tr>
262
                                                        <th>SIGES</th>
263
                                                        <th>Nome</th>
264
                                                        <th>Total</th>
265
                                                        <th>T</th>
266
                                                        <th>TP</th>
267
                                                        <th>P</th>
268
                                                        <th>PL</th>
269
                                                        <th>PD</th>
270
                                                        <th>OT</th>
271
                                                        <th>E</th>
272
                                                        <th>S</th>
273
                                                        <th>TC</th>
274
                                                        <th>O</th>
275
                                                        <th>ECTS</th>
276
                                                        <th>URL UNIDADE</th>
277
                                                        <th>FICHA URL</th>
278
                                                    </tr>
279
                                                </thead>
280
                                                <tbody>
281
                                                    <nested:iterate id="unidade" property="unidade" type="pt.estgp.estgweb.services.courses.xsd.UnidadeType">
282
                                                        <tr>
283
                                                            <td><nested:text styleClass="form-control" property="siges"/></td>
284
                                                            <td>
285
                                                                <div>
286
                                                                    <div class="col-sm-1">(PT)</div>
287
                                                                    <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nome"/></div>
288
 
289
                                                                    <div class="langs collapse" >
290
                                                                        <div class="col-sm-1">(EN)</div>
291
                                                                        <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeEn"/></div>
292
                                                                        <div class="col-sm-1">(ES)</div>
293
                                                                        <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeEs"/></div>
294
                                                                        <div class="col-sm-1">(FR)</div>
295
                                                                        <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeFr"/></div>
296
                                                                    </div>
297
                                                                </div>
298
 
299
                                                            </td>
300
                                                            <td><nested:text styleClass="form-control" property="totalHoras"/></td>
301
                                                            <td><nested:text styleClass="form-control" property="horasContacto.t"/></td>
302
                                                            <td><nested:text styleClass="form-control" property="horasContacto.TP"/></td>
303
                                                            <td><nested:text styleClass="form-control" property="horasContacto.p"/></td>
304
                                                            <td><nested:text styleClass="form-control" property="horasContacto.PL"/></td>
305
                                                            <td><nested:text styleClass="form-control" property="horasContacto.PD"/></td>
306
                                                            <td><nested:text styleClass="form-control" property="horasContacto.OT"/></td>
307
                                                            <td><nested:text styleClass="form-control" property="horasContacto.e"/></td>
308
                                                            <td><nested:text styleClass="form-control" property="horasContacto.s"/></td>
309
                                                            <td><nested:text styleClass="form-control" property="horasContacto.TC"/></td>
310
                                                            <td><nested:text styleClass="form-control" property="horasContacto.o"/></td>
311
                                                            <td><nested:text styleClass="form-control" property="ECTS"/></td>
312
                                                            <td><nested:text styleClass="form-control" style="width:600px" property="urlUnidadeCurricular"/></td>
313
                                                            <td><nested:text styleClass="form-control" style="width:600px" property="urlFichaCurricular"/></td>
314
                                                        </tr>
315
                                                    </nested:iterate>
316
                                                </tbody>
317
                                            </table>
318
                                            </nested:notEmpty>
319
                                        </div>
320
                                    </div>
321
 
322
                                </nested:iterate>
323
 
324
                            </nested:notEmpty>
325
 
326
                            <button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
327
                            <html:submit styleClass="btn btn-success" >Salvar</html:submit>
328
 
329
 
330
                        </html:form>
331
 
332
                </div>
333
            </div>
334
        </div>
335
    </div>
336
 
337
<%
338
 
339
    AbstractDao.getCurrentSession().getTransaction().commit();
340
%>
341