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


PHP eZContentLanguage::languagesSQLFilter方法代码示例

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


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

示例1: modify

 function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     $parentNodeID = $namedParameters['parent_node_id'];
     switch ($operatorName) {
         case 'ezkeywordlist':
             include_once 'lib/ezdb/classes/ezdb.php';
             $db = eZDB::instance();
             if ($parentNodeID) {
                 $node = eZContentObjectTreeNode::fetch($parentNodeID);
                 if ($node) {
                     $pathString = "AND ezcontentobject_tree.path_string like '" . $node->attribute('path_string') . "%'";
                 }
                 $parentNodeIDSQL = "AND ezcontentobject_tree.node_id != " . (int) $parentNodeID;
             }
             $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(true, false);
             $limitation = false;
             $limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
             $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
             $versionNameJoins = " AND ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id AND\n                                            ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version AND ";
             $languageFilter = " AND " . eZContentLanguage::languagesSQLFilter('ezcontentobject');
             $versionNameJoins .= eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject');
             $quotedClassIdentifiers = array();
             foreach ((array) $namedParameters['class_identifier'] as $classIdentifier) {
                 $quotedClassIdentifiers[] = "'" . $db->escapeString($classIdentifier) . "'";
             }
             $rs = $db->arrayQuery("SELECT DISTINCT ezkeyword.keyword\n                                            FROM ezkeyword_attribute_link,\n                                                 ezkeyword,\n                                                 ezcontentobject,\n                                                 ezcontentobject_name,\n                                                 ezcontentobject_attribute,\n                                                 ezcontentobject_tree,\n                                                 ezcontentclass\n                                                 {$sqlPermissionChecking['from']}\n                                            WHERE ezkeyword.id = ezkeyword_attribute_link.keyword_id\n                                                AND ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id\n                                                AND ezcontentobject_tree.contentobject_id = ezcontentobject_attribute.contentobject_id\n                                                AND ezkeyword.class_id = ezcontentclass.id\n                                                AND " . $db->generateSQLINStatement($quotedClassIdentifiers, 'ezcontentclass.identifier') . "\n                                                {$pathString}\n                                                {$parentNodeIDSQL} " . ($namedParameters['depth'] > 0 ? "AND ezcontentobject_tree.depth=" . (int) $namedParameters['depth'] : '') . "\n                                                {$showInvisibleNodesCond}\n                                                {$sqlPermissionChecking['where']}\n                                                {$languageFilter}\n                                                {$versionNameJoins}\n                                            ORDER BY ezkeyword.keyword ASC");
             $operatorValue = $rs;
             break;
     }
 }
开发者ID:BGCX067,项目名称:ezpublish-thetechtalent-svn-to-git,代码行数:30,代码来源:ezkeywordlist.php

示例2: validNodes

 /**
  * Return valid items for block with given $blockID
  * 
  * @static
  * @param string $blockID
  * @param bool $asObject
  * @return array(eZContentObjectTreeNode)
  */
 static function validNodes($blockID, $asObject = true)
 {
     if (isset($GLOBALS['eZFlowPool']) === false) {
         $GLOBALS['eZFlowPool'] = array();
     }
     if (isset($GLOBALS['eZFlowPool'][$blockID])) {
         return $GLOBALS['eZFlowPool'][$blockID];
     }
     $visibilitySQL = "";
     if (eZINI::instance('site.ini')->variable('SiteAccessSettings', 'ShowHiddenNodes') !== 'true') {
         $visibilitySQL = "AND ezcontentobject_tree.is_invisible = 0 ";
     }
     $db = eZDB::instance();
     $validNodes = $db->arrayQuery("SELECT ezm_pool.node_id\n                                        FROM ezm_pool, ezcontentobject_tree, ezcontentobject\n                                        WHERE ezm_pool.block_id='{$blockID}'\n                                          AND ezm_pool.ts_visible>0\n                                          AND ezm_pool.ts_hidden=0\n                                          AND ezcontentobject_tree.node_id = ezm_pool.node_id\n                                          AND ezcontentobject.id = ezm_pool.object_id\n                                          AND " . eZContentLanguage::languagesSQLFilter('ezcontentobject') . "\n                                          {$visibilitySQL}\n                                        ORDER BY ezm_pool.priority DESC");
     if ($asObject && !empty($validNodes)) {
         $validNodesObjects = array();
         foreach ($validNodes as $node) {
             $validNodeObject = eZContentObjectTreeNode::fetch($node['node_id']);
             if ($validNodeObject instanceof eZContentObjectTreeNode && $validNodeObject->canRead()) {
                 $validNodesObjects[] = $validNodeObject;
             }
         }
         $GLOBALS['eZFlowPool'][$blockID] = $validNodesObjects;
         return $validNodesObjects;
     } else {
         return $validNodes;
     }
 }
开发者ID:kuborgh,项目名称:ezflow-ls-extension,代码行数:36,代码来源:ezflowpool.php

