use of org.olat.modules.qpool.QuestionItemView in project openolat by klemens.
the class ItemListMyCompetencesController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (selectLink == source) {
Set<Integer> selections = getItemsTable().getMultiSelectedIndex();
if (!selections.isEmpty()) {
List<QuestionItemView> items = getItemViews(selections);
fireEvent(ureq, new QItemViewEvent("select-item", items));
}
} else if (myCompetenceLevelsEl == source) {
String selectedKey = myCompetenceLevelsEl.getSelectedKey();
if (StringHelper.isLong(selectedKey)) {
doSelectLevel(ureq, selectedKey);
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.modules.qpool.QuestionItemView in project openolat by klemens.
the class ItemListMyListsController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (selectLink == source) {
Set<Integer> selections = getItemsTable().getMultiSelectedIndex();
if (!selections.isEmpty()) {
List<QuestionItemView> items = getItemViews(selections);
fireEvent(ureq, new QItemViewEvent("select-item", items));
}
} else if (myListEl == source) {
String selectedCollKey = myListEl.getSelectedKey();
if (StringHelper.isLong(selectedCollKey)) {
Long collectionKey = Long.parseLong(selectedCollKey);
doSelectCollection(ureq, collectionKey);
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.modules.qpool.QuestionItemView in project openolat by klemens.
the class ItemListMySharesController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (selectLink == source) {
Set<Integer> selections = getItemsTable().getMultiSelectedIndex();
if (!selections.isEmpty()) {
List<QuestionItemView> items = getItemViews(selections);
fireEvent(ureq, new QItemViewEvent("select-item", items));
}
} else if (myShareEl == source) {
String selectedKey = myShareEl.getSelectedKey();
if (selectedKey != null && selectedKey.length() > 4) {
String key = selectedKey.substring(4);
if (StringHelper.isLong(key)) {
Long resourceKey = Long.parseLong(key);
if (selectedKey.startsWith("pool")) {
doSelectPool(ureq, resourceKey);
} else if (selectedKey.startsWith("grou")) {
doSelectBusinessGroup(ureq, resourceKey);
}
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.modules.qpool.QuestionItemView in project openolat by klemens.
the class AssessmentTestComposerController method doInsert.
private void doInsert(UserRequest ureq, List<QuestionItemView> items) {
TreeNode selectedNode = menuTree.getSelectedNode();
TreeNode sectionNode = getNearestSection(selectedNode);
boolean allOk = true;
String firstItemId = null;
Map<AssessmentItemRef, AssessmentItem> flyingObjects = new HashMap<>();
try {
AssessmentSection section = (AssessmentSection) sectionNode.getUserObject();
for (QuestionItemView item : items) {
QuestionItemFull qItem = qti21QPoolServiceProvider.getFullQuestionItem(item);
AssessmentItem assessmentItem = qti21QPoolServiceProvider.exportToQTIEditor(qItem, getLocale(), unzippedDirRoot);
if (assessmentItem != null) {
AssessmentItemRef itemRef = doInsert(section, assessmentItem);
if (firstItemId == null) {
firstItemId = itemRef.getIdentifier().toString();
}
flyingObjects.put(itemRef, assessmentItem);
ManifestMetadataBuilder metadata = manifestBuilder.getResourceBuilderByHref(itemRef.getHref().toString());
metadata.appendMetadataFrom(qItem, assessmentItem, getLocale());
metadata.setOpenOLATMetadataCopiedAt(new Date());
} else {
allOk &= false;
}
}
} catch (IOException | URISyntaxException e) {
showError("error.import.question");
logError("", e);
}
if (!allOk) {
showError("error.import.question");
}
if (firstItemId != null) {
// persist metadata
doSaveAssessmentTest(ureq, flyingObjects);
doSaveManifest();
updateTreeModel(false);
TreeNode newItemNode = menuTree.getTreeModel().getNodeById(firstItemId);
menuTree.setSelectedNode(newItemNode);
menuTree.open(newItemNode);
partEditorFactory(ureq, newItemNode);
}
}
use of org.olat.modules.qpool.QuestionItemView in project openolat by klemens.
the class QTIEditorMainController method doInsert.
private void doInsert(UserRequest ureq, TreePosition tp, Object toInsert) {
// new node
GenericQtiNode parentTargetNode = (GenericQtiNode) tp.getParentTreeNode();
if (toInsert instanceof GenericQtiNode) {
doInsert(parentTargetNode, (GenericQtiNode) toInsert, tp.getChildpos());
} else if (toInsert instanceof QuestionItemView) {
QuestionItemView item = (QuestionItemView) toInsert;
GenericQtiNode insertNode = doConvertItemToQtiNode(item);
doInsert(parentTargetNode, insertNode, tp.getChildpos());
} else if (toInsert instanceof Collection) {
int position = tp.getChildpos();
@SuppressWarnings("unchecked") Collection<QuestionItemView> items = (Collection<QuestionItemView>) toInsert;
for (QuestionItemView item : items) {
GenericQtiNode insertNode = doConvertItemToQtiNode(item);
doInsert(parentTargetNode, insertNode, position++);
}
} else if (toInsert instanceof ItemsPackage) {
ItemsPackage itemsToImport = (ItemsPackage) toInsert;
List<ItemAndMetadata> items = itemsToImport.getItems();
int pos = tp.getChildpos();
for (ItemAndMetadata item : items) {
GenericQtiNode insertNode = new ItemNode(item.getItem(), qtiPackage);
doInsert(parentTargetNode, insertNode, pos++);
}
}
event(ureq, menuTree, new Event(MenuTree.COMMAND_TREENODE_CLICKED));
qtiPackage.serializeQTIDocument();
updateWarning();
}
Aggregations