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


PHP ElggObject::getGUID方法代码示例

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


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

示例1: testElggApiGettersEntitiesFromPrivateSettings

 public function testElggApiGettersEntitiesFromPrivateSettings()
 {
     // create some test private settings
     $setting_name = 'test_setting_name_' . rand();
     $setting_value = rand(1000, 9999);
     $setting_name2 = 'test_setting_name_' . rand();
     $setting_value2 = rand(1000, 9999);
     $subtypes = $this->getRandomValidSubtypes(array('object'), 1);
     $subtype = $subtypes[0];
     $guids = array();
     // our targets
     $valid = new ElggObject();
     $valid->subtype = $subtype;
     $valid->save();
     $guids[] = $valid->getGUID();
     set_private_setting($valid->getGUID(), $setting_name, $setting_value);
     set_private_setting($valid->getGUID(), $setting_name2, $setting_value2);
     $valid2 = new ElggObject();
     $valid2->subtype = $subtype;
     $valid2->save();
     $guids[] = $valid2->getGUID();
     set_private_setting($valid2->getGUID(), $setting_name, $setting_value);
     set_private_setting($valid2->getGUID(), $setting_name2, $setting_value2);
     // simple test with name
     $options = array('private_setting_name' => $setting_name);
     $entities = elgg_get_entities_from_private_settings($options);
     foreach ($entities as $entity) {
         $this->assertTrue(in_array($entity->getGUID(), $guids));
         $value = get_private_setting($entity->getGUID(), $setting_name);
         $this->assertEqual($value, $setting_value);
     }
     // simple test with value
     $options = array('private_setting_value' => $setting_value);
     $entities = elgg_get_entities_from_private_settings($options);
     foreach ($entities as $entity) {
         $this->assertTrue(in_array($entity->getGUID(), $guids));
         $value = get_private_setting($entity->getGUID(), $setting_name);
         $this->assertEqual($value, $setting_value);
     }
     // test pairs
     $options = array('type' => 'object', 'subtype' => $subtype, 'private_setting_name_value_pairs' => array(array('name' => $setting_name, 'value' => $setting_value), array('name' => $setting_name2, 'value' => $setting_value2)));
     $entities = elgg_get_entities_from_private_settings($options);
     $this->assertEqual(2, count($entities));
     foreach ($entities as $entity) {
         $this->assertTrue(in_array($entity->getGUID(), $guids));
     }
     foreach ($guids as $guid) {
         if ($e = get_entity($guid)) {
             $e->delete();
         }
     }
 }
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:52,代码来源:ElggCoreGetEntitiesFromPrivateSettingsTest.php

示例2: testElggEntityRecursiveDisableAndEnable

 public function testElggEntityRecursiveDisableAndEnable()
 {
     global $CONFIG;
     $obj1 = new \ElggObject();
     $obj1->container_guid = $this->entity->getGUID();
     $obj1->save();
     $obj2 = new \ElggObject();
     $obj2->container_guid = $this->entity->getGUID();
     $obj2->save();
     // disable $obj2 before disabling the container
     $this->assertTrue($obj2->disable());
     // disable entities container by $this->entity
     $this->assertTrue($this->entity->disable());
     $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$obj1->guid}'");
     $this->assertIdentical($entity->enabled, 'no');
     // enable entities that were disabled with the container (but not $obj2)
     $this->assertTrue($this->entity->enable());
     $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$obj1->guid}'");
     $this->assertIdentical($entity->enabled, 'yes');
     $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$obj2->guid}'");
     $this->assertIdentical($entity->enabled, 'no');
     // cleanup
     $this->assertTrue($obj2->enable());
     $this->assertTrue($obj2->delete());
     $this->assertTrue($obj1->delete());
 }
开发者ID:elgg,项目名称:elgg,代码行数:26,代码来源:ElggEntityTest.php

示例3: au_subgroups_clone_layout

/**
 * Clones the custom layout of a parent group, for a newly created subgroup
 * @param type $group
 * @param type $parent
 */