示例3: fetchByConditions

 /**
  * Fetches content object states by conditions.
  *
  * The content object states are fetched in the right language, depending on the list of prioritized languages
  * of the site access.
  *
  * @param $conditions
  * @param $limit
  * @param $offset
  * @return array
  */
 private static function fetchByConditions($conditions, $limit, $offset)
 {
     $db = eZDB::instance();
     $defaultConditions = array('ezcobj_state.group_id=ezcobj_state_group.id', 'ezcobj_state_language.contentobject_state_id=ezcobj_state.id', eZContentLanguage::languagesSQLFilter('ezcobj_state'), eZContentLanguage::sqlFilter('ezcobj_state_language', 'ezcobj_state'));
     $conditions = array_merge($conditions, $defaultConditions);
     $conditionsSQL = implode(' AND ', $conditions);
     $sql = "SELECT ezcobj_state.*, ezcobj_state_language.* " . "FROM ezcobj_state, ezcobj_state_group, ezcobj_state_language " . "WHERE {$conditionsSQL} " . "ORDER BY ezcobj_state.priority";
     $rows = $db->arrayQuery($sql, array('limit' => $limit, 'offset' => $offset));
     $states = array();
     foreach ($rows as $row) {
         $state = new eZContentObjectState($row);
         $stateLanguage = new eZContentObjectStateLanguage($row);
         $state->setLanguageObject($stateLanguage);
         $states[] = $state;
     }
     return $states;
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:28,代码来源:ezcontentobjectstate.php

示例4: modify

 function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     $parentNodeID = $namedParameters['parent_node_id'];
     switch ($operatorName) {
         case 'ezkeywordlist':
             include_once 'lib/ezdb/classes/ezdb.php';
             $db = eZDB::instance();
             if ($parentNodeID) {
                 $node = eZContentObjectTreeNode::fetch($parentNodeID);
                 if ($node) {
                     $pathString = "AND ezcontentobject_tree.path_string like '" . $node->attribute('path_string') . "%'";
                 }
                 $parentNodeIDSQL = "AND ezcontentobject_tree.node_id != " . (int) $parentNodeID;
             }
             $limitation = false;
             $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL(eZContentObjectTreeNode::getLimitationList($limitation));
             // eZContentObjectTreeNode::classIDByIdentifier() might need to be used for eZ Publish < 4.1
             $classIDs = eZContentClass::classIDByIdentifier($namedParameters['class_identifier']);
             $operatorValue = $db->arrayQuery("SELECT DISTINCT ezkeyword.keyword\n                     FROM ezkeyword\n                          JOIN ezkeyword_attribute_link ON ezkeyword.id = ezkeyword_attribute_link.keyword_id\n                          JOIN ezcontentobject_attribute ON ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id\n                          JOIN ezcontentobject ON ezcontentobject_attribute.contentobject_id = ezcontentobject.id\n                          JOIN ezcontentobject_name ON ezcontentobject.id = ezcontentobject_name.contentobject_id\n                          JOIN ezcontentobject_tree ON ezcontentobject_name.contentobject_id = ezcontentobject_tree.contentobject_id AND ezcontentobject_name.content_version = ezcontentobject_tree.contentobject_version\n                          {$sqlPermissionChecking['from']}\n                     WHERE " . eZContentLanguage::languagesSQLFilter('ezcontentobject') . "\n                         AND " . eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject') . (empty($classIDs) ? '' : ' AND ' . $db->generateSQLINStatement($classIDs, 'ezkeyword.class_id')) . "\n                         {$pathString}\n                         {$parentNodeIDSQL} " . ($namedParameters['depth'] > 0 ? "AND ezcontentobject_tree.depth=" . (int) $namedParameters['depth'] : '') . "\n                         " . eZContentObjectTreeNode::createShowInvisibleSQLString(true, false) . "\n                         {$sqlPermissionChecking['where']}\n                     ORDER BY ezkeyword.keyword ASC");
             break;
     }
 }
开发者ID:heliopsis,项目名称:ezwebin,代码行数:22,代码来源:ezkeywordlist.php

示例5: search


//.........这里部分代码省略.........
                 if ($i == 0) {
                     $table = $db->generateUniqueTempTableName('ezsearch_tmp_%', 0);
                     $this->saveCreatedTempTableName(0, $table);
                     $db->createTempTable("CREATE TEMPORARY TABLE {$table} ( contentobject_id int primary key not null, published int )");
                     $db->query("INSERT INTO {$table} SELECT DISTINCT ezsearch_object_word_link.contentobject_id, ezsearch_object_word_link.published\n                                         FROM ezcontentobject\n                                              INNER JOIN ezsearch_object_word_link ON (ezsearch_object_word_link.contentobject_id = ezcontentobject.id)\n                                              {$subTreeTable}\n                                              INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id)\n                                              INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)\n                                              {$sqlPermissionChecking['from']}\n                                         WHERE\n                                               {$searchDateQuery}\n                                               {$sectionQuery}\n                                               {$classQuery}\n                                               {$classAttributeQuery}\n                                               {$searchPartText}\n                                               {$subTreeSQL}\n                                         ezcontentclass.version = '0' AND\n                                         ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id\n                                         {$showInvisibleNodesCond}\n                                         {$sqlPermissionChecking['where']}", eZDBInterface::SERVER_SLAVE);
                 } else {
                     $table = $db->generateUniqueTempTableName('ezsearch_tmp_%', $i);
                     $this->saveCreatedTempTableName($i, $table);
                     $tmpTable0 = $this->getSavedTempTableName(0);
                     $db->createTempTable("CREATE TEMPORARY TABLE {$table} ( contentobject_id int primary key not null, published int )");
                     $db->query("INSERT INTO {$table} SELECT DISTINCT ezsearch_object_word_link.contentobject_id, ezsearch_object_word_link.published\n                                         FROM\n                                             ezcontentobject\n                                             INNER JOIN ezsearch_object_word_link ON (ezsearch_object_word_link.contentobject_id = ezcontentobject.id)\n                                             {$subTreeTable}\n                                             INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id)\n                                             INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)\n                                             INNER JOIN {$tmpTable0} ON ({$tmpTable0}.contentobject_id = ezsearch_object_word_link.contentobject_id)\n                                             {$sqlPermissionChecking['from']}\n                                          WHERE\n                                          {$searchDateQuery}\n                                          {$sectionQuery}\n                                          {$classQuery}\n                                          {$classAttributeQuery}\n                                          {$searchPartText}\n                                          {$subTreeSQL}\n                                          ezcontentclass.version = '0' AND\n                                          ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id\n                                          {$showInvisibleNodesCond}\n                                          {$sqlPermissionChecking['where']}", eZDBInterface::SERVER_SLAVE);
                 }
                 $i++;
             } else {
                 $stopWordArray[] = array('word' => $searchPart['text']);
             }
         }
         if (count($searchPartsArray) === 0 && $this->TempTablesCount == 0) {
             $table = $db->generateUniqueTempTableName('ezsearch_tmp_%', 0);
             $this->saveCreatedTempTableName(0, $table);
             $db->createTempTable("CREATE TEMPORARY TABLE {$table} ( contentobject_id int primary key not null, published int )");
             $db->query("INSERT INTO {$table} SELECT DISTINCT ezsearch_object_word_link.contentobject_id, ezsearch_object_word_link.published\n                                     FROM ezcontentobject\n                                          INNER JOIN ezsearch_object_word_link ON (ezsearch_object_word_link.contentobject_id = ezcontentobject.id)\n                                          {$subTreeTable}\n                                          INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id)\n                                          INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)\n                                          {$sqlPermissionChecking['from']}\n                                     WHERE\n                                          {$searchDateQuery}\n                                          {$sectionQuery}\n                                          {$classQuery}\n                                          {$classAttributeQuery}\n                                          {$subTreeSQL}\n                                          ezcontentclass.version = '0' AND\n                                          ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id\n                                          {$showInvisibleNodesCond}\n                                          {$sqlPermissionChecking['where']}", eZDBInterface::SERVER_SLAVE);
             $this->TempTablesCount = 1;
             $i = $this->TempTablesCount;
         }
         $nonExistingWordCount = count(array_unique($searchWordArray)) - count($wordIDHash) - $wildCardCount;
         $excludeWordCount = $searchWordCount - count($stopWordArray);
         if (count($stopWordArray) + $nonExistingWordCount == $searchWordCount && $this->TempTablesCount == 0) {
             // No words to search for, return empty result
             // cleanup temp tables
             $db->dropTempTableList($sqlPermissionChecking['temp_tables']);
             $db->dropTempTableList($this->getSavedTempTablesList());
             return array("SearchResult" => array(), "SearchCount" => 0, "StopWordArray" => $stopWordArray);
         }
         $tmpTablesFrom = "";
         $tmpTablesWhere = "";
         /// tmp tables
         $tmpTableCount = $i;
         for ($i = 0; $i < $tmpTableCount; $i++) {
             $tmpTablesFrom .= $this->getSavedTempTableName($i);
             if ($i < $tmpTableCount - 1) {
                 $tmpTablesFrom .= ", ";
             }
         }
         $tmpTablesSeparator = '';
         if ($tmpTableCount > 0) {
             $tmpTablesSeparator = ', ';
         }
         $tmpTable0 = $this->getSavedTempTableName(0);
         for ($i = 1; $i < $tmpTableCount; $i++) {
             $tmpTableI = $this->getSavedTempTableName($i);
             $tmpTablesWhere .= " {$tmpTable0}.contentobject_id={$tmpTableI}.contentobject_id  ";
             if ($i < $tmpTableCount - 1) {
                 $tmpTablesWhere .= " AND ";
             }
         }
         $tmpTablesWhereExtra = '';
         if ($tmpTableCount > 0) {
             $tmpTablesWhereExtra = "ezcontentobject.id={$tmpTable0}.contentobject_id AND";
         }
         $and = "";
         if ($tmpTableCount > 1) {
             $and = " AND ";
         }
         // Generate ORDER BY SQL
         $orderBySQLArray = $this->buildSortSQL($sortArray);
         $orderByFieldsSQL = $orderBySQLArray['sortingFields'];
         $sortWhereSQL = $orderBySQLArray['whereSQL'];
         $sortFromSQL = $orderBySQLArray['fromSQL'];
         $sortSelectSQL = $orderBySQLArray['selectSQL'];
         // Fetch data from table
         $searchQuery = '';
         $searchQuery = "SELECT DISTINCT ezcontentobject.*, ezcontentclass.serialized_name_list as class_serialized_name_list,\n                ezcontentobject_tree.*, ezcontentobject_name.name as name,\n                ezcontentobject_name.real_translation {$sortSelectSQL}\n                FROM\n                   {$tmpTablesFrom} {$tmpTablesSeparator}\n                   ezcontentobject\n                   INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id )\n                   INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)\n                   INNER JOIN ezcontentobject_name ON (\n                       ezcontentobject_name.contentobject_id = ezcontentobject_tree.contentobject_id AND\n                       ezcontentobject_name.content_version = ezcontentobject_tree.contentobject_version\n                   )\n                   {$sortFromSQL}\n                WHERE\n                {$tmpTablesWhere} {$and}\n                {$tmpTablesWhereExtra}\n                ezcontentclass.version = '0' AND\n                ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id AND\n                " . eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject') . "\n                {$showInvisibleNodesCond}\n                {$sortWhereSQL}\n                ORDER BY {$orderByFieldsSQL}";
         // Count query
         $languageCond = eZContentLanguage::languagesSQLFilter('ezcontentobject');
         if ($tmpTableCount == 0) {
             $searchCountQuery = "SELECT count( DISTINCT ezcontentobject.id ) AS count\n                        FROM\n                           ezcontentobject,\n                           ezcontentobject_tree\n                        WHERE\n                        ezcontentobject.id = ezcontentobject_tree.contentobject_id and\n                        ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id\n                        AND {$languageCond}\n                        {$showInvisibleNodesCond}";
         } else {
             $searchCountQuery = "SELECT count( DISTINCT ezcontentobject.id ) AS count\n                        FROM {$tmpTablesFrom} {$tmpTablesSeparator}\n                             ezcontentobject\n                        WHERE {$tmpTablesWhere} {$and}\n                            {$tmpTablesWhereExtra}\n                            {$languageCond}";
         }
         $objectRes = array();
         $searchCount = 0;
         if ($nonExistingWordCount <= 0) {
             // execute search query
             $objectResArray = $db->arrayQuery($searchQuery, array("limit" => $searchLimit, "offset" => $searchOffset), eZDBInterface::SERVER_SLAVE);
             // execute search count query
             $objectCountRes = $db->arrayQuery($searchCountQuery, array(), eZDBInterface::SERVER_SLAVE);
             $objectRes = eZContentObjectTreeNode::makeObjectsArray($objectResArray);
             $searchCount = $objectCountRes[0]['count'];
         } else {
             $objectRes = array();
         }
         // Drop tmp tables
         $db->dropTempTableList($sqlPermissionChecking['temp_tables']);
         $db->dropTempTableList($this->getSavedTempTablesList());
         return array("SearchResult" => $objectRes, "SearchCount" => $searchCount, "StopWordArray" => $stopWordArray);
     } else {
         return array("SearchResult" => array(), "SearchCount" => 0, "StopWordArray" => array());
     }
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:101,代码来源:ezsearchengine.php

