Package org.fenixedu.academic.domain

Examples of org.fenixedu.academic.domain.ExecutionCourse


    private static Professorship findProfessorship(final HttpServletRequest request, final String executionCourseID) {
        final Person person = AccessControl.getPerson();
        if (person != null) {
            for (final Professorship professorship : person.getProfessorshipsSet()) {
                final ExecutionCourse executionCourse = professorship.getExecutionCourse();
                if (executionCourse.getExternalId().equals(executionCourseID)) {
                    return professorship;
                }
            }
        }
        throw new RuntimeException("User is not authorized to manage the selected course!");
View Full Code Here


        return forward(request, "/teacher/executionCourse/program.jsp");
    }

    public ActionForward prepareEditProgram(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        final ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");

        final Teacher teacher = getUserView(request).getPerson().getTeacher();
        if (teacher.isResponsibleFor(executionCourse) == null) {
            ActionMessages messages = new ActionMessages();
            messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.teacherNotResponsibleOrNotCoordinator"));
View Full Code Here

        return forward(request, "/teacher/executionCourse/objectives.jsp");
    }

    public ActionForward prepareEditObjectives(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        final ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");

        final Teacher teacher = getUserView(request).getPerson().getTeacher();
        if (teacher.isResponsibleFor(executionCourse) == null) {
            ActionMessages messages = new ActionMessages();
            messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.teacherNotResponsibleOrNotCoordinator"));
View Full Code Here

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
            HttpServletResponse response) throws Exception {

        final IViewState viewState = RenderUtils.getViewState();
        ExecutionCourse executionCourse = null;

        if (viewState != null && viewState.getMetaObject().getObject() instanceof SummariesManagementBean) {
            executionCourse = ((SummariesManagementBean) viewState.getMetaObject().getObject()).getExecutionCourse();
        } else if (viewState != null && viewState.getMetaObject().getObject() instanceof ShowSummariesBean) {
            executionCourse = ((ShowSummariesBean) viewState.getMetaObject().getObject()).getExecutionCourse();
        } else if (viewState != null && viewState.getMetaObject().getObject() instanceof NextPossibleSummaryLessonsAndDatesBean) {
            executionCourse =
                    ((NextPossibleSummaryLessonsAndDatesBean) viewState.getMetaObject().getObject()).getLesson().getShift()
                            .getDisciplinaExecucao();
        } else {
            executionCourse = readAndSaveExecutionCourse(request);
        }

        String teacherId = request.getParameter("teacherId_");

        Teacher loggedTeacher;
        Professorship loggedProfessorship;
        if (!StringUtils.isEmpty(teacherId)) {
            loggedTeacher = Teacher.readByIstId(teacherId);
            loggedProfessorship = loggedTeacher.getProfessorshipByExecutionCourse(executionCourse);
        } else {
            loggedProfessorship = AccessControl.getPerson().getProfessorshipByExecutionCourse(executionCourse);
        }

        if (loggedProfessorship == null) {
            throw new FenixActionException("error.summariesManagement.empty.loggedProfessorship");
        }

        request.setAttribute("loggedTeacherProfessorship", loggedProfessorship);
        request.setAttribute("loggedIsResponsible", loggedProfessorship.isResponsibleFor());
        request.setAttribute("executionCourse", executionCourse);
        request.setAttribute("executionCourseID", executionCourse.getExternalId());
        request.setAttribute("professorship", loggedProfessorship);

        ActionForward forward = super.execute(mapping, actionForm, request, response);
        return processForward(request, forward);
    }
View Full Code Here

        RenderUtils.invalidateViewState();
        DynaActionForm dynaActionForm = (DynaActionForm) form;

        Professorship loggedProfessorship = (Professorship) request.getAttribute("loggedTeacherProfessorship");
        ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");
        dynaActionForm.set("teacher", loggedProfessorship.getExternalId().toString());

        SummariesManagementBean newBean =
                new SummariesManagementBean(SummariesManagementBean.SummaryType.NORMAL_SUMMARY, executionCourse,
                        loggedProfessorship, null);
View Full Code Here

    public ActionForward deleteSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws FenixServiceException {

        Summary summary = getSummaryFromParameter(request);
        Professorship professorshipLogged = (Professorship) request.getAttribute("loggedTeacherProfessorship");
        ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");

        try {
            DeleteSummary.runDeleteSummary(executionCourse, summary, professorshipLogged);
        } catch (DomainException e) {
            addActionMessage(request, e.getMessage());
View Full Code Here

    }

    public ActionForward prepareShowSummaries(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) {

        ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");
        Professorship professorshipLogged = (Professorship) request.getAttribute("loggedTeacherProfessorship");
        Set<Summary> teacherSummaries = new TreeSet<Summary>(Summary.COMPARATOR_BY_DATE_AND_HOUR);
        teacherSummaries.addAll(professorshipLogged.getAssociatedSummariesSet());

        readAndSaveNextPossibleSummaryLessonsAndDates(request, executionCourse);
View Full Code Here

            HttpServletResponse response) {

        final IViewState viewState = RenderUtils.getViewState();
        ShowSummariesBean bean = (ShowSummariesBean) viewState.getMetaObject().getObject();

        ExecutionCourse executionCourse = bean.getExecutionCourse();
        ShiftType shiftType = bean.getShiftType();
        Shift shift = bean.getShift();

        SummaryTeacherBean summaryTeacher = bean.getSummaryTeacher();
        Professorship teacher = (summaryTeacher != null) ? summaryTeacher.getProfessorship() : null;
        Boolean otherTeachers = (summaryTeacher != null) ? summaryTeacher.getOthers() : null;
        SummariesOrder summariesOrder = bean.getSummariesOrder();

        Set<Summary> summariesToShow =
                summariesOrder == null || summariesOrder.equals(SummariesOrder.DECREASING) ? new TreeSet<Summary>(
                        Summary.COMPARATOR_BY_DATE_AND_HOUR) : new TreeSet<Summary>(new ReverseComparator(
                        Summary.COMPARATOR_BY_DATE_AND_HOUR));

        for (Summary summary : executionCourse.getAssociatedSummariesSet()) {
            boolean insert = true;
            if ((shift != null && (summary.getShift() == null || !summary.getShift().equals(shift)))
                    || (teacher != null && (summary.getProfessorship() == null || !summary.getProfessorship().equals(teacher)))
                    || (shiftType != null && (summary.getSummaryType() == null || !summary.getSummaryType().equals(shiftType)))
                    || (otherTeachers != null && otherTeachers && summary.getProfessorship() != null)) {
View Full Code Here

public class DownloadStudentsWithAttendsByExecutionCourseListWithGradesActionForTeacher extends FenixDispatchAction {

    public ActionForward downloadStudentListForGradesForm(final ActionMapping mapping, final ActionForm form,
            final HttpServletRequest request, final HttpServletResponse response) {

        final ExecutionCourse executionCourse = getDomainObject(request, "executionCourseOID");

        final Spreadsheet spreadsheet = new Spreadsheet(executionCourse.getSigla());
        spreadsheet.setHeader(BundleUtil.getString(Bundle.APPLICATION, "label.username"));
        spreadsheet.setHeader(BundleUtil.getString(Bundle.APPLICATION, "label.number"));
        spreadsheet.setHeader(BundleUtil.getString(Bundle.APPLICATION, "label.name"));
        spreadsheet.setHeader(BundleUtil.getString(Bundle.APPLICATION, "label.degree.code"));
        spreadsheet.setHeader(BundleUtil.getString(Bundle.APPLICATION, "label.attends.enrollmentState"));
        final List<Evaluation> evaluations = executionCourse.getOrderedAssociatedEvaluations();
        for (final Evaluation evaluation : evaluations) {
            spreadsheet.setHeader(evaluation.getPresentationName());
        }

        for (final Attends attends : executionCourse.getOrderedAttends()) {
            final Registration registration = attends.getRegistration();
            final Row row = spreadsheet.addRow();
            row.setCell(registration.getPerson().getUsername());
            row.setCell(registration.getNumber());
            row.setCell(registration.getName());
            row.setCell(registration.getDegree().getSigla());
            if (attends.getEnrolment() != null) {
                final EnrolmentEvaluationType enrolmentEvaluationType = attends.getEnrolmentEvaluationType();
                row.setCell(enrolmentEvaluationType.getDescription());
            } else {
                row.setCell(BundleUtil.getString(Bundle.APPLICATION, "label.attends.enrollmentState.notEnrolled"));
            }
            for (final Evaluation evaluation : evaluations) {
                final Mark mark = findMark(attends, evaluation);
                if (mark == null) {
                    row.setCell(" ");
                } else {
                    row.setCell(mark.getMark());
                }
            }
        }

        try {
            response.setHeader("Content-disposition", "attachment; filename=" + executionCourse.getSigla() + ".xls");
            response.setContentType("application/vnd.ms-excel");

            final ServletOutputStream outputStream = response.getOutputStream();
            spreadsheet.exportToXLSSheet(outputStream);
            outputStream.close();
View Full Code Here

    public ActionForward prepareCreateComplexSummaryInSummariesCalendarMode(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) throws FenixActionException {

        Professorship loggedProfessorship = (Professorship) request.getAttribute("loggedTeacherProfessorship");
        ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");
        NextPossibleSummaryLessonsAndDatesBean nextSummaryDateBean = getNextSummaryDateBeanFromParameter(request);

        if (!executionCourse.getLessons().contains(nextSummaryDateBean.getLesson())) {
            throw new FenixActionException();
        }

        DynaActionForm dynaActionForm = (DynaActionForm) form;
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.domain.ExecutionCourse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.