Search in sources :

Example 26 with CourseNode

use of org.olat.course.nodes.CourseNode in project OpenOLAT by OpenOLAT.

the class MoveCopySubtreeController method recursiveCopy.

private void recursiveCopy(CourseEditorTreeNode copyFrom2, CourseEditorTreeNode insertParent, int pos, boolean firstIteration, ICourse course) {
    // create copy of course node
    CourseNode copyOfNode = copyFrom2.getCourseNode().createInstanceForCopy(firstIteration, course, getIdentity());
    copyNodeId = copyOfNode.getIdent();
    // Insert at desired position
    course.getEditorTreeModel().insertCourseNodeAt(copyOfNode, insertParent.getCourseNode(), pos);
    CourseEditorTreeNode insertedEditorTreeNode = course.getEditorTreeModel().getCourseEditorNodeById(copyOfNode.getIdent());
    for (int i = 0; i < copyFrom2.getChildCount(); i++) {
        recursiveCopy(course.getEditorTreeModel().getCourseEditorNodeById(copyFrom2.getChildAt(i).getIdent()), insertedEditorTreeNode, i, false, course);
    }
}
Also used : CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) CourseNode(org.olat.course.nodes.CourseNode)

Example 27 with CourseNode

use of org.olat.course.nodes.CourseNode in project OpenOLAT by OpenOLAT.

the class GTANotifications method getItems.

public List<SubscriptionListItem> getItems() {
    Publisher p = subscriber.getPublisher();
    ICourse course = CourseFactory.loadCourse(p.getResId());
    CourseNode node = course.getRunStructure().getNode(p.getSubidentifier());
    RepositoryEntry entry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    if (entry.getRepositoryEntryStatus().isClosed() || entry.getRepositoryEntryStatus().isUnpublished()) {
        return Collections.emptyList();
    }
    if (entry != null && node instanceof GTACourseNode) {
        gtaNode = (GTACourseNode) node;
        displayName = entry.getDisplayname();
        courseEnv = course.getCourseEnvironment();
        taskList = gtaManager.getTaskList(entry, gtaNode);
        if (GTAType.group.name().equals(gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
            createBusinessGroupsSubscriptionInfo(subscriber.getIdentity());
        } else {
            createIndividualSubscriptionInfo(subscriber.getIdentity());
        }
    }
    return items;
}
Also used : GTACourseNode(org.olat.course.nodes.GTACourseNode) ICourse(org.olat.course.ICourse) Publisher(org.olat.core.commons.services.notifications.Publisher) CourseNode(org.olat.course.nodes.CourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 28 with CourseNode

use of org.olat.course.nodes.CourseNode in project OpenOLAT by OpenOLAT.

the class AbstractDueDateTaskRuleSPI method evaluate.

@Override
public List<Identity> evaluate(RepositoryEntry entry, ReminderRule rule) {
    List<Identity> identities = null;
    if (rule instanceof ReminderRuleImpl) {
        ReminderRuleImpl r = (ReminderRuleImpl) rule;
        String nodeIdent = r.getLeftOperand();
        ICourse course = CourseFactory.loadCourse(entry);
        CourseNode courseNode = course.getRunStructure().getNode(nodeIdent);
        if (courseNode instanceof GTACourseNode) {
            identities = evaluateRule(entry, (GTACourseNode) courseNode, r);
        }
    }
    return identities == null ? Collections.<Identity>emptyList() : identities;
}
Also used : ReminderRuleImpl(org.olat.modules.reminder.model.ReminderRuleImpl) GTACourseNode(org.olat.course.nodes.GTACourseNode) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) Identity(org.olat.core.id.Identity)

Example 29 with CourseNode

use of org.olat.course.nodes.CourseNode in project OpenOLAT by OpenOLAT.

the class HomeCalendarManager method isCourseCalendarEnabled.

private boolean isCourseCalendarEnabled(ICourse course) {
    if (course.getCourseConfig().isCalendarEnabled()) {
        return true;
    }
    CourseNode rootNode = course.getRunStructure().getRootNode();
    CalCourseNodeVisitor v = new CalCourseNodeVisitor();
    new TreeVisitor(v, rootNode, true).visitAll();
    return v.isFound();
}
Also used : TreeVisitor(org.olat.core.util.tree.TreeVisitor) CourseNode(org.olat.course.nodes.CourseNode) CalCourseNode(org.olat.course.nodes.CalCourseNode)

Example 30 with CourseNode

use of org.olat.course.nodes.CourseNode in project OpenOLAT by OpenOLAT.

the class CourseIndexer method doIndexCourse.

/**
 * @param repositoryResourceContext
 * @param course
 * @param courseNode
 * @param indexWriter
 * @throws IOException
 * @throws InterruptedException
 */
private void doIndexCourse(SearchResourceContext repositoryResourceContext, ICourse course, INode node, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
    // try to index the course node
    if (node instanceof CourseNode) {
        if (isLogDebugEnabled())
            logDebug("Analyse CourseNode child ... childCourseNode=" + node);
        // go further with resource
        CourseNode childCourseNode = (CourseNode) node;
        CourseNodeIndexer courseNodeIndexer = getCourseNodeIndexer(childCourseNode);
        if (courseNodeIndexer != null) {
            if (isLogDebugEnabled())
                logDebug("courseNodeIndexer=" + courseNodeIndexer);
            try {
                courseNodeIndexer.doIndex(repositoryResourceContext, course, childCourseNode, indexWriter);
            } catch (Exception e) {
                logWarn("Can not index course node=" + childCourseNode.getIdent(), e);
            }
        }
    }
    // loop over all child nodes
    int childCount = node.getChildCount();
    for (int i = 0; i < childCount; i++) {
        INode childNode = node.getChildAt(i);
        doIndexCourse(repositoryResourceContext, course, childNode, indexWriter);
    }
}
Also used : INode(org.olat.core.util.nodes.INode) CourseNodeIndexer(org.olat.search.service.indexer.repository.course.CourseNodeIndexer) CourseNode(org.olat.course.nodes.CourseNode) AssertException(org.olat.core.logging.AssertException) CorruptedCourseException(org.olat.course.CorruptedCourseException) StartupException(org.olat.core.logging.StartupException) IOException(java.io.IOException)

Aggregations

CourseNode (org.olat.course.nodes.CourseNode)402 ICourse (org.olat.course.ICourse)182 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)98 Identity (org.olat.core.id.Identity)74 STCourseNode (org.olat.course.nodes.STCourseNode)72 ArrayList (java.util.ArrayList)68 RepositoryEntry (org.olat.repository.RepositoryEntry)64 CourseEditorTreeNode (org.olat.course.tree.CourseEditorTreeNode)54 INode (org.olat.core.util.nodes.INode)44 GTACourseNode (org.olat.course.nodes.GTACourseNode)44 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)42 TACourseNode (org.olat.course.nodes.TACourseNode)40 TreeNode (org.olat.core.gui.components.tree.TreeNode)38 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)36 MSCourseNode (org.olat.course.nodes.MSCourseNode)36 ScormCourseNode (org.olat.course.nodes.ScormCourseNode)30 Test (org.junit.Test)28 AbstractAccessableCourseNode (org.olat.course.nodes.AbstractAccessableCourseNode)28 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)28 CourseEditorTreeModel (org.olat.course.tree.CourseEditorTreeModel)26