Package org.olat.course.run.userview

Examples of org.olat.course.run.userview.UserCourseEnvironment


    } else {
      IdentityEnvironment ienv = new IdentityEnvironment();
      ienv.setIdentity(identity);
      Roles roles = ManagerFactory.getManager().getRoles(identity);
      ienv.setRoles(roles);
      UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
      // Build an evaluation tree
      TreeEvaluation treeEval = new TreeEvaluation();
      NodeEvaluation nodeEval = node.eval(userCourseEnv.getConditionInterpreter(), treeEval);
      if (nodeEval.isVisible() && validAuthentication(identity, token)) {
        hasAccess = true;
      }
    }
    return hasAccess;
View Full Code Here


      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
              if (hasScore){
                // score < minimum score
                if ((min != null && score.floatValue() < min.floatValue())
                    || (score.floatValue() < AssessmentHelper.MIN_SCORE_SUPPORTED)) {
                  Object[] feedback = new Object[]{Boolean.FALSE, identityAndItsScore[0],
                      translator.translate("bulk.action.lessThanMin",new String[]{String.valueOf(min)})};
                  feedbacks.add(feedback);
                }
                // score > maximum score
                else if ((max != null && score.floatValue() > max.floatValue())
                    || (score.floatValue() > AssessmentHelper.MAX_SCORE_SUPPORTED)) {
                  Object[] feedback = new Object[]{Boolean.FALSE, identityAndItsScore[0],
                      translator.translate("bulk.action.greaterThanMax",new String[]{String.valueOf(max)})};
                  feedbacks.add(feedback);
                }
                // score between minimum and maximum score
                else {
                  ScoreEvaluation se;
                  // *** Display passed/not passed: yes
                  // *** Type of display: automatic using cut value --> it must have a cut value
                  if (hasPassed && cut != null){
                    Boolean passed = (score.floatValue() >= cut.floatValue()) ? Boolean.TRUE  : Boolean.FALSE;
                    se = new ScoreEvaluation(score, passed);
                   
                  // *** Display passed/not passed: yes
                  // *** Type of display: Manual by tutor --> there is no cut value
                  // or
                  // *** Display passed/not passed: no --> there is no cut value
                  }else{
                    se = new ScoreEvaluation(score, null);
                  }
                 
                  // Update score,passed properties in db, and the user's efficiency statement
                  boolean incrementAttempts = false;
                  courseNode.updateUserScoreEvaluation(se, uce, coachIdentity, incrementAttempts);
                 
                  // Refresh score view
                  uce.getScoreAccounting().scoreInfoChanged(this.courseNode, se);
                 
                  Object[] feedback = new Object[]{Boolean.TRUE, identityAndItsScore[0],translator.translate("bulk.action.ok")};
                  feedbacks.add(feedback);
                }
              }else{ // *** Score granted: No
View Full Code Here

    // Try to get user course environment from local hash map cache. If not
    // successful
    // create the environment and add it to the map for later performance
    // optimization
    //synchronized (localUserCourseEnvironmentCache) { //o_clusterOK by:ld - no need to synchronized - only local variables
      UserCourseEnvironment uce = localUserCourseEnvironmentCache.get(identity.getKey());
      if (uce == null) {
        uce = createAndInitUserCourseEnvironment(identity, course);
        // add to cache for later usage
        localUserCourseEnvironmentCache.put(identity.getKey(), uce);
        if (Tracing.isDebugEnabled(AssessmentHelper.class)){
View Full Code Here

   */
  static UserCourseEnvironment createAndInitUserCourseEnvironment(Identity identity, ICourse course) {
    // create an identenv with no roles, no attributes, no locale
    IdentityEnvironment ienv = new IdentityEnvironment();
    ienv.setIdentity(identity);
    UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
    // Fetch all score and passed and calculate score accounting for the entire
    // course
    uce.getScoreAccounting().evaluateAll();
    return uce;
  }
View Full Code Here

      Identity identity = (Identity) iter.next();
      if (identity != null){ 
        IdentityEnvironment ienv = new IdentityEnvironment();
        ienv.setIdentity(identity);
        ICourse course = CourseFactory.loadCourse(ores);
        UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
        ScoreEvaluation scoreEvaluation = uce.getScoreAccounting().getScoreEvaluation(courseNode);
       
        if(scoreEvaluation == null){
          nodePassedResults.add(translator.translate("bulk.action.no.value"));
        }else{
          Boolean nodePassed = scoreEvaluation.getPassed();
View Full Code Here

      }

      // create a identenv with no roles, no attributes, no locale
      IdentityEnvironment ienv = new IdentityEnvironment();
      ienv.setIdentity(identity);
      UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
      uce.getScoreAccounting().evaluateAll();
      AssessmentManager am = course.getCourseEnvironment().getAssessmentManager();

      Iterator iterNodes = myNodes.iterator();
      while (iterNodes.hasNext()) {
        AssessableCourseNode acnode = (AssessableCourseNode) iterNodes.next();
        boolean scoreOk = acnode.hasScoreConfigured();
        boolean passedOk = acnode.hasPassedConfigured();
        boolean attemptsOk = acnode.hasAttemptsConfigured();
        boolean commentOk = acnode.hasCommentConfigured();

        if (scoreOk || passedOk || commentOk || attemptsOk) {
          ScoreEvaluation se = uce.getScoreAccounting().getScoreEvaluation(acnode);
          boolean nodeColumnOk = false;
          StringBuilder tabs = new StringBuilder();

          if (scoreOk) {
            Float score = se.getScore();
View Full Code Here

      Identity identity = (Identity) iter.next();
      if (identity != null){
        IdentityEnvironment ienv = new IdentityEnvironment();
        ienv.setIdentity(identity);
        ICourse course = CourseFactory.loadCourse(ores);
        UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
        ScoreEvaluation scoreEvaluation = uce.getScoreAccounting().getScoreEvaluation(courseNode);
       
        if (scoreEvaluation == null){
            nodeScores.add(translator.translate("bulk.action.no.value"));
        }else{
          Float nodeScore = scoreEvaluation.getScore();
View Full Code Here

   
    ICourse course = CourseFactory.loadCourse(repositoryEntry.getOlatResource());
    IdentityEnvironment ienv = new IdentityEnvironment();
    ienv.setIdentity(identity);
    ienv.setRoles(roles);
    UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
    if (log.isDebug()) log.debug("userCourseEnv=" + userCourseEnv + "ienv=" + ienv );
   
    CourseNode rootCn = userCourseEnv.getCourseEnvironment().getRunStructure().getRootNode();

    String nodeIdS = nodeId.toString();
    CourseNode courseNode = course.getRunStructure().getNode(nodeIdS);
    if (log.isDebug()) log.debug("courseNode=" + courseNode );
   
    TreeEvaluation treeEval = new TreeEvaluation();
    NodeEvaluation rootNodeEval = rootCn.eval(userCourseEnv.getConditionInterpreter(), treeEval);
    if (log.isDebug()) log.debug("rootNodeEval=" + rootNodeEval );

    TreeNode newCalledTreeNode = treeEval.getCorrespondingTreeNode(courseNode);
    if (newCalledTreeNode == null) {
      // TreeNode no longer visible
View Full Code Here

        //o_clusterOK: by ld
        OLATResourceable efficiencyStatementResourceable = am.createOLATResourceableForLocking(identity);
        CoordinatorManager.getCoordinator().getSyncer().doInSync(efficiencyStatementResourceable, new SyncerExecutor() {
          public void execute() {         
            // create temporary user course env
            UserCourseEnvironment uce = AssessmentHelper.createAndInitUserCourseEnvironment(identity, course);
            updateUserEfficiencyStatement(uce, re.getKey(), course, checkForExistingProperty);
            }
          });
        if (Thread.interrupted()) break;
      }
View Full Code Here

      }
     
      // select user
      this.assessedIdentityWrapper = AssessmentHelper.wrapIdentity(focusOnIdentity, this.localUserCourseEnvironmentCache, course, null);
     
      UserCourseEnvironment chooseUserCourseEnv = assessedIdentityWrapper.getUserCourseEnvironment();   
      identityAssessmentController = new IdentityAssessmentEditController(getWindowControl(),ureq, chooseUserCourseEnv, course, true);
      listenTo(identityAssessmentController);
      setContent(identityAssessmentController.getInitialComponent());
    }
   
View Full Code Here

TOP

Related Classes of org.olat.course.run.userview.UserCourseEnvironment

Copyright © 2018 www.massapicom. 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.