Search in sources :

Example 11 with EfficiencyStatement

use of org.olat.course.assessment.EfficiencyStatement in project OpenOLAT by OpenOLAT.

the class EfficiencyStatementMediaHandler method getMediaController.

@Override
public Controller getMediaController(UserRequest ureq, WindowControl wControl, Media media, MediaRenderingHints hints) {
    String statementXml = media.getContent();
    EfficiencyStatement statement = null;
    if (StringHelper.containsNonWhitespace(statementXml)) {
        try {
            statement = (EfficiencyStatement) myXStream.fromXML(statementXml);
        } catch (Exception e) {
            log.error("Cannot load efficiency statement from artefact", e);
        }
    }
    CertificateAndEfficiencyStatementController ctrl = new CertificateAndEfficiencyStatementController(wControl, ureq, statement);
    ctrl.disableMediaCollector();
    return ctrl;
}
Also used : CertificateAndEfficiencyStatementController(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementController) EfficiencyStatement(org.olat.course.assessment.EfficiencyStatement)

Example 12 with EfficiencyStatement

use of org.olat.course.assessment.EfficiencyStatement in project OpenOLAT by OpenOLAT.

the class EfficiencyStatementArtefactHandler method createDetailsController.

@Override
public Controller createDetailsController(UserRequest ureq, WindowControl wControl, AbstractArtefact artefact, boolean readOnlyMode) {
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    String statementXml = ePFMgr.getArtefactFullTextContent(artefact);
    EfficiencyStatement statement = null;
    if (StringHelper.containsNonWhitespace(statementXml)) {
        try {
            statement = (EfficiencyStatement) myXStream.fromXML(statementXml);
        } catch (Exception e) {
            log.error("Cannot load efficiency statement from artefact", e);
        }
    }
    CertificateAndEfficiencyStatementController efficiencyCtrl = new CertificateAndEfficiencyStatementController(wControl, ureq, statement);
    return new LayoutMain3ColsController(ureq, wControl, efficiencyCtrl);
}
Also used : LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) CertificateAndEfficiencyStatementController(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementController) EfficiencyStatement(org.olat.course.assessment.EfficiencyStatement) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager)

Example 13 with EfficiencyStatement

use of org.olat.course.assessment.EfficiencyStatement in project OpenOLAT by OpenOLAT.

the class EfficiencyStatementArtefactHandler method getContent.

@Override
protected void getContent(AbstractArtefact artefact, StringBuilder sb, SearchResourceContext context, EPFrontendManager ePFManager) {
    String statementXml = ePFManager.getArtefactFullTextContent(artefact);
    if (!StringHelper.containsNonWhitespace(statementXml))
        return;
    try {
        EfficiencyStatement statement = (EfficiencyStatement) myXStream.fromXML(statementXml);
        sb.append(statement.getCourseTitle()).append(' ');
        sb.append(statement.getDisplayableUserInfo()).append(' ');
    } catch (Exception ex) {
        log.error("Error while parsing " + artefact, ex);
    }
}
Also used : EfficiencyStatement(org.olat.course.assessment.EfficiencyStatement)

Example 14 with EfficiencyStatement

use of org.olat.course.assessment.EfficiencyStatement in project OpenOLAT by OpenOLAT.

the class EfficiencyStatementManager method updateUserEfficiencyStatement.

