Search in sources :

Example 21 with CourseEnvironment

use of org.olat.course.run.environment.CourseEnvironment in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentDetailsController method getSignatureOptions.

private DigitalSignatureOptions getSignatureOptions(AssessmentTestSession session) {
    RepositoryEntry sessionTestEntry = session.getTestEntry();
    QTI21DeliveryOptions deliveryOptions = qtiService.getDeliveryOptions(sessionTestEntry);
    boolean digitalSignature = deliveryOptions.isDigitalSignature();
    boolean sendMail = deliveryOptions.isDigitalSignatureMail();
    if (courseNode != null) {
        ModuleConfiguration config = courseNode.getModuleConfiguration();
        digitalSignature = config.getBooleanSafe(IQEditController.CONFIG_DIGITAL_SIGNATURE, deliveryOptions.isDigitalSignature());
        sendMail = config.getBooleanSafe(IQEditController.CONFIG_DIGITAL_SIGNATURE_SEND_MAIL, deliveryOptions.isDigitalSignatureMail());
    }
    DigitalSignatureOptions options = new DigitalSignatureOptions(digitalSignature, sendMail, entry, testEntry);
    if (digitalSignature) {
        if (courseNode == null) {
            AssessmentEntryOutcomesListener.decorateResourceConfirmation(entry, testEntry, session, options, null, getLocale());
        } else {
            CourseEnvironment courseEnv = CourseFactory.loadCourse(entry).getCourseEnvironment();
            QTI21AssessmentRunController.decorateCourseConfirmation(session, options, courseEnv, courseNode, sessionTestEntry, null, getLocale());
        }
    }
    return options;
}
Also used : QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions) ModuleConfiguration(org.olat.modules.ModuleConfiguration) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) DigitalSignatureOptions(org.olat.ims.qti21.model.DigitalSignatureOptions) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 22 with CourseEnvironment

use of org.olat.course.run.environment.CourseEnvironment in project OpenOLAT by OpenOLAT.

the class QTI21RetrieveTestsController method doRetrieveTest.

private void doRetrieveTest(AssessmentTestSession session) {
    session = qtiService.getAssessmentTestSession(session.getKey());
    session = qtiService.pullSession(session, getSignatureOptions(session), getIdentity());
    if (courseNode != null) {
        RepositoryEntry courseEntry = session.getRepositoryEntry();
        CourseEnvironment courseEnv = CourseFactory.loadCourse(courseEntry).getCourseEnvironment();
        UserCourseEnvironment assessedUserCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(session.getIdentity(), courseEnv);
        courseNode.pullAssessmentTestSession(session, assessedUserCourseEnv, getIdentity(), Role.coach);
    }
}
Also used : CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 23 with CourseEnvironment

use of org.olat.course.run.environment.CourseEnvironment in project openolat by klemens.

the class TodayVariable method getValue.

/**
 * @see com.neemsoft.jmep.VariableCB#getValue()
 */
public Object getValue() {
    CourseEditorEnv cev = getUserCourseEnv().getCourseEditorEnv();
    if (cev != null) {
        return new Double(0);
    }
    CourseEnvironment ce = getUserCourseEnv().getCourseEnvironment();
    long time = ce.getCurrentTimeMillis();
    Date date = new Date(time);
    Date day = DateUtils.truncate(date, Calendar.DATE);
    Double dDay = new Double(day.getTime());
    return dDay;
}
Also used : CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) CourseEditorEnv(org.olat.course.editor.CourseEditorEnv) Date(java.util.Date)

Example 24 with CourseEnvironment

use of org.olat.course.run.environment.CourseEnvironment in project openolat by klemens.

the class CheckboxEditController method getFileContainer.

private VFSContainer getFileContainer() {
    VFSContainer container;
    if (courseNode == null) {
        File tmp = new File(FolderConfig.getCanonicalTmpDir(), checkbox.getCheckboxId());
        container = new LocalFolderImpl(tmp);
    } else {
        ICourse course = CourseFactory.loadCourse(courseOres);
        CourseEnvironment courseEnv = course.getCourseEnvironment();
        container = checkboxManager.getFileContainer(courseEnv, courseNode);
    }
    return container;
}
Also used : CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) VFSContainer(org.olat.core.util.vfs.VFSContainer) ICourse(org.olat.course.ICourse) File(java.io.File) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 25 with CourseEnvironment

use of org.olat.course.run.environment.CourseEnvironment in project openolat by klemens.

the class BulkAssessmentTask method getReturnBox.

/**
 * Return the target folder of the assessed identity. This is a factory method which take care
 * of the type of the course node.
 *
 * @param uce
 * @param courseNode
 * @param identity
 * @return
 */
private VFSContainer getReturnBox(UserCourseEnvironment uce, CourseNode courseNode, Identity identity) {
    VFSContainer returnContainer = null;
    if (courseNode instanceof GTACourseNode) {
        final GTAManager gtaManager = CoreSpringFactory.getImpl(GTAManager.class);
        CourseEnvironment courseEnv = uce.getCourseEnvironment();
        returnContainer = gtaManager.getCorrectionContainer(courseEnv, (GTACourseNode) courseNode, identity);
    } else {
        String returnPath = ReturnboxController.getReturnboxPathRelToFolderRoot(uce.getCourseEnvironment(), courseNode);
        OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(returnPath, null);
        VFSItem assessedItem = rootFolder.resolve(identity.getName());
        if (assessedItem == null) {
            returnContainer = rootFolder.createChildContainer(identity.getName());
        } else if (assessedItem instanceof VFSContainer) {
            returnContainer = (VFSContainer) assessedItem;
        }
    }
    return returnContainer;
}
Also used : OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) VFSContainer(org.olat.core.util.vfs.VFSContainer) GTACourseNode(org.olat.course.nodes.GTACourseNode) GTAManager(org.olat.course.nodes.gta.GTAManager) VFSItem(org.olat.core.util.vfs.VFSItem)

Aggregations

CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)80 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)64 RepositoryEntry (org.olat.repository.RepositoryEntry)34 Identity (org.olat.core.id.Identity)28 ICourse (org.olat.course.ICourse)18 VFSContainer (org.olat.core.util.vfs.VFSContainer)16 File (java.io.File)14 Date (java.util.Date)14 CourseNode (org.olat.course.nodes.CourseNode)14 Test (org.junit.Test)12 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)12 BusinessGroup (org.olat.group.BusinessGroup)12 ModuleConfiguration (org.olat.modules.ModuleConfiguration)12 ArrayList (java.util.ArrayList)10 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)10 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)10 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)10 Path (java.nio.file.Path)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 OLATResourceable (org.olat.core.id.OLATResourceable)8