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;
}
}
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());
}
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());
}
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));
}
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());
}
Aggregations