Search in sources :

Example 11 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.

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 12 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.

the class IQSURVCourseNode 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: attempts
    pm.deleteNodeProperties(this, null);
    // 2) Delete all qtiresults for this node
    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());
    }
}
Also used : RepositoryEntry(org.olat.repository.RepositoryEntry) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 13 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.

the class TACourseNode 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) {
    Translator trans = new PackageTranslator(PACKAGE_TA, locale);
    CoursePropertyManager cpm = PersistingCoursePropertyManager.getInstance(course);
    List<Property> list = cpm.listCourseNodeProperties(this, null, null, null);
    // properties exist
    if (list.size() != 0)
        return trans.translate("warn.nodedelete");
    File fTaskFolder = new File(FolderConfig.getCanonicalRoot() + TACourseNode.getTaskFolderPathRelToFolderRoot(course, this));
    // task folder contains files
    if (fTaskFolder.exists() && fTaskFolder.list().length > 0)
        return trans.translate(NLS_WARN_NODEDELETE);
    // no data yet.
    return null;
}
Also used : PackageTranslator(org.olat.core.gui.translator.PackageTranslator) Translator(org.olat.core.gui.translator.Translator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) Property(org.olat.properties.Property) File(java.io.File) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager) PersistingCoursePropertyManager(org.olat.course.properties.PersistingCoursePropertyManager)

Example 14 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.

the class TACourseNode method getDetailsListView.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#getDetailsListView(org.olat.course.run.userview.UserCourseEnvironment)
 */
@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 15 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.

the class LTIRunController method checkHasDataExchangeAccepted.

/**
 * Helper method to check if user has already accepted. this info is stored
 * in a user property, the accepted values are stored as an MD5 hash (save
 * space, privacy)
 *
 * @param hash
 *            MD5 hash with all user data
 * @return true: user has already accepted for this hash; false: user has
 *         not yet accepted or for other values
 */
private boolean checkHasDataExchangeAccepted(String hash) {
    boolean dataAccepted = false;
    CoursePropertyManager propMgr = this.userCourseEnv.getCourseEnvironment().getCoursePropertyManager();
    Property prop = propMgr.findCourseNodeProperty(this.courseNode, getIdentity(), null, PROP_NAME_DATA_EXCHANGE_ACCEPTED);
    if (prop != null) {
        // compare if value in property is the same as calculated today. If not, user as to accept again
        String storedHash = prop.getStringValue();
        if (storedHash != null && hash != null && storedHash.equals(hash)) {
            dataAccepted = true;
        } else {
            // remove property, not valid anymore
            propMgr.deleteProperty(prop);
        }
    }
    return dataAccepted;
}
Also used : Property(org.olat.properties.Property) 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