Search in sources :

Example 91 with Binder

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

the class BinderDAOTest method createNewBinder.

@Test
public void createNewBinder() {
    String title = "My portfolio";
    String summary = "My live";
    BinderImpl binder = binderDao.createAndPersist(title, summary, null, null);
    dbInstance.commitAndCloseSession();
    Assert.assertNotNull(binder);
    Assert.assertNotNull(binder.getKey());
    Assert.assertNotNull(binder.getCreationDate());
    Assert.assertNotNull(binder.getLastModified());
    Assert.assertNotNull(binder.getBaseGroup());
    Assert.assertEquals(title, binder.getTitle());
    Assert.assertEquals(summary, binder.getSummary());
    Binder reloadedBinder = binderDao.loadByKey(binder.getKey());
    Assert.assertNotNull(reloadedBinder);
    Assert.assertNotNull(reloadedBinder.getKey());
    Assert.assertEquals(binder.getKey(), reloadedBinder.getKey());
    Assert.assertEquals(binder, reloadedBinder);
    Assert.assertNotNull(reloadedBinder.getCreationDate());
    Assert.assertNotNull(reloadedBinder.getLastModified());
    Assert.assertEquals(title, reloadedBinder.getTitle());
    Assert.assertEquals(summary, reloadedBinder.getSummary());
}
Also used : Binder(org.olat.modules.portfolio.Binder) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Test(org.junit.Test)

Example 92 with Binder

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

the class BinderDAOTest method getOwnedBinders.

@Test
public void getOwnedBinders() {
    Identity owner = JunitTestHelper.createAndPersistIdentityAsRndUser("binder-owner");
    Binder binder = portfolioService.createNewBinder("My own binder", "", "", owner);
    dbInstance.commit();
    Binder deletedBinder = portfolioService.createNewBinder("My own deleted binder", "", "", owner);
    deletedBinder.setBinderStatus(BinderStatus.deleted);
    deletedBinder = portfolioService.updateBinder(deletedBinder);
    dbInstance.commitAndCloseSession();
    List<Binder> ownedBinders = binderDao.getOwnedBinders(owner);
    Assert.assertNotNull(ownedBinders);
    Assert.assertEquals(1, ownedBinders.size());
    Assert.assertTrue(ownedBinders.contains(binder));
    Assert.assertFalse(ownedBinders.contains(deletedBinder));
}
Also used : Binder(org.olat.modules.portfolio.Binder) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 93 with Binder

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

the class AssignmentDAOTest method loadAssignments_section.

@Test
public void loadAssignments_section() {
    Identity owner = JunitTestHelper.createAndPersistIdentityAsRndUser("assign-4");
    Binder binder = portfolioService.createNewBinder("Assignment binder 4", "Difficult!", null, owner);
    dbInstance.commit();
    portfolioService.appendNewSection("Section", "Assignment section", null, null, binder);
    dbInstance.commit();
    // create assignment
    List<Section> sections = portfolioService.getSections(binder);
    Section section = sections.get(0);
    Assignment assignment = assignmentDao.createAssignment("Load assignment", "Load by section", "The another content", null, AssignmentType.essay, AssignmentStatus.template, section, false, false, false, null);
    dbInstance.commitAndCloseSession();
    // load the assignment
    List<Assignment> assignments = assignmentDao.loadAssignments(section, 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 94 with Binder

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

the class AssignmentDAOTest method loadAssignments_section_search.

@Test
public void loadAssignments_section_search() {
    Identity owner = JunitTestHelper.createAndPersistIdentityAsRndUser("assign-5");
    Binder binder = portfolioService.createNewBinder("Assignment binder 5", "Difficult!", null, owner);
    dbInstance.commit();
    portfolioService.appendNewSection("Section", "Assignment section", null, null, binder);
    dbInstance.commit();
    // create assignment
    List<Section> sections = portfolioService.getSections(binder);
    Section section = sections.get(0);
    Assignment assignment = assignmentDao.createAssignment("Load assignment", "Load by binder", "The little blabla to search", null, AssignmentType.essay, AssignmentStatus.template, section, false, false, false, null);
    dbInstance.commitAndCloseSession();
    // search the assignment
    List<Assignment> assignments = assignmentDao.loadAssignments(section, "blabla");
    Assert.assertNotNull(assignments);
    Assert.assertEquals(1, assignments.size());
    Assert.assertEquals(assignment, assignments.get(0));
    // dummy search
    List<Assignment> emptyAssignments = assignmentDao.loadAssignments(section, "wezruiwezi");
    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)

Example 95 with Binder

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

the class PortfolioResultDetailsController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if (cmd != null && cmd.startsWith("map.deadline.change")) {
            if (deadlineCalloutCtr == null) {
                EPStructuredMap map = (EPStructuredMap) link.getUserObject();
                popupDeadlineBox(ureq, map);
            } else {
                // close on second click
                closeDeadlineBox();
            }
        } else if (link.getName().startsWith("open.map")) {
            PortfolioStructureMap map = (PortfolioStructureMap) link.getUserObject();
            doOpenMap(ureq, map);
        } else if (link.getName().startsWith("open.binder")) {
            Binder map = (Binder) link.getUserObject();
            doOpenMap(ureq, map);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) Binder(org.olat.modules.portfolio.Binder) EPStructuredMap(org.olat.portfolio.model.structel.EPStructuredMap) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

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