Search in sources :

Example 31 with EfficiencyStatementEntry

use of org.olat.modules.coach.model.EfficiencyStatementEntry in project OpenOLAT by OpenOLAT.

the class CoachingServiceImpl method getGroup.

@Override
public List<EfficiencyStatementEntry> getGroup(BusinessGroup group, List<UserPropertyHandler> userPropertyHandlers, Locale locale) {
    List<Identity> students = businessGroupService.getMembers(group, GroupRoles.participant.name());
    List<RepositoryEntry> courses = businessGroupService.findRepositoryEntries(Collections.singletonList(group), 0, -1);
    List<UserEfficiencyStatement> statements = efficiencyStatementManager.getUserEfficiencyStatementLight(courses);
    Map<IdentityRepositoryEntryKey, UserEfficiencyStatement> identityToStatements = new HashMap<>();
    for (UserEfficiencyStatement statement : statements) {
        IdentityRepositoryEntryKey key = new IdentityRepositoryEntryKey(statement.getIdentity().getKey(), statement.getCourseRepoKey());
        identityToStatements.put(key, statement);
    }
    List<EfficiencyStatementEntry> entries = new ArrayList<>(students.size() * courses.size());
    for (RepositoryEntry course : courses) {
        for (Identity student : students) {
            IdentityRepositoryEntryKey key = new IdentityRepositoryEntryKey(student.getKey(), course.getKey());
            UserEfficiencyStatement statement = identityToStatements.get(key);
            entries.add(new EfficiencyStatementEntry(student, course, statement, userPropertyHandlers, locale));
        }
    }
    return entries;
}
Also used : HashMap(java.util.HashMap) UserEfficiencyStatement(org.olat.course.assessment.UserEfficiencyStatement) ArrayList(java.util.ArrayList) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) EfficiencyStatementEntry(org.olat.modules.coach.model.EfficiencyStatementEntry)

Example 32 with EfficiencyStatementEntry

use of org.olat.modules.coach.model.EfficiencyStatementEntry in project openolat by klemens.

the class StudentCoursesController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (tableEl == source) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            EfficiencyStatementEntry selectedRow = model.getObject(se.getIndex());
            if ("select".equals(cmd)) {
                selectDetails(ureq, selectedRow);
            }
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) EfficiencyStatementEntry(org.olat.modules.coach.model.EfficiencyStatementEntry)

Example 33 with EfficiencyStatementEntry

use of org.olat.modules.coach.model.EfficiencyStatementEntry in project openolat by klemens.

the class StudentCoursesController method nextEntry.

private void nextEntry(UserRequest ureq) {
    EfficiencyStatementEntry currentEntry = statementCtrl.getEntry();
    int nextIndex = model.getObjects().indexOf(currentEntry) + 1;
    if (nextIndex < 0 || nextIndex >= model.getRowCount()) {
        nextIndex = 0;
    }
    EfficiencyStatementEntry nextEntry = model.getObject(nextIndex);
    selectDetails(ureq, nextEntry);
}
Also used : EfficiencyStatementEntry(org.olat.modules.coach.model.EfficiencyStatementEntry)

Example 34 with EfficiencyStatementEntry

use of org.olat.modules.coach.model.EfficiencyStatementEntry in project openolat by klemens.

the class StudentCoursesController method previousEntry.

private void previousEntry(UserRequest ureq) {
    EfficiencyStatementEntry currentEntry = statementCtrl.getEntry();
    int previousIndex = model.getObjects().indexOf(currentEntry) - 1;
    if (previousIndex < 0 || previousIndex >= model.getRowCount()) {
        previousIndex = model.getRowCount() - 1;
    }
    EfficiencyStatementEntry previousEntry = model.getObject(previousIndex);
    selectDetails(ureq, previousEntry);
}
Also used : EfficiencyStatementEntry(org.olat.modules.coach.model.EfficiencyStatementEntry)

Example 35 with EfficiencyStatementEntry

use of org.olat.modules.coach.model.EfficiencyStatementEntry in project openolat by klemens.

the class StudentCoursesController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    ContextEntry ce = entries.get(0);
    OLATResourceable ores = ce.getOLATResourceable();
    if ("RepositoryEntry".equals(ores.getResourceableTypeName())) {
        Long entryKey = ores.getResourceableId();
        for (EfficiencyStatementEntry entry : model.getObjects()) {
            if (entryKey.equals(entry.getCourse().getKey())) {
                selectDetails(ureq, entry);
                statementCtrl.activate(ureq, entries.subList(1, entries.size()), ce.getTransientState());
                break;
            }
        }
    }
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) EfficiencyStatementEntry(org.olat.modules.coach.model.EfficiencyStatementEntry) ContextEntry(org.olat.core.id.context.ContextEntry)

Aggregations

EfficiencyStatementEntry (org.olat.modules.coach.model.EfficiencyStatementEntry)40 RepositoryEntry (org.olat.repository.RepositoryEntry)8 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)6 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)6 Identity (org.olat.core.id.Identity)6 OLATResourceable (org.olat.core.id.OLATResourceable)6 ContextEntry (org.olat.core.id.context.ContextEntry)6 UserEfficiencyStatement (org.olat.course.assessment.UserEfficiencyStatement)6 CertificateLight (org.olat.course.certificate.CertificateLight)6 IdentityResourceKey (org.olat.modules.coach.model.IdentityResourceKey)6 Test (org.junit.Test)2 IdentityRepositoryEntryKey (org.olat.modules.coach.model.IdentityRepositoryEntryKey)2 LectureBlockStatistics (org.olat.modules.lecture.model.LectureBlockStatistics)2