Search in sources :

Example 51 with RepositoryEntry

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;
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) AssessedPage(org.olat.modules.portfolio.model.AssessedPage) Page(org.olat.modules.portfolio.Page) RepositoryEntry(org.olat.repository.RepositoryEntry) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section)

Example 52 with RepositoryEntry

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);
        }
    }
}
Also used : PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) OLATResource(org.olat.resource.OLATResource) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Date(java.util.Date)

Example 53 with RepositoryEntry

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);
    }
}
Also used : RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 54 with RepositoryEntry

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);
    }
}
Also used : CourseTemplateRow(org.olat.modules.portfolio.ui.model.CourseTemplateRow) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) VisibleTreeFilter(org.olat.course.run.userview.VisibleTreeFilter) TreeEvaluation(org.olat.course.run.userview.TreeEvaluation) RepositoryEntry(org.olat.repository.RepositoryEntry) NodeEvaluation(org.olat.course.run.userview.NodeEvaluation)

Example 55 with RepositoryEntry

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);
}
Also used : RepositoryEntry(org.olat.repository.RepositoryEntry)

Aggregations

RepositoryEntry (org.olat.repository.RepositoryEntry)2108 Test (org.junit.Test)922 Identity (org.olat.core.id.Identity)888 BusinessGroup (org.olat.group.BusinessGroup)344 ArrayList (java.util.ArrayList)258 File (java.io.File)246 ICourse (org.olat.course.ICourse)246 Date (java.util.Date)234 OLATResource (org.olat.resource.OLATResource)200 URI (java.net.URI)176 HttpResponse (org.apache.http.HttpResponse)172 OLATResourceable (org.olat.core.id.OLATResourceable)132 RepositoryManager (org.olat.repository.RepositoryManager)122 Roles (org.olat.core.id.Roles)104 RepositoryService (org.olat.repository.RepositoryService)104 LectureBlock (org.olat.modules.lecture.LectureBlock)94 Path (javax.ws.rs.Path)90 URL (java.net.URL)84 VFSContainer (org.olat.core.util.vfs.VFSContainer)76 WindowControl (org.olat.core.gui.control.WindowControl)74