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;
}
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;
}
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());
}
}
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;
}
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);
}
}
}
}
Aggregations