use of org.olat.ims.qti.editor.beecom.objects.Assessment in project openolat by klemens.
the class OLATUpgrade_11_0_0 method checkEssay.
private boolean checkEssay(RepositoryEntry testEntry) {
if (qtiEssayMap.containsKey(testEntry.getKey())) {
return qtiEssayMap.get(testEntry.getKey()).booleanValue();
}
TestFileResource fr = new TestFileResource();
fr.overrideResourceableId(testEntry.getOlatResource().getResourceableId());
TransientIdentity pseudoIdentity = new TransientIdentity();
pseudoIdentity.setName("transient");
Translator translator = Util.createPackageTranslator(QTIModule.class, Locale.ENGLISH);
try {
QTIEditorPackage qtiPackage = new QTIEditorPackageImpl(pseudoIdentity, fr, null, translator);
if (qtiPackage.getQTIDocument() != null && qtiPackage.getQTIDocument().getAssessment() != null) {
Assessment ass = qtiPackage.getQTIDocument().getAssessment();
// Sections with their Items
List<Section> sections = ass.getSections();
for (Section section : sections) {
List<Item> items = section.getItems();
for (Item item : items) {
String ident = item.getIdent();
if (ident != null && ident.startsWith("QTIEDIT:ESSAY")) {
qtiEssayMap.put(testEntry.getKey(), Boolean.TRUE);
return true;
}
}
}
}
} catch (OLATRuntimeException e) {
log.warn("QTI without content in repository entry: " + testEntry.getKey(), e);
}
qtiEssayMap.put(testEntry.getKey(), Boolean.FALSE);
return false;
}
use of org.olat.ims.qti.editor.beecom.objects.Assessment in project openolat by klemens.
the class IQConfigurationController method needManualCorrectionQTI12.
private boolean needManualCorrectionQTI12(RepositoryEntry re) {
boolean needManualCorrection = false;
QTIDocument doc = TestFileResource.getQTIDocument(re.getOlatResource());
if (doc != null && doc.getAssessment() != null) {
Assessment ass = doc.getAssessment();
// Sections with their Items
List<Section> sections = ass.getSections();
for (Section section : sections) {
List<Item> items = section.getItems();
for (Item item : items) {
String ident = item.getIdent();
if (ident != null && ident.startsWith("QTIEDIT:ESSAY")) {
needManualCorrection = true;
break;
}
}
}
}
return needManualCorrection;
}
use of org.olat.ims.qti.editor.beecom.objects.Assessment in project openolat by klemens.
the class QTIWordExport method exportTest.
private void exportTest(String header, OutputStream out, boolean withResponses) {
ZipOutputStream zout = null;
try {
OpenXMLDocument document = new OpenXMLDocument();
document.setMediaContainer(mediaContainer);
document.setDocumentHeader(header);
Translator translator = Util.createPackageTranslator(QTIWordExport.class, locale, Util.createPackageTranslator(QTIEditorMainController.class, locale));
Assessment assessment = rootNode.getAssessment();
renderAssessment(assessment, document, translator);
for (Section section : assessment.getSections()) {
renderSection(section, document);
List<Item> items = section.getItems();
for (Iterator<Item> itemIt = items.iterator(); itemIt.hasNext(); ) {
Item item = itemIt.next();
if (item.isAlient()) {
renderAlienItem(item, document, translator);
} else {
renderItem(item, document, withResponses, translator);
}
if (itemIt.hasNext()) {
document.appendPageBreak();
}
}
}
zout = new ZipOutputStream(out);
zout.setLevel(9);
OpenXMLDocumentWriter writer = new OpenXMLDocumentWriter();
writer.createDocument(zout, document);
} catch (Exception e) {
log.error("", e);
} finally {
if (zout != null) {
try {
zout.finish();
} catch (IOException e) {
log.error("", e);
}
}
}
}
use of org.olat.ims.qti.editor.beecom.objects.Assessment in project openolat by klemens.
the class QTIEditHelper method getFeedbacks.
/**
* @param object
* @return
*/
private static List<Feedback> getFeedbacks(QTIObject object) {
List<Feedback> feedbacks = null;
if (Item.class.isAssignableFrom(object.getClass())) {
Item item = (Item) object;
feedbacks = item.getItemfeedbacks();
} else if (Section.class.isAssignableFrom(object.getClass())) {
Section section = (Section) object;
feedbacks = section.getSectionfeedbacks();
} else if (Assessment.class.isAssignableFrom(object.getClass())) {
Assessment assessment = (Assessment) object;
feedbacks = assessment.getAssessfeedbacks();
}
return feedbacks;
}
use of org.olat.ims.qti.editor.beecom.objects.Assessment in project OpenOLAT by OpenOLAT.
the class IQConfigurationController method needManualCorrectionQTI12.
private boolean needManualCorrectionQTI12(RepositoryEntry re) {
boolean needManualCorrection = false;
QTIDocument doc = TestFileResource.getQTIDocument(re.getOlatResource());
if (doc != null && doc.getAssessment() != null) {
Assessment ass = doc.getAssessment();
// Sections with their Items
List<Section> sections = ass.getSections();
for (Section section : sections) {
List<Item> items = section.getItems();
for (Item item : items) {
String ident = item.getIdent();
if (ident != null && ident.startsWith("QTIEDIT:ESSAY")) {
needManualCorrection = true;
break;
}
}
}
}
return needManualCorrection;
}
Aggregations