Search in sources :

Example 86 with Component

use of org.olat.core.gui.components.Component in project openolat by klemens.

the class QTI21ResultsExportMediaResource method createResultDetail.

private List<ResultDetail> createResultDetail(Identity identity, ZipOutputStream zout, String idDir) throws IOException {
    List<ResultDetail> assessments = new ArrayList<>();
    List<AssessmentTestSession> sessions = qtiService.getAssessmentTestSessions(entry, courseNode.getIdent(), identity);
    for (AssessmentTestSession session : sessions) {
        Long assessmentID = session.getKey();
        String idPath = idDir + translator.translate("table.user.attempt") + (sessions.indexOf(session) + 1) + SEP;
        createZipDirectory(zout, idPath);
        // content of result table
        ResultDetail resultDetail = new ResultDetail(assessmentID.toString(), assessmentDateFormat.format(session.getCreationDate()), displayDateFormat.format(new Date(session.getDuration())), session.getScore(), session.getManualScore(), createPassedIcons(session.getPassed() == null ? true : session.getPassed()), idPath.replace(idDir, "") + assessmentID + ".html");
        assessments.add(resultDetail);
        // WindowControlMocker needed because this is not a controller
        WindowControl mockwControl = new WindowControlMocker();
        FileResourceManager frm = FileResourceManager.getInstance();
        RepositoryEntry testEntry = session.getTestEntry();
        testEntries.add(testEntry);
        File fUnzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
        // add test repo key
        String mapperUri = "../../../test" + testEntry.getKey() + "/";
        String submissionMapperUri = ".";
        String exportUri = "../" + translator.translate("table.user.attempt") + (sessions.indexOf(session) + 1);
        Controller assessmentResultController = new AssessmentResultController(ureq, mockwControl, identity, false, session, fUnzippedDirRoot, mapperUri, submissionMapperUri, QTI21AssessmentResultsOptions.allOptions(), false, true, false, exportUri);
        Component component = assessmentResultController.getInitialComponent();
        String componentHTML = createResultHTML(component);
        convertToZipEntry(zout, idPath + assessmentID + ".html", componentHTML);
        File resultXML = qtiService.getAssessmentResultFile(session);
        convertToZipEntry(zout, idPath + assessmentID + ".xml", resultXML);
        File signatureXML = qtiService.getAssessmentResultSignature(session);
        if (signatureXML != null) {
            convertToZipEntry(zout, idPath + "assessmentResultSignature.xml", signatureXML);
        }
        File submissionDir = qtiService.getSubmissionDirectory(session);
        String baseDir = idPath + "submissions";
        ZipUtil.addDirectoryToZip(submissionDir.toPath(), baseDir, zout);
    }
    return assessments;
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) ArrayList(java.util.ArrayList) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) AssessmentResultController(org.olat.ims.qti21.ui.AssessmentResultController) Controller(org.olat.core.gui.control.Controller) Date(java.util.Date) FileResourceManager(org.olat.fileresource.FileResourceManager) AssessmentResultController(org.olat.ims.qti21.ui.AssessmentResultController) Component(org.olat.core.gui.components.Component) File(java.io.File) WindowControlMocker(org.olat.core.gui.util.WindowControlMocker)

Example 87 with Component

use of org.olat.core.gui.components.Component in project openolat by klemens.

the class AbstractPageListController method getComponents.

@Override
public final Iterable<Component> getComponents(int row, Object rowObject) {
    PortfolioElementRow elRow = model.getObject(row);
    List<Component> components = new ArrayList<>(4);
    if (elRow.getNewEntryLink() != null) {
        components.add(elRow.getNewEntryLink().getComponent());
    }
    if (elRow.getNewFloatingEntryLink() != null) {
        components.add(elRow.getNewFloatingEntryLink().getComponent());
    }
    if (elRow.getNewAssignmentLink() != null) {
        components.add(elRow.getNewAssignmentLink().getComponent());
    }
    if (elRow.getOpenFormItem() != null) {
        components.add(elRow.getOpenFormItem().getComponent());
    }
    if (elRow.getReopenSectionLink() != null) {
        components.add(elRow.getReopenSectionLink().getComponent());
    }
    if (elRow.getCloseSectionLink() != null) {
        components.add(elRow.getCloseSectionLink().getComponent());
    }
    if (elRow.getEditAssignmentLink() != null) {
        components.add(elRow.getEditAssignmentLink().getComponent());
    }
    if (elRow.getDeleteAssignmentLink() != null) {
        components.add(elRow.getDeleteAssignmentLink().getComponent());
    }
    if (elRow.getUpAssignmentLink() != null) {
        components.add(elRow.getUpAssignmentLink().getComponent());
    }
    if (elRow.getDownAssignmentLink() != null) {
        components.add(elRow.getDownAssignmentLink().getComponent());
    }
    if (elRow.getMoveAssignmentLink() != null) {
        components.add(elRow.getMoveAssignmentLink().getComponent());
    }
    if (elRow.getInstantiateAssignmentLink() != null) {
        components.add(elRow.getInstantiateAssignmentLink().getComponent());
    }
    if (elRow.getCommentFormLink() != null) {
        components.add(elRow.getCommentFormLink().getComponent());
    }
    if (elRow.getPoster() != null) {
        components.add(elRow.getPoster());
    }
    if (elRow.getStartSelection() != null) {
        components.add(elRow.getStartSelection().getComponent());
    }
    return components;
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) ArrayList(java.util.ArrayList) Component(org.olat.core.gui.components.Component) ImageComponent(org.olat.core.gui.components.image.ImageComponent)

