Search in sources :

Example 81 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class SubmissionTaskRuleSPI method getDueDate.

@Override
protected Date getDueDate(GTACourseNode gtaNode) {
    Date dueDate = null;
    ModuleConfiguration config = gtaNode.getModuleConfiguration();
    boolean submit = config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT);
    if (submit) {
        dueDate = config.getDateValue(GTACourseNode.GTASK_SUBMIT_DEADLINE);
    }
    return dueDate;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) Date(java.util.Date)

Example 82 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class BeforeDateTaskRuleEditor method searchNodesWithDeadlines.

private void searchNodesWithDeadlines(CourseNode courseNode, List<CourseNode> nodes) {
    if (courseNode instanceof GTACourseNode) {
        GTACourseNode assessableCourseNode = (GTACourseNode) courseNode;
        ModuleConfiguration config = assessableCourseNode.getModuleConfiguration();
        if (AssignTaskRuleSPI.class.getSimpleName().equals(ruleType)) {
            boolean assignment = config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT);
            if (assignment) {
                Date dueDate = config.getDateValue(GTACourseNode.GTASK_ASSIGNMENT_DEADLINE);
                int numOfDays = config.getIntegerSafe(GTACourseNode.GTASK_ASSIGNMENT_DEADLINE_RELATIVE, -1);
                String relativeTo = config.getStringValue(GTACourseNode.GTASK_ASSIGNMENT_DEADLINE_RELATIVE_TO);
                if (dueDate != null) {
                    nodes.add(courseNode);
                } else if (numOfDays >= 0 && StringHelper.containsNonWhitespace(relativeTo)) {
                    nodes.add(courseNode);
                }
            }
        } else if (SubmissionTaskRuleSPI.class.getSimpleName().equals(ruleType)) {
            boolean submit = config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT);
            if (submit) {
                Date dueDate = config.getDateValue(GTACourseNode.GTASK_SUBMIT_DEADLINE);
                int numOfDays = config.getIntegerSafe(GTACourseNode.GTASK_SUBMIT_DEADLINE_RELATIVE, -1);
                String relativeTo = config.getStringValue(GTACourseNode.GTASK_SUBMIT_DEADLINE_RELATIVE_TO);
                if (dueDate != null) {
                    nodes.add(courseNode);
                } else if (numOfDays >= 0 && StringHelper.containsNonWhitespace(relativeTo)) {
                    nodes.add(courseNode);
                }
            }
        }
    }
    for (int i = 0; i < courseNode.getChildCount(); i++) {
        CourseNode child = (CourseNode) courseNode.getChildAt(i);
        searchNodesWithDeadlines(child, nodes);
    }
}
Also used : AssignTaskRuleSPI(org.olat.course.nodes.gta.rule.AssignTaskRuleSPI) ModuleConfiguration(org.olat.modules.ModuleConfiguration) GTACourseNode(org.olat.course.nodes.GTACourseNode) CourseNode(org.olat.course.nodes.CourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) Date(java.util.Date)

Example 83 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class QTI12PullTestsToolController method retrieveTest.

private void retrieveTest(Identity assessedIdentity, ICourse course) {
    ModuleConfiguration modConfig = courseNode.getModuleConfiguration();
    String resourcePathInfo = courseEnv.getCourseResourceableId() + File.separator + courseNode.getIdent();
    AssessmentInstance ai = AssessmentFactory.createAssessmentInstance(assessedIdentity, "", modConfig, false, courseEnv.getCourseResourceableId(), courseNode.getIdent(), resourcePathInfo, null);
    // close the test
    ai.stop();
    // persist the results
    iqm.persistResults(ai);
    // reporting
    Document docResReporting = iqm.getResultsReporting(ai, assessedIdentity, I18nModule.getDefaultLocale());
    FilePersister.createResultsReporting(docResReporting, assessedIdentity, ai.getFormattedType(), ai.getAssessID());
    // olat results
    AssessmentContext ac = ai.getAssessmentContext();
    Float score = new Float(ac.getScore());
    Boolean passed = new Boolean(ac.isPassed());
    ScoreEvaluation sceval = new ScoreEvaluation(score, passed, Boolean.FALSE, new Long(ai.getAssessID()));
    UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
    courseNode.updateUserScoreEvaluation(sceval, userCourseEnv, assessedIdentity, true, Role.coach);
    // cleanup
    ai.cleanUp();
}
Also used : AssessmentContext(org.olat.ims.qti.container.AssessmentContext) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) ModuleConfiguration(org.olat.modules.ModuleConfiguration) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessmentInstance(org.olat.ims.qti.process.AssessmentInstance) Document(org.dom4j.Document)

Example 84 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class ProjectBrokerManagerTest method testPerformanceTableModel.

