use of de.bps.olat.modules.cl.Checklist in project OpenOLAT by OpenOLAT.
the class ChecklistCourseNode method initDefaultConfig.
private void initDefaultConfig() {
ModuleConfiguration config = getModuleConfiguration();
// add an empty checkpoint entry as default if none existent
if (config.get(CONF_CHECKLIST) == null) {
Checklist initialChecklist = new Checklist();
// set to config
config.set(CONF_CHECKLIST, initialChecklist);
// save to db
ChecklistManager.getInstance().saveChecklist(initialChecklist);
}
}
use of de.bps.olat.modules.cl.Checklist in project OpenOLAT by OpenOLAT.
the class ChecklistCourseNode method createInstanceForCopy.
@Override
public CourseNode createInstanceForCopy(boolean isNewTitle, ICourse course, Identity author) {
CourseNode copyInstance = super.createInstanceForCopy(isNewTitle, course, author);
ChecklistManager cm = ChecklistManager.getInstance();
// load checklist
Checklist checklist = cm.loadChecklist((Checklist) getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST));
// remove old config
copyInstance.getModuleConfiguration().remove(ChecklistCourseNode.CONF_CHECKLIST);
// create new checklist with same settings and save to db
Checklist initialChecklist = cm.copyChecklist(checklist);
// set to config
copyInstance.getModuleConfiguration().set(CONF_CHECKLIST_COPY, initialChecklist);
return copyInstance;
}
use of de.bps.olat.modules.cl.Checklist in project openolat by klemens.
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 klemens.
the class ChecklistCourseNode method importNode.
@Override
public void importNode(File importDirectory, ICourse course, Identity owner, Locale locale, boolean withReferences) {
CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
if (getChecklistKey(cpm) != null)
deleteChecklistKeyConf(cpm);
File importFile = new File(importDirectory, getExportFilename());
String importContent = FileUtils.load(importFile, WebappHelper.getDefaultCharset());
if (importContent == null || importContent.isEmpty()) {
return;
}
XStream xstream = XStreamHelper.createXStreamInstance();
Checklist checklist = (Checklist) xstream.fromXML(importContent);
if (checklist != null) {
checklist = ChecklistManager.getInstance().copyChecklist(checklist);
setChecklistKey(cpm, checklist.getKey());
}
}
use of de.bps.olat.modules.cl.Checklist in project openolat by klemens.
the class ChecklistCourseNode method initDefaultConfig.
private void initDefaultConfig() {
ModuleConfiguration config = getModuleConfiguration();
// add an empty checkpoint entry as default if none existent
if (config.get(CONF_CHECKLIST) == null) {
Checklist initialChecklist = new Checklist();
// set to config
config.set(CONF_CHECKLIST, initialChecklist);
// save to db
ChecklistManager.getInstance().saveChecklist(initialChecklist);
}
}
Aggregations