function au_subgroups_clone_layout($group, $parent)
{
    if (!elgg_is_active_plugin('group_custom_layout') || !group_custom_layout_allow($parent)) {
        return false;
    }
    // get the layout object for the parent
    if ($parent->countEntitiesFromRelationship(GROUP_CUSTOM_LAYOUT_RELATION) <= 0) {
        return false;
    }
    $parentlayout = $parent->getEntitiesFromRelationship(GROUP_CUSTOM_LAYOUT_RELATION);
    $parentlayout = $parentlayout[0];
    $layout = new ElggObject();
    $layout->subtype = GROUP_CUSTOM_LAYOUT_SUBTYPE;
    $layout->owner_guid = $group->getGUID();
    $layout->container_guid = $group->getGUID();
    $layout->access_id = ACCESS_PUBLIC;
    $layout->save();
    // background image
    $layout->enable_background = $parentlayout->enable_background;
    $parentimg = elgg_get_config('dataroot') . 'group_custom_layout/backgrounds/' . $parent->getGUID() . '.jpg';
    $groupimg = elgg_get_config('dataroot') . 'group_custom_layout/backgrounds/' . $group->getGUID() . '.jpg';
    if (file_exists($parentimg)) {
        copy($parentimg, $groupimg);
    }
    $layout->enable_colors = $parentlayout->enable_colors;
    $layout->background_color = $parentlayout->background_color;
    $layout->border_color = $parentlayout->border_color;
    $layout->title_color = $parentlayout->title_color;
    $group->addRelationship($layout->getGUID(), GROUP_CUSTOM_LAYOUT_RELATION);
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:35,代码来源:functions.php

示例4: removeFolderContents

 /**
  * Remove all the files in this folder
  *
  * @param \ElggObject $entity the folder to removed the file from
  *
  * @return void
  */
 protected static function removeFolderContents(\ElggObject $entity)
 {
     $batch = new \ElggBatch('elgg_get_entities_from_relationship', ['type' => 'object', 'subtype' => 'file', 'container_guid' => $entity->getContainerGUID(), 'limit' => false, 'relationship' => FILE_TOOLS_RELATIONSHIP, 'relationship_guid' => $entity->getGUID()]);
     $batch->setIncrementOffset(false);
     foreach ($batch as $file) {
         $file->delete();
     }
 }
开发者ID:coldtrick,项目名称:file_tools,代码行数:15,代码来源:Folder.php

示例5: save_answer

function save_answer($elgg_question, $answer_body)
{
    $answer = new ElggObject();
    $answer->subtype = "answer";
    $answer->description = $answer_body;
    $answer->question_guid = $elgg_question->getGUID();
    $answer->save();
    add_entity_relationship($elgg_question->getGUID(), "answer", $answer->getGUID());
    return $answer;
}
开发者ID:rkvsraman,项目名称:stackoverflow-elgg-plugin,代码行数:10,代码来源:save.php

示例6: elgg_modifications_generate_digischool_menu_page_handler

function elgg_modifications_generate_digischool_menu_page_handler($page)
{
    admin_gatekeeper();
    if (elgg_is_active_plugin("menu_builder")) {
        // remove current menu items
        $current_options = array("type" => "object", "subtype" => "menu_builder_menu_item", "limit" => false);
        if ($current_items = elgg_get_entities($current_options)) {
            foreach ($current_items as $current_item) {
                $current_item->delete();
            }
        }
        // 			var_dump($current_items);
        // 			exit();
        // add the new ones
        $site = elgg_get_site_entity();
        $site_acl = $site->getACL();
        $menu_items = array(array("title" => "Voorpagina", "url" => "[wwwroot]", "access_id" => ACCESS_PUBLIC, "children" => array(array("title" => "Alle blogs", "url" => "[wwwroot]blog/all", "access_id" => ACCESS_PUBLIC), array("title" => "Alle activiteiten", "url" => "[wwwroot]activity", "access_id" => ACCESS_LOGGED_IN))), array("title" => "Statische pagina's", "url" => "[wwwroot]lidworden", "access_id" => ACCESS_LOGGED_IN), array("title" => "Archief", "url" => "Zelf in te vullen", "access_id" => ACCESS_PUBLIC), array("title" => "Leermiddelen", "url" => "#", "access_id" => ACCESS_PUBLIC, "children" => array(array("title" => "Vakpagina", "url" => "hier de link naar uw vakp", "access_id" => ACCESS_PUBLIC), array("title" => "Leermiddelenbank Digischool", "url" => "[wwwroot]", "access_id" => ACCESS_PUBLIC), array("title" => "Leden keurmerkgroepen", "url" => "zelf te vullen", "access_id" => ACCESS_PUBLIC))), array("title" => "Leden", "url" => "#", "access_id" => ACCESS_LOGGED_IN, "children" => array(array("title" => "Mijn groepen", "url" => "[wwwroot]groups/member/[username]", "access_id" => $site_acl), array("title" => "Mijn profielpagina", "url" => "[wwwroot]profile/[username]", "access_id" => $site_acl), array("title" => "Alle groepen", "url" => "[wwwroot]groups/all/?filter=pop", "access_id" => $site_acl), array("title" => "Lid worden", "url" => "[wwwroot]lidworden", "access_id" => ACCESS_PUBLIC), array("title" => "Content toevoegen", "url" => "[wwwroot]add", "access_id" => $site_acl), array("title" => "Mijn dashboard", "url" => "[wwwroot]dashboard", "access_id" => $site_acl), array("title" => "Zoeken leden", "url" => "[wwwroot]members", "access_id" => $site_acl), array("title" => "Mijn contacten", "url" => "[wwwroot]friends/[username]", "access_id" => $site_acl), array("title" => "Contactverzoeken", "url" => "[wwwroot]friend_request/", "access_id" => $site_acl), array("title" => "Mijn instellingen", "url" => "[wwwroot]settings", "access_id" => $site_acl), array("title" => "Nieuwe groep maken", "url" => "[wwwroot]groups/add", "access_id" => $site_acl))), array("title" => "Beheer", "url" => "[wwwroot]admin", "access_id" => ACCESS_PRIVATE, "children" => array(array("title" => "Gebruikersbeheer", "url" => "[wwwroot]admin/users/newest", "access_id" => ACCESS_PRIVATE), array("title" => "Nodig leden uit", "url" => "[wwwroot]admin/users/invite", "access_id" => ACCESS_PRIVATE), array("title" => "Pluginbeheer", "url" => "[wwwroot]admin/plugins", "access_id" => ACCESS_PRIVATE), array("title" => "Beheer template", "url" => "[wwwroot]admin/appearance/template", "access_id" => ACCESS_PRIVATE))));
        $i = 0;
        foreach ($menu_items as $main_item) {
            $item = new ElggObject();
            $item->subtype = "menu_builder_menu_item";
            $item->owner_guid = $site->getGUID();
            $item->container_guid = $site->getGUID();
            $item->site_guid = $site->getGUID();
            $item->access_id = $main_item["access_id"];
            $item->parent_guid = 0;
            $item->title = $main_item["title"];
            $item->url = $main_item["url"];
            $item->order = $i;
            $i++;
            $item->save();
            if (array_key_exists("children", $main_item)) {
                foreach ($main_item["children"] as $sub_item) {
                    $submenu_item = new ElggObject();
                    $submenu_item->subtype = "menu_builder_menu_item";
                    $submenu_item->owner_guid = $site->getGUID();
                    $submenu_item->container_guid = $site->getGUID();
                    $submenu_item->site_guid = $site->getGUID();
                    $submenu_item->access_id = $sub_item["access_id"];
                    $submenu_item->parent_guid = $item->getGUID();
                    $submenu_item->title = $sub_item["title"];
                    $submenu_item->url = $sub_item["url"];
                    $submenu_item->order = $i;
                    $i++;
                    $submenu_item->save();
                }
            }
        }
        system_message("menu created");
    } else {
        register_error("plugin menu_builder not activated");
    }
    forward();
}
开发者ID:pleio,项目名称:elgg_modifications,代码行数:54,代码来源:page_handlers.php

示例7: 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

示例8: testElggApiGettersEntitiesFromAnnotation

 public function testElggApiGettersEntitiesFromAnnotation()
 {
     // grab a few different users to annotation
     // there will always be at least 2 here because of the construct.
     $users = elgg_get_entities(array('type' => 'user', 'limit' => 2));
     // create some test annotations
     $subtypes = $this->getRandomValidSubtypes(array('object'), 1);
     $subtype = $subtypes[0];
     $annotation_name = 'test_annotation_name_' . rand();
     $annotation_value = rand(1000, 9999);
     $annotation_name2 = 'test_annotation_name_' . rand();
     $annotation_value2 = rand(1000, 9999);
     $guids = array();
     // our targets
     $valid = new \ElggObject();
     $valid->subtype = $subtype;
     $valid->save();
     $guids[] = $valid->getGUID();
     create_annotation($valid->getGUID(), $annotation_name, $annotation_value, 'integer', $users[0]->getGUID());
     $valid2 = new \ElggObject();
     $valid2->subtype = $subtype;
     $valid2->save();
     $guids[] = $valid2->getGUID();
     create_annotation($valid2->getGUID(), $annotation_name2, $annotation_value2, 'integer', $users[1]->getGUID());
     $options = array('annotation_owner_guid' => $users[0]->getGUID(), 'annotation_name' => $annotation_name);
     $entities = elgg_get_entities_from_annotations($options);
     foreach ($entities as $entity) {
         $this->assertTrue(in_array($entity->getGUID(), $guids));
         $annotations = $entity->getAnnotations(array('annotation_name' => $annotation_name));
         $this->assertEqual(count($annotations), 1);
         $this->assertEqual($annotations[0]->name, $annotation_name);
         $this->assertEqual($annotations[0]->value, $annotation_value);
         $this->assertEqual($annotations[0]->owner_guid, $users[0]->getGUID());
     }
     foreach ($guids as $guid) {
         if ($e = get_entity($guid)) {
             $e->delete();
         }
     }
 }
开发者ID:sephiroth88,项目名称:Elgg,代码行数:40,代码来源:ElggCoreGetEntitiesFromAnnotationsTest.php

示例9: 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

示例10: testElggDeleteMetadata

 public function testElggDeleteMetadata()
 {
     $e = new \ElggObject();
     $e->save();
     for ($i = 0; $i < 30; $i++) {
         $name = "test_metadata{$i}";
         $e->{$name} = rand(0, 10000);
     }
     $options = array('guid' => $e->getGUID(), 'limit' => 0);
     $md = elgg_get_metadata($options);
     $this->assertIdentical(30, count($md));
     $this->assertTrue(elgg_delete_metadata($options));
     $md = elgg_get_metadata($options);
     $this->assertTrue(empty($md));
     $e->delete();
 }
开发者ID:elgg,项目名称:elgg,代码行数:16,代码来源:ElggCoreMetadataAPITest.php

示例11: 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
     try {
         $error = new ElggUserTest($guid);
         $this->assertTrue(FALSE);
     } catch (Exception $e) {
         $this->assertIsA($e, 'InvalidClassException');
         $message = sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $guid, 'ElggUser');
         $this->assertIdentical($e->getMessage(), $message);
     }
     // clean up
     $object->delete();
 }
