protected function dtgPersons_Bind() { // We must first let the datagrid know how many total items there are $this->dtgPersons->TotalItemCount = Person::QueryCount($this->dtgPersons->Conditions); // Next, we must be sure to load the data source, passing in the datagrid's // limit info into our loadall method. $this->dtgPersons->DataSource = Person::QueryArray($this->dtgPersons->Conditions, QQ::Clause($this->dtgPersons->OrderByClause, $this->dtgPersons->LimitClause)); }
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); }
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); }
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 RenderCount($objGroup) { // Count differently if it's a group Category or Growth Group if ($objGroup->Type == GroupType::$NameArray[GroupType::GroupCategory]) { // Setup Group Array $objGroupArray = $objGroup->GetThisAndChildren(); $intGroupIdArray = array(); foreach ($objGroupArray as $objGroup) { $intGroupIdArray[] = $objGroup->Id; } $objCondition = QQ::In(QQN::Person()->GroupParticipation->GroupId, $intGroupIdArray); $objCondition = QQ::AndCondition($objCondition, QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd)); $strReturn = Person::QueryCount($objCondition); return "<b>" . $strReturn . "</b>"; } else { $objCondition = QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $objGroup->Id); $objCondition = QQ::AndCondition($objCondition, QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd)); return Person::QueryCount($objCondition); } }
/** * Checks to see if an association exists with a specific NameItem * @param NameItem $objNameItem * @return bool */ public function IsNameItemAssociated(NameItem $objNameItem) { if (is_null($this->intId)) { throw new QUndefinedPrimaryKeyException('Unable to call IsNameItemAssociated on this unsaved Person.'); } if (is_null($objNameItem->Id)) { throw new QUndefinedPrimaryKeyException('Unable to call IsNameItemAssociated on this Person with an unsaved NameItem.'); } $intRowCount = Person::QueryCount(QQ::AndCondition(QQ::Equal(QQN::Person()->Id, $this->intId), QQ::Equal(QQN::Person()->NameItem->NameItemId, $objNameItem->Id))); return $intRowCount > 0; }
// Notice that QuerySingle returned just a single Person object _p($objPerson->FirstName . ' ' . $objPerson->LastName); _p('<br/>', false); ?> <h3>QueryArray Example</h3> <?php $objPersonArray = Person::QueryArray(QQ::In(QQN::Person()->Id, array(5, 6, 8))); // Notice that QueryArray returns an array of Person objects... this will // be true even if the result set only yields 1 row.= foreach ($objPersonArray as $objPerson) { _p($objPerson->FirstName . ' ' . $objPerson->LastName); _p('<br/>', false); } ?> <h3>QueryCount Example</h3> <?php $intCount = Person::QueryCount(QQ::In(QQN::Person()->Id, array(5, 6, 8))); // Notice that QueryCount returns an integer _p($intCount . ' rows.'); ?> <?php require __INCLUDES__ . '/examples/footer.inc.php';
/** * Checks to see if an association exists with a specific TopicAsRead * @param Topic $objTopic * @return bool */ public function IsTopicAsReadAssociated(Topic $objTopic) { if (is_null($this->intId)) { throw new QUndefinedPrimaryKeyException('Unable to call IsTopicAsReadAssociated on this unsaved Person.'); } if (is_null($objTopic->Id)) { throw new QUndefinedPrimaryKeyException('Unable to call IsTopicAsReadAssociated on this Person with an unsaved Topic.'); } $intRowCount = Person::QueryCount(QQ::AndCondition(QQ::Equal(QQN::Person()->Id, $this->intId), QQ::Equal(QQN::Person()->TopicAsRead->TopicId, $objTopic->Id))); return $intRowCount > 0; }
public static function CountForMemberSearch($strDisplayName) { return Person::QueryCount(QQ::Like(QQN::Person()->DisplayName, '%' . $strDisplayName . '%')); }
/** * Main utility method to aid with data binding. It is used by the default BindAllRows() databinder but * could and should be used by any custom databind methods that would be used for instances of this * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. * * If a paginator is set on this DataBinder, it will use it. If not, then no pagination will be used. * It will also perform any sorting (if applicable). * * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query * @return void */ public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null) { // Setup input parameters to default values if none passed in if (!$objCondition) { $objCondition = QQ::All(); } $objClauses = $objOptionalClauses ? $objOptionalClauses : array(); // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below if ($this->Paginator) { $this->TotalItemCount = Person::QueryCount($objCondition, $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->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be a Query result from Person, given the clauses above $this->DataSource = Person::QueryArray($objCondition, $objClauses); }
/** * Count People * by CountryId Index(es) * @param integer $intCountryId * @return int */ public static function CountByCountryId($intCountryId) { // Call Person::QueryCount to perform the CountByCountryId query return Person::QueryCount(QQ::Equal(QQN::Person()->CountryId, $intCountryId)); }
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); }