Package de.bps.olat.modules.cl

Examples of de.bps.olat.modules.cl.Checklist


  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);
    }
View Full Code Here


   * 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 orgChecklist = ChecklistManager.getInstance().loadChecklist((Checklist) getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST));
        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 {
View Full Code Here

      sd.setDescriptionForUnit(getIdent());
      sd.setActivateableViewIdentifier(ChecklistEditController.PANE_TAB_CLCONFIG);
      return sd;
    }
   
    Checklist checklist = (Checklist) getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST);
    // checklist without any checkpoints makes no sense
    if (!checklist.hasCheckpoints()) {
      sd = new StatusDescription(ValidationStatus.ERROR, "config.nocheckpoints.short", "config.nocheckpoints.long", null, transPackage);
      sd.setDescriptionForUnit(getIdent());
      sd.setActivateableViewIdentifier(ChecklistEditController.PANE_TAB_CLCONFIG);
      return sd;
    }
   
    // information, if all checkpoints are invisible
    boolean allUnvisible = true;
    boolean noLearners = false;
    if (checklist.hasCheckpoints()) {
      List<Checkpoint> checkpoints = ((Checklist)getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST)).getCheckpoints();
      for (Checkpoint checkpoint : checkpoints) {
        if (!checkpoint.getMode().equals(CheckpointMode.MODE_HIDDEN)) allUnvisible = false;
      }
      if(allUnvisible) {
View Full Code Here

 
  @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());
  }
View Full Code Here

 
  @Override
  public void exportNode(File exportDirectory, ICourse course) {
    XStream xstream = new XStream();
    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());
  }
View Full Code Here

    if(importContent == null || importContent.isEmpty()) {
      return null;
    }
   
    XStream xstream = new XStream();
    Checklist checklist = (Checklist) xstream.fromXML(importContent);
    if(checklist != null) {
      checklist = ChecklistManager.getInstance().copyChecklist(checklist);
      setChecklistKey(cpm, checklist.getKey());
    }
   
    return null;
  }
View Full Code Here

  }
 
  @Override
  public void archiveNodeData(Locale locale, ICourse course, File exportDirectory, String charset) {
    XStream xstream = new XStream();
    Checklist checklist = loadOrCreateChecklist(course.getCourseEnvironment().getCoursePropertyManager());
    String exportContent = xstream.toXML(checklist);
    String exportFilename = ExportUtil.createFileNameWithTimeStamp("checklist_"+this.getIdent(), "xml");
    ExportUtil.writeContentToFile(exportFilename, exportContent, exportDirectory, WebappHelper.getDefaultCharset());
  }
View Full Code Here

  @Override
  public CourseNode createInstanceForCopy(boolean isNewTitle) {
    CourseNode copyInstance = super.createInstanceForCopy(isNewTitle);
    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;
  }
View Full Code Here

      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(this.checklist);
      cl.setTitle(this.courseNode.getShortTitle());
      cl.setDescription(this.courseNode.getLongTitle());
      ChecklistManager.getInstance().saveChecklist(cl);
    }
  }
View Full Code Here

TOP

Related Classes of de.bps.olat.modules.cl.Checklist

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.