开发者ID:redvabel,项目名称:Vabelgg,代码行数:19,代码来源:users.php

示例12: hypefaker_add_page

function hypefaker_add_page($owner, $container, $parent = null)
{
    $locale = elgg_get_plugin_setting('locale', 'hypeFaker', 'en_US');
    $faker = Factory::create($locale);
    $access_array = get_write_access_array($owner->guid);
    $access_id = array_rand($access_array, 1);
    $write_access_array = get_write_access_array($owner->guid);
    unset($write_access_array[ACCESS_PUBLIC]);
    $write_access_id = array_rand($write_access_array, 1);
    $page = new ElggObject();
    $page->subtype = $parent ? 'page' : 'page_top';
    $page->owner_guid = $owner->guid;
    $page->container_guid = $container->guid;
    $page->title = $faker->sentence(6);
    $page->description = $faker->text(500);
    $page->tags = $faker->words(5);
    $page->access_id = $access_id;
    $page->write_access_id = $write_access_id;
    $page->__faker = true;
    if ($parent) {
        $page->parent_guid = $parent->guid;
    }
    if ($page->save()) {
        $page->annotate('page', $page->description, $page->access_id, $page->owner_guid);
        elgg_create_river_item(array('view' => 'river/object/page/create', 'action_type' => 'create', 'subject_guid' => $page->owner_guid, 'object_guid' => $page->getGUID()));
        // add some revisions
        $users = elgg_get_entities_from_metadata(array('types' => 'user', 'limit' => rand(1, 10), 'order_by' => 'RAND()', 'metadata_names' => '__faker'));
        foreach ($users as $user) {
            if ($page->canAnnotate($user->guid, 'page')) {
                $last_revision = $faker->text(500);
                $page->annotate('page', $last_annotation, $page->access_id, $user->guid);
            }
        }
        if (!empty($last_revision)) {
            $page->description = $last_revision;
            $page->save();
        }
        return $page;
    }
    return false;
}
开发者ID:hypejunction,项目名称:hypefaker,代码行数:41,代码来源:gen_pages.php

