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


PHP eZContentObjectTreeNode::hideSubTree方法代码示例

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


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

示例1: execute

    function execute( $xmlNode )
    {
        $action = $xmlNode->getAttribute( 'action' );
        $xmlNodeID = $xmlNode->getAttribute( 'nodeID' );

        $nodeID = $this->getReferenceID( $xmlNodeID );
        if ( !$nodeID )
        {
            $this->writeMessage( "\tInvalid node $nodeID does not exist.", 'warning' );
            return false;
        }

        if ( !$action )
        {
            $action = 'toogle';
        }
        $node = eZContentObjectTreeNode::fetch( $nodeID );
        if ( !$node )
        {
            $this->writeMessage( "\tNo node defined.", 'error' );
            return false;
        }

        switch ( $action )
        {
            case 'unhide':
            {
                if ( $node->attribute( 'is_hidden' ) )
                {
                    eZContentObjectTreeNode::unhideSubTree( $node );
                    $this->writeMessage( "\tNode " . $node->attribute( 'name' ) . " has be unhidden.", 'error' );
                }
            } break;
            case 'hide':
            {
                if ( !$node->attribute( 'is_hidden' ) )
                {
                    eZContentObjectTreeNode::hideSubTree( $node );
                    $this->writeMessage( "\tNode " . $node->attribute( 'name' ) . " has be hidden.", 'error' );
                }
            } break;
            case 'toogle':
            {
                if ( $node->attribute( 'is_hidden' ) )
                {
                    eZContentObjectTreeNode::unhideSubTree( $node );
                    $this->writeMessage( "\tNode " . $node->attribute( 'name' ) . " has be unhidden.", 'error' );
                }
                else
                {
                    eZContentObjectTreeNode::hideSubTree( $node );
                    $this->writeMessage( "\tNode " . $node->attribute( 'name' ) . " has be hidden.", 'error' );
                }
            } break;
        }
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:56,代码来源:ezhideunhide.php

示例2: runOperation

 function runOperation(&$node)
 {
     if (!$node->canHide()) {
         return false;
     }
     if ($this->hidden) {
         eZContentObjectTreeNode::hideSubTree($node);
     } else {
         eZContentObjectTreeNode::unhideSubTree($node);
     }
     // We have no result value, so assume the operation worked
     return true;
 }
开发者ID:informaticatrentina,项目名称:batchtool,代码行数:13,代码来源:nodehide.php

示例3: changeHideStatus

 /**
  * Changes an contentobject's status
  *
  * @param int $nodeID
  *
  * @return array An array with operation status, always true
  */
 public static function changeHideStatus($nodeID)
 {
     $action = 'hide';
     $curNode = eZContentObjectTreeNode::fetch($nodeID);
     if (is_object($curNode)) {
         if ($curNode->attribute('is_hidden')) {
             eZContentObjectTreeNode::unhideSubTree($curNode);
             $action = 'show';
         } else {
             eZContentObjectTreeNode::hideSubTree($curNode);
         }
     }
     //call appropriate method from search engine
     eZSearch::updateNodeVisibility($nodeID, $action);
     return array('status' => true);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:23,代码来源:ezcontentoperationcollection.php

示例4: checkContentActions


//.........这里部分代码省略.........
                        else if ( isset( $operationResult['result'] ) )
                        {
                            $result = $operationResult['result'];
                            $resultContent = false;
                            if ( is_array( $result ) )
                            {
                                if ( isset( $result['content'] ) )
                                {
                                    $resultContent = $result['content'];
                                }
                                if ( isset( $result['path'] ) )
                                {
                                    $Result['path'] = $result['path'];
                                }
                            }
                            else
                            {
                                $resultContent = $result;
                            }
                            // Temporary fix to make approval workflow work with edit.
                            if ( strpos( $resultContent, 'Deffered to cron' ) === 0 )
                            {
                                $Result = null;
                            }
                            else
                            {
                                $Result['content'] = $resultContent;
                            }
                        }
                    }break;
                    case eZModuleOperationInfo::STATUS_CANCELLED:
                    {
                        $Result = array();
                        $Result['content'] = "Content publish cancelled<br/>";
                    }
                }

                /* If we already have a correct module result
                 * we don't need to continue module execution.
                 */
                if ( is_array( $Result ) )
                    return eZModule::HOOK_STATUS_CANCEL_RUN;
            }

            // update content object attributes array by refetching them from database
            $object = eZContentObject::fetch( $object->attribute( 'id' ) );
            $contentObjectAttributes = $object->attribute( 'contentobject_attributes' );

            // set chosen hidden/invisible attributes for object nodes
            $http          = eZHTTPTool::instance();
            $assignedNodes = $object->assignedNodes( true );
            foreach ( $assignedNodes as $node )
            {
                $nodeID               = $node->attribute( 'node_id' );
                $parentNodeID         = $node->attribute( 'parent_node_id' );
                $updateNodeVisibility =  false;
                $postVarName          = "FutureNodeHiddenState_$parentNodeID";

                if ( !$http->hasPostVariable( $postVarName ) )
                    $updateNodeVisibility = true;
                else
                {
                    $futureNodeHiddenState = $http->postVariable( $postVarName );
                    $db = eZDB::instance();
                    $db->begin();
                    if ( $futureNodeHiddenState == 'hidden' )
                        eZContentObjectTreeNode::hideSubTree( $node );
                    else if ( $futureNodeHiddenState == 'visible' )
                        eZContentObjectTreeNode::unhideSubTree( $node );
                    else if ( $futureNodeHiddenState == 'unchanged' )
                        $updateNodeVisibility = true;
                    else
                        eZDebug::writeWarning( "Unknown value for the future node hidden state: '$futureNodeHiddenState'" );
                    $db->commit();
                }

                if ( $updateNodeVisibility )
                {
                    // this might be redundant
                    $db = eZDB::instance();
                    $db->begin();
                    $parentNode = eZContentObjectTreeNode::fetch( $parentNodeID );
                    eZContentObjectTreeNode::updateNodeVisibility( $node, $parentNode, /* $recursive = */ false );
                    $db->commit();
                    unset( $node, $parentNode );
                }
            }
            unset( $assignedNodes );

            $object = eZContentObject::fetch( $object->attribute( 'id' ) );

            $newObjectName = $object->name();

            $http = eZHTTPTool::instance();

            computeRedirect( $module, $object, $version, $EditLanguage );
            // we have set redirection URI for module so we don't need to continue module execution
            return eZModule::HOOK_STATUS_CANCEL_RUN;
        }
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:101,代码来源:edit.php

