Search in sources :

Example 6 with EvaluationFormController

use of org.olat.modules.forms.ui.EvaluationFormController 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 7 with EvaluationFormController

use of org.olat.modules.forms.ui.EvaluationFormController in project OpenOLAT by OpenOLAT.

the class EvaluationFormHandler method getControllerForAssignment.

private Controller getControllerForAssignment(UserRequest ureq, WindowControl wControl, PageBody body, Assignment assignment, boolean onePage) {
    PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
    // find the evaluation form
    RepositoryEntry re = assignment.getFormEntry();
    Page page = assignment.getPage();
    PageStatus pageStatus = page.getPageStatus();
    Controller ctrl = null;
    List<AccessRights> accessRights = portfolioService.getAccessRights(page);
    boolean anonym = assignment.isAnonymousExternalEvaluation();
    if (pageStatus == null || pageStatus == PageStatus.draft) {
        if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
            ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, false, false);
        }
    } else if (assignment.isOnlyAutoEvaluation()) {
        // only the auto evaluation is shown
        if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
            boolean readOnly = (pageStatus == PageStatus.published) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted);
            ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, false);
        } else if (hasRole(PortfolioRoles.coach, ureq.getIdentity(), accessRights)) {
            Identity owner = getOwner(accessRights);
            ctrl = new EvaluationFormController(ureq, wControl, owner, body, re, true, false);
        } else if (hasRole(PortfolioRoles.reviewer, ureq.getIdentity(), accessRights) || hasRole(PortfolioRoles.invitee, ureq.getIdentity(), accessRights)) {
            if (assignment.isReviewerSeeAutoEvaluation()) {
                Identity owner = getOwner(accessRights);
                ctrl = new EvaluationFormController(ureq, wControl, owner, body, re, true, false);
            }
        }
    } else {
        if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
            boolean readOnly = (pageStatus == PageStatus.published) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
            Identity owner = getOwner(accessRights);
            List<Identity> coachesAndReviewers = getCoachesAndReviewers(accessRights);
            if (coachesAndReviewers.size() > 0) {
                ctrl = new MultiEvaluationFormController(ureq, wControl, owner, coachesAndReviewers, body, re, false, readOnly, onePage, anonym);
            } else {
                ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, false);
            }
        } else if (hasRole(PortfolioRoles.coach, ureq.getIdentity(), accessRights)) {
            Identity owner = getOwner(accessRights);
            List<Identity> coachesAndReviewers = getCoachesAndReviewers(accessRights);
            boolean readOnly = (pageStatus == PageStatus.draft) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
            ctrl = new MultiEvaluationFormController(ureq, wControl, owner, coachesAndReviewers, body, re, false, readOnly, onePage, anonym);
        } else if (hasRole(PortfolioRoles.reviewer, ureq.getIdentity(), accessRights) || hasRole(PortfolioRoles.invitee, ureq.getIdentity(), accessRights)) {
            boolean readOnly = (pageStatus == PageStatus.draft) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
            if (assignment.isReviewerSeeAutoEvaluation()) {
                Identity owner = getOwner(accessRights);
                List<Identity> reviewers = Collections.singletonList(ureq.getIdentity());
                ctrl = new MultiEvaluationFormController(ureq, wControl, owner, reviewers, body, re, true, readOnly, onePage, anonym);
            } else {
                ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, !readOnly);
            }
        }
    }
    return ctrl;
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) Page(org.olat.modules.portfolio.Page) RepositoryEntry(org.olat.repository.RepositoryEntry) 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) AccessRights(org.olat.modules.portfolio.model.AccessRights) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController) PortfolioService(org.olat.modules.portfolio.PortfolioService) ArrayList(java.util.ArrayList) List(java.util.List) Identity(org.olat.core.id.Identity)

Example 8 with EvaluationFormController

use of org.olat.modules.forms.ui.EvaluationFormController in project openolat by klemens.

the class MultiEvaluationFormController method createEvalutationForm.

private Controller createEvalutationForm(UserRequest ureq, Identity evaluator) {
    boolean ro = readOnly || !evaluator.equals(getIdentity());
    boolean doneButton = !ro && evaluator.equals(getIdentity()) && (owner == null || !owner.equals(evaluator));
    EvaluationFormController evalutionFormCtrl = new EvaluationFormController(ureq, getWindowControl(), evaluator, anchor, formEntry, ro, doneButton);
    listenTo(evalutionFormCtrl);
    return evalutionFormCtrl;
}
Also used : EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController)

Example 9 with EvaluationFormController

