Search in sources :

Example 1 with Evaluator

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);
}
Also used : Evaluator(org.olat.modules.forms.ui.model.Evaluator) Identity(org.olat.core.id.Identity) Link(org.olat.core.gui.components.link.Link)

Example 2 with Evaluator

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());
    }
}
Also used : CompareEvaluationsFormController(org.olat.modules.forms.ui.CompareEvaluationsFormController) ArrayList(java.util.ArrayList) Evaluator(org.olat.modules.forms.ui.model.Evaluator) CompareEvaluationsFormController(org.olat.modules.forms.ui.CompareEvaluationsFormController) Controller(org.olat.core.gui.control.Controller) EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController) BasicController(org.olat.core.gui.control.controller.BasicController) Identity(org.olat.core.id.Identity)

Example 3 with Evaluator

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);
    }
}
Also used : EvaluationFormSessionStatus(org.olat.modules.forms.EvaluationFormSessionStatus) EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper) Autowired(org.springframework.beans.factory.annotation.Autowired) TextInput(org.olat.modules.forms.model.xml.TextInput) Map(java.util.Map) EvaluationFormManager(org.olat.modules.forms.EvaluationFormManager) VFSLeaf(org.olat.core.util.vfs.VFSLeaf) Rubric(org.olat.modules.forms.model.xml.Rubric) AbstractElement(org.olat.modules.forms.model.xml.AbstractElement) Slider(org.olat.modules.forms.model.xml.Slider) RadarChartElement(org.olat.core.gui.components.chart.RadarChartElement) FORM_XML_FILE(org.olat.modules.forms.handler.EvaluationFormResource.FORM_XML_FILE) WindowControl(org.olat.core.gui.control.WindowControl) FileUploadCompareWrapper(org.olat.modules.forms.ui.model.FileUploadCompareWrapper) Collectors(java.util.stream.Collectors) List(java.util.List) Identity(org.olat.core.id.Identity) Format(org.olat.core.gui.components.chart.RadarChartComponent.Format) TextInputWrapper(org.olat.modules.forms.ui.model.TextInputWrapper) SliderType(org.olat.modules.forms.model.xml.Rubric.SliderType) VFSMediaMapper(org.olat.core.util.vfs.VFSMediaMapper) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) PageBody(org.olat.modules.portfolio.PageBody) HashMap(java.util.HashMap) FileResourceManager(org.olat.fileresource.FileResourceManager) RepositoryEntry(org.olat.repository.RepositoryEntry) Form(org.olat.modules.forms.model.xml.Form) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) MetaInfo(org.olat.core.commons.modules.bc.meta.MetaInfo) StringHelper(org.olat.core.util.StringHelper) MetaTagged(org.olat.core.commons.modules.bc.meta.tagged.MetaTagged) Formatter(org.olat.core.util.Formatter) RadarSeries(org.olat.core.gui.components.chart.RadarSeries) SliderOverviewElement(org.olat.modules.forms.ui.component.SliderOverviewElement) Evaluator(org.olat.modules.forms.ui.model.Evaluator) SliderWrapper(org.olat.modules.forms.ui.model.SliderWrapper) Controller(org.olat.core.gui.control.Controller) File(java.io.File) SliderPoint(org.olat.modules.forms.ui.component.SliderPoint) EvaluationFormSession(org.olat.modules.forms.EvaluationFormSession) EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse) CSSHelper(org.olat.core.gui.util.CSSHelper) FormXStream(org.olat.modules.forms.model.xml.FormXStream) UserRequest(org.olat.core.gui.UserRequest) XStreamHelper(org.olat.core.util.xml.XStreamHelper) FileUpload(org.olat.modules.forms.model.xml.FileUpload) Identity(org.olat.core.id.Identity) EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse)

