本文整理汇总了PHP中Person::CountAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::CountAll方法的具体用法?PHP Person::CountAll怎么用?PHP Person::CountAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::CountAll方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Run
/**
* Main DataGen Runner
* @return void
*/
public static function Run()
{
// Run "Fake Data" SQL Script
$strFakeDataSql = file_get_contents(__DOCROOT__ . '/../database/fake_data.sql');
foreach (explode("\n", $strFakeDataSql) as $strSql) {
$strSql = trim($strSql);
if (strlen($strSql) && substr($strSql, 0, 1) != '#') {
Person::GetDatabase()->NonQuery($strSql);
}
}
self::$SystemStartDate = new QDateTime('1990-01-01');
self::$LifeStartDate = new QDateTime('1930-01-01');
self::$OldestChildBirthDate = QDateTime::Now(false);
self::$OldestChildBirthDate->Year -= 18;
// Get Cached Data
self::$CommentCategoryArray = CommentCategory::LoadAll();
// Erase Directories
exec('rm -r -f ' . __DOCROOT__ . '/../file_assets/head_shots');
exec('rm -r -f ' . __DOCROOT__ . '/../file_assets/contribution_images');
// Generate Stuff
ChmsDataGen::GenerateMinistries();
ChmsDataGen::GenerateUsers();
ChmsDataGen::GenerateHouseholds();
ChmsDataGen::GenerateStewardship();
self::$MaxPersonId = Person::CountAll();
ChmsDataGen::GenerateCommunicationLists();
ChmsDataGen::GenerateGroups();
}
示例2: dtgPersons_Bind
protected function dtgPersons_Bind()
{
// We must first let the datagrid know how many total items there are
$this->dtgPersons->TotalItemCount = Person::CountAll();
// 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::LoadAll(QQ::Clause($this->dtgPersons->OrderByClause, $this->dtgPersons->LimitClause));
}
示例3: dtgPersons_Bind
protected function dtgPersons_Bind()
{
// We must first let the datagrid know how many total items there are
// IMPORTANT: Do not pass a limit clause here to CountAll
$this->dtgPersons->TotalItemCount = Person::CountAll();
// Ask the datagrid for the sorting information for the currently active sort column
$clauses[] = $this->dtgPersons->OrderByClause;
// Ask the datagrid for the Limit clause that will limit what portion of the data we will get from the database
$clauses[] = $this->dtgPersons->LimitClause;
// 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::LoadAll($clauses);
}
示例4: Form_Create
protected function Form_Create()
{
$count = 10000;
Project::ClearCache();
Person::ClearCache();
// Create test persons in database.
// Tiny objects
if (Person::CountAll() < $count) {
for ($i = 0; $i < $count; $i++) {
$objPerson = new Person();
$objPerson->FirstName = 'FirstName' . $i;
$objPerson->LastName = 'LastName' . $i;
$objPerson->Save();
}
}
// Bigger objects with expansion
if (Project::CountAll() < $count) {
for ($i = 0; $i < $count; $i++) {
$objProject = new Project();
$objProject->Name = 'Project' . $i;
$objProject->ProjectStatusTypeId = ProjectStatusType::Open;
$objProject->ManagerPersonId = $i % 1000 + 1000;
$objProject->Description = 'Description' . $i;
$objProject->StartDate = QDateTime::Now();
$objProject->EndDate = QDateTime::Now();
$objProject->Budget = $i;
$objProject->Spent = 1;
$objProject->Save();
}
}
$this->pnlTiny = new QPanel($this);
$this->pnlTiny->Name = '10,000 Person Objects';
$this->pnlBig = new QPanel($this);
$this->pnlBig->Name = '10,000 Project Objects With Expansion';
$this->btnGo = new QButton($this);
$this->btnGo->Text = 'Go';
$this->btnGo->AddAction(new QClickEvent(), new QAjaxAction('Go_Click'));
}
示例5: _p
<br/>
Project End Date: <?php
_p($objProject->EndDate);
?>
<br/>
Project Budget: <?php
_p($objProject->Budget);
?>
<br/>
<h3>Using LoadAll to get an Array of Person Objects</h3>
<?php
// We'll load all the persons into an array
$objPersonArray = Person::LoadAll();
// Use foreach to iterate through that array and output the first and last
// name of each person
foreach ($objPersonArray as $objPerson) {
printf('• ' . $objPerson->FirstName . ' ' . $objPerson->LastName . '<br/>');
}
?>
<h3>Using CountAll to get a Count of All Persons in the Database</h3>
There are <?php
_p(Person::CountAll());
?>
person(s) in the system.
<?php
require __INCLUDES__ . '/examples/footer.inc.php';
示例6: dtrPersons_Bind
protected function dtrPersons_Bind()
{
// This function defines how we load the data source into the Data Repeater
$this->dtrPersons->TotalItemCount = Person::CountAll();
$this->dtrPersons->DataSource = Person::LoadAll(QQ::Clause($this->dtrPersons->LimitClause));
}
示例7: MetaDataBinder
/**
* Default / simple DataBinder for this Meta DataGrid. This can easily be overridden
* by calling SetDataBinder() on this DataGrid with another DataBinder of your choice.
*
* 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).
*/
public function MetaDataBinder()
{
// Remember! We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
if ($this->Paginator) {
$this->TotalItemCount = Person::CountAll();
}
// 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->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::LoadAll($objClauses);
}
示例8: QCliParameterProcessor
<?php
$objParameters = new QCliParameterProcessor('zipcode-locater', 'Zipcode locater Script');
$objParameters->AddDefaultParameter('zipcode', QCliParameterType::String, 'Zipcode to search for');
$objParameters->Run();
$zipcode = $objParameters->GetDefaultValue('zipcode');
$objPersonCursor = Person::QueryCursor(QQ::All());
QDataGen::DisplayForEachTaskStart('Checking for Persons in zipcode', Person::CountAll());
print "\n";
while ($objPerson = Person::InstantiateCursor($objPersonCursor)) {
QDataGen::DisplayForEachTaskNext('Checking for Persons in zipcode');
if ($objPerson->MembershipStatusTypeId == MembershipStatusType::Member) {
$objAddressArray = $objPerson->GetAllAssociatedAddressArray();
foreach ($objAddressArray as $objAddress) {
if (strstr($objAddress->ZipCode, $zipcode) != false) {
print $objPerson->FirstName . " " . $objPerson->LastName . ": " . $objAddress->Address1 . ", " . $objAddress->City . ", " . $objAddress->ZipCode . "\n";
}
}
}
}
//$test = new Address();
//$test->City
QDataGen::DisplayForEachTaskEnd('Checking for Persons in zipcode');
示例9: Form_Create
protected function Form_Create()
{
$this->iTotalPersonCount = Person::CountAll();
$this->ethnicityArray = AttributeValue::LoadEthnicityArray();
$objEthnicityArray = array();
foreach ($this->ethnicityArray as $key => $val) {
$objEthnicityItem = new ethnicityItem($key, $val);
$objEthnicityArray[] = $objEthnicityItem;
}
$this->dtgEthnicity = new QDataGrid($this);
$this->dtgEthnicity->AddColumn(new QDataGridColumn('Ethnicity', '<?= $_ITEM->key; ?>', 'Width=270px'));
$this->dtgEthnicity->AddColumn(new QDataGridColumn('Count', '<?= $_ITEM->value; ?>', 'Width=270px'));
$this->dtgEthnicity->DataSource = $objEthnicityArray;
$this->dtgAfricanAmericanGroup = new QDataGrid($this);
$this->dtgAfricanAmericanGroup->AddColumn(new QDataGridColumn('Ethnicity', '<?= $_ITEM->key; ?>', 'Width=270px'));
$this->dtgAfricanAmericanGroup->AddColumn(new QDataGridColumn('Count', '<?= $_ITEM->value; ?>', 'Width=270px'));
$this->dtgAsianGroup = new QDataGrid($this);
$this->dtgAsianGroup->AddColumn(new QDataGridColumn('Ethnicity', '<?= $_ITEM->key; ?>', 'Width=270px'));
$this->dtgAsianGroup->AddColumn(new QDataGridColumn('Count', '<?= $_ITEM->value; ?>', 'Width=270px'));
$this->dtgHispanicGroup = new QDataGrid($this);
$this->dtgHispanicGroup->AddColumn(new QDataGridColumn('Ethnicity', '<?= $_ITEM->key; ?>', 'Width=270px'));
$this->dtgHispanicGroup->AddColumn(new QDataGridColumn('Count', '<?= $_ITEM->value; ?>', 'Width=270px'));
$this->dtgEuropeanGroup = new QDataGrid($this);
$this->dtgEuropeanGroup->AddColumn(new QDataGridColumn('Ethnicity', '<?= $_ITEM->key; ?>', 'Width=270px'));
$this->dtgEuropeanGroup->AddColumn(new QDataGridColumn('Count', '<?= $_ITEM->value; ?>', 'Width=270px'));
$this->dtgPacificIslanderGroup = new QDataGrid($this);
$this->dtgPacificIslanderGroup->AddColumn(new QDataGridColumn('Ethnicity', '<?= $_ITEM->key; ?>', 'Width=270px'));
$this->dtgPacificIslanderGroup->AddColumn(new QDataGridColumn('Count', '<?= $_ITEM->value; ?>', 'Width=270px'));
$this->dtgIndianGroup = new QDataGrid($this);
$this->dtgIndianGroup->AddColumn(new QDataGridColumn('Ethnicity', '<?= $_ITEM->key; ?>', 'Width=270px'));
$this->dtgIndianGroup->AddColumn(new QDataGridColumn('Count', '<?= $_ITEM->value; ?>', 'Width=270px'));
$this->dtgOtherGroup = new QDataGrid($this);
$this->dtgOtherGroup->AddColumn(new QDataGridColumn('Ethnicity', '<?= $_ITEM->key; ?>', 'Width=270px'));
$this->dtgOtherGroup->AddColumn(new QDataGridColumn('Count', '<?= $_ITEM->value; ?>', 'Width=270px'));
// African American Group
$this->africanAmericanGroup = $this->ethnicityArray["africanAmerican"] + $this->ethnicityArray["africanAmericanNative"] + $this->ethnicityArray["africanAmericanItalian"] + $this->ethnicityArray["africanAmericanCaucasian"];
$objAfricanAmericanArray = array();
$objEthnicityItem = new ethnicityItem("African American", $this->ethnicityArray["africanAmerican"]);
$objAfricanAmericanArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("African American Native", $this->ethnicityArray["africanAmericanNative"]);
$objAfricanAmericanArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("African American Italian", $this->ethnicityArray["africanAmericanItalian"]);
$objAfricanAmericanArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("African American Caucasian", $this->ethnicityArray["africanAmericanCaucasian"]);
$objAfricanAmericanArray[] = $objEthnicityItem;
$this->dtgAfricanAmericanGroup->DataSource = $objAfricanAmericanArray;
// Asian Group
$this->asianGroup = $this->ethnicityArray["asian"] + $this->ethnicityArray["chinese"] + $this->ethnicityArray["chineseAmerican"] + $this->ethnicityArray["filipino"] + $this->ethnicityArray["filipinoPuertoRican"] + $this->ethnicityArray["japanese"] + $this->ethnicityArray["japaneseCaucasian"] + $this->ethnicityArray["koreanAmerican"] + $this->ethnicityArray["vietnamese"];
$objAsianArray = array();
$objEthnicityItem = new ethnicityItem("Asian", $this->ethnicityArray["asian"]);
$objAsianArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Chinese", $this->ethnicityArray["chinese"]);
$objAsianArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Chinese American", $this->ethnicityArray["chineseAmerican"]);
$objAsianArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Filipino", $this->ethnicityArray["filipino"]);
$objAsianArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Filipino/Puerto Rican", $this->ethnicityArray["filipinoPuertoRican"]);
$objAsianArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Japanese", $this->ethnicityArray["japanese"]);
$objAsianArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Japanese Caucasian", $this->ethnicityArray["japaneseCaucasian"]);
$objAsianArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Korean/American", $this->ethnicityArray["koreanAmerican"]);
$objAsianArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Vietnamese", $this->ethnicityArray["vietnamese"]);
$objAsianArray[] = $objEthnicityItem;
$this->dtgAsianGroup->DataSource = $objAsianArray;
// Hispanic/Latino Group
$this->hispanicGroup = $this->ethnicityArray["hispanic"] + $this->ethnicityArray["hispanicBrazilian"] + $this->ethnicityArray["hispanicLatino"] + $this->ethnicityArray["latino"];
$objHispanicArray = array();
$objEthnicityItem = new ethnicityItem("Hispanic", $this->ethnicityArray["hispanic"]);
$objHispanicArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Hispanic/Brazilian", $this->ethnicityArray["hispanicBrazilian"]);
$objHispanicArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Hispanic/Latino", $this->ethnicityArray["hispanicLatino"]);
$objHispanicArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Latino", $this->ethnicityArray["latino"]);
$objHispanicArray[] = $objEthnicityItem;
$this->dtgHispanicGroup->DataSource = $objHispanicArray;
// European Group
$this->europeanGroup = $this->ethnicityArray["british"] + $this->ethnicityArray["greek"] + $this->ethnicityArray["spanish"] + $this->ethnicityArray["swiss"];
$objEuropeanArray = array();
$objEthnicityItem = new ethnicityItem("British", $this->ethnicityArray["british"]);
$objEuropeanArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Greek", $this->ethnicityArray["greek"]);
$objEuropeanArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Spanish", $this->ethnicityArray["spanish"]);
$objEuropeanArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Swiss", $this->ethnicityArray["swiss"]);
$objEuropeanArray[] = $objEthnicityItem;
$this->dtgEuropeanGroup->DataSource = $objEuropeanArray;
// Pacific Islander Group
$this->pacificIslanderGroup = $this->ethnicityArray["hawaiian"] + $this->ethnicityArray["polynesian"] + $this->ethnicityArray["samoan"] + $this->ethnicityArray["tongan"];
$objIslanderArray = array();
$objEthnicityItem = new ethnicityItem("Hawaiian", $this->ethnicityArray["hawaiian"]);
$objIslanderArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Polynesian", $this->ethnicityArray["polynesian"]);
$objIslanderArray[] = $objEthnicityItem;
$objEthnicityItem = new ethnicityItem("Samoan", $this->ethnicityArray["samoan"]);
//.........这里部分代码省略.........
示例10: lg_Bind
protected function lg_Bind()
{
$this->lg->TotalItemCount = Person::CountAll();
$clauses[] = $this->lg->LimitClause;
$this->lg->DataSource = Person::LoadAll($clauses);
}
示例11: dtgPerson_Bind
protected function dtgPerson_Bind()
{
// Get Total Count b/c of Pagination
$this->dtgPerson->TotalItemCount = Person::CountAll();
$objClauses = array();
if ($objClause = $this->dtgPerson->OrderByClause) {
array_push($objClauses, $objClause);
}
if ($objClause = $this->dtgPerson->LimitClause) {
array_push($objClauses, $objClause);
}
$this->dtgPerson->DataSource = Person::LoadAll($objClauses);
}
示例12: array
<?php
$objPersonCursor = Person::QueryCursor(QQ::All());
QDataGen::DisplayForEachTaskStart('Refreshing Person data', Person::CountAll());
while ($objPerson = Person::InstantiateCursor($objPersonCursor)) {
QDataGen::DisplayForEachTaskNext('Refreshing Person data');
$objPerson->RefreshAge(false);
$objPerson->RefreshMaritalStatusTypeId(false);
$objPerson->RefreshMembershipStatusTypeId(false);
$objPerson->RefreshPrimaryContactInfo(true);
$objPerson->RefreshNameItemAssociations();
}
QDataGen::DisplayForEachTaskEnd('Refreshing Person data');
$objHouseholdCursor = Household::QueryCursor(QQ::All());
QDataGen::DisplayForEachTaskStart('Refreshing Household data', Household::CountAll());
while ($objHousehold = Household::InstantiateCursor($objHouseholdCursor)) {
QDataGen::DisplayForEachTaskNext('Refreshing Household data');
$objHousehold->RefreshMembers(false);
$objMarriedPersonArray = array();
foreach ($objHousehold->GetHouseholdParticipationArray() as $objParticipation) {
if ($objParticipation->Person->MaritalStatusTypeId == MaritalStatusType::Married && $objParticipation->Person->CountMarriages() == 1) {
$objMarriedPersonArray[] = $objParticipation->Person;
}
}
if (count($objMarriedPersonArray) == 2) {
$objMarriedPersonArray[0]->DeleteAllMarriages();
$objMarriedPersonArray[1]->DeleteAllMarriages();
$objMarriedPersonArray[0]->CreateMarriageWith($objMarriedPersonArray[1]);
} else {
if (count($objMarriedPersonArray)) {
print "\r\nWhat!? Household " . $objHousehold->Id . " has a marriage count of " . count($objMarriedPersonArray) . "!\r\n";
示例13:
<?php
$objPersonCursor = Person::QueryCursor(QQ::All());
QDataGen::DisplayForEachTaskStart('Removing Duplicate Addresses from Person', Person::CountAll());
while ($objPerson = Person::InstantiateCursor($objPersonCursor)) {
QDataGen::DisplayForEachTaskNext('Removing Duplicate Addresses from Person');
$objPerson->RemoveDuplicateAddresses();
}
QDataGen::DisplayForEachTaskEnd('Removing Duplicate Addresses from Person');
示例14: strpos
<?php
$objPersonCursor = Person::QueryCursor(QQ::All());
QDataGen::DisplayForEachTaskStart('Checking for Multiple First Names in Person', Person::CountAll());
print "\n";
while ($objPerson = Person::InstantiateCursor($objPersonCursor)) {
QDataGen::DisplayForEachTaskNext('Checking for Multiple First Names in Person');
$pos = strpos($objPerson->FirstName, " and ");
if ($pos !== false) {
print "Found Multiple First Name: " . $objPerson->FirstName . "\n";
}
$pos = strpos($objPerson->FirstName, "&");
if ($pos !== false) {
print "Found Multiple First Name: " . $objPerson->FirstName . "\n";
}
}
QDataGen::DisplayForEachTaskEnd('Checking for Multiple First Names in Person');