blockContainer.addChild(table);
table.setClasses(getTablesClasses());
table.setStyle("width: " + (getInitialWidth() - depth) + "em; margin-left: " + depth + "em;");
for (Context context : contexts) {
final CurricularCourse curricularCourse = (CurricularCourse) context.getChildDegreeModule();
if (!curricularCourse.isOptionalCurricularCourse()) {
final HtmlTableRow htmlTableRow = table.createRow();
HtmlTableCell cellName = htmlTableRow.createCell();
cellName.setClasses(getCurricularCourseNameClasses());
cellName.setBody(new HtmlText(curricularCourse.getName(getExecutionSemester())));
// Year
final HtmlTableCell yearCell = htmlTableRow.createCell();
yearCell.setClasses(getCurricularCourseYearClasses());
yearCell.setBody(new HtmlText(context.getCurricularPeriod().getFullLabel()));
// Ects
final HtmlTableCell ectsCell = htmlTableRow.createCell();
ectsCell.setClasses(getCurricularCourseEctsClasses());
final StringBuilder ects = new StringBuilder();
ects.append(curricularCourse.getEctsCredits(getExecutionSemester())).append(" ")
.append(BundleUtil.getString(Bundle.ACADEMIC, "credits.abbreviation"));
ectsCell.setBody(new HtmlText(ects.toString()));
// enrolment link
final HtmlTableCell linkTableCell = htmlTableRow.createCell();
linkTableCell.setClasses(getCurricularCourseLinkClasses());
final HtmlActionLink actionLink = new HtmlActionLink();
actionLink.setText(BundleUtil.getString(Bundle.ACADEMIC, "link.option.enrol.curricular.course"));
actionLink.setName("curricularCourseEnrolLink" + curricularCourse.getExternalId());
actionLink.setOnClick(String.format(
"$(this).closest('form').find('input[name=\\'method\\']').attr('value', '%s');", getMethodName()));
//actionLink.setOnClick(String.format("document.forms[0].method.value='%s';", getMethodName()));
actionLink.setController(new UpdateSelectedCurricularCourseController(curricularCourse));
linkTableCell.setBody(actionLink);