public void updateUserEfficiencyStatement(Identity assessedIdentity, final CourseEnvironment courseEnv, List<AssessmentNodeData> assessmentNodeList, AssessmentNodesLastModified lastModifications, final RepositoryEntry repoEntry) {
    List<Map<String, Object>> assessmentNodes = AssessmentHelper.assessmentNodeDataListToMap(assessmentNodeList);
    EfficiencyStatement efficiencyStatement = new EfficiencyStatement();
    efficiencyStatement.setAssessmentNodes(assessmentNodes);
    efficiencyStatement.setCourseTitle(courseEnv.getCourseTitle());
    efficiencyStatement.setCourseRepoEntryKey(repoEntry.getKey());
    String userInfos = userManager.getUserDisplayName(assessedIdentity);
    efficiencyStatement.setDisplayableUserInfo(userInfos);
    efficiencyStatement.setLastUpdated(System.currentTimeMillis());
    if (lastModifications != null) {
        if (lastModifications.getLastUserModified() != null) {
            efficiencyStatement.setLastUserModified(lastModifications.getLastUserModified().getTime());
        }
        if (lastModifications.getLastCoachModified() != null) {
            efficiencyStatement.setLastCoachModified(lastModifications.getLastCoachModified().getTime());
        }
    }
    boolean debug = log.isDebug();
    UserEfficiencyStatementImpl efficiencyProperty = getUserEfficiencyStatementFull(repoEntry, assessedIdentity);
    if (assessmentNodes != null) {
        if (efficiencyProperty == null) {
            // create new
            efficiencyProperty = new UserEfficiencyStatementImpl();
            efficiencyProperty.setIdentity(assessedIdentity);
            efficiencyProperty.setCourseRepoKey(repoEntry.getKey());
            if (repoEntry != null) {
                efficiencyProperty.setResource(repoEntry.getOlatResource());
                efficiencyProperty.setCourseRepoKey(repoEntry.getKey());
            }
            efficiencyProperty.setShortTitle(courseEnv.getRunStructure().getRootNode().getShortTitle());
            efficiencyProperty.setTitle(courseEnv.getRunStructure().getRootNode().getLongTitle());
            fillEfficiencyStatement(efficiencyStatement, lastModifications, efficiencyProperty);
            dbInstance.getCurrentEntityManager().persist(efficiencyProperty);
            if (debug) {
                log.debug("creating new efficiency statement property::" + efficiencyProperty.getKey() + " for id::" + assessedIdentity.getName() + " repoEntry::" + repoEntry.getKey());
            }
        } else {
            // update existing
            if (debug) {
                log.debug("updating efficiency statement property::" + efficiencyProperty.getKey() + " for id::" + assessedIdentity.getName() + " repoEntry::" + repoEntry.getKey());
            }
            efficiencyProperty.setShortTitle(courseEnv.getRunStructure().getRootNode().getShortTitle());
            efficiencyProperty.setTitle(courseEnv.getRunStructure().getRootNode().getLongTitle());
            fillEfficiencyStatement(efficiencyStatement, lastModifications, efficiencyProperty);
            dbInstance.getCurrentEntityManager().merge(efficiencyProperty);
        }
    } else {
        if (efficiencyProperty != null) {
            // remove existing since now empty efficiency statements
            if (debug) {
                log.debug("removing efficiency statement property::" + efficiencyProperty.getKey() + " for id::" + assessedIdentity.getName() + " repoEntry::" + repoEntry.getKey() + " since empty");
            }
            dbInstance.getCurrentEntityManager().remove(efficiencyProperty);
        }
    // else nothing to create and nothing to delete
    }
    // send modified event to everybody
    AssessmentChangedEvent ace = new AssessmentChangedEvent(AssessmentChangedEvent.TYPE_EFFICIENCY_STATEMENT_CHANGED, assessedIdentity);
    OLATResourceable courseOres = OresHelper.createOLATResourceableInstance(CourseModule.class, courseEnv.getCourseResourceableId());
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(ace, courseOres);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentChangedEvent(org.olat.course.assessment.AssessmentChangedEvent) UserEfficiencyStatementImpl(org.olat.course.assessment.model.UserEfficiencyStatementImpl) Map(java.util.Map) EfficiencyStatement(org.olat.course.assessment.EfficiencyStatement) UserEfficiencyStatement(org.olat.course.assessment.UserEfficiencyStatement)

Example 15 with EfficiencyStatement

use of org.olat.course.assessment.EfficiencyStatement in project OpenOLAT by OpenOLAT.

the class UserDetailsController method doOpenEfficiencyStatementController.

private CertificateAndEfficiencyStatementController doOpenEfficiencyStatementController(UserRequest ureq) {
    if (statementCtrl == null || hasChanged) {
        removeAsListenerAndDispose(statementCtrl);
        RepositoryEntry entry = statementEntry.getCourse();
        UserEfficiencyStatement statement = statementEntry.getUserEfficencyStatement();
        EfficiencyStatement efficiencyStatement = null;
        if (statement != null) {
            RepositoryEntry re = statementEntry.getCourse();
            efficiencyStatement = efficiencyStatementManager.getUserEfficiencyStatementByCourseRepositoryEntry(re, assessedIdentity);
        }
        statementCtrl = new CertificateAndEfficiencyStatementController(getWindowControl(), ureq, assessedIdentity, null, entry.getOlatResource().getKey(), entry, efficiencyStatement, true);
        listenTo(statementCtrl);
        hasChanged = false;
    }
    mainVC.put("segmentCmp", statementCtrl.getInitialComponent());
    segmentView.select(efficiencyStatementLink);
    return statementCtrl;
}
Also used : UserEfficiencyStatement(org.olat.course.assessment.UserEfficiencyStatement) CertificateAndEfficiencyStatementController(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementController) RepositoryEntry(org.olat.repository.RepositoryEntry) EfficiencyStatement(org.olat.course.assessment.EfficiencyStatement) UserEfficiencyStatement(org.olat.course.assessment.UserEfficiencyStatement)

Aggregations

EfficiencyStatement (org.olat.course.assessment.EfficiencyStatement)26 UserEfficiencyStatement (org.olat.course.assessment.UserEfficiencyStatement)8 UserEfficiencyStatementImpl (org.olat.course.assessment.model.UserEfficiencyStatementImpl)6 CertificateAndEfficiencyStatementController (org.olat.course.certificate.ui.CertificateAndEfficiencyStatementController)6 CertificateAndEfficiencyStatement (org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement)6 RepositoryEntry (org.olat.repository.RepositoryEntry)6 Date (java.util.Date)4 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Consumes (javax.ws.rs.Consumes)2 PUT (javax.ws.rs.PUT)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 BaseSecurity (org.olat.basesecurity.BaseSecurity)2 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 Identity (org.olat.core.id.Identity)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 VFSContainer (org.olat.core.util.vfs.VFSContainer)2 AssessmentChangedEvent (org.olat.course.assessment.AssessmentChangedEvent)2