use of org.olat.ims.qti.editor.beecom.objects.Assessment in project openolat by klemens.
the class QTI12ResultDetailsController method checkEssay.
private boolean checkEssay() {
QTIDocument doc = TestFileResource.getQTIDocument(repositoryEntry.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")) {
return true;
}
}
}
}
return false;
}
use of org.olat.ims.qti.editor.beecom.objects.Assessment in project openolat by klemens.
the class QTIEditHelper method createAssessment.
/**
* Creates an empty assessment
* @param title
* @param type
* @return Assessment
*/
public static Assessment createAssessment(String title, String type) {
Assessment assessment = new Assessment();
assessment.setIdent(CodeHelper.getGlobalForeverUniqueID());
assessment.setTitle(title);
Metadata meta = new Metadata();
meta.setField(AssessmentInstance.QMD_LABEL_TYPE, type);
assessment.setMetadata(meta);
return assessment;
}
use of org.olat.ims.qti.editor.beecom.objects.Assessment in project openolat by klemens.
the class QTIEditHelper method getControl.
/**
* Get controls.
* @param object
* @return Controls.
*/
public static Control getControl(QTIObject object) {
Control control = null;
List controls = null;
if (Item.class.isAssignableFrom(object.getClass())) {
Item item = (Item) object;
controls = item.getItemcontrols();
} else if (Section.class.isAssignableFrom(object.getClass())) {
Section section = (Section) object;
controls = section.getSectioncontrols();
} else if (Assessment.class.isAssignableFrom(object.getClass())) {
Assessment assessment = (Assessment) object;
controls = assessment.getAssessmentcontrols();
}
for (Iterator i = controls.iterator(); i.hasNext(); ) {
Control tmp = (Control) i.next();
if (tmp.getView() != null) {
if (tmp.getView().equalsIgnoreCase("all")) {
control = tmp;
break;
}
} else {
control = tmp;
}
}
return control;
}
use of org.olat.ims.qti.editor.beecom.objects.Assessment in project openolat by klemens.
the class QTIEditorMainController method doExportQItem.
private void doExportQItem() {
GenericQtiNode selectedNode = menuTreeModel.getQtiNode(menuTree.getSelectedNodeId());
if (selectedNode instanceof ItemNode) {
ItemNode itemNode = (ItemNode) selectedNode;
QTIObject qtiObject = itemNode.getUnderlyingQTIObject();
if (qtiObject instanceof Item) {
ItemAndMetadata item = new ItemAndMetadata((Item) qtiObject);
VFSContainer editorContainer = qtiPackage.getBaseDir();
qtiQpoolServiceProvider.importBeecomItem(getIdentity(), item, editorContainer, getLocale());
showInfo("export.qpool.successful", "1");
}
} else if (selectedNode instanceof SectionNode) {
SectionNode sectionNode = (SectionNode) selectedNode;
QTIObject qtiObject = sectionNode.getUnderlyingQTIObject();
if (qtiObject instanceof Section) {
int count = doExportSection((Section) qtiObject);
showInfo("export.qpool.successful", Integer.toString(count));
}
} else if (selectedNode instanceof AssessmentNode) {
AssessmentNode assessmentNode = (AssessmentNode) selectedNode;
QTIObject qtiObject = assessmentNode.getUnderlyingQTIObject();
if (qtiObject instanceof Assessment) {
int count = doExportAssessment((Assessment) qtiObject);
showInfo("export.qpool.successful", Integer.toString(count));
}
}
}
use of org.olat.ims.qti.editor.beecom.objects.Assessment in project openolat by klemens.
the class QTIEditorTreeModel method init.
/**
* takes the assessment object tree and converts it to a QTIEditorTreeModel
*/
private void init() {
Assessment ass = qtiPackage.getQTIDocument().getAssessment();
GenericQtiNode rootNode = new AssessmentNode(ass, qtiPackage);
this.setRootNode(rootNode);
// Sections with their Items
List<Section> sections = ass.getSections();
for (int i = 0; i < sections.size(); i++) {
// get section data
Section elem = sections.get(i);
GenericQtiNode sectionNode = new SectionNode(elem, qtiPackage);
List<Item> items = elem.getItems();
for (int j = 0; j < items.size(); j++) {
// get item data
Item elem2 = items.get(j);
GenericQtiNode itemNode = new ItemNode(elem2, qtiPackage);
// add item to its parent section
sectionNode.addChild(itemNode);
}
// add section with its items to the rootNode
rootNode.addChild(sectionNode);
}
}
Aggregations