use of org.olat.course.run.environment.CourseEnvironment in project openolat by klemens.
the class PreviewConfigHelper method getPreviewCourseEnvironment.
public static CourseEnvironment getPreviewCourseEnvironment(boolean isCoach, boolean isCourseAdmin, ICourse course) {
// generateEnvironment();
final RepositoryEntry courseResource = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
final CourseGroupManager cgm = new PreviewCourseGroupManager(courseResource, new ArrayList<BusinessGroup>(), new ArrayList<BGArea>(), isCoach, isCourseAdmin);
final UserNodeAuditManager auditman = new PreviewAuditManager();
final AssessmentManager am = new PreviewAssessmentManager();
final CoursePropertyManager cpm = new PreviewCoursePropertyManager();
final Structure runStructure = course.getEditorTreeModel().createStructureForPreview();
final String title = course.getCourseTitle();
final CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
CourseEnvironment previewCourseEnvironment = new PreviewCourseEnvironment(title, runStructure, new Date(), course.getCourseFolderContainer(), course.getCourseBaseContainer(), course.getResourceableId(), cpm, cgm, auditman, am, courseConfig);
return previewCourseEnvironment;
}
use of org.olat.course.run.environment.CourseEnvironment in project openolat by klemens.
the class ConvertToGTACourseNode method convertTasks.
private void convertTasks(TaskList taskList, TACourseNode sourceNode, GTACourseNode gtaNode, ICourse course) {
File taskFolder = new File(FolderConfig.getCanonicalRoot(), TACourseNode.getTaskFolderPathRelToFolderRoot(course, sourceNode));
OlatRootFolderImpl taskContainer = new OlatRootFolderImpl(TACourseNode.getTaskFolderPathRelToFolderRoot(course, sourceNode), null);
CourseEnvironment courseEnv = course.getCourseEnvironment();
File gtaskDirectory = gtaManager.getTasksDirectory(courseEnv, gtaNode);
VFSContainer gtaskContainer = gtaManager.getTasksContainer(courseEnv, gtaNode);
// make the task
TaskDefinitionList taskDefs = new TaskDefinitionList();
for (File task : taskFolder.listFiles(SystemFileFilter.FILES_ONLY)) {
TaskDefinition taskDef = new TaskDefinition();
taskDef.setDescription("");
taskDef.setFilename(task.getName());
taskDef.setTitle(task.getName());
taskDefs.getTasks().add(taskDef);
try {
File target = new File(gtaskDirectory, task.getName());
Files.copy(task.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING);
convertMetada(taskContainer, gtaskContainer, task.getName(), taskDef, null);
} catch (Exception ex) {
log.error("", ex);
}
List<Property> samples = courseEnv.getCoursePropertyManager().listCourseNodeProperties(sourceNode, null, null, TaskController.PROP_ASSIGNED);
for (Property sample : samples) {
File taskFile = new File(gtaskDirectory, sample.getStringValue());
Identity id = securityManager.loadIdentityByKey(sample.getIdentity().getKey());
gtaManager.selectTask(id, taskList, gtaNode, taskFile);
}
}
gtaNode.getModuleConfiguration().set(GTACourseNode.GTASK_TASKS, taskDefs);
}
use of org.olat.course.run.environment.CourseEnvironment in project openolat by klemens.
the class DropboxController method init.
protected void init(UserRequest ureq, WindowControl wControl, boolean previewMode, boolean hasNotification) {
myContent = createVelocityContainer("dropbox");
ulButton = LinkFactory.createButton("dropbox.upload", myContent, this);
ulButton.setVisible(!userCourseEnv.isCourseReadOnly());
if (!previewMode) {
VFSContainer fDropbox = getDropBox(ureq.getIdentity());
int numFiles = fDropbox.getItems().size();
if (numFiles > 0)
myContent.contextPut("numfiles", new String[] { Integer.toString(numFiles) });
} else {
myContent.contextPut("numfiles", "0");
}
myContent.contextPut("previewMode", previewMode ? Boolean.TRUE : Boolean.FALSE);
// notification
CourseEnvironment courseEnv = userCourseEnv.getCourseEnvironment();
subsContext = DropboxFileUploadNotificationHandler.getSubscriptionContext(courseEnv, node);
if (hasNotification && !previewMode) {
// offer subscription, but not to guests
if (subsContext != null) {
String path = getDropboxPathRelToFolderRoot(courseEnv, node);
contextualSubscriptionCtr = AbstractTaskNotificationHandler.createContextualSubscriptionController(ureq, wControl, path, subsContext, DropboxController.class);
myContent.put("subscription", contextualSubscriptionCtr.getInitialComponent());
myContent.contextPut("hasNotification", Boolean.TRUE);
}
} else {
myContent.contextPut("hasNotification", Boolean.FALSE);
}
putInitialPanel(myContent);
}
use of org.olat.course.run.environment.CourseEnvironment in project openolat by klemens.
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;
}
use of org.olat.course.run.environment.CourseEnvironment in project openolat by klemens.
the class QTI21RetrieveTestsController method getSignatureOptions.
private DigitalSignatureOptions getSignatureOptions(AssessmentTestSession session) {
if (courseNode == null)
return null;
RepositoryEntry testEntry = session.getTestEntry();
RepositoryEntry courseEntry = session.getRepositoryEntry();
QTI21DeliveryOptions deliveryOptions = qtiService.getDeliveryOptions(testEntry);
boolean digitalSignature = deliveryOptions.isDigitalSignature();
boolean sendMail = deliveryOptions.isDigitalSignatureMail();
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, courseEntry, testEntry);
if (digitalSignature) {
CourseEnvironment courseEnv = CourseFactory.loadCourse(courseEntry).getCourseEnvironment();
QTI21AssessmentRunController.decorateCourseConfirmation(session, options, courseEnv, courseNode, testEntry, null, getLocale());
}
return options;
}
Aggregations