本文整理汇总了PHP中core_kernel_classes_Resource::removePropertyValue方法的典型用法代码示例。如果您正苦于以下问题:PHP core_kernel_classes_Resource::removePropertyValue方法的具体用法?PHP core_kernel_classes_Resource::removePropertyValue怎么用?PHP core_kernel_classes_Resource::removePropertyValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_kernel_classes_Resource
的用法示例。
在下文中一共展示了core_kernel_classes_Resource::removePropertyValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteContent
/**
* (non-PHPdoc)
* @see taoTests_models_classes_TestModel::onTestModelSet()
*/
public function deleteContent(core_kernel_classes_Resource $test)
{
$content = $test->getOnePropertyValue(new core_kernel_classes_Property(TEST_TESTCONTENT_PROP));
if (!is_null($content)) {
$content->delete();
$test->removePropertyValue(new core_kernel_classes_Property(TEST_TESTCONTENT_PROP), $content);
}
}
示例2: saveGroups
/**
* Assign deliveries to groups
*
* @param \core_kernel_classes_Resource $delivery Delivery or RepeatedDelivery instance
* @param array $values List of groups (uri)
* @return boolean
*/
public function saveGroups(\core_kernel_classes_Resource $delivery, $values)
{
$property = new \core_kernel_classes_Property(PROPERTY_GROUP_DELVIERY);
$currentValues = array();
foreach ($property->getDomain() as $domain) {
$instances = $domain->searchInstances(array($property->getUri() => $delivery), array('recursive' => true, 'like' => false));
$currentValues = array_merge($currentValues, array_keys($instances));
}
$toAdd = array_diff($values, $currentValues);
$toRemove = array_diff($currentValues, $values);
$success = true;
foreach ($toAdd as $uri) {
$subject = new \core_kernel_classes_Resource($uri);
$success = $success && $subject->setPropertyValue($property, $delivery);
}
foreach ($toRemove as $uri) {
$subject = new \core_kernel_classes_Resource($uri);
$success = $success && $subject->removePropertyValue($property, $delivery);
}
return $success;
}
示例3: deleteContent
/**
* Delete the content of a QTI test
* @param core_kernel_classes_Resource $test
* @throws common_exception_Error
*/
public function deleteContent(core_kernel_classes_Resource $test)
{
$content = $test->getOnePropertyValue(new core_kernel_classes_Property(TEST_TESTCONTENT_PROP));
if (!is_null($content)) {
$file = new core_kernel_file_File($content);
try {
$path = $file->getAbsolutePath();
if (is_dir($path)) {
if (!tao_helpers_File::delTree($path)) {
throw new common_exception_Error("Unable to remove test content directory located at '" . $file->getAbsolutePath() . "'.");
}
}
} catch (common_Exception $e) {
// Empty file...
}
$file->delete();
$test->removePropertyValue(new core_kernel_classes_Property(TEST_TESTCONTENT_PROP), $file);
}
}
示例4: removeUser
public function removeUser(\core_kernel_classes_Resource $user, core_kernel_classes_Resource $group)
{
return $user->removePropertyValue(new core_kernel_classes_Property(self::PROPERTY_MEMBERS_URI), $group);
}
示例5: deleteActualParameters
/**
* Short description of method deleteActualParameters
*
* @access public
* @author Joel Bout, <joel.bout@tudor.lu>
* @param Resource callOfService
* @return boolean
*/
public function deleteActualParameters(core_kernel_classes_Resource $callOfService)
{
$propActualParamIn = new core_kernel_classes_Property(PROPERTY_CALLOFSERVICES_ACTUALPARAMETERIN);
$propActualParamOut = new core_kernel_classes_Property(PROPERTY_CALLOFSERVICES_ACTUALPARAMETEROUT);
foreach ($callOfService->getPropertyValuesCollection($propActualParamIn)->getIterator() as $actualParam) {
$actualParam->delete();
$callOfService->removePropertyValue($propActualParamIn, $actualParam);
}
foreach ($callOfService->getPropertyValuesCollection($propActualParamOut)->getIterator() as $actualParam) {
$actualParam->delete();
$callOfService->removePropertyValue($propActualParamOut, $actualParam);
}
return true;
}
示例6: setReverseValues
public function setReverseValues()
{
if (!tao_helpers_Request::isAjax()) {
throw new common_exception_IsAjaxAction(__FUNCTION__);
}
$values = tao_helpers_form_GenerisTreeForm::getSelectedInstancesFromPost();
$resource = new core_kernel_classes_Resource($this->getRequestParameter('resourceUri'));
$property = new core_kernel_classes_Property($this->getRequestParameter('propertyUri'));
$currentValues = array();
foreach ($property->getDomain() as $domain) {
$instances = $domain->searchInstances(array($property->getUri() => $resource), array('recursive' => true, 'like' => false));
$currentValues = array_merge($currentValues, array_keys($instances));
}
$toAdd = array_diff($values, $currentValues);
$toRemove = array_diff($currentValues, $values);
$success = true;
foreach ($toAdd as $uri) {
$subject = new core_kernel_classes_Resource($uri);
$success = $success && $subject->setPropertyValue($property, $resource);
}
foreach ($toRemove as $uri) {
$subject = new core_kernel_classes_Resource($uri);
$success = $success && $subject->removePropertyValue($property, $resource);
}
echo json_encode(array('saved' => $success));
}
示例7: deleteContent
/**
* Delete the content of a QTI test
* @param core_kernel_classes_Resource $test
* @throws common_exception_Error
*/
public function deleteContent(core_kernel_classes_Resource $test)
{
$content = $test->getOnePropertyValue($this->getProperty(TEST_TESTCONTENT_PROP));
if (!is_null($content)) {
$dir = $this->getFileReferenceSerializer()->unserialize($content);
$dir->deleteSelf();
$this->getFileReferenceSerializer()->cleanUp($content);
$test->removePropertyValue($this->getProperty(TEST_TESTCONTENT_PROP), $content);
}
}