use of org.olat.course.nodes.cl.model.Checkbox in project OpenOLAT by OpenOLAT.
the class CheckListCourseNode method exportNode.
@Override
public void exportNode(File fExportDirectory, ICourse course) {
// export the files
CheckboxManager checkboxManager = CoreSpringFactory.getImpl(CheckboxManager.class);
ModuleConfiguration config = getModuleConfiguration();
CheckboxList list = (CheckboxList) config.get(CONFIG_KEY_CHECKBOX);
if (list != null && list.getList() != null) {
for (Checkbox checkbox : list.getList()) {
File dir = checkboxManager.getFileDirectory(course.getCourseEnvironment(), this);
if (dir.exists()) {
File fFileExportDir = new File(fExportDirectory, "checklistfiles/" + getIdent() + "/" + checkbox.getCheckboxId());
fFileExportDir.mkdirs();
FileUtils.copyDirContentsToDir(dir, fFileExportDir, false, "export files of checkbox");
}
}
}
}
use of org.olat.course.nodes.cl.model.Checkbox in project OpenOLAT by OpenOLAT.
the class CheckedPDFExport method create.
public void create(CheckboxList checkboxList, List<CheckListAssessmentRow> rows) throws IOException, COSVisitorException, TransformerException {
addMetadata(courseNodeTitle, courseTitle, author);
int i = 0;
for (Checkbox checkbox : checkboxList.getList()) {
create(checkbox, i++, rows);
}
addPageNumbers();
}
use of org.olat.course.nodes.cl.model.Checkbox in project openolat by klemens.
the class CheckListAssessmentController method loadDatas.
private List<CheckListAssessmentRow> loadDatas() {
if (!(coachCourseEnv instanceof UserCourseEnvironmentImpl)) {
return Collections.emptyList();
}
UserCourseEnvironmentImpl env = (UserCourseEnvironmentImpl) coachCourseEnv;
List<Checkbox> checkboxColl = checkboxList.getList();
int numOfCheckbox = checkboxList.getNumOfCheckbox();
boolean courseAdmin = env.isAdmin();
RepositoryEntry re = env.getCourseRepositoryEntry();
boolean courseTutor = repositoryService.hasRole(getIdentity(), re, GroupRoles.coach.name());
Set<Long> missingIdentityKeys = new HashSet<>();
if (courseTutor || courseAdmin) {
List<RepositoryEntryMembership> repoMemberships = repositoryManager.getRepositoryEntryMembership(re);
for (RepositoryEntryMembership repoMembership : repoMemberships) {
if (repoMembership.isParticipant()) {
missingIdentityKeys.add(repoMembership.getIdentityKey());
}
}
}
List<BusinessGroup> coachedGroups = courseAdmin ? coachCourseEnv.getCourseEnvironment().getCourseGroupManager().getAllBusinessGroups() : env.getCoachedGroups();
List<AssessmentData> dataList = checkboxManager.getAssessmentDatas(courseOres, courseNode.getIdent(), courseTutor || courseAdmin ? re : null, coachedGroups);
List<CheckListAssessmentRow> boxList = getAssessmentDataViews(dataList, checkboxColl);
Map<Long, CheckListAssessmentRow> identityToView = new HashMap<>();
for (CheckListAssessmentRow box : boxList) {
identityToView.put(box.getIdentityKey(), box);
missingIdentityKeys.remove(box.getIdentityKey());
}
List<BusinessGroupMembership> memberships = businessGroupService.getBusinessGroupsMembership(coachedGroups);
for (BusinessGroupMembership membership : memberships) {
if (!membership.isParticipant())
continue;
Long identityKey = membership.getIdentityKey();
if (!identityToView.containsKey(identityKey)) {
missingIdentityKeys.add(identityKey);
}
}
List<Identity> missingIdentities = securityManager.loadIdentityByKeys(missingIdentityKeys);
for (Identity missingIdentity : missingIdentities) {
Boolean[] checked = new Boolean[numOfCheckbox];
Float[] scores = new Float[numOfCheckbox];
CheckListAssessmentRow view = new CheckListAssessmentRow(missingIdentity, checked, scores, null, userPropertyHandlers, getLocale());
identityToView.put(missingIdentity.getKey(), view);
}
for (BusinessGroupMembership membership : memberships) {
if (!membership.isParticipant())
continue;
CheckListAssessmentRow view = identityToView.get(membership.getIdentityKey());
if (view != null) {
view.addGroupKey(membership.getGroupKey());
}
}
List<CheckListAssessmentRow> views = new ArrayList<>();
views.addAll(identityToView.values());
return views;
}
use of org.olat.course.nodes.cl.model.Checkbox in project openolat by klemens.
the class CheckListBoxListEditController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (addLink == source) {
Checkbox checkbox = new Checkbox();
checkbox.setCheckboxId(UUID.randomUUID().toString());
doOpenEdit(ureq, checkbox, true, translate("add.checkbox"));
} else if (boxTable == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
if ("edit".equals(cmd)) {
CheckboxConfigRow row = model.getObject(se.getIndex());
doOpenEdit(ureq, row.getCheckbox(), false, translate("edit.checkbox"));
} else if ("up".equals(cmd)) {
doUp(ureq, se.getIndex());
} else if ("down".equals(cmd)) {
doDown(ureq, se.getIndex());
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.course.nodes.cl.model.Checkbox 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();
}
Aggregations