use of org.olat.modules.portfolio.model.EvaluationFormPart in project OpenOLAT by OpenOLAT.
the class EvaluationFormHandler method getContent.
@Override
public PageRunElement getContent(UserRequest ureq, WindowControl wControl, PageElement element, PageElementRenderingHints hints) {
Controller ctrl = null;
if (element instanceof EvaluationFormPart) {
PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
// find assignment
EvaluationFormPart eva = (EvaluationFormPart) element;
PageBody body = eva.getBody();
Assignment assignment = portfolioService.getAssignment(body);
if (assignment == null) {
ctrl = getController(ureq, wControl, body, eva);
} else {
ctrl = getControllerForAssignment(ureq, wControl, body, assignment, hints.isOnePage());
}
}
if (ctrl == null) {
Translator translator = Util.createPackageTranslator(PortfolioHomeController.class, ureq.getLocale());
String title = translator.translate("warning.evaluation.not.visible.title");
String text = translator.translate("warning.evaluation.not.visible.text");
ctrl = MessageUIFactory.createWarnMessage(ureq, wControl, title, text);
}
return new PageRunControllerElement(ctrl);
}
use of org.olat.modules.portfolio.model.EvaluationFormPart in project openolat by klemens.
the class EvaluationFormHandler method getContent.
@Override
public PageRunElement getContent(UserRequest ureq, WindowControl wControl, PageElement element, PageElementRenderingHints hints) {
Controller ctrl = null;
if (element instanceof EvaluationFormPart) {
PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
// find assignment
EvaluationFormPart eva = (EvaluationFormPart) element;
PageBody body = eva.getBody();
Assignment assignment = portfolioService.getAssignment(body);
if (assignment == null) {
ctrl = getController(ureq, wControl, body, eva);
} else {
ctrl = getControllerForAssignment(ureq, wControl, body, assignment, hints.isOnePage());
}
}
if (ctrl == null) {
Translator translator = Util.createPackageTranslator(PortfolioHomeController.class, ureq.getLocale());
String title = translator.translate("warning.evaluation.not.visible.title");
String text = translator.translate("warning.evaluation.not.visible.text");
ctrl = MessageUIFactory.createWarnMessage(ureq, wControl, title, text);
}
return new PageRunControllerElement(ctrl);
}
use of org.olat.modules.portfolio.model.EvaluationFormPart in project OpenOLAT by OpenOLAT.
the class AssignmentDAO method startFormAssignment.
public Assignment startFormAssignment(Assignment assignment, Page page, Identity assignee) {
((AssignmentImpl) assignment).setPage(page);
((AssignmentImpl) assignment).setAssignee(assignee);
((AssignmentImpl) assignment).setLastModified(new Date());
assignment.setAssignmentStatus(AssignmentStatus.inProgress);
RepositoryEntry formEntry = assignment.getFormEntry();
if (formEntry.getOlatResource().getResourceableTypeName().equals(formHandler.getSupportedType())) {
File formFile = formHandler.getFormFile(formEntry);
String formXml = FileUtils.load(formFile, "UTF-8");
EvaluationFormPart formPart = new EvaluationFormPart();
formPart.setContent(formXml);
formPart.setFormEntry(formEntry);
pageDao.persistPart(page.getBody(), formPart);
}
return dbInstance.getCurrentEntityManager().merge(assignment);
}
use of org.olat.modules.portfolio.model.EvaluationFormPart in project OpenOLAT by OpenOLAT.
the class EvaluationFormHandler method getEditor.
@Override
public Controller getEditor(UserRequest ureq, WindowControl wControl, PageElement element) {
if (element instanceof EvaluationFormPart) {
PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
// find assignment
EvaluationFormPart eva = (EvaluationFormPart) element;
PageBody body = eva.getBody();
Assignment assignment = portfolioService.getAssignment(body);
// find the evaluation form
RepositoryEntry re = assignment.getFormEntry();
File repositoryDir = new File(FileResourceManager.getInstance().getFileResourceRoot(re.getOlatResource()), FileResourceManager.ZIPDIR);
File formFile = new File(repositoryDir, FORM_XML_FILE);
return new EvaluationFormController(ureq, wControl, formFile);
}
return null;
}
use of org.olat.modules.portfolio.model.EvaluationFormPart in project openolat by klemens.
the class AssignmentDAO method startFormAssignment.
public Assignment startFormAssignment(Assignment assignment, Page page, Identity assignee) {
((AssignmentImpl) assignment).setPage(page);
((AssignmentImpl) assignment).setAssignee(assignee);
((AssignmentImpl) assignment).setLastModified(new Date());
assignment.setAssignmentStatus(AssignmentStatus.inProgress);
RepositoryEntry formEntry = assignment.getFormEntry();
if (formEntry.getOlatResource().getResourceableTypeName().equals(formHandler.getSupportedType())) {
File formFile = formHandler.getFormFile(formEntry);
String formXml = FileUtils.load(formFile, "UTF-8");
EvaluationFormPart formPart = new EvaluationFormPart();
formPart.setContent(formXml);
formPart.setFormEntry(formEntry);
pageDao.persistPart(page.getBody(), formPart);
}
return dbInstance.getCurrentEntityManager().merge(assignment);
}
Aggregations