Search in sources :

Example 1 with LMSDataFormBean

use of org.olat.modules.scorm.server.beans.LMSDataFormBean in project OpenOLAT by OpenOLAT.

the class OLATApiAdapter method getScormLastAccessedItemId.

/**
 * @return a String that points to the last accessed sco itemId
 */
public String getScormLastAccessedItemId() {
    LMSDataFormBean lmsDataBean = new LMSDataFormBean();
    lmsDataBean.setLmsAction("boot");
    odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
    LMSResultsBean lmsBean = odatahandler.getResultsBean();
    return lmsBean.getItemID();
}
Also used : LMSResultsBean(org.olat.modules.scorm.server.beans.LMSResultsBean) LMSDataHandler(org.olat.modules.scorm.server.beans.LMSDataHandler) LMSDataFormBean(org.olat.modules.scorm.server.beans.LMSDataFormBean)

Example 2 with LMSDataFormBean

use of org.olat.modules.scorm.server.beans.LMSDataFormBean in project OpenOLAT by OpenOLAT.

the class OLATApiAdapter method getScoItemsStatus.

/**
 * @return Map containing the recent sco items status
 */
public Map<String, String> getScoItemsStatus() {
    LMSDataFormBean lmsDataBean = new LMSDataFormBean();
    lmsDataBean.setLmsAction("boot");
    odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
    LMSResultsBean lmsBean = odatahandler.getResultsBean();
    String[][] preReqTbl = lmsBean.getPreReqTable();
    Map<String, String> itemsStatus = new HashMap<String, String>();
    // put table into map
    for (int i = 0; i < preReqTbl.length; i++) {
        if (preReqTbl[i][1].equals("not attempted"))
            preReqTbl[i][1] = "not_attempted";
        itemsStatus.put(preReqTbl[i][0], preReqTbl[i][1]);
    }
    return itemsStatus;
}
Also used : HashMap(java.util.HashMap) LMSResultsBean(org.olat.modules.scorm.server.beans.LMSResultsBean) LMSDataHandler(org.olat.modules.scorm.server.beans.LMSDataHandler) LMSDataFormBean(org.olat.modules.scorm.server.beans.LMSDataFormBean)

Example 3 with LMSDataFormBean

use of org.olat.modules.scorm.server.beans.LMSDataFormBean in project OpenOLAT by OpenOLAT.

the class OLATApiAdapter method launchItem.

/**
 * @param sahs_id
 */
public final void launchItem(String scoId) {
    if (isLaunching) {
        say("SCO " + olatScoId + " is launching.");
        return;
    }
    if (isLaunched && scoId.equals(olatScoId)) {
        say("SCO " + scoId + " is already running.");
        return;
    }
    olatScoCmi.clear();
    say("Launching sahs " + scoId);
    if (isLaunched) {
        say("SCO " + olatScoId + " will be unloaded.");
    } else {
        isLaunching = true;
        olatScoId = scoId;
        // putting all cmi from the olat storage to the local storage
        LMSDataFormBean lmsDataBean = new LMSDataFormBean();
        lmsDataBean.setItemID(scoId);
        lmsDataBean.setLmsAction("get");
        odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
        LMSResultsBean lmsBean = odatahandler.getResultsBean();
        olatScoCmi.clear();
        String[][] strArr = lmsBean.getCmiStrings();
        String key = "";
        String value = "";
        if (strArr != null) {
            for (int i = 0; i < strArr.length; i++) {
                key = strArr[i][0];
                value = strArr[i][1];
                olatScoCmi.put(key, value);
                logDebug("passing cmi data to api adapter: " + key + ": " + value);
            }
        }
    }
}
Also used : LMSResultsBean(org.olat.modules.scorm.server.beans.LMSResultsBean) LMSDataHandler(org.olat.modules.scorm.server.beans.LMSDataHandler) LMSDataFormBean(org.olat.modules.scorm.server.beans.LMSDataFormBean)

Example 4 with LMSDataFormBean

use of org.olat.modules.scorm.server.beans.LMSDataFormBean in project OpenOLAT by OpenOLAT.

the class OLATApiAdapter method hasItemPrerequisites.

/**
 * @param itemId
 * @return true if item has any not fullfilled preconditions
 */
public boolean hasItemPrerequisites(String itemId) {
    // TODO:gs make method faster by caching lmsBean, but when to set out of date?
    LMSDataFormBean lmsDataBean = new LMSDataFormBean();
    lmsDataBean.setItemID(itemId);
    lmsDataBean.setLmsAction("get");
    odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
    LMSResultsBean lmsBean = odatahandler.getResultsBean();
    return lmsBean.getHasPrerequisites().equals("true");
}
Also used : LMSResultsBean(org.olat.modules.scorm.server.beans.LMSResultsBean) LMSDataHandler(org.olat.modules.scorm.server.beans.LMSDataHandler) LMSDataFormBean(org.olat.modules.scorm.server.beans.LMSDataFormBean)

Example 5 with LMSDataFormBean

use of org.olat.modules.scorm.server.beans.LMSDataFormBean in project openolat by klemens.

the class OLATApiAdapter method getScoItemsStatus.

/**
 * @return Map containing the recent sco items status
 */
public Map<String, String> getScoItemsStatus() {
    LMSDataFormBean lmsDataBean = new LMSDataFormBean();
    lmsDataBean.setLmsAction("boot");
    odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
    LMSResultsBean lmsBean = odatahandler.getResultsBean();
    String[][] preReqTbl = lmsBean.getPreReqTable();
    Map<String, String> itemsStatus = new HashMap<String, String>();
    // put table into map
    for (int i = 0; i < preReqTbl.length; i++) {
        if (preReqTbl[i][1].equals("not attempted"))
            preReqTbl[i][1] = "not_attempted";
        itemsStatus.put(preReqTbl[i][0], preReqTbl[i][1]);
    }
    return itemsStatus;
}
Also used : HashMap(java.util.HashMap) LMSResultsBean(org.olat.modules.scorm.server.beans.LMSResultsBean) LMSDataHandler(org.olat.modules.scorm.server.beans.LMSDataHandler) LMSDataFormBean(org.olat.modules.scorm.server.beans.LMSDataFormBean)

Aggregations

LMSDataFormBean (org.olat.modules.scorm.server.beans.LMSDataFormBean)16 LMSDataHandler (org.olat.modules.scorm.server.beans.LMSDataHandler)16 LMSResultsBean (org.olat.modules.scorm.server.beans.LMSResultsBean)14 HashMap (java.util.HashMap)4 BufferedOutputStream (java.io.BufferedOutputStream)2 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 OutputStream (java.io.OutputStream)2 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)2