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


PHP eZSearch::updateObjectsSection方法代码示例

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


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

示例1: assignSectionToSubTree

 static function assignSectionToSubTree($nodeID, $sectionID, $oldSectionID = false)
 {
     $db = eZDB::instance();
     $node = eZContentObjectTreeNode::fetch($nodeID);
     $nodePath = $node->attribute('path_string');
     $sectionID = (int) $sectionID;
     $pathString = " path_string like '{$nodePath}%' AND ";
     // fetch the object id's which needs to be updated
     $objectIDArray = $db->arrayQuery("SELECT\n                                                   ezcontentobject.id\n                                            FROM\n                                                   ezcontentobject_tree, ezcontentobject\n                                            WHERE\n                                                  {$pathString}\n                                                  ezcontentobject_tree.contentobject_id=ezcontentobject.id AND\n                                                  ezcontentobject_tree.main_node_id=ezcontentobject_tree.node_id");
     if (count($objectIDArray) == 0) {
         return;
     }
     // Who assigns which section at which node should be logged.
     $section = eZSection::fetch($sectionID);
     $object = $node->object();
     eZAudit::writeAudit('section-assign', array('Section ID' => $sectionID, 'Section name' => $section->attribute('name'), 'Node ID' => $nodeID, 'Content object ID' => $object->attribute('id'), 'Content object name' => $object->attribute('name'), 'Comment' => 'Assigned a section to the current node and all child objects: eZContentObjectTreeNode::assignSectionToSubTree()'));
     $objectSimpleIDArray = array();
     foreach ($objectIDArray as $objectID) {
         $objectSimpleIDArray[] = $objectID['id'];
     }
     $filterPart = '';
     if ($oldSectionID !== false) {
         $oldSectionID = (int) $oldSectionID;
         $filterPart = " section_id = '{$oldSectionID}' and ";
     }
     $db->begin();
     foreach (array_chunk($objectSimpleIDArray, 100) as $pagedObjectIDs) {
         $db->query("UPDATE ezcontentobject SET section_id='{$sectionID}' WHERE {$filterPart} " . $db->generateSQLINStatement($pagedObjectIDs, 'id', false, true, 'int'));
         eZSearch::updateObjectsSection($pagedObjectIDs, $sectionID);
     }
     $db->commit();
     // clear caches for updated objects
     eZContentObject::clearCache($objectSimpleIDArray);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:34,代码来源:ezcontentobjecttreenode.php


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