Example 88 with Component

use of org.olat.core.gui.components.Component in project openolat by klemens.

the class BinderOnePageController method loadPage.

private void loadPage(UserRequest ureq, Page page) {
    String id = "page_w_" + (++counter);
    VelocityContainer pageVC = createVelocityContainer(id, "page_content_print");
    mainVC.put(id, pageVC);
    components.add(id);
    BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getReadOnlyCallback();
    PageMetadataController metadatCtrl = new PageMetadataController(ureq, getWindowControl(), secCallback, page);
    listenTo(metadatCtrl);
    Component pageMetaCmp = metadatCtrl.getInitialComponent();
    pageVC.put("meta", pageMetaCmp);
    PageController pageCtrl = new PageController(ureq, getWindowControl(), new PortfolioPageProvider(page), renderingHints);
    listenTo(pageCtrl);
    pageCtrl.loadElements(ureq);
    Component pageCmp = pageCtrl.getInitialComponent();
    pageVC.put("page", pageCmp);
    CommentAndRatingSecurityCallback commentSecCallback = new ReadOnlyCommentsSecurityCallback();
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(Page.class, page.getKey());
    UserCommentsController commentsCtrl = new UserCommentsController(ureq, getWindowControl(), ores, null, commentSecCallback);
    listenTo(commentsCtrl);
    if (commentsCtrl.getNumOfComments() > 0) {
        pageVC.put("comments", commentsCtrl.getInitialComponent());
    }
}
Also used : CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) PageController(org.olat.modules.portfolio.ui.editor.PageController) OLATResourceable(org.olat.core.id.OLATResourceable) ReadOnlyCommentsSecurityCallback(org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback) UserCommentsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsController) BinderSecurityCallback(org.olat.modules.portfolio.BinderSecurityCallback) Component(org.olat.core.gui.components.Component) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 89 with Component

use of org.olat.core.gui.components.Component in project openolat by klemens.

the class MediaCenterController method getComponents.

@Override
public Iterable<Component> getComponents(int row, Object rowObject) {
    MediaRow mediaRow = model.getObject(row);
    List<Component> components = new ArrayList<>(2);
    if (mediaRow.getOpenFormItem() != null) {
        components.add(mediaRow.getOpenFormItem().getComponent());
    }
    return components;
}
Also used : ArrayList(java.util.ArrayList) Component(org.olat.core.gui.components.Component) MediaRow(org.olat.modules.portfolio.ui.model.MediaRow)

Example 90 with Component

use of org.olat.core.gui.components.Component in project openolat by klemens.

the class ViteroAdminBookingInfosController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == segmentView) {
        if (event instanceof SegmentViewEvent) {
            SegmentViewEvent sve = (SegmentViewEvent) event;
            String segmentCName = sve.getComponentName();
            Component clickedLink = mainVC.getComponent(segmentCName);
            if (clickedLink == infosLink) {
                doOpenInfos(ureq);
            } else if (clickedLink == membersLink) {
                doOpenMembers(ureq);
            }
        }
    }
}
Also used : SegmentViewEvent(org.olat.core.gui.components.segmentedview.SegmentViewEvent) Component(org.olat.core.gui.components.Component) SegmentViewComponent(org.olat.core.gui.components.segmentedview.SegmentViewComponent)

Aggregations

Component (org.olat.core.gui.components.Component)300 SegmentViewComponent (org.olat.core.gui.components.segmentedview.SegmentViewComponent)90 SegmentViewEvent (org.olat.core.gui.components.segmentedview.SegmentViewEvent)90 ArrayList (java.util.ArrayList)36 Controller (org.olat.core.gui.control.Controller)28 Link (org.olat.core.gui.components.link.Link)22 BasicController (org.olat.core.gui.control.controller.BasicController)22 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)22 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)18 Panel (org.olat.core.gui.components.panel.Panel)12 HighScoreRunController (org.olat.course.highscore.ui.HighScoreRunController)12 Date (java.util.Date)10 UserRequest (org.olat.core.gui.UserRequest)10 ComponentRenderer (org.olat.core.gui.components.ComponentRenderer)10 TreeNode (org.olat.core.gui.components.tree.TreeNode)10 RenderResult (org.olat.core.gui.render.RenderResult)10 StringOutput (org.olat.core.gui.render.StringOutput)10 Translator (org.olat.core.gui.translator.Translator)10 AbstractComponent (org.olat.core.gui.components.AbstractComponent)8 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)8