当前位置: 首页>>代码示例>>PHP>>正文


PHP ElggObject::delete方法代码示例

本文整理汇总了PHP中ElggObject::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggObject::delete方法的具体用法?PHP ElggObject::delete怎么用?PHP ElggObject::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ElggObject的用法示例。


在下文中一共展示了ElggObject::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCanGetEntitiesByAnnotationCreationTime

 public function testCanGetEntitiesByAnnotationCreationTime()
 {
     $prefix = elgg_get_config('dbprefix');
     $users = elgg_get_entities(array('type' => 'user', 'limit' => 1));
     // create some test annotations
     $subtypes = $this->getRandomValidSubtypes(array('object'), 1);
     $subtype = $subtypes[0];
     $annotation_name = 'test_annotation_name_' . rand();
     // our targets
     $valid1 = new \ElggObject();
     $valid1->subtype = $subtype;
     $valid1->save();
     $id1 = $valid1->annotate($annotation_name, 1, ACCESS_PUBLIC, $users[0]->guid);
     // this one earlier
     $yesterday = time() - 86400;
     update_data("\n\t\t\tUPDATE {$prefix}annotations\n\t\t\tSET time_created = {$yesterday}\n\t\t\tWHERE id = {$id1}\n\t\t");
     $valid2 = new \ElggObject();
     $valid2->subtype = $subtype;
     $valid2->save();
     $valid2->annotate($annotation_name, 1, ACCESS_PUBLIC, $users[0]->guid);
     $options = array('annotation_owner_guid' => $users[0]->guid, 'annotation_created_time_lower' => time() - 3600, 'annotation_name' => $annotation_name);
     $entities = elgg_get_entities_from_annotations($options);
     $this->assertEqual(1, count($entities));
     $this->assertEqual($valid2->guid, $entities[0]->guid);
     $options = array('annotation_owner_guid' => $users[0]->guid, 'annotation_created_time_upper' => time() - 3600, 'annotation_name' => $annotation_name);
     $entities = elgg_get_entities_from_annotations($options);
     $this->assertEqual(1, count($entities));
     $this->assertEqual($valid1->guid, $entities[0]->guid);
     $valid1->delete();
     $valid2->delete();
 }
开发者ID:elgg,项目名称:elgg,代码行数:31,代码来源:ElggCoreGetEntitiesFromAnnotationsTest.php

示例2: delete

 function delete()
 {
     try {
         $this->startSession();
         $this->get_pad_client()->deletePad($this->getMetaData('pname'));
     } catch (Exception $e) {
         return false;
     }
     return parent::delete();
 }
开发者ID:smellems,项目名称:elggpad-lite,代码行数:10,代码来源:ElggPad.php

示例3: groups_2011030101

/**
 * Condense annotation into object
 *
 * @param ElggObject $topic
 */
