本文整理汇总了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
//}
}