use of org.olat.course.nodes.ScormCourseNode in project OpenOLAT by OpenOLAT.
the class OLATUpgrade_12_0_0 method processCourseNodeAssessmentLastModified.
private boolean processCourseNodeAssessmentLastModified(ICourse course, RepositoryEntry entry, CourseNode courseNode, Set<Identity> changeSet) {
if (courseNode instanceof IQTESTCourseNode) {
updateTest(entry, (IQTESTCourseNode) courseNode, changeSet);
} else if (courseNode instanceof MSCourseNode) {
updateMS(entry, courseNode, changeSet);
} else if (courseNode instanceof ScormCourseNode) {
updateScorm(course, entry, courseNode, changeSet);
}
dbInstance.commitAndCloseSession();
for (int i = courseNode.getChildCount(); i-- > 0; ) {
CourseNode child = (CourseNode) courseNode.getChildAt(i);
processCourseNodeAssessmentLastModified(course, entry, child, changeSet);
}
return true;
}
use of org.olat.course.nodes.ScormCourseNode in project OpenOLAT by OpenOLAT.
the class ArchiverMainController method launchArchiveControllers.
private void launchArchiveControllers(UserRequest ureq, String menuCommand) {
if (menuCommand.equals(CMD_INDEX)) {
main.setContent(intro);
} else {
removeAsListenerAndDispose(contentCtr);
if (menuCommand.equals(CMD_QTISURVRESULTS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new IQSURVCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_QTITESTRESULTS)) {
contentCtr = new TestArchiveController(ureq, getWindowControl(), ores, new IQTESTCourseNode(), new IQSELFCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_SCOREACCOUNTING)) {
contentCtr = new ScoreAccountingArchiveController(ureq, getWindowControl(), ores);
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_ARCHIVELOGFILES)) {
contentCtr = new CourseLogsArchiveController(ureq, getWindowControl(), ores);
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_HANDEDINTASKS)) {
// TACourseNode
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new TACourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_GROUPTASKS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new GTACourseNode(), new GTACourseNode(GTACourseNode.TYPE_INDIVIDUAL));
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_PROJECTBROKER)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new ProjectBrokerCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_FORUMS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new FOCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_DIALOGS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new DialogCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_WIKIS)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new WikiCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_SCORM)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new ScormCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_CHECKLIST)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new CheckListCourseNode());
main.setContent(contentCtr.getInitialComponent());
} else if (menuCommand.equals(CMD_PARTICIPANTFOLDER)) {
contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new PFCourseNode());
main.setContent(contentCtr.getInitialComponent());
}
listenTo(contentCtr);
}
}
use of org.olat.course.nodes.ScormCourseNode in project openolat by klemens.
the class OLATUpgrade_11_0_0 method createAssessmentEntry.
private AssessmentEntryImpl createAssessmentEntry(Identity assessedIdentity, Property property, ICourse course, RepositoryEntry courseEntry, String nodeIdent) {
AssessmentEntryImpl entry = new AssessmentEntryImpl();
if (property == null) {
entry.setCreationDate(new Date());
entry.setLastModified(entry.getCreationDate());
} else {
entry.setCreationDate(property.getCreationDate());
entry.setLastModified(property.getLastModified());
}
entry.setIdentity(assessedIdentity);
entry.setRepositoryEntry(courseEntry);
entry.setSubIdent(nodeIdent);
entry.setAttempts(new Integer(0));
entry.setUserVisibility(Boolean.TRUE);
CourseNode courseNode = course.getRunStructure().getNode(nodeIdent);
if (courseNode != null) {
if (courseNode.needsReferenceToARepositoryEntry()) {
RepositoryEntry referenceEntry = courseNode.getReferencedRepositoryEntry();
entry.setReferenceEntry(referenceEntry);
}
if (courseNode instanceof GTACourseNode) {
processAssessmentPropertyForGTA(assessedIdentity, entry, (GTACourseNode) courseNode, courseEntry);
} else if (courseNode instanceof TACourseNode) {
processAssessmentPropertyForTA(assessedIdentity, entry, (TACourseNode) courseNode, course);
} else if (courseNode instanceof IQTESTCourseNode) {
processAssessmentPropertyForIQTEST(assessedIdentity, entry, (IQTESTCourseNode) courseNode, course);
} else if (courseNode instanceof PortfolioCourseNode) {
processAssessmentPropertyForPortfolio(assessedIdentity, entry, (PortfolioCourseNode) courseNode, course);
} else if (courseNode instanceof MSCourseNode) {
entry.setAssessmentStatus(AssessmentEntryStatus.inReview);
} else if (courseNode instanceof BasicLTICourseNode) {
processAssessmentPropertyForBasicLTI(assessedIdentity, entry, (BasicLTICourseNode) courseNode, course);
} else if (courseNode instanceof ScormCourseNode) {
String username = assessedIdentity.getName();
Map<Date, List<CmiData>> rawDatas = ScormAssessmentManager.getInstance().visitScoDatasMultiResults(username, course.getCourseEnvironment(), (ScormCourseNode) courseNode);
if (rawDatas != null && rawDatas.size() > 0) {
entry.setAssessmentStatus(AssessmentEntryStatus.inProgress);
} else {
entry.setAssessmentStatus(AssessmentEntryStatus.notStarted);
}
}
}
return entry;
}
use of org.olat.course.nodes.ScormCourseNode in project openolat by klemens.
the class OLATUpgrade_12_0_0 method processCourseNodeAssessmentLastModified.
private boolean processCourseNodeAssessmentLastModified(ICourse course, RepositoryEntry entry, CourseNode courseNode, Set<Identity> changeSet) {
if (courseNode instanceof IQTESTCourseNode) {
updateTest(entry, (IQTESTCourseNode) courseNode, changeSet);
} else if (courseNode instanceof MSCourseNode) {
updateMS(entry, courseNode, changeSet);
} else if (courseNode instanceof ScormCourseNode) {
updateScorm(course, entry, courseNode, changeSet);
}
dbInstance.commitAndCloseSession();
for (int i = courseNode.getChildCount(); i-- > 0; ) {
CourseNode child = (CourseNode) courseNode.getChildAt(i);
processCourseNodeAssessmentLastModified(course, entry, child, changeSet);
}
return true;
}
use of org.olat.course.nodes.ScormCourseNode in project openolat by klemens.
the class AssessmentNotificationsHandler method createSubscriptionInfo.
/**
* @see org.olat.core.commons.services.notifications.NotificationsHandler#createSubscriptionInfo(org.olat.core.commons.services.notifications.Subscriber,
* java.util.Locale, java.util.Date)
*/
public SubscriptionInfo createSubscriptionInfo(final Subscriber subscriber, Locale locale, Date compareDate) {
SubscriptionInfo si = null;
Publisher p = subscriber.getPublisher();
if (!NotificationsUpgradeHelper.checkCourse(p)) {
// course don't exist anymore
notificationsManager.deactivate(p);
return notificationsManager.getNoSubscriptionInfo();
}
try {
Date latestNews = p.getLatestNewsDate();
Identity identity = subscriber.getIdentity();
// can't be loaded when already deleted
if (notificationsManager.isPublisherValid(p) && compareDate.before(latestNews)) {
Long courseId = new Long(p.getData());
final ICourse course = loadCourseFromId(courseId);
if (courseStatus(course)) {
// course admins or users with the course right to have full access to
// the assessment tool will have full access to user tests
CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
final boolean hasFullAccess = (cgm.isIdentityCourseAdministrator(identity) ? true : cgm.hasRight(identity, CourseRights.RIGHT_ASSESSMENT));
final Set<Identity> coachedUsers = new HashSet<Identity>();
if (!hasFullAccess) {
// initialize list of users, only when user has not full access
List<BusinessGroup> coachedGroups = cgm.getOwnedBusinessGroups(identity);
List<Identity> coachedIdentites = businessGroupService.getMembers(coachedGroups, GroupRoles.participant.name());
coachedUsers.addAll(coachedIdentites);
}
List<AssessableCourseNode> testNodes = getCourseTestNodes(course);
Translator translator = Util.createPackageTranslator(AssessmentManager.class, locale);
for (AssessableCourseNode test : testNodes) {
List<AssessmentEntry> assessments = courseNodeAssessmentDao.loadAssessmentEntryBySubIdent(cgm.getCourseEntry(), test.getIdent());
for (AssessmentEntry assessment : assessments) {
Date modDate = assessment.getLastModified();
Identity assessedIdentity = assessment.getIdentity();
if (modDate.after(compareDate) && (hasFullAccess || coachedUsers.contains(assessedIdentity))) {
BigDecimal score = assessment.getScore();
if (test instanceof ScormCourseNode) {
ScormCourseNode scormTest = (ScormCourseNode) test;
// check if completed or passed
String status = ScormAssessmentManager.getInstance().getLastLessonStatus(assessedIdentity.getName(), course.getCourseEnvironment(), scormTest);
if (!"passed".equals(status) && !"completed".equals(status)) {
continue;
}
}
String desc;
String type = translator.translate("notifications.entry." + test.getType());
if (score == null) {
desc = translator.translate("notifications.entry.attempt", new String[] { test.getShortTitle(), NotificationHelper.getFormatedName(assessedIdentity), type });
} else {
String scoreStr = AssessmentHelper.getRoundedScore(score);
desc = translator.translate("notifications.entry", new String[] { test.getShortTitle(), NotificationHelper.getFormatedName(assessedIdentity), scoreStr, type });
}
String urlToSend = null;
String businessPath = null;
if (p.getBusinessPath() != null) {
businessPath = p.getBusinessPath() + "[Users:0][Node:" + test.getIdent() + "][Identity:" + assessedIdentity.getKey() + "]";
urlToSend = BusinessControlFactory.getInstance().getURLFromBusinessPathString(businessPath);
}
SubscriptionListItem subListItem = new SubscriptionListItem(desc, urlToSend, businessPath, modDate, CSS_CLASS_USER_ICON);
if (si == null) {
String title = translator.translate("notifications.header", new String[] { course.getCourseTitle() });
String css = CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(test.getType()).getIconCSSClass();
si = new SubscriptionInfo(subscriber.getKey(), p.getType(), new TitleItem(title, css), null);
}
si.addSubscriptionListItem(subListItem);
}
}
}
}
}
if (si == null) {
si = notificationsManager.getNoSubscriptionInfo();
}
return si;
} catch (Exception e) {
log.error("Error while creating assessment notifications", e);
checkPublisher(p);
return notificationsManager.getNoSubscriptionInfo();
}
}
Aggregations