本文整理汇总了PHP中ElggObject::getContainerGUID方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggObject::getContainerGUID方法的具体用法?PHP ElggObject::getContainerGUID怎么用?PHP ElggObject::getContainerGUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggObject
的用法示例。
在下文中一共展示了ElggObject::getContainerGUID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例2: testCreateWithContainerGuidEqualsZero
public function testCreateWithContainerGuidEqualsZero()
{
$user = new \ElggUser();
$user->save();
$object = new \ElggObject();
$object->owner_guid = $user->guid;
$object->container_guid = 0;
// If container_guid attribute is not updated with owner_guid attribute
// ElggEntity::getContainerEntity() would return false
// thus terminating save()
$this->assertTrue($object->save());
$this->assertEqual($user->guid, $object->getContainerGUID());
$user->delete();
}
示例3: file_tools_change_files_access
/**
* Change the access of all file in a folder
*
* @param ElggObject $folder the folder to change the file access for
*
* @return void
*/
function file_tools_change_files_access($folder)
{
if (!empty($folder) && $folder instanceof ElggObject) {
if ($folder->getSubtype() == FILE_TOOLS_SUBTYPE) {
// change access on files in this folder
$options = array("type" => "object", "subtype" => "file", "container_guid" => $folder->getContainerGUID(), "limit" => false, "relationship" => FILE_TOOLS_RELATIONSHIP, "relationship_guid" => $folder->getGUID());
if ($files = elgg_get_entities_from_relationship($options)) {
// need to unregister an event listener
elgg_unregister_event_handler("update", "object", "file_tools_object_handler");
foreach ($files as $file) {
$file->access_id = $folder->access_id;
$file->save();
}
}
}
}
}
示例4: while
}
}
// need to add check to make sure user can write to container
$page->container_guid = $container_guid;
// allow moving of subpages
if ($parent_guid && $parent_guid != $page_guid) {
// Check if parent isn't below the page in the tree
if (!$new_page && $page->parent_guid != $parent_guid) {
$tree_page = get_entity($parent_guid);
while ($tree_page->parent_guid > 0 && $page_guid != $tree_page->getGUID()) {
$tree_page = get_entity($tree_page->parent_guid);
}
// If is below, bring all child elements forward
if ($page_guid == $tree_page->getGUID()) {
$previous_parent = (int) $page->parent_guid;
$options = array("type" => "object", "subtype" => "page", "container_guid" => $page->getContainerGUID(), "limit" => false, "metadata_name_value_pairs" => array("name" => "parent_guid", "value" => $page->getGUID()));
if ($children = elgg_get_entities_from_metadata($options)) {
foreach ($children as $child) {
$child->parent_guid = $previous_parent;
}
}
}
}
$page->parent_guid = $parent_guid;
}
// allow comments
$page->allow_comments = $allow_comments;
// check for publication/expiration date
$publication_date = get_input("publication_date");
$expiration_date = get_input("expiration_date");
// first reset publication status