Subversion Repositories bacoAlunos

Rev

Rev 1505 | Rev 1507 | Go to most recent revision | Details | Compare with Previous | 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">
1506 jmachado 183
                                            <nested:select property="id">
184
                                                <html:option value="S1">Semestre 1</html:option>
185
                                                <html:option value="S2">Semestre 2</html:option>
186
                                                <html:option value="S3">Semestre 3</html:option>
187
                                                <html:option value="S4">Semestre 4</html:option>
188
                                                <html:option value="S5">Semestre 5</html:option>
189
                                                <html:option value="S6">Semestre 6</html:option>
190
                                                <html:option value="T1">Trimestre 1</html:option>
191
                                                <html:option value="T2">Trimestre 2</html:option>
192
                                                <html:option value="T3">Trimestre 3</html:option>
193
                                                <html:option value="T4">Trimestre 4</html:option>
194
                                                <html:option value="T5">Trimestre 5</html:option>
195
                                                <html:option value="T6">Trimestre 6</html:option>
196
                                                <html:option value="T7">Trimestre 7</html:option>
197
                                                <html:option value="T8">Trimestre 8</html:option>
198
                                            </nested:select>
1505 jmachado 199
                                        </div>
200
                                        <div class="panel-body">
201
 
202
                                            <button class="btn btn-default" data-toggle="collapse" type="button" data-target=".langs">Ver Campos Multingua</button>
203
                                            <nested:iterate id="perfil" property="perfil" type="pt.estgp.estgweb.services.courses.xsd.Curso.Semestre.Perfil">
204
                                                <div class="panel panel-default">
205
                                                    <div class="panel-heading">
206
                                                        PERFIL <nested:text styleClass="form-control" property="nome"/>
207
                                                    </div>
208
                                                    <div class="panel-body">
209
                                                        <table class="tablesorterfiltered">
210
                                                            <thead>
211
                                                            <tr>
212
                                                                <th>SIGES</th>
213
                                                                <th>Nome</th>
214
                                                                <th>Total</th>
215
                                                                <th>T</th>
216
                                                                <th>TP</th>
217
                                                                <th>P</th>
218
                                                                <th>PL</th>
219
                                                                <th>PD</th>
220
                                                                <th>OT</th>
221
                                                                <th>E</th>
222
                                                                <th>S</th>
223
                                                                <th>TC</th>
224
                                                                <th>O</th>
225
                                                                <th>ECTS</th>
226
                                                                <th>URL UNIDADE</th>
227
                                                                <th>FICHA URL</th>
228
                                                            </tr>
229
                                                            </thead>
230
                                                            <tbody>
231
                                                            <nested:iterate id="unidade" property="unidade" type="pt.estgp.estgweb.services.courses.xsd.UnidadeType">
232
                                                                <tr>
233
                                                                    <td><nested:text styleClass="form-control" property="siges"/></td>
234
                                                                    <td>
235
                                                                        <div>
236
                                                                            <div class="col-sm-1">(PT)</div>
237
                                                                            <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nome"/></div>
238
 
239
                                                                            <div class="langs collapse" >
240
                                                                                <div class="col-sm-1">(EN)</div>
241
                                                                                <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeEn"/></div>
242
                                                                                <div class="col-sm-1">(ES)</div>
243
                                                                                <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeEs"/></div>
244
                                                                                <div class="col-sm-1">(FR)</div>
245
                                                                                <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeFr"/></div>
246
                                                                            </div>
247
                                                                        </div>
248
 
249
                                                                    </td>
250
                                                                    <td><nested:text styleClass="form-control" property="totalHoras"/></td>
251
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.t"/></td>
252
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.TP"/></td>
253
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.p"/></td>
254
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.PL"/></td>
255
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.PD"/></td>
256
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.OT"/></td>
257
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.e"/></td>
258
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.s"/></td>
259
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.TC"/></td>
260
                                                                    <td><nested:text styleClass="form-control" property="horasContacto.o"/></td>
261
                                                                    <td><nested:text styleClass="form-control" property="ECTS"/></td>
262
                                                                    <td><nested:text styleClass="form-control" style="width:600px" property="urlUnidadeCurricular"/></td>
