Esempio n. 1
0
  public SynchronizedGroupStatistic synchronizeCourse(CampusCourseImportTO sapCourse) {
    if (sapCourse != null) {
      long resourceableId = sapCourse.getOlatResourceableId();
      log.debug(
          "synchronizeCourse sapCourseId="
              + sapCourse.getSapCourseId()
              + "  resourceableId="
              + resourceableId);
      ICourse course = CourseFactory.loadCourse(resourceableId);
      commitDBImplTransaction();
      log.debug("synchronizeCourse start for course=" + course.getCourseTitle());
      log.debug("synchronizeCourse Lecturer size=" + sapCourse.getLecturers().size());
      log.debug("synchronizeCourse Participants size=" + sapCourse.getParticipants().size());

      courseGroupSynchronizer.addAllLecturesAsOwner(course, sapCourse.getLecturers());
      // SynchronizedGroupStatistic groupStatistic =
      // courseGroupSynchronizer.synchronizeCourseGroupsForStudentsOnly(course, sapCourse);
      SynchronizedGroupStatistic groupStatistic =
          courseGroupSynchronizer.synchronizeCourseGroups(course, sapCourse);
      commitDBImplTransaction();
      log.debug("synchronizeCourse statistic=" + groupStatistic);
      if (campusConfiguration.isSynchronizeTitleAndDescriptionEnabled()) {
        log.debug("SynchronizeTitleAndDescription is enabled");
        courseAttributeSynchronizer.synchronizeTitleAndDescription(
            sapCourse.getSapCourseId(), sapCourse);
        commitDBImplTransaction();
      }
      return groupStatistic;
    } else {
      return SynchronizedGroupStatistic.createEmptyStatistic();
    }
  }
Esempio n. 2
0
  /**
   * Index a forum in a course.
   *
   * @param parentResourceContext
   * @param course
   * @param courseNode
   * @param indexWriter
   * @throws IOException
   */
  private void doIndexForum(
      final SearchResourceContext parentResourceContext,
      final ICourse course,
      final CourseNode courseNode,
      final OlatFullIndexer indexWriter)
      throws IOException, InterruptedException {
    if (log.isDebugEnabled()) {
      log.debug("Index Course Forum...");
    }
    final ForumService fom = getForumService();
    final CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();

    final PropertyImpl forumKeyProperty =
        cpm.findCourseNodeProperty(courseNode, null, null, FOCourseNode.FORUM_KEY);
    // Check if forum-property exist
    if (forumKeyProperty != null) {
      final Long forumKey = forumKeyProperty.getLongValue();
      final Forum forum = fom.loadForum(forumKey);
      // SearchResourceContext forumSearchResourceContext = new
      // SearchResourceContext(parentResourceContext);
      // forumSearchResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLFORUM); // TODO:chg: Must be an other Class e.g.
      // CourseRunMainController
      parentResourceContext.setDocumentType(TYPE);
      parentResourceContext.setDocumentContext(
          course.getResourceableId() + " " + courseNode.getIdent() + " " + forumKey);
      doIndexAllMessages(parentResourceContext, forum, indexWriter);
    }
  }
