for (DegreeModuleToEnrol degreeModuleToEnrol : coursesToEnrol) {
CurricularCourse curricularCourse = (CurricularCourse) degreeModuleToEnrol.getContext().getChildDegreeModule();
HtmlTableRow htmlTableRow = groupTable.createRow();
HtmlTableCell cellName = htmlTableRow.createCell();
cellName.setClasses(getCurricularCourseNameClasses());
cellName.setBody(new HtmlText(curricularCourse.getName()));
// Year
final HtmlTableCell yearCell = htmlTableRow.createCell();
yearCell.setClasses(getCurricularCourseYearClasses());
yearCell.setColspan(2);
final StringBuilder year = new StringBuilder();
year.append(degreeModuleToEnrol.getContext().getCurricularPeriod().getFullLabel());
yearCell.setBody(new HtmlText(year.toString()));
if (!curricularCourse.isOptionalCurricularCourse()) {
// Ects
final HtmlTableCell ectsCell = htmlTableRow.createCell();
ectsCell.setClasses(getCurricularCourseEctsClasses());
final StringBuilder ects = new StringBuilder();
ects.append(curricularCourse.getEctsCredits()).append(" ")
.append(BundleUtil.getString(Bundle.ACADEMIC, "credits.abbreviation"));
ectsCell.setBody(new HtmlText(ects.toString()));
HtmlTableCell checkBoxCell = htmlTableRow.createCell();
checkBoxCell.setClasses(getCurricularCourseCheckBoxClasses());
HtmlCheckBox checkBox = new HtmlCheckBox(false);
checkBox.setName("degreeModuleToEnrolCheckBox" + degreeModuleToEnrol.getContext().getExternalId() + ":"
+ degreeModuleToEnrol.getCurriculumGroup().getExternalId());
checkBox.setUserValue(degreeModuleToEnrol.getKey());
degreeModulesToEnrolController.addCheckBox(checkBox);
checkBoxCell.setBody(checkBox);
} else {
final HtmlTableCell cell = htmlTableRow.createCell();
cell.setClasses(getCurricularCourseEctsClasses());
cell.setBody(new HtmlText(""));
HtmlTableCell linkTableCell = htmlTableRow.createCell();
linkTableCell.setClasses(getCurricularCourseCheckBoxClasses());
final HtmlLink htmlLink = new HtmlLink();
htmlLink.setText(BundleUtil.getString(Bundle.ACADEMIC, "link.option.choose.curricular.course"));
htmlLink.setUrl(getLinkURL());
htmlLink.setParameter("scpID", studentEnrolmentBean.getStudentCurricularPlan().getExternalId());
htmlLink.setParameter("executionPeriodID", studentEnrolmentBean.getExecutionPeriod().getExternalId());
htmlLink.setParameter("curriculumGroupID", degreeModuleToEnrol.getCurriculumGroup().getExternalId());
htmlLink.setParameter("contextID", degreeModuleToEnrol.getContext().getExternalId());
linkTableCell.setBody(htmlLink);
}
}
}