Exemplo n.º 1
0
  public TeachersSummaryPage() {
    IColumn[] columns =
        new IColumn[] {
          new PropertyColumn(
              new Model(TeachUsSession.get().getString("General.teacher")),
              "teacher.name"), //$NON-NLS-1$ //$NON-NLS-2$
          new PropertyColumn(
              new Model(TeachUsSession.get().getString("TeachersSummaryPage.numberOfPupils")),
              "pupilCount"), //$NON-NLS-1$ //$NON-NLS-2$
          new PropertyColumn(
              new Model(TeachUsSession.get().getString("TeachersSummaryPage.numberOfPeriods")),
              "periodCount"), //$NON-NLS-1$ //$NON-NLS-2$
          new PropertyColumn(
              new Model(
                  TeachUsSession.get().getString("TeachersSummaryPage.numberOfPupilBookings")),
              "pupilBookingCount"), //$NON-NLS-1$ //$NON-NLS-2$
          new PropertyColumn(
              new Model(
                  TeachUsSession.get().getString("TeachersSummaryPage.numberOfTeacherBookings")),
              "teacherBookingCount"), //$NON-NLS-1$ //$NON-NLS-2$
          new PropertyColumn(
              new Model(TeachUsSession.get().getString("TeachersSummaryPage.numberOfBookings")),
              "totalBookingCount"), //$NON-NLS-1$ //$NON-NLS-2$
        };

    List<TeacherStatistics> data = TeachUsApplication.get().getStatisticsDAO().getTeachers();

    add(new ListPanel("teachersSummary", columns, data)); // $NON-NLS-1$
  }
Exemplo n.º 2
0
  public void appendEntries(List<Entry> entries, TeachUsDate fromDate, TeachUsDate toDate) {
    StatisticsDAO statisticsDAO = TeachUsApplication.get().getStatisticsDAO();
    List<PupilBooking> bookings = statisticsDAO.getAllBookings(fromDate, toDate);

    for (PupilBooking pupilBooking : bookings) {
      if (pupilBooking.isActive()) {
        entries.add(createEntry(pupilBooking));
      } else {
        TeachUsDate createDate = pupilBooking.getCreateDate();
        TeachUsDate updateDate = pupilBooking.getUpdateDate();

        if (createDate.intervalMinutes(updateDate) > 60) {
          entries.add(createEntry(pupilBooking));
          entries.add(createDeleteEntry(pupilBooking));
        }
      }
    }

    //		PersonDAO personDAO = TeachUsApplication.get().getPersonDAO();
    //		BookingDAO bookingDAO = TeachUsApplication.get().getBookingDAO();
    //
    //		List<Teacher> teachers = personDAO.getPersons(Teacher.class);
    //		for (Teacher teacher : teachers) {
    //
    //			Bookings bookings = bookingDAO.getBookings(teacher, fromDate, toDate);
    //			List<Booking> bookingList = bookings.getBookingList();
    //			for (Booking booking : bookingList) {
    //				if (booking instanceof PupilBooking) {
    //					PupilBooking pupilBooking = (PupilBooking) booking;
    //
    //					if (pupilBooking.isActive()) {
    //						entries.add(createEntry(pupilBooking));
    //					} else {
    //						TeachUsDate createDate = booking.getCreateDate();
    //						TeachUsDate updateDate = booking.getUpdateDate();
    //
    //						if (createDate.intervalMinutes(updateDate) > 60) {
    //							entries.add(createEntry(pupilBooking));
    //							entries.add(createDeleteEntry(pupilBooking));
    //						}
    //					}
    //				}
    //			}
    //		}
  }