コード例 #1
0
  private void loadModel(UserRequest ureq) {
    IdentityEnvironment identityEnv = ureq.getUserSession().getIdentityEnvironment();

    List<Binder> currentBinders =
        portfolioService.searchOwnedBindersFromCourseTemplate(getIdentity());
    Set<CurrentBinder> currentSet = new HashSet<>();
    for (Binder currentBinder : currentBinders) {
      Long courseEntryKey = currentBinder.getEntry().getKey();
      String nodeIdent = currentBinder.getSubIdent();
      currentSet.add(new CurrentBinder(courseEntryKey, nodeIdent));
    }

    List<RepositoryEntry> entries = portfolioService.searchCourseWithBinderTemplates(getIdentity());
    List<CourseTemplateRow> rows = new ArrayList<>(entries.size());
    for (RepositoryEntry entry : entries) {
      ICourse course = CourseFactory.loadCourse(entry);
      UserCourseEnvironment uce =
          new UserCourseEnvironmentImpl(identityEnv, course.getCourseEnvironment());
      uce.getScoreAccounting().evaluateAll();

      CourseNode rootNode = uce.getCourseEnvironment().getRunStructure().getRootNode();
      loadCourseModel(rootNode, uce, rows, currentSet);
    }

    model.setObjects(rows);
    tableEl.reset();
    tableEl.reloadData();
  }
コード例 #2
0
 @Override
 protected void event(UserRequest ureq, Controller source, Event event) {
   if (commentCalloutCtrl == source) {
     cleanUp();
   } else if (editCommentCtrl == source) {
     if (event == Event.DONE_EVENT) {
       table.reset();
     }
     commentCalloutCtrl.deactivate();
     cleanUp();
   }
   super.event(ureq, source, event);
 }
コード例 #3
0
 private void loadTable() {
   // Hardcoded same as VideoAdminSetController
   int[] resolution = {2160, 1080, 720, 480, 360, 240};
   // FIXME:FK fetch using one single SQL query
   for (int i = 0; i < resolution.length; i++) {
     int sizeOfTranscodings = availableTranscodings.get(resolution[i]).size();
     int counter = 0;
     for (OLATResource videoResource : olatresources) {
       VideoMetadata videoMetadata = videoManager.readVideoMetadataFile(videoResource);
       if (videoMetadata != null && videoMetadata.getHeight() >= resolution[i]) counter++;
     }
     resolutions.add(
         new TranscodingRow(
             resolution[i], sizeOfTranscodings, counter, mayTranscode(resolution[i])));
   }
   if (resolutions != null) tableModel.setObjects(resolutions);
   transcodingTable.reset(true, true, true);
 }
コード例 #4
0
  private void updateModel() {
    List<Solution> solutionList = solutions.getSolutions();
    List<SolutionRow> rows = new ArrayList<>(solutionList.size());
    for (Solution solution : solutionList) {
      String filename = solution.getFilename();
      String author = null;

      VFSItem item = solutionContainer.resolve(filename);
      if (item instanceof MetaTagged) {
        MetaInfo metaInfo = ((MetaTagged) item).getMetaInfo();
        if (metaInfo != null && metaInfo.getAuthorIdentityKey() != null) {
          author = userManager.getUserDisplayName(metaInfo.getAuthorIdentityKey());
        }
      }

      rows.add(new SolutionRow(solution, author));
    }
    solutionModel.setObjects(rows);
    solutionTable.reset();
  }
コード例 #5
0
  /**
   * Perform a search for the given search value in the search result providers and clear any GUI
   * errors that might be on the page
   *
   * @param searchValue
   * @param ureq
   */
  private void doSearchGroups(String searchValue, UserRequest ureq) {
    if (StringHelper.containsNonWhitespace(searchValue)) {
      SearchBusinessGroupParams param1s = new SearchBusinessGroupParams();
      param1s.setNameOrDesc(searchValue);
      List<BusinessGroup> group1s = businessGroupService.findBusinessGroups(param1s, null, 0, -1);
      filterGroups(group1s);

      SearchBusinessGroupParams param2s = new SearchBusinessGroupParams();
      param2s.setCourseTitle(searchValue);
      List<BusinessGroup> group2s = businessGroupService.findBusinessGroups(param2s, null, 0, -1);
      filterGroups(group2s);

      List<BusinessGroup> groups = new ArrayList<BusinessGroup>(group1s.size() + group2s.size());
      groups.addAll(group1s);
      groups.addAll(group2s);

      List<Long> groupKeysWithRelations = PersistenceHelper.toKeys(groups);
      List<BGRepositoryEntryRelation> resources =
          businessGroupService.findRelationToRepositoryEntries(groupKeysWithRelations, 0, -1);

      List<GroupWrapper> groupWrappers = new ArrayList<GroupWrapper>();
      for (BusinessGroup group : groups) {
        StringBuilder sb = new StringBuilder();
        for (BGRepositoryEntryRelation resource : resources) {
          if (resource.getGroupKey().equals(group.getKey())) {
            if (sb.length() > 0) sb.append(", ");
            sb.append(resource.getRepositoryEntryDisplayName());
          }
        }

        GroupWrapper wrapper = new GroupWrapper(group, sb.toString());
        wrapper.setTutor(createSelection("tutor_" + group.getKey()));
        wrapper.setParticipant(createSelection("participant_" + group.getKey()));
        groupWrappers.add(wrapper);
      }

      table.reset();
      tableDataModel.setObjects(groupWrappers);
      errorComp.clearError();
    }
  }
