Search in sources :

Example 1 with Checklist

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);
    }
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) Checklist(de.bps.olat.modules.cl.Checklist)

Example 2 with Checklist

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;
}
Also used : ChecklistManager(de.bps.olat.modules.cl.ChecklistManager) Checklist(de.bps.olat.modules.cl.Checklist) CourseNode(org.olat.course.nodes.CourseNode) AbstractAccessableCourseNode(org.olat.course.nodes.AbstractAccessableCourseNode)

Example 3 with Checklist

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);
    }
}
Also used : Condition(org.olat.course.condition.Condition) Checklist(de.bps.olat.modules.cl.Checklist)

Example 4 with Checklist

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());
    }
}
Also used : XStream(com.thoughtworks.xstream.XStream) Checklist(de.bps.olat.modules.cl.Checklist) File(java.io.File) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 5 with Checklist

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);
    }
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) Checklist(de.bps.olat.modules.cl.Checklist)

Aggregations

Checklist (de.bps.olat.modules.cl.Checklist)20 XStream (com.thoughtworks.xstream.XStream)4 ChecklistEditController (de.bps.course.nodes.cl.ChecklistEditController)4 ChecklistManager (de.bps.olat.modules.cl.ChecklistManager)4 Condition (org.olat.course.condition.Condition)4 ChecklistDisplayController (de.bps.olat.modules.cl.ChecklistDisplayController)2 Checkpoint (de.bps.olat.modules.cl.Checkpoint)2 File (java.io.File)2 IOException (java.io.IOException)2 Date (java.util.Date)2 ZipEntry (java.util.zip.ZipEntry)2 Controller (org.olat.core.gui.control.Controller)2 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)2 ICourse (org.olat.course.ICourse)2 ConditionEditController (org.olat.course.condition.ConditionEditController)2 NodeEditController (org.olat.course.editor.NodeEditController)2 StatusDescription (org.olat.course.editor.StatusDescription)2 CourseGroupManager (org.olat.course.groupsandrights.CourseGroupManager)2 AbstractAccessableCourseNode (org.olat.course.nodes.AbstractAccessableCourseNode)2 CourseNode (org.olat.course.nodes.CourseNode)2