use of org.olat.modules.forms.ui.model.Evaluator in project OpenOLAT by OpenOLAT.
the class MultiEvaluationFormController method initSegmentView.
private void initSegmentView(UserRequest ureq, List<Identity> otherEvaluators, boolean anonym) {
mainVC = createVelocityContainer("multi_evaluation_form");
segmentView = SegmentViewFactory.createSegmentView("segments", mainVC, this);
boolean viewOthers = isViewOthers();
if (owner != null) {
String ownerFullname = userManager.getUserDisplayName(owner);
evaluators.add(new Evaluator(owner, ownerFullname));
String id = "eva-" + (count++);
ownerLink = LinkFactory.createCustomLink(id, id, ownerFullname, Link.BUTTON | Link.NONTRANSLATED, mainVC, this);
ownerLink.setUserObject(owner);
boolean me = owner.equals(ureq.getIdentity());
segmentView.addSegment(ownerLink, me);
if (me) {
doOpenEvalutationForm(ureq, owner);
}
}
if (otherEvaluators != null && otherEvaluators.size() > 0) {
int countEva = 1;
for (Identity evaluator : otherEvaluators) {
boolean me = evaluator.equals(ureq.getIdentity());
String evaluatorFullname;
if (!me && anonym) {
evaluatorFullname = translate("anonym.evaluator", new String[] { Integer.toString(countEva++) });
} else {
evaluatorFullname = userManager.getUserDisplayName(evaluator);
}
evaluators.add(new Evaluator(evaluator, evaluatorFullname));
String id = "eva-" + (count++);
Link evaluatorLink = LinkFactory.createCustomLink(id, id, evaluatorFullname, Link.BUTTON | Link.NONTRANSLATED, mainVC, this);
evaluatorLink.setUserObject(evaluator);
otherEvaluatorLinks.add(evaluatorLink);
segmentView.addSegment(evaluatorLink, me);
if (me) {
doOpenEvalutationForm(ureq, evaluator);
}
}
}
if ((owner != null && otherEvaluators != null && otherEvaluators.size() > 0) || (otherEvaluators != null && otherEvaluators.size() > 1)) {
compareLink = LinkFactory.createLink("compare.evaluations", mainVC, this);
compareLink.setUserObject(owner);
segmentView.addSegment(compareLink, false);
}
segmentView.setVisible(viewOthers);
mainVC.put("segments", segmentView);
}
use of org.olat.modules.forms.ui.model.Evaluator in project OpenOLAT by OpenOLAT.
the class MultiEvaluationFormController method initOnePageView.
private void initOnePageView(UserRequest ureq, List<Identity> otherEvaluators, boolean anonym) {
mainVC = createVelocityContainer("multi_evaluation_one_page");
List<EvaluatorPanel> panels = new ArrayList<>();
mainVC.contextPut("panels", panels);
boolean viewOthers = isViewOthers();
if (owner != null) {
String ownerFullname = userManager.getUserDisplayName(owner);
Evaluator evaluator = new Evaluator(owner, ownerFullname);
evaluators.add(evaluator);
boolean me = owner.equals(getIdentity());
if (me || viewOthers) {
Controller ctrl = createEvalutationForm(ureq, owner);
String componentName = "panel_" + (++count);
panels.add(new EvaluatorPanel(evaluator, componentName, ctrl.getInitialComponent()));
mainVC.put(componentName, ctrl.getInitialComponent());
}
}
if (otherEvaluators != null && otherEvaluators.size() > 0) {
int countEva = 1;
for (Identity evaluator : otherEvaluators) {
boolean me = evaluator.equals(ureq.getIdentity());
String evaluatorFullname;
if (!me && anonym) {
evaluatorFullname = translate("anonym.evaluator", new String[] { Integer.toString(countEva++) });
} else {
evaluatorFullname = userManager.getUserDisplayName(evaluator);
}
Evaluator eval = new Evaluator(evaluator, evaluatorFullname);
evaluators.add(eval);
if (me || viewOthers) {
Controller ctrl = createEvalutationForm(ureq, evaluator);
String componentName = "panel_" + (++count);
panels.add(new EvaluatorPanel(eval, componentName, ctrl.getInitialComponent()));
mainVC.put(componentName, ctrl.getInitialComponent());
}
}
}
if (viewOthers && (owner != null && otherEvaluators != null && otherEvaluators.size() > 0) || (otherEvaluators != null && otherEvaluators.size() > 1)) {
removeAsListenerAndDispose(compareEvaluationCtrl);
CompareEvaluationsFormController ctrl = new CompareEvaluationsFormController(ureq, getWindowControl(), evaluators, anchor, formEntry);
listenTo(ctrl);
Evaluator eval = new Evaluator(null, translate("compare.evaluations"));
String componentName = "panel_" + (++count);
panels.add(new EvaluatorPanel(eval, componentName, ctrl.getInitialComponent()));
mainVC.put(componentName, ctrl.getInitialComponent());
}
}
use of org.olat.modules.forms.ui.model.Evaluator in project OpenOLAT by OpenOLAT.
the class CompareEvaluationsFormController method loadResponses.
private void loadResponses() {
flc.contextPut("messageNotDone", Boolean.FALSE);
List<Identity> evaluatorIdentities = evaluators.stream().map(evaluator -> evaluator.getIdentity()).collect(Collectors.toList());
List<EvaluationFormResponse> responses = evaluationFormManager.getResponsesFromPortfolioEvaluation(evaluatorIdentities, anchor, EvaluationFormSessionStatus.done);
for (EvaluationFormResponse response : responses) {
List<EvaluationFormResponse> responseList = identifierToResponses.get(response.getResponseIdentifier());
if (responseList == null) {
responseList = new ArrayList<>();
identifierToResponses.put(response.getResponseIdentifier(), responseList);
}
responseList.add(response);
}
}
use of org.olat.modules.forms.ui.model.Evaluator in project openolat by klemens.
the class CompareEvaluationsFormController method loadResponses.
private void loadResponses() {
flc.contextPut("messageNotDone", Boolean.FALSE);
List<Identity> evaluatorIdentities = evaluators.stream().map(evaluator -> evaluator.getIdentity()).collect(Collectors.toList());
List<EvaluationFormResponse> responses = evaluationFormManager.getResponsesFromPortfolioEvaluation(evaluatorIdentities, anchor, EvaluationFormSessionStatus.done);
for (EvaluationFormResponse response : responses) {
List<EvaluationFormResponse> responseList = identifierToResponses.get(response.getResponseIdentifier());
if (responseList == null) {
responseList = new ArrayList<>();
identifierToResponses.put(response.getResponseIdentifier(), responseList);
}
responseList.add(response);
}
}
use of org.olat.modules.forms.ui.model.Evaluator in project openolat by klemens.
the class MultiEvaluationFormController method initOnePageView.
private void initOnePageView(UserRequest ureq, List<Identity> otherEvaluators, boolean anonym) {
mainVC = createVelocityContainer("multi_evaluation_one_page");
List<EvaluatorPanel> panels = new ArrayList<>();
mainVC.contextPut("panels", panels);
boolean viewOthers = isViewOthers();
if (owner != null) {
String ownerFullname = userManager.getUserDisplayName(owner);
Evaluator evaluator = new Evaluator(owner, ownerFullname);
evaluators.add(evaluator);
boolean me = owner.equals(getIdentity());
if (me || viewOthers) {
Controller ctrl = createEvalutationForm(ureq, owner);
String componentName = "panel_" + (++count);
panels.add(new EvaluatorPanel(evaluator, componentName, ctrl.getInitialComponent()));
mainVC.put(componentName, ctrl.getInitialComponent());
}
}
if (otherEvaluators != null && otherEvaluators.size() > 0) {
int countEva = 1;
for (Identity evaluator : otherEvaluators) {
boolean me = evaluator.equals(ureq.getIdentity());
String evaluatorFullname;
if (!me && anonym) {
evaluatorFullname = translate("anonym.evaluator", new String[] { Integer.toString(countEva++) });
} else {
evaluatorFullname = userManager.getUserDisplayName(evaluator);
}
Evaluator eval = new Evaluator(evaluator, evaluatorFullname);
evaluators.add(eval);
if (me || viewOthers) {
Controller ctrl = createEvalutationForm(ureq, evaluator);
String componentName = "panel_" + (++count);
panels.add(new EvaluatorPanel(eval, componentName, ctrl.getInitialComponent()));
mainVC.put(componentName, ctrl.getInitialComponent());
}
}
}
if (viewOthers && (owner != null && otherEvaluators != null && otherEvaluators.size() > 0) || (otherEvaluators != null && otherEvaluators.size() > 1)) {
removeAsListenerAndDispose(compareEvaluationCtrl);
CompareEvaluationsFormController ctrl = new CompareEvaluationsFormController(ureq, getWindowControl(), evaluators, anchor, formEntry);
listenTo(ctrl);
Evaluator eval = new Evaluator(null, translate("compare.evaluations"));
String componentName = "panel_" + (++count);
panels.add(new EvaluatorPanel(eval, componentName, ctrl.getInitialComponent()));
mainVC.put(componentName, ctrl.getInitialComponent());
}
}
Aggregations