Search in sources :

Example 96 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project openolat by klemens.

the class ProjectBrokerCourseNode method getDetailsListView.

@Override
public String getDetailsListView(UserCourseEnvironment userCourseEnvironment) {
    Identity identity = userCourseEnvironment.getIdentityEnvironment().getIdentity();
    CoursePropertyManager propMgr = userCourseEnvironment.getCourseEnvironment().getCoursePropertyManager();
    List<Property> samples = propMgr.findCourseNodeProperties(this, identity, null, TaskController.PROP_ASSIGNED);
    // no sample assigned yet
    if (samples.size() == 0)
        return null;
    return samples.get(0).getStringValue();
}
Also used : Identity(org.olat.core.id.Identity) Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager) PersistingCoursePropertyManager(org.olat.course.properties.PersistingCoursePropertyManager)

Example 97 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project openolat by klemens.

the class ProjectBrokerCourseNode method createInstanceForCopy.

/**
 * @see org.olat.course.nodes.CourseNode#createInstanceForCopy()
 */
@Override
public CourseNode createInstanceForCopy(boolean isNewTitle, ICourse course, Identity author) {
    // create the instance for the copy
    CourseNode copyInstance = super.createInstanceForCopy(isNewTitle, course, author);
    // get all the different managers
    BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
    CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    ProjectGroupManager projectGroupManager = CoreSpringFactory.getImpl(ProjectGroupManager.class);
    ProjectBrokerManager projectBrokerManager = CoreSpringFactory.getImpl(ProjectBrokerManager.class);
    // get the pbID from the source pb
    Long oldProjectBrokerId = projectBrokerManager.getProjectBrokerId(cpm, this);
    // create a new projectBroker for the copyInstance
    ProjectBroker newBroker = projectBrokerManager.createAndSaveProjectBroker();
    Long projectBrokerId = newBroker.getKey();
    projectBrokerManager.saveProjectBrokerId(projectBrokerId, cpm, copyInstance);
    // configure the new Project like the old one
    // copy the old accountManagergroup to preserve the
    // "persons in charge"
    Long originalAccountGroupKey = projectGroupManager.getAccountManagerGroupKey(cpm, this);
    if (originalAccountGroupKey != null) {
        BusinessGroup originalAccountGroup = projectGroupManager.getAccountManagerGroupFor(cpm, this, course, getShortTitle(), getShortTitle(), null);
        BusinessGroup newAccountManagerGroup = bgs.copyBusinessGroup(author, originalAccountGroup, originalAccountGroup.getName(), originalAccountGroup.getDescription(), originalAccountGroup.getMinParticipants(), originalAccountGroup.getMaxParticipants(), false, false, true, false, false, true, false, false);
        projectGroupManager.saveAccountManagerGroupKey(newAccountManagerGroup.getKey(), cpm, copyInstance);
        bgs.addResourceTo(newAccountManagerGroup, course.getCourseEnvironment().getCourseGroupManager().getCourseEntry());
    }
    if (oldProjectBrokerId != null) {
        List<Project> projects = projectBrokerManager.getProjectListBy(oldProjectBrokerId);
        for (Project project : projects) {
            // create projectGroup
            BusinessGroup projectGroup = projectGroupManager.createProjectGroupFor(projectBrokerId, author, project.getTitle(), project.getDescription(), course.getResourceableId());
            Project newProject = projectBrokerManager.createAndSaveProjectFor(project.getTitle(), project.getDescription(), projectBrokerId, projectGroup);
            // copy all project configurations
            newProject.setMailNotificationEnabled(project.isMailNotificationEnabled());
            newProject.setMaxMembers(project.getMaxMembers());
            for (int i = 0; i < project.getCustomFieldSize(); i++) {
                newProject.setCustomFieldValue(i, project.getCustomFieldValue(i));
            }
            projectGroupManager.setDeselectionAllowed(newProject, project.getProjectGroup().isAllowToLeave());
            projectBrokerManager.updateProject(newProject);
            // attachment file
            OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(projectBrokerManager.getAttamchmentRelativeRootPath(project, course.getCourseEnvironment(), this), null);
            VFSItem item = rootFolder.resolve(project.getAttachmentFileName());
            if (item instanceof VFSLeaf) {
                projectBrokerManager.saveAttachedFile(newProject, project.getAttachmentFileName(), (VFSLeaf) item, course.getCourseEnvironment(), copyInstance);
                newProject.setAttachedFileName(project.getAttachmentFileName());
                projectBrokerManager.updateProject(newProject);
            }
        }
    }
    return copyInstance;
}
Also used : VFSLeaf(org.olat.core.util.vfs.VFSLeaf) BusinessGroup(org.olat.group.BusinessGroup) VFSItem(org.olat.core.util.vfs.VFSItem) ProjectBrokerManager(org.olat.course.nodes.projectbroker.service.ProjectBrokerManager) ProjectGroupManager(org.olat.course.nodes.projectbroker.service.ProjectGroupManager) Project(org.olat.course.nodes.projectbroker.datamodel.Project) ProjectBroker(org.olat.course.nodes.projectbroker.datamodel.ProjectBroker) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) BusinessGroupService(org.olat.group.BusinessGroupService) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager) PersistingCoursePropertyManager(org.olat.course.properties.PersistingCoursePropertyManager)