Esempio n. 3
0
 /** @param res glossary to be deleted */
 @Override
 public void deleteGlossary(final OLATResourceable res) {
   // first remove all references
   final List repoRefs = referenceManager.getReferencesTo(res);
   for (final Iterator iter = repoRefs.iterator(); iter.hasNext(); ) {
     final Reference ref = (Reference) iter.next();
     if (ref.getUserdata().equals(GLOSSARY_REPO_REF_IDENTIFYER)) {
       // remove the reference from the course configuration
       // TODO:RH:improvement: this should use a callback method or send a general delete
       // event so that the course can take care of this rather than having it
       // here hardcoded
       final OLATResourceImpl courseResource = ref.getSource();
       // ICourse course = CourseFactory.loadCourse(courseResource);
       final ICourse course =
           CourseFactory.openCourseEditSession(courseResource.getResourceableId());
       final CourseConfig cc = course.getCourseEnvironment().getCourseConfig();
       cc.setGlossarySoftKey(null);
       CourseFactory.setCourseConfig(course.getResourceableId(), cc);
       CourseFactory.closeCourseEditSession(course.getResourceableId(), true);
       // remove reference from the references table
       referenceManager.delete(ref);
     }
   }
   // now remove the resource itself
   FileResourceManager.getInstance().deleteFileResource(res);
 }
  public PortfolioCourseNodeEditController(
      final UserRequest ureq,
      final WindowControl wControl,
      final ICourse course,
      final PortfolioCourseNode node,
      final ModuleConfiguration config,
      final UserCourseEnvironment euce) {
    super(ureq, wControl);
    this.config = config;
    this.courseNode = node;

    configForm = new PortfolioConfigForm(ureq, wControl, course, node);
    listenTo(configForm);
    scoringController = new MSEditFormController(ureq, wControl, config);
    scoringContent = scoringController.getInitialComponent();
    listenTo(scoringController);
    textForm = new PortfolioTextForm(ureq, wControl, course, node);
    listenTo(textForm);

    configContent = createVelocityContainer("edit");
    configContent.put("configForm", configForm.getInitialComponent());
    configContent.put("textForm", textForm.getInitialComponent());

    // Accessibility precondition
    final CourseGroupManager groupMgr = course.getCourseEnvironment().getCourseGroupManager();
    final CourseEditorTreeModel editorModel = course.getEditorTreeModel();
    final Condition accessCondition = node.getPreConditionAccess();
    accessibilityCondContr =
        new ConditionEditController(
            ureq,
            getWindowControl(),
            groupMgr,
            accessCondition,
            "accessabilityConditionForm",
            AssessmentHelper.getAssessableNodes(editorModel, node),
            euce);
    listenTo(accessibilityCondContr);

    // if there is already user data available, make for read only
    final UserNodeAuditManager am = course.getCourseEnvironment().getAuditManager();
    hasLogEntries = am.hasUserNodeLogs(node);
    configContent.contextPut("hasLogEntries", new Boolean(hasLogEntries));
    if (hasLogEntries) {
      scoringController.setDisplayOnly(true);
    }
    // Initialstate
    configContent.contextPut("isOverwriting", new Boolean(false));
  }
  public PreviewCourseEnvironment(
      final ICourse course,
      final Date simulatedDateTime,
      final CoursePropertyManager cpm,
      final CourseGroupManager cgm,
      final UserNodeAuditManager auditman,
      final AssessmentManager am) {
    super();
    this.course = course;
    this.title = course.getCourseTitle();
    this.courseFolderContainer = course.getCourseFolderContainer();
    this.courseBaseContainer = course.getCourseBaseContainer();
    this.runStructure = course.getEditorTreeModel().createStructureForPreview();
    this.resourceablId = course.getResourceableId();

    this.simulatedDateTime = simulatedDateTime.getTime();
    this.coursePropertyManager = cpm;
    this.courseGroupManager = cgm;
    this.auditManager = auditman;
    this.assessmentManager = am;
  }
Esempio n. 6
0
 /** org.olat.lms.course.ICourse, org.olat.lms.course.run.userview.UserCourseEnvironment) */
 @Override
 public TabbableController createEditController(
     final UserRequest ureq,
     final WindowControl wControl,
     final ICourse course,
     final UserCourseEnvironment euce) {
   final CourseNode chosenNode =
       course
           .getEditorTreeModel()
           .getCourseNode(euce.getCourseEditorEnv().getCurrentCourseNodeId());
   final TabbableController blogChildController =
       new BlogNodeEditController(this, course, euce, ureq, wControl);
   return new NodeEditController(
       ureq,
       wControl,
       course.getEditorTreeModel(),
       course,
       chosenNode,
       course.getCourseEnvironment().getCourseGroupManager(),
       euce,
       blogChildController);
 }