@Test
public void testPerformanceTableModel() throws Exception {
    int ITERATION = 300;
    int START_PAGE_INDEX = 100;
    int PAGE_SIZE = 20;
    Translator translator = Util.createPackageTranslator(this.getClass(), Locale.GERMAN);
    ProjectBroker projectBrokerD = projectBrokerManager.createAndSaveProjectBroker();
    Long idProjectBrokerD = projectBrokerD.getKey();
    ProjectBrokerModuleConfiguration moduleConfig = new ProjectBrokerModuleConfiguration(new ModuleConfiguration());
    for (int i = 0; i < ITERATION; i++) {
        createProject("thema D1_" + i, id1, idProjectBrokerD, resourceableId);
    }
    List<Project> projectListD = projectBrokerManager.getProjectListBy(idProjectBrokerD);
    ProjectListTableModel tableModel = new ProjectListTableModel(projectListD, id1, translator, moduleConfig, 0, 0, 0, false);
    // loop over table like rendering loop
    long startTime = System.currentTimeMillis();
    for (int row = START_PAGE_INDEX; row < START_PAGE_INDEX + PAGE_SIZE; row++) {
        for (int col = 0; col < tableModel.getColumnCount(); col++) {
            Object element = tableModel.getValueAt(row, col);
            Assert.assertNotNull(element);
        }
    }
    long endTime = System.currentTimeMillis();
    long duration = endTime - startTime;
    log.info("tableModel.getValueAt(row, col) for " + PAGE_SIZE + "elements (of " + ITERATION + ") takes " + duration + "ms with " + ITERATION + " projects");
}
Also used : Project(org.olat.course.nodes.projectbroker.datamodel.Project) ProjectBroker(org.olat.course.nodes.projectbroker.datamodel.ProjectBroker) ProjectBrokerModuleConfiguration(org.olat.course.nodes.projectbroker.service.ProjectBrokerModuleConfiguration) ProjectBrokerModuleConfiguration(org.olat.course.nodes.projectbroker.service.ProjectBrokerModuleConfiguration) ModuleConfiguration(org.olat.modules.ModuleConfiguration) Translator(org.olat.core.gui.translator.Translator) Test(org.junit.Test)

Example 85 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class IQSURVCourseNode method createNodeRunConstructionResult.

/**
 * @see org.olat.course.nodes.CourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation)
 */
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    Controller controller;
    // Do not allow guests to start questionnaires
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
        Translator trans = Util.createPackageTranslator(IQSURVCourseNode.class, ureq.getLocale());
        String title = trans.translate("guestnoaccess.title");
        String message = trans.translate("guestnoaccess.message");
        controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
        ModuleConfiguration config = getModuleConfiguration();
        boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
        if (onyx) {
            Translator trans = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
            controller = MessageUIFactory.createInfoMessage(ureq, wControl, "", trans.translate("error.onyx"));
        } else {
            RepositoryEntry repositoryEntry = getReferencedRepositoryEntry();
            OLATResourceable ores = repositoryEntry.getOlatResource();
            Long resId = ores.getResourceableId();
            SurveyFileResource fr = new SurveyFileResource();
            fr.overrideResourceableId(resId);
            if (!CoordinatorManager.getInstance().getCoordinator().getLocker().isLocked(fr, null)) {
                AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
                IQSecurityCallback sec = new CourseIQSecurityCallback(this, am, ureq.getIdentity());
                controller = new IQRunController(userCourseEnv, getModuleConfiguration(), sec, ureq, wControl, this);
            } else {
                Translator trans = Util.createPackageTranslator(IQSURVCourseNode.class, ureq.getLocale());
                String title = trans.translate("editor.lock.title");
                String message = trans.translate("editor.lock.message");
                controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
            }
        }
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_iqsurv_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) IQRunController(org.olat.course.nodes.iq.IQRunController) OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentManager(org.olat.course.assessment.AssessmentManager) Roles(org.olat.core.id.Roles) RepositoryEntry(org.olat.repository.RepositoryEntry) IQEditController(org.olat.course.nodes.iq.IQEditController) NodeEditController(org.olat.course.editor.NodeEditController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) Controller(org.olat.core.gui.control.Controller) IQRunController(org.olat.course.nodes.iq.IQRunController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) SurveyFileResource(org.olat.ims.qti.fileresource.SurveyFileResource) Translator(org.olat.core.gui.translator.Translator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) IQSecurityCallback(org.olat.modules.iq.IQSecurityCallback) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback)

Aggregations

ModuleConfiguration (org.olat.modules.ModuleConfiguration)296 ArrayList (java.util.ArrayList)34 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)28 ICourse (org.olat.course.ICourse)26 CourseNode (org.olat.course.nodes.CourseNode)26 Date (java.util.Date)22 RepositoryEntry (org.olat.repository.RepositoryEntry)22 File (java.io.File)20 CheckboxList (org.olat.course.nodes.cl.model.CheckboxList)18 List (java.util.List)16 Identity (org.olat.core.id.Identity)16 CheckboxManager (org.olat.course.nodes.cl.CheckboxManager)16 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)16 Translator (org.olat.core.gui.translator.Translator)14 AssessmentManager (org.olat.course.assessment.AssessmentManager)14 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)14 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)14 VFSItem (org.olat.core.util.vfs.VFSItem)12 BusinessGroup (org.olat.group.BusinessGroup)12 Checkbox (org.olat.course.nodes.cl.model.Checkbox)11