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;
}
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);
}
}
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();
}
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");
}
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);
}
Aggregations