Package org.olat.ims.qti.container

Examples of org.olat.ims.qti.container.SectionContext


   */
  public void goToItem(int sectionPos, int itemPos) {
    if (getInfo().getStatus() != QTIConstants.ASSESSMENT_RUNNING) throw new RuntimeException("assessment is NOT running yet or anymore");
    clearInfo();
    AssessmentContext ac = getAssessmentContext();
    SectionContext sc = ac.getSectionContext(sectionPos);
    ItemContext target = sc.getItemContext(itemPos);
    // check if targeted item is still open
   
    if (!ac.isOpen()) {
      getInfo().setError(QTIConstants.ERROR_ASSESSMENT_OUTOFTIME);
      getInfo().setRenderItems(false)
    } else if (!sc.isOpen()) {
      getInfo().setError(QTIConstants.ERROR_SECTION_OUTOFTIME);
      getInfo().setRenderItems(false)
    } else if (!target.isOpen()) {
      getInfo().setError(QTIConstants.ERROR_ITEM_OUTOFTIME);
      getInfo().setRenderItems(false)
    else {
      getInfo().setStatus(QTIConstants.ASSESSMENT_RUNNING);
      getInfo().setRenderItems(true);
      ac.setCurrentSectionContextPos(sectionPos);
      sc.start();
      sc.setCurrentItemContextPos(itemPos);
      sc.getCurrentItemContext().start();
    }
    getAssessmentInstance().persist();
  }
View Full Code Here


  public void goToSection(int sectionPos) {
    if (getInfo().getStatus() != QTIConstants.ASSESSMENT_RUNNING) throw new RuntimeException("assessment is NOT running yet or anymore");   
    clearInfo();
    AssessmentContext ac = getAssessmentContext();
    ac.setCurrentSectionContextPos(sectionPos);
    SectionContext sc = ac.getCurrentSectionContext();
    if (!ac.isOpen()) {
      getInfo().setError(QTIConstants.ERROR_ASSESSMENT_OUTOFTIME);
      getInfo().setRenderItems(false)
    } else if (!sc.isOpen()) {
      getInfo().setError(QTIConstants.ERROR_SECTION_OUTOFTIME);
      getInfo().setRenderItems(false)
    else {
      sc.setCurrentItemContextPos(-1); // no current item position, since we display section info only
      sc.start();
      getInfo().setStatus(QTIConstants.ASSESSMENT_RUNNING);
      getInfo().setRenderItems(false); // only section info
      getInfo().setMessage(QTIConstants.MESSAGE_SECTION_INFODEMANDED);
    }
    getAssessmentInstance().persist();
View Full Code Here

   * @see org.olat.ims.qti.navigator.Navigator#submitItems(org.olat.ims.qti.container.ItemsInput)
   */
  public void submitItems(ItemsInput curitsinp) {
    clearInfo();
    AssessmentContext ac = getAssessmentContext();
    SectionContext sc = ac.getCurrentSectionContext();
    int st = submitOneItem(curitsinp);
    if (st != QTIConstants.ITEM_SUBMITTED) {
      // time expired or too many attempts-> display a message above the next
      // item or assessment-finished-text
      if (st == QTIConstants.ERROR_SUBMITTEDITEM_TOOMANYATTEMPTS) {
        throw new RuntimeException("import check failed: there was a maxattempts in a item, but mode is sequential/item");
      } else if (st == QTIConstants.ERROR_ASSESSMENT_OUTOFTIME) {
        getInfo().setError(st);
        getInfo().setRenderItems(false);
      } else if (st == QTIConstants.ERROR_SUBMITTEDITEM_OUTOFTIME) {
        getInfo().setError(st);
        getInfo().setRenderItems(true); // still continue to next item
      }
    } else { // ok, display feedback
      ItemContext itc = getAssessmentContext().getCurrentSectionContext().getCurrentItemContext();
      Output outp = itc.getOutput();
      if (outp != null) getInfo().setCurrentOutput(outp);
      // check on item feedback
      if (itc.isFeedback()) { // feedback allowed
        getInfo().setFeedback(itc.getOutput().hasItem_Responses());
      }
      getInfo().setMessage(QTIConstants.MESSAGE_ITEM_SUBMITTED);
      getInfo().setRenderItems(true);
    }

    // find next item
    int itpos = sc.getCurrentItemContextPos();
    if (itpos < sc.getItemContextCount() - 1 && sc.isOpen()) {
      //there are still further items in the current section
      sc.setCurrentItemContextPos(++itpos);
      sc.getCurrentItemContext().start();
    } else { // fetch next section     
      if (!sc.isOpen()) {
        getInfo().setError(QTIConstants.ERROR_SECTION_OUTOFTIME);
        getInfo().setRenderItems(true);
      }
      ac.getCurrentSectionContext().sectionWasSubmitted();

View Full Code Here

   * @see org.olat.ims.qti.navigator.Navigator#goToItem(int, int)
   */
  public void goToItem(int sectionPos, int itemPos) {     
    AssessmentContext ac = getAssessmentContext();
    ac.setCurrentSectionContextPos(sectionPos);
    SectionContext sc = ac.getCurrentSectionContext();
    sc.setCurrentItemContextPos(itemPos);
    getInfo().setRenderItems(true);
    getInfo().setMessage(QTIConstants.MESSAGE_NONE);
  }
View Full Code Here

TOP

Related Classes of org.olat.ims.qti.container.SectionContext

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.