use of org.olat.course.nodes.gta.model.TaskDefinition in project OpenOLAT by OpenOLAT.
the class GTACoachController method getTaskDefinition.
private TaskDefinition getTaskDefinition(Task task) {
if (task == null)
return null;
TaskDefinition taskDef = null;
List<TaskDefinition> availableTasks = gtaManager.getTaskDefinitions(courseEnv, gtaNode);
for (TaskDefinition availableTask : availableTasks) {
if (availableTask.getFilename() != null && availableTask.getFilename().equals(task.getTaskName())) {
taskDef = availableTask;
break;
}
}
return taskDef;
}
use of org.olat.course.nodes.gta.model.TaskDefinition in project OpenOLAT by OpenOLAT.
the class GTACoachController method stepAssignment.
@Override
protected Task stepAssignment(UserRequest ureq, Task assignedTask) {
assignedTask = super.stepAssignment(ureq, assignedTask);
if (assignedTask == null || assignedTask.getTaskStatus() == TaskProcess.assignment) {
mainVC.contextPut("assignmentCssClass", "o_active");
} else {
mainVC.contextPut("assignmentCssClass", "o_done");
TaskDefinition taskDef = getTaskDefinition(assignedTask);
assignedTaskCtrl = new GTAAssignedTaskController(ureq, getWindowControl(), assignedTask, taskDef, courseEnv, gtaNode, "coach.task.assigned.description", "warning.no.task.choosed.coach", null);
listenTo(assignedTaskCtrl);
mainVC.put("assignedTask", assignedTaskCtrl.getInitialComponent());
}
return assignedTask;
}
use of org.olat.course.nodes.gta.model.TaskDefinition in project OpenOLAT by OpenOLAT.
the class GTAParticipantController method showAssignedTask.
private void showAssignedTask(UserRequest ureq, Task assignedTask) {
String message = gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_USERS_TEXT);
TaskDefinition taskDef = getTaskDefinition(assignedTask);
assignedTaskCtrl = new GTAAssignedTaskController(ureq, getWindowControl(), assignedTask, taskDef, courseEnv, gtaNode, "task.assigned.description", "warning.no.task.choosed", message);
listenTo(assignedTaskCtrl);
mainVC.put("myAssignedTask", assignedTaskCtrl.getInitialComponent());
}
use of org.olat.course.nodes.gta.model.TaskDefinition in project OpenOLAT by OpenOLAT.
the class GTAManagerImpl method getTaskDefinitions.
@Override
public List<TaskDefinition> getTaskDefinitions(CourseEnvironment courseEnv, GTACourseNode cNode) {
Path taskDefinitionsPath = Paths.get(FolderConfig.getCanonicalRoot(), courseEnv.getCourseBaseContainer().getRelPath(), "gtasks", cNode.getIdent(), TASKS_DEFINITIONS);
List<TaskDefinition> taskDefinitions = new ArrayList<>();
if (Files.exists(taskDefinitionsPath)) {
TaskDefinitionList taskDefinitionsList = (TaskDefinitionList) taskDefinitionsXstream.fromXML(taskDefinitionsPath.toFile());
if (taskDefinitionsList != null && taskDefinitionsList.getTasks() != null) {
taskDefinitions.addAll(taskDefinitionsList.getTasks());
}
} else {
syncWithTaskList(courseEnv, cNode, new TaskListSynched() {
@Override
public void sync() {
ModuleConfiguration config = cNode.getModuleConfiguration();
TaskDefinitionList tasks = (TaskDefinitionList) config.get(GTACourseNode.GTASK_TASKS);
if (tasks != null) {
taskDefinitions.addAll(tasks.getTasks());
}
storeTaskDefinitions(taskDefinitions, courseEnv, cNode);
}
});
}
return taskDefinitions;
}
use of org.olat.course.nodes.gta.model.TaskDefinition in project OpenOLAT by OpenOLAT.
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);
}
Aggregations