Subversion Repositories bacoAlunos

Rev

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

<%@ page import="pt.estgp.estgweb.domain.views.UserView" %>
<%@ page import="java.util.List" %>
<%@ 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="CourseUnitView" type="pt.estgp.estgweb.domain.views.CourseUnitView" scope="request"/>

<%
    String turma = request.getParameter("filterTurma");
    if(turma == null && request.getAttribute("filterTurma")!=null)
        turma = (String) request.getAttribute("filterTurma");

    String fromAction = "";
    String user = "";
    if (request.getParameter("from") != null)
    {
        user = "/user";
        fromAction = "From" + request.getParameter("from");
        if(request.getParameter("from").equals("CourseUnit"))
        {
            fromAction = "FromHome";
        }
    }
    request.setAttribute("user", user);
    request.setAttribute("fromAction", fromAction);

    String orderBy = request.getParameter("order");

    List<UserView> students = null;
    if(turma != null)
    {
        if(orderBy != null && orderBy.equals("byNumber"))
            students = CourseUnitView.getStudentsTurmaOrderedByNumber(turma);
        else
            students = CourseUnitView.getStudentsTurmaOrderedByName(turma);
    }
    else
    {
        if(orderBy != null && orderBy.equals("byNumber"))
            students = CourseUnitView.getStudentsOrderedByNumber();
        else
            students = CourseUnitView.getStudentsOrderedByName();
    }

    request.setAttribute("turma",turma);
    request.setAttribute("students",students);
    request.setAttribute("studentsSize",students.size());


%>
<div class="panel panel-default">
    <div class="panel-body">
        <p>
            <logic:notEmpty name="turma">
                (${turma})
            </logic:notEmpty>
            <bean:message key="courseunit.students.count"/>: ${studentsSize}
        </p>
        <table id="myTable" class="tablesorterfiltered">
            <thead> 
            <tr>
                <%/*<th><html:link action="${user}/startLoadCourseUnitStudents${fromAction}?courseUnitView.id=${CourseUnitView.id}&order=byNumber"><bean:message key="number"/></html:link></th>
                <th><html:link action="${user}/startLoadCourseUnitStudents${fromAction}?courseUnitView.id=${CourseUnitView.id}&order=byName"><bean:message key="name"/></html:link></th>
                */%>
                <th><bean:message key="number"/></th>
                <th><bean:message key="name"/></th>
                
                <th><bean:message key="user"/></th>
                
                <th><bean:message key="email"/></th>

                <baco:hasRole role="teacher">
                    <th><bean:message key="phone.number"/></th>
                </baco:hasRole>

                <th class="filter-name filter-select" data-placeholder="Todas">Turma</th>
            </tr>
            </thead>
            <tbody>
            <logic:iterate id="student" name="students" type="pt.estgp.estgweb.domain.views.UserView">
                <tr>
                    <td>
                            ${student.code}
                    </td>
                    <td>
                        <logic:notEmpty name="fromAction">
                            <html:link action="${user}/startLoadStudentCourseUnit${fromAction}?code=${student.code}&courseUnitView.id=${CourseUnitView.id}">${student.name}</html:link>
                        </logic:notEmpty>
                        <logic:empty name="fromAction">
                            <html:link target="_blank" action="/user/startProfileFromHome.do?userView.id=${student.id}">${student.name}</html:link>
                        </logic:empty>
                    </td>
                    <td>
                            ${student.username}
                    </td>
                    <td>
                        <logic:empty name="UserSession" property="user">
                            ${student.safeEmail}
                        </logic:empty>
                        <logic:notEmpty name="UserSession" property="user">
                            ${student.email}
                        </logic:notEmpty>
                    </td>
                    <baco:hasRole role="teacher">
                        <td>${student.phonenumber} </td>
                    </baco:hasRole>
                    <td>
                        ${student.studentTurma}
                    </td>
                </tr>
            </logic:iterate>
            </tbody>
        </table>
    </div>
</div>


<%
    if(CourseUnitView.getStudentsWithoutTurma() != null && CourseUnitView.getStudentsWithoutTurma().size() > 0)
    {
        request.setAttribute("students",CourseUnitView.getStudentsWithoutTurma());
        request.setAttribute("studentsSize",CourseUnitView.getStudentsWithoutTurma().size());
%>
<h2>Estudantes MAL ATRIBUIDOS, SEM TURMA, contactar a administração do sistema informático</h2>
<div class="panel panel-default">
    <div class="panel-body">
        <p>
            <logic:notEmpty name="turma">
                (${turma})
            </logic:notEmpty>
            <bean:message key="courseunit.students.count"/>: ${studentsSize}
        </p>
        <table class="tablesorterfiltered">
            <thead>
            <tr>
                <%/*<th><html:link action="${user}/startLoadCourseUnitStudents${fromAction}?courseUnitView.id=${CourseUnitView.id}&order=byNumber"><bean:message key="number"/></html:link></th>
                <th><html:link action="${user}/startLoadCourseUnitStudents${fromAction}?courseUnitView.id=${CourseUnitView.id}&order=byName"><bean:message key="name"/></html:link></th>
                */%>
                <th><bean:message key="number"/></th>
                <th><bean:message key="name"/></th>

                <th><bean:message key="user"/></th>

                <th><bean:message key="email"/></th>

                <baco:hasRole role="teacher">
                    <th><bean:message key="phone.number"/></th>
                </baco:hasRole>
            </tr>
            </thead>
            <tbody>
            <logic:iterate id="student" name="students" type="pt.estgp.estgweb.domain.views.UserView">
                <tr>
                    <td>
                            ${student.code}
                    </td>
                    <td>
                        <logic:notEmpty name="fromAction">
                            <html:link action="${user}/startLoadStudentCourseUnit${fromAction}?code=${student.code}&courseUnitView.id=${CourseUnitView.id}">${student.name}</html:link>
                        </logic:notEmpty>
                        <logic:empty name="fromAction">
                            <html:link target="_blank" action="/user/startProfileFromHome.do?userView.id=${student.id}">${student.name}</html:link>
                        </logic:empty>
                    </td>
                    <td>
                            ${student.username}
                    </td>
                    <td>
                        <logic:empty name="UserSession" property="user">
                            ${student.safeEmail}
                        </logic:empty>
                        <logic:notEmpty name="UserSession" property="user">
                            ${student.email}
                        </logic:notEmpty>
                    </td>
                    <baco:hasRole role="teacher">
                        <td>${student.phonenumber} </td>
                    </baco:hasRole>
                </tr>
            </logic:iterate>
            </tbody>
        </table>
    </div>
</div>
<%
    }
%>