Search in sources :

Example 31 with Binder

use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.

the class SharedBindersController method doSelectBinder.

private BinderController doSelectBinder(UserRequest ureq, SharedItemRow row) {
    Binder binder = portfolioService.getBinderByKey(row.getBinderKey());
    if (binder == null) {
        showWarning("warning.portfolio.not.found");
        return null;
    } else {
        removeAsListenerAndDispose(binderCtrl);
        portfolioService.updateBinderUserInformations(binder, getIdentity());
        row.setRecentLaunch(new Date());
        OLATResourceable binderOres = OresHelper.createOLATResourceableInstance("Binder", binder.getKey());
        WindowControl swControl = addToHistory(ureq, binderOres, null);
        List<AccessRights> rights = portfolioService.getAccessRights(binder, getIdentity());
        BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForCoach(binder, rights);
        BinderConfiguration config = BinderConfiguration.createConfig(binder);
        binderCtrl = new BinderController(ureq, swControl, stackPanel, secCallback, binder, config);
        String displayName = StringHelper.escapeHtml(binder.getTitle());
        stackPanel.pushController(displayName, binderCtrl);
        return binderCtrl;
    }
}
Also used : AccessRights(org.olat.modules.portfolio.model.AccessRights) AssessedBinder(org.olat.modules.portfolio.model.AssessedBinder) Binder(org.olat.modules.portfolio.Binder) OLATResourceable(org.olat.core.id.OLATResourceable) BinderController(org.olat.modules.portfolio.ui.BinderController) BinderSecurityCallback(org.olat.modules.portfolio.BinderSecurityCallback) WindowControl(org.olat.core.gui.control.WindowControl) Date(java.util.Date) BinderConfiguration(org.olat.modules.portfolio.BinderConfiguration)

Example 32 with Binder

use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.

the class SharedBindersController method doLeaveBinder.

private void doLeaveBinder(SharedItemRow row) {
    Binder binder = portfolioService.getBinderByKey(row.getBinderKey());
    portfolioService.removeAccessRights(binder, getIdentity());
    loadModel(tableEl.getQuickSearchString());
}
Also used : AssessedBinder(org.olat.modules.portfolio.model.AssessedBinder) Binder(org.olat.modules.portfolio.Binder)

Example 33 with Binder

use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.

the class AssignmentDAOTest method createBinderWithAssignment.

@Test
public void createBinderWithAssignment() {
    Identity owner = JunitTestHelper.createAndPersistIdentityAsRndUser("assign-1");
    Binder binder = portfolioService.createNewBinder("Assignment binder 1", "Difficult!", null, owner);
    dbInstance.commit();
    portfolioService.appendNewSection("Section", "Assignment section", null, null, binder);
    dbInstance.commit();
    // create assignment
    List<Section> sections = portfolioService.getSections(binder);
    Assignment assignment = assignmentDao.createAssignment("Difficult", "Very difficult", "The difficult content", null, AssignmentType.essay, AssignmentStatus.template, sections.get(0), false, false, false, null);
    dbInstance.commitAndCloseSession();
    Assert.assertNotNull(assignment);
    Assert.assertNotNull(assignment.getKey());
    Assert.assertNotNull(assignment.getCreationDate());
    Assert.assertNotNull(assignment.getLastModified());
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) Binder(org.olat.modules.portfolio.Binder) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Example 34 with Binder

use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.

the class AssignmentDAOTest method loadAssignments_binder.

@Test
public void loadAssignments_binder() {
    Identity owner = JunitTestHelper.createAndPersistIdentityAsRndUser("assign-2");
    Binder binder = portfolioService.createNewBinder("Assignment binder 2", "Difficult!", null, owner);
    dbInstance.commit();
    portfolioService.appendNewSection("Section", "Assignment section", null, null, binder);
    dbInstance.commit();
    // create assignment
    List<Section> sections = portfolioService.getSections(binder);
    Assignment assignment = assignmentDao.createAssignment("Load assignment", "Load by binder", "The difficult content", null, AssignmentType.essay, AssignmentStatus.template, sections.get(0), false, false, false, null);
    dbInstance.commitAndCloseSession();
    // load the assignment
    List<Assignment> assignments = assignmentDao.loadAssignments(binder, null);
    Assert.assertNotNull(assignments);
    Assert.assertEquals(1, assignments.size());
    Assert.assertEquals(assignment, assignments.get(0));
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) Binder(org.olat.modules.portfolio.Binder) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Example 35 with Binder

use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.

the class AssignmentDAOTest method loadAssignments_binder_search.

@Test
public void loadAssignments_binder_search() {
    Identity owner = JunitTestHelper.createAndPersistIdentityAsRndUser("assign-3");
    Binder binder = portfolioService.createNewBinder("Assignment binder 3", "Difficult!", null, owner);
    dbInstance.commit();
    portfolioService.appendNewSection("Section", "Assignment section", null, null, binder);
    dbInstance.commit();
    // create assignment
    List<Section> sections = portfolioService.getSections(binder);
    Assignment assignment = assignmentDao.createAssignment("Load assignment", "Load by binder", "The content unkown search", null, AssignmentType.essay, AssignmentStatus.template, sections.get(0), false, false, false, null);
    dbInstance.commitAndCloseSession();
    // search the assignment
    List<Assignment> assignments = assignmentDao.loadAssignments(binder, "unkown");
    Assert.assertNotNull(assignments);
    Assert.assertEquals(1, assignments.size());
    Assert.assertEquals(assignment, assignments.get(0));
    // dummy search
    List<Assignment> emptyAssignments = assignmentDao.loadAssignments(binder, "sdhfks");
    Assert.assertNotNull(emptyAssignments);
    Assert.assertEquals(0, emptyAssignments.size());
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) Binder(org.olat.modules.portfolio.Binder) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Aggregations

Binder (org.olat.modules.portfolio.Binder)144 Section (org.olat.modules.portfolio.Section)72 Identity (org.olat.core.id.Identity)70 Test (org.junit.Test)68 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)58 Page (org.olat.modules.portfolio.Page)44 RepositoryEntry (org.olat.repository.RepositoryEntry)34 Assignment (org.olat.modules.portfolio.Assignment)30 ArrayList (java.util.ArrayList)22 SectionRef (org.olat.modules.portfolio.SectionRef)22 AssessedBinder (org.olat.modules.portfolio.model.AssessedBinder)20 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)16 OLATResourceable (org.olat.core.id.OLATResourceable)14 BinderSecurityCallback (org.olat.modules.portfolio.BinderSecurityCallback)14 PortfolioService (org.olat.modules.portfolio.PortfolioService)14 BinderImpl (org.olat.modules.portfolio.model.BinderImpl)14 AccessRights (org.olat.modules.portfolio.model.AccessRights)12 Date (java.util.Date)10 WindowControl (org.olat.core.gui.control.WindowControl)10 AssessmentSectionImpl (org.olat.modules.portfolio.model.AssessmentSectionImpl)8