コード例 #6
0
  /** @return True if all results are the same */
  private ModelInfos loadModel() {
    // load participants, load datas
    ICourse course = CourseFactory.loadCourse(courseEnv.getCourseResourceableId());
    List<Identity> identities =
        businessGroupService.getMembers(assessedGroup, GroupRoles.participant.name());

    Map<Identity, AssessmentEntry> identityToEntryMap = new HashMap<>();
    List<AssessmentEntry> entries =
        course
            .getCourseEnvironment()
            .getAssessmentManager()
            .getAssessmentEntries(assessedGroup, gtaNode);
    for (AssessmentEntry entry : entries) {
      identityToEntryMap.put(entry.getIdentity(), entry);
    }

    int count = 0;
    boolean same = true;
    StringBuilder duplicateWarning = new StringBuilder();
    Float scoreRef = null;
    Boolean passedRef = null;
    String commentRef = null;

    List<AssessmentRow> rows = new ArrayList<>(identities.size());
    for (Identity identity : identities) {
      AssessmentEntry entry = identityToEntryMap.get(identity);

      ScoreEvaluation scoreEval = null;
      if (withScore || withPassed) {
        scoreEval = gtaNode.getUserScoreEvaluation(entry);
        if (scoreEval == null) {
          scoreEval = ScoreEvaluation.EMPTY_EVALUATION;
        }
      }

      String comment = null;
      if (withComment && entry != null) {
        comment = entry.getComment();
      }

      boolean duplicate = duplicateMemberKeys.contains(identity.getKey());
      if (duplicate) {
        if (duplicateWarning.length() > 0) duplicateWarning.append(", ");
        duplicateWarning.append(StringHelper.escapeHtml(userManager.getUserDisplayName(identity)));
      }

      AssessmentRow row = new AssessmentRow(identity, duplicate);
      rows.add(row);

      if (withScore) {
        Float score = scoreEval.getScore();
        String pointVal = AssessmentHelper.getRoundedScore(score);
        TextElement pointEl = uifactory.addTextElement("point" + count, null, 5, pointVal, flc);
        pointEl.setDisplaySize(5);
        row.setScoreEl(pointEl);
        if (count == 0) {
          scoreRef = score;
        } else if (!same(scoreRef, score)) {
          same = false;
        }
      }

      if (withPassed && cutValue == null) {
        Boolean passed = scoreEval.getPassed();
        MultipleSelectionElement passedEl =
            uifactory.addCheckboxesHorizontal("check" + count, null, flc, onKeys, onValues);
        if (passed != null && passed.booleanValue()) {
          passedEl.select(onKeys[0], passed.booleanValue());
        }
        row.setPassedEl(passedEl);
        if (count == 0) {
          passedRef = passed;
        } else if (!same(passedRef, passed)) {
          same = false;
        }
      }

      if (withComment) {
        FormLink commentLink =
            uifactory.addFormLink(
                "comment-" + CodeHelper.getRAMUniqueID(),
                "comment",
                "comment",
                null,
                flc,
                Link.LINK);
        if (StringHelper.containsNonWhitespace(comment)) {
          commentLink.setIconLeftCSS("o_icon o_icon_comments");
        } else {
          commentLink.setIconLeftCSS("o_icon o_icon_comments_none");
        }
        commentLink.setUserObject(row);
        row.setComment(comment);
        row.setCommentEditLink(commentLink);

        if (count == 0) {
          commentRef = comment;
        } else if (!same(commentRef, comment)) {
          same = false;
        }
      }

      count++;
    }

    model.setObjects(rows);
    table.reset();

    return new ModelInfos(same, scoreRef, passedRef, commentRef, duplicateWarning.toString());
  }