use of de.bps.olat.modules.cl.Checklist in project openolat by klemens.
the class ChecklistCourseNode method exportNode.
@Override
public void exportNode(File exportDirectory, ICourse course) {
XStream xstream = XStreamHelper.createXStreamInstance();
ChecklistManager cm = ChecklistManager.getInstance();
Checklist checklist = loadOrCreateChecklist(course.getCourseEnvironment().getCoursePropertyManager());
Checklist copy = cm.copyChecklistInRAM(checklist);
String exportContent = xstream.toXML(copy);
ExportUtil.writeContentToFile(getExportFilename(), exportContent, exportDirectory, WebappHelper.getDefaultCharset());
}
use of de.bps.olat.modules.cl.Checklist in project openolat by klemens.
the class ChecklistCourseNode method cleanupOnDelete.
@Override
public void cleanupOnDelete(ICourse course) {
super.cleanupOnDelete(course);
// delete checklist in db
Checklist checklist = loadOrCreateChecklist(course.getCourseEnvironment().getCoursePropertyManager());
ChecklistManager.getInstance().deleteChecklist(checklist);
checklist = null;
// delete node configuration
deleteChecklistKeyConf(course.getCourseEnvironment().getCoursePropertyManager());
}
use of de.bps.olat.modules.cl.Checklist in project openolat by klemens.
the class ChecklistCourseNode method loadOrCreateChecklist.
/**
* Load referenced checklist or create a new one
* @param cpm
* @return Checklist
*/
public Checklist loadOrCreateChecklist(final CoursePropertyManager cpm) {
Checklist checklist;
if (getChecklistKey(cpm) == null) {
// this is a copied node, the checklist is referenced by createInstanceForCopy()
if (getModuleConfiguration().get(CONF_CHECKLIST_COPY) != null) {
checklist = ChecklistManager.getInstance().loadChecklist((Checklist) getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST_COPY));
getModuleConfiguration().remove(CONF_CHECKLIST_COPY);
} else // this is part of a copied course, the original checklist will be copied
if (getModuleConfiguration().get(CONF_CHECKLIST) != null) {
Checklist confChecklist = (Checklist) getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST);
Checklist orgChecklist = ChecklistManager.getInstance().loadChecklist(confChecklist);
checklist = ChecklistManager.getInstance().copyChecklist(orgChecklist);
} else {
// no checklist available, create new one
checklist = new Checklist();
ChecklistManager.getInstance().saveChecklist(checklist);
}
// set referenced checklist in configuration
setChecklistKey(cpm, checklist.getKey());
} else {
checklist = ChecklistManager.getInstance().loadChecklist(getChecklistKey(cpm));
}
return checklist;
}
use of de.bps.olat.modules.cl.Checklist in project OpenOLAT by OpenOLAT.
the class ChecklistEditController method event.
/**
* {@inheritDoc}
*/
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == accessibilityCondContr) {
if (event == Event.CHANGED_EVENT) {
Condition cond = accessibilityCondContr.getCondition();
courseNode.setPreConditionAccess(cond);
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == checklistFormContr && event == Event.CHANGED_EVENT) {
// checklist = ChecklistManager.getInstance().saveChecklist(checklist);
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
} else if (source == manageController && event == Event.DONE_EVENT) {
cmcManage.deactivate();
} else if (event == NodeEditController.NODECONFIG_CHANGED_EVENT) {
// update title and description according to the course node
Checklist cl = ChecklistManager.getInstance().loadChecklist(checklist);
cl.setTitle(courseNode.getShortTitle());
cl.setDescription(courseNode.getLongTitle());
checklist = ChecklistManager.getInstance().saveChecklist(cl);
}
}
use of de.bps.olat.modules.cl.Checklist in project OpenOLAT by OpenOLAT.
the class ChecklistCourseNode method loadOrCreateChecklist.
/**
* Load referenced checklist or create a new one
* @param cpm
* @return Checklist
*/
public Checklist loadOrCreateChecklist(final CoursePropertyManager cpm) {
Checklist checklist;
if (getChecklistKey(cpm) == null) {
// this is a copied node, the checklist is referenced by createInstanceForCopy()
if (getModuleConfiguration().get(CONF_CHECKLIST_COPY) != null) {
checklist = ChecklistManager.getInstance().loadChecklist((Checklist) getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST_COPY));
getModuleConfiguration().remove(CONF_CHECKLIST_COPY);
} else // this is part of a copied course, the original checklist will be copied
if (getModuleConfiguration().get(CONF_CHECKLIST) != null) {
Checklist confChecklist = (Checklist) getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST);
Checklist orgChecklist = ChecklistManager.getInstance().loadChecklist(confChecklist);
checklist = ChecklistManager.getInstance().copyChecklist(orgChecklist);
} else {
// no checklist available, create new one
checklist = new Checklist();
ChecklistManager.getInstance().saveChecklist(checklist);
}
// set referenced checklist in configuration
setChecklistKey(cpm, checklist.getKey());
} else {
checklist = ChecklistManager.getInstance().loadChecklist(getChecklistKey(cpm));
}
return checklist;
}
Aggregations