示例13: file_tools_get_zip_structure

/**
 * Read a folder structure for a zip file
 *
 * @param ElggObject $folder  the folder to read
 * @param string     $prepend current prefix
 *
 * @return array
 */
function file_tools_get_zip_structure($folder, $prepend)
{
    $entries = [];
    if (!empty($prepend)) {
        $prepend = ltrim(sanitise_filepath($prepend), '/');
    }
    if (empty($folder)) {
        $parent_guid = 0;
    } else {
        $parent_guid = $folder->getGUID();
    }
    // get subfolder of this folder
    $entities = new ElggBatch('elgg_get_entities_from_metadata', ['type' => 'object', 'subtype' => FILE_TOOLS_SUBTYPE, 'limit' => false, 'metadata_name_value_pairs' => ['parent_guid' => $parent_guid]]);
    /* @var $subfolder ElggObject */
    foreach ($entities as $subfolder) {
        $path = $prepend . $subfolder->title;
        $entries[] = ['directory' => $path, 'files' => file_tools_has_files($subfolder->getGUID())];
        $entries = array_merge($entries, file_tools_get_zip_structure($subfolder, $path));
    }
    return $entries;
}
开发者ID:coldtrick,项目名称:file_tools,代码行数:29,代码来源:functions.php

示例14: pages_prepare_form_vars

