public function dtgPeople_Bind() { $objConditions = QQ::All(); $objClauses = array(); $blnSearch = false; if ($strName = trim($this->txtName->Text)) { $blnSearch = true; Person::PrepareQqForSearch($strName, $objConditions, $objClauses); } if ($strName = trim($this->txtFirstName->Text)) { $blnSearch = true; $objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->FirstName, $strName . '%')); } if ($strName = trim($this->txtLastName->Text)) { $blnSearch = true; $objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->LastName, $strName . '%')); } if ($strName = trim($this->txtCity->Text)) { $blnSearch = true; $objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->PrimaryCityText, $strName . '%')); } if ($strName = trim($this->txtAddress->Text)) { $blnSearch = true; $objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->PrimaryAddressText, $strName . '%')); } if ($strName = trim($this->txtPhone->Text)) { $blnSearch = true; $objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->PrimaryPhoneText, $strName . '%')); } // No Search Parameters -- Let's see if we should find the check account folks first if (!$blnSearch) { if ($this->objParentControl->mctContribution->StewardshipContribution->PossiblePeopleArray) { $objConditions = QQ::Equal(QQN::Person()->CheckingAccountLookup->CheckingAccountLookupId, $this->objParentControl->mctContribution->StewardshipContribution->CheckingAccountLookupId); } else { $objConditions = QQ::None(); } } else { $this->dtgPeople->NoDataHtml = 'No results found. Please re-specify a search criteria above.'; } $this->dtgPeople->MetaDataBinder($objConditions, $objClauses); // Automagically "Select" the First Person if applicable if (!$this->blnExplicitSelectionFlag && $this->dtgPeople->DataSource && count($this->dtgPeople->DataSource) > 0) { $this->pxySelectPerson_Click(null, null, $this->dtgPeople->DataSource[0]->Id); } $this->blnExplicitSelectionFlag = false; }
public function btnClear_Click() { $this->txtSearch->Text = ''; $this->dtgSuggestion->AdditionalConditions = QQ::None(); }
/** * 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)); } } }
protected function dtgContributions_Bind() { $this->CalculateQuery($objCondition, $objClauses, $blnQueried); if ($blnQueried) { $this->dtgContributions->MetaDataBinder($objCondition, $objClauses); } else { $this->dtgContributions->MetaDataBinder(QQ::None()); } if ($this->blnPrintMode) { $objDataSource = $this->dtgContributions->DataSource; $objDataSource[] = new StewardshipContribution(); $this->dtgContributions->DataSource = $objDataSource; } }