本文整理汇总了PHP中eZSection类的典型用法代码示例。如果您正苦于以下问题:PHP eZSection类的具体用法?PHP eZSection怎么用?PHP eZSection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZSection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sectionEditActionCheck
function sectionEditActionCheck( $module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage )
{
if ( $module->isCurrentAction( 'SectionEdit' ) )
{
$http = eZHTTPTool::instance();
if ( $http->hasPostVariable( 'SelectedSectionId' ) )
{
$selectedSectionID = (int) $http->postVariable( 'SelectedSectionId' );
$selectedSection = eZSection::fetch( $selectedSectionID );
if ( is_object( $selectedSection ) )
{
$currentUser = eZUser::currentUser();
if ( $currentUser->canAssignSectionToObject( $selectedSectionID, $object ) )
{
$db = eZDB::instance();
$db->begin();
$assignedNodes = $object->attribute( 'assigned_nodes' );
if ( count( $assignedNodes ) > 0 )
{
foreach ( $assignedNodes as $node )
{
if ( eZOperationHandler::operationIsAvailable( 'content_updatesection' ) )
{
$operationResult = eZOperationHandler::execute( 'content',
'updatesection',
array( 'node_id' => $node->attribute( 'node_id' ),
'selected_section_id' => $selectedSectionID ),
null,
true );
}
else
{
eZContentOperationCollection::updateSection( $node->attribute( 'node_id' ), $selectedSectionID );
}
}
}
else
{
// If there are no assigned nodes we should update db for the current object.
$objectID = $object->attribute( 'id' );
$db->query( "UPDATE ezcontentobject SET section_id='$selectedSectionID' WHERE id = '$objectID'" );
$db->query( "UPDATE ezsearch_object_word_link SET section_id='$selectedSectionID' WHERE contentobject_id = '$objectID'" );
}
$object->expireAllViewCache();
$db->commit();
}
else
{
eZDebug::writeError( "You do not have permissions to assign the section <" . $selectedSection->attribute( 'name' ) .
"> to the object <" . $object->attribute( 'name' ) . ">." );
}
$module->redirectToView( 'edit', array( $object->attribute( 'id' ), $editVersion, $editLanguage, $fromLanguage ) );
}
}
}
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:57,代码来源:section_edit.php
示例2: section_list
private function section_list()
{
$sectionObjects = eZSection::fetchList();
$results = array();
$results[] = array("Id", "NavigationPartIdentifier", "Count", "Name");
foreach ($sectionObjects as $section) {
$count = eZSectionFunctionCollection::fetchObjectListCount($section->ID);
$count = $count["result"];
$results[] = array($section->ID, $section->NavigationPartIdentifier, $count, $section->Name);
}
eep::printTable($results, "all sections");
}
开发者ID:truffo,项目名称:eep,代码行数:12,代码来源:index.php
示例3: testFetchByIdentifier
/**
* test fetchByIdentifier function
*/
public function testFetchByIdentifier()
{
global $eZContentSectionObjectCache;
$section = new eZSection(array());
$section->setAttribute('name', 'Test Section');
$section->setAttribute('identifier', 'test_section');
$section->store();
$sectionID = $section->attribute('id');
// assert that if the cache is set after fetching
$section2 = eZSection::fetchByIdentifier('test_section');
$this->assertEquals($sectionID, $section2->attribute('id'));
// assert that object is cached
$this->assertNotNull($eZContentSectionObjectCache['test_section']);
$this->assertNotNull($eZContentSectionObjectCache[$sectionID]);
// assert that the two object refer to same object
$this->assertSame($eZContentSectionObjectCache[$sectionID], $section2);
$this->assertSame(eZSection::fetch($sectionID), $section2);
// fetchByID and fetchByIdentifier, assert that the result is the same
$section3 = new eZSection(array());
$section3->setAttribute('name', 'Test Section3');
$section3->setAttribute('identifier', 'test_section3');
$section3->store();
$objectByID = eZSection::fetch($section3->attribute('id'));
$objectByIdentifier = eZSection::fetchByIdentifier('test_section3');
$this->assertSame($objectByID, $objectByIdentifier);
$arrayByIdentifier = eZSection::fetch($section3->attribute('id'), false);
$this->assertTrue(is_array($arrayByIdentifier));
}
开发者ID:rmiguel,项目名称:ezpublish,代码行数:31,代码来源:ezsection_test.php
示例4: sectionIDbyName
private function sectionIDbyName( $name )
{
$sectionID = false;
$sectionList = eZSection::fetchFilteredList( array( 'name' => $name ), false, false, true );
if( is_array( $sectionList ) && count( $sectionList ) > 0 )
{
$section = $sectionList[0];
if( is_object( $section ) )
{
$sectionID = $section->attribute( 'id' );
}
}
return $sectionID;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:14,代码来源:ezcreatesection.php
示例5: attribute
function attribute($attr)
{
switch ($attr) {
case 'sections':
$sections = eZSection::fetchList(false);
foreach ($sections as $key => $section) {
$sections[$key]['Name'] = $section['name'];
$sections[$key]['value'] = $section['id'];
}
return $sections;
break;
case 'languages':
return eZContentLanguage::fetchList();
break;
}
return eZWorkflowEventType::attribute($attr);
}
开发者ID:gggeek,项目名称:ezworkflowcollection,代码行数:17,代码来源:approvelocationtype.php
示例6: sectionEditActionCheck
function sectionEditActionCheck($module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage)
{
if (!$module->isCurrentAction('SectionEdit')) {
return;
}
$http = eZHTTPTool::instance();
if (!$http->hasPostVariable('SelectedSectionId')) {
return;
}
$selectedSection = eZSection::fetch((int) $http->postVariable('SelectedSectionId'));
if (!$selectedSection instanceof eZSection) {
return;
}
$selectedSection->applyTo($object);
eZContentCacheManager::clearContentCacheIfNeeded($object->attribute('id'));
$module->redirectToView('edit', array($object->attribute('id'), $editVersion, $editLanguage, $fromLanguage));
}
开发者ID:nlescure,项目名称:ezpublish,代码行数:17,代码来源:section_edit.php
示例7: attribute
function attribute($attr)
{
switch ($attr) {
case 'sections':
#include_once( 'kernel/classes/ezsection.php' );
$sections = eZSection::fetchList(false);
foreach (array_keys($sections) as $key) {
$section = $sections[$key];
$section['Name'] = $section['name'];
$section['value'] = $section['id'];
}
return $sections;
break;
}
$eventValue = eZWorkflowEventType::attribute($attr);
return $eventValue;
}
开发者ID:brucem,项目名称:ezapprove2,代码行数:17,代码来源:ezapprove2type.php
示例8: array
//
$http = eZHTTPTool::instance();
$SectionID = $Params["SectionID"];
$Module = $Params['Module'];
$tpl = eZTemplate::factory();
if ($SectionID == 0) {
$section = array('id' => 0, 'name' => ezpI18n::tr('kernel/section', 'New section'), 'navigation_part_identifier' => 'ezcontentnavigationpart');
} else {
$section = eZSection::fetch($SectionID);
if ($section === null) {
return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
}
if ($http->hasPostVariable("StoreButton")) {
if ($SectionID == 0) {
$section = new eZSection(array());
}
$section->setAttribute('name', $http->postVariable('Name'));
$sectionIdentifier = trim($http->postVariable('SectionIdentifier'));
$errorMessage = '';
if ($sectionIdentifier === '') {
$errorMessage = ezpI18n::tr('design/admin/section/edit', 'Identifier can not be empty');
} else {
if (preg_match('/(^[^A-Za-z])|\\W/', $sectionIdentifier)) {
$errorMessage = ezpI18n::tr('design/admin/section/edit', 'Identifier should consist of letters, numbers or \'_\' with letter prefix.');
} else {
$conditions = array('identifier' => $sectionIdentifier, 'id' => array('!=', $SectionID));
$existingSection = eZSection::fetchFilteredList($conditions);
if (count($existingSection) > 0) {
$errorMessage = ezpI18n::tr('design/admin/section/edit', 'The identifier has been used in another section.');
}
开发者ID:runelangseid,项目名称:ezpublish,代码行数:31,代码来源:edit.php
示例9: foreach
if ($http->hasSessionVariable('SectionIDArray')) {
$sectionIDArray = $http->sessionVariable('SectionIDArray');
$db = eZDB::instance();
$db->begin();
foreach ($sectionIDArray as $sectionID) {
$section = eZSection::fetch($sectionID);
if (is_object($section) and $section->canBeRemoved()) {
// Clear content cache if needed
eZContentCacheManager::clearContentCacheIfNeededBySectionID($sectionID);
$section->remove();
}
}
$db->commit();
}
} else {
return $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
}
$viewParameters = array('offset' => $offset);
$sectionArray = eZSection::fetchByOffset($offset, $limit);
$sectionCount = eZSection::sectionCount();
$currentUser = eZUser::currentUser();
$allowedAssignSectionList = $currentUser->canAssignSectionList();
$tpl->setVariable("limit", $limit);
$tpl->setVariable('section_array', $sectionArray);
$tpl->setVariable('section_count', $sectionCount);
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('allowed_assign_sections', $allowedAssignSectionList);
$Result = array();
$Result['content'] = $tpl->fetch("design:section/list.tpl");
$Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/section', 'Sections')));
开发者ID:,项目名称:,代码行数:31,代码来源:
示例10: array
* @version 2012.6
* @package kernel
* @subpackage content
*/
$tpl = eZTemplate::factory();
$module = $Params['Module'];
$http = eZHTTPTool::instance();
$pContentObjectId = $Params['ContentObjectID'];
$pVersion = $Params['version'];
$tpl->setVariable('contentObjectId', $pContentObjectId);
$tpl->setVariable('version', $pVersion);
$virtualNodeID = 0;
$contentObject = eZContentObject::fetch($pContentObjectId);
$contentObjectVersion = $contentObject->version($pVersion);
$nodeAssignments = $contentObjectVersion->attribute('node_assignments');
$contentClass = eZContentClass::fetch($contentObject->attribute('contentclass_id'));
$section = eZSection::fetch($contentObject->attribute('section_id'));
$navigationPartIdentifier = $section->attribute('navigation_part_identifier');
$res = eZTemplateDesignResource::instance();
$designKeys = array(array('object', $contentObject->attribute('id')), array('node', $virtualNodeID), array('remote_id', $contentObject->attribute('remote_id')), array('class', $contentClass->attribute('id')), array('class_identifier', $contentClass->attribute('identifier')), array('class_group', $contentObject->attribute('match_ingroup_id_list')), array('state', $contentObject->attribute('state_id_array')), array('state_identifier', $contentObject->attribute('state_identifier_array')), array('section', $contentObject->attribute('section_id')), array('section_identifier', $section->attribute('identifier')));
$res->setKeys($designKeys);
if ($http->hasSessionVariable('RedirectURIAfterPublish')) {
$tpl->setVariable('redirect_uri', $http->sessionVariable('RedirectURIAfterPublish'));
}
$tpl->setVariable('content_object', $contentObject);
$tpl->setVariable('content_object_version', $contentObjectVersion);
$tpl->setVariable('content_class', $contentClass);
$Result['path'] = array(array('text' => ezpI18n::tr('kernel/content', 'Content'), 'url' => false), array('text' => ezpI18n::tr('kernel/content', 'Publishing queue'), 'url' => false), array('text' => $contentObject->attribute('name'), 'url' => false));
$Result['content'] = $tpl->fetch('design:content/queued.tpl');
$Result['navigation_part'] = $navigationPartIdentifier;
return $Result;
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:queued.php
示例11: array
}
$contentObjectID = $http->postVariable('ContentObjectID', 1);
$hideRemoveConfirm = false;
if ($http->hasPostVariable('HideRemoveConfirmation')) {
$hideRemoveConfirm = $http->postVariable('HideRemoveConfirmation') ? true : false;
}
if ($contentNodeID != null) {
$http->setSessionVariable('CurrentViewMode', $viewMode);
$http->setSessionVariable('ContentNodeID', $parentNodeID);
$http->setSessionVariable('HideRemoveConfirmation', $hideRemoveConfirm);
$http->setSessionVariable('DeleteIDArray', array($contentNodeID));
$http->setSessionVariable('RedirectURIAfterRemove', $http->postVariable('RedirectURIAfterRemove', false));
$http->setSessionVariable('RedirectIfCancel', $http->postVariable('RedirectIfCancel', false));
$object = eZContentObject::fetchByNodeID($contentNodeID);
if ($object instanceof eZContentObject) {
$section = eZSection::fetch($object->attribute('section_id'));
}
if (isset($section) && $section) {
$navigationPartIdentifier = $section->attribute('navigation_part_identifier');
} else {
$navigationPartIdentifier = null;
}
if ($navigationPartIdentifier and $navigationPartIdentifier == 'ezusernavigationpart') {
$module->redirectTo($module->functionURI('removeuserobject') . '/');
} elseif ($navigationPartIdentifier and $navigationPartIdentifier == 'ezmedianavigationpart') {
$module->redirectTo($module->functionURI('removemediaobject') . '/');
} else {
$module->redirectTo($module->functionURI('removeobject') . '/');
}
} else {
$module->redirectToView('view', array($viewMode, $parentNodeID));
开发者ID:heliopsis,项目名称:ezpublish-legacy,代码行数:31,代码来源:action.php
示例12: checkRelationActions
function checkRelationActions($module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage)
{
$http = eZHTTPTool::instance();
if ($module->isCurrentAction('BrowseForObjects')) {
$objectID = $object->attribute('id');
$assignedNodes = $object->attribute('assigned_nodes');
$assignedNodesIDs = array();
foreach ($assignedNodes as $node) {
$assignedNodesIDs = $node->attribute('node_id');
}
unset($assignedNodes);
eZContentBrowse::browse(array('action_name' => 'AddRelatedObject', 'description_template' => 'design:content/browse_related.tpl', 'content' => array('object_id' => $objectID, 'object_version' => $editVersion, 'object_language' => $editLanguage), 'keys' => array('class' => $class->attribute('id'), 'class_id' => $class->attribute('identifier'), 'classgroup' => $class->attribute('ingroup_id_list'), 'section' => $object->attribute('section_id')), 'ignore_nodes_select' => $assignedNodesIDs, 'from_page' => $module->redirectionURI('content', 'edit', array($objectID, $editVersion, $editLanguage, $fromLanguage))), $module);
return eZModule::HOOK_STATUS_CANCEL_RUN;
}
if ($module->isCurrentAction('UploadFileRelation')) {
$objectID = $object->attribute('id');
$section = eZSection::fetch($object->attribute('section_id'));
$navigationPart = false;
if ($section) {
$navigationPart = $section->attribute('navigation_part_identifier');
}
$location = false;
if ($module->hasActionParameter('UploadRelationLocation')) {
$location = $module->actionParameter('UploadRelationLocation');
}
// We only do direct uploading if we have the uploaded HTTP file
// if not we need to go to the content/upload page.
if (eZHTTPFile::canFetch('UploadRelationFile')) {
$upload = new eZContentUpload();
if ($upload->handleUpload($result, 'UploadRelationFile', $location, false)) {
$relatedObjectID = $result['contentobject_id'];
if ($relatedObjectID) {
$db = eZDB::instance();
$db->begin();
$object->addContentObjectRelation($relatedObjectID, $editVersion);
$db->commit();
}
}
} else {
eZContentUpload::upload(array('action_name' => 'RelatedObjectUpload', 'description_template' => 'design:content/upload_related.tpl', 'navigation_part_identifier' => $navigationPart, 'content' => array('object_id' => $objectID, 'object_version' => $editVersion, 'object_language' => $editLanguage), 'keys' => array('class' => $class->attribute('id'), 'class_id' => $class->attribute('identifier'), 'classgroup' => $class->attribute('ingroup_id_list'), 'section' => $object->attribute('section_id')), 'result_action_name' => 'UploadedFileRelation', 'ui_context' => 'edit', 'result_module' => array('content', 'edit', array($objectID, $editVersion, $editLanguage, $fromLanguage))), $module);
return eZModule::HOOK_STATUS_CANCEL_RUN;
}
}
if ($module->isCurrentAction('DeleteRelation')) {
$objectID = $object->attribute('id');
if ($http->hasPostVariable('DeleteRelationIDArray')) {
$relationObjectIDs = $http->postVariable('DeleteRelationIDArray');
} else {
$relationObjectIDs = array();
}
$db = eZDB::instance();
$db->begin();
foreach ($relationObjectIDs as $relationObjectID) {
$object->removeContentObjectRelation($relationObjectID, $editVersion);
}
$db->commit();
}
if ($module->isCurrentAction('NewObject')) {
if ($http->hasPostVariable('ClassID')) {
if ($http->hasPostVariable('SectionID')) {
$sectionID = $http->postVariable('SectionID');
} else {
$sectionID = 0;
/* Will be changed later */
}
$contentClassID = $http->postVariable('ClassID');
$class = eZContentClass::fetch($contentClassID);
$db = eZDB::instance();
$db->begin();
$relatedContentObject = $class->instantiate(false, $sectionID);
$db->commit();
$newObjectID = $relatedContentObject->attribute('id');
$relatedContentVersion = $relatedContentObject->attribute('current');
if ($relatedContentObject->attribute('can_edit')) {
$db = eZDB::instance();
$db->begin();
$assignmentHandler = new eZContentObjectAssignmentHandler($relatedContentObject, $relatedContentVersion);
$sectionID = (int) $assignmentHandler->setupAssignments(array('group-name' => 'RelationAssignmentSettings', 'default-variable-name' => 'DefaultAssignment', 'specific-variable-name' => 'ClassSpecificAssignment', 'section-id-wanted' => true, 'fallback-node-id' => $object->attribute('main_node_id')));
$http->setSessionVariable('ParentObject', array($object->attribute('id'), $editVersion, $editLanguage));
$http->setSessionVariable('NewObjectID', $newObjectID);
/* Change section ID to the same one as the main node placement */
$db->query("UPDATE ezcontentobject SET section_id = {$sectionID} WHERE id = {$newObjectID}");
$db->commit();
$module->redirectToView('edit', array($relatedContentObject->attribute('id'), $relatedContentObject->attribute('current_version'), false));
} else {
$db = eZDB::instance();
$db->begin();
$relatedContentObject->purge();
$db->commit();
}
return;
}
}
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:94,代码来源:relation_edit.php
示例13: array
* @version 2013.11
* @package update
*/
require 'autoload.php';
$script = eZScript::instance(array('description' => 'eZ Publish section identifier update script. ' . 'This script will update existing sections with missing identifiers.', 'use-session' => false, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions('', '', array('-q' => 'Quiet mode'));
$script->initialize();
$cli = eZCLI::instance();
$trans = eZCharTransform::instance();
// Fetch 50 items per iteration
$limit = 50;
$offset = 0;
do {
// Fetch items with empty identifier
$rows = eZSection::fetchFilteredList(null, $offset, $limit);
if (!$rows) {
break;
}
foreach ($rows as $row) {
if ($row->attribute('identifier') == '') {
// Create a new section identifier with NAME_ID pattern
$name = $row->attribute('name');
$identifier = $trans->transformByGroup($name, 'identifier') . '_' . $row->attribute('id');
// Set new section identifier and store it
$row->setAttribute('identifier', $identifier);
$row->store();
$cli->output("Setting identifier '{$identifier}' for section '{$name}'");
}
}
$offset += $limit;
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:31,代码来源:updatesectionidentifier.php
示例14: assignSectionToSubTree
static function assignSectionToSubTree($nodeID, $sectionID, $oldSectionID = false)
{
$db = eZDB::instance();
$node = eZContentObjectTreeNode::fetch($nodeID);
$nodePath = $node->attribute('path_string');
$sectionID = (int) $sectionID;
$pathString = " path_string like '{$nodePath}%' AND ";
// fetch the object id's which needs to be updated
$objectIDArray = $db->arrayQuery("SELECT\n ezcontentobject.id\n FROM\n ezcontentobject_tree, ezcontentobject\n WHERE\n {$pathString}\n ezcontentobject_tree.contentobject_id=ezcontentobject.id AND\n ezcontentobject_tree.main_node_id=ezcontentobject_tree.node_id");
if (count($objectIDArray) == 0) {
return;
}
// Who assigns which section at which node should be logged.
$section = eZSection::fetch($sectionID);
$object = $node->object();
eZAudit::writeAudit('section-assign', array('Section ID' => $sectionID, 'Section name' => $section->attribute('name'), 'Node ID' => $nodeID, 'Content object ID' => $object->attribute('id'), 'Content object name' => $object->attribute('name'), 'Comment' => 'Assigned a section to the current node and all child objects: eZContentObjectTreeNode::assignSectionToSubTree()'));
$objectSimpleIDArray = array();
foreach ($objectIDArray as $objectID) {
$objectSimpleIDArray[] = $objectID['id'];
}
$filterPart = '';
if ($oldSectionID !== false) {
$oldSectionID = (int) $oldSectionID;
$filterPart = " section_id = '{$oldSectionID}' and ";
}
$db->begin();
foreach (array_chunk($objectSimpleIDArray, 100) as $pagedObjectIDs) {
$db->query("UPDATE ezcontentobject SET section_id='{$sectionID}' WHERE {$filterPart} " . $db->generateSQLINStatement($pagedObjectIDs, 'id', false, true, 'int'));
eZSearch::updateObjectsSection($pagedObjectIDs, $sectionID);
}
$db->commit();
// clear caches for updated objects
eZContentObject::clearCache($objectSimpleIDArray);
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:34,代码来源:ezcontentobjecttreenode.php
示例15: createSectionDOMElement
/**
* Create Section element.
*
* @param DOMDocument Owner DOMDocument
* @param eZSection eZSection object
*
* @return DOMElement Section DOMElement, example:
*
* <Section ID="2" name="News" />
*/
protected function createSectionDOMElement(DOMDocument $domDocument, eZSection $section)
{
$sectionElement = $domDocument->createElement('Section');
// Set attributes
$sectionElement->setAttribute('ID', $section->attribute('id'));
$sectionElement->setAttribute('name', $section->attribute('name'));
return $sectionElement;
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:18,代码来源:ezrestodfhandler.php
示例16: allowedAssignSectionList
function allowedAssignSectionList()
{
$currentUser = eZUser::currentUser();
$sectionIDList = $currentUser->canAssignToObjectSectionList( $this );
$sectionList = array();
if ( in_array( '*', $sectionIDList ) )
{
$sectionList = eZSection::fetchList( false );
}
else
{
$sectionIDList[] = $this->attribute( 'section_id' );
$sectionList = eZSection::fetchFilteredList( array( 'id' => array( $sectionIDList ) ), false, false, false );
}
return $sectionList;
}
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:17,代码来源:ezcontentobject.php
示例17: attribute
function attribute($attr)
{
switch ($attr) {
case 'sections':
$sections = eZSection::fetchList(false);
foreach ($sections as $key => $section) {
$sections[$key]['Name'] = $section['name'];
$sections[$key]['value'] = $section['id'];
}
return $sections;
break;
case 'languages':
return eZContentLanguage::fetchList();
break;
case 'usergroups':
$groups = eZPersistentObject::fetchObjectList(eZContentObject::definition(), array('id', 'name'), array('contentclass_id' => 3, 'status' => eZContentObject::STATUS_PUBLISHED), null, null, false);
foreach ($groups as $key => $group) {
$groups[$key]['Name'] = $group['name'];
$groups[$key]['value'] = $group['id'];
}
return $groups;
break;
case 'contentclass_list':
$classes = eZContentClass::fetchList(eZContentClass::VERSION_STATUS_DEFINED, true, false, array('name' => 'asc'));
$classList = array();
for ($i = 0; $i < count($classes); $i++) {
$classList[$i]['Name'] = $classes[$i]->attribute('name');
$classList[$i]['value'] = $classes[$i]->attribute('id');
}
return $classList;
break;
case 'workflow_list':
$workflows = eZWorkflow::fetchList();
$workflowList = array();
for ($i = 0; $i < count($workflows); $i++) {
$workflowList[$i]['Name'] = $workflows[$i]->attribute('name');
$workflowList[$i]['value'] = $workflows[$i]->attribute('id');
}
return $workflowList;
break;
}
return eZWorkflowEventType::attribute($attr);
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:43,代码来源:ezmultiplexertype.php
示例18: array
*/
$http = eZHTTPTool::instance();
$SectionID = $Params["SectionID"];
$Module = $Params['Module'];
$tpl = eZTemplate::factory();
if ($SectionID == 0) {
$section = array('id' => 0, 'name' => ezpI18n::tr('kernel/section', 'New section'), 'navigation_part_identifier' => 'ezcontentnavigationpart');
} else {
$section = eZSection::fetch($SectionID);
if ($section === null) {
return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
}
if ($http->hasPostVariable("StoreButton")) {
if ($SectionID == 0) {
$section = new eZSection(array());
}
$section->setAttribute('name', $http->postVariable('Name'));
$sectionIdentifier = trim($http->postVariable('SectionIdentifier'));
$errorMessage = '';
if ($sectionIdentifier === '') {
$errorMessage = ezpI18n::tr('design/admin/section/edit', 'Identifier can not be empty');
} else {
if (preg_match('/(^[^A-Za-z])|\\W/', $sectionIdentifier)) {
$errorMessage = ezpI18n::tr('design/admin/section/edit', 'Identifier should consist of letters, numbers or \'_\' with letter prefix.');
} else {
$conditions = array('identifier' => $sectionIdentifier, 'id' => array('!=', !empty($SectionID) ? $SectionID : 0));
$existingSection = eZSection::fetchFilteredList($conditions);
if (count($existingSection) > 0) {
$errorMessage = ezpI18n::tr('design/admin/section/edit', 'The identifier has been used in another section.');
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:31,代码来源:edit.php
示例19: generateNodeViewData
/**
* Generate result data for a node view
*
* @param eZTemplate $tpl
* @param eZContentObjectTreeNode $node
* @param eZContentObject $object
* @param bool|string $languageCode
* @param string $viewMode
* @param int $offset
* @param array $viewParameters
* @param bool|array $collectionAttributes
* @param bool $validation
* @return array Result array for view
*/
static function generateNodeViewData(eZTemplate $tpl, eZContentObjectTreeNode $node, eZContentObject $object, $languageCode, $viewMode, $offset, array $viewParameters = array('offset' => 0, 'year' => false, 'month' => false, 'day' => false), $collectionAttributes = false, $validation = false)
{
$section = eZSection::fetch($object->attribute('section_id'));
if ($section) {
$navigationPartIdentifier = $section->attribute('navigation_part_identifier');
$sectionIdentifier = $section->attribute('identifier');
} else {
$navigationPartIdentifier = null;
$sectionIdentifier = null;
}
$keyArray = array(array('object', $object->attribute('id')), array('node', $node->attribute('node_id')), array('parent_node', $node->attribute('parent_node_id')), array('class', $object->attribute('contentclass_id')), array('class_identifier', $node->attribute('class_identifier')), array('view_offset', $offset), array('viewmode', $viewMode), array('remote_id', $object->attribute('remote_id')), array('node_remote_id', $node->attribute('remote_id')), array('navigation_part_identifier', $navigationPartIdentifier), array('depth', $node->attribute('depth')), array('url_alias', $node->attribute('url_alias')), array('class_group', $object->attribute('match_ingroup_id_list')), array('state', $object->attribute('state_id_array')), array('state_identifier', $object->attribute('state_identifier_array')), array('section', $object->attribute('section_id')), array('section_identifier', $sectionIdentifier));
$parentClassID = false;
$parentClassIdentifier = false;
$parentNodeRemoteID = false;
$parentObjectRemoteID = false;
$parentNode = $node->attribute('parent');
if (is_object($parentNode)) {
$parentNodeRemoteID = $parentNode->attribute('remote_id');
$keyArray[] = array('parent_node_remote_id', $parentNodeRemoteID);
$parentObject = $parentNode->attribute('object');
if (is_object($parentObject)) {
$parentObjectRemoteID = $parentObject->attribute('remote_id');
$keyArray[] = array('parent_object_remote_id', $parentObjectRemoteID);
$parentClass = $parentObject->contentClass();
if (is_object($parentClass)) {
$parentClassID = $parentClass->attribute('id');
$parentClassIdentifier = $parentClass->attribute('identifier');
$keyArray[] = array('parent_class', $parentClassID);
$keyArray[] = array('parent_class_identifier', $parentClassIdentifier);
}
}
}
$res = eZTemplateDesignResource::instance();
$res->setKeys($keyArray);
if ($languageCode) {
$oldLanguageCode = $node->currentLanguage();
$node->setCurrentLanguage($languageCode);
}
$tpl->setVariable('node', $node);
$tpl->setVariable('viewmode', $viewMode);
$tpl->setVariable('language_code', $languageCode);
if (isset($viewParameters['_custom'])) {
foreach ($viewParameters['_custom'] as $customVarName => $customValue) {
$tpl->setVariable($customVarName, $customValue);
}
unset($viewParameters['_custom']);
}
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('collection_attributes', $collectionAttributes);
$tpl->setVariable('validation', $validation);
$tpl->setVariable('persistent_variable', false);
$parents = $node->attribute('path');
$path = array();
$titlePath = array();
foreach ($parents as $parent) {
$path[] = array('text' => $parent->attribute('name'), 'url' => '/content/view/full/' . $parent->attribute('node_id'), 'url_alias' => $parent->attribute('url_alias'), 'node_id' => $parent->attribute('node_id'));
}
$titlePath = $path;
$path[] = array('text' => $object->attribute('name'), 'url' => false, 'url_alias' => false, 'node_id' => $node->attribute('node_id'));
$titlePath[] = array('text' => $object->attribute('name'), 'url' => false, 'url_alias' => false);
$tpl->setVariable('node_path', $path);
$event = ezpEvent::getInstance();
$event->notify('content/pre_rendering', array($node, $tpl, $viewMode));
$Result = array();
$Result['content'] = $tpl->fetch('design:node/view/' . $viewMode . '.tpl');
$Result['view_parameters'] = $viewParameters;
$Result['path'] = $path;
$Result['title_path'] = $titlePath;
$Result['section_id'] = $object->attribute('section_id');
$Result['node_id'] = $node->attribute('node_id');
$Result['navigation_part'] = $navigationPartIdentifier;
$contentInfoArray = array();
$contentInfoArray['object_id'] = $object->attribute('id');
$contentInfoArray['node_id'] = $node->attribute('node_id');
$contentInfoArray['parent_node_id'] = $node->attribute('parent_node_id');
$contentInfoArray['class_id'] = $object->attribute('contentclass_id');
$contentInfoArray['class_identifier'] = $node->attribute('class_identifier');
$contentInfoArray['remote_id'] = $object->attribute('remote_id');
$contentInfoArray['node_remote_id'] = $node->attribute('remote_id');
$contentInfoArray['offset'] = $offset;
$contentInfoArray['viewmode'] = $viewMode;
$contentInfoArray['navigation_part_identifier'] = $navigationPartIdentifier;
$contentInfoArray['node_depth'] = $node->attribute('depth');
$contentInfoArray['url_alias'] = $node->attribute('url_alias');
$contentInfoArray['current_language'] = $object->attribute('current_language');
$contentInfoArray['language_mask'] = $object->attribute('language_mask');
//.........这里部分代码省略.........
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:101,代码来源:eznodeviewfunctions.php
示例20: fetchByOffset
static function fetchByOffset($offset, $limit, $asObject = true)
{
$sectionList = eZPersistentObject::fetchObjectList(eZSection::definition(), null, null, array('name' => 'ASC'), array('offset' => $offset, 'length' => $limit), $asObject);
return $sectionList;
}
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:5,代码来源:ezsection.php
注:本文中的eZSection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论