public static Like ( QQNode $objQueryNode, $strValue ) | ||
$objQueryNode | QQNode |
public function dtgWikiItems_Bind() { $objCondition = QQ::All(); if (trim($this->txtTitle->Text)) { $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::WikiItem()->CurrentName, '%' . trim($this->txtTitle->Text) . '%')); } if ($strPath = trim($this->txtPath->Text)) { $strPath = WikiItem::SanitizeForPath($strPath, $intWikiItemTypeId); $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::WikiItem()->Path, $strPath . '%')); } if ($intValue = $this->lstWikiItemType->SelectedValue) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::WikiItem()->WikiItemTypeId, $intValue)); } if (trim($this->txtPostedBy->Text)) { $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::WikiItem()->CurrentPostedByPerson->DisplayName, trim($this->txtPostedBy->Text) . '%')); } $this->dtgWikiItems->TotalItemCount = WikiItem::QueryCount($objCondition); $objClauses = array(); if ($objClause = $this->dtgWikiItems->LimitClause) { $objClauses[] = $objClause; } if ($objClause = $this->dtgWikiItems->OrderByClause) { $objClauses[] = $objClause; } $this->dtgWikiItems->DataSource = WikiItem::QueryArray($objCondition, $objClauses); }
public function txtSearch_KeyUp() { if (strlen($this->txtSearch->Text) < 2 || preg_match("/^'.*'\$/", $this->txtSearch->Text) || preg_match('/^".*"$/', $this->txtSearch->Text)) { $this->dtgSuggestion->AdditionalConditions = QQ::AndCondition(QQ::Equal(QQN::NarroSuggestion()->LanguageId, $this->lstLanguage->SelectedValue), QQ::Like(QQN::NarroSuggestion()->Text->TextValue, substr($this->txtSearch->Text, 1, -1))); } else { $this->dtgSuggestion->AdditionalConditions = QQ::AndCondition(QQ::Equal(QQN::NarroSuggestion()->LanguageId, $this->lstLanguage->SelectedValue), QQ::Like(QQN::NarroSuggestion()->Text->TextValue, '%' . $this->txtSearch->Text . '%')); } $this->dtgSuggestion->Refresh(); }
public function testSelectSubsetInExpand() { $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) { $this->assertNull($objPerson->FirstName, "FirstName should be null, since it was not selected"); $this->assertNotNull($objPerson->Id, "Id should not be null since it's always added to the select list"); $this->assertNotNull($objPerson->_ProjectAsManager->Id, "ProjectAsManager->Id should not be null since id's are always added to the select list"); $this->assertNull($objPerson->_ProjectAsManager->Name, "ProjectAsManager->Name should be null since it was not selected"); } }
public function auto_Bind($strFormId, $strControlId, $term) { $cond = QQ::OrCondition(QQ::Like(QQN::Person()->FirstName, '%' . $term . '%'), QQ::Like(QQN::Person()->LastName, '%' . $term . '%')); $a = Person::QueryArray($cond); $items = array(); foreach ($a as $obj) { $items[] = new QListItem($obj->FirstName . ' ' . $obj->LastName, $obj->Id); } $this->auto2->DataSource = $items; }
protected function BindData() { if ($strFilter = $this->dtgTable->Search["search"]) { $objCondition = QQ::OrCondition(QQ::Like(QQN::Person()->FirstName, '%' . $strFilter . '%'), QQ::Like(QQN::Person()->LastName, '%' . $strFilter . '%')); } else { $objCondition = QQ::All(); } $this->dtgTable->TotalItemCount = Person::QueryCount($objCondition); $objClauses[] = $this->dtgTable->OrderByClause; $objClauses[] = $this->dtgTable->LimitClause; $this->dtgTable->DataSource = Person::QueryArray($objCondition, $objClauses); }
protected function GetAssetLog() { $objClauses = array(); array_push($objClauses, QQ::OrderBy(QQN::Assetsauditlog()->RealReturnDate)); if ($this->txtSearchTerm->Text == "") { $condition = QQ::Equal(QQN::Assetsauditlog()->Owner, $_SESSION['User']); $myassets = Assetsauditlog::QueryArray($condition, $objClauses); } else { $objCondition = QQ::AndCondition(QQ::OrCondition(QQ::Like(QQN::Assetsauditlog()->Asin, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Assetsauditlog()->Email, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Assetsauditlog()->Title, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Assetsauditlog()->FullName, '%' . $this->txtSearchTerm->Text . '%')), QQ::Equal(QQN::Assetsauditlog()->Owner, $_SESSION['User'])); $objDbResult = Assetsauditlog::QueryArray($objCondition, $objClauses); $myassets = $objDbResult; } return $myassets; }
protected function dtgBatches_Bind() { $objCondition = QQ::All(); if (strlen($strText = trim($this->txtDescription->Text))) { $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::StewardshipBatch()->Description, $strText . '%')); } if ($this->lstCreatedBy->SelectedValue) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipBatch()->CreatedByLoginId, $this->lstCreatedBy->SelectedValue)); } if ($this->lstStatus->SelectedValue) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipBatch()->StewardshipBatchStatusTypeId, $this->lstStatus->SelectedValue)); } $this->dtgBatches->MetaDataBinder($objCondition); }
protected function Form_Create() { // Define the DataGrid $this->dtgPersons = new QDataGrid($this); $this->dtgPersons->ShowFilter = true; // To create pagination, we will create a new paginator, and specify the datagrid // as the paginator's parent. (We do this because the datagrid is the control // who is responsible for rendering the paginator, as opposed to the form.) $objPaginator = new QPaginator($this->dtgPersons); $this->dtgPersons->Paginator = $objPaginator; // Now, with a paginator defined, we can set up some additional properties on // the datagrid. For purposes of this example, let's make the datagrid show // only 5 items per page. $this->dtgPersons->ItemsPerPage = 20; // Define Columns $idCol = new QDataGridColumn('Person ID', '<?= $_ITEM->Id ?>', 'Width=100', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Id), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Id, false))); $idCol->Filter = QQ::Equal(QQN::Person()->Id, null); $idCol->FilterType = QFilterType::TextFilter; $idCol->FilterBoxSize = 3; //note that due to the CSS applied to the examples, this doesn't do anything $this->dtgPersons->AddColumn($idCol); $fNameCol = new QDataGridColumn('First Name', '<?= $_ITEM->FirstName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->FirstName, false))); $fNameCol->Filter = QQ::Like(QQN::Person()->FirstName, null); $fNameCol->FilterPrefix = $fNameCol->FilterPostfix = '%'; $fNameCol->FilterType = QFilterType::TextFilter; $this->dtgPersons->AddColumn($fNameCol); $lNameCol = new QDataGridColumn('Last Name', '<?= $_ITEM->LastName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->LastName, false))); QQN::Person()->LastName->SetFilteredDataGridColumnFilter($lNameCol); $this->dtgPersons->AddColumn($lNameCol); // Let's default the sorting to the last name column (column #2) $this->dtgPersons->SortColumnIndex = 2; // Specify the Datagrid's Data Binder method $this->dtgPersons->SetDataBinder('dtgPersons_Bind'); // Make the DataGrid look nice $objStyle = $this->dtgPersons->RowStyle; $objStyle->FontSize = 12; $objStyle = $this->dtgPersons->AlternateRowStyle; $objStyle->BackColor = '#f6f6f6'; $objStyle = $this->dtgPersons->HeaderRowStyle; $objStyle->ForeColor = 'white'; $objStyle->BackColor = '#780000'; // Because browsers will apply different styles/colors for LINKs // We must explicitly define the ForeColor for the HeaderLink. // The header row turns into links when the column can be sorted. $objStyle = $this->dtgPersons->HeaderLinkStyle; $objStyle->ForeColor = 'white'; }
protected function getList($strTerm = null, $blnHtml = false) { if ($strTerm) { $cond = QQ::OrCondition(QQ::Like(QQN::Person()->FirstName, '%' . $strTerm . '%'), QQ::Like(QQN::Person()->LastName, '%' . $strTerm . '%')); } else { $cond = QQ::All(); } $clauses[] = QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName); $lst = Person::QueryArray($cond, $clauses); $a = array(); foreach ($lst as $objPerson) { $item = new QListItem($objPerson->FirstName . ' ' . $objPerson->LastName, $objPerson->Id); if ($blnHtml) { $item->Label = '<em>' . $objPerson->FirstName . ' ' . $objPerson->LastName . '</em>'; } $a[] = $item; } return $a; }
protected function GetShareDetails() { $objClauses = array(); array_push($objClauses, QQ::OrderBy(QQN::Sharedetails()->ReturnDate)); if ($objClause = $this->dtrShareDetails->LimitClause) { array_push($objClauses, $this->dtrShareDetails->LimitClause); } if ($this->txtSearchTerm->Text == "") { $objCondition = QQ::Equal(QQN::Sharedetails()->Owner, $_SESSION['User']); $myassets = Sharedetails::QueryArray($objCondition, $objClauses); } else { $objCondition = QQ::AndCondition(QQ::OrCondition(QQ::Like(QQN::Sharedetails()->Asin, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->Email, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->TakenDate, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->ReturnDate, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->Title, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->FullName, '%' . $this->txtSearchTerm->Text . '%')), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User'])); $objDbResult = Sharedetails::QueryArray($objCondition, $objClauses); $myassets = $objDbResult; } //$this->dtrShareDetails->TotalItemCount = Sharedetails::QueryCount($condition); $this->arrShareDetails = $myassets; return $objCondition; }
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); }
public function dtgPosts_Bind() { $objCondition = QQ::All(); if ($intId = $this->lstCategory->SelectedValue) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::ClassifiedPost()->ClassifiedCategoryId, $intId)); } if (!is_null($blnValue = $this->lstApproval->SelectedValue)) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::ClassifiedPost()->ApprovalFlag, $blnValue)); } if (!is_null($blnValue = $this->lstExpiration->SelectedValue)) { $objCondition = QQ::AndCondition($objCondition, $blnValue ? QQ::LessThan(QQN::ClassifiedPost()->DateExpired, QDateTime::Now()) : QQ::GreaterOrEqual(QQN::ClassifiedPost()->DateExpired, QDateTime::Now())); } if (strlen($strText = trim($this->txtTitle->Text))) { $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::ClassifiedPost()->Title, '%' . $strText . '%')); } if (strlen($strText = trim($this->txtName->Text))) { $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::ClassifiedPost()->Name, '%' . $strText . '%')); } $this->dtgPosts->MetaDataBinder($objCondition); }
<h2>Select all People where: the first name is alphabetically "greater than" the last name</h2> <ul> <?php $objPersonArray = Person::QueryArray(QQ::GreaterThan(QQN::Person()->FirstName, QQN::Person()->LastName)); foreach ($objPersonArray as $objPerson) { _p('<li>' . $objPerson->FirstName . ' ' . $objPerson->LastName . '</li>', false); } ?> </ul> <h2>Select all Projects where: the manager's first name is alphabetically "greater than" the last name, or who's name contains "Website"</h2> <ul> <?php $objProjectArray = Project::QueryArray(QQ::OrCondition(QQ::GreaterThan(QQN::Project()->ManagerPerson->FirstName, QQN::Project()->ManagerPerson->LastName), QQ::Like(QQN::Project()->Name, '%Website%'))); foreach ($objProjectArray as $objProject) { _p(sprintf('<li>%s (managed by %s %s)</li>', $objProject->Name, $objProject->ManagerPerson->FirstName, $objProject->ManagerPerson->LastName), false); } ?> </ul> <h2>Select all Projects where: the Project ID <= 2 AND (the manager's first name is alphabetically "greater than" the last name, or who's name contains "Website")</h2> <ul> <?php $objProjectArray = Project::QueryArray(QQ::AndCondition(QQ::OrCondition(QQ::GreaterThan(QQN::Project()->ManagerPerson->FirstName, QQN::Project()->ManagerPerson->LastName), QQ::Like(QQN::Project()->Name, '%Website%')), QQ::LessOrEqual(QQN::Project()->Id, 2))); foreach ($objProjectArray as $objProject) { _p(sprintf('<li>%s (managed by %s %s)</li>', $objProject->Name, $objProject->ManagerPerson->FirstName, $objProject->ManagerPerson->LastName), false); } ?> </ul> </div> <?php require '../includes/footer.inc.php';
<?php require_once 'prepend.inc.php'; if (!array_key_exists('q', $_GET)) { die(""); } $strQuery = $_GET['q'] . '%'; $arrAppTemplateTags = AppTemplateTag::QueryArray(QQ::AndCondition(QQ::Like(QQN::AppTemplateTag()->Tag, $strQuery), QQ::Equal(QQN::AppTemplateTag()->Hidden, 0), QQ::Equal(QQN::AppTemplateTag()->Reserved, 0))); //Render foreach ($arrAppTemplateTags as $intIndex => $objAppTemplateTag) { echo $objAppTemplateTag->Tag . "\n"; }
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 dtgUser_Bind() { if ($this->txtSearch->Text != '') { $objSearchCondition = QQ::OrCondition(QQ::Like(QQN::NarroUser()->RealName, sprintf('%%%s%%', $this->txtSearch->Text)), QQ::Like(QQN::NarroUser()->Username, sprintf('%%%s%%', $this->txtSearch->Text)), QQ::Like(QQN::NarroUser()->Email, sprintf('%%%s%%', $this->txtSearch->Text))); } else { $objSearchCondition = QQ::All(); } // Because we want to enable pagination AND sorting, we need to setup the $objClauses array to send to LoadAll() // Remember! We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below $this->dtgUser->TotalItemCount = NarroUser::QueryCount($objSearchCondition); // Setup the $objClauses Array $objClauses = array(); // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add // the OrderByClause to the $objClauses array if ($objClause = $this->dtgUser->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->dtgUser->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be the array of all NarroUser objects, given the clauses above $this->dtgUser->DataSource = NarroUser::QueryArray($objSearchCondition, $objClauses); QApplication::ExecuteJavaScript('highlight_datagrid();'); }
private function GetAssetsData($productgroup) { $objClauses = array(); array_push($objClauses, QQ::OrderBy(QQN::Myassets()->Title)); if ($objClause = $this->dtrMyLibrary->LimitClause) { array_push($objClauses, $this->dtrMyLibrary->LimitClause); } if ($this->txtSearchTerm->Text == "") { $condition = QQ::AndCondition(QQ::Equal(QQN::Myassets()->ProductGroup, $productgroup), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User'])); $arrResult = Myassets::QueryArray($condition, $objClauses); $this->dtrMyLibrary->TotalItemCount = Myassets::QueryCount($condition); $this->dtrMyLibrary->DataSource = $arrResult; } else { $objCondition = QQ::AndCondition(QQ::OrCondition(QQ::Like(QQN::Myassets()->Title, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Author, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Artist, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Actor, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Director, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Publisher, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Label, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Isbn, '%' . $this->txtSearchTerm->Text . '%')), QQ::Equal(QQN::Myassets()->ProductGroup, $productgroup), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User'])); $objDbResult = Myassets::QueryArray($objCondition, $objClauses); $myassets = $objDbResult; $this->dtrMyLibrary->TotalItemCount = Myassets::QueryCount($objCondition); if ($this->dtrMyLibrary->TotalItemCount > 0) { $this->dtrMyLibrary->DataSource = $myassets; } else { QApplicationBase::DisplayAlert('No ' . $productgroup . 's exists for the searched term'); } } }
protected function update_autocompleteList($strFormId, $strControlId, $strParameter) { $strLookup = $strParameter; $objControl = $this->GetControl($strControlId); $cond = QQ::OrCondition(QQ::Like(QQN::Person()->FirstName, '%' . $strLookup . '%'), QQ::Like(QQN::Person()->LastName, '%' . $strLookup . '%')); $clauses[] = QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName); $lst = Person::QueryArray($cond, $clauses); /* * If you implement Person::__toString in the model->Person.class.php file, you * could just pass the $lst to the DataSource. If you want to add a 'label' item * to the display, you can override toJsObject in the People.class.php file. * * For puposes of this example, we will build a custom list using list items below. * */ //$this->AjaxAutocomplete->DataSource = $lst; $a = array(); foreach ($lst as $objPerson) { $item = new QListItem($objPerson->FirstName . ' ' . $objPerson->LastName, $objPerson->Id); if ($objControl->DisplayHtml) { $item->Label = '<em>' . $objPerson->FirstName . ' ' . $objPerson->LastName . '</em>'; } $a[] = $item; } $objControl->DataSource = $a; }
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); }
protected function update_autocompleteList() { $strTyped = $this->AjaxAutocomplete->Text; $cond = QQ::OrCondition(QQ::Like(QQN::Person()->FirstName, '%' . $strTyped . '%'), QQ::Like(QQN::Person()->LastName, '%' . $strTyped . '%')); $clauses[] = QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName); $lst = Person::QueryArray($cond, $clauses); // If you implement Person::__toString in the model->Person.class.php file, you // could just pass the $lst to the DataSource. // Instead, we will build the list using autcomplete list items //$this->AjaxAutocomplete->DataSource = $lst; $a = array(); foreach ($lst as $objPerson) { $a[] = new QListItem($objPerson->FirstName . ' ' . $objPerson->LastName, $objPerson->Id); } $this->AjaxAutocomplete->DataSource = $a; }
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; } }
public function dtgProjectList_Bind() { if ($this->txtSearch->Text != '') { $arrConditions[] = QQ::Like(QQN::NarroProject()->ProjectName, sprintf('%%%s%%', $this->txtSearch->Text)); } else { $arrConditions[] = QQ::All(); } if (QApplication::HasPermissionForThisLang('Can manage project')) { $arrConditions[] = QQ::All(); } else { $arrConditions[] = QQ::AndCondition(QQ::Equal(QQN::NarroProject()->NarroProjectProgressAsProject->Active, 1), QQ::Equal(QQN::NarroProject()->Active, 1)); } // Setup the $objClauses Array $objClauses = array(QQ::Expand(QQN::NarroProject()->NarroProjectProgressAsProject, QQ::Equal(QQN::NarroProject()->NarroProjectProgressAsProject->LanguageId, QApplication::GetLanguageId()))); // Remember! We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below $this->dtgProjectList->TotalItemCount = NarroProject::QueryCount(QQ::AndCondition($arrConditions), $objClauses); // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add // the OrderByClause to the $objClauses array if ($objClause = $this->dtgProjectList->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->dtgProjectList->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be the array of all NarroProjectProgress objects, given the clauses above $this->dtgProjectList->DataSource = NarroProject::QueryArray(QQ::AndCondition($arrConditions), $objClauses); }
protected function GetPeopleData() { $objClauses = array(); array_push($objClauses, QQ::OrderBy(QQN::Peopledetails()->FullName)); if ($objClause = $this->dtrPeople->LimitClause) { array_push($objClauses, $this->dtrPeople->LimitClause); } if ($this->txtSearchPeople->Text != '') { $condition = QQ::OrCondition(QQ::Like(QQN::Peopledetails()->FullName, '%' . $this->txtSearchPeople->Text . '%'), QQ::Like(QQN::Peopledetails()->Email, '%' . $this->txtSearchPeople->Text . '%'), QQ::Like(QQN::Peopledetails()->Phone, '%' . $this->txtSearchPeople->Text . '%')); $result = Peopledetails::QueryArray($condition, $objClause); $this->dtrPeople->DataSource = $result; $this->dtrPeople->TotalItemCount = Peopledetails::QueryCount($condition); } else { $result = Peopledetails::QueryArray(QQ::All(), $objClause); $this->dtrPeople->DataSource = $result; $this->dtrPeople->TotalItemCount = Peopledetails::QueryCount(QQ::All()); } }
public function dtgLanguage_Bind() { if ($this->txtSearch->Text != '') { $objSearchCondition = QQ::Like(QQN::NarroLanguage()->LanguageName, sprintf('%%%s%%', $this->txtSearch->Text)); } else { $objSearchCondition = QQ::All(); } switch ($this->lstFilter->SelectedValue) { /** * Only active */ case 1: $objFilterCondition = QQ::AndCondition($objSearchCondition, QQ::Equal(QQN::NarroLanguage()->Active, 1)); break; /** * 0 - show all */ /** * 0 - show all */ default: $objFilterCondition = $objSearchCondition; } // Because we want to enable pagination AND sorting, we need to setup the $objClauses array to send to LoadAll() // Remember! We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below $this->dtgLanguage->TotalItemCount = NarroLanguage::QueryCount($objFilterCondition); // Setup the $objClauses Array $objClauses = array(QQ::Expand(QQ::Virtual('last_translation', QQ::SubSql('SELECT MAX(created) FROM narro_suggestion WHERE language_id={1}', QQN::NarroLanguage()->LanguageId))), QQ::Count(QQN::NarroLanguage()->NarroSuggestionAsLanguage->SuggestionId, 'translations_count'), QQ::GroupBy(QQN::NarroLanguage()->LanguageId)); // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add // the OrderByClause to the $objClauses array if ($objClause = $this->dtgLanguage->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->dtgLanguage->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be the array of all NarroLanguage objects, given the clauses above $this->dtgLanguage->DataSource = NarroLanguage::QueryArray($objFilterCondition, $objClauses); QApplication::ExecuteJavaScript('highlight_datagrid();'); }
public function dtgPerson_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 . '%')); } $this->dtgPerson->MetaDataBinder($objConditions, $objClauses); }
<div id="demoZone"> <h2>Get All People, Specifying the Project They Manage (if any), for Projects that have 'ACME' or 'HR' in it</h2> <p><em>Notice how some people may be listed twice, if they manage more than one project.</em></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::Expand(QQN::Person()->ProjectAsManager), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName))); foreach ($objPersonArray as $objPerson) { printf('<li>%s %s (managing the "%s" project)</li>', QApplication::HtmlEntities($objPerson->FirstName), QApplication::HtmlEntities($objPerson->LastName), QApplication::HtmlEntities($objPerson->_ProjectAsManager->Name), false); } ?> </ul> <h3>Same as above, but this time, use ExpandAsArray()</h3> <em>Notice how each person is only listed once... but each person has an internal/virtual <strong>_ProjectAsManagerArray</strong> which may list more than one project.</em></p> <?php $objPersonArray = Person::QueryArray(QQ::OrCondition(QQ::Like(QQN::Person()->ProjectAsManager->Name, '%ACME%'), QQ::Like(QQN::Person()->ProjectAsManager->Name, '%HR%')), QQ::Clause(QQ::ExpandAsArray(QQN::Person()->ProjectAsManager), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName))); foreach ($objPersonArray as $objPerson) { _p('<li>' . $objPerson->FirstName . ' ' . $objPerson->LastName, false); // Now, instead of using the _ProjectAsManager virtual attribute, we will use // the _ProjectAsManagerArray virtual attribute, which gives us an array of Project objects $strProjectNameArray = array(); foreach ($objPerson->_ProjectAsManagerArray as $objProject) { array_push($strProjectNameArray, QApplication::HtmlEntities($objProject->Name)); } printf(' via: %s</li>', implode(', ', $strProjectNameArray)); } ?> </div> <?php require '../includes/footer.inc.php';
public static function CountForMemberSearch($strDisplayName) { return Person::QueryCount(QQ::Like(QQN::Person()->DisplayName, '%' . $strDisplayName . '%')); }
public function dtgUserAccount_Bind() { $objClauses = array(); if ($objClause = $this->dtgUserAccount->OrderByClause) { array_push($objClauses, $objClause); } $objClause = QQ::Expand(QQN::UserAccount()->CreatedByObject); array_push($objClauses, $objClause); $objClause = QQ::Expand(QQN::UserAccount()->Role); array_push($objClauses, $objClause); $this->strUsername = $this->txtUsername->Text; if ($this->strUsername) { $this->dtgUserAccount->TotalItemCount = UserAccount::QueryCount(QQ::Like(QQN::UserAccount()->Username, '%' . $this->strUsername . '%'), $objClauses); if ($this->dtgUserAccount->TotalItemCount > 0) { $this->dtgUserAccount->ShowHeader = true; // Add the LimitClause information, as well if ($objClause = $this->dtgUserAccount->LimitClause) { array_push($objClauses, $objClause); } $this->dtgUserAccount->DataSource = UserAccount::QueryArray(QQ::Like(QQN::UserAccount()->Username, '%' . $this->strUsername . '%'), $objClauses); } else { $this->dtgUserAccount->ShowHeader = false; } } else { // Get Total Count b/c of Pagination $this->dtgUserAccount->TotalItemCount = UserAccount::CountAll(); if ($this->dtgUserAccount->TotalItemCount == 0) { $this->dtgUserAccount->ShowHeader = false; } else { if ($objClause = $this->dtgUserAccount->LimitClause) { array_push($objClauses, $objClause); } $this->dtgUserAccount->DataSource = UserAccount::LoadAll($objClauses); $this->dtgUserAccount->ShowHeader = true; } } }
public static function _(QQNode $objQueryNode, $strSymbol, $mixValue, $mixValueTwo = null) { try { switch (strtolower(trim($strSymbol))) { case '=': return QQ::Equal($objQueryNode, $mixValue); case '!=': return QQ::NotEqual($objQueryNode, $mixValue); case '>': return QQ::GreaterThan($objQueryNode, $mixValue); case '<': return QQ::LessThan($objQueryNode, $mixValue); case '>=': return QQ::GreaterOrEqual($objQueryNode, $mixValue); case '<=': return QQ::LessOrEqual($objQueryNode, $mixValue); case 'in': return QQ::In($objQueryNode, $mixValue); case 'not in': return QQ::NotIn($objQueryNode, $mixValue); case 'like': return QQ::Like($objQueryNode, $mixValue); case 'not like': return QQ::NotLike($objQueryNode, $mixValue); case 'is null': return QQ::IsNull($objQueryNode, $mixValue); case 'is not null': return QQ::IsNotNull($objQueryNode, $mixValue); case 'between': return QQ::Between($objQueryNode, $mixValue, $mixValueTwo); case 'not between': return QQ::NotBetween($objQueryNode, $mixValue, $mixValueTwo); default: throw new QCallerException('Unknown Query Comparison Operation: ' . $strSymbol, 0); } } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
protected function GetFilterConditions() { // Exclude inventory locations with zero qty $arrConditions = array(QQ::NotEqual(QQN::InventoryLocation()->Quantity, 0)); // Inventory Model if (strlen($this->txtInventoryModel->Text) > 0) { array_push($arrConditions, QQ::Like(QQN::InventoryLocation()->InventoryModel->ShortDescription, '%' . $this->txtInventoryModel->Text . '%')); } // Inventory Code if (strlen($this->txtInventoryCode->Text) > 0) { array_push($arrConditions, QQ::Like(QQN::InventoryLocation()->InventoryModel->InventoryModelCode, '%' . $this->txtInventoryCode->Text . '%')); } // Category if ($this->lstCategory->SelectedValue) { array_push($arrConditions, QQ::Equal(QQN::InventoryLocation()->InventoryModel->CategoryId, $this->lstCategory->SelectedValue)); } // Manufacturer if ($this->lstManufacturer->SelectedValue) { array_push($arrConditions, QQ::Equal(QQN::InventoryLocation()->InventoryModel->ManufacturerId, $this->lstManufacturer->SelectedValue)); } // Location if (strlen($this->txtLocation->Text) > 0) { array_push($arrConditions, QQ::Like(QQN::InventoryLocation()->Location->ShortDescription, sprintf($this->lstLocationFilterTypes->SelectedValue, $this->txtLocation->Text))); } return $arrConditions; }