本文整理汇总了PHP中QQ::Distinct方法的典型用法代码示例。如果您正苦于以下问题:PHP QQ::Distinct方法的具体用法?PHP QQ::Distinct怎么用?PHP QQ::Distinct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQ
的用法示例。
在下文中一共展示了QQ::Distinct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dtgItems_Bind
public function dtgItems_Bind()
{
$intYear = QApplication::PathInfo(0);
$dttStart = new QDateTime($intYear . '-01-01');
$dttEnd = new QDateTime($dttStart);
$dttEnd->Year += 1;
$dttStart->SetTime(null, null, null);
$dttEnd->SetTime(null, null, null);
$objPersonCursor = Person::QueryCursor(QQ::AndCondition(QQ::GreaterOrEqual(QQN::Person()->StewardshipContribution->DateCredited, $dttStart), QQ::LessThan(QQN::Person()->StewardshipContribution->DateCredited, $dttEnd)), QQ::Clause(QQ::Distinct(), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
$strNameArray = array();
$strNameValueArray = array();
while ($objPerson = Person::InstantiateCursor($objPersonCursor)) {
$strToken = strtolower($objPerson->FirstName . '|' . $objPerson->LastName);
$strToken = str_replace(' ', '', $strToken);
$strToken = str_replace('.', '', $strToken);
$strToken = str_replace(',', '', $strToken);
$strToken = str_replace('-', '', $strToken);
$strToken = str_replace('_', '', $strToken);
$strToken = str_replace('/', '', $strToken);
if (array_key_exists($strToken, $strNameArray)) {
$strNameValueArray[$strToken] = $objPerson->FirstName . ' ' . $objPerson->LastName;
}
$strNameArray[$strToken] = true;
}
$this->dtgItems->DataSource = $strNameValueArray;
}
示例2: dtgItems_Bind
public function dtgItems_Bind()
{
$intYear = QApplication::PathInfo(0);
$dttStart = new QDateTime($intYear . '-01-01');
$dttEnd = new QDateTime($dttStart);
$dttEnd->Year += 1;
$dttStart->SetTime(null, null, null);
$dttEnd->SetTime(null, null, null);
$this->dtgItems->DataSource = Person::QueryArray(QQ::AndCondition(QQ::GreaterOrEqual(QQN::Person()->StewardshipContribution->DateCredited, $dttStart), QQ::LessThan(QQN::Person()->StewardshipContribution->DateCredited, $dttEnd), QQ::IsNull(QQN::Person()->PrimaryAddressText), QQ::IsNull(QQN::Person()->StewardshipAddressId)), QQ::Clause(QQ::Distinct(), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
}
示例3: testAssociationTables
public function testAssociationTables()
{
// All People Who Are on a Project Managed by Karen Wolfe (Person ID #7)
$objPersonArray = Person::QueryArray(QQ::Equal(QQN::Person()->ProjectAsTeamMember->Project->ManagerPersonId, 7), QQ::Clause(QQ::Distinct(), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
$arrNamesOnly = array();
foreach ($objPersonArray as $item) {
$arrNamesOnly[] = $item->FirstName . " " . $item->LastName;
}
$this->assertEqual($arrNamesOnly, array("Brett Carlisle", "John Doe", "Samantha Jones", "Jacob Pratt", "Kendall Public", "Ben Robinson", "Alex Smith", "Wendy Smith", "Karen Wolfe"), "List managed persons is correct");
}
示例4: dtgMembers_Bind
public function dtgMembers_Bind()
{
$objCondition = QQ::In(QQN::Person()->GroupParticipation->GroupId, $this->intGroupIdArray);
$objCondition = QQ::AndCondition($objCondition, QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd));
$this->dtgMembers->TotalItemCount = Person::QueryCount($objCondition);
$objClauses = array(QQ::Distinct());
if ($objClause = $this->dtgMembers->LimitClause) {
$objClauses[] = $objClause;
}
if ($objClause = $this->dtgMembers->OrderByClause) {
$objClauses[] = $objClause;
}
$this->dtgMembers->DataSource = Person::QueryArray($objCondition, $objClauses);
}
示例5: dtgMembers_Bind
public function dtgMembers_Bind()
{
$objConditions = QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $this->objGroup->Id);
$this->dtgMembers->TotalItemCount = Person::QueryCount($objConditions);
if ($strName = trim($this->txtFirstName->Text)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->FirstName, $strName . '%'));
}
if ($strName = trim($this->txtLastName->Text)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->LastName, $strName . '%'));
}
$objClauses = array(QQ::Distinct());
if ($objClause = $this->dtgMembers->LimitClause) {
$objClauses[] = $objClause;
}
if ($objClause = $this->dtgMembers->OrderByClause) {
$objClauses[] = $objClause;
}
$this->dtgMembers->DataSource = Person::QueryArray($objConditions, $objClauses);
}
示例6: dtgGroups_Bind
public function dtgGroups_Bind()
{
if ($this->chkViewAll->Checked) {
$objClause = QQ::AndCondition(QQ::Equal(QQN::Group()->GroupParticipation->PersonId, $this->objPerson->Id), QQ::In(QQN::Group()->GroupTypeId, array(GroupType::RegularGroup, GroupType::GrowthGroup)));
} else {
$objClause = QQ::AndCondition(QQ::Equal(QQN::Group()->GroupParticipation->PersonId, $this->objPerson->Id), QQ::IsNull(QQN::Group()->GroupParticipation->DateEnd), QQ::In(QQN::Group()->GroupTypeId, array(GroupType::RegularGroup, GroupType::GrowthGroup)));
}
// Admins can view anything
if (QApplication::$Login->RoleTypeId == RoleType::ChMSAdministrator) {
} else {
// Non-Admins can only view non-confidential groups
// OR groups that they are associated with
$intMinistryIdArray = array();
foreach (QApplication::$Login->GetMinistryArray() as $objMinistry) {
$intMinistryIdArray[] = $objMinistry->Id;
}
$objSubClause = QQ::OrCondition(QQ::Equal(QQN::Group()->ConfidentialFlag, false), QQ::In(QQN::Group()->MinistryId, $intMinistryIdArray));
$objClause = QQ::AndCondition($objClause, $objSubClause);
}
$this->dtgGroups->DataSource = Group::QueryArray($objClause, QQ::Distinct());
}
示例7: Wolfe
well as any columns from that project table. In fact, the linkages can go indefinitely.
<b>QQN::Person()->ProjectAsTeamMember->Project->ManagerPerson->FirstName</b> refers to the "first name of the manager
of any project that this person is a team member of."<br/><br/>
More importantly, when performing <b>Qcodo Queries</b> across association tables, we can <b>Expand</b> on the many-to-many
relationship, which would use a special virtual attribute to help describe the individual object, itself, which was involved for the join.
In this case, if we were to do a query of the person table, expanding on any ProjectAsTeamMember objects, the actual project that is joined is available
to the Person object as $objPerson->_ProjectAsTeamMember.<br/><br/>
And finally, on a similar note, you could instead use <b>ExpandAsArray</b> which would do a similar expansion
on the associated object, but store it as an array. See below for the differences of each.
</div>
<h3>Get All People Who Are on a Project Managed by Karen Wolfe (Person ID #7)</h3>
<?php
$objPersonArray = Person::QueryArray(QQ::Equal(QQN::Person()->ProjectAsTeamMember->Project->ManagerPersonId, 7), QQ::Clause(QQ::Distinct(), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
foreach ($objPersonArray as $objPerson) {
_p($objPerson->FirstName . ' ' . $objPerson->LastName);
_p('<br/>', false);
}
?>
<br/>
<h3>Get All People Who Are on a Project Managed by Karen Wolfe (Person ID #7)<br/>showing the Project which is involved in the JOIN via Expand()</h3>
<i>Notice how some people may be listed twice, once for each project which he or she is part of that is managed by Karen Wolfe.</i><br/><br/>
<?php
$objPersonArray = Person::QueryArray(QQ::Equal(QQN::Person()->ProjectAsTeamMember->Project->ManagerPersonId, 7), QQ::Clause(QQ::Expand(QQN::Person()->ProjectAsTeamMember->Project), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
foreach ($objPersonArray as $objPerson) {
printf('%s %s (via the "%s" project)<br/>', QApplication::HtmlEntities($objPerson->FirstName), QApplication::HtmlEntities($objPerson->LastName), QApplication::HtmlEntities($objPerson->_ProjectAsTeamMember->Name));
示例8: 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));
}
}
}
示例9: Execute
/**
* This will execute the search query object and should in theory
* return a Database Cursor that can be used by Person
* @param QQClause $objOptionalClauses
* @return QDatabaseResultBase Person cursor
*/
public function Execute($objOptionalClauses = null)
{
if (!$this->CountQueryConditions()) {
return array();
}
// Setup the Clauses array
if (!$objOptionalClauses) {
$objOptionalClauses = array(QQ::Distinct());
} else {
$objOptionalClauses[] = QQ::Distinct();
}
// Go through all the Conditions assigned to this SearchQuery
$objQqConditionToUse = QQ::All();
foreach ($this->GetQueryConditionArray() as $objQueryCondition) {
$objQqConditionToAdd = null;
// First, calculate the QqNode to use. Be sure to capture any conditions/clauses required during the QqNode calculation process
$objQqNode = $objQueryCondition->QueryNode->GetQqNode($objQqConditionToAdd, $objOptionalClauses, $objQueryCondition->Value);
// Go Ahead and Calculate the QqCondition to Add into our overall QqCondition to use
$objQqConditionToAdd = $this->CalculateQqCondition($objQueryCondition, $objQqNode, $objQqConditionToAdd);
$objQqConditionToUse = QQ::AndCondition($objQqConditionToUse, $objQqConditionToAdd);
}
// Return an array of Person objects
return Person::QueryCursor($objQqConditionToUse, $objOptionalClauses);
}
示例10: dtrText_Conditions
protected function dtrText_Conditions($blnReset = false)
{
$this->arrConditions = array(QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroContextInfo()->Context->Active, true), QQ::Equal(QQN::NarroContextInfo()->Context->File->Active, true)));
if ($blnReset) {
$this->intMaxRowCount = 0;
}
$this->arrClauses = array(QQ::Expand(QQN::NarroContextInfo()->Context), QQ::Expand(QQN::NarroContextInfo()->Context->Text), QQ::Expand(QQN::NarroContextInfo()->Context->File), QQ::Expand(QQN::NarroContextInfo()->Context->Project), QQ::Expand(QQN::NarroContextInfo()->ValidSuggestion));
if ($this->lstProject->SelectedValue > 0) {
$this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->Context->ProjectId, $this->lstProject->SelectedValue);
}
switch ($this->lstFilter->SelectedValue) {
case self::SHOW_NOT_TRANSLATED:
$this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, false);
break;
case self::SHOW_NOT_APPROVED:
$this->arrConditions[] = QQ::AndCondition(QQ::IsNull(QQN::NarroContextInfo()->ValidSuggestionId), QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, true));
break;
case self::SHOW_APPROVED:
$this->arrConditions[] = QQ::IsNotNull(QQN::NarroContextInfo()->ValidSuggestionId);
break;
case self::SHOW_APPROVED_AND_NOT_APPROVED:
$this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, true);
break;
case self::SHOW_NOT_APPROVED_AND_NOT_TRANSLATED:
$this->arrConditions[] = QQ::IsNull(QQN::NarroContextInfo()->ValidSuggestionId);
break;
case self::SHOW_NOT_APPROVED_AND_WITHOUT_VOTES:
$this->arrConditions[] = QQ::Equal(QQ::SubSql('SELECT COUNT(*) FROM narro_suggestion_vote, narro_suggestion WHERE narro_suggestion_vote.suggestion_id=narro_suggestion.suggestion_id AND narro_suggestion.text_id={1}', QQN::NarroContextInfo()->Context->TextId), 0);
break;
case self::SHOW_NOT_APPROVED_AND_WITH_VOTES:
$this->arrConditions[] = QQ::NotEqual(QQ::SubSql('SELECT COUNT(*) FROM narro_suggestion_vote, narro_suggestion WHERE narro_suggestion_vote.suggestion_id=narro_suggestion.suggestion_id AND narro_suggestion.text_id={1}', QQN::NarroContextInfo()->Context->TextId), 0);
break;
case self::SHOW_IDENTICAL_APPROVED:
$this->arrClauses[] = QQ::ExpandAsArray(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText);
$this->arrClauses[] = QQ::Distinct();
$this->arrConditions[] = QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->Context->Text->TextValueMd5, QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionValueMd5), QQ::Equal(QQN::NarroContextInfo()->ValidSuggestionId, QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionId), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QQN::NarroContextInfo()->LanguageId));
break;
case self::SHOW_IDENTICAL:
$this->arrClauses[] = QQ::ExpandAsArray(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText);
$this->arrClauses[] = QQ::Distinct();
$this->arrConditions[] = QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->Context->Text->TextValueMd5, QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionValueMd5), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QQN::NarroContextInfo()->LanguageId));
break;
case self::SHOW_ALL:
default:
}
if ($this->txtFile->Text != t('all files') && $this->txtFile->Text != '') {
if (preg_match("/^'.+'\$/", $this->txtFile->Text)) {
$this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->Context->File->FilePath, substr($this->txtFile->Text, 1, -1));
} elseif (preg_match('/^".+"$/', $this->txtFile->Text)) {
$this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->Context->File->FilePath, substr($this->txtFile->Text, 1, -1));
} else {
$this->arrConditions[] = QQ::Like(QQN::NarroContextInfo()->Context->File->FilePath, '%' . $this->txtFile->Text . '%');
}
}
if ($this->txtSearch->Text) {
if (preg_match("/^'.+'\$/", $this->txtSearch->Text)) {
$strLikeSearch = substr($this->txtSearch->Text, 1, -1);
} elseif (preg_match('/^".+"$/', $this->txtSearch->Text)) {
$strLikeSearch = substr($this->txtSearch->Text, 1, -1);
} else {
$strLikeSearch = '%' . $this->txtSearch->Text . '%';
}
switch ($this->lstSearchIn->SelectedValue) {
case self::SEARCH_IN_TEXTS:
$this->arrConditions[] = QQ::Like(QQN::NarroContextInfo()->Context->Text->TextValue, $strLikeSearch);
break;
case self::SEARCH_IN_TRANSLATIONS:
$this->arrClauses[] = QQ::ExpandAsArray(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText);
$this->arrConditions[] = QQ::AndCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionValue, $strLikeSearch), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId()));
break;
case self::SEARCH_IN_AUTHORS:
$this->arrClauses[] = QQ::ExpandAsArray(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText);
$this->arrConditions[] = QQ::AndCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->User->RealName, $strLikeSearch), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId()));
break;
case self::SEARCH_IN_CONTEXTS:
$this->arrConditions[] = QQ::OrCondition(QQ::Like(QQN::NarroContextInfo()->Context->Context, $strLikeSearch), QQ::Like(QQN::NarroContextInfo()->Context->Comment, $strLikeSearch));
break;
case self::SEARCH_IN_ALL:
default:
$this->arrClauses[] = QQ::Distinct();
$this->arrConditions[] = QQ::OrCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->TextValue, $strLikeSearch), QQ::AndCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionValue, $strLikeSearch), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId())), QQ::AndCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->User->RealName, $strLikeSearch), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId())), QQ::Like(QQN::NarroContextInfo()->Context->Context, $strLikeSearch), QQ::Like(QQN::NarroContextInfo()->Context->Comment, $strLikeSearch));
}
}
switch ($this->lstSort->SelectedValue) {
case self::SORT_TEXT:
$this->arrClauses[] = QQ::OrderBy(QQN::NarroContextInfo()->Context->Text->TextValue, $this->lstSortDir->SelectedValue);
break;
case self::SORT_TEXT_LENGTH:
$this->arrClauses[] = QQ::OrderBy(QQN::NarroContextInfo()->Context->Text->TextWordCount, $this->lstSortDir->SelectedValue);
break;
case self::SORT_TRANSLATION:
$this->arrClauses[] = QQ::OrderBy(QQN::NarroContextInfo()->ValidSuggestion->SuggestionValue, $this->lstSortDir->SelectedValue);
break;
case self::SORT_TRANSLATION_DATE:
$this->arrClauses[] = QQ::OrderBy(QQN::NarroContextInfo()->Modified, $this->lstSortDir->SelectedValue);
break;
}
}
示例11: dtgPeople_Bind
public function dtgPeople_Bind()
{
$objConditions = QQ::All();
$objClauses = array();
if ($strName = trim($this->txtName->Text)) {
Person::PrepareQqForSearch($strName, $objConditions, $objClauses);
}
if ($strName = trim($this->txtFirstName->Text)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->FirstName, $strName . '%'));
}
if ($strName = trim($this->txtLastName->Text)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->LastName, $strName . '%'));
}
if ($strName = trim($this->txtCity->Text)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->PrimaryCityText, $strName . '%'));
}
if ($strName = trim($this->txtZipcode->Text)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->PrimaryZipCodeText, $strName . '%'));
}
if ($strName = trim($this->txtEmail->Text)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->PrimaryEmail->Address, $strName . '%'));
}
if ($strName = trim($this->txtPhone->Text)) {
$strFormatted = sprintf("%s-%s-%s", substr($strName, 0, 3), substr($strName, 3, 3), substr($strName, 6));
$objClauses[] = QQ::Distinct();
$objConditions = QQ::AndCondition($objConditions, QQ::OrCondition(QQ::Like(QQN::Person()->Phone->Number, $strName . '%'), QQ::Like(QQN::Person()->HouseholdParticipation->Household->Address->Phone->Number, $strName . '%'), QQ::Like(QQN::Person()->Phone->Number, $strFormatted . '%'), QQ::Like(QQN::Person()->HouseholdParticipation->Household->Address->Phone->Number, $strFormatted . '%')));
}
if (!is_null($strValue = $this->lstGender->SelectedValue)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Person()->Gender, $strValue));
}
if (!is_null($strValue = $this->lstMemberStatus->SelectedValue)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Person()->MembershipStatusTypeId, $strValue));
}
$this->dtgPeople->MetaDataBinder($objConditions, $objClauses);
}
示例12: header
// Disable strict no-cache for IE due to IE issues with downloading no-cache items
if (QApplication::IsBrowser(QBrowserType::InternetExplorer)) {
header("Pragma:");
header("Expires:");
}
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename=growthgroupreport.csv');
function EscapeCsv($strString)
{
return '"' . str_replace('"', '""', $strString) . '"';
}
print "Growth Group,First Name,Last Name,E-mail,Phone,Address,City,State,Zip Code\r\n";
foreach ($groupArray as $objGroup) {
// If it's a growth group then display the details
if ($objGroup->Type != GroupType::$NameArray[GroupType::GroupCategory]) {
$objPersonCursor = Person::QueryCursor(QQ::AndCondition(QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $objGroup->Id), QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd)), QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName), QQ::Distinct()));
$intGroupCount++;
while ($objPerson = Person::InstantiateCursor($objPersonCursor)) {
print EscapeCsv($objGroup->Name);
print ",";
print EscapeCsv($objPerson->FirstName);
print ",";
print EscapeCsv($objPerson->LastName);
print ",";
if ($objPerson->PrimaryEmail) {
print EscapeCsv($objPerson->PrimaryEmail->Address);
}
print ",";
print EscapeCsv($objPerson->PrimaryPhoneText);
print ",";
print EscapeCsv($objPerson->PrimaryAddressText);
示例13: CalculatePotentialSenderArray
/**
* Given a valid From EmailAddress, this will lookup and return a "Sender" array, a 3-item array containing:
* Login
* CommunicationListEntry
* Person[]
* that would correspond to this From EmailAddress. Note that any one of those indexes can also be null
* if there is no object corresponding to this From Email Address.
* @return mixed[]
*/
protected function CalculatePotentialSenderArray()
{
$objArrayToReturn = array();
$objArrayToReturn[] = Login::LoadByEmail($this->FromAddress);
$objArrayToReturn[] = CommunicationListEntry::LoadByEmail($this->FromAddress);
// Get all Person objects that have this as an email address
$objArrayToReturn[] = Person::QueryArray(QQ::Equal(QQN::Person()->Email->Address, $this->FromAddress), QQ::Distinct());
return $objArrayToReturn;
}
示例14: dtgMembers_Bind
public function dtgMembers_Bind()
{
if ($this->chkViewAll->Checked) {
$objCondition = QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $this->objGroup->Id);
} else {
$objCondition = QQ::AndCondition(QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $this->objGroup->Id), QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd));
}
$this->dtgMembers->TotalItemCount = Person::QueryCount($objCondition);
$objClauses = array(QQ::Distinct());
if ($objClause = $this->dtgMembers->LimitClause) {
$objClauses[] = $objClause;
}
if ($objClause = $this->dtgMembers->OrderByClause) {
$objClauses[] = $objClause;
}
$this->dtgMembers->DataSource = Person::QueryArray($objCondition, $objClauses);
}
示例15: foreach
QApplication::$Database[1]->EnableProfiling();
$objPersonArray = Person::LoadAll(QQ::Select(QQN::Person()->FirstName));
foreach ($objPersonArray as $objPerson) {
printf('<li>%s %s</li>', QApplication::HtmlEntities($objPerson->Id), QApplication::HtmlEntities($objPerson->FirstName));
assert(is_null($objPerson->LastName));
}
?>
</ul>
<h2>2. Get all the distinct <em>first names</em> of all the people</h2>
<ul>
<?php
QApplication::$Database[1]->EnableProfiling();
$objSelect = QQ::Select(QQN::Person()->FirstName);
$objSelect->SetSkipPrimaryKey(true);
$objPersonArray = Person::LoadAll(QQ::Clause($objSelect, QQ::Distinct()));
foreach ($objPersonArray as $objPerson) {
printf('<li>%s</li>', QApplication::HtmlEntities($objPerson->FirstName));
assert(is_null($objPerson->Id));
assert(is_null($objPerson->LastName));
}
?>
</ul>
<h2>3. Get the last names of all the people, and the amount spent on the project they manage (if any), for Projects that
have 'ACME' or 'HR' in it. Sort the result by Last Name, then First Name</h2>
<p><i>Notice how some people may be listed twice, if they manage more than one project.</i></p>
<ul>
<?php
$objPersonArray = Person::QueryArray(QQ::OrCondition(QQ::Like(QQN::Person()->ProjectAsManager->Name, '%ACME%'), QQ::Like(QQN::Person()->ProjectAsManager->Name, '%HR%')), QQ::Clause(QQ::Select(QQN::Person()->LastName), QQ::Expand(QQN::Person()->ProjectAsManager, null, QQ::Select(QQN::Person()->ProjectAsManager->Spent)), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
foreach ($objPersonArray as $objPerson) {