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;
}
Aggregations