예제 #1
0
  public String processGradebookView() {
    Long currentGbId = ((Gradebook) gradebookTable.getRowData()).getId();

    // if instructor, we need to load all students
    if (isEditable()) {
      currentGradebook = gradebookManager.getGradebookByIdWithHeadings(currentGbId);
      currentGradebook.setUsernames(gradebookManager.getUsernamesInGradebook(currentGradebook));
      studentMap = currentGradebook.getStudentMap();
      setSelectedStudent((String) studentMap.firstKey());
      return "view_student";
    }

    // otherwise, just load what we need for the current user
    currentGradebook = gradebookManager.getGradebookByIdWithHeadings(currentGbId);
    this.userId = SessionManager.getCurrentSessionUserId();

    currentStudent = gradebookManager.getStudentByGBAndUsername(currentGradebook, this.userEid);
    if (currentStudent != null) {
      currentStudent.setLastChecked(new Timestamp(new Date().getTime()));
      gradebookManager.updateStudent(currentStudent);

      currentStudent.setGradebook(currentGradebook);
    }

    return "view_grades";
  }
예제 #2
0
  public String getSelectedStudentGrades() {
    if (currentGradebook == null) {
      return "<p>" + msgs.getString("no_gradebook_selected") + "</p>";
    }

    if (currentGradebook.getUsernames() == null || currentGradebook.getUsernames().isEmpty()) {
      return "<p>"
          + msgs.getFormattedMessage(
              "no_grades_in_gradebook",
              new Object[] {StringEscapeUtils.escapeHtml(currentGradebook.getTitle())})
          + "</p>";
    }

    if (selectedStudent == null || selectedStudent.equals("")) {
      return msgs.getString("select_participant");
    }

    StudentGrades selStudent =
        gradebookManager.getStudentByGBAndUsername(currentGradebook, selectedStudent);
    if (selStudent != null) {
      selStudent.setGradebook(currentGradebook);
      return selStudent.formatGrades();
    }

    return msgs.getString("select_participant");
  }