use of org.olat.modules.forms.ui.EvaluationFormController in project openolat by klemens.

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 10 with EvaluationFormController

use of org.olat.modules.forms.ui.EvaluationFormController in project openolat by klemens.

the class EvaluationFormHandler method getControllerForAssignment.

private Controller getControllerForAssignment(UserRequest ureq, WindowControl wControl, PageBody body, Assignment assignment, boolean onePage) {
    PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
    // find the evaluation form
    RepositoryEntry re = assignment.getFormEntry();
    Page page = assignment.getPage();
    PageStatus pageStatus = page.getPageStatus();
    Controller ctrl = null;
    List<AccessRights> accessRights = portfolioService.getAccessRights(page);
    boolean anonym = assignment.isAnonymousExternalEvaluation();
    if (pageStatus == null || pageStatus == PageStatus.draft) {
        if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
            ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, false, false);
        }
    } else if (assignment.isOnlyAutoEvaluation()) {
        // only the auto evaluation is shown
        if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
            boolean readOnly = (pageStatus == PageStatus.published) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted);
            ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, false);
        } else if (hasRole(PortfolioRoles.coach, ureq.getIdentity(), accessRights)) {
            Identity owner = getOwner(accessRights);
            ctrl = new EvaluationFormController(ureq, wControl, owner, body, re, true, false);
        } else if (hasRole(PortfolioRoles.reviewer, ureq.getIdentity(), accessRights) || hasRole(PortfolioRoles.invitee, ureq.getIdentity(), accessRights)) {
            if (assignment.isReviewerSeeAutoEvaluation()) {
                Identity owner = getOwner(accessRights);
                ctrl = new EvaluationFormController(ureq, wControl, owner, body, re, true, false);
            }
        }
    } else {
        if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
            boolean readOnly = (pageStatus == PageStatus.published) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
            Identity owner = getOwner(accessRights);
            List<Identity> coachesAndReviewers = getCoachesAndReviewers(accessRights);
            if (coachesAndReviewers.size() > 0) {
                ctrl = new MultiEvaluationFormController(ureq, wControl, owner, coachesAndReviewers, body, re, false, readOnly, onePage, anonym);
            } else {
                ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, false);
            }
        } else if (hasRole(PortfolioRoles.coach, ureq.getIdentity(), accessRights)) {
            Identity owner = getOwner(accessRights);
            List<Identity> coachesAndReviewers = getCoachesAndReviewers(accessRights);
            boolean readOnly = (pageStatus == PageStatus.draft) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
            ctrl = new MultiEvaluationFormController(ureq, wControl, owner, coachesAndReviewers, body, re, false, readOnly, onePage, anonym);
        } else if (hasRole(PortfolioRoles.reviewer, ureq.getIdentity(), accessRights) || hasRole(PortfolioRoles.invitee, ureq.getIdentity(), accessRights)) {
            boolean readOnly = (pageStatus == PageStatus.draft) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
            if (assignment.isReviewerSeeAutoEvaluation()) {
                Identity owner = getOwner(accessRights);
                List<Identity> reviewers = Collections.singletonList(ureq.getIdentity());
                ctrl = new MultiEvaluationFormController(ureq, wControl, owner, reviewers, body, re, true, readOnly, onePage, anonym);
            } else {
                ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, !readOnly);
            }
        }
    }
    return ctrl;
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) Page(org.olat.modules.portfolio.Page) RepositoryEntry(org.olat.repository.RepositoryEntry) 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) AccessRights(org.olat.modules.portfolio.model.AccessRights) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController) PortfolioService(org.olat.modules.portfolio.PortfolioService) ArrayList(java.util.ArrayList) List(java.util.List) Identity(org.olat.core.id.Identity)

Aggregations

EvaluationFormController (org.olat.modules.forms.ui.EvaluationFormController)10 PortfolioService (org.olat.modules.portfolio.PortfolioService)6 MultiEvaluationFormController (org.olat.modules.portfolio.ui.MultiEvaluationFormController)6 Controller (org.olat.core.gui.control.Controller)4 Identity (org.olat.core.id.Identity)4 Page (org.olat.modules.portfolio.Page)4 AccessRights (org.olat.modules.portfolio.model.AccessRights)4 PortfolioHomeController (org.olat.modules.portfolio.ui.PortfolioHomeController)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 File (java.io.File)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Assignment (org.olat.modules.portfolio.Assignment)2 PageBody (org.olat.modules.portfolio.PageBody)2 PageStatus (org.olat.modules.portfolio.PageStatus)2 EvaluationFormPart (org.olat.modules.portfolio.model.EvaluationFormPart)2