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


PHP eZContentClassClassGroup::removeClassMembers方法代码示例

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


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

示例1: remove

 static function remove($classID)
 {
     $contentClass = eZContentClass::fetch($classID);
     if ($contentClass == null or !$contentClass->isRemovable()) {
         return false;
     }
     // Remove all objects
     $contentObjects = eZContentObject::fetchSameClassList($classID);
     foreach ($contentObjects as $contentObject) {
         eZContentObjectOperations::remove($contentObject->attribute('id'));
     }
     if (count($contentObjects) == 0) {
         eZContentObject::expireAllViewCache();
     }
     eZContentClassClassGroup::removeClassMembers($classID, 0);
     eZContentClassClassGroup::removeClassMembers($classID, 1);
     // Fetch real version and remove it
     $contentClass->remove(true);
     // Fetch temp version and remove it
     $tempDeleteClass = eZContentClass::fetch($classID, true, 1);
     if ($tempDeleteClass != null) {
         $tempDeleteClass->remove(true, 1);
     }
     return true;
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:25,代码来源:ezcontentclassoperations.php

示例2: storeVersioned

 /**
  * Stores the current class as a modified version, updates the contentobject_name
  * attribute and recreates the class group entries.
  *
  * @note It will remove classes in the previous and specified version before storing.
  *
  * @param array $attributes array of attributes
  * @param int $version version status
  * @since Version 4.3
  */
 public function storeVersioned($attributes, $version)
 {
     $previousVersion = $this->attribute('version');
     $db = eZDB::instance();
     $db->begin();
     // Before removing anything from the attributes, load attribute information
     // which might otherwise not accessible when recreating them below.
     // See issue #18164
     foreach ($attributes as $attribute) {
         $attribute->content();
     }
     $this->removeAttributes(false, $version);
     $this->removeAttributes(false, $previousVersion);
     $this->remove(false);
     $this->setVersion($version, $attributes);
     $this->setAttribute("modifier_id", eZUser::currentUser()->attribute("contentobject_id"));
     $this->setAttribute("modified", time());
     $this->adjustAttributePlacements($attributes);
     foreach ($attributes as $attribute) {
         $attribute->storeVersioned($version);
     }
     // Set contentobject_name to something sensible if it is missing
     if (count($attributes) > 0 && trim($this->attribute('contentobject_name')) == '') {
         $this->setAttribute('contentobject_name', '<' . $attributes[0]->attribute('identifier') . '>');
     }
     // Recreate class member entries
     eZContentClassClassGroup::removeClassMembers($this->ID, $version);
     foreach (eZContentClassClassGroup::fetchGroupList($this->ID, $previousVersion) as $classgroup) {
         $classgroup->setAttribute('contentclass_version', $version);
         $classgroup->store();
     }
     eZContentClassClassGroup::removeClassMembers($this->ID, $previousVersion);
     eZExpiryHandler::registerShutdownFunction();
     $handler = eZExpiryHandler::instance();
     $time = time();
     $handler->setTimestamp('user-class-cache', $time);
     $handler->setTimestamp('class-identifier-cache', $time);
     $handler->setTimestamp('sort-key-cache', $time);
     $handler->store();
     eZContentCacheManager::clearAllContentCache();
     $this->setAttribute('serialized_name_list', $this->NameList->serializeNames());
     $this->setAttribute('serialized_description_list', $this->DescriptionList->serializeNames());
     eZPersistentObject::store();
     $this->NameList->store($this);
     $db->commit();
 }
开发者ID:nlenardou,项目名称:ezpublish,代码行数:56,代码来源:ezcontentclass.php

示例3: count

if (isset($Params["GroupID"])) {
    $GroupID = $Params["GroupID"];
}
$class = eZContentClass::fetch($ClassID);
$ClassName = $class->attribute('name');
$classObjects = eZContentObject::fetchSameClassList($ClassID);
$ClassObjectsCount = count($classObjects);
if ($ClassObjectsCount == 0) {
    $ClassObjectsCount .= " object";
} else {
    $ClassObjectsCount .= " objects";
}
$http = eZHTTPTool::instance();
if ($http->hasPostVariable("ConfirmButton")) {
    $class->remove(true);
    eZContentClassClassGroup::removeClassMembers($ClassID, 0);
    ezpEvent::getInstance()->notify('content/class/cache', array($ClassID));
    $Module->redirectTo('/class/classlist/' . $GroupID);
}
if ($http->hasPostVariable("CancelButton")) {
    $Module->redirectTo('/class/classlist/' . $GroupID);
}
$Module->setTitle("Deletion of class " . $ClassID);
$tpl = eZTemplate::factory();
$tpl->setVariable("module", $Module);
$tpl->setVariable("GroupID", $GroupID);
$tpl->setVariable("ClassID", $ClassID);
$tpl->setVariable("ClassName", $ClassName);
$tpl->setVariable("ClassObjectsCount", $ClassObjectsCount);
$Result = array();
$Result['content'] = $tpl->fetch("design:class/delete.tpl");
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:31,代码来源:delete.php

示例4: array

}
// Find out the group where class is created or edited from.
if ($http->hasSessionVariable('FromGroupID')) {
    $fromGroupID = $http->sessionVariable('FromGroupID');
} else {
    $fromGroupID = false;
}
$ClassID = $class->attribute('id');
$ClassVersion = $class->attribute('version');
$validation = array('processed' => false, 'groups' => array(), 'attributes' => array(), 'class_errors' => array());
$unvalidatedAttributes = array();
if ($http->hasPostVariable('DiscardButton')) {
    $http->removeSessionVariable('ClassCanStoreTicket');
    $class->setVersion(eZContentClass::VERSION_STATUS_TEMPORARY);
    $class->remove(true, eZContentClass::VERSION_STATUS_TEMPORARY);
    eZContentClassClassGroup::removeClassMembers($ClassID, eZContentClass::VERSION_STATUS_TEMPORARY);
    if ($fromGroupID === false) {
        $Module->redirectToView('grouplist');
    } else {
        $Module->redirectTo($Module->functionURI('classlist') . '/' . $fromGroupID . '/');
    }
    return;
}
if ($http->hasPostVariable('AddGroupButton') && $http->hasPostVariable('ContentClass_group')) {
    eZClassFunctions::addGroup($ClassID, $ClassVersion, $http->postVariable('ContentClass_group'));
    $lastChangedID = 'group';
}
if ($http->hasPostVariable('RemoveGroupButton') && $http->hasPostVariable('group_id_checked')) {
    if (!eZClassFunctions::removeGroup($ClassID, $ClassVersion, $http->postVariable('group_id_checked'))) {
        $validation['groups'][] = array('text' => ezpI18n::tr('kernel/class', 'You have to have at least one group that the class belongs to!'));
        $validation['processed'] = true;
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:edit.php

示例5: deleteClass

 private function deleteClass($classIdentifier)
 {
     $chunkSize = 1000;
     $classId = eZContentClass::classIDByIdentifier($classIdentifier);
     $contentClass = eZContentClass::fetch($classId);
     if (!$contentClass) {
         throw new Exception("Failed to instantiate content class. [" . $classIdentifier . "]");
     }
     $totalObjectCount = eZContentObject::fetchSameClassListCount($classId);
     echo "Deleting " . $totalObjectCount . " objects.\n";
     $moreToDelete = 0 < $totalObjectCount;
     $totalDeleted = 0;
     // need to operate in a privileged account - use doug@mugo.ca
     $adminUserObject = eZUser::fetch(eepSetting::PrivilegedAccountId);
     $adminUserObject->loginCurrent();
     while ($moreToDelete) {
         $params["IgnoreVisibility"] = true;
         $params['Limitation'] = array();
         $params['Limit'] = $chunkSize;
         $params['ClassFilterType'] = "include";
         $params['ClassFilterArray'] = array($classIdentifier);
         $children = eZContentObjectTreeNode::subTreeByNodeID($params, 2);
         foreach ($children as $child) {
             $info = eZContentObjectTreeNode::subtreeRemovalInformation(array($child->NodeID));
             if (!$info["can_remove_all"]) {
                 $msg = " permission is denied for nodeid=" . $child->NodeID;
                 // todo, this can yield an infinite loop if some objects are
                 // not deleteable, but you don't take that number into account
                 // at the bottom of the loop - where there will always be
                 // some >0 number of undeleteable objects left
                 echo $msg . "\n";
                 continue;
             }
             $removeResult = eZContentObjectTreeNode::removeSubtrees(array($child->NodeID), false, false);
             if (true === $removeResult) {
                 $totalDeleted += 1;
             } else {
                 $msg = " failed to delete nodeid=" . $child->NodeID;
                 echo $msg . "\n";
             }
             echo "Percent complete: " . sprintf("% 3.3f", $totalDeleted / $totalObjectCount * 100.0) . "%\r";
             unset($GLOBALS['eZContentObjectContentObjectCache']);
             unset($GLOBALS['eZContentObjectDataMapCache']);
             unset($GLOBALS['eZContentObjectVersionCache']);
         }
         $moreToDelete = 0 < eZContentObject::fetchSameClassListCount($classId);
     }
     echo "\nDone deleting objects.\n";
     $adminUserObject->logoutCurrent();
     eZContentClassClassGroup::removeClassMembers($classId, 0);
     eZContentClassClassGroup::removeClassMembers($classId, 1);
     // Fetch real version and remove it
     $contentClass->remove(true);
     // this seems to mainly cause an exception, might be an idea to simply skip it
     // Fetch temp version and remove it
     $tempDeleteClass = eZContentClass::fetch($classId, true, 1);
     if ($tempDeleteClass != null) {
         $tempDeleteClass->remove(true, 1);
     }
 }
开发者ID:truffo,项目名称:eep,代码行数:60,代码来源:index.php


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