本文整理匯總了PHP中eZContentClassClassGroup::removeGroup方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZContentClassClassGroup::removeGroup方法的具體用法?PHP eZContentClassClassGroup::removeGroup怎麽用?PHP eZContentClassClassGroup::removeGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZContentClassClassGroup
的用法示例。
在下文中一共展示了eZContentClassClassGroup::removeGroup方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: removeGroup
static function removeGroup( $classID, $classVersion, $selectedGroup )
{
$class = eZContentClass::fetch( $classID, true, eZContentClass::VERSION_STATUS_DEFINED );
if ( !$class )
return false;
$groups = $class->attribute( 'ingroup_list' );
foreach ( array_keys( $groups ) as $key )
{
if ( in_array( $groups[$key]->attribute( 'group_id' ), $selectedGroup ) )
{
unset( $groups[$key] );
}
}
if ( count( $groups ) == 0 )
{
return false;
}
else
{
foreach( $selectedGroup as $group_id )
{
eZContentClassClassGroup::removeGroup( $classID, $classVersion, $group_id );
}
}
return true;
}
示例2: removeFromGroup
private function removeFromGroup($classIdentifier, $groupIdentifier)
{
$classObject = eZContentClass::fetchByIdentifier($classIdentifier);
$groupObject = eZContentClassGroup::fetchByName($groupIdentifier);
if (!$classObject) {
throw new Exception("Invalid Class Identifier. [" . $classIdentifier . "]");
}
if (!$groupObject) {
throw new Exception("Invalid Group Identifier. [" . $groupIdentifier . "]");
}
$db = eZDB::instance();
$db->begin();
eZContentClassClassGroup::removeGroup($classObject->ID, null, $groupObject->ID);
$db->commit();
echo "Successfully removed class [" . $classIdentifier . "] from group [" . $groupIdentifier . "]";
}
示例3: syncGroups
protected function syncGroups()
{
$remote = $this->getRemote();
if ($remote === null) {
throw new Exception("Classe remota non trovata");
}
$this->syncAllGroups($remote);
$locale = $this->currentClass;
/** @var eZContentClassClassGroup[] $localGroups */
$localGroups = $locale->fetchGroupList();
//$localGroupsNames = array();
//$remoteGroupsNames = array();
foreach ($localGroups as $group) {
/** @var eZContentClassGroup $classGroup */
$classGroup = eZContentClassGroup::fetchByName($group->attribute('group_name'));
if ($classGroup) {
eZContentClassClassGroup::removeGroup($this->currentClass->attribute('id'), $this->currentClass->attribute('version'), $classGroup->attribute('id'));
}
}
foreach ($remote->InGroups as $group) {
/** @var eZContentClassGroup $classGroup */
$classGroup = eZContentClassGroup::fetchByName($group->GroupName);
if ($classGroup) {
$ingroup = eZContentClassClassGroup::create($this->currentClass->attribute('id'), $this->currentClass->attribute('version'), $classGroup->attribute('id'), $classGroup->attribute('name'));
$ingroup->store();
}
}
//$groups = $this->currentClass->attribute( 'ingroup_list' );
//if ( count( $groups ) == 0 )
//{
// //@todo
//}
}