示例5: execute

    public function execute( $process, $event )
    {
        $parameters = $process->attribute( 'parameter_list' );
        $object = eZContentObject::fetch( $parameters['object_id'] );
        $attribute = false;

        $dataMap = $object->attribute( 'data_map' );
        foreach ( $dataMap as $attr )
        {
            $dataType = $attr->attribute( 'data_type_string' );
            if ( $dataType == 'ezfeatureselect' )
            {
                $attribute = $attr;
                continue;
            }
        }

        // if object does not have a featureselect attribute.
        if ( $attribute == false )
        {
            return eZWorkflowType::STATUS_ACCEPTED;
        }

        // if we have not the first version published, we only need to enable/disable features
        if ( $object->attribute( 'modified' ) != $object->attribute( 'published' ) )
        {
            $attributeContent = $attribute->attribute( 'content' );
            $installedFeatureList = $attributeContent['installed_feature_list'];
            $availibleFeatureList = $attributeContent['availible_feature_list'];

            $mainNodeID = $object->attribute( 'main_node_id' );

            foreach( $availibleFeatureList as $feature => $featureName )
            {
                $featureObject = eZContentObject::fetchByRemoteID( $mainNodeID . '_' . $feature );
                if( !$featureObject )
                {
                    eZDebug::writeError( "Cannot find feature object", "eZXMLPublisherType::execute" );
                    continue;
                }
                $featureNode = $featureObject->attribute( 'main_node' );
                if( !$featureNode )
                {
                    eZDebug::writeError( "Cannot find feature node", "eZXMLPublisherType::execute" );
                    continue;
                }
                if ( in_array( $feature, $installedFeatureList ) )
                {
                    if ( $featureNode->attribute( 'is_hidden' ) )
                    {
                        eZContentObjectTreeNode::unhideSubTree( $featureNode );
                    }
                    $featureObject = $featureNode->attribute( 'object' );
                    $list          = $featureObject->reverseRelatedObjectList( false, 0, false,
                                                                               array( 'AllRelations' => eZContentObject::RELATION_ATTRIBUTE, 'IgnoreVisibility' => true )
                                                                             );
                    if ( is_array( $list ) )
                    {
                        foreach ( $list as $reverseRelatedContentObject )
                        {
                            $reverseRelatedMainNode = $reverseRelatedContentObject->attribute( 'main_node' );
                            eZContentObjectTreeNode::unhideSubTree( $reverseRelatedMainNode );
                        }
                    }
                }
                elseif ( !in_array( $feature, $installedFeatureList ) && !$featureNode->attribute( 'is_hidden' ) )
                {
                    if ( !$featureNode->attribute( 'is_hidden' ) )
                    {
                        eZContentObjectTreeNode::hideSubTree( $featureNode );
                    }
                    $featureObject = $featureNode->attribute( 'object' );
                    $list          = $featureObject->reverseRelatedObjectList( false, 0, false,
                                                                               array( 'AllRelations' => eZContentObject::RELATION_ATTRIBUTE, 'IgnoreVisibility' => true )
                                                                             );
                    if ( is_array( $list ) )
                    {
                        foreach ( $list as $reverseRelatedContentObject )
                        {
                            $reverseRelatedMainNode = $reverseRelatedContentObject->attribute( 'main_node' );
                            eZContentObjectTreeNode::hideSubTree( $reverseRelatedMainNode );
                        }
                    }
                }
            }
        }

        // defer to cron, this is safer because we might do a lot of things here
        include_once( 'lib/ezutils/classes/ezsys.php' );
        if ( eZSys::isShellExecution() == false )
        {
            return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
        }

        // if we have the first version published, we need to set up the related things.
        if ( $object->attribute( 'modified' ) == $object->attribute( 'published' ) )
        {
            $classAttribute = $attribute->attribute( 'contentclass_attribute' );
            $templateName = $classAttribute->attribute( 'data_text1' );

//.........这里部分代码省略.........
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:ezxmlpublishertype.php

示例6: hideObject

 /**
  * Hides an object specified by $objectId.
  *
  * @param int $objectId
  */
 public function hideObject($objectId)
 {
     $node = eZContentObjectTreeNode::fetchByContentObjectID($objectId);
     eZContentObjectTreeNode::hideSubTree($node[0]);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:10,代码来源:ezrss_export_test.php

示例7: updateNodeVisibility

 /**
  * Depending on the new parent node visibility, recompute "is_invisible" attribute for the given node and
  * its children. (used after content/move or content/copy)
  *
  * @param eZContentObjectTreeNode $node
  * @param eZContentObjectTreeNode $parentNode
  * @param bool $recursive
  */
 static function updateNodeVisibility($node, $parentNode, $recursive = true)
 {
     if (!$node) {
         eZDebug::writeWarning('No such node to update visibility for.');
         return;
     }
     if (!$parentNode) {
         eZDebug::writeWarning('No parent node found when updating node visibility');
         return;
     }
     if ($node->attribute('is_hidden') == 0 && $parentNode->attribute('is_invisible') != $node->attribute('is_invisible')) {
         $parentNodeIsVisible = $parentNode->attribute('is_invisible');
         $nodeID = $node->attribute('node_id');
         $db = eZDB::instance();
         $db->begin();
         $db->query("UPDATE ezcontentobject_tree SET is_invisible={$parentNodeIsVisible} WHERE node_id={$nodeID}");
         if ($recursive) {
             // update visibility for children of the node
             if ($parentNodeIsVisible) {
                 eZContentObjectTreeNode::hideSubTree($node, $modifyRootNode = false);
             } else {
                 eZContentObjectTreeNode::unhideSubTree($node, $modifyRootNode = false);
             }
         }
         $db->commit();
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:35,代码来源:ezcontentobjecttreenode.php

示例8: QuestionInteractiveCli

    }

    $pathIdentificationString = $node->attribute('path_identification_string');

    if ( $node->IsHidden )
    {
        $cli->warning ( " Already hidden : [" . $nodeId . "] " . $pathIdentificationString . " : " . $node->getName() );
        continue;
    }

    $validCalculatorsNodeId[] = $nodeId;
    $possibleReplies[] = $nodeId . " " . $pathIdentificationString . " : " . $node->getName();
}

$questionHandler = new QuestionInteractiveCli();
$question = "Hide which nodes";

$response = $questionHandler->askQuestionMultipleChoices($question, $possibleReplies, 'validateReplyMultiple', true);

foreach ( $response as $indexToHide )
{
    $nodeId = $validCalculatorsNodeId[$indexToHide];
    $node   = eZContentObjectTreeNode::fetch($nodeId);

    eZContentObjectTreeNode::hideSubTree( $node );
    eZSearch::updateNodeVisibility( $node->NodeID, 'hide' );

    $pathIdentificationString = $node->attribute('path_identification_string');
    $cli->warning ( " Hiding : [" . $nodeId . "] " . $pathIdentificationString . " : " . $node->getName() );
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:30,代码来源:hide_calculators.php

示例9: execute

 function execute($process, $event)
 {
     // Get some information about the object being passed
     $parameters = $process->attribute('parameter_list');
     $object = eZContentObject::fetch($parameters['object_id']);
     // Because this is also run by the cronjob, check to make sure the object hasn't been deleted
     if (!$object) {
         eZDebugSetting::writeError('workflow-hideuntildate', 'The object with ID ' . $parameters['object_id'] . ' does not exist.', 'eZApproveType::execute() object is unavailable');
         return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
     }
     // if the current version of an object is not the version the workflow pertains to, cancel the workflow
     $currentVersion = $object->attribute('current_version');
     $version = $parameters['version'];
     if ($currentVersion != $version) {
         return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
     }
     // Get the data map for this object
     $objectAttributes = $object->attribute('data_map');
     // Get the user configuration with class and attribute mapping and the boolean modify publish date setting
     $workflowSettings = $this->getWorkflowSettings($event);
     foreach ($objectAttributes as $objectAttribute) {
         if (in_array($objectAttribute->attribute('contentclassattribute_id'), $workflowSettings['classattribute_map'])) {
             // Make sure this is of a date or datetime attribute
             if (in_array($objectAttribute->attribute('data_type_string'), array('ezdate', 'ezdatetime'))) {
                 // If the publish date is in the future, hide the node
                 if (time() < $objectAttribute->toString()) {
                     // Set a time for when this workflow should be tested again via the cronjob
                     // Store a description to be displayed in the Setup > Workflow processes list
                     // This must also be accompanied by overriding the workflow/processlist.tpl template
                     $parameters = array_merge($parameters, array('event_description' => 'Publishing of object delayed until ' . $objectAttribute->attribute('content')->toString(true)));
                     $process->setParameters($parameters);
                     $process->store();
                     // Hide the object's nodes
                     $nodes = $object->attribute('assigned_nodes');
                     foreach ($nodes as $node) {
                         if (!$node->attribute('is_hidden')) {
                             eZContentObjectTreeNode::hideSubTree($node);
                         }
                     }
                     return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
                 } elseif ($objectAttribute->hasContent()) {
                     if ($workflowSettings['modify_publish_date']) {
                         $object->setAttribute('published', $objectAttribute->toString());
                         $object->store();
                     }
                     $nodes = $object->attribute('assigned_nodes');
                     foreach ($nodes as $node) {
                         eZContentObjectTreeNode::unhideSubTree($node);
                         eZContentCacheManager::clearContentCache($parameters['object_id']);
                         eZContentCacheManager::clearObjectViewCache($parameters['object_id']);
                     }
                     return eZWorkflowType::STATUS_ACCEPTED;
                 }
             } else {
                 // Attribute that matched was not a valid date or datetime attribute, so ignore
                 return eZWorkflowType::STATUS_ACCEPTED;
             }
         }
     }
     // No attributes matched the workflow configured by the user
     return eZWorkflowType::STATUS_ACCEPTED;
 }
开发者ID:mugoweb,项目名称:hideuntildate,代码行数:62,代码来源:hideuntildatetype.php

示例10: updateVisibility

 /**
  * Change node`s visibility
  *
  * @private
  * @param eZContentObject $object
  * @param bool $visibility
  * @return void
  */
 private function updateVisibility($object, $visibility = true)
 {
     $action = $visibility ? 'show' : 'hide';
     $nodeAssigments = eZPersistentObject::fetchObjectList(eZNodeAssignment::definition(), null, array('contentobject_id' => $object->attribute('id'), 'contentobject_version' => $object->attribute('current_version')), null, null, true);
     foreach ($nodeAssigments as $nodeAssigment) {
         $node = $nodeAssigment->attribute('node');
         if ($node instanceof eZContentObjectTreeNode === false) {
             continue;
         }
         if ((bool) (!$node->attribute('is_hidden')) === (bool) $visibility) {
             continue;
         }
         if ($action == 'show') {
             eZContentObjectTreeNode::unhideSubTree($node);
         } else {
             eZContentObjectTreeNode::hideSubTree($node);
         }
         eZSearch::updateNodeVisibility($node->attribute('node_id'), $action);
     }
 }
开发者ID:nxc,项目名称:nxc_powercontent,代码行数:28,代码来源:powercontent.php


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