use of org.olat.course.nodes.cl.model.CheckboxList in project openolat by klemens.
the class CheckListBoxListEditController method doDelete.
private void doDelete(UserRequest ureq, Checkbox checkbox) {
CheckboxList list = (CheckboxList) config.get(CheckListCourseNode.CONFIG_KEY_CHECKBOX);
if (list == null || checkbox == null)
return;
list.remove(checkbox);
config.set(CheckListCourseNode.CONFIG_KEY_CHECKBOX, list);
fireEvent(ureq, Event.DONE_EVENT);
updateModel();
}
use of org.olat.course.nodes.cl.model.CheckboxList in project openolat by klemens.
the class CheckListBoxListEditController method updateModel.
private void updateModel() {
CheckboxList list = (CheckboxList) config.get(CheckListCourseNode.CONFIG_KEY_CHECKBOX);
List<CheckboxConfigRow> boxList = new ArrayList<CheckboxConfigRow>();
if (list != null && list.getList() != null) {
for (Checkbox checkbox : list.getList()) {
DownloadLink download = null;
VFSContainer container = checkboxManager.getFileContainer(courseEnv, courseNode);
if (container != null) {
VFSItem item = container.resolve(checkbox.getFilename());
if (item instanceof VFSLeaf) {
download = uifactory.addDownloadLink("file_" + checkbox.getCheckboxId(), checkbox.getFilename(), null, (VFSLeaf) item, boxTable);
}
}
boxList.add(new CheckboxConfigRow(checkbox, download));
}
}
model.setObjects(boxList);
boxTable.reset();
}
use of org.olat.course.nodes.cl.model.CheckboxList in project openolat by klemens.
the class CheckListBoxListEditController method doEdit.
private void doEdit(UserRequest ureq, Checkbox checkbox) {
CheckboxList list = (CheckboxList) config.get(CheckListCourseNode.CONFIG_KEY_CHECKBOX);
if (list == null) {
list = new CheckboxList();
}
list.add(checkbox);
config.set(CheckListCourseNode.CONFIG_KEY_CHECKBOX, list);
fireEvent(ureq, Event.DONE_EVENT);
updateModel();
}
use of org.olat.course.nodes.cl.model.CheckboxList in project openolat by klemens.
the class CheckListConfigurationController method getAvailableSumCutValues.
private String[] getAvailableSumCutValues() {
int currentNumOfCheckbox;
if (data == null) {
CheckboxList list = (CheckboxList) config.get(CheckListCourseNode.CONFIG_KEY_CHECKBOX);
currentNumOfCheckbox = list == null ? 0 : list.getNumOfCheckbox();
} else {
currentNumOfCheckbox = data.getNumOfCheckbox();
}
String[] numKeys = new String[currentNumOfCheckbox + 1];
for (int i = 0; i <= currentNumOfCheckbox; i++) {
numKeys[i] = Integer.toString(i);
}
return numKeys;
}
use of org.olat.course.nodes.cl.model.CheckboxList in project openolat by klemens.
the class CheckListCourseNode method doUpdateAssessmentBySum.
private void doUpdateAssessmentBySum(Identity identity, UserCourseEnvironment assessedUserCourseEnv, Identity assessedIdentity, Role by) {
OLATResourceable courseOres = OresHelper.createOLATResourceableInstance("CourseModule", assessedUserCourseEnv.getCourseEnvironment().getCourseResourceableId());
ModuleConfiguration config = getModuleConfiguration();
CheckboxManager checkboxManager = CoreSpringFactory.getImpl(CheckboxManager.class);
int checkedBox = checkboxManager.countChecked(assessedIdentity, courseOres, getIdent());
CheckboxList checkboxList = (CheckboxList) config.get(CONFIG_KEY_CHECKBOX);
Integer cut = (Integer) config.get(CheckListCourseNode.CONFIG_KEY_PASSED_SUM_CUTVALUE);
int minNumOfCheckbox = cut == null ? checkboxList.getNumOfCheckbox() : cut.intValue();
boolean passed = checkedBox >= minNumOfCheckbox;
Float score = null;
if (passed) {
Boolean scoreGrantedBool = (Boolean) config.get(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD);
if (scoreGrantedBool != null && scoreGrantedBool.booleanValue()) {
score = checkboxManager.calculateScore(assessedIdentity, courseOres, getIdent());
Float maxScore = (Float) config.get(MSCourseNode.CONFIG_KEY_SCORE_MAX);
if (maxScore != null && maxScore.floatValue() < score) {
score = maxScore.floatValue();
}
}
}
ScoreEvaluation sceval = new ScoreEvaluation(score, new Boolean(passed));
AssessmentManager am = assessedUserCourseEnv.getCourseEnvironment().getAssessmentManager();
am.saveScoreEvaluation(this, identity, assessedIdentity, sceval, assessedUserCourseEnv, false, by);
}
Aggregations