本文整理汇总了PHP中eZContentObjectTreeNode::sortFieldName方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectTreeNode::sortFieldName方法的具体用法?PHP eZContentObjectTreeNode::sortFieldName怎么用?PHP eZContentObjectTreeNode::sortFieldName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectTreeNode
的用法示例。
在下文中一共展示了eZContentObjectTreeNode::sortFieldName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: classDOMTree
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);
//.........这里部分代码省略.........
示例2: serialize
function serialize($options, $contentNodeIDArray, $topNodeIDArray)
{
if ($options['node_assignment'] == 'main' && $this->attribute('main_node_id') != $this->attribute('node_id')) {
return false;
}
if (!in_array($this->attribute('node_id'), array_keys($contentNodeIDArray))) {
return false;
}
$dom = new DOMDocument('1.0', 'utf-8');
$nodeAssignmentNode = $dom->createElement('node-assignment');
if ($this->attribute('main_node_id') == $this->attribute('node_id')) {
$nodeAssignmentNode->setAttribute('is-main-node', 1);
}
if (!in_array($this->attribute('node_id'), $topNodeIDArray)) {
$parentNode = $this->attribute('parent');
$nodeAssignmentNode->setAttribute('parent-node-remote-id', $parentNode->attribute('remote_id'));
}
$nodeAssignmentNode->setAttribute('name', $this->attribute('name'));
$nodeAssignmentNode->setAttribute('node-id', $this->attribute('node_id'));
$nodeAssignmentNode->setAttribute('remote-id', $this->attribute('remote_id'));
$nodeAssignmentNode->setAttribute('sort-field', eZContentObjectTreeNode::sortFieldName($this->attribute('sort_field')));
$nodeAssignmentNode->setAttribute('sort-order', $this->attribute('sort_order'));
$nodeAssignmentNode->setAttribute('priority', $this->attribute('priority'));
return $nodeAssignmentNode;
}