Package org.olat.course.nodes.scorm

Source Code of org.olat.course.nodes.scorm.ChooseScormRunModeForm

/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br>
* University of Zurich, Switzerland.
* <p>
*/

package org.olat.course.nodes.scorm;

import org.olat.core.gui.components.form.Form;
import org.olat.core.gui.formelements.StaticSingleSelectionElement;
import org.olat.core.gui.translator.Translator;
import org.olat.modules.scorm.ScormConstants;

/**
* Description:<br>
* Let the student decide in which mode he likes to run his scorm package.
*
* <P>
* Initial Date:  08.09.2005 <br>
* @author guido
*/
public class ChooseScormRunModeForm extends Form {

  protected static final String SCORM_MODES = "scormModes";

  /**
   * @param name
   */
  public ChooseScormRunModeForm(String name, Translator translator, boolean showOptions) {
    super(name, translator);
    init(showOptions);
  }

  /**
   * form definition
   */
  public void init(boolean showOptions) {
    if (showOptions) {
      String[] scormModesKeys = new String[] {ScormConstants.SCORM_MODE_NORMAL, ScormConstants.SCORM_MODE_BROWSE, ScormConstants.SCORM_MODE_NOCREDIT};
      String[] scormModesValues = new String[] {
          translate("form.scormmode.normal"),
          translate("form.scormmode.browse"),
          translate("form.scormmode.nocredit")};
      addFormElement(SCORM_MODES, new StaticSingleSelectionElement("form.scormmode", scormModesKeys, scormModesValues));
    }
    setSubmitKey("command.showscorm");
  }

  /**
   * @see org.olat.core.gui.components.Form#validate(org.olat.core.gui.UserRequest)
   */
  public boolean validate() {
    return true;
  }
 
  /**
   *
   * @return the key of the selected element in the dropdown
   */
  public String getSelectedElement(){
    return getSingleSelectionElement(SCORM_MODES).getSelectedKey();
  }
}
TOP

Related Classes of org.olat.course.nodes.scorm.ChooseScormRunModeForm

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.