263
                                                                    <td><nested:text styleClass="form-control" style="width:600px" property="urlFichaCurricular"/></td>
264
                                                                </tr>
265
                                                            </nested:iterate>
266
                                                            </tbody>
267
                                                        </table>
268
                                                    </div>
269
                                                </div>
270
 
271
                                            </nested:iterate>
272
 
273
                                            <nested:notEmpty property="unidade">
274
                                                <table class="tablesorterfiltered">
275
                                                <thead>
276
                                                    <tr>
277
                                                        <th>SIGES</th>
278
                                                        <th>Nome</th>
279
                                                        <th>Total</th>
280
                                                        <th>T</th>
281
                                                        <th>TP</th>
282
                                                        <th>P</th>
283
                                                        <th>PL</th>
284
                                                        <th>PD</th>
285
                                                        <th>OT</th>
286
                                                        <th>E</th>
287
                                                        <th>S</th>
288
                                                        <th>TC</th>
289
                                                        <th>O</th>
290
                                                        <th>ECTS</th>
291
                                                        <th>URL UNIDADE</th>
292
                                                        <th>FICHA URL</th>
293
                                                    </tr>
294
                                                </thead>
295
                                                <tbody>
296
                                                    <nested:iterate id="unidade" property="unidade" type="pt.estgp.estgweb.services.courses.xsd.UnidadeType">
297
                                                        <tr>
298
                                                            <td><nested:text styleClass="form-control" property="siges"/></td>
299
                                                            <td>
300
                                                                <div>
301
                                                                    <div class="col-sm-1">(PT)</div>
302
                                                                    <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nome"/></div>
303
 
304
                                                                    <div class="langs collapse" >
305
                                                                        <div class="col-sm-1">(EN)</div>
306
                                                                        <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeEn"/></div>
307
                                                                        <div class="col-sm-1">(ES)</div>
308
                                                                        <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeEs"/></div>
309
                                                                        <div class="col-sm-1">(FR)</div>
310
                                                                        <div class="col-sm-11"><nested:text style="width:300px" styleClass="form-control" property="nomeFr"/></div>
311
                                                                    </div>
312
                                                                </div>
313
 
314
                                                            </td>
315
                                                            <td><nested:text styleClass="form-control" property="totalHoras"/></td>
316
                                                            <td><nested:text styleClass="form-control" property="horasContacto.t"/></td>
317
                                                            <td><nested:text styleClass="form-control" property="horasContacto.TP"/></td>
318
                                                            <td><nested:text styleClass="form-control" property="horasContacto.p"/></td>
319
                                                            <td><nested:text styleClass="form-control" property="horasContacto.PL"/></td>
320
                                                            <td><nested:text styleClass="form-control" property="horasContacto.PD"/></td>
321
                                                            <td><nested:text styleClass="form-control" property="horasContacto.OT"/></td>
322
                                                            <td><nested:text styleClass="form-control" property="horasContacto.e"/></td>
323
                                                            <td><nested:text styleClass="form-control" property="horasContacto.s"/></td>
324
                                                            <td><nested:text styleClass="form-control" property="horasContacto.TC"/></td>
325
                                                            <td><nested:text styleClass="form-control" property="horasContacto.o"/></td>
326
                                                            <td><nested:text styleClass="form-control" property="ECTS"/></td>
327
                                                            <td><nested:text styleClass="form-control" style="width:600px" property="urlUnidadeCurricular"/></td>
328
                                                            <td><nested:text styleClass="form-control" style="width:600px" property="urlFichaCurricular"/></td>
329
                                                        </tr>
330
                                                    </nested:iterate>
331
                                                </tbody>
332
                                            </table>
333
                                            </nested:notEmpty>
334
                                        </div>
335
                                    </div>
336
 
337
                                </nested:iterate>
338
 
339
                            </nested:notEmpty>
340
 
341
                            <button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
342
                            <html:submit styleClass="btn btn-success" >Salvar</html:submit>
343
 
344
 
345
                        </html:form>
346
 
347
                </div>
348
            </div>
349
        </div>
350
    </div>
351
 
352
<%
353
 
354
    AbstractDao.getCurrentSession().getTransaction().commit();
355
%>
356