示例6: trashList

 /**
  * Returns a list or the number of nodes from the trash
  *
  * @see eZContentObjectTreeNode::subTreeByNodeID()
  *
  * @param array|bool $params
  * @param bool $asCount If true, returns the number of items in the trash
  * @return array|int|null
  */
 static function trashList($params = false, $asCount = false)
 {
     if ($params === false) {
         $params = array('Offset' => false, 'Limit' => false, 'SortBy' => false, 'AttributeFilter' => false);
     }
     $offset = isset($params['Offset']) && is_numeric($params['Offset']) ? $params['Offset'] : false;
     $limit = isset($params['Limit']) && is_numeric($params['Limit']) ? $params['Limit'] : false;
     $asObject = isset($params['AsObject']) ? $params['AsObject'] : true;
     $objectNameFilter = isset($params['ObjectNameFilter']) ? $params['ObjectNameFilter'] : false;
     $sortBy = isset($params['SortBy']) && is_array($params['SortBy']) ? $params['SortBy'] : array(array('name'));
     if ($asCount) {
         $sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings(false);
     } else {
         $sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings($sortBy, 'ezcot');
     }
     $attributeFilter = eZContentObjectTreeNode::createAttributeFilterSQLStrings($params['AttributeFilter'], $sortingInfo);
     if ($attributeFilter === false) {
         return null;
     }
     $objectNameFilterSQL = eZContentObjectTreeNode::createObjectNameFilterConditionSQLString($objectNameFilter);
     $limitation = isset($params['Limitation']) && is_array($params['Limitation']) ? $params['Limitation'] : false;
     $limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
     $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList, 'ezcontentobject_trash', 'ezcot');
     if ($asCount) {
         $query = "SELECT count(*) as count ";
     } else {
         $query = "SELECT\n                        ezcontentobject.*,\n                        ezcot.*,\n                        ezcontentclass.serialized_name_list as class_serialized_name_list,\n                        ezcontentclass.identifier as class_identifier,\n                        ezcontentobject_name.name as name,\n                        ezcontentobject_name.real_translation\n                        {$sortingInfo['attributeTargetSQL']} ";
     }
     $query .= "FROM\n                        ezcontentobject_trash ezcot\n                        INNER JOIN ezcontentobject ON ezcot.contentobject_id = ezcontentobject.id\n                        INNER JOIN ezcontentclass ON ezcontentclass.version = 0 AND ezcontentclass.id = ezcontentobject.contentclass_id\n                        INNER JOIN ezcontentobject_name ON (\n                            ezcot.contentobject_id = ezcontentobject_name.contentobject_id AND\n                            ezcot.contentobject_version = ezcontentobject_name.content_version\n                        )\n                        {$sortingInfo['attributeFromSQL']}\n                        {$attributeFilter['from']}\n                        {$sqlPermissionChecking['from']}\n                   WHERE\n                        {$sortingInfo['attributeWhereSQL']}\n                        {$attributeFilter['where']}\n                        " . eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject') . "\n                        {$sqlPermissionChecking['where']}\n                        {$objectNameFilterSQL}\n                        AND " . eZContentLanguage::languagesSQLFilter('ezcontentobject');
     if (!$asCount && $sortingInfo['sortingFields'] && strlen($sortingInfo['sortingFields']) > 5) {
         $query .= " ORDER BY {$sortingInfo['sortingFields']}";
     }
     $db = eZDB::instance();
     if (!$offset && !$limit) {
         $trashRowsArray = $db->arrayQuery($query);
     } else {
         $trashRowsArray = $db->arrayQuery($query, array('offset' => $offset, 'limit' => $limit));
     }
     // cleanup temp tables
     $db->dropTempTableList($sqlPermissionChecking['temp_tables']);
     if ($asCount) {
         return $trashRowsArray[0]['count'];
     } else {
         if ($asObject) {
             $retTrashNodes = array();
             foreach (array_keys($trashRowsArray) as $key) {
                 $trashRow =& $trashRowsArray[$key];
                 $retTrashNodes[] = new eZContentObjectTrashNode($trashRow);
             }
             return $retTrashNodes;
         } else {
             return $trashRowsArray;
         }
     }
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:64,代码来源:ezcontentobjecttrashnode.php

