Search in sources :

Example 16 with CoursePropertyManager

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);
}
Also used : CheckboxManager(org.olat.course.nodes.cl.CheckboxManager) CheckboxList(org.olat.course.nodes.cl.model.CheckboxList) ModuleConfiguration(org.olat.modules.ModuleConfiguration) Identity(org.olat.core.id.Identity) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 17 with CoursePropertyManager

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");
}
Also used : PackageTranslator(org.olat.core.gui.translator.PackageTranslator) Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager) PersistingCoursePropertyManager(org.olat.course.properties.PersistingCoursePropertyManager)

Example 18 with CoursePropertyManager

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);
    }
}
Also used : AssessmentEvaluation(org.olat.course.run.scoring.AssessmentEvaluation) Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 19 with CoursePropertyManager

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);
    }
}
Also used : Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 20 with CoursePropertyManager

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();
}
Also used : Project(org.olat.course.nodes.projectbroker.datamodel.Project) Translator(org.olat.core.gui.translator.Translator) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Aggregations

CoursePropertyManager (org.olat.course.properties.CoursePropertyManager)108 Property (org.olat.properties.Property)62 PersistingCoursePropertyManager (org.olat.course.properties.PersistingCoursePropertyManager)44 Identity (org.olat.core.id.Identity)28 File (java.io.File)18 ICourse (org.olat.course.ICourse)18 ProjectBrokerManager (org.olat.course.nodes.projectbroker.service.ProjectBrokerManager)14 CourseNode (org.olat.course.nodes.CourseNode)12 Project (org.olat.course.nodes.projectbroker.datamodel.Project)12 RepositoryEntry (org.olat.repository.RepositoryEntry)12 AssessmentChangedEvent (org.olat.course.assessment.AssessmentChangedEvent)10 UserNodeAuditManager (org.olat.course.auditing.UserNodeAuditManager)10 ProjectGroupManager (org.olat.course.nodes.projectbroker.service.ProjectGroupManager)10 BusinessGroup (org.olat.group.BusinessGroup)10 XStream (com.thoughtworks.xstream.XStream)8 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)8 TaskExecutorManager (org.olat.core.commons.services.taskexecutor.TaskExecutorManager)8 PackageTranslator (org.olat.core.gui.translator.PackageTranslator)8 Translator (org.olat.core.gui.translator.Translator)8 SyncerExecutor (org.olat.core.util.coordinate.SyncerExecutor)8