本文整理汇总了PHP中QQ::CustomNode方法的典型用法代码示例。如果您正苦于以下问题:PHP QQ::CustomNode方法的具体用法?PHP QQ::CustomNode怎么用?PHP QQ::CustomNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQ
的用法示例。
在下文中一共展示了QQ::CustomNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetQqNodeForAttributeNode
protected function GetQqNodeForAttributeNode(QQCondition &$objQqCondition = null, &$objQqClauses = null, $strValue)
{
// Get the Attribute object we are trying to query against
$objAttribute = Attribute::Load($this->NodeDetail);
$strAttributeValueTableAlias = 'av' . self::$intJoinCount++;
$objQqClauses[] = QQ::CustomJoin('attribute_value', $strAttributeValueTableAlias, sprintf('%s%s%s.%sperson_id%s = %st0%s.%sid%s AND %s%s%s.%sattribute_id%s = %s', self::GetDatabase()->EscapeIdentifierBegin, $strAttributeValueTableAlias, self::GetDatabase()->EscapeIdentifierEnd, self::GetDatabase()->EscapeIdentifierBegin, self::GetDatabase()->EscapeIdentifierEnd, self::GetDatabase()->EscapeIdentifierBegin, self::GetDatabase()->EscapeIdentifierEnd, self::GetDatabase()->EscapeIdentifierBegin, self::GetDatabase()->EscapeIdentifierEnd, self::GetDatabase()->EscapeIdentifierBegin, $strAttributeValueTableAlias, self::GetDatabase()->EscapeIdentifierEnd, self::GetDatabase()->EscapeIdentifierBegin, self::GetDatabase()->EscapeIdentifierEnd, $objAttribute->Id));
// What is the ATTRIBUTE's type? Figure out the Custom QQ Node based on that
switch ($objAttribute->AttributeDataTypeId) {
case AttributeDataType::Checkbox:
$objQqNode = QQ::CustomNode(sprintf('%s.boolean_value', $strAttributeValueTableAlias));
break;
case AttributeDataType::Date:
$objQqNode = QQ::CustomNode(sprintf('%s.date_value', $strAttributeValueTableAlias));
break;
case AttributeDataType::DateTime:
$objQqNode = QQ::CustomNode(sprintf('%s.datetime_value', $strAttributeValueTableAlias));
break;
case AttributeDataType::Text:
$objQqNode = QQ::CustomNode(sprintf('%s.text_value', $strAttributeValueTableAlias));
break;
case AttributeDataType::ImmutableSingleDropdown:
case AttributeDataType::MutableSingleDropdown:
$objQqNode = QQ::CustomNode(sprintf('%s.single_attribute_option_id', $strAttributeValueTableAlias));
break;
case AttributeDataType::ImmutableMultipleDropdown:
case AttributeDataType::MutableMultipleDropdown:
$strAttributeOptionTableAlias = 'avmaoa' . self::$intJoinCount++;
$objQqClauses[] = QQ::CustomJoin('attributevalue_multipleattributeoption_assn', $strAttributeOptionTableAlias, sprintf("%s.attribute_value_id = %s.id AND %s.attribute_option_id = '%s'", $strAttributeOptionTableAlias, $strAttributeValueTableAlias, $strAttributeOptionTableAlias, $strValue));
$objQqNode = QQ::CustomNode(sprintf('%s.attribute_option_id', $strAttributeOptionTableAlias));
break;
default:
throw new Exception('No Support for Attribute Data Type Id: ' . $objAttribute->AttributeDataTypeId);
}
return $objQqNode;
}
示例2: 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));
}
}
}