本文整理汇总了PHP中eZSearch::updateNodeVisibility方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSearch::updateNodeVisibility方法的具体用法?PHP eZSearch::updateNodeVisibility怎么用?PHP eZSearch::updateNodeVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSearch
的用法示例。
在下文中一共展示了eZSearch::updateNodeVisibility方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: updateGlobalLimitation
/**
* @param eZContentObject $contentObject
* @param bool|null $parentIsInvisible Only defined as boolean true|false if we are recursively going in a child
*/
public static function updateGlobalLimitation ( $contentObject, $parentIsInvisible = null )
{
/* @type $contentMainNode eZContentObjectTreeNode */
$db = eZDB::instance();
$contentObjectID = $contentObject->attribute('id');
$contentMainNode = $contentObject->mainNode();
if ( !($contentMainNode instanceof eZContentObjectTreeNode) )
return;
/* @type $dm eZContentObjectAttribute[] */
$contentDepth = $contentMainNode->attribute('depth');
$merckINI = eZINI::instance('merck.ini');
$onlineDateAttribute = $merckINI->variable("ArticleVisibility","OnlineDate");
$offlineDateAttribute = $merckINI->variable("ArticleVisibility","OfflineDate");
$dm = $contentObject->attribute("data_map");
if ( !is_array($dm) )
return;
/* @type $onlineDateContent eZDateTime */
/* @type $offlineDateContent eZDateTime */
$onlineDateContent = $dm[$onlineDateAttribute]->content();
$onlineDate = $onlineDateContent->timeStamp();
$offlineDateContent = $dm[$offlineDateAttribute]->content();
$offlineDate = $offlineDateContent->timeStamp();
$visibility = MMEventManager::visibilityDates($contentObject);
$isInvisible = !$visibility;
// We have a parent article, we check its visibility
if ( !$isInvisible && $parentIsInvisible === null && $contentDepth > 4 )
{
$parentNode = $contentMainNode->fetchParent();
$isInvisible = self::isGloballyLimited( $parentNode->attribute('contentobject_id') );
}
elseif ( !$isInvisible )
{
if ( $parentIsInvisible !== null && $parentIsInvisible === true )
$isInvisible = true;
}
$db->beginQuery();
$visibilityChange = self::updateGlobalLimitationEntry( $contentObjectID, $offlineDate, $onlineDate, $visibility, $isInvisible);
if ( $visibilityChange && $visibility && !$isInvisible )
{
eZSearch::updateNodeVisibility($contentObject->mainNodeID(), 'show');
}
elseif ( $visibilityChange && ( !$visibility || $isInvisible ) )
{
eZSearch::updateNodeVisibility($contentObject->mainNodeID(), 'hide');
}
if ( $visibilityChange )
self::spreadGlobalLimitationChange( $contentMainNode, $isInvisible );
$db->commitQuery();
}
示例3: 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() );
}
示例4: 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);
}
}