protected void generateCurricularCoursesToEnrol(HtmlTable groupTable, StudentCurriculumGroupBean studentCurriculumGroupBean) {
final List<IDegreeModuleToEvaluate> coursesToEvaluate = studentCurriculumGroupBean.getSortedDegreeModulesToEvaluate();
for (final IDegreeModuleToEvaluate degreeModuleToEvaluate : coursesToEvaluate) {
HtmlTableRow htmlTableRow = groupTable.createRow();
HtmlTableCell cellName = htmlTableRow.createCell();
cellName.setClasses(getRenderer().getCurricularCourseToEnrolNameClasses());
String degreeName = degreeModuleToEvaluate.getName();
if (canPerformStudentEnrolments && degreeModuleToEvaluate.getDegreeModule() instanceof CurricularCourse) {
if (!StringUtils.isEmpty(degreeModuleToEvaluate.getDegreeModule().getCode())) {
degreeName = degreeModuleToEvaluate.getDegreeModule().getCode() + " - " + degreeName;
}
CurricularCourse curricularCourse = (CurricularCourse) degreeModuleToEvaluate.getDegreeModule();
degreeName +=
" (" + BundleUtil.getString(Bundle.STUDENT, "label.grade.scale") + " - "
+ curricularCourse.getGradeScaleChain().getDescription() + ") ";
}
cellName.setBody(new HtmlText(degreeName));
// Year
final HtmlTableCell yearCell = htmlTableRow.createCell();
yearCell.setClasses(getRenderer().getCurricularCourseToEnrolYearClasses());
yearCell.setColspan(2);
yearCell.setBody(new HtmlText(degreeModuleToEvaluate.getYearFullLabel()));
if (!degreeModuleToEvaluate.isOptionalCurricularCourse()) {
// Ects
final HtmlTableCell ectsCell = htmlTableRow.createCell();
ectsCell.setClasses(getRenderer().getCurricularCourseToEnrolEctsClasses());
final StringBuilder ects = new StringBuilder();
ects.append(degreeModuleToEvaluate.getEctsCredits()).append(" ")
.append(BundleUtil.getString(Bundle.STUDENT, "label.credits.abbreviation"));
ectsCell.setBody(new HtmlText(ects.toString()));
HtmlTableCell checkBoxCell = htmlTableRow.createCell();
checkBoxCell.setClasses(getRenderer().getCurricularCourseToEnrolCheckBoxClasses());
HtmlCheckBox checkBox = new HtmlCheckBox(false);
checkBox.setName("degreeModuleToEnrolCheckBox" + degreeModuleToEvaluate.getKey());
checkBox.setUserValue(degreeModuleToEvaluate.getKey());
getDegreeModulesToEvaluateController().addCheckBox(checkBox);
checkBoxCell.setBody(checkBox);
} else {
final HtmlTableCell cell = htmlTableRow.createCell();
cell.setClasses(getRenderer().getCurricularCourseToEnrolEctsClasses());
cell.setBody(new HtmlText(""));
HtmlTableCell linkTableCell = htmlTableRow.createCell();
linkTableCell.setClasses(getRenderer().getCurricularCourseToEnrolCheckBoxClasses());
final HtmlActionLink actionLink = new HtmlActionLink();
actionLink.setText(BundleUtil.getString(Bundle.STUDENT, "label.chooseOptionalCurricularCourse"));
actionLink.setController(new OptionalCurricularCourseLinkController(degreeModuleToEvaluate));
actionLink
.setOnClick("$(this).closest('form').find('input[name=\\'method\\']').attr('value', 'prepareChooseOptionalCurricularCourseToEnrol');");
//actionLink.setOnClick("document.forms[2].method.value='prepareChooseOptionalCurricularCourseToEnrol';");
actionLink.setName("optionalCurricularCourseLink" + degreeModuleToEvaluate.getCurriculumGroup().getExternalId()
+ "_" + degreeModuleToEvaluate.getContext().getExternalId());
linkTableCell.setBody(actionLink);
}
if (getRenderer().isEncodeCurricularRules()) {
encodeCurricularRules(groupTable, degreeModuleToEvaluate);
}