/** * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved. * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 * @version 2012.6 * @package kernel */ $Module = $Params['Module']; $http = eZHTTPTool::instance(); $deleteIDArray = $http->hasSessionVariable('DeleteGroupIDArray') ? $http->sessionVariable('DeleteGroupIDArray') : array(); $groupsInfo = array(); $deleteResult = array(); $deleteClassIDList = array(); foreach ($deleteIDArray as $deleteID) { $deletedClassName = ''; $group = eZContentClassGroup::fetch($deleteID); if ($group != null) { $GroupName = $group->attribute('name'); $classList = eZContentClassClassGroup::fetchClassList(null, $deleteID); $groupClassesInfo = array(); foreach ($classList as $class) { $classID = $class->attribute("id"); $classGroups = eZContentClassClassGroup::fetchGroupList($classID, 0); if (count($classGroups) == 1) { $classObject = eZContentclass::fetch($classID); $className = $classObject->attribute("name"); $deletedClassName .= " '" . $className . "'"; $deleteClassIDList[] = $classID; $groupClassesInfo[] = array('class_name' => $className, 'object_count' => $classObject->objectCount()); } }
static function classDOMTree($class) { if (!$class) { $retValue = false; return $retValue; } $dom = new DOMDocument('1.0', 'utf-8'); $classNode = $dom->createElement('content-class'); $dom->appendChild($classNode); $serializedNameListNode = $dom->createElement('serialized-name-list'); $serializedNameListNode->appendChild($dom->createTextNode($class->attribute('serialized_name_list'))); $classNode->appendChild($serializedNameListNode); $identifierNode = $dom->createElement('identifier'); $identifierNode->appendChild($dom->createTextNode($class->attribute('identifier'))); $classNode->appendChild($identifierNode); $serializedDescriptionListNode = $dom->createElement('serialized-description-list'); $serializedDescriptionListNode->appendChild($dom->createTextNode($class->attribute('serialized_description_list'))); $classNode->appendChild($serializedDescriptionListNode); $remoteIDNode = $dom->createElement('remote-id'); $remoteIDNode->appendChild($dom->createTextNode($class->attribute('remote_id'))); $classNode->appendChild($remoteIDNode); $objectNamePatternNode = $dom->createElement('object-name-pattern'); $objectNamePatternNode->appendChild($dom->createTextNode($class->attribute('contentobject_name'))); $classNode->appendChild($objectNamePatternNode); $urlAliasPatternNode = $dom->createElement('url-alias-pattern'); $urlAliasPatternNode->appendChild($dom->createTextNode($class->attribute('url_alias_name'))); $classNode->appendChild($urlAliasPatternNode); $isContainer = $class->attribute('is_container') ? 'true' : 'false'; $classNode->setAttribute('is-container', $isContainer); $classNode->setAttribute('always-available', $class->attribute('always_available') ? 'true' : 'false'); $classNode->setAttribute('sort-field', eZContentObjectTreeNode::sortFieldName($class->attribute('sort_field'))); $classNode->setAttribute('sort-order', $class->attribute('sort_order')); // Remote data start $remoteNode = $dom->createElement('remote'); $classNode->appendChild($remoteNode); $ini = eZINI::instance(); $siteName = $ini->variable('SiteSettings', 'SiteURL'); $classURL = 'http://' . $siteName . '/class/view/' . $class->attribute('id'); $siteURL = 'http://' . $siteName . '/'; $siteUrlNode = $dom->createElement('site-url'); $siteUrlNode->appendChild($dom->createTextNode($siteURL)); $remoteNode->appendChild($siteUrlNode); $urlNode = $dom->createElement('url'); $urlNode->appendChild($dom->createTextNode($classURL)); $remoteNode->appendChild($urlNode); $classGroupsNode = $dom->createElement('groups'); $classGroupList = eZContentClassClassGroup::fetchGroupList($class->attribute('id'), $class->attribute('version')); foreach ($classGroupList as $classGroupLink) { $classGroup = eZContentClassGroup::fetch($classGroupLink->attribute('group_id')); if ($classGroup) { unset($groupNode); $groupNode = $dom->createElement('group'); $groupNode->setAttribute('id', $classGroup->attribute('id')); $groupNode->setAttribute('name', $classGroup->attribute('name')); $classGroupsNode->appendChild($groupNode); } } $remoteNode->appendChild($classGroupsNode); $idNode = $dom->createElement('id'); $idNode->appendChild($dom->createTextNode($class->attribute('id'))); $remoteNode->appendChild($idNode); $createdNode = $dom->createElement('created'); $createdNode->appendChild($dom->createTextNode($class->attribute('created'))); $remoteNode->appendChild($createdNode); $modifiedNode = $dom->createElement('modified'); $modifiedNode->appendChild($dom->createTextNode($class->attribute('modified'))); $remoteNode->appendChild($modifiedNode); $creatorNode = $dom->createElement('creator'); $remoteNode->appendChild($creatorNode); $creatorIDNode = $dom->createElement('user-id'); $creatorIDNode->appendChild($dom->createTextNode($class->attribute('creator_id'))); $creatorNode->appendChild($creatorIDNode); $creator = $class->attribute('creator'); if ($creator) { $creatorLoginNode = $dom->createElement('user-login'); $creatorLoginNode->appendChild($dom->createTextNode($creator->attribute('login'))); $creatorNode->appendChild($creatorLoginNode); } $modifierNode = $dom->createElement('modifier'); $remoteNode->appendChild($modifierNode); $modifierIDNode = $dom->createElement('user-id'); $modifierIDNode->appendChild($dom->createTextNode($class->attribute('modifier_id'))); $modifierNode->appendChild($modifierIDNode); $modifier = $class->attribute('modifier'); if ($modifier) { $modifierLoginNode = $dom->createElement('user-login'); $modifierLoginNode->appendChild($dom->createTextNode($modifier->attribute('login'))); $modifierNode->appendChild($modifierLoginNode); } // Remote data end $attributesNode = $dom->createElementNS('http://ezpublish/contentclassattribute', 'ezcontentclass-attribute:attributes'); $classNode->appendChild($attributesNode); $attributes = $class->fetchAttributes(); foreach ($attributes as $attribute) { $attributeNode = $dom->createElement('attribute'); $attributeNode->setAttribute('datatype', $attribute->attribute('data_type_string')); $required = $attribute->attribute('is_required') ? 'true' : 'false'; $attributeNode->setAttribute('required', $required); $searchable = $attribute->attribute('is_searchable') ? 'true' : 'false'; $attributeNode->setAttribute('searchable', $searchable); $informationCollector = $attribute->attribute('is_information_collector') ? 'true' : 'false'; $attributeNode->setAttribute('information-collector', $informationCollector); $translatable = $attribute->attribute('can_translate') ? 'true' : 'false'; $attributeNode->setAttribute('translatable', $translatable); $attributeRemoteNode = $dom->createElement('remote'); $attributeNode->appendChild($attributeRemoteNode); $attributeIDNode = $dom->createElement('id'); $attributeIDNode->appendChild($dom->createTextNode($attribute->attribute('id'))); $attributeRemoteNode->appendChild($attributeIDNode); $attributeSerializedNameListNode = $dom->createElement('serialized-name-list'); $attributeSerializedNameListNode->appendChild($dom->createTextNode($attribute->attribute('serialized_name_list'))); $attributeNode->appendChild($attributeSerializedNameListNode); $attributeIdentifierNode = $dom->createElement('identifier'); $attributeIdentifierNode->appendChild($dom->createTextNode($attribute->attribute('identifier'))); $attributeNode->appendChild($attributeIdentifierNode); $attributeSerializedDescriptionListNode = $dom->createElement('serialized-description-list'); $attributeSerializedDescriptionListNode->appendChild($dom->createTextNode($attribute->attribute('serialized_description_list'))); $attributeNode->appendChild($attributeSerializedDescriptionListNode); $attributeCategoryNode = $dom->createElement('category'); $attributeCategoryNode->appendChild($dom->createTextNode($attribute->attribute('category'))); $attributeNode->appendChild($attributeCategoryNode); $attributeSerializedDataTextNode = $dom->createElement('serialized-data-text'); $attributeSerializedDataTextNode->appendChild($dom->createTextNode($attribute->attribute('serialized_data_text'))); $attributeNode->appendChild($attributeSerializedDataTextNode); $attributePlacementNode = $dom->createElement('placement'); $attributePlacementNode->appendChild($dom->createTextNode($attribute->attribute('placement'))); $attributeNode->appendChild($attributePlacementNode); $attributeParametersNode = $dom->createElement('datatype-parameters'); $attributeNode->appendChild($attributeParametersNode); $dataType = $attribute->dataType(); if (is_object($dataType)) { $dataType->serializeContentClassAttribute($attribute, $attributeNode, $attributeParametersNode); } $attributesNode->appendChild($attributeNode); } eZDebug::writeDebug($dom->saveXML(), 'content class package XML'); return $classNode; }
$groupInfo = eZContentClassGroup::fetch( $GroupID ); if( !$groupInfo ) { return $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' ); } $list = eZContentClassClassGroup::fetchClassList( 0, $GroupID, $asObject = true ); $groupModifier = eZContentObject::fetch( $groupInfo->attribute( 'modifier_id') ); $tpl->setVariable( $tplname, $list ); $tpl->setVariable( "class_count", count( $list ) ); $tpl->setVariable( "GroupID", $GroupID ); $tpl->setVariable( "group", $groupInfo ); $tpl->setVariable( "group_modifier", $groupModifier ); } $group = eZContentClassGroup::fetch( $GroupID ); $groupName = $group->attribute( 'name' ); $tpl->setVariable( "module", $Module ); $Result = array(); $Result['content'] = $tpl->fetch( "design:class/classlist.tpl" ); $Result['path'] = array( array( 'url' => '/class/grouplist/', 'text' => ezpI18n::tr( 'kernel/class', 'Class groups' ) ), array( 'url' => false, 'text' => $groupName ) ); ?>