Search in sources :

Example 1 with ArchivedCoursesTableRow

use of teammates.ui.template.ArchivedCoursesTableRow in project teammates by TEAMMATES.

the class InstructorCoursesPageData method convertToArchivedCoursesTable.

private ArchivedCoursesTable convertToArchivedCoursesTable(List<CourseAttributes> archivedCourses) {
    ArchivedCoursesTable archivedCoursesTable = new ArchivedCoursesTable();
    int idx = this.activeCourses.getRows().size() - 1;
    for (CourseAttributes course : archivedCourses) {
        idx++;
        List<ElementTag> actionsParam = new ArrayList<>();
        String unarchiveLink = getInstructorCourseArchiveLink(course.getId(), false, false);
        ElementTag unarchivedButton = createButton("Unarchive", "btn btn-default btn-xs", "t_course_unarchive" + idx, unarchiveLink, "", false);
        String deleteLink = getInstructorCourseDeleteLink(course.getId(), false);
        Boolean hasDeletePermission = instructorsForCourses.get(course.getId()).isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE);
        ElementTag deleteButton = createButton("Delete", "btn btn-default btn-xs course-delete-link", "t_course_delete" + idx, deleteLink, Const.Tooltips.COURSE_DELETE, !hasDeletePermission);
        deleteButton.setAttribute("data-course-id", course.getId());
        actionsParam.add(unarchivedButton);
        actionsParam.add(deleteButton);
        ArchivedCoursesTableRow row = new ArchivedCoursesTableRow(SanitizationHelper.sanitizeForHtml(course.getId()), SanitizationHelper.sanitizeForHtml(course.getName()), course.getCreatedAtDateString(), course.getCreatedAtDateStamp(), course.getCreatedAtFullDateTimeString(), actionsParam);
        archivedCoursesTable.getRows().add(row);
    }
    return archivedCoursesTable;
}
Also used : ArrayList(java.util.ArrayList) ArchivedCoursesTable(teammates.ui.template.ArchivedCoursesTable) ElementTag(teammates.ui.template.ElementTag) ArchivedCoursesTableRow(teammates.ui.template.ArchivedCoursesTableRow) CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes)

Aggregations

ArrayList (java.util.ArrayList)1 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)1 ArchivedCoursesTable (teammates.ui.template.ArchivedCoursesTable)1 ArchivedCoursesTableRow (teammates.ui.template.ArchivedCoursesTableRow)1 ElementTag (teammates.ui.template.ElementTag)1