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


PHP QQ::CustomFrom方法代码示例

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


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

示例1: PrepareQqForSearch

 /**
  * Given a search term, this will try and match all similarly matched individuals.
  * This will utilize soundex and other indexing methodologies.
  * 
  * @param string $strName
  * @param QQCondition $objCondition
  * @param QQClause[] $objClauses
  * @param QQNodePerson $objPersonNode
  * @return void
  */
 public static function PrepareQqForSearch($strName, QQCondition &$objCondition, &$objClauses, QQNodePerson $objPersonNode = null)
 {
     if (!$objPersonNode) {
         $objPersonNode = QQN::Person();
     }
     $strNameItemArray = NameItem::GetNormalizedArrayFromNameString($strName, true);
     // First, get the applicable NameItem
     $intNameItemIdArrayArray = array();
     foreach ($strNameItemArray as $strNameItem) {
         $intNameItemIdArray = array();
         $strQuery = sprintf("SELECT * FROM name_item WHERE (soundex(name) = soundex('%s') OR name LIKE '%s%%')", mysql_escape_string($strNameItem), mysql_escape_string($strNameItem));
         $objNameItemArray = NameItem::InstantiateDbResult(NameItem::GetDatabase()->Query($strQuery));
         foreach ($objNameItemArray as $objNameItem) {
             $intNameItemIdArray[] = $objNameItem->Id;
         }
         $intNameItemIdArrayArray[] = $intNameItemIdArray;
     }
     // Build the search array from Person
     $intIndex = 0;
     foreach ($intNameItemIdArrayArray as $intNameItemIdArray) {
         if (!count($intNameItemIdArray)) {
             $objCondition = QQ::None();
             return;
         }
         $intIndex++;
         $strAlias = 'assn_' . $intIndex;
         if ($intIndex == 2) {
             $objClauses[] = QQ::Distinct();
         }
         $objClauses[] = QQ::CustomFrom('person_nameitem_assn', $strAlias);
         if (count($intNameItemIdArray) == 1) {
             $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQ::CustomNode($strAlias . '.person_id'), $objPersonNode->Id), QQ::Equal(QQ::CustomNode($strAlias . '.name_item_id'), $intNameItemIdArray[0]));
         } else {
             $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQ::CustomNode($strAlias . '.person_id'), $objPersonNode->Id), QQ::In(QQ::CustomNode($strAlias . '.name_item_id'), $intNameItemIdArray));
         }
     }
 }
开发者ID:alcf,项目名称:chms,代码行数:47,代码来源:Person.class.php


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