Search in sources :

Example 1 with CheckboxList

use of org.olat.course.nodes.cl.model.CheckboxList in project OpenOLAT by OpenOLAT.

the class CheckListBoxListEditController method doUp.

private void doUp(UserRequest ureq, int checkboxIndex) {
    CheckboxList list = (CheckboxList) config.get(CheckListCourseNode.CONFIG_KEY_CHECKBOX);
    if (checkboxIndex > 0 && checkboxIndex < list.getList().size()) {
        Checkbox box = list.getList().remove(checkboxIndex);
        list.getList().add(checkboxIndex - 1, box);
    }
    fireEvent(ureq, Event.DONE_EVENT);
    updateModel();
}
Also used : CheckboxList(org.olat.course.nodes.cl.model.CheckboxList) Checkbox(org.olat.course.nodes.cl.model.Checkbox)

Example 2 with CheckboxList

use of org.olat.course.nodes.cl.model.CheckboxList in project OpenOLAT by OpenOLAT.

the class CheckListBoxListEditController method doDelete.

private void doDelete(UserRequest ureq, Checkbox checkbox) {
    CheckboxList list = (CheckboxList) config.get(CheckListCourseNode.CONFIG_KEY_CHECKBOX);
    if (list == null || checkbox == null)
        return;
    list.remove(checkbox);
    config.set(CheckListCourseNode.CONFIG_KEY_CHECKBOX, list);
    fireEvent(ureq, Event.DONE_EVENT);
    updateModel();
}
Also used : CheckboxList(org.olat.course.nodes.cl.model.CheckboxList)

Example 3 with CheckboxList

use of org.olat.course.nodes.cl.model.CheckboxList in project OpenOLAT by OpenOLAT.

the class CheckListBoxListEditController method doDown.

private void doDown(UserRequest ureq, int checkboxIndex) {
    CheckboxList list = (CheckboxList) config.get(CheckListCourseNode.CONFIG_KEY_CHECKBOX);
    if (checkboxIndex >= 0 && checkboxIndex < list.getList().size() - 1) {
        Checkbox box = list.getList().remove(checkboxIndex);
        list.getList().add(checkboxIndex + 1, box);
    }
    fireEvent(ureq, Event.DONE_EVENT);
    updateModel();
}
Also used : CheckboxList(org.olat.course.nodes.cl.model.CheckboxList) Checkbox(org.olat.course.nodes.cl.model.Checkbox)

Example 4 with CheckboxList

use of org.olat.course.nodes.cl.model.CheckboxList in project OpenOLAT by OpenOLAT.

the class CheckListCourseNode method updateOnPublish.

@Override
public void updateOnPublish(Locale locale, ICourse course, Identity publisher, PublishEvents publishEvents) {
    ModuleConfiguration config = getModuleConfiguration();
    // sync the checkbox with the database
    CheckboxList list = (CheckboxList) config.get(CONFIG_KEY_CHECKBOX);
    CheckboxManager checkboxManager = CoreSpringFactory.getImpl(CheckboxManager.class);
    checkboxManager.syncCheckbox(list, course, getIdent());
    CoursePropertyManager pm = course.getCourseEnvironment().getCoursePropertyManager();
    List<Identity> assessedUsers = pm.getAllIdentitiesWithCourseAssessmentData(null);
    int count = 0;
    for (Identity assessedIdentity : assessedUsers) {
        updateScorePassedOnPublish(assessedIdentity, publisher, checkboxManager, course);
        if (++count % 10 == 0) {
            DBFactory.getInstance().commitAndCloseSession();
        }
    }
    DBFactory.getInstance().commitAndCloseSession();
    super.updateOnPublish(locale, course, publisher, publishEvents);
}
Also used : CheckboxManager(org.olat.course.nodes.cl.CheckboxManager) CheckboxList(org.olat.course.nodes.cl.model.CheckboxList) ModuleConfiguration(org.olat.modules.ModuleConfiguration) Identity(org.olat.core.id.Identity) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 5 with CheckboxList

use of org.olat.course.nodes.cl.model.CheckboxList 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");
            }
        }
    }
}
Also used : CheckboxManager(org.olat.course.nodes.cl.CheckboxManager) CheckboxList(org.olat.course.nodes.cl.model.CheckboxList) ModuleConfiguration(org.olat.modules.ModuleConfiguration) Checkbox(org.olat.course.nodes.cl.model.Checkbox) File(java.io.File)

Aggregations

CheckboxList (org.olat.course.nodes.cl.model.CheckboxList)34 Checkbox (org.olat.course.nodes.cl.model.Checkbox)24 CheckboxManager (org.olat.course.nodes.cl.CheckboxManager)18 ModuleConfiguration (org.olat.modules.ModuleConfiguration)18 File (java.io.File)12 Identity (org.olat.core.id.Identity)6 VFSContainer (org.olat.core.util.vfs.VFSContainer)6 VFSItem (org.olat.core.util.vfs.VFSItem)6 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)6 ArrayList (java.util.ArrayList)4 OLATResourceable (org.olat.core.id.OLATResourceable)4 Row (org.olat.core.util.openxml.OpenXMLWorksheet.Row)4 CellStyle (org.olat.core.util.openxml.workbookstyle.CellStyle)4 ICourse (org.olat.course.ICourse)4 CheckListCourseNode (org.olat.course.nodes.CheckListCourseNode)4 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)4 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)4 IOException (java.io.IOException)2 OutputStream (java.io.OutputStream)2 Collections (java.util.Collections)2