示例7: fetchNode

 static function fetchNode($contentObjectID, $parentNodeID)
 {
     $returnValue = null;
     $ini = eZINI::instance();
     $db = eZDB::instance();
     $contentObjectID = (int) $contentObjectID;
     $parentNodeID = (int) $parentNodeID;
     $query = "SELECT ezcontentobject_tree.*,\n                         ezcontentclass.serialized_name_list as class_serialized_name_list,\n                         ezcontentclass.identifier as class_identifier,\n                         ezcontentclass.is_container as is_container\n                  FROM ezcontentobject_tree,\n                       ezcontentobject,\n                       ezcontentclass\n                  WHERE ezcontentobject_tree.contentobject_id = '{$contentObjectID}' AND\n                        ezcontentobject.id = '{$contentObjectID}' AND\n                        ezcontentobject_tree.parent_node_id = '{$parentNodeID}' AND\n                        ezcontentclass.version=0 AND\n                        ezcontentclass.id = ezcontentobject.contentclass_id AND " . eZContentLanguage::languagesSQLFilter('ezcontentobject');
     $nodeListArray = $db->arrayQuery($query);
     if (count($nodeListArray) == 1) {
         $retNodeArray = eZContentObjectTreeNode::makeObjectsArray($nodeListArray, false);
         $returnValue = $retNodeArray[0];
     }
     return $returnValue;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:15,代码来源:ezcontentobjecttreenode.php

示例8: modify

 function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     switch ($operatorName) {
         case 'eztagcloud':
             $tags = array();
             $tagCloud = array();
             $parentNodeID = 0;
             $classIdentifier = '';
             $classIdentifierSQL = '';
             $pathString = '';
             $parentNodeIDSQL = '';
             $dbParams = array();
             $params = $namedParameters['params'];
             $orderBySql = 'ORDER BY ezkeyword.keyword ASC';
             if (isset($params['class_identifier'])) {
                 $classIdentifier = $params['class_identifier'];
             }
             if (isset($params['parent_node_id'])) {
                 $parentNodeID = $params['parent_node_id'];
             }
             if (isset($params['limit'])) {
                 $dbParams['limit'] = $params['limit'];
             }
             if (isset($params['offset'])) {
                 $dbParams['offset'] = $params['offset'];
             }
             if (isset($params['sort_by']) && is_array($params['sort_by']) && count($params['sort_by'])) {
                 $orderBySql = 'ORDER BY ';
                 $orderArr = is_string($params['sort_by'][0]) ? array($params['sort_by']) : $params['sort_by'];
                 foreach ($orderArr as $key => $order) {
                     if ($key !== 0) {
                         $orderBySql .= ', ';
                     }
                     $direction = isset($order[1]) ? $order[1] : false;
                     switch ($order[0]) {
                         case 'keyword':
                             $orderBySql .= 'ezkeyword.keyword ' . ($direction ? 'ASC' : 'DESC');
                             break;
                         case 'count':
                             $orderBySql .= 'keyword_count ' . ($direction ? 'ASC' : 'DESC');
                             break;
                     }
                 }
             }
             $db = eZDB::instance();
             if ($classIdentifier) {
                 $classID = eZContentObjectTreeNode::classIDByIdentifier($classIdentifier);
                 $classIdentifierSQL = "AND ezcontentobject.contentclass_id = '" . $classID . "'";
             }
             if ($parentNodeID) {
                 $node = eZContentObjectTreeNode::fetch($parentNodeID);
                 if ($node) {
                     $pathString = "AND ezcontentobject_tree.path_string like '" . $node->attribute('path_string') . "%'";
                 }
                 $parentNodeIDSQL = 'AND ezcontentobject_tree.node_id != ' . (int) $parentNodeID;
             }
             $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(true, false);
             $limitation = false;
             $limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
             $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
             $languageFilter = 'AND ' . eZContentLanguage::languagesSQLFilter('ezcontentobject');
             $languageFilter .= 'AND ' . eZContentLanguage::languagesSQLFilter('ezcontentobject_attribute', 'language_id');
             $rs = $db->arrayQuery("SELECT ezkeyword.keyword, count(ezkeyword.keyword) AS keyword_count\n                                        FROM ezkeyword_attribute_link\n                                        LEFT JOIN ezcontentobject_attribute\n                                            ON ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id\n                                        LEFT JOIN ezcontentobject\n                                            ON ezcontentobject_attribute.contentobject_id = ezcontentobject.id\n                                        LEFT JOIN ezcontentobject_tree\n                                            ON ezcontentobject_attribute.contentobject_id = ezcontentobject_tree.contentobject_id\n                                        LEFT JOIN ezkeyword\n                                            ON ezkeyword.id = ezkeyword_attribute_link.keyword_id\n                                        {$sqlPermissionChecking['from']}\n                                        WHERE\n                                            ezcontentobject.status = " . eZContentObject::STATUS_PUBLISHED . "\n                                            AND ezcontentobject_attribute.version = ezcontentobject.current_version\n                                            AND ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id\n                                            {$pathString}\n                                            {$parentNodeIDSQL}\n                                            {$classIdentifierSQL}\n                                            {$showInvisibleNodesCond}\n                                            {$sqlPermissionChecking['where']}\n                                            {$languageFilter}\n                                        GROUP BY ezkeyword.id, ezkeyword.keyword\n                                        {$orderBySql}", $dbParams);
             foreach ($rs as $row) {
                 $tags[$row['keyword']] = $row['keyword_count'];
             }
             // To be able to combine count sorting with keyword sorting
             // without being limited by sql LIMIT result clipping
             if (isset($params['post_sort_by'])) {
                 if ($params['post_sort_by'] === 'keyword') {
                     ksort($tags, SORT_LOCALE_STRING);
                 } else {
                     if ($params['post_sort_by'] === 'keyword_reverse') {
                         krsort($tags, SORT_LOCALE_STRING);
                     } else {
                         if ($params['post_sort_by'] === 'count') {
                             asort($tags, SORT_NUMERIC);
                         } else {
                             if ($params['post_sort_by'] === 'count_reverse') {
                                 arsort($tags, SORT_NUMERIC);
                             }
                         }
                     }
                 }
             }
             $maxFontSize = 200;
             $minFontSize = 100;
             $maxCount = 0;
             $minCount = 0;
             if (count($tags) != 0) {
                 $maxCount = max(array_values($tags));
                 $minCount = min(array_values($tags));
             }
             $spread = $maxCount - $minCount;
             if ($spread == 0) {
                 $spread = 1;
             }
             $step = ($maxFontSize - $minFontSize) / $spread;
             foreach ($tags as $key => $value) {
                 $size = $minFontSize + ($value - $minCount) * $step;
//.........这里部分代码省略.........
开发者ID:innoteam,项目名称:ezdemo-ls-extension,代码行数:101,代码来源:eztagcloud.php

示例9: modify

 function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     switch ($operatorName) {
         case 'eztagcloud':
             $tags = array();
             $tagCloud = array();
             $parentNodeID = 0;
             $classIdentifier = '';
             $classIdentifierSQL = '';
             $pathString = '';
             $parentNodeIDSQL = '';
             $dbParams = array();
             $params = $namedParameters['params'];
             $orderBySql = 'ORDER BY ezkeyword.keyword ASC';
             if (isset($params['class_identifier'])) {
                 $classIdentifier = $params['class_identifier'];
             }
             if (isset($params['parent_node_id'])) {
                 $parentNodeID = $params['parent_node_id'];
             }
             if (isset($params['limit'])) {
                 $dbParams['limit'] = $params['limit'];
             }
             if (isset($params['offset'])) {
                 $dbParams['offset'] = $params['offset'];
             }
             if (isset($params['sort_by']) && is_array($params['sort_by']) && count($params['sort_by'])) {
                 $orderBySql = 'ORDER BY ';
                 $orderArr = is_string($params['sort_by'][0]) ? array($params['sort_by']) : $params['sort_by'];
                 foreach ($orderArr as $key => $order) {
                     if ($key !== 0) {
                         $orderBySql .= ', ';
                     }
                     $direction = isset($order[1]) ? $order[1] : false;
                     switch ($order[0]) {
                         case 'keyword':
                             $orderBySql .= 'ezkeyword.keyword ' . ($direction ? 'ASC' : 'DESC');
                             break;
                         case 'count':
                             $orderBySql .= 'keyword_count ' . ($direction ? 'ASC' : 'DESC');
                             break;
                     }
                 }
             }
             $db = eZDB::instance();
             if ($classIdentifier) {
                 $classID = eZContentObjectTreeNode::classIDByIdentifier($classIdentifier);
                 $classIdentifierSQL = "AND ezcontentobject.contentclass_id = '" . $classID . "'";
             }
             if ($parentNodeID) {
                 $node = eZContentObjectTreeNode::fetch($parentNodeID);
                 if ($node) {
                     $pathString = "AND ezcontentobject_tree.path_string like '" . $node->attribute('path_string') . "%'";
                 }
                 $parentNodeIDSQL = 'AND ezcontentobject_tree.node_id != ' . (int) $parentNodeID;
             }
             $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(true, false);
             $limitation = false;
             $limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
             $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
             $languageFilter = 'AND ' . eZContentLanguage::languagesSQLFilter('ezcontentobject');
             $rs = $db->arrayQuery("SELECT ezkeyword.keyword, count(*) as keyword_count\n                                        FROM ezkeyword,\n                                            ezkeyword_attribute_link,\n                                            ezcontentobject,\n                                            ezcontentobject_attribute,\n                                            ezcontentobject_tree\n                                            {$sqlPermissionChecking['from']}\n                                        WHERE ezkeyword.id = ezkeyword_attribute_link.keyword_id\n                                            AND ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id\n                                            AND ezcontentobject_attribute.contentobject_id = ezcontentobject_tree.contentobject_id\n                                            AND ezcontentobject_attribute.contentobject_id = ezcontentobject.id\n                                            AND ezcontentobject.status = " . eZContentObject::STATUS_PUBLISHED . "\n                                            AND ezcontentobject_attribute.version = ezcontentobject.current_version\n                                            AND ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id\n                                            {$pathString}\n                                            {$parentNodeIDSQL}\n                                            {$classIdentifierSQL}\n                                            {$showInvisibleNodesCond}\n                                            {$sqlPermissionChecking['where']}\n                                            {$languageFilter}\n                                        GROUP BY ezkeyword.id, ezkeyword.keyword\n                                        {$orderBySql}", $dbParams);
             foreach ($rs as $row) {
                 $tags[$row['keyword']] = $row['keyword_count'];
             }
             $maxFontSize = 200;
             $minFontSize = 100;
             $maxCount = 0;
             $minCount = 0;
             if (count($tags) != 0) {
                 $maxCount = max(array_values($tags));
                 $minCount = min(array_values($tags));
             }
             $spread = $maxCount - $minCount;
             if ($spread == 0) {
                 $spread = 1;
             }
             $step = ($maxFontSize - $minFontSize) / $spread;
             // stevo - combine lower/upper case
             $realTags = array();
             $realkey = '';
             foreach ($tags as $key => $value) {
                 $key = strtolower($key);
                 if (isset($realTags[$key])) {
                     $realTags[$key] += $value;
                 } else {
                     $realTags[$key] = $value;
                 }
             }
             // stevo - add minimum tag count option
             $min = isset($params['min']) ? $params['min'] : 0;
             //$minCount -= $min;
             foreach ($realTags as $key => $value) {
                 if ($value > $min) {
                     $size = $minFontSize + ($value - $minCount) * $step;
                     $tagCloud[] = array('font_size' => $size, 'count' => $value, 'tag' => $key);
                 }
             }
             require_once 'kernel/common/template.php';
             $tpl = templateInit();
//.........这里部分代码省略.........
开发者ID:stevoland,项目名称:ez_patch,代码行数:101,代码来源:eztagcloud.php

示例10: fetchNodeByRating


//.........这里部分代码省略.........
     }
     if (isset($params['offset'])) {
         $offset = (int) $params['offset'];
     }
     if ($includeNotRated) {
         $ratingFromSql = 'LEFT JOIN ezstarrating
                          ON ezstarrating.contentobject_id = ezcontentobject.id';
         $ratingWhereSql = '';
     } else {
         $ratingFromSql = ', ezstarrating';
         $ratingWhereSql = 'ezstarrating.contentobject_id = ezcontentobject.id AND';
     }
     if (isset($params['sort_by']) && is_array($params['sort_by'])) {
         $orderBySql = 'ORDER BY ';
         $orderArr = is_string($params['sort_by'][0]) ? array($params['sort_by']) : $params['sort_by'];
         foreach ($orderArr as $key => $order) {
             $orderBySqlPart = false;
             $direction = isset($order[1]) ? $order[1] : false;
             switch ($order[0]) {
                 case 'rating':
                     $orderBySqlPart = 'rating ' . ($direction ? 'ASC' : 'DESC');
                     break;
                 case 'rating_count':
                     $orderBySqlPart = 'rating_count ' . ($direction ? 'ASC' : 'DESC');
                     break;
                 case 'object_count':
                     $selectSql .= 'COUNT( ezcontentobject.id ) as object_count,';
                     $orderBySqlPart = 'object_count ' . ($direction ? 'ASC' : 'DESC');
                     break;
                 case 'published':
                     $orderBySqlPart = 'ezcontentobject.published ' . ($direction ? 'ASC' : 'DESC');
                     break;
                 case 'modified':
                     $orderBySqlPart = 'ezcontentobject.modified ' . ($direction ? 'ASC' : 'DESC');
                     break;
                 case 'view_count':
                     // notice: will only fetch nodes that HAVE a entry in the ezview_counter table!!!
                     $selectSql .= 'ezview_counter.count as view_count,';
                     $fromSql .= ', ezview_counter';
                     $whereSql[] = 'ezcontentobject_tree.node_id = ezview_counter.node_id';
                     $orderBySqlPart = 'view_count ' . ($direction ? 'ASC' : 'DESC');
                     break;
                 default:
                     if (isset($params['extended_attribute_filter'])) {
                         $orderBySqlPart = $order[0] . ' ' . ($direction ? 'ASC' : 'DESC');
                     } else {
                         eZDebug::writeError("Unsuported sort type '{$order['0']}', for fetch_by_starrating().", __METHOD__);
                     }
                     break;
             }
             if ($orderBySqlPart) {
                 if ($key !== 0) {
                     $orderBySql .= ',';
                 }
                 $orderBySql .= $orderBySqlPart;
             }
         }
     }
     $whereSql = $whereSql ? implode($whereSql, ' AND ') . ' AND ' : '';
     $extendedAttributeFilter = eZContentObjectTreeNode::createExtendedAttributeFilterSQLStrings($params['extended_attribute_filter']);
     $limitation = isset($params['limitation']) && is_array($params['limitation']) ? $params['limitation'] : false;
     $limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
     $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
     $languageFilter = ' AND ' . eZContentLanguage::languagesSQLFilter('ezcontentobject');
     $useVersionName = true;
     $versionNameTables = eZContentObjectTreeNode::createVersionNameTablesSQLString($useVersionName);
     $versionNameTargets = eZContentObjectTreeNode::createVersionNameTargetsSQLString($useVersionName);
     $versionNameJoins = eZContentObjectTreeNode::createVersionNameJoinsSQLString($useVersionName, false);
     $mainNodeOnlyCond = eZContentObjectTreeNode::createMainNodeConditionSQLString($mainNodeOnly);
     $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(!$ignoreVisibility);
     $db = eZDB::instance();
     $sql = "SELECT\n                             {$selectSql}\n                             AVG( ezstarrating.rating_average ) as rating,\n                             SUM( ezstarrating.rating_count ) as rating_count,\n                             ezcontentclass.serialized_name_list as class_serialized_name_list,\n                             ezcontentclass.identifier as class_identifier,\n                             ezcontentclass.is_container as is_container\n                             {$versionNameTargets}\n                             {$extendedAttributeFilter['columns']}\n                            FROM\n                             ezcontentobject_tree,\n                             ezcontentobject_tree owner_tree,\n                             ezcontentclass\n                             {$fromSql}\n                             {$versionNameTables}\n                             {$extendedAttributeFilter['tables']}\n                             {$sqlPermissionChecking['from']}\n                             ,ezcontentobject\n                             {$ratingFromSql}\n                            WHERE\n                             {$extendedAttributeFilter['joins']}\n                             {$ratingWhereSql}\n                             ezcontentobject.id = ezcontentobject_tree.contentobject_id AND\n                             ezcontentobject.owner_id = owner_tree.contentobject_id AND\n                             owner_tree.node_id = owner_tree.main_node_id AND\n                             ezcontentclass.version=0 AND\n                             ezcontentclass.id = ezcontentobject.contentclass_id AND\n                             {$mainNodeOnlyCond}\n                             {$classCondition}\n                             {$whereSql}\n\t                         {$versionNameJoins}\n\t                         {$showInvisibleNodesCond}\n\t                         {$sqlPermissionChecking['where']}\n\t                         {$languageFilter}\n                            {$groupBySql}\n                            {$orderBySql}";
     $server = isset($sqlPermissionChecking['temp_tables'][0]) ? eZDBInterface::SERVER_SLAVE : false;
     if ($offset !== false || $limit !== false) {
         $rows = $db->arrayQuery($sql, array('offset' => $offset, 'limit' => $limit), $server);
     } else {
         $rows = $db->arrayQuery($sql, null, $server);
     }
     $db->dropTempTableList($sqlPermissionChecking['temp_tables']);
     unset($db);
     if (isset($rows[0]) && is_array($rows)) {
         if ($asObject) {
             $ret = ezsrRatingObjectTreeNode::makeObjectsArray($rows);
             if ($loadDataMap) {
                 eZContentObject::fillNodeListAttributes($ret);
             }
         } else {
             $ret = $rows;
         }
     } else {
         if ($rows === false) {
             eZDebug::writeError('The ezstarrating table seems to be missing,
                       contact your administrator', __METHOD__);
             $ret = array();
         } else {
             $ret = array();
         }
     }
     return $ret;
 }
开发者ID:nlescure,项目名称:ezstarrating,代码行数:101,代码来源:ezsrratingobject.php

示例11: tagCloud

 /**
  * Returns the tag cloud for specified parameters using eZ Publish database
  *
  * @param array $params
  *
  * @return array
  */
 private function tagCloud($params)
 {
     $parentNodeID = 0;
     $classIdentifier = '';
     $classIdentifierSQL = '';
     $pathString = '';
     $parentNodeIDSQL = '';
     $dbParams = array();
     $orderBySql = 'ORDER BY eztags.keyword ASC';
     if (isset($params['class_identifier'])) {
         $classIdentifier = $params['class_identifier'];
     }
     if (isset($params['parent_node_id'])) {
         $parentNodeID = $params['parent_node_id'];
     }
     if (isset($params['limit'])) {
         $dbParams['limit'] = $params['limit'];
     }
     if (isset($params['offset'])) {
         $dbParams['offset'] = $params['offset'];
     }
     if (isset($params['sort_by']) && is_array($params['sort_by']) && !empty($params['sort_by'])) {
         $orderBySql = 'ORDER BY ';
         $orderArr = is_string($params['sort_by'][0]) ? array($params['sort_by']) : $params['sort_by'];
         foreach ($orderArr as $key => $order) {
             if ($key !== 0) {
                 $orderBySql .= ', ';
             }
             $direction = isset($order[1]) ? $order[1] : false;
             switch ($order[0]) {
                 case 'keyword':
                     $orderBySql .= 'eztags.keyword ' . ($direction ? 'ASC' : 'DESC');
                     break;
                 case 'count':
                     $orderBySql .= 'keyword_count ' . ($direction ? 'ASC' : 'DESC');
                     break;
             }
         }
     }
     $db = eZDB::instance();
     if ($classIdentifier) {
         $classID = eZContentObjectTreeNode::classIDByIdentifier($classIdentifier);
         $classIdentifierSQL = "AND ezcontentobject.contentclass_id = '" . $classID . "'";
     }
     if ($parentNodeID) {
         $node = eZContentObjectTreeNode::fetch($parentNodeID);
         if ($node) {
             $pathString = "AND ezcontentobject_tree.path_string like '" . $node->attribute('path_string') . "%'";
         }
         $parentNodeIDSQL = "AND ezcontentobject_tree.node_id != " . (int) $parentNodeID;
     }
     $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(true, false);
     $limitation = false;
     $limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
     $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
     $languageFilter = 'AND ' . eZContentLanguage::languagesSQLFilter('ezcontentobject');
     $languageFilter .= 'AND ' . eZContentLanguage::languagesSQLFilter('ezcontentobject_attribute', 'language_id');
     $rs = $db->arrayQuery("SELECT eztags.id, eztags.keyword, COUNT(DISTINCT ezcontentobject.id) AS keyword_count\n                                FROM eztags_attribute_link\n                                LEFT JOIN ezcontentobject_attribute\n                                    ON eztags_attribute_link.objectattribute_id = ezcontentobject_attribute.id\n                                    AND eztags_attribute_link.objectattribute_version = ezcontentobject_attribute.version\n                                LEFT JOIN ezcontentobject\n                                    ON ezcontentobject_attribute.contentobject_id = ezcontentobject.id\n                                LEFT JOIN ezcontentobject_tree\n                                    ON ezcontentobject_attribute.contentobject_id = ezcontentobject_tree.contentobject_id\n                                LEFT JOIN eztags\n                                    ON eztags.id = eztags_attribute_link.keyword_id\n                                LEFT JOIN eztags_keyword\n                                    ON eztags.id = eztags_keyword.keyword_id\n                                {$sqlPermissionChecking['from']}\n                                WHERE " . eZContentLanguage::languagesSQLFilter('eztags') . "\n                                    AND " . eZContentLanguage::sqlFilter('eztags_keyword', 'eztags') . "\n                                    AND ezcontentobject.status = " . eZContentObject::STATUS_PUBLISHED . "\n                                    AND ezcontentobject_attribute.version = ezcontentobject.current_version\n                                    AND ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id\n                                    {$pathString}\n                                    {$parentNodeIDSQL}\n                                    {$classIdentifierSQL}\n                                    {$showInvisibleNodesCond}\n                                    {$sqlPermissionChecking['where']}\n                                    {$languageFilter}\n                                GROUP BY eztags.id, eztags.keyword\n                                {$orderBySql}", $dbParams);
     $tagsCountList = array();
     foreach ($rs as $row) {
         $tagsCountList[$row['id']] = $row['keyword_count'];
     }
     /** @var eZTagsObject[] $tagObjects */
     $tagObjects = eZTagsObject::fetchList(array('id' => array(array_keys($tagsCountList))));
     if (!is_array($tagObjects) || empty($tagObjects)) {
         return array();
     }
     $tagSortArray = array();
     $tagKeywords = array();
     $tagCounts = array();
     foreach ($tagObjects as $tag) {
         $tagKeyword = $tag->attribute('keyword');
         $tagCount = $tagsCountList[$tag->attribute('id')];
         $tagSortArray[] = array('keyword' => $tagKeyword, 'count' => $tagCount, 'tag' => $tag);
         $tagKeywords[] = $tagKeyword;
         $tagCounts[] = $tagCount;
     }
     if (isset($params['post_sort_by'])) {
         if ($params['post_sort_by'] === 'keyword') {
             array_multisort($tagKeywords, SORT_ASC, SORT_LOCALE_STRING, $tagSortArray);
         } else {
             if ($params['post_sort_by'] === 'keyword_reverse') {
                 array_multisort($tagKeywords, SORT_DESC, SORT_LOCALE_STRING, $tagSortArray);
             } else {
                 if ($params['post_sort_by'] === 'count') {
                     array_multisort($tagCounts, SORT_ASC, SORT_NUMERIC, $tagSortArray);
                 } else {
                     if ($params['post_sort_by'] === 'count_reverse') {
                         array_multisort($tagCounts, SORT_DESC, SORT_NUMERIC, $tagSortArray);
                     }
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:oki34,项目名称:eztags,代码行数:101,代码来源:eztagscloud.php

示例12: createAndMultipleFilterSqlParts

 /**
  * Creates and returns SQL parts used in fetch functions
  *
  * @param array $params where 'tag_id' is an array of arrays; at least one tag ID from each array must match
  *
  * @return array
  */
 public function createAndMultipleFilterSqlParts($params)
 {
     $returnArray = array('tables' => '', 'joins' => '', 'columns' => '');
     if (!isset($params['tag_id'])) {
         return $returnArray;
     }
     if (is_array($params['tag_id'])) {
         $tagIDsArray = $params['tag_id'];
     } else {
         return $returnArray;
     }
     $returnArray['tables'] = " INNER JOIN eztags_attribute_link i1 ON (i1.object_id = ezcontentobject.id AND i1.objectattribute_version = ezcontentobject.current_version)\n                                   INNER JOIN eztags i2 ON (i1.keyword_id = i2.id)\n                                   INNER JOIN eztags_keyword i3 ON (i2.id = i3.keyword_id)";
     $dbStrings = array();
     $db = eZDB::instance();
     foreach ($tagIDsArray as $tagIDGroup) {
         $tagIDGroup = (array) $tagIDGroup;
         if (!isset($params['include_synonyms']) || isset($params['include_synonyms']) && (bool) $params['include_synonyms'] == true) {
             /** @var eZTagsObject[] $tags */
             $tags = eZTagsObject::fetchList(array('main_tag_id' => array($tagIDGroup)));
             if (is_array($tags)) {
                 foreach ($tags as $tag) {
                     $tagIDGroup[] = $tag->attribute('id');
                 }
             }
         }
         $dbStrings[] = "EXISTS (\n                SELECT 1\n                FROM\n                    eztags_attribute_link j1,\n                    ezcontentobject j2\n                WHERE " . $db->generateSQLINStatement($tagIDGroup, 'j1.keyword_id', false, true, 'int') . " AND j1.object_id = j2.id\n                AND j2.id = ezcontentobject.id\n                AND j1.objectattribute_version = j2.current_version\n            )";
     }
     $dbString = implode(" AND ", $dbStrings);
     if (isset($params['language'])) {
         $language = $params['language'];
         if (!is_array($language)) {
             $language = array($language);
         }
         eZContentLanguage::setPrioritizedLanguages($language);
     }
     $returnArray['joins'] = " {$dbString}\n                                  AND " . eZContentLanguage::languagesSQLFilter('i2') . " AND " . eZContentLanguage::sqlFilter('i3', 'i2') . " AND ";
     if (isset($params['language'])) {
         eZContentLanguage::clearPrioritizedLanguages();
     }
     return $returnArray;
 }
开发者ID:oki34,项目名称:eztags,代码行数:48,代码来源:eztagsattributefilter.php

示例13: modify

 function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     switch ($operatorName) {
         case 'eztagcloud':
             /*
             $tags = array();
             $tagCloud = array();
             $parentNodeID = 0;
             $classID = '';
             $classIdentifier = '';
             $classIdentifierSQL = '';
             $pathString = '';
             $parentNodeIDSQL = '';
             
             if ( isset( $namedParameters['params']['class_identifier'] ) )
                 $classIdentifier = $namedParameters['params']['class_identifier'];
             
             if ( isset( $namedParameters['params']['parent_node_id'] ) )
                 $parentNodeID = $namedParameters['params']['parent_node_id'];
             
             if ( isset( $namedParameters['params']['limit'] ) )
                 $tagCloudLimit = $namedParameters['params']['limit'];
             else
                 $tagCloudLimit = 25;
             
             include_once( 'lib/ezdb/classes/ezdb.php' );
             $db = eZDB::instance();
             
             if( $classIdentifier )
             {
                 $classID = eZContentObjectTreeNode::classIDByIdentifier( $classIdentifier );
                 $classIdentifierSQL = "AND ezcontentobject.contentclass_id = $classID";
             }
             
             if( $parentNodeID )
             {
                 $node = eZContentObjectTreeNode::fetch( $parentNodeID );
                 if ( $node )
                     $pathString = "AND ezcontentobject_tree.path_string like '" . $node->attribute( 'path_string' ) . "%'";
                 $parentNodeIDSQL = "AND ezcontentobject_tree.node_id != " . (int)$parentNodeID;
             }
             
             $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString( true, false );
             $limitation = false;
             $limitationList = eZContentObjectTreeNode::getLimitationList( $limitation );
             $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL( $limitationList );
             
             $versionNameJoins = " AND ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id AND
                                         ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version AND ";
             $languageFilter = " AND " . eZContentLanguage::languagesSQLFilter( 'ezcontentobject' );
             $versionNameJoins .= eZContentLanguage::sqlFilter( 'ezcontentobject_name', 'ezcontentobject' );
             
             $rs = $db->arrayQuery( "SELECT DISTINCT ezkeyword.keyword
                                     FROM ezkeyword,
                                         ezkeyword_attribute_link,
                                         ezcontentobject,
                                         ezcontentobject_name,
                                         ezcontentobject_attribute,
                                         ezcontentobject_tree
                                         $sqlPermissionChecking[from]
                                     WHERE ezkeyword.id = ezkeyword_attribute_link.keyword_id
                                         AND ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id
                                         AND ezcontentobject_attribute.contentobject_id = ezcontentobject_tree.contentobject_id
                                         AND ezcontentobject.status = '".eZContentObject::STATUS_PUBLISHED."'
                                         AND ezcontentobject_attribute.version = ezcontentobject.current_version
                                         AND ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id
                                         $pathString
                                         $parentNodeIDSQL
                                         $classIdentifierSQL
                                         $showInvisibleNodesCond
                                         $sqlPermissionChecking[where]
                                         $languageFilter
                                         $versionNameJoins
                                     ORDER BY ezkeyword.keyword ASC" );
             
             include_once ('lib/ezutils/classes/ezfunctionhandler.php');
             
             foreach( $rs as $row )
             {
                 $tags[$row['keyword']] = eZFunctionHandler::execute( 'content', 'keyword_count', array( 'alphabet' => $row['keyword'],
                                                                                                         'strict_matching' => true,
                                                                                                         'classid' => $classID  ) );
             }
             
             $maxFontSize = 180;
             $minFontSize = 90;
             
             $maxCount = 0;
             $minCount = 0;
             
             if( count( $tags ) != 0 )
             {
                 $maxCount = max( array_values( $tags ) );
                 $minCount = min( array_values($tags ) );
             }
             
             $spread = $maxCount - $minCount;
             if ( $spread == 0 )
             $spread = 1;
             
//.........这里部分代码省略.........
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:101,代码来源:eztagcloud.php

示例14: trashList

    static function trashList( $params = false, $asCount = false )
    {
        if ( $params === false )
        {
            $params = array( 'Offset'                   => false,
                             'Limit'                    => false,
                             'SortBy'                   => false,
                             'AttributeFilter'          => false,
                             );
        }

        $offset           = ( isset( $params['Offset'] ) && is_numeric( $params['Offset'] ) ) ? $params['Offset']             : false;
        $limit            = ( isset( $params['Limit']  ) && is_numeric( $params['Limit']  ) ) ? $params['Limit']              : false;
        $asObject         = ( isset( $params['AsObject']          ) )                         ? $params['AsObject']           : true;
        $objectNameFilter = ( isset( $params['ObjectNameFilter']  ) )                         ? $params['ObjectNameFilter']   : false;
        $sortBy           = ( isset( $params['SortBy']  ) && is_array( $params['SortBy']  ) ) ? $params['SortBy']              : array( array( 'name' ) );

        if ( $asCount )
        {
            $sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings( false );
        }
        else
        {
            $sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings( $sortBy, 'ezcot' );
        }

        $attributeFilter         = eZContentObjectTreeNode::createAttributeFilterSQLStrings( $params['AttributeFilter'], $sortingInfo );
        if ( $attributeFilter === false )
        {
            return null;
        }

        $useVersionName     = true;
        $versionNameTables  = eZContentObjectTreeNode::createVersionNameTablesSQLString ( $useVersionName );
        $versionNameTargets = eZContentObjectTreeNode::createVersionNameTargetsSQLString( $useVersionName );
        $versionNameJoins   = eZContentObjectTreeNode::createVersionNameJoinsSQLString  ( $useVersionName, false, false, false, 'ezcot' );

        $languageFilter = ' AND ' . eZContentLanguage::languagesSQLFilter( 'ezcontentobject' );

        $objectNameFilterSQL = eZContentObjectTreeNode::createObjectNameFilterConditionSQLString( $objectNameFilter );

        $limitation = ( isset( $params['Limitation']  ) && is_array( $params['Limitation']  ) ) ? $params['Limitation']: false;
        $limitationList = eZContentObjectTreeNode::getLimitationList( $limitation );
        $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL( $limitationList, 'ezcontentobject_trash', 'ezcot' );

        if ( $asCount )
        {
            $query = "SELECT count(*) as count ";
        }
        else
        {
            $query = "SELECT
                        ezcontentobject.*,
                        ezcot.*,
                        ezcontentclass.serialized_name_list as class_serialized_name_list,
                        ezcontentclass.identifier as class_identifier
                        $versionNameTargets
                        $sortingInfo[attributeTargetSQL] ";
        }
        $query .= "FROM
                        ezcontentobject_trash ezcot,
                        ezcontentobject,
                        ezcontentclass
                        $versionNameTables
                        $sortingInfo[attributeFromSQL]
                        $attributeFilter[from]
                        $sqlPermissionChecking[from]
                   WHERE
                        ezcontentclass.version=0 AND
                        ezcot.contentobject_id = ezcontentobject.id  AND
                        ezcontentclass.id = ezcontentobject.contentclass_id AND
                        $sortingInfo[attributeWhereSQL]
                        $attributeFilter[where]
                        $versionNameJoins
                        $sqlPermissionChecking[where]
                        $objectNameFilterSQL
                        $languageFilter
                        ";
        if ( !$asCount && $sortingInfo['sortingFields'] && strlen( $sortingInfo['sortingFields'] ) > 5  )
            $query .= " ORDER BY $sortingInfo[sortingFields]";

        $db = eZDB::instance();
        if ( !$offset && !$limit )
            $trashRowsArray = $db->arrayQuery( $query );
        else
            $trashRowsArray = $db->arrayQuery( $query, array( 'offset' => $offset,
                                                              'limit'  => $limit ) );

        // cleanup temp tables
        $db->dropTempTableList( $sqlPermissionChecking['temp_tables'] );

        if ( $asCount )
        {
            return $trashRowsArray[0]['count'];
        }
        else if ( $asObject )
        {
            $retTrashNodes = array();
            foreach ( array_keys( $trashRowsArray ) as $key )
            {
//.........这里部分代码省略.........
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:ezcontentobjecttrashnode.php

示例15: generateSQL

 protected function generateSQL()
 {
     if (!in_array($this->type, array('name', 'alias', 'all'))) {
         eZDebug::writeError("Parameter \$type must be one of name, alias or all. The value which was used was '{$this->type}'.");
         return null;
     }
     $db = eZDB::instance();
     if ($this->languages === true) {
         $langMask = trim(eZContentLanguage::languagesSQLFilter('ezurlalias_ml', 'lang_mask'));
         $conds[] = "({$langMask})";
     }
     if ($this->paren !== null) {
         $conds[] = "parent = {$this->paren}";
     }
     if ($this->text !== null) {
         $conds[] = "text_md5 = " . $db->md5("'" . $db->escapeString($this->text) . "'");
     }
     if ($this->actions !== null) {
         // Check for conditions which will return no rows.
         if (count($this->actions) == 0) {
             return false;
         }
         if (count($this->actions) == 1) {
             $action = $this->actions[0];
             $actionStr = $db->escapeString($action);
             $conds[] = "action = '{$actionStr}'";
         } else {
             $actions = array();
             foreach ($this->actions as $action) {
                 $actions[] = "'" . $db->escapeString($action) . "'";
             }
             $conds[] = "action IN (" . join(", ", $actions) . ")";
         }
     }
     $actionTypes = null;
     if ($this->actionTypes !== null) {
         $actionTypes = $this->actionTypes;
     }
     if ($this->actionTypesEx !== null) {
         if ($actionTypes == null) {
             $rows = $db->arrayQuery("SELECT DISTINCT action_type FROM ezurlalias_ml");
             $actionTypes = array();
             foreach ($rows as $row) {
                 $actionTypes[] = $row['action_type'];
             }
         }
         $actionTypes = array_values(array_diff($actionTypes, $this->actionTypesEx));
     }
     if ($actionTypes !== null) {
         // Check for conditions which will return no rows.
         if (count($actionTypes) == 0) {
             return false;
         }
         if (count($actionTypes) == 1) {
             $action = $actionTypes[0];
             $actionStr = $db->escapeString($action);
             $conds[] = "action_type = '{$actionStr}'";
         } else {
             $actions = array();
             foreach ($actionTypes as $action) {
                 $actions[] = "'" . $db->escapeString($action) . "'";
             }
             $conds[] = "action_type IN (" . join(", ", $actions) . ")";
         }
     }
     $conds[] = 'is_original = 1';
     if ($this->type == 'name') {
         $conds[] = 'is_alias = 0';
     } else {
         if ($this->type == 'alias') {
             $conds[] = 'is_alias = 1';
         } else {
         }
     }
     return "FROM ezurlalias_ml WHERE " . join(" AND ", $conds);
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:76,代码来源:ezurlaliasquery.php


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