use of org.olat.modules.scorm.server.beans.LMSResultsBean in project openolat by klemens.
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.LMSResultsBean in project openolat by klemens.
the class OLATApiAdapter method getPreviousSco.
/**
* @param recentId
* @return the previos Sco itemId
*/
public Integer getPreviousSco(String recentId) {
// TODO:gs make method faster by caching lmsBean, but when to set out of date?
LMSDataFormBean lmsDataBean = new LMSDataFormBean();
lmsDataBean.setItemID(recentId);
lmsDataBean.setLmsAction("get");
odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
LMSResultsBean lmsBean = odatahandler.getResultsBean();
String[][] pretable = lmsBean.getPreReqTable();
String previousNavScoId = "-1";
for (int i = 0; i < pretable.length; i++) {
if (pretable[i][0].equals(recentId) && (i != 0)) {
previousNavScoId = pretable[--i][0];
break;
}
}
return new Integer(previousNavScoId);
}
use of org.olat.modules.scorm.server.beans.LMSResultsBean in project openolat by klemens.
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.LMSResultsBean in project openolat by klemens.
the class OLATApiAdapter method getNextSco.
/**
* @param recentId
* @return the next Sco itemId
*/
public Integer getNextSco(String recentId) {
// TODO:gs make method faster by chaching lmsBean, but when to set out of date?
LMSDataFormBean lmsDataBean = new LMSDataFormBean();
lmsDataBean.setItemID(recentId);
lmsDataBean.setLmsAction("get");
odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
LMSResultsBean lmsBean = odatahandler.getResultsBean();
String[][] pretable = lmsBean.getPreReqTable();
String nextNavScoId = "-1";
for (int i = 0; i < pretable.length; i++) {
if (pretable[i][0].equals(recentId) && (i != pretable.length - 1)) {
nextNavScoId = pretable[++i][0];
break;
}
}
return new Integer(nextNavScoId);
}
use of org.olat.modules.scorm.server.beans.LMSResultsBean in project OpenOLAT by OpenOLAT.
the class OLATApiAdapter method getNextSco.
/**
* @param recentId
* @return the next Sco itemId
*/
public Integer getNextSco(String recentId) {
// TODO:gs make method faster by chaching lmsBean, but when to set out of date?
LMSDataFormBean lmsDataBean = new LMSDataFormBean();
lmsDataBean.setItemID(recentId);
lmsDataBean.setLmsAction("get");
odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
LMSResultsBean lmsBean = odatahandler.getResultsBean();
String[][] pretable = lmsBean.getPreReqTable();
String nextNavScoId = "-1";
for (int i = 0; i < pretable.length; i++) {
if (pretable[i][0].equals(recentId) && (i != pretable.length - 1)) {
nextNavScoId = pretable[++i][0];
break;
}
}
return new Integer(nextNavScoId);
}
Aggregations