use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.
the class CheckListCourseNode method updateOnPublish.
@Override
public void updateOnPublish(Locale locale, ICourse course, Identity publisher, PublishEvents publishEvents) {
ModuleConfiguration config = getModuleConfiguration();
// sync the checkbox with the database
CheckboxList list = (CheckboxList) config.get(CONFIG_KEY_CHECKBOX);
CheckboxManager checkboxManager = CoreSpringFactory.getImpl(CheckboxManager.class);
checkboxManager.syncCheckbox(list, course, getIdent());
CoursePropertyManager pm = course.getCourseEnvironment().getCoursePropertyManager();
List<Identity> assessedUsers = pm.getAllIdentitiesWithCourseAssessmentData(null);
int count = 0;
for (Identity assessedIdentity : assessedUsers) {
updateScorePassedOnPublish(assessedIdentity, publisher, checkboxManager, course);
if (++count % 10 == 0) {
DBFactory.getInstance().commitAndCloseSession();
}
}
DBFactory.getInstance().commitAndCloseSession();
super.updateOnPublish(locale, course, publisher, publishEvents);
}
use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.
the class ForumNodeForumCallback method informOnDelete.
/**
* @see org.olat.course.nodes.CourseNode#informOnDelete(org.olat.core.gui.UserRequest,
* org.olat.course.ICourse)
*/
@Override
public String informOnDelete(Locale locale, ICourse course) {
CoursePropertyManager cpm = PersistingCoursePropertyManager.getInstance(course);
Property forumKeyProperty = cpm.findCourseNodeProperty(this, null, null, FORUM_KEY);
// no forum created yet
if (forumKeyProperty == null)
return null;
return new PackageTranslator(PACKAGE_FO, locale).translate("warn.forumdelete");
}
use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.
the class TaskController method setAssignedTask.
private void setAssignedTask(Identity identity, String task) {
CoursePropertyManager cpm = courseEnv.getCoursePropertyManager();
Property p = cpm.createCourseNodePropertyInstance(node, identity, null, PROP_ASSIGNED, null, null, task, null);
cpm.saveProperty(p);
AssessmentEvaluation eval = node.getUserScoreEvaluation(userCourseEnv);
if (eval.getAssessmentStatus() == null || eval.getAssessmentStatus() == AssessmentEntryStatus.notStarted) {
eval = new AssessmentEvaluation(eval, AssessmentEntryStatus.inProgress);
node.updateUserScoreEvaluation(eval, userCourseEnv, getIdentity(), false, Role.user);
}
}
use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.
the class TaskController method removeAssignedTask.
/**
* Cancel the task assignment.
* @param identity
* @param task
*/
private void removeAssignedTask(Identity identity) {
CoursePropertyManager cpm = courseEnv.getCoursePropertyManager();
// remove assigned
List<Property> properties = cpm.findCourseNodeProperties(node, identity, null, PROP_ASSIGNED);
if (properties != null && properties.size() > 0) {
Property propety = properties.get(0);
cpm.deleteProperty(propety);
assignedTask = null;
}
// removed sampled
properties = courseEnv.getCoursePropertyManager().findCourseNodeProperties(node, null, null, PROP_SAMPLED);
if (properties != null && properties.size() > 0) {
Property propety = properties.get(0);
cpm.deleteProperty(propety);
}
}
use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.
the class ProjectBrokerExportGenerator method createCourseResultsOverviewTable.
/**
* The results from assessable nodes are written to one row per user into an excel-sheet. An
* assessable node will only appear if it is producing at least one of the
* following variables: score, passed, attempts, comments.
*
* @param identities
* @param myNodes
* @param course
* @param locale
* @return String
*/
public static String createCourseResultsOverviewTable(CourseNode courseNode, ICourse course, Locale locale) {
Translator translator = Util.createPackageTranslator(ProjectBrokerControllerFactory.class, locale);
StringBuilder table = new StringBuilder();
ProjectBrokerModuleConfiguration moduleConfig = new ProjectBrokerModuleConfiguration(courseNode.getModuleConfiguration());
ProjectBrokerManager projectBrokerManager = CoreSpringFactory.getImpl(ProjectBrokerManager.class);
// load project-list
CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
Long projectBrokerId = projectBrokerManager.getProjectBrokerId(cpm, courseNode);
if (projectBrokerId != null) {
List<Project> projects = projectBrokerManager.getProjectListBy(projectBrokerId);
// build table-header
table.append(createHeaderLine(translator, moduleConfig));
// loop over all projects
for (Project project : projects) {
table.append(createProjectDataLine(translator, project, moduleConfig, translator));
}
} else {
log.debug("projectBrokerId is null, courseNode=" + courseNode + " , course=" + course);
}
return table.toString();
}
Aggregations