當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。