use of org.olat.modules.qpool.model.QEducationalContext in project openolat by klemens.
the class MetadataBulkChangeController method formOKQuestion.
private void formOKQuestion(QuestionItemImpl itemImpl) {
if (isEnabled(contextEl)) {
if (contextEl.isOneSelected()) {
QEducationalContext context = qpoolService.getEducationlContextByLevel(contextEl.getSelectedKey());
itemImpl.setEducationalContext(context);
} else {
itemImpl.setEducationalContext(null);
}
}
if (isEnabled(learningTimeContainer)) {
int day = learningTimeDayElement.getIntValue();
int hour = learningTimeHourElement.getIntValue();
int minute = learningTimeMinuteElement.getIntValue();
int seconds = learningTimeSecondElement.getIntValue();
String timeStr = MetadataConverterHelper.convertDuration(day, hour, minute, seconds);
itemImpl.setEducationalLearningTime(timeStr);
}
if (isEnabled(difficultyEl))
itemImpl.setDifficulty(toBigDecimal(difficultyEl.getValue()));
if (isEnabled(stdevDifficultyEl))
itemImpl.setStdevDifficulty(toBigDecimal(stdevDifficultyEl.getValue()));
if (isEnabled(differentiationEl))
itemImpl.setDifferentiation(toBigDecimal(differentiationEl.getValue()));
if (isEnabled(numAnswerAltEl))
itemImpl.setNumOfAnswerAlternatives(toInt(numAnswerAltEl.getValue()));
if (isEnabled(assessmentTypeEl)) {
String assessmentType = assessmentTypeEl.isOneSelected() ? assessmentTypeEl.getSelectedKey() : null;
itemImpl.setAssessmentType(assessmentType);
}
}
use of org.olat.modules.qpool.model.QEducationalContext in project openolat by klemens.
the class QEducationalContextsAdminController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == createType) {
doEdit(ureq, null);
} else if (source == tableEl) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
if ("delete-level".equals(se.getCommand())) {
QEducationalContext row = model.getObject(se.getIndex());
doConfirmDelete(ureq, row);
} else if ("translate".equals(se.getCommand())) {
QEducationalContext row = model.getObject(se.getIndex());
doOpenTranslationTool(ureq, row);
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.modules.qpool.model.QEducationalContext in project openolat by klemens.
the class QTIImportProcessorTest method testImport_QTI12_metadata.
@Test
public void testImport_QTI12_metadata() throws IOException, URISyntaxException {
URL itemUrl = QTIImportProcessorTest.class.getResource("mchc_i_001.xml");
Assert.assertNotNull(itemUrl);
File itemFile = new File(itemUrl.toURI());
// get the document informations
QTIImportProcessor proc = new QTIImportProcessor(owner, Locale.ENGLISH, itemFile.getName(), itemFile);
List<QuestionItem> items = proc.process();
Assert.assertNotNull(items);
Assert.assertEquals(1, items.size());
dbInstance.commitAndCloseSession();
// check metadata
QuestionItem item = items.get(0);
Assert.assertEquals("Standard Multiple Choice Item", item.getTitle());
// qmd_levelofdifficulty
QEducationalContext level = item.getEducationalContext();
Assert.assertNotNull(level);
Assert.assertEquals("basic", level.getLevel());
// qmd_toolvendor
Assert.assertEquals("QTITools", item.getEditor());
}
use of org.olat.modules.qpool.model.QEducationalContext in project openolat by klemens.
the class QTIImportProcessor method processMetadataField.
/**
* <ul>
* <li>qmd_computerscored</li>
* <li>qmd_feedbackpermitted</li>
* <li>qmd_hintspermitted</li>
* <li>qmd_itemtype -> (check is made on the content of the item)</li>
* <li>qmd_levelofdifficulty -> educational context</li>
* <li>qmd_maximumscore</li>
* <li>qmd_renderingtype</li>
* <li>qmd_responsetype</li>
* <li>qmd_scoringpermitted</li>
* <li>qmd_solutionspermitted</li>
* <li>qmd_status</li>
* <li>qmd_timedependence</li>
* <li>qmd_timelimit</li>
* <li>qmd_toolvendor -> editor</li>
* <li>qmd_topic</li>
* <li>qmd_material</li>
* <li>qmd_typeofsolution</li>
* <li>qmd_weighting</li>
* </ul>
* @param poolItem
* @param labelEl
* @param entryEl
*/
private void processMetadataField(QuestionItemImpl poolItem, Element labelEl, Element entryEl) {
String label = labelEl.getText();
String entry = entryEl.getText();
if (QTIConstants.META_LEVEL_OF_DIFFICULTY.equals(label)) {
if (StringHelper.containsNonWhitespace(entry)) {
QEducationalContext context = qEduContextDao.loadByLevel(entry);
if (context == null) {
context = qEduContextDao.create(entry, true);
}
poolItem.setEducationalContext(context);
}
} else if (QTIConstants.META_ITEM_TYPE.equals(label)) {
if (poolItem.getType() == null && StringHelper.containsNonWhitespace(entry)) {
// some heuristic
String typeStr = entry;
if (typeStr.equalsIgnoreCase("MCQ") || typeStr.equalsIgnoreCase("Multiple choice")) {
typeStr = QuestionType.MC.name();
} else if (typeStr.equalsIgnoreCase("SCQ") || typeStr.equalsIgnoreCase("Single choice")) {
typeStr = QuestionType.SC.name();
} else if (typeStr.equalsIgnoreCase("fill-in") || typeStr.equals("Fill-in-the-Blank") || typeStr.equalsIgnoreCase("Fill-in-Blank") || typeStr.equalsIgnoreCase("Fill In the Blank")) {
typeStr = QuestionType.FIB.name();
} else if (typeStr.equalsIgnoreCase("Essay")) {
typeStr = QuestionType.ESSAY.name();
}
QItemType type = qItemTypeDao.loadByType(entry);
if (type == null) {
type = qItemTypeDao.create(entry, true);
}
poolItem.setType(type);
}
} else if (QTIConstants.META_TOOLVENDOR.equals(label)) {
poolItem.setEditor(entry);
}
}
use of org.olat.modules.qpool.model.QEducationalContext in project OpenOLAT by OpenOLAT.
the class MetaUIFactory method getContextKeyValues.
public static KeyValues getContextKeyValues(Translator translator, QPoolService qpoolService) {
List<QEducationalContext> levels = qpoolService.getAllEducationlContexts();
String[] contextKeys = new String[levels.size()];
String[] contextValues = new String[levels.size()];
int count = 0;
for (QEducationalContext level : levels) {
contextKeys[count] = level.getLevel();
String i18nKey = "item.level." + level.getLevel().toLowerCase();
String translation = translator.translate(i18nKey);
if (i18nKey.equals(translation) || translation.length() > 256) {
translation = level.getLevel();
}
contextValues[count++] = translation;
}
return new KeyValues(contextKeys, contextValues);
}
Aggregations