/**
 * Prepare the add/edit form variables
 *
 * @param ElggObject     $page
 * @param int            $parent_guid
 * @param ElggAnnotation $revision
 * @return array
 */
function pages_prepare_form_vars($page = null, $parent_guid = 0, $revision = null)
{
    // input names => defaults
    $values = array('title' => '', 'description' => '', 'access_id' => ACCESS_DEFAULT, 'write_access_id' => ACCESS_DEFAULT, 'tags' => '', 'container_guid' => elgg_get_page_owner_guid(), 'guid' => null, 'entity' => $page, 'parent_guid' => $parent_guid);
    if ($page) {
        foreach (array_keys($values) as $field) {
            if (isset($page->{$field})) {
                $values[$field] = $page->{$field};
            }
        }
    }
    if (elgg_is_sticky_form('page')) {
        $sticky_values = elgg_get_sticky_values('page');
        foreach ($sticky_values as $key => $value) {
            $values[$key] = $value;
        }
    }
    elgg_clear_sticky_form('page');
    // load the revision annotation if requested
    if ($revision instanceof ElggAnnotation && $revision->entity_guid == $page->getGUID()) {
        $values['description'] = $revision->value;
    }
    return $values;
}
开发者ID:tjcaverly,项目名称:Elgg,代码行数:32,代码来源:pages.php

示例15: elseif

            }
            if (!empty($border_color)) {
                $layout->border_color = $border_color;
                system_message(elgg_echo("group_custom_layout:action:save:success:border_color"));
            } else {
                register_error(elgg_echo("group_custom_layout:action:save:error:border_color"));
            }
            if (!empty($title_color)) {
                $layout->title_color = $title_color;
                system_message(elgg_echo("group_custom_layout:action:save:success:title_color"));
            } else {
                register_error(elgg_echo("group_custom_layout:action:save:error:title_color"));
            }
        }
        $last_save = $layout->save();
        if ($existing && $last_save) {
            system_message(elgg_echo("group_custom_layout:action:save:success:existing"));
        } elseif ($existing && !$last_save) {
            register_error(elgg_echo("group_custom_layout:action:save:error:last_save"));
        } elseif (!$existing && $group->addRelationship($layout->getGUID(), GROUP_CUSTOM_LAYOUT_RELATION)) {
            system_message(elgg_echo("group_custom_layout:action:save:success:group"));
        } else {
            register_error(elgg_echo("group_custom_layout:action:save:error:add_to_group"));
        }
    } else {
        register_error(elgg_echo("group_custom_layout:action:save:error:no_group"));
    }
} else {
    register_error(elgg_echo("group_custom_layout:action:save:error:input"));
}
forward($group->getURL());
开发者ID:beck24,项目名称:group_custom_layout,代码行数:31,代码来源:save.php


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