use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class PortfolioServiceImpl method startAssignment.
@Override
public Assignment startAssignment(Long assignmentKey, Identity author) {
Assignment reloadedAssignment = assignmentDao.loadAssignmentByKey(assignmentKey);
if (reloadedAssignment.getPage() == null) {
Section section = reloadedAssignment.getSection();
if (reloadedAssignment.getAssignmentType() == AssignmentType.essay || reloadedAssignment.getAssignmentType() == AssignmentType.document) {
Page page = appendNewPage(author, reloadedAssignment.getTitle(), reloadedAssignment.getSummary(), null, null, section);
reloadedAssignment = assignmentDao.startEssayAssignment(reloadedAssignment, page, author);
} else if (reloadedAssignment.getAssignmentType() == AssignmentType.form) {
RepositoryEntry formEntry = reloadedAssignment.getFormEntry();
Page page = appendNewPage(author, reloadedAssignment.getTitle(), reloadedAssignment.getSummary(), null, false, null, section);
reloadedAssignment = assignmentDao.startFormAssignment(reloadedAssignment, page, author);
// create the session for the assignee
evaluationFormSessionDao.createSessionForPortfolio(author, page.getBody(), formEntry);
}
}
dbInstance.commit();
ThreadLocalUserActivityLogger.log(PortfolioLoggingAction.PORTFOLIO_ASSIGNMENT_STARTED, getClass(), LoggingResourceable.wrap(reloadedAssignment.getSection()), LoggingResourceable.wrap(reloadedAssignment));
return reloadedAssignment;
}
use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class PortfolioServiceImpl method updateAssessmentEntryLastModification.
private void updateAssessmentEntryLastModification(Binder binder, Identity doer, Role by) {
if (binder.getEntry() == null)
return;
RepositoryEntry entry = binder.getEntry();
List<Identity> assessedIdentities = getMembers(binder, PortfolioRoles.owner.name());
// order status from the entry / section
if ("CourseModule".equals(entry.getOlatResource().getResourceableTypeName())) {
ICourse course = CourseFactory.loadCourse(entry);
CourseNode courseNode = course.getRunStructure().getNode(binder.getSubIdent());
if (courseNode instanceof PortfolioCourseNode) {
PortfolioCourseNode pfNode = (PortfolioCourseNode) courseNode;
for (Identity assessedIdentity : assessedIdentities) {
UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
pfNode.updateLastModifications(userCourseEnv, doer, by);
}
}
} else {
OLATResource resource = ((BinderImpl) binder.getTemplate()).getOlatResource();
RepositoryEntry referenceEntry = repositoryService.loadByResourceKey(resource.getKey());
for (Identity assessedIdentity : assessedIdentities) {
AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, binder.getEntry(), binder.getSubIdent(), referenceEntry);
if (by == Role.coach) {
assessmentEntry.setLastCoachModified(new Date());
} else if (by == Role.user) {
assessmentEntry.setLastUserModified(new Date());
}
assessmentService.updateAssessmentEntry(assessmentEntry);
}
}
}
use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class BinderRuntimeController method initRuntimeTools.
@Override
protected void initRuntimeTools(Dropdown toolsDropdown) {
if (reSecurity.isEntryAdmin()) {
membersLink = LinkFactory.createToolLink("members", translate("details.members"), this, "o_sel_repo_members");
membersLink.setIconLeftCSS("o_icon o_icon-fw o_icon_membersmanagement");
toolsDropdown.addComponent(membersLink);
}
if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach()) {
assessmentLink = LinkFactory.createToolLink("assessment", translate("command.openassessment"), this, "o_icon_assessment_tool");
assessmentLink.setElementCssClass("o_sel_course_assessment_tool");
toolsDropdown.addComponent(assessmentLink);
}
if (reSecurity.isEntryAdmin()) {
RepositoryEntry re = getRepositoryEntry();
ordersLink = LinkFactory.createToolLink("bookings", translate("details.orders"), this, "o_sel_repo_booking");
ordersLink.setIconLeftCSS("o_icon o_icon-fw o_icon_booking");
boolean booking = acService.isResourceAccessControled(re.getOlatResource(), null);
ordersLink.setEnabled(booking);
toolsDropdown.addComponent(ordersLink);
}
}
use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class CourseTemplateSearchController method loadCourseModel.
private void loadCourseModel(CourseNode courseNode, UserCourseEnvironment uce, List<CourseTemplateRow> rows, Set<CurrentBinder> currentSet) {
if (courseNode instanceof PortfolioCourseNode) {
PortfolioCourseNode pNode = (PortfolioCourseNode) courseNode;
NodeEvaluation ne = pNode.eval(uce.getConditionInterpreter(), new TreeEvaluation(), new VisibleTreeFilter());
if (NavigationHandler.mayAccessWholeTreeUp(ne)) {
RepositoryEntry refEntry = pNode.getReferencedRepositoryEntry();
if ("BinderTemplate".equals(refEntry.getOlatResource().getResourceableTypeName())) {
RepositoryEntry courseEntry = uce.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
CurrentBinder binderKey = new CurrentBinder(courseEntry.getKey(), pNode.getIdent());
if (!currentSet.contains(binderKey)) {
rows.add(new CourseTemplateRow(courseEntry, pNode, refEntry));
}
}
}
}
for (int i = courseNode.getChildCount(); i-- > 0; ) {
loadCourseModel((CourseNode) courseNode.getChildAt(i), uce, rows, currentSet);
}
}
use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class BinderDAO method syncAssignment.
private AssignmentImpl syncAssignment(Assignment refAssignment, AssignmentImpl currentAssignment) {
if (StringHelper.isSame(currentAssignment.getTitle(), refAssignment.getTitle()) && StringHelper.isSame(currentAssignment.getSummary(), refAssignment.getSummary()) && StringHelper.isSame(currentAssignment.getContent(), refAssignment.getContent()) && StringHelper.isSame(currentAssignment.getStorage(), refAssignment.getStorage()) && StringHelper.isSame(currentAssignment.getType(), refAssignment.getAssignmentType().name()) && StringHelper.isSame(currentAssignment.isOnlyAutoEvaluation(), refAssignment.isOnlyAutoEvaluation()) && StringHelper.isSame(currentAssignment.isReviewerSeeAutoEvaluation(), refAssignment.isReviewerSeeAutoEvaluation()) && StringHelper.isSame(currentAssignment.isAnonymousExternalEvaluation(), refAssignment.isAnonymousExternalEvaluation()) && StringHelper.isSame(currentAssignment.getFormEntry(), refAssignment.getFormEntry())) {
return currentAssignment;
}
currentAssignment.setTitle(refAssignment.getTitle());
currentAssignment.setSummary(refAssignment.getSummary());
currentAssignment.setContent(refAssignment.getContent());
currentAssignment.setStorage(refAssignment.getStorage());
currentAssignment.setType(refAssignment.getAssignmentType().name());
currentAssignment.setOnlyAutoEvaluation(refAssignment.isOnlyAutoEvaluation());
currentAssignment.setReviewerSeeAutoEvaluation(refAssignment.isReviewerSeeAutoEvaluation());
currentAssignment.setAnonymousExternalEvaluation(refAssignment.isAnonymousExternalEvaluation());
RepositoryEntry formEntry = refAssignment.getFormEntry();
if (formEntry != null) {
RepositoryEntry refFormEntry = dbInstance.getCurrentEntityManager().getReference(RepositoryEntry.class, formEntry.getKey());
currentAssignment.setFormEntry(refFormEntry);
}
return dbInstance.getCurrentEntityManager().merge(currentAssignment);
}
Aggregations