use of org.olat.fileresource.FileResourceManager in project openolat by klemens.
the class CPManagerImpl method getCPPackageConfig.
@Override
public CPPackageConfig getCPPackageConfig(OLATResourceable ores) {
FileResourceManager frm = FileResourceManager.getInstance();
File reFolder = frm.getFileResourceRoot(ores);
File configXml = new File(reFolder, PACKAGE_CONFIG_FILE_NAME);
CPPackageConfig config;
if (configXml.exists()) {
config = (CPPackageConfig) configXstream.fromXML(configXml);
} else {
// set default config
config = new CPPackageConfig();
config.setDeliveryOptions(DeliveryOptions.defaultWithGlossary());
setCPPackageConfig(ores, config);
}
return config;
}
use of org.olat.fileresource.FileResourceManager in project openolat by klemens.
the class QTIQPoolServiceProvider method importRepositoryEntry.
public List<QuestionItem> importRepositoryEntry(Identity owner, RepositoryEntry repositoryEntry, Locale defaultLocale) {
OLATResourceable ores = repositoryEntry.getOlatResource();
FileResourceManager frm = FileResourceManager.getInstance();
File testFile = frm.getFileResource(ores);
List<QuestionItem> importedItem = importItems(owner, defaultLocale, testFile.getName(), testFile);
if (importedItem != null && importedItem.size() > 0) {
dbInstance.getCurrentEntityManager().flush();
}
return importedItem;
}
use of org.olat.fileresource.FileResourceManager in project openolat by klemens.
the class QTI21ArchiveFormat method exportWorkbook.
public void exportWorkbook(OutputStream exportStream) {
RepositoryEntry testEntry = searchParams.getTestEntry();
FileResourceManager frm = FileResourceManager.getInstance();
File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
// content
final List<AssessmentTestSession> sessions = testSessionDao.getTestSessionsOfResponse(searchParams);
final List<AssessmentResponse> responses = responseDao.getResponse(searchParams);
try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(exportStream, 1)) {
// headers
OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
exportSheet.setHeaderRows(2);
writeHeaders_1(exportSheet, workbook);
writeHeaders_2(exportSheet, workbook);
writeData(sessions, responses, exportSheet, workbook);
} catch (Exception e) {
log.error("", e);
}
}
use of org.olat.fileresource.FileResourceManager in project openolat by klemens.
the class QTI21AssessmentDetailsController method doOpenResult.
private void doOpenResult(UserRequest ureq, AssessmentTestSession session) {
if (resultCtrl != null)
return;
// reload it to prevent lazy loading issues
session = qtiService.getAssessmentTestSession(session.getKey());
FileResourceManager frm = FileResourceManager.getInstance();
File fUnzippedDirRoot = frm.unzipFileResource(session.getTestEntry().getOlatResource());
URI assessmentObjectUri = qtiService.createAssessmentTestUri(fUnzippedDirRoot);
File submissionDir = qtiService.getSubmissionDirectory(session);
String mapperUri = registerCacheableMapper(ureq, "QTI21DetailsResources::" + session.getKey(), new ResourcesMapper(assessmentObjectUri, submissionDir));
resultCtrl = new AssessmentResultController(ureq, getWindowControl(), assessedIdentity, false, session, fUnzippedDirRoot, mapperUri, null, QTI21AssessmentResultsOptions.allOptions(), true, true, true);
listenTo(resultCtrl);
cmc = new CloseableModalController(getWindowControl(), "close", resultCtrl.getInitialComponent(), true, translate("results.report"));
cmc.activate();
listenTo(cmc);
}
use of org.olat.fileresource.FileResourceManager 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;
}
Aggregations