Examples of ICourse


Examples of org.olat.course.ICourse

          return re.getDisplayname();
        }
        if ("CourseNode".equals(tokenType)) {
          String repoKey = allTokens.get(0).split("[:]")[1];
          RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(Long.parseLong(repoKey));
          ICourse course = CourseFactory.loadCourse(re.getOlatResource());
          CourseNode courseNode = course.getRunStructure().getNode(tokenKey);
          return courseNode.getShortTitle();
        }
        if ("Identity".equals(tokenType)) {
          Identity identity  = ManagerFactory.getManager().loadIdentityByKey(Long.parseLong(tokenKey));
          User user = identity.getUser();
View Full Code Here

Examples of org.olat.course.ICourse

    if (path.isCourseType()) {
      // A course node is being requested
      OLATResourceable oresCourse = OLATResourceManager.getInstance()
          .findResourceable(path.getCourseId(), CourseModule.getCourseTypeName());
      ICourse course = CourseFactory.loadCourse(oresCourse);
      CourseNode node = course.getEditorTreeModel().getCourseNode(path.getNodeId());
      // Check access
      hasAccess = hasAccess(identity, path.getToken(), course, node);
    } else {
      // A learning resource is being requested
      hasAccess = hasAccess(identity, path.getToken(), feed);
View Full Code Here

Examples of org.olat.course.ICourse

    super(ureq, wControl);
    this.ores = ores;
    this.moveCopyFrom = moveCopyFrom;
    this.copy = copy;

    ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
    addLoggingResourceable(LoggingResourceable.wrap(course));
    addLoggingResourceable(LoggingResourceable.wrap(moveCopyFrom.getCourseNode()));

    insertTree = new SelectionTree("copy_node_selection", getTranslator());
    insertTree.setFormButtonKey("insertAtSelectedTreepos");
    insertTree.addListener(this);
    insertModel = new InsertTreeModel(course.getEditorTreeModel());
    insertTree.setTreeModel(insertModel);   
   
    VelocityContainer mainVC = createVelocityContainer("moveCopyNode");
   
    if(insertModel.totalNodeCount() > CourseModule.getCourseNodeLimit()){
View Full Code Here

Examples of org.olat.course.ICourse

   
    this.putInitialPanel(mainVC);
  }

  public void event(UserRequest ureq, Component source, Event event) {
    ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
    copyNodeId = null; // initialize copyNodeId with null because a new event happens and old value is invalid.
    if (source == insertTree) {
      TreeEvent te = (TreeEvent) event;
      if (te.getCommand().equals(TreeEvent.COMMAND_TREENODE_CLICKED)) {
        // user chose a position to insert a new node
        String nodeId = te.getNodeId();
        TreePosition tp = insertModel.getTreePosition(nodeId);
        CourseNode selectedNode = insertModel.getCourseNode(tp.getParentTreeNode());
        CourseEditorTreeNode insertParent = course.getEditorTreeModel().getCourseEditorNodeById(selectedNode.getIdent());

        // check if insert position is within the to-be-copied tree
        if (checkIfIsChild(insertParent, moveCopyFrom)) {         
          this.showError("movecopynode.error.overlap");
          fireEvent(ureq, Event.CANCELLED_EVENT);
          return;
        }

        int insertPos = tp.getChildpos();
        if (copy) { // do a copy
          // copy subtree and save model
          recursiveCopy(moveCopyFrom, insertParent, insertPos, true, CourseFactory.getCourseEditSession(ores.getResourceableId()));         
          CourseFactory.saveCourseEditorTreeModel(course.getResourceableId());

          ThreadLocalUserActivityLogger.log(CourseLoggingAction.COURSE_EDITOR_NODE_COPIED, getClass());
          fireEvent(ureq, Event.DONE_EVENT);
        } else { // move only
          if (insertParent.getIdent().equals(moveCopyFrom.getParent().getIdent())) {
            // same parent, adjust insertPos
            if (insertPos > moveCopyFrom.getPosition()) insertPos--;
          }
          insertParent.insert(moveCopyFrom, insertPos);

          moveCopyFrom.setDirty(true);
          //mark subtree as dirty
          TreeVisitor tv = new TreeVisitor( new Visitor() {
            public void visit(INode node) {
              CourseEditorTreeNode cetn = (CourseEditorTreeNode)node;
              cetn.setDirty(true);
            }
          },moveCopyFrom,true);
          tv.visitAll();         
          CourseFactory.saveCourseEditorTreeModel(course.getResourceableId()); // TODO: pb: Review : Add by chg to FIX OLAT-1662
          this.showInfo("movecopynode.info.condmoved");

          ThreadLocalUserActivityLogger.log(CourseLoggingAction.COURSE_EDITOR_NODE_MOVED, getClass());
          fireEvent(ureq, Event.DONE_EVENT);
        }
View Full Code Here

Examples of org.olat.course.ICourse

    // FIXME:ms:b would it be simpler to check the parents?
    // INode par;
    // for (par = prospectChild.getParent(); par != null && par != sourceTree;
    // par = par.getParent());
    // return (par == sourceTree);
    ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
    if (sourceTree.getIdent().equals(prospectChild.getIdent())) return true;
    for (int i = 0; i < sourceTree.getChildCount(); i++) {
      INode child = sourceTree.getChildAt(i);
      if (checkIfIsChild(prospectChild, course.getEditorTreeModel().getCourseEditorNodeById(child.getIdent()))) return true;
    }
    return false;
  }
View Full Code Here

Examples of org.olat.course.ICourse

    query.append("' or p.name = '").append(AssessmentManager.PASSED);
    query.append("' )");

    DB db = DBFactory.getInstance();
    DBQuery dbq = db.createQuery(query.toString());
    ICourse course = CourseFactory.loadCourse(ores);
    dbq.setLong("resid", course.getResourceableId().longValue());
    dbq.setString("resname", course.getResourceableTypeName());

    List res = dbq.list();
    return res;
  }
View Full Code Here

Examples of org.olat.course.ICourse

  public List doAction(List identitiesAndTheirsScores) {
    if (this.ores == null || this.courseNode == null || this.coachIdentity == null){
      throw new AssertException("use constructor with course, assessable coursnode and coachidentity");
    }
    List feedbacks = new ArrayList(identitiesAndTheirsScores.size());
    ICourse course = CourseFactory.loadCourse(ores);
    for (Iterator iter = identitiesAndTheirsScores.iterator(); iter.hasNext();) {
      Object[] identityAndItsScore = (Object[]) iter.next();
      if (identityAndItsScore[0] != null){
       
        if (allowedIdKeys.contains(((Identity)identityAndItsScore[0]).getKey())){
          IdentityEnvironment ienv = new IdentityEnvironment();
          ienv.setIdentity((Identity)identityAndItsScore[0]);
          UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
          String scoreAsString = (String) identityAndItsScore[1];
          if(scoreAsString != null){
            try {
              Float score = Float.valueOf(scoreAsString);
              //*** Score granted: Yes --> it must have a minimum and a maximum score value
View Full Code Here

Examples of org.olat.course.ICourse

    else tmpAreas = Arrays.asList(psf.getArea().split(","));

    // get learning areas for groups
    Set areas = new HashSet();
    areas.addAll(tmpAreas);
    ICourse course = CourseFactory.loadCourse(ores);
    for (Iterator iter = groups.iterator(); iter.hasNext();) {
      String groupName = (String) iter.next();
      List newAreas = course.getCourseEnvironment().getCourseGroupManager().getLearningAreasOfGroupFromAllContexts(groupName);
      for (Iterator iterator = newAreas.iterator(); iterator.hasNext();) {
        BGArea newArea = (BGArea) iterator.next();
        areas.add(newArea.getName());
      }
    }
    role = psf.getRole();
    // default is student
    isGlobalAuthor = false;
    isGuestOnly = false;
    isCoach = false;
    isCourseAdmin = false;
    /*
     * if (role.equals(PreviewSettingsForm.ROLE_STUDENT)) { } else
     */
    if (role.equals(PreviewSettingsForm.ROLE_GUEST)) {
      isGuestOnly = true;
    } else if (role.equals(PreviewSettingsForm.ROLE_COURSECOACH)) {
      isCoach = true;
    } else if (role.equals(PreviewSettingsForm.ROLE_COURSEADMIN)) {
      isCourseAdmin = true;
    } else if (role.equals(PreviewSettingsForm.ROLE_GLOBALAUTHOR)) {
      isGlobalAuthor = true;
    }

    final CourseGroupManager cgm = new PreviewCourseGroupManager(groups, new ArrayList(areas), isCoach, isCourseAdmin);
    final UserNodeAuditManager auditman = new PreviewAuditManager();
    final AssessmentManager am = new PreviewAssessmentManager();
    final CoursePropertyManager cpm = new PreviewCoursePropertyManager();
    final Structure runStructure = course.getEditorTreeModel().createStructureForPreview();
    final String title = course.getCourseTitle();

    simCourseEnv = new PreviewCourseEnvironment(title, runStructure, psf.getDate(), course.getCourseFolderContainer(), course
        .getCourseBaseContainer(),course.getResourceableId(), cpm, cgm, auditman, am);
    simIdentEnv = new IdentityEnvironment();
    simIdentEnv.setRoles(new Roles(false, false, false, isGlobalAuthor, isGuestOnly, false));
    final Identity ident = new PreviewIdentity();
    simIdentEnv.setIdentity(ident);
    //identity must be set before attributes OLAT-4811
View Full Code Here

Examples of org.olat.course.ICourse

  /**
   * Archive the hole course with runtime-data and course-structure-data.
   * @see org.olat.repository.handlers.RepositoryHandler#archive(java.lang.String, org.olat.repository.RepositoryEntry)
   */
  public String archive(Identity archiveOnBehalfOf, String archivFilePath, RepositoryEntry entry) {
    ICourse course = CourseFactory.loadCourse(entry.getOlatResource() );
    // Archive course runtime data (like delete course, archive e.g. logfiles, node-data)
    File tmpExportDir = new File(FolderConfig.getCanonicalTmpDir() + "/" + CodeHelper.getRAMUniqueID());
    tmpExportDir.mkdirs();
    CourseFactory.archiveCourse(archiveOnBehalfOf, course, WebappHelper.getDefaultCharset(), I18nModule.getDefaultLocale(), tmpExportDir , true);
    // Archive course run structure (like course export)
View Full Code Here

Examples of org.olat.course.ICourse

  }

  @Override
  public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl,
      UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    ICourse course = CourseFactory.loadCourse(userCourseEnv.getCourseEnvironment().getCourseResourceableId());
    CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
    boolean canEdit = ureq.getUserSession().getRoles().isOLATAdmin() || cgm.isIdentityCourseAdministrator(ureq.getIdentity());
    boolean canManage;
    if(canEdit) canManage = true;
    else canManage = cgm.isIdentityCourseCoach(ureq.getIdentity()) | cgm.hasRight(ureq.getIdentity(), CourseRights.RIGHT_GROUPMANAGEMENT);
    Controller controller = ChecklistUIFactory.getInstance().createDisplayController(ureq, wControl, loadOrCreateChecklist(userCourseEnv.getCourseEnvironment().getCoursePropertyManager()), null, canEdit, canManage, course);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.