Example 98 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project openolat by klemens.

the class ScormCourseNode method cleanupOnDelete.

/**
 * @see org.olat.course.nodes.CourseNode#cleanupOnDelete(org.olat.course.ICourse)
 */
@Override
public void cleanupOnDelete(ICourse course) {
    super.cleanupOnDelete(course);
    CoursePropertyManager pm = course.getCourseEnvironment().getCoursePropertyManager();
    // 1) Delete all properties: score, passed, log, comment, coach_comment,
    // attempts
    pm.deleteNodeProperties(this, null);
// 2) Delete all user files for this scorm node
// FIXME gs
// it is problematic that the data is stored using username/courseid-scormid/
// much better would be /courseid-scormid/username/
// I would consider refatoring this and setting up an upgrade task that moves the
// folders accordingly
}
Also used : CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 99 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project openolat by klemens.

the class IQTESTCourseNode method cleanupOnDelete.

/**
 * @see org.olat.course.nodes.CourseNode#cleanupOnDelete(org.olat.course.ICourse)
 */
@Override
public void cleanupOnDelete(ICourse course) {
    super.cleanupOnDelete(course);
    CoursePropertyManager pm = course.getCourseEnvironment().getCoursePropertyManager();
    // 1) Delete all properties: score, passed, log, comment, coach_comment,
    // attempts
    pm.deleteNodeProperties(this, null);
    // 2) Delete all qtiresults for this node (QTI 1.2 + qtiworks)
    String repositorySoftKey = (String) getModuleConfiguration().get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
    RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftKey, false);
    if (re != null) {
        QTIResultManager.getInstance().deleteAllResults(course.getResourceableId(), getIdent(), re.getKey());
    }
    // 3) Delete all assessment test sessions (QTI 2.1)
    RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    CoreSpringFactory.getImpl(AssessmentTestSessionDAO.class).deleteAllUserTestSessionsByCourse(courseEntry, getIdent());
}
Also used : AssessmentTestSessionDAO(org.olat.ims.qti21.manager.AssessmentTestSessionDAO) RepositoryEntry(org.olat.repository.RepositoryEntry) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 100 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project openolat by klemens.

the class MSCourseNode 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);
    List<Property> list = cpm.listCourseNodeProperties(this, null, null, null);
    // no properties created yet
    if (list.size() == 0)
        return null;
    Translator trans = new PackageTranslator(PACKAGE_MS, locale);
    return trans.translate("warn.nodedelete");
}
Also used : PackageTranslator(org.olat.core.gui.translator.PackageTranslator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) Translator(org.olat.core.gui.translator.Translator) Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager) PersistingCoursePropertyManager(org.olat.course.properties.PersistingCoursePropertyManager)

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