Search in sources :

Example 6 with StatisticResourceNode

use of org.olat.course.statistic.StatisticResourceNode in project OpenOLAT by OpenOLAT.

the class QTIStatisticResourceResult method getSubTreeModel.

@Override
public TreeModel getSubTreeModel() {
    GenericTreeModel subTreeModel;
    if (type == QTIType.onyx) {
        subTreeModel = new GenericTreeModel();
        StatisticResourceNode rootTreeNode = new StatisticResourceNode(courseNode, this);
        subTreeModel.setRootNode(rootTreeNode);
    } else if (qtiDocument == null) {
        subTreeModel = null;
    } else {
        subTreeModel = new GenericTreeModel();
        StatisticResourceNode rootTreeNode = new StatisticResourceNode(courseNode, this);
        subTreeModel.setRootNode(rootTreeNode);
        buildQTICourseNodeSubTree(qtiDocument, rootTreeNode);
    }
    return subTreeModel;
}
Also used : StatisticResourceNode(org.olat.course.statistic.StatisticResourceNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel)

Example 7 with StatisticResourceNode

use of org.olat.course.statistic.StatisticResourceNode in project OpenOLAT by OpenOLAT.

the class QTI12PrintController method initView.

private void initView(UserRequest ureq, QTIStatisticResourceResult resourceResult) {
    StatisticResourceNode rootNode = (StatisticResourceNode) resourceResult.getSubTreeModel().getRootNode();
    ICourse course = CourseFactory.loadCourse(resourceResult.getCourseOres());
    mainVC.contextPut("courseTitle", course.getCourseTitle());
    String testTitle = resourceResult.getQTIRepositoryEntry().getDisplayname();
    mainVC.contextPut("testTitle", testTitle);
    int count = 0;
    List<String> pageNames = new ArrayList<>();
    Controller assessmentCtrl = resourceResult.getController(ureq, getWindowControl(), null, rootNode, true);
    String pageName = "page" + count++;
    mainVC.put(pageName, assessmentCtrl.getInitialComponent());
    pageNames.add(pageName);
    for (int i = 0; i < rootNode.getChildCount(); i++) {
        INode sectionNode = rootNode.getChildAt(i);
        for (int j = 0; j < sectionNode.getChildCount(); j++) {
            TreeNode itemNode = (TreeNode) sectionNode.getChildAt(j);
            Controller itemCtrl = resourceResult.getController(ureq, getWindowControl(), null, itemNode, true);
            String itemPageName = "page" + count++;
            mainVC.put(itemPageName, itemCtrl.getInitialComponent());
            pageNames.add(itemPageName);
        }
    }
    mainVC.contextPut("pageNames", pageNames);
}
Also used : INode(org.olat.core.util.nodes.INode) TreeNode(org.olat.core.gui.components.tree.TreeNode) StatisticResourceNode(org.olat.course.statistic.StatisticResourceNode) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController)

Example 8 with StatisticResourceNode

use of org.olat.course.statistic.StatisticResourceNode in project OpenOLAT by OpenOLAT.

the class QTI21StatisticResourceResult method getSubTreeModel.

/**
 * Return the tree model for a course and a specific test.
 */
@Override
public TreeModel getSubTreeModel() {
    GenericTreeModel subTreeModel = new GenericTreeModel();
    StatisticResourceNode rootTreeNode = new StatisticResourceNode(courseNode, this);
    subTreeModel.setRootNode(rootTreeNode);
    FileResourceManager frm = FileResourceManager.getInstance();
    File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
    resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
    AssessmentTest test = resolvedAssessmentTest.getTestLookup().getRootNodeHolder().getRootNode();
    buildRecursively(test, rootTreeNode);
    return subTreeModel;
}
Also used : ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) FileResourceManager(org.olat.fileresource.FileResourceManager) StatisticResourceNode(org.olat.course.statistic.StatisticResourceNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) File(java.io.File)

Example 9 with StatisticResourceNode

use of org.olat.course.statistic.StatisticResourceNode in project openolat by klemens.

the class QTIStatisticResourceResult method getController.

public Controller getController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, TreeNode selectedNode, boolean printMode) {
    if (selectedNode instanceof StatisticResourceNode) {
        return createAssessmentController(ureq, wControl, stackPanel, printMode);
    } else if (selectedNode instanceof SectionNode) {
        return createAssessmentController(ureq, wControl, stackPanel, printMode);
    } else if (selectedNode instanceof ItemNode) {
        Section section = null;
        INode sectionNode = selectedNode.getParent();
        if (sectionNode instanceof SectionNode) {
            section = (Section) ((SectionNode) sectionNode).getUserObject();
        }
        Item item = (Item) ((ItemNode) selectedNode).getUserObject();
        return createItemController(ureq, wControl, section, item, printMode);
    }
    return null;
}
Also used : Item(org.olat.ims.qti.editor.beecom.objects.Item) ItemNode(org.olat.ims.qti.editor.tree.ItemNode) INode(org.olat.core.util.nodes.INode) StatisticResourceNode(org.olat.course.statistic.StatisticResourceNode) SectionNode(org.olat.ims.qti.editor.tree.SectionNode) Section(org.olat.ims.qti.editor.beecom.objects.Section)

Example 10 with StatisticResourceNode

use of org.olat.course.statistic.StatisticResourceNode in project openolat by klemens.

the class QTI21StatisticResourceResult method getSubTreeModel.

/**
 * Return the tree model for a course and a specific test.
 */
@Override
public TreeModel getSubTreeModel() {
    GenericTreeModel subTreeModel = new GenericTreeModel();
    StatisticResourceNode rootTreeNode = new StatisticResourceNode(courseNode, this);
    subTreeModel.setRootNode(rootTreeNode);
    FileResourceManager frm = FileResourceManager.getInstance();
    File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
    resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
    AssessmentTest test = resolvedAssessmentTest.getTestLookup().getRootNodeHolder().getRootNode();
    buildRecursively(test, rootTreeNode);
    return subTreeModel;
}
Also used : ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) FileResourceManager(org.olat.fileresource.FileResourceManager) StatisticResourceNode(org.olat.course.statistic.StatisticResourceNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) File(java.io.File)

Aggregations

StatisticResourceNode (org.olat.course.statistic.StatisticResourceNode)10 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)4 TreeNode (org.olat.core.gui.components.tree.TreeNode)4 INode (org.olat.core.util.nodes.INode)4 AssessmentTest (uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest)4 ResolvedAssessmentTest (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest)4 File (java.io.File)2 ArrayList (java.util.ArrayList)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 Controller (org.olat.core.gui.control.Controller)2 BasicController (org.olat.core.gui.control.controller.BasicController)2 ICourse (org.olat.course.ICourse)2 FileResourceManager (org.olat.fileresource.FileResourceManager)2 Item (org.olat.ims.qti.editor.beecom.objects.Item)2 Section (org.olat.ims.qti.editor.beecom.objects.Section)2 ItemNode (org.olat.ims.qti.editor.tree.ItemNode)2 SectionNode (org.olat.ims.qti.editor.tree.SectionNode)2 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)2