コード例 #1
0
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 ) );
            }
        }
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: truffo/eep
 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");
 }
コード例 #3
0
ファイル: ezsection_test.php プロジェクト: rmiguel/ezpublish
 /**
  * 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));
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 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);
 }
コード例 #6
0
ファイル: section_edit.php プロジェクト: nlescure/ezpublish
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));
}
コード例 #7
0
ファイル: ezapprove2type.php プロジェクト: brucem/ezapprove2
 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;
 }
コード例 #8
0
ファイル: edit.php プロジェクト: runelangseid/ezpublish
//
$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.');
            }
コード例 #9
0
        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')));
コード例 #10
0
ファイル: queued.php プロジェクト: legende91/ez
 * @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;
コード例 #11
0
ファイル: action.php プロジェクト: heliopsis/ezpublish-legacy
 }
 $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));
コード例 #12
0
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;
        }
    }
}
コード例 #13
0
 * @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;
コード例 #14
0
 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);
 }
コード例 #15
0
 /**
  * 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;
 }
コード例 #16
0
    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;
    }
コード例 #17
0
 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);
 }
コード例 #18
0
ファイル: edit.php プロジェクト: mugoweb/ezpublish-legacy
 */
$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.');
            }
コード例 #19
0
 /**
  * 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');
     $contentInfoArray['main_node_id'] = $node->attribute('main_node_id');
     $contentInfoArray['main_node_url_alias'] = false;
     // Add url alias for main node if it is not current node and user has access to it
     if (!$node->isMain()) {
         $mainNode = $object->mainNode();
         if ($mainNode->canRead()) {
             $contentInfoArray['main_node_url_alias'] = $mainNode->attribute('url_alias');
         }
     }
     $contentInfoArray['persistent_variable'] = false;
     if ($tpl->variable('persistent_variable') !== false) {
         $contentInfoArray['persistent_variable'] = $tpl->variable('persistent_variable');
         $keyArray[] = array('persistent_variable', $contentInfoArray['persistent_variable']);
         $res->setKeys($keyArray);
     }
     $contentInfoArray['class_group'] = $object->attribute('match_ingroup_id_list');
     $contentInfoArray['state'] = $object->attribute('state_id_array');
     $contentInfoArray['state_identifier'] = $object->attribute('state_identifier_array');
     $contentInfoArray['parent_class_id'] = $parentClassID;
     $contentInfoArray['parent_class_identifier'] = $parentClassIdentifier;
     $contentInfoArray['parent_node_remote_id'] = $parentNodeRemoteID;
     $contentInfoArray['parent_object_remote_id'] = $parentObjectRemoteID;
     $Result['content_info'] = $contentInfoArray;
     // Store which templates were used to make this cache.
     $Result['template_list'] = $tpl->templateFetchList();
     // Check if time to live is set in template
     if ($tpl->hasVariable('cache_ttl')) {
         $cacheTTL = $tpl->variable('cache_ttl');
     }
     if (!isset($cacheTTL)) {
         $cacheTTL = -1;
     }
     $Result['cache_ttl'] = $cacheTTL;
     // if cache_ttl is set to 0 from the template, we need to add a no-cache advice
     // to the node's data. That way, the retrieve callback on the next calls
     // will be able to determine earlier that no cache generation should be started
     // for this node
     if ($cacheTTL == 0) {
         $Result['no_cache'] = true;
     }
     if ($languageCode) {
         $node->setCurrentLanguage($oldLanguageCode);
     }
     return $Result;
 }
コード例 #20
0
ファイル: ezsection.php プロジェクト: jordanmanning/ezpublish
 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;
 }
コード例 #21
0
ファイル: ezjscajaxcontent.php プロジェクト: nfrp/ezpublish
 /**
  * Function for simplifying a content object or node
  *
  * @param mixed $obj
  * @param array $params
  * @return array
  */
 public static function simplify($obj, $params = array())
 {
     if (!$obj) {
         return array();
     } else {
         if ($obj instanceof eZContentObject) {
             $node = $obj->attribute('main_node');
             $contentObject = $obj;
         } else {
             if ($obj instanceof eZContentObjectTreeNode || $obj instanceof eZFindResultNode) {
                 $node = $obj;
                 $contentObject = $obj->attribute('object');
             } else {
                 if (isset($params['fetchNodeFunction']) && method_exists($obj, $params['fetchNodeFunction'])) {
                     // You can supply fetchNodeFunction parameter to be able to support other node related classes
                     $node = call_user_func(array($obj, $params['fetchNodeFunction']));
                     if (!$node instanceof eZContentObjectTreeNode) {
                         return '';
                     }
                     $contentObject = $node->attribute('object');
                 } else {
                     if (is_array($obj)) {
                         return $obj;
                         // Array is returned as is
                     } else {
                         return '';
                         // Other passed objects are not supported
                     }
                 }
             }
         }
     }
     $ini = eZINI::instance('site.ini');
     $params = array_merge(array('dataMap' => array(), 'fetchPath' => false, 'fetchSection' => false, 'fetchChildrenCount' => false, 'dataMapType' => array(), 'loadImages' => false, 'imagePreGenerateSizes' => array('small')), $params);
     if (!isset($params['imageSizes'])) {
         $imageIni = eZINI::instance('image.ini');
         $params['imageSizes'] = $imageIni->variable('AliasSettings', 'AliasList');
     }
     if ($params['imageSizes'] === null || !isset($params['imageSizes'][0])) {
         $params['imageSizes'] = array();
     }
     if (!isset($params['imageDataTypes'])) {
         $params['imageDataTypes'] = $ini->variable('ImageDataTypeSettings', 'AvailableImageDataTypes');
     }
     $ret = array();
     $attrtibuteArray = array();
     $ret['name'] = htmlentities($contentObject->attribute('name'), ENT_QUOTES, "UTF-8");
     $ret['contentobject_id'] = $ret['id'] = (int) $contentObject->attribute('id');
     $ret['contentobject_remote_id'] = $contentObject->attribute('remote_id');
     $ret['contentobject_state'] = implode(", ", $contentObject->attribute('state_identifier_array'));
     $ret['main_node_id'] = (int) $contentObject->attribute('main_node_id');
     $ret['version'] = (int) $contentObject->attribute('current_version');
     $ret['modified'] = $contentObject->attribute('modified');
     $ret['published'] = $contentObject->attribute('published');
     $ret['section_id'] = (int) $contentObject->attribute('section_id');
     $ret['current_language'] = $contentObject->attribute('current_language');
     $ret['owner_id'] = (int) $contentObject->attribute('owner_id');
     $ret['class_id'] = (int) $contentObject->attribute('contentclass_id');
     $ret['class_name'] = $contentObject->attribute('class_name');
     $ret['path_identification_string'] = $node->attribute('path_identification_string');
     $ret['translations'] = eZContentLanguage::decodeLanguageMask($contentObject->attribute('language_mask'), true);
     $ret['can_edit'] = $contentObject->attribute('can_edit');
     if (isset($params['formatDate'])) {
         $ret['modified_date'] = self::formatLocaleDate($contentObject->attribute('modified'), $params['formatDate']);
         $ret['published_date'] = self::formatLocaleDate($contentObject->attribute('published'), $params['formatDate']);
     }
     if (isset($params['fetchCreator'])) {
         $creator = $contentObject->attribute('current')->attribute('creator');
         if ($creator instanceof eZContentObject) {
             $ret['creator'] = array('id' => $creator->attribute('id'), 'name' => $creator->attribute('name'));
         } else {
             $ret['creator'] = array('id' => $contentObject->attribute('current')->attribute('creator_id'), 'name' => null);
             // user has been deleted
         }
     }
     if (isset($params['fetchClassIcon'])) {
         $operator = new eZWordToImageOperator();
         $tpl = eZTemplate::instance();
         $operatorValue = $contentObject->attribute('class_identifier');
         $operatorParameters = array(array(array(1, 'small')));
         $namedParameters = array();
         $operatorName = 'class_icon';
         $operator->modify($tpl, $operatorName, $operatorParameters, '', '', $operatorValue, $namedParameters, array());
         $ret['class_icon'] = $operatorValue;
     }
     if (isset($params['fetchThumbPreview'])) {
         $thumbUrl = '';
         $thumbWidth = 0;
         $thumbHeight = 0;
         $thumbDataType = isset($params['thumbDataType']) ? $params['thumbDataType'] : 'ezimage';
         $thumbImageSize = isset($params['thumbImageSize']) ? $params['thumbImageSize'] : 'small';
         foreach ($contentObject->attribute('data_map') as $key => $atr) {
             if ($atr->attribute('data_type_string') == $thumbDataType && $atr->attribute('has_content')) {
                 $imageContent = $atr->attribute('content');
                 if ($imageContent->hasAttribute($thumbImageSize)) {
                     $imageAlias = $imageContent->attribute($thumbImageSize);
                 } else {
                     eZDebug::writeError("Image alias does not exist: '{$thumbImageSize}', missing from image.ini?", __METHOD__);
                 }
                 $thumbUrl = isset($imageAlias['full_path']) ? $imageAlias['full_path'] : '';
                 $thumbWidth = isset($imageAlias['width']) ? (int) $imageAlias['width'] : 0;
                 $thumbHeight = isset($imageAlias['height']) ? (int) $imageAlias['height'] : 0;
                 if ($thumbUrl !== '') {
                     eZURI::transformURI($thumbUrl, true);
                 }
                 break;
             }
         }
         $ret['thumbnail_url'] = $thumbUrl;
         $ret['thumbnail_width'] = $thumbWidth;
         $ret['thumbnail_height'] = $thumbHeight;
     }
     if ($params['fetchSection']) {
         $section = eZSection::fetch($ret['section_id']);
         if ($section instanceof eZSection) {
             $ret['section'] = array('id' => $section->attribute('id'), 'name' => $section->attribute('name'), 'navigation_part_identifier' => $section->attribute('navigation_part_identifier'), 'locale' => $section->attribute('locale'));
         } else {
             $ret['section'] = null;
         }
     }
     if ($node) {
         // optimization for eZ Publish 4.1 (avoid fetching class)
         if ($node->hasAttribute('is_container')) {
             $ret['class_identifier'] = $node->attribute('class_identifier');
             $ret['is_container'] = (int) $node->attribute('is_container');
         } else {
             $class = $contentObject->attribute('content_class');
             $ret['class_identifier'] = $class->attribute('identifier');
             $ret['is_container'] = (int) $class->attribute('is_container');
         }
         $ret['node_id'] = (int) $node->attribute('node_id');
         $ret['parent_node_id'] = (int) $node->attribute('parent_node_id');
         $ret['node_remote_id'] = $node->attribute('remote_id');
         $ret['url_alias'] = $node->attribute('url_alias');
         $ret['url'] = $node->url();
         // force system url on empty urls (root node)
         if ($ret['url'] === '') {
             $ret['url'] = 'content/view/full/' . $node->attribute('node_id');
         }
         eZURI::transformURI($ret['url']);
         $ret['depth'] = (int) $node->attribute('depth');
         $ret['priority'] = (int) $node->attribute('priority');
         $ret['hidden_status_string'] = $node->attribute('hidden_status_string');
         if ($params['fetchPath']) {
             $ret['path'] = array();
             foreach ($node->attribute('path') as $n) {
                 $ret['path'][] = self::simplify($n);
             }
         } else {
             $ret['path'] = false;
         }
         if ($params['fetchChildrenCount']) {
             $ret['children_count'] = $ret['is_container'] ? (int) $node->attribute('children_count') : 0;
         } else {
             $ret['children_count'] = false;
         }
     } else {
         $class = $contentObject->attribute('content_class');
         $ret['class_identifier'] = $class->attribute('identifier');
         $ret['is_container'] = (int) $class->attribute('is_container');
     }
     $ret['image_attributes'] = array();
     if (is_array($params['dataMap']) && is_array($params['dataMapType'])) {
         $dataMap = $contentObject->attribute('data_map');
         $datatypeBlacklist = array_fill_keys($ini->variable('ContentSettings', 'DatatypeBlackListForExternal'), true);
         foreach ($dataMap as $key => $atr) {
             $dataTypeString = $atr->attribute('data_type_string');
             //if ( in_array( $dataTypeString, $params['imageDataTypes'], true) !== false )
             if (!in_array('all', $params['dataMap'], true) && !in_array($key, $params['dataMap'], true) && !in_array($dataTypeString, $params['dataMapType'], true) && !($params['loadImages'] && in_array($dataTypeString, $params['imageDataTypes'], true))) {
                 continue;
             }
             $attrtibuteArray[$key]['id'] = $atr->attribute('id');
             $attrtibuteArray[$key]['type'] = $dataTypeString;
             $attrtibuteArray[$key]['identifier'] = $key;
             if (isset($datatypeBlacklist[$dataTypeString])) {
                 $attrtibuteArray[$key]['content'] = null;
             } else {
                 $attrtibuteArray[$key]['content'] = $atr->toString();
             }
             // images
             if (in_array($dataTypeString, $params['imageDataTypes'], true) && $atr->hasContent()) {
                 $content = $atr->attribute('content');
                 $imageArray = array();
                 if ($content != null) {
                     foreach ($params['imageSizes'] as $size) {
                         $imageArray[$size] = false;
                         if (in_array($size, $params['imagePreGenerateSizes'], true)) {
                             if ($content->hasAttribute($size)) {
                                 $imageArray[$size] = $content->attribute($size);
                             } else {
                                 eZDebug::writeError("Image alias does not exist: '{$size}', missing from image.ini?", __METHOD__);
                             }
                         }
                     }
                     $ret['image_attributes'][] = $key;
                 }
                 if (!isset($imageArray['original'])) {
                     $imageArray['original'] = $content->attribute('original');
                 }
                 array_walk_recursive($imageArray, function (&$element, $key) {
                     // json_encode/xmlEncode need UTF8 encoded strings
                     // (exif) metadata might not be for instance
                     // see https://jira.ez.no/browse/EZP-19929
                     if (!mb_check_encoding($element, 'UTF-8')) {
                         $element = mb_convert_encoding((string) $element, 'UTF-8');
                     }
                 });
                 $attrtibuteArray[$key]['content'] = $imageArray;
             }
         }
     }
     $ret['data_map'] = $attrtibuteArray;
     return $ret;
 }
コード例 #22
0
 function fetchSectionList()
 {
     $sectionObjects = eZSection::fetchList();
     return array('result' => $sectionObjects);
 }
コード例 #23
0
 public static function fetchSectionList()
 {
     return array('result' => eZSection::fetchList());
 }
コード例 #24
0
 /**
  * Returns a valid limitation value to be saved in database
  *
  * @since 1.2.0
  * @param string $limitationType	Limitation type
  * @param string $limitationValue	Human readable input value
  * @return string	Value to be saved in database
  */
 private function getLimitationValue($limitationType, $limitationValue)
 {
     $limitationValue = $this->getReferenceID($limitationValue);
     switch ($limitationType) {
         case 'Class':
         case 'ParentClass':
             if (!is_int($limitationValue)) {
                 $class = eZContentClass::fetchByIdentifier($limitationValue);
                 if ($class) {
                     $limitationValue = $class->ID;
                 }
             }
             break;
         case 'Subtree':
             //Subtree limitations need to store path_string instead of node_id
             $val = (int) $limitationValue;
             if ($val > 0) {
                 $node = eZContentObjectTreeNode::fetch($val);
                 $limitationValue = $node->attribute('path_string');
             }
             break;
         case 'SiteAccess':
             //siteaccess name must be crc32'd
             if (!is_int($limitationValue)) {
                 $limitationValue = eZSys::ezcrc32($limitationValue);
             }
             break;
         case 'Section':
             if (!is_int($limitationValue)) {
                 $section = eZSection::fetchByIdentifier($limitationValue);
                 if ($section) {
                     $limitationValue = $section->attribute('id');
                 }
             }
             break;
     }
     return $limitationValue;
 }
コード例 #25
0
    // we changed prices => remove content cache
    eZContentCacheManager::clearAllContentCache();

    return $module->redirectTo( $module->functionURI( 'discountgroupview' ) . '/' . $discountGroupID );
}

$classList = eZContentClass::fetchList();
$productClassList = array();
foreach ( $classList as $class )
{
    if ( eZShopFunctions::isProductClass( $class ) )
        $productClassList[] = $class;
}

$sectionList = eZSection::fetchList();

$tpl = eZTemplate::factory();

$tpl->setVariable( 'module', $module );
$tpl->setVariable( 'discountgroup_id', $discountGroupID );
$tpl->setVariable( 'discountrule', $discountRule );

$tpl->setVariable( 'product_class_list', $productClassList );
$tpl->setVariable( 'section_list', $sectionList );

$tpl->setVariable( 'class_limitation_list', $discountRuleSelectedClasses );
$tpl->setVariable( 'section_limitation_list', $discountRuleSelectedSections );
$tpl->setVariable( 'product_list', $productList );

$tpl->setVariable( 'class_any_selected', in_array( -1, $discountRuleSelectedClasses ) );
コード例 #26
0
ファイル: ezsiteinstaller.php プロジェクト: nottavi/ezpublish
    function createContentSection( $params )
    {
        $section = false;

        $sectionName = $params['name'];
        $navigationPart = $params['navigation_part_identifier'];

        $section = new eZSection( array() );
        $section->setAttribute( 'name', $sectionName );
        $section->setAttribute( 'navigation_part_identifier', $navigationPart );
        $section->store();

        return $section;
    }
コード例 #27
0
     $db->commit();
     if (count($selectedObjectIDArray) > 0) {
         eZContentCacheManager::clearAllContentCache();
     }
     /* Clean up policy cache */
     eZUser::cleanupCache();
     $Module->redirectTo('/role/view/' . $roleID);
 } else {
     if (is_string($limitIdent) && !isset($limitValue)) {
         switch ($limitIdent) {
             case 'subtree':
                 eZContentBrowse::browse(array('action_name' => 'SelectObjectRelationNode', 'from_page' => '/role/assign/' . $roleID . '/' . $limitIdent, 'cancel_page' => '/role/view/' . $roleID), $Module);
                 return;
                 break;
             case 'section':
                 $sectionArray = eZSection::fetchList();
                 $tpl = eZTemplate::factory();
                 $tpl->setVariable('section_array', $sectionArray);
                 $tpl->setVariable('role_id', $roleID);
                 $tpl->setVariable('limit_ident', $limitIdent);
                 $Result = array();
                 $Result['content'] = $tpl->fetch('design:role/assign_limited_section.tpl');
                 $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/role', 'Limit on section')));
                 return;
                 break;
             default:
                 eZDebug::writeWarning('Unsupported assign limitation: ' . $limitIdent);
                 $Module->redirectTo('/role/view/' . $roleID);
                 break;
         }
     } else {
コード例 #28
0
 /**
  * Serialize the eZContentObject to be used to build the result in
  * JavaScript
  *
  * @param eZContentObject $object
  * @return array
  */
 public function serializeObject(eZContentObject $contentObject)
 {
     $section = eZSection::fetch($contentObject->attribute('section_id'));
     return array('object_info' => array('id' => $contentObject->attribute('id'), 'name' => $contentObject->attribute('name'), 'class_name' => $contentObject->attribute('class_name'), 'section_name' => $section->attribute('name'), 'published' => ezpI18n::tr('design/standard/content/datatype', 'Yes')));
 }
コード例 #29
0
                 $firstLoop = false;
             }
             $className = $class->attribute('name');
             $limitation .= "'" . $className . "'";
         }
     }
 } else {
     $limitation = ezpI18n::tr('kernel/shop', 'Any class');
 }
 $sectionRuleValues = eZDiscountSubRuleValue::fetchBySubRuleID($discountRuleID, 1);
 if ($sectionRuleValues != null) {
     $limitation .= ' ' . ezpI18n::tr('kernel/shop', 'in sections') . ' ';
     $firstLoop = true;
     foreach ($sectionRuleValues as $sectionRuleValue) {
         $sectionID = $sectionRuleValue->attribute('value');
         $section = eZSection::fetch($sectionID);
         if ($section) {
             if (!$firstLoop) {
                 $limitation .= ', ';
             } else {
                 $firstLoop = false;
             }
             $sectionName = $section->attribute('name');
             $limitation .= "'" . $sectionName . "'";
         }
     }
 } else {
     $limitation .= ' ' . ezpI18n::tr('kernel/shop', 'in any section');
 }
 $productRuleValues = eZDiscountSubRuleValue::fetchBySubRuleID($discountRuleID, 2);
 if ($productRuleValues != null) {
コード例 #30
0
 /**
  * Returns object's section identifier
  *
  * @return string|bool
  */
 public function sectionIdentifier()
 {
     $section = eZSection::fetch( $this->attribute( 'section_id' ) );
     if( $section instanceof eZSection )
     {
         return $section->attribute( 'identifier' );
     }
     return false;
 }