Search in sources :

Example 1 with EvaluationFormPart

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);
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) PageRunControllerElement(org.olat.modules.portfolio.ui.editor.PageRunControllerElement) EvaluationFormPart(org.olat.modules.portfolio.model.EvaluationFormPart) PortfolioService(org.olat.modules.portfolio.PortfolioService) Translator(org.olat.core.gui.translator.Translator) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) Controller(org.olat.core.gui.control.Controller) EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController) PortfolioHomeController(org.olat.modules.portfolio.ui.PortfolioHomeController) PageBody(org.olat.modules.portfolio.PageBody)

Example 2 with EvaluationFormPart

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);
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) PageRunControllerElement(org.olat.modules.portfolio.ui.editor.PageRunControllerElement) EvaluationFormPart(org.olat.modules.portfolio.model.EvaluationFormPart) PortfolioService(org.olat.modules.portfolio.PortfolioService) Translator(org.olat.core.gui.translator.Translator) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) Controller(org.olat.core.gui.control.Controller) EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController) PortfolioHomeController(org.olat.modules.portfolio.ui.PortfolioHomeController) PageBody(org.olat.modules.portfolio.PageBody)

Example 3 with EvaluationFormPart

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);
}
Also used : EvaluationFormPart(org.olat.modules.portfolio.model.EvaluationFormPart) AssignmentImpl(org.olat.modules.portfolio.model.AssignmentImpl) RepositoryEntry(org.olat.repository.RepositoryEntry) PersistenceHelper.makeFuzzyQueryString(org.olat.core.commons.persistence.PersistenceHelper.makeFuzzyQueryString) File(java.io.File) Date(java.util.Date)

Example 4 with EvaluationFormPart

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;
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController) EvaluationFormPart(org.olat.modules.portfolio.model.EvaluationFormPart) PortfolioService(org.olat.modules.portfolio.PortfolioService) RepositoryEntry(org.olat.repository.RepositoryEntry) PageBody(org.olat.modules.portfolio.PageBody) File(java.io.File)

Example 5 with EvaluationFormPart

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);
}
Also used : EvaluationFormPart(org.olat.modules.portfolio.model.EvaluationFormPart) AssignmentImpl(org.olat.modules.portfolio.model.AssignmentImpl) RepositoryEntry(org.olat.repository.RepositoryEntry) PersistenceHelper.makeFuzzyQueryString(org.olat.core.commons.persistence.PersistenceHelper.makeFuzzyQueryString) File(java.io.File) Date(java.util.Date)

Aggregations

EvaluationFormPart (org.olat.modules.portfolio.model.EvaluationFormPart)6 File (java.io.File)4 EvaluationFormController (org.olat.modules.forms.ui.EvaluationFormController)4 Assignment (org.olat.modules.portfolio.Assignment)4 PageBody (org.olat.modules.portfolio.PageBody)4 PortfolioService (org.olat.modules.portfolio.PortfolioService)4 MultiEvaluationFormController (org.olat.modules.portfolio.ui.MultiEvaluationFormController)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 Date (java.util.Date)2 PersistenceHelper.makeFuzzyQueryString (org.olat.core.commons.persistence.PersistenceHelper.makeFuzzyQueryString)2 Controller (org.olat.core.gui.control.Controller)2 Translator (org.olat.core.gui.translator.Translator)2 AssignmentImpl (org.olat.modules.portfolio.model.AssignmentImpl)2 PortfolioHomeController (org.olat.modules.portfolio.ui.PortfolioHomeController)2 PageRunControllerElement (org.olat.modules.portfolio.ui.editor.PageRunControllerElement)2