本文整理汇总了PHP中eZContentClassClassGroup::create方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentClassClassGroup::create方法的具体用法?PHP eZContentClassClassGroup::create怎么用?PHP eZContentClassClassGroup::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentClassClassGroup
的用法示例。
在下文中一共展示了eZContentClassClassGroup::create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addGroup
static function addGroup( $classID, $classVersion, $selectedGroup )
{
list ( $groupID, $groupName ) = explode( '/', $selectedGroup );
$ingroup = eZContentClassClassGroup::create( $classID, $classVersion, $groupID, $groupName );
$ingroup->store();
return true;
}
示例2: testContentClassStillInGroupAfterEdition
/**
* Test that saving a content class in DEFINED version status
* correctly manipulate associated class groups
*
* @link http://issues.ez.no/16197
*/
public function testContentClassStillInGroupAfterEdition()
{
$class = eZContentClass::fetch( $this->class->id );
// This is logic contained in kernel/class/edit.php
foreach ( eZContentClassClassGroup::fetchGroupList( $class->attribute( 'id' ),
eZContentClass::VERSION_STATUS_DEFINED ) as $classGroup )
{
eZContentClassClassGroup::create( $class->attribute( 'id' ),
eZContentClass::VERSION_STATUS_TEMPORARY,
$classGroup->attribute( 'group_id' ),
$classGroup->attribute( 'group_name' ) )
->store();
}
$attributes = $class->fetchAttributes();
$class->setAttribute( 'version', eZContentClass::VERSION_STATUS_TEMPORARY );
$class->NameList->setHasDirtyData();
foreach ( $attributes as $attribute )
{
$attribute->setAttribute( 'version', eZContentClass::VERSION_STATUS_TEMPORARY );
if ( $dataType = $attribute->dataType() )
$dataType->initializeClassAttribute( $attribute );
}
$class->store( $attributes );
$db = eZDB::instance();
$db->begin();
$class->storeVersioned( $attributes, eZContentClass::VERSION_STATUS_DEFINED );
$db->commit();
$this->assertTrue( eZContentClassClassGroup::classInGroup( $class->attribute( 'id' ),
eZContentClass::VERSION_STATUS_DEFINED,
1 ) );
}
示例3: __construct
/**
* Initialize ezpClass object
*
* @param string $name
* @param string $identifier
* @param string $contentObjectName
* @param int $creatorID
* @param string $language
* @param int $groupID
* @param string $groupName
*/
public function __construct($name = 'Test class', $identifier = 'test_class', $contentObjectName = '<test_attribute>', $creatorID = 14, $language = 'eng-GB', $groupID = 1, $groupName = 'Content')
{
if (eZContentLanguage::fetchByLocale($language) === false) {
$topPriorityLanguage = eZContentLanguage::topPriorityLanguage();
if ($topPriorityLanguage) {
$language = $topPriorityLanguage->attribute('locale');
}
}
$this->language = $language;
$this->class = eZContentClass::create($creatorID, array(), $this->language);
$this->class->setName($name, $this->language);
$this->class->setAttribute('contentobject_name', $contentObjectName);
$this->class->setAttribute('identifier', $identifier);
$this->class->store();
$languageID = eZContentLanguage::idByLocale($this->language);
$this->class->setAlwaysAvailableLanguageID($languageID);
$this->classGroup = eZContentClassClassGroup::create($this->id, $this->version, $groupID, $groupName);
$this->classGroup->store();
}
示例4: appendClass
function appendClass($class, $version = false)
{
if ($class instanceof eZContentClass) {
$classID = $class->attribute('id');
$version = $class->attribute('version');
} else {
$classID = $class;
}
$classGroupLink = eZContentClassClassGroup::create($classID, $version, $this->attribute('id'), $this->attribute('name'));
$classGroupLink->store();
return $classGroupLink;
}
示例5: array
eZDebug::writeError('Undefined default language', 'class/edit.php');
$Module->setExitStatus(eZModule::STATUS_FAILED);
return;
}
}
if (is_numeric($GroupID) and is_string($GroupName) and $GroupName != '') {
$user = eZUser::currentUser();
$user_id = $user->attribute('contentobject_id');
$class = eZContentClass::create($user_id, array(), $EditLanguage);
$class->setName(ezpI18n::tr('kernel/class/edit', 'New Class'), $EditLanguage);
$class->store();
$editLanguageID = eZContentLanguage::idByLocale($EditLanguage);
$class->setAlwaysAvailableLanguageID($editLanguageID);
$ClassID = $class->attribute('id');
$ClassVersion = $class->attribute('version');
$ingroup = eZContentClassClassGroup::create($ClassID, $ClassVersion, $GroupID, $GroupName);
$ingroup->store();
$Module->redirectTo($Module->functionURI('edit') . '/' . $ClassID . '/(language)/' . $EditLanguage);
return;
} else {
$errorResponseGroupName = $GroupName == '' ? '<Empty name>' : $GroupName;
$errorResponseGroupID = !is_numeric($GroupID) ? '<Empty ID>' : $GroupID;
eZDebug::writeError("Unknown class group: {$errorResponseGroupName} (ID: {$errorResponseGroupID})", 'Kernel - Class - Edit');
$Module->setExitStatus(eZModule::STATUS_FAILED);
return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
}
$contentClassHasInput = true;
if ($http->hasPostVariable('ContentClassHasInput')) {
$contentClassHasInput = $http->postVariable('ContentClassHasInput');
}
示例6: createClass
private function createClass($displayName, $classIdentifier, $groupIdentifier, $groupId)
{
$adminUserObject = eZUser::fetchByName("admin");
$adminUserObject->loginCurrent();
$adminUserId = $adminUserObject->attribute('contentobject_id');
$language = eZContentLanguage::topPriorityLanguage();
$editLanguage = $language->attribute('locale');
$class = eZContentClass::create($adminUserId, array(), $editLanguage);
// this is the display name, ez automatically creates the content-class-identifier from it
$class->setName($displayName, $editLanguage);
$class->setAttribute("identifier", $classIdentifier);
// default naming for objects - content classes should update this value once they have attributes added
$class->setAttribute('contentobject_name', 'eep-created-content-class');
$class->store();
$editLanguageID = eZContentLanguage::idByLocale($editLanguage);
$class->setAlwaysAvailableLanguageID($editLanguageID);
$ClassID = $class->attribute('id');
$ClassVersion = $class->attribute('version');
$ingroup = eZContentClassClassGroup::create($ClassID, $ClassVersion, $groupId, $groupIdentifier);
$ingroup->store();
// clean up the content class status
$class->storeDefined(array());
$adminUserObject->logoutCurrent();
}
示例7: 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
//}
}