Search in sources :

Example 6 with QItemEdited

use of org.olat.modules.qpool.ui.events.QItemEdited in project OpenOLAT by OpenOLAT.

the class QTI21EditorController method updateQuestionItem.

private void updateQuestionItem(UserRequest ureq, AssessmentItem assessmentItem) {
    if (questionItem instanceof QuestionItemImpl) {
        String title = assessmentItem.getTitle();
        QuestionItemImpl itemImpl = (QuestionItemImpl) questionItem;
        itemImpl.setTitle(title);
        qpoolService.updateItem(itemImpl);
        fireEvent(ureq, new QItemEdited(questionItem));
    }
}
Also used : QItemEdited(org.olat.modules.qpool.ui.events.QItemEdited) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl)

Example 7 with QItemEdited

use of org.olat.modules.qpool.ui.events.QItemEdited in project openolat by klemens.

the class QTI12EditorController method updateQuestionItem.

private void updateQuestionItem(UserRequest ureq, Item assessmentItem) {
    if (qitem instanceof QuestionItemImpl && assessmentItem != null) {
        String title = assessmentItem.getTitle();
        QuestionItemImpl itemImpl = (QuestionItemImpl) qitem;
        itemImpl.setTitle(title);
        qpoolService.updateItem(itemImpl);
        fireEvent(ureq, new QItemEdited(qitem));
    }
}
Also used : QItemEdited(org.olat.modules.qpool.ui.events.QItemEdited) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl)

Example 8 with QItemEdited

use of org.olat.modules.qpool.ui.events.QItemEdited in project openolat by klemens.

the class QTI21EditorController method updateQuestionItem.

private void updateQuestionItem(UserRequest ureq, AssessmentItem assessmentItem) {
    if (questionItem instanceof QuestionItemImpl) {
        String title = assessmentItem.getTitle();
        QuestionItemImpl itemImpl = (QuestionItemImpl) questionItem;
        itemImpl.setTitle(title);
        qpoolService.updateItem(itemImpl);
        fireEvent(ureq, new QItemEdited(questionItem));
    }
}
Also used : QItemEdited(org.olat.modules.qpool.ui.events.QItemEdited) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl)

Example 9 with QItemEdited

use of org.olat.modules.qpool.ui.events.QItemEdited in project openolat by klemens.

the class QuestionMetadataEditController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (item instanceof QuestionItemImpl) {
        QuestionItemImpl itemImpl = (QuestionItemImpl) item;
        QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.UPDATE_QUESTION_ITEM_METADATA);
        builder.withBefore(itemImpl);
        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);
        BigDecimal difficulty = toBigDecimal(difficultyEl.getValue());
        itemImpl.setDifficulty(difficulty);
        BigDecimal stdevDifficulty = toBigDecimal(stdevDifficultyEl.getValue());
        itemImpl.setStdevDifficulty(stdevDifficulty);
        BigDecimal differentiation = toBigDecimal(differentiationEl.getValue());
        itemImpl.setDifferentiation(differentiation);
        int numOfAnswerAlternatives = toInt(numAnswerAltEl.getValue());
        itemImpl.setNumOfAnswerAlternatives(numOfAnswerAlternatives);
        int numUsage = toInt(usageEl.getValue());
        itemImpl.setUsage(numUsage);
        item = qpoolService.updateItem(itemImpl);
        builder.withAfter(item);
        qpoolService.persist(builder.create());
        fireEvent(ureq, new QItemEdited(item));
    }
}
Also used : QuestionItemAuditLogBuilder(org.olat.modules.qpool.QuestionItemAuditLogBuilder) QItemEdited(org.olat.modules.qpool.ui.events.QItemEdited) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl) MetaUIFactory.bigDToString(org.olat.modules.qpool.ui.metadata.MetaUIFactory.bigDToString) BigDecimal(java.math.BigDecimal) MetaUIFactory.validateBigDecimal(org.olat.modules.qpool.ui.metadata.MetaUIFactory.validateBigDecimal) MetaUIFactory.toBigDecimal(org.olat.modules.qpool.ui.metadata.MetaUIFactory.toBigDecimal)

Example 10 with QItemEdited

use of org.olat.modules.qpool.ui.events.QItemEdited in project openolat by klemens.

the class RightsMetadataEditController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (item instanceof QuestionItemImpl) {
        QuestionItemImpl itemImpl = (QuestionItemImpl) item;
        QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.UPDATE_QUESTION_ITEM_METADATA);
        builder.withBefore(itemImpl);
        if (licenseModule.isEnabled(licenseHandler)) {
            if (licenseEl != null && licenseEl.isOneSelected()) {
                String licenseTypeKey = licenseEl.getSelectedKey();
                LicenseType licneseType = licenseService.loadLicenseTypeByKey(licenseTypeKey);
                license.setLicenseType(licneseType);
            }
            String licensor = null;
            String freetext = null;
            if (licensorEl != null && licensorEl.isVisible()) {
                licensor = StringHelper.containsNonWhitespace(licensorEl.getValue()) ? licensorEl.getValue() : null;
            }
            if (licenseFreetextEl != null && licenseFreetextEl.isVisible()) {
                freetext = StringHelper.containsNonWhitespace(licenseFreetextEl.getValue()) ? licenseFreetextEl.getValue() : null;
            }
            license.setLicensor(licensor);
            license.setFreetext(freetext);
            license = licenseService.update(license);
            licensorEl.setValue(license.getLicensor());
            licenseFreetextEl.setValue(license.getFreetext());
        }
        item = qpoolService.updateItem(item);
        builder.withAfter(itemImpl);
        qpoolService.persist(builder.create());
        fireEvent(ureq, new QItemEdited(item));
    }
}
Also used : QuestionItemAuditLogBuilder(org.olat.modules.qpool.QuestionItemAuditLogBuilder) QItemEdited(org.olat.modules.qpool.ui.events.QItemEdited) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl) LicenseType(org.olat.core.commons.services.license.LicenseType)

Aggregations

QItemEdited (org.olat.modules.qpool.ui.events.QItemEdited)18 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)12 QuestionItemAuditLogBuilder (org.olat.modules.qpool.QuestionItemAuditLogBuilder)8 ArrayList (java.util.ArrayList)6 List (java.util.List)6 QuestionItemShort (org.olat.modules.qpool.QuestionItemShort)6 BusinessGroup (org.olat.group.BusinessGroup)4 BusinessGroupSelectionEvent (org.olat.group.model.BusinessGroupSelectionEvent)4 QPoolSelectionEvent (org.olat.modules.qpool.ui.events.QPoolSelectionEvent)4 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)4 BigDecimal (java.math.BigDecimal)2 IdentitiesAddEvent (org.olat.admin.securitygroup.gui.IdentitiesAddEvent)2 IdentitiesRemoveEvent (org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent)2 LicenseType (org.olat.core.commons.services.license.LicenseType)2 StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)2 Identity (org.olat.core.id.Identity)2 ExportFormatOptions (org.olat.modules.qpool.ExportFormatOptions)2 QuestionItem (org.olat.modules.qpool.QuestionItem)2 QEducationalContext (org.olat.modules.qpool.model.QEducationalContext)2 QItemList (org.olat.modules.qpool.model.QItemList)2