use of org.olat.modules.portfolio.ui.MultiEvaluationFormController 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;
}
use of org.olat.modules.portfolio.ui.MultiEvaluationFormController 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;
}
Aggregations