function groups_2011030101($topic)
{
    $annotation = $topic->getAnnotations('group_topic_post', 1);
    if (!$annotation) {
        // no text for this forum post so we delete (probably caused by #2624)
        return $topic->delete();
    }
    $topic->description = $annotation[0]->value;
    $topic->save();
    return $annotation[0]->delete();
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:16,代码来源:2011030101.php

示例4: testElggUserLoad

 public function testElggUserLoad()
 {
     // new object
     $object = new ElggObject();
     $this->AssertEqual($object->getGUID(), 0);
     $guid = $object->save();
     $this->AssertNotEqual($guid, 0);
     // fail on wrong type
     $this->assertFalse(get_user($guid));
     // clean up
     $object->delete();
 }
开发者ID:tjcaverly,项目名称:Elgg,代码行数:12,代码来源:ElggUserTest.php

示例5: delete

 public function delete()
 {
     $result = false;
     $event = get_entity($this->event_guid);
     $result = remove_entity_relationship($this->event_guid, ZHAOHU_MANAGER_RELATION_ATTENDING, $this->user_guid);
     if (!$result) {
         elgg_log("ZHError ,coupon:delete, failed to remove_entity_relationship, coupon_id {$this->guid}", "ERROR");
         return false;
     }
     parent::delete();
     return true;
 }
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:12,代码来源:Coupon.php

示例6: delete

 function delete($recursive = true)
 {
     if ($widgets = $this->getWidgets(false)) {
         foreach ($widgets as $col => $col_widgets) {
             if (!empty($col_widgets)) {
                 foreach ($col_widgets as $widget) {
                     $widget->delete();
                 }
             }
         }
     }
     return parent::delete($recursive);
 }
开发者ID:remy40,项目名称:gvrs,代码行数:13,代码来源:MultiDashboard.php

示例7: testElggDeleteAnnotations

 public function testElggDeleteAnnotations()
 {
     $e = new ElggObject();
     $e->save();
     for ($i = 0; $i < 30; $i++) {
         $e->annotate('test_annotation', rand(0, 10000));
     }
     $options = array('guid' => $e->getGUID(), 'limit' => 0);
     $annotations = elgg_get_annotations($options);
     $this->assertIdentical(30, count($annotations));
     $this->assertTrue(elgg_delete_annotations($options));
     $annotations = elgg_get_annotations($options);
     $this->assertTrue(empty($annotations));
     $this->assertTrue($e->delete());
 }
开发者ID:duanhv,项目名称:mdg-social,代码行数:15,代码来源:annotations.php

示例8: groups_2011030101

/**
 * Condense first annotation into object
 *
 * @param ElggObject $topic
 */
function groups_2011030101($topic)
{
    // do not upgrade topics that have already been upgraded
    if ($topic->description) {
        return true;
    }
    $annotation = $topic->getAnnotations(array('annotation_name' => 'group_topic_post', 'limit' => 1));
    if (!$annotation) {
        // no text for this forum post so we delete (probably caused by #2624)
        return $topic->delete();
    }
    $topic->description = $annotation[0]->value;
    $topic->save();
    return $annotation[0]->delete();
}
开发者ID:ibou77,项目名称:elgg,代码行数:20,代码来源:2011030101.php

示例9: testDefaultOrderedById

 public function testDefaultOrderedById()
 {
     $ia = elgg_set_ignore_access(true);
     $obj = new ElggObject();
     $obj->owner_guid = elgg_get_site_entity()->guid;
     $obj->container_guid = elgg_get_site_entity()->guid;
     $obj->access_id = ACCESS_PUBLIC;
     $obj->save();
     $obj->test_md = [1, 2, 3];
     $time = time();
     $prefix = _elgg_services()->db->getTablePrefix();
     // reverse the times
     $mds = elgg_get_metadata(['metadata_owner_guids' => $obj->guid, 'metadata_names' => 'test_md', 'order_by' => 'n_table.id ASC']);
     foreach ($mds as $i => $md) {
         update_data("\n\t\t\t\tUPDATE {$prefix}metadata\n\t\t\t\tSET time_created = " . ($time - $i) . "\n\t\t\t\tWHERE id = {$md->id}\n\t\t\t");
     }
     // verify ID order
     $mds = elgg_get_metadata(['guid' => $obj->guid, 'metadata_names' => 'test_md']);
     $md_values = array_map(function (ElggMetadata $md) {
         return (int) $md->value;
     }, $mds);
     $this->assertEqual($md_values, [1, 2, 3]);
     // ignore access bypasses the MD cache, so we try it both ways
     elgg_set_ignore_access(false);
     _elgg_services()->metadataCache->clear($obj->guid);
     $md_values = $obj->test_md;
     $this->assertEqual($md_values, [1, 2, 3]);
     elgg_set_ignore_access(true);
     _elgg_services()->metadataCache->clear($obj->guid);
     $md_values = $obj->test_md;
     $this->assertEqual($md_values, [1, 2, 3]);
     $obj->delete();
     elgg_set_ignore_access($ia);
 }
开发者ID:ibou77,项目名称:elgg,代码行数:34,代码来源:ElggCoreMetadataAPITest.php

示例10: delete

 /**
  * Delete this file.
  *
  * @return bool
  */
 public function delete()
 {
     $fs = $this->getFilestore();
     $result = $fs->delete($this);
     if ($this->getGUID() && $result) {
         $result = parent::delete();
     }
     return $result;
 }
开发者ID:thehereward,项目名称:Elgg,代码行数:14,代码来源:ElggFile.php

示例11: delete

 /**
  * Also remove API user when deleting the object
  * 
  * @param boolean $recursive if the delete should be recursive
  * 
  * @return boolean
  * 
  * @see ElggEntity::delete()
  */
 function delete($recursive = true)
 {
     if ($keys = $this->getApiKeys()) {
         remove_api_user($this->site_guid, $keys["api_key"]);
     }
     return parent::delete($recursive);
 }
开发者ID:lorea,项目名称:Hydra-dev,代码行数:16,代码来源:APIApplication.php

示例12: tearDown

 /**
  * Called after each test method.
  */
 public function tearDown()
 {
     $this->obj1->delete();
     $this->obj2->delete();
     elgg_set_ignore_access($this->ignoreAccess);
 }
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:9,代码来源:ElggCoreMetadataCacheTest.php

示例13: testElggApiGettersEntityNoValueSubtypeSet

 public function testElggApiGettersEntityNoValueSubtypeSet()
 {
     global $CONFIG;
     // create an entity we can later delete.
     // order by time created and limit by 1 should == this entity.
     $subtype = 'subtype_' . rand();
     $e_subtype = new \ElggObject();
     $e_subtype->subtype = $subtype;
     $e_subtype->save();
     $e = new \ElggObject();
     $e->save();
     $options = array('type' => 'object', 'subtype' => ELGG_ENTITIES_NO_VALUE, 'limit' => 1, 'order_by' => 'guid desc');
     // grab ourself again to fill out attributes.
     $e = get_entity($e->getGUID());
     $entities = elgg_get_entities($options);
     $this->assertEqual(count($entities), 1);
     // this entity should NOT be the entity we just created
     // and should have no subtype
     foreach ($entities as $entity) {
         $this->assertEqual($entity->subtype_id, 0);
     }
     $e_subtype->delete();
     $e->delete();
     $q = "DELETE FROM {$CONFIG->dbprefix}entity_subtypes WHERE subtype = '{$subtype}'";
     delete_data($q);
 }
开发者ID:ibou77,项目名称:elgg,代码行数:26,代码来源:ElggCoreGetEntitiesTest.php

示例14: ElggObject

 */
$title = get_input('title');
$description = get_input('description');
$address = get_input('address');
$access = ACCESS_PRIVATE;
//this is private and only admins can see it
if ($title && $address) {
    $entity = new ElggObject();
    $entity->subtype = "reported_content";
    $entity->owner_guid = $_SESSION['user']->getGUID();
    $entity->title = $title;
    $entity->address = $address;
    $entity->description = $description;
    $entity->access_id = $access;
    if ($entity->save()) {
        if (!trigger_plugin_hook('reportedcontent:add', $reported->type, array('entity' => $reported), true)) {
            $entity->delete();
            register_error(elgg_echo('reportedcontent:failed'));
        } else {
            system_message(elgg_echo('reportedcontent:success'));
            $entity->state = "active";
        }
        forward($address);
    } else {
        register_error(elgg_echo('reportedcontent:failed'));
        forward($address);
    }
} else {
    register_error(elgg_echo('reportedcontent:failed'));
    forward($address);
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:add.php

示例15: testElggAnnotationExists

 public function testElggAnnotationExists()
 {
     $e = new ElggObject();
     $e->save();
     $guid = $e->getGUID();
     $this->assertFalse(elgg_annotation_exists($guid, 'test_annotation'));
     $e->annotate('test_annotation', rand(0, 10000));
     $this->assertTrue(elgg_annotation_exists($guid, 'test_annotation'));
     // this metastring should always exist but an annotation of this name should not
     $this->assertFalse(elgg_annotation_exists($guid, 'email'));
     $options = array('guid' => $guid, 'limit' => 0);
     $this->assertTrue(elgg_disable_annotations($options));
     $this->assertTrue(elgg_annotation_exists($guid, 'test_annotation'));
     $this->assertTrue($e->delete());
     $this->assertFalse(elgg_annotation_exists($guid, 'test_annotation'));
 }
开发者ID:elainenaomi,项目名称:labxp2014,代码行数:16,代码来源:annotations.php


注:本文中的ElggObject::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。