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