use of org.olat.ims.qti.resultexport.QTI12ResultsExportMediaResource in project OpenOLAT by OpenOLAT.
the class IQIdentityListCourseNodeController method doExportResults.
private void doExportResults(UserRequest ureq) {
List<Identity> identities = getIdentities();
if (identities != null && !identities.isEmpty()) {
MediaResource resource;
CourseEnvironment courseEnv = getCourseEnvironment();
if (isTestQTI21()) {
resource = new QTI21ResultsExportMediaResource(courseEnv, identities, (IQTESTCourseNode) courseNode, getLocale());
} else {
resource = new QTI12ResultsExportMediaResource(courseEnv, getLocale(), identities, (IQTESTCourseNode) courseNode);
}
ureq.getDispatchResult().setResultingMediaResource(resource);
} else {
showWarning("error.no.assessed.users");
}
}
use of org.olat.ims.qti.resultexport.QTI12ResultsExportMediaResource in project OpenOLAT by OpenOLAT.
the class IQTESTCourseNode method archiveNodeData.
@Override
public boolean archiveNodeData(Locale locale, ICourse course, ArchiveOptions options, ZipOutputStream exportStream, String charset) {
String repositorySoftKey = (String) getModuleConfiguration().get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
Long courseResourceableId = course.getResourceableId();
// 1) prepare result export
CourseEnvironment courseEnv = course.getCourseEnvironment();
try {
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftKey, true);
boolean onyx = OnyxModule.isOnyxTest(re.getOlatResource());
if (onyx) {
return true;
} else if (ImsQTI21Resource.TYPE_NAME.equals(re.getOlatResource().getResourceableTypeName())) {
// 2a) create export resource
List<Identity> identities = ScoreAccountingHelper.loadUsers(courseEnv, options);
new QTI21ResultsExportMediaResource(courseEnv, identities, this, locale).exportTestResults(exportStream);
// excel results
RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
QTI21StatisticSearchParams searchParams = new QTI21StatisticSearchParams(options, re, courseEntry, getIdent());
QTI21ArchiveFormat qaf = new QTI21ArchiveFormat(locale, searchParams);
qaf.exportCourseElement(exportStream);
return true;
} else {
// 2b) create export resource
List<Identity> identities = ScoreAccountingHelper.loadUsers(courseEnv, options);
new QTI12ResultsExportMediaResource(courseEnv, locale, identities, this).exportTestResults(exportStream);
// excel results
String shortTitle = getShortTitle();
QTIExportManager qem = QTIExportManager.getInstance();
QTIExportFormatter qef = new QTIExportFormatterCSVType1(locale, "\t", "\"", "\r\n", false);
if (options != null && options.getExportFormat() != null) {
Map<Class<?>, QTIExportItemFormatConfig> itemConfigs = new HashMap<>();
Class<?>[] itemTypes = new Class<?>[] { QTIExportSCQItemFormatConfig.class, QTIExportMCQItemFormatConfig.class, QTIExportKPRIMItemFormatConfig.class, QTIExportFIBItemFormatConfig.class, QTIExportEssayItemFormatConfig.class };
for (Class<?> itemClass : itemTypes) {
itemConfigs.put(itemClass, new QTIExportItemFormatDelegate(options.getExportFormat()));
}
qef.setMapWithExportItemConfigs(itemConfigs);
}
return qem.selectAndExportResults(qef, courseResourceableId, shortTitle, getIdent(), re, exportStream, locale, ".xls");
}
} catch (IOException e) {
log.error("", e);
return false;
}
}
use of org.olat.ims.qti.resultexport.QTI12ResultsExportMediaResource in project openolat by klemens.
the class IQIdentityListCourseNodeController method doExportResults.
private void doExportResults(UserRequest ureq) {
List<Identity> identities = getIdentities();
if (identities != null && !identities.isEmpty()) {
MediaResource resource;
CourseEnvironment courseEnv = getCourseEnvironment();
if (isTestQTI21()) {
resource = new QTI21ResultsExportMediaResource(courseEnv, identities, (IQTESTCourseNode) courseNode, getLocale());
} else {
resource = new QTI12ResultsExportMediaResource(courseEnv, getLocale(), identities, (IQTESTCourseNode) courseNode);
}
ureq.getDispatchResult().setResultingMediaResource(resource);
} else {
showWarning("error.no.assessed.users");
}
}
use of org.olat.ims.qti.resultexport.QTI12ResultsExportMediaResource in project openolat by klemens.
the class IQTESTCourseNode method archiveNodeData.
@Override
public boolean archiveNodeData(Locale locale, ICourse course, ArchiveOptions options, ZipOutputStream exportStream, String charset) {
String repositorySoftKey = (String) getModuleConfiguration().get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
Long courseResourceableId = course.getResourceableId();
// 1) prepare result export
CourseEnvironment courseEnv = course.getCourseEnvironment();
try {
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftKey, true);
boolean onyx = OnyxModule.isOnyxTest(re.getOlatResource());
if (onyx) {
return true;
} else if (ImsQTI21Resource.TYPE_NAME.equals(re.getOlatResource().getResourceableTypeName())) {
// 2a) create export resource
List<Identity> identities = ScoreAccountingHelper.loadUsers(courseEnv, options);
new QTI21ResultsExportMediaResource(courseEnv, identities, this, locale).exportTestResults(exportStream);
// excel results
RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
QTI21StatisticSearchParams searchParams = new QTI21StatisticSearchParams(options, re, courseEntry, getIdent());
QTI21ArchiveFormat qaf = new QTI21ArchiveFormat(locale, searchParams);
qaf.exportCourseElement(exportStream);
return true;
} else {
// 2b) create export resource
List<Identity> identities = ScoreAccountingHelper.loadUsers(courseEnv, options);
new QTI12ResultsExportMediaResource(courseEnv, locale, identities, this).exportTestResults(exportStream);
// excel results
String shortTitle = getShortTitle();
QTIExportManager qem = QTIExportManager.getInstance();
QTIExportFormatter qef = new QTIExportFormatterCSVType1(locale, "\t", "\"", "\r\n", false);
if (options != null && options.getExportFormat() != null) {
Map<Class<?>, QTIExportItemFormatConfig> itemConfigs = new HashMap<>();
Class<?>[] itemTypes = new Class<?>[] { QTIExportSCQItemFormatConfig.class, QTIExportMCQItemFormatConfig.class, QTIExportKPRIMItemFormatConfig.class, QTIExportFIBItemFormatConfig.class, QTIExportEssayItemFormatConfig.class };
for (Class<?> itemClass : itemTypes) {
itemConfigs.put(itemClass, new QTIExportItemFormatDelegate(options.getExportFormat()));
}
qef.setMapWithExportItemConfigs(itemConfigs);
}
return qem.selectAndExportResults(qef, courseResourceableId, shortTitle, getIdent(), re, exportStream, locale, ".xls");
}
} catch (IOException e) {
log.error("", e);
return false;
}
}
Aggregations