use of org.olat.modules.scorm.server.servermodels.ScoDocument in project OpenOLAT by OpenOLAT.
the class ScormAssessmentManager method collectData.
/**
* Collects the cmi data of the given Scorm-file.
* @param scoFile
* @return
*/
private List<CmiData> collectData(VFSItem scoFile) {
List<CmiData> datas = new ArrayList<CmiData>();
ScoDocument document = new ScoDocument(null);
try {
if (scoFile instanceof LocalFileImpl) {
document.loadDocument(((LocalFileImpl) scoFile).getBasefile());
} else {
logger.warn("Cannot use this type of VSFItem to load a SCO Datamodel: " + scoFile.getClass().getName(), null);
return null;
}
String fileName = scoFile.getName();
String itemId = fileName.substring(0, fileName.length() - 4);
String[][] scoModel = document.getScoModel();
for (String[] line : scoModel) {
datas.add(new CmiData(itemId, line[0], line[1]));
}
} catch (Exception e) {
logger.error("Cannot load a SCO Datamodel", e);
}
return datas;
}
use of org.olat.modules.scorm.server.servermodels.ScoDocument in project openolat by klemens.
the class ItemSequence method loadInModel.
/**
* Method to associate and load in the cmi model for this sco (if it is one)
*/
public void loadInModel() {
// cmi data model we created when importing the package
if (isItemSco()) {
if (_scoitemID != null) {
ScoDocument anSco = new ScoDocument(settings);
anSco.loadDocument(_scoitemID);
_scoDataModel = anSco;
}
}
}
use of org.olat.modules.scorm.server.servermodels.ScoDocument in project openolat by klemens.
the class ScormExportManager method collectData.
private void collectData(String username, VFSContainer scoFolder, ScormExportVisitor visitor) {
List<VFSItem> contents = scoFolder.getItems(new XMLFilter());
for (VFSItem file : contents) {
ScoDocument document = new ScoDocument(null);
try {
if (file instanceof LocalFileImpl) {
document.loadDocument(((LocalFileImpl) file).getBasefile());
} else {
logger.warn("Cannot use this type of VSFItem to load a SCO Datamodel: " + file.getClass().getName(), null);
continue;
}
String[][] scoModel = document.getScoModel();
ScoDatas parsedDatas = parseScoModel(file.getName(), username, scoModel);
visitor.visit(parsedDatas);
} catch (Exception e) {
logger.error("Cannot load a SCO Datamodel", e);
}
}
}
use of org.olat.modules.scorm.server.servermodels.ScoDocument in project OpenOLAT by OpenOLAT.
the class ScormExportManager method collectData.
private void collectData(String username, VFSContainer scoFolder, ScormExportVisitor visitor) {
List<VFSItem> contents = scoFolder.getItems(new XMLFilter());
for (VFSItem file : contents) {
ScoDocument document = new ScoDocument(null);
try {
if (file instanceof LocalFileImpl) {
document.loadDocument(((LocalFileImpl) file).getBasefile());
} else {
logger.warn("Cannot use this type of VSFItem to load a SCO Datamodel: " + file.getClass().getName(), null);
continue;
}
String[][] scoModel = document.getScoModel();
ScoDatas parsedDatas = parseScoModel(file.getName(), username, scoModel);
visitor.visit(parsedDatas);
} catch (Exception e) {
logger.error("Cannot load a SCO Datamodel", e);
}
}
}
use of org.olat.modules.scorm.server.servermodels.ScoDocument in project OpenOLAT by OpenOLAT.
the class ItemSequence method loadInModel.
/**
* Method to associate and load in the cmi model for this sco (if it is one)
*/
public void loadInModel() {
// cmi data model we created when importing the package
if (isItemSco()) {
if (_scoitemID != null) {
ScoDocument anSco = new ScoDocument(settings);
anSco.loadDocument(_scoitemID);
_scoDataModel = anSco;
}
}
}
Aggregations