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();
}
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;
}
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);
}
}
}
}
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");
}
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;
}
Aggregations