Example 4 with Evaluator

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);
    }
}
Also used : EvaluationFormSessionStatus(org.olat.modules.forms.EvaluationFormSessionStatus) EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper) Autowired(org.springframework.beans.factory.annotation.Autowired) TextInput(org.olat.modules.forms.model.xml.TextInput) Map(java.util.Map) EvaluationFormManager(org.olat.modules.forms.EvaluationFormManager) VFSLeaf(org.olat.core.util.vfs.VFSLeaf) Rubric(org.olat.modules.forms.model.xml.Rubric) AbstractElement(org.olat.modules.forms.model.xml.AbstractElement) Slider(org.olat.modules.forms.model.xml.Slider) RadarChartElement(org.olat.core.gui.components.chart.RadarChartElement) FORM_XML_FILE(org.olat.modules.forms.handler.EvaluationFormResource.FORM_XML_FILE) WindowControl(org.olat.core.gui.control.WindowControl) FileUploadCompareWrapper(org.olat.modules.forms.ui.model.FileUploadCompareWrapper) Collectors(java.util.stream.Collectors) List(java.util.List) Identity(org.olat.core.id.Identity) Format(org.olat.core.gui.components.chart.RadarChartComponent.Format) TextInputWrapper(org.olat.modules.forms.ui.model.TextInputWrapper) SliderType(org.olat.modules.forms.model.xml.Rubric.SliderType) VFSMediaMapper(org.olat.core.util.vfs.VFSMediaMapper) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) PageBody(org.olat.modules.portfolio.PageBody) HashMap(java.util.HashMap) FileResourceManager(org.olat.fileresource.FileResourceManager) RepositoryEntry(org.olat.repository.RepositoryEntry) Form(org.olat.modules.forms.model.xml.Form) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) MetaInfo(org.olat.core.commons.modules.bc.meta.MetaInfo) StringHelper(org.olat.core.util.StringHelper) MetaTagged(org.olat.core.commons.modules.bc.meta.tagged.MetaTagged) Formatter(org.olat.core.util.Formatter) RadarSeries(org.olat.core.gui.components.chart.RadarSeries) SliderOverviewElement(org.olat.modules.forms.ui.component.SliderOverviewElement) Evaluator(org.olat.modules.forms.ui.model.Evaluator) SliderWrapper(org.olat.modules.forms.ui.model.SliderWrapper) Controller(org.olat.core.gui.control.Controller) File(java.io.File) SliderPoint(org.olat.modules.forms.ui.component.SliderPoint) EvaluationFormSession(org.olat.modules.forms.EvaluationFormSession) EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse) CSSHelper(org.olat.core.gui.util.CSSHelper) FormXStream(org.olat.modules.forms.model.xml.FormXStream) UserRequest(org.olat.core.gui.UserRequest) XStreamHelper(org.olat.core.util.xml.XStreamHelper) FileUpload(org.olat.modules.forms.model.xml.FileUpload) Identity(org.olat.core.id.Identity) EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse)

Example 5 with Evaluator

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());
    }
}
Also used : CompareEvaluationsFormController(org.olat.modules.forms.ui.CompareEvaluationsFormController) ArrayList(java.util.ArrayList) Evaluator(org.olat.modules.forms.ui.model.Evaluator) CompareEvaluationsFormController(org.olat.modules.forms.ui.CompareEvaluationsFormController) Controller(org.olat.core.gui.control.Controller) EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController) BasicController(org.olat.core.gui.control.controller.BasicController) Identity(org.olat.core.id.Identity)

Aggregations

Identity (org.olat.core.id.Identity)6 Evaluator (org.olat.modules.forms.ui.model.Evaluator)6 ArrayList (java.util.ArrayList)4 Controller (org.olat.core.gui.control.Controller)4 File (java.io.File)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Collectors (java.util.stream.Collectors)2 MetaInfo (org.olat.core.commons.modules.bc.meta.MetaInfo)2 MetaTagged (org.olat.core.commons.modules.bc.meta.tagged.MetaTagged)2 UserRequest (org.olat.core.gui.UserRequest)2 Format (org.olat.core.gui.components.chart.RadarChartComponent.Format)2 RadarChartElement (org.olat.core.gui.components.chart.RadarChartElement)2 RadarSeries (org.olat.core.gui.components.chart.RadarSeries)2 FormItem (org.olat.core.gui.components.form.flexible.FormItem)2 FormItemContainer (org.olat.core.gui.components.form.flexible.FormItemContainer)2 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)2 FormEvent (org.olat.core.gui.components.form.flexible.impl.FormEvent)2 WindowControl (org.olat.core.gui.control.WindowControl)2