当前位置: 首页>>代码示例>>PHP>>正文


PHP eZContentObjectTreeNode::showInvisibleNodes方法代码示例

本文整理汇总了PHP中eZContentObjectTreeNode::showInvisibleNodes方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectTreeNode::showInvisibleNodes方法的具体用法?PHP eZContentObjectTreeNode::showInvisibleNodes怎么用?PHP eZContentObjectTreeNode::showInvisibleNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZContentObjectTreeNode的用法示例。


在下文中一共展示了eZContentObjectTreeNode::showInvisibleNodes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

$nodeAssignments = $contentObject->attribute('assigned_nodes');
if (count($nodeAssignments) === 0) {
    // oops, no locations. probably it's related object. Let's check his owners
    $ownerList = eZContentObject::fetch($contentObjectID)->reverseRelatedObjectList(false, false, false, false);
    foreach ($ownerList as $owner) {
        if (is_object($owner)) {
            $ownerNodeAssignments = $owner->attribute('assigned_nodes');
            $nodeAssignments = array_merge($nodeAssignments, $ownerNodeAssignments);
        }
    }
}
// If exists location that current user has access to and location is visible.
$canAccess = false;
$isContentDraft = $contentObject->attribute('status') == eZContentObject::STATUS_DRAFT;
foreach ($nodeAssignments as $nodeAssignment) {
    if (eZContentObjectTreeNode::showInvisibleNodes() || !$nodeAssignment->attribute('is_invisible') and $nodeAssignment->canRead()) {
        $canAccess = true;
        break;
    }
}
if (!$canAccess && !$isContentDraft) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
// If $version is not current version (published)
// we should check permission versionRead for the $version.
if ($version != $currentVersion || $isContentDraft) {
    $versionObj = eZContentObjectVersion::fetchVersion($version, $contentObjectID);
    if (is_object($versionObj) and !$versionObj->canVersionRead()) {
        return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
    }
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:download.php

示例2: array

 */
$module = $Params['Module'];
$viewMode = 'full';
$nodeID = $Params['NodeID'];
$userParameters = array();
if (isset($Params['UserParameters'])) {
    $userParameters = $Params['UserParameters'];
}
if (!$nodeID) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$node = eZContentObjectTreeNode::fetch($nodeID);
if (!$node) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if ($node->attribute('is_invisible') && !eZContentObjectTreeNode::showInvisibleNodes()) {
    return $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
$object = $node->attribute('object');
if (!$object) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if (!$object->attribute('can_read')) {
    return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
$icMap = array();
if ($http->hasSessionVariable('InformationCollectionMap')) {
    $icMap = $http->sessionVariable('InformationCollectionMap');
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:collectedinfo.php

示例3: buildSearch


//.........这里部分代码省略.........
     if ($policyLimitationFilterQuery !== false) {
         $filterQuery[] = $policyLimitationFilterQuery;
     }
     // Add time/date query filter
     if ($dateFilter > 0) {
         switch ($dateFilter) {
             // last day
             case 1:
                 $searchTimestamp = strtotime('-1 day');
                 break;
                 // last week
             // last week
             case 2:
                 $searchTimestamp = strtotime('-1 week');
                 break;
                 // last month
             // last month
             case 3:
                 $searchTimestamp = strtotime('-1 month');
                 break;
                 // last three month
             // last three month
             case 4:
                 $searchTimestamp = strtotime('-3 month');
                 break;
                 // last year
             // last year
             case 5:
                 $searchTimestamp = strtotime('-1 year');
                 break;
         }
         $filterQuery[] = eZSolr::getMetaFieldName('published') . ':[' . ezfSolrDocumentFieldBase::preProcessValue($searchTimestamp, 'date') . '/DAY TO *]';
     }
     if ((!eZContentObjectTreeNode::showInvisibleNodes() || !$ignoreVisibility) && $eZFindIni->variable('SearchFilters', 'FilterHiddenFromDB') == 'enabled') {
         $db = eZDB::instance();
         $invisibleNodeIDArray = $db->arrayQuery('SELECT node_id FROM ezcontentobject_tree WHERE ezcontentobject_tree.is_invisible = 1', array('column' => 0));
         $hiddenNodesQueryText = 'meta_main_node_id_si:[* TO *] -meta_main_node_id_si:(';
         foreach ($invisibleNodeIDArray as $element) {
             $hiddenNodesQueryText = $hiddenNodesQueryText . $element['node_id'] . ' ';
         }
         $hiddenNodesQueryText = $hiddenNodesQueryText . ')';
         // only add filter if there are hidden nodes after all
         if ($invisibleNodeIDArray) {
             $filterQuery[] = $hiddenNodesQueryText;
         }
     }
     // Add content class query filter
     $classLimitationFilter = $this->getContentClassFilterQuery($contentClassID);
     if ($classLimitationFilter !== null) {
         $filterQuery[] = $classLimitationFilter;
     }
     // Add section to query filter.
     if ($sectionID) {
         $filterQuery[] = eZSolr::getMetaFieldName('section_id') . ':' . $sectionID;
     }
     $languageFilterQuery = $this->buildLanguageFilterQuery();
     if ($languageFilterQuery) {
         $filterQuery[] = $languageFilterQuery;
     }
     $paramFilterQuery = $this->getParamFilterQuery($params);
     if (!empty($paramFilterQuery)) {
         $filterQuery = array_merge($filterQuery, $paramFilterQuery);
     }
     //add raw filters
     if ($eZFindIni->hasVariable('SearchFilters', 'RawFilterList')) {
         $rawFilters = $eZFindIni->variable('SearchFilters', 'RawFilterList');
开发者ID:kminds,项目名称:ezfind,代码行数:67,代码来源:ezfezpsolrquerybuilder.php

示例4: generateFeed

    /**
     * Generates an RSS feed document with type $type and returns it as a string.
     *
     * It uses the Feed component from eZ Components.
     *
     * Supported types: 'rss1', 'rss2', 'atom'.
     *
     * @since 4.2
     * @param string $type One of 'rss1', 'rss2' and 'atom'
     * @return string XML document as a string
     */
    function generateFeed( $type )
    {
        $locale = eZLocale::instance();

        // Get URL Translation settings.
        $config = eZINI::instance();
        if ( $config->variable( 'URLTranslator', 'Translation' ) == 'enabled' )
        {
            $useURLAlias = true;
        }
        else
        {
            $useURLAlias = false;
        }

        if ( $this->attribute( 'url' ) == '' )
        {
            $baseItemURL = '';
            eZURI::transformURI( $baseItemURL, false, 'full' );
            $baseItemURL .= '/';
        }
        else
        {
            $baseItemURL = $this->attribute( 'url' ) . '/'; //.$this->attribute( 'site_access' ).'/';
        }

        $feed = new ezcFeed();

        $feed->title = $this->attribute( 'title' );

        $link = $feed->add( 'link' );
        $link->href = $baseItemURL;

        $feed->description = $this->attribute( 'description' );
        $feed->language = $locale->httpLocaleCode();

        // to add the <atom:link> element needed for RSS2
        $feed->id = $baseItemURL . 'rss/feed/' . $this->attribute( 'access_url' );

        // required for ATOM
        $feed->updated = time();
        $author        = $feed->add( 'author' );
        $author->email = $config->variable( 'MailSettings', 'AdminEmail' );
        $creatorObject = eZContentObject::fetch( $this->attribute( 'creator_id' ) );
        if ( $creatorObject instanceof eZContentObject )
        {
            $author->name = $creatorObject->attribute('name');
        }

        $imageURL = $this->fetchImageURL();
        if ( $imageURL !== false )
        {
            $image = $feed->add( 'image' );

            // Required for RSS1
            $image->about = $imageURL;

            $image->url = $imageURL;
            $image->title = $this->attribute( 'title' );
            $image->link = $baseItemURL;
        }

        $cond = array(
                    'rssexport_id'  => $this->ID,
                    'status'        => $this->Status
                    );
        $rssSources = eZRSSExportItem::fetchFilteredList( $cond );

        $nodeArray = eZRSSExportItem::fetchNodeList( $rssSources, $this->getObjectListFilter() );

        if ( is_array( $nodeArray ) && count( $nodeArray ) )
        {
            $attributeMappings = eZRSSExportItem::getAttributeMappings( $rssSources );

            foreach ( $nodeArray as $node )
            {
                if ( $node->attribute('is_hidden') && !eZContentObjectTreeNode::showInvisibleNodes() )
                {
                    // if the node is hidden skip past it and don't add it to the RSS export
                    continue;
                }
                $object = $node->attribute( 'object' );
                $dataMap = $object->dataMap();
                if ( $useURLAlias === true )
                {
                    $nodeURL = $this->urlEncodePath( $baseItemURL . $node->urlAlias() );
                }
                else
                {
//.........这里部分代码省略.........
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:101,代码来源:ezrssexport.php

示例5: contentViewGenerate

 /**
  * Generate convent view data
  *
  * @see contentViewRetrieve()
  *
  * @param string|false $file File in which the result will be cached
  * @param array $args Hash containing arguments, the used ones are:
  *  - NodeID
  *  - Module
  *  - tpl
  *  - LanguageCode
  *  - ViewMode
  *  - Offset
  *  - viewParameters
  *  - collectionAttributes
  *  - validation
  *  - noCache (optional)
  *
  * @return array
  */
 public static function contentViewGenerate($file, $args)
 {
     extract($args);
     $node = eZContentObjectTreeNode::fetch($NodeID);
     if (!$node instanceof eZContentObjectTreeNode) {
         if (!eZDB::instance()->isConnected()) {
             return self::contentViewGenerateError($Module, eZError::KERNEL_NO_DB_CONNECTION, false);
         }
         return self::contentViewGenerateError($Module, eZError::KERNEL_NOT_AVAILABLE);
     }
     $object = $node->attribute('object');
     if (!$object instanceof eZContentObject) {
         return self::contentViewGenerateError($Module, eZError::KERNEL_NOT_AVAILABLE);
     }
     if ($node->attribute('is_invisible') && !eZContentObjectTreeNode::showInvisibleNodes()) {
         return self::contentViewGenerateError($Module, eZError::KERNEL_ACCESS_DENIED);
     }
     if (!$node->canRead()) {
         return self::contentViewGenerateError($Module, eZError::KERNEL_ACCESS_DENIED, true, array('AccessList' => $node->checkAccess('read', false, false, true)));
     }
     $result = self::generateNodeViewData($tpl, $node, $object, $LanguageCode, $ViewMode, $Offset, $viewParameters, $collectionAttributes, $validation);
     // 'store' depends on noCache: if $noCache is set, this means that retrieve
     // returned it, and the noCache fake cache file is already stored
     // and should not be stored again
     $retval = array('content' => $result, 'scope' => 'viewcache', 'store' => !(isset($noCache) and $noCache));
     if ($file !== false && $retval['store']) {
         $retval['binarydata'] = serialize($result);
     }
     return $retval;
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:50,代码来源:eznodeviewfunctions.php

示例6: createShowInvisibleSQLString

 static function createShowInvisibleSQLString($useSettings, $fetchHidden = true)
 {
     $showInvisibleNodesCond = '';
     $showInvisible = $fetchHidden;
     if ($useSettings) {
         $showInvisible = eZContentObjectTreeNode::showInvisibleNodes();
     }
     if (!$showInvisible) {
         $showInvisibleNodesCond = 'AND ezcontentobject_tree.is_invisible = 0';
     }
     return $showInvisibleNodesCond;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:12,代码来源:ezcontentobjecttreenode.php

示例7: contentViewGenerate

 static function contentViewGenerate($file, $args)
 {
     extract($args);
     $node = eZContentObjectTreeNode::fetch($NodeID);
     if (!is_object($node)) {
         if (!eZDB::instance()->isConnected()) {
             return array('content' => $Module->handleError(eZError::KERNEL_NO_DB_CONNECTION, 'kernel'), 'store' => false);
         } else {
             return array('content' => $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'), 'store' => false);
         }
     }
     $object = $node->attribute('object');
     if (!is_object($object)) {
         return array('content' => $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'), 'store' => false);
     }
     if (!$object instanceof eZContentObject) {
         return array('content' => $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'), 'store' => false);
     }
     if ($node === null) {
         return array('content' => $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'), 'store' => false);
     }
     if ($object === null) {
         return array('content' => $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel'), 'store' => false);
     }
     // HACK! Ignore showInvisibleNodes policy for the 'detail' view mode in ez_sbase. We do policy
     // checking in the template.
     if ($ViewMode != 'detail') {
         if ($node->attribute('is_invisible') && !eZContentObjectTreeNode::showInvisibleNodes()) {
             return array('content' => $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel'), 'store' => false);
         }
     }
     if (!$object->canRead()) {
         return array('content' => $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel', array('AccessList' => $object->accessList('read'))), 'store' => false);
     }
     $Result = eZNodeviewfunctions::generateNodeViewData($tpl, $node, $object, $LanguageCode, $ViewMode, $Offset, $viewParameters, $collectionAttributes, $validation);
     // 'store' depends on noCache: if $noCache is set, this means that retrieve
     // returned it, and the noCache fake cache file is already stored
     // and should not be stored again
     $retval = array('content' => $Result, 'scope' => 'viewcache', 'store' => !(isset($noCache) and $noCache));
     if ($file !== false && $retval['store']) {
         $retval['binarydata'] = serialize($Result);
     }
     return $retval;
 }
开发者ID:stevoland,项目名称:ez_patch,代码行数:44,代码来源:eznodeviewfunctions.php

示例8: getNodeID

 /**
  * Returns the relative NodeID for a given search result,
  * depending on whether a subtree filter was applied or not and limitations by user policy limitations.
  *
  * Policy limitations (subtree/node) are aggregated by a logic OR (same for subtree filters).
  * Subtree filters and policy limitations are aggregated together with a logic AND,
  * so that valid locations must comply subtree filters (if any) AND subtree/node policy limitations (if any)
  *
  * @param array $doc The search result, directly received from Solr.
  * @return int The NodeID corresponding the search result
  */
 protected function getNodeID($doc)
 {
     $docPathStrings = $doc[ezfSolrDocumentFieldBase::generateMetaFieldName('path_string')];
     $docVisibilities = $doc[ezfSolrDocumentFieldBase::generateMetaFieldName('is_invisible')];
     if (count($docPathStrings) > 1) {
         // reordering the path strings and the associated visibilities so
         // that the main node path string and the main node visibility are
         // in the first position.
         $mainNodeIdx = array_search($doc[ezfSolrDocumentFieldBase::generateMetaFieldName('main_path_string')], $docPathStrings);
         if ($mainNodeIdx != 0) {
             array_unshift($docVisibilities, $docVisibilities[$mainNodeIdx]);
             array_unshift($docPathStrings, $docPathStrings[$mainNodeIdx]);
             unset($docVisibilities[$mainNodeIdx], $docPathStrings[$mainNodeIdx]);
         }
     }
     $locationFilter = isset($this->postSearchProcessingData['subtree_array']) ? $this->postSearchProcessingData['subtree_array'] : array();
     $subtreeLimitations = isset($this->postSearchProcessingData['subtree_limitations']) ? $this->postSearchProcessingData['subtree_limitations'] : array();
     $validSubtreeArray = $this->getValidPathStringsByLimitation($docPathStrings, $locationFilter);
     $validSubtreeLimitations = $this->getValidPathStringsByLimitation($docPathStrings, $subtreeLimitations);
     $ignoreVisibility = eZContentObjectTreeNode::showInvisibleNodes();
     if (isset($this->postSearchProcessingData['ignore_visibility'])) {
         $ignoreVisibility = $this->postSearchProcessingData['ignore_visibility'];
     }
     // Intersect between $validSubtreeArray (search location filter) and $validSubtreeLimitations (user policy limitations)
     // indicates valid locations for $doc in current search query
     // If this intersect is not empty, we take the first node id that
     // matches the visibility requirement
     $validSubtrees = array_flip(array_intersect($validSubtreeArray, $validSubtreeLimitations));
     if (!empty($validSubtrees)) {
         foreach ($docPathStrings as $k => $path) {
             if (isset($validSubtrees[$path])) {
                 if ($ignoreVisibility || !$docVisibilities[$k]) {
                     $nodeArray = explode('/', rtrim($path, '/'));
                     return (int) array_pop($nodeArray);
                 }
             }
         }
         eZDebug::writeError("Could not find a visible location for content " . "#{$doc[ezfSolrDocumentFieldBase::generateMetaFieldName('id')]} " . "that current user has read access on. The Solr index is probably outdated", __METHOD__);
     } else {
         $contentId = $doc[ezfSolrDocumentFieldBase::generateMetaFieldName('id')];
         $content = eZContentObject::fetch($contentId);
         if ($content instanceof eZContentObject && !$content->canRead()) {
             eZDebug::writeError("Could not find valid/granted locations for content #{$contentId}. Broken sync between eZPublish and Solr ?\n\n" . "Location filter : " . print_r($locationFilter, true) . "Subtree limitations for user : " . print_r($subtreeLimitations, true), __METHOD__);
         }
         foreach ($docPathStrings as $k => $path) {
             if ($ignoreVisibility || !$docVisibilities[$k]) {
                 $nodeArray = explode('/', rtrim($path, '/'));
                 return (int) array_pop($nodeArray);
             }
         }
     }
     return (int) $doc[ezfSolrDocumentFieldBase::generateMetaFieldName('main_node_id')];
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:64,代码来源:ezsolr.php


注:本文中的eZContentObjectTreeNode::showInvisibleNodes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。