本文整理汇总了PHP中Person::LoadAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::LoadAll方法的具体用法?PHP Person::LoadAll怎么用?PHP Person::LoadAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::LoadAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Form_Create
protected function Form_Create()
{
// Define our Label
$this->lblMessage = new QLabel($this);
$this->lblMessage->Text = '<None>';
// Define the ListBox, and create the first listitem as 'Select One'
$this->lstPersons = new QListBox($this);
$this->lstPersons->AddItem('- Select One -', null);
// Add the items for the listbox, pulling in from the Person table
$objPersons = Person::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
if ($objPersons) {
foreach ($objPersons as $objPerson) {
// We want to display the listitem as Last Name, First Name
// and the VALUE of the listitem should be the person object itself
$this->lstPersons->AddItem($objPerson->LastName . ', ' . $objPerson->FirstName, $objPerson);
}
}
// Declare a QChangeEvent to call a server action: the lstPersons_Change PHP method
$this->lstPersons->AddAction(new QChangeEvent(), new QServerAction('lstPersons_Change'));
// Do the same but with a multiple selection QCheckboxList
$this->chkPersons = new QCheckBoxList($this);
if ($objPersons) {
foreach ($objPersons as $objPerson) {
// We want to display the listitem as Last Name, First Name
// and the VALUE of the listitem will be the database id
$this->chkPersons->AddItem($objPerson->FirstName . ' ' . $objPerson->LastName, $objPerson->Id);
}
}
$this->chkPersons->RepeatColumns = 2;
$this->chkPersons->AddAction(new QChangeEvent(), new QServerAction('chkPersons_Change'));
}
示例2: testSelectSubsetInExpandAsArray
public function testSelectSubsetInExpandAsArray()
{
$objPersonArray = Person::LoadAll(QQ::Clause(QQ::Select(QQN::Person()->FirstName), QQ::ExpandAsArray(QQN::Person()->Address, QQ::Select(QQN::Person()->Address->Street, QQN::Person()->Address->City)), QQ::ExpandAsArray(QQN::Person()->ProjectAsManager, QQ::Select(QQN::Person()->ProjectAsManager->StartDate)), QQ::ExpandAsArray(QQN::Person()->ProjectAsManager->Milestone, QQ::Select(QQN::Person()->ProjectAsManager->Milestone->Name))));
foreach ($objPersonArray as $objPerson) {
$this->assertNull($objPerson->LastName, "LastName 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");
if (sizeof($objPerson->_AddressArray) > 0) {
foreach ($objPerson->_AddressArray as $objAddress) {
$this->assertNotNull($objAddress->Id, "Address->Id should not be null since it's always added to the select list");
$this->assertNull($objAddress->PersonId, "Address->PersonId should be null, since it was not selected");
}
}
if (sizeof($objPerson->_ProjectAsManagerArray) > 0) {
foreach ($objPerson->_ProjectAsManagerArray as $objProject) {
$this->assertNotNull($objProject->Id, "Project->Id should not be null since it's always added to the select list");
$this->assertNull($objProject->Name, "Project->Name should be null, since it was not selected");
if (sizeof($objProject->_MilestoneArray) > 0) {
foreach ($objProject->_MilestoneArray as $objMilestone) {
$this->assertNotNull($objMilestone->Id, "Milestone->Id should not be null since it's always added to the select list");
$this->assertNull($objMilestone->ProjectId, "Milestone->ProjectId should be null, since it was not selected");
}
}
}
}
}
}
示例3: testMultiLevel
public function testMultiLevel()
{
$arrPeople = Person::LoadAll(QQ::Clause(QQ::ExpandAsArray(QQN::Person()->Address), QQ::ExpandAsArray(QQN::Person()->ProjectAsManager), QQ::ExpandAsArray(QQN::Person()->ProjectAsManager->Milestone)));
$targetPerson = null;
foreach ($arrPeople as $objPerson) {
if ($objPerson->LastName == "Wolfe") {
$targetPerson = $objPerson;
}
}
$this->assertEqual(sizeof($arrPeople), 12);
$this->assertNotEqual($targetPerson, null, "Karen Wolfe found");
$targetProject = null;
foreach ($targetPerson->_ProjectAsManagerArray as $objProject) {
if ($objProject->Name == "ACME Payment System") {
$targetProject = $objProject;
}
}
$this->assertEqual(sizeof($targetPerson->_ProjectAsManagerArray), 2, "2 projects found");
$this->assertNotEqual($targetProject, null, "ACME Payment System project found");
$targetMilestone = null;
foreach ($targetProject->_MilestoneArray as $objMilestone) {
if ($objMilestone->Name == "Milestone H") {
$targetMilestone = $objMilestone;
}
}
$this->assertEqual(sizeof($targetProject->_MilestoneArray), 4, "4 milestones found");
$this->assertNotEqual($targetMilestone, null, "Milestone H found");
}
示例4: 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));
}
示例5: dtgPersons_Bind
protected function dtgPersons_Bind()
{
// We must be sure to load the data source
// Ask the datagrid for the sorting clause that corresponds to the currently active sort column.
$clauses[] = $this->dtgPersons->OrderByClause;
// Give that clause to our sql query so it returns sorted data
$this->dtgPersons->DataSource = Person::LoadAll($clauses);
}
示例6: dtgPersons_Bind
protected function dtgPersons_Bind()
{
$objPersonArray = $this->dtgPersons->DataSource = Person::LoadAll(QQ::Clause($this->dtgPersons->OrderByClause, $this->dtgPersons->LimitClause));
// If we are editing someone new, we need to add a new (blank) person to the data source
if ($this->intEditPersonId == -1) {
array_push($objPersonArray, new Person());
}
// Bind the datasource to the datagrid
$this->dtgPersons->DataSource = $objPersonArray;
}
示例7: Go_Click
protected function Go_Click()
{
QApplication::$blnLocalCache = false;
$timeNoCache = -microtime(true);
$a = Person::LoadAll();
// noncached loads
$timeNoCache += microtime(true);
QApplication::$blnLocalCache = true;
$timeLoad1Cached = -microtime(true);
$a = Person::LoadAll();
// noncached loads
$timeLoad1Cached += microtime(true);
$timeLoad2Cached = -microtime(true);
$a = Person::LoadAll();
// cached loads
$timeLoad2Cached += microtime(true);
QApplication::$blnLocalCache = new QCacheProviderLocalMemory(array());
$timeLoad3Cached = -microtime(true);
$a = Person::LoadAll();
// noncached loads
$timeLoad3Cached += microtime(true);
$timeLoad4Cached = -microtime(true);
$a = Person::LoadAll();
// cached loads
$timeLoad4Cached += microtime(true);
$this->pnlTiny->Text = sprintf("Load No Cache: %2.1f%% \n", 100 * $timeNoCache / $timeNoCache) . sprintf("Populate Cache: %2.1f%% \n", 100 * $timeLoad1Cached / $timeNoCache) . sprintf("Load With Cache: %2.1f%% \n", 100 * $timeLoad2Cached / $timeNoCache) . sprintf("Populate LocalCacheProvider: %2.1f%% \n", 100 * $timeLoad3Cached / $timeNoCache) . sprintf("Load LocalCacheProvider: %2.1f%% \n", 100 * $timeLoad4Cached / $timeNoCache);
$cond = QQ::Equal(QQN::Project()->ProjectStatusTypeId, ProjectStatusType::Open);
$clauses[] = QQ::Expand(QQN::Project()->ManagerPerson);
Project::ClearCache();
Person::ClearCache();
QApplication::$blnLocalCache = false;
$timeNoCache = -microtime(true);
$a = Project::QueryArray($cond, $clauses);
// noncached loads
$timeNoCache += microtime(true);
QApplication::$blnLocalCache = true;
$timeLoad1Cached = -microtime(true);
$a = Project::QueryArray($cond, $clauses);
// noncached loads
$timeLoad1Cached += microtime(true);
$timeLoad2Cached = -microtime(true);
$a = Project::QueryArray($cond, $clauses);
// cached loads
$timeLoad2Cached += microtime(true);
QApplication::$blnLocalCache = new QCacheProviderLocalMemory(array());
$timeLoad3Cached = -microtime(true);
$a = Project::QueryArray($cond, $clauses);
// noncached loads
$timeLoad3Cached += microtime(true);
$timeLoad4Cached = -microtime(true);
$a = Project::QueryArray($cond, $clauses);
// cached loads
$timeLoad4Cached += microtime(true);
$this->pnlBig->Text = sprintf("Load No Cache: %2.1f%% \n", 100 * $timeNoCache / $timeNoCache) . sprintf("Populate Cache: %2.1f%% \n", 100 * $timeLoad1Cached / $timeNoCache) . sprintf("Load With Cache: %2.1f%% \n", 100 * $timeLoad2Cached / $timeNoCache) . sprintf("Populate LocalCacheProvider: %2.1f%% \n", 100 * $timeLoad3Cached / $timeNoCache) . sprintf("Load LocalCacheProvider: %2.1f%% \n", 100 * $timeLoad4Cached / $timeNoCache);
}
示例8: 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);
}
示例9: _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
示例10: testQuerySelectSubsetSkipPK
public function testQuerySelectSubsetSkipPK()
{
$objSelect = QQ::Select(QQN::Person()->FirstName);
$objSelect->SetSkipPrimaryKey(true);
$objPersonArray = Person::LoadAll($objSelect);
foreach ($objPersonArray as $objPerson) {
$this->assertNull($objPerson->LastName, "LastName should be null, since it was not selected");
$this->assertNull($objPerson->Id, "Id should be null since SkipPrimaryKey is set on the Select object");
}
}
示例11: Refresh
/**
* Refresh this MetaControl with Data from the local WikiVersion object.
* @param boolean $blnReload reload WikiVersion from the database
* @return void
*/
public function Refresh($blnReload = false)
{
if ($blnReload) {
$this->objWikiVersion->Reload();
}
if ($this->lblId) {
if ($this->blnEditMode) {
$this->lblId->Text = $this->objWikiVersion->Id;
}
}
if ($this->lstWikiItem) {
$this->lstWikiItem->RemoveAllItems();
if (!$this->blnEditMode) {
$this->lstWikiItem->AddItem(QApplication::Translate('- Select One -'), null);
}
$objWikiItemArray = WikiItem::LoadAll();
if ($objWikiItemArray) {
foreach ($objWikiItemArray as $objWikiItem) {
$objListItem = new QListItem($objWikiItem->__toString(), $objWikiItem->Id);
if ($this->objWikiVersion->WikiItem && $this->objWikiVersion->WikiItem->Id == $objWikiItem->Id) {
$objListItem->Selected = true;
}
$this->lstWikiItem->AddItem($objListItem);
}
}
}
if ($this->lblWikiItemId) {
$this->lblWikiItemId->Text = $this->objWikiVersion->WikiItem ? $this->objWikiVersion->WikiItem->__toString() : null;
}
if ($this->txtVersionNumber) {
$this->txtVersionNumber->Text = $this->objWikiVersion->VersionNumber;
}
if ($this->lblVersionNumber) {
$this->lblVersionNumber->Text = $this->objWikiVersion->VersionNumber;
}
if ($this->txtName) {
$this->txtName->Text = $this->objWikiVersion->Name;
}
if ($this->lblName) {
$this->lblName->Text = $this->objWikiVersion->Name;
}
if ($this->lstPostedByPerson) {
$this->lstPostedByPerson->RemoveAllItems();
if (!$this->blnEditMode) {
$this->lstPostedByPerson->AddItem(QApplication::Translate('- Select One -'), null);
}
$objPostedByPersonArray = Person::LoadAll();
if ($objPostedByPersonArray) {
foreach ($objPostedByPersonArray as $objPostedByPerson) {
$objListItem = new QListItem($objPostedByPerson->__toString(), $objPostedByPerson->Id);
if ($this->objWikiVersion->PostedByPerson && $this->objWikiVersion->PostedByPerson->Id == $objPostedByPerson->Id) {
$objListItem->Selected = true;
}
$this->lstPostedByPerson->AddItem($objListItem);
}
}
}
if ($this->lblPostedByPersonId) {
$this->lblPostedByPersonId->Text = $this->objWikiVersion->PostedByPerson ? $this->objWikiVersion->PostedByPerson->__toString() : null;
}
if ($this->calPostDate) {
$this->calPostDate->DateTime = $this->objWikiVersion->PostDate;
}
if ($this->lblPostDate) {
$this->lblPostDate->Text = sprintf($this->objWikiVersion->PostDate) ? $this->objWikiVersion->__toString($this->strPostDateDateTimeFormat) : null;
}
if ($this->lstWikiFile) {
$this->lstWikiFile->RemoveAllItems();
$this->lstWikiFile->AddItem(QApplication::Translate('- Select One -'), null);
$objWikiFileArray = WikiFile::LoadAll();
if ($objWikiFileArray) {
foreach ($objWikiFileArray as $objWikiFile) {
$objListItem = new QListItem($objWikiFile->__toString(), $objWikiFile->WikiVersionId);
if ($objWikiFile->WikiVersionId == $this->objWikiVersion->Id) {
$objListItem->Selected = true;
}
$this->lstWikiFile->AddItem($objListItem);
}
}
// Because WikiFile's WikiFile is not null, if a value is already selected, it cannot be changed.
if ($this->lstWikiFile->SelectedValue) {
$this->lstWikiFile->Enabled = false;
} else {
$this->lstWikiFile->Enabled = true;
}
}
if ($this->lblWikiFile) {
$this->lblWikiFile->Text = $this->objWikiVersion->WikiFile ? $this->objWikiVersion->WikiFile->__toString() : null;
}
if ($this->lstWikiImage) {
$this->lstWikiImage->RemoveAllItems();
$this->lstWikiImage->AddItem(QApplication::Translate('- Select One -'), null);
$objWikiImageArray = WikiImage::LoadAll();
if ($objWikiImageArray) {
foreach ($objWikiImageArray as $objWikiImage) {
//.........这里部分代码省略.........
示例12: tblPersons_Bind
protected function tblPersons_Bind()
{
// We load the data source, and set it to the datagrid's DataSource parameter
$this->tblPersons->DataSource = Person::LoadAll();
}
示例13: GenerateCommunicationLists
public static function GenerateCommunicationLists()
{
$objPersonArray = Person::LoadAll();
while (QDataGen::DisplayWhileTask('Generating Communication Lists', self::CommunicationListCount, false)) {
$objCommunicationList = new CommunicationList();
$objCommunicationList->EmailBroadcastTypeId = QDataGen::GenerateFromArray(array_keys(EmailBroadcastType::$NameArray));
$objCommunicationList->Ministry = QDataGen::GenerateFromArray(self::$MinistryArray);
$objCommunicationList->Name = QDataGen::GenerateTitle(1, 4);
$objCommunicationList->Token = strtolower(str_replace(' ', '_', $objCommunicationList->Name));
while (CommunicationList::LoadByToken($objCommunicationList->Token)) {
$objCommunicationList->Name = QDataGen::GenerateTitle(1, 4);
$objCommunicationList->Token = strtolower(str_replace(' ', '_', $objCommunicationList->Name));
}
$objCommunicationList->Save();
$intCount = rand(5, 100);
for ($i = 0; $i < $intCount; $i++) {
if (rand(0, 3)) {
$objPerson = QDataGen::GenerateFromArray($objPersonArray);
while ($objCommunicationList->IsPersonAssociated($objPerson)) {
$objPerson = QDataGen::GenerateFromArray($objPersonArray);
}
$objCommunicationList->AssociatePerson($objPerson);
} else {
$strFirstName = QDataGen::GenerateFirstName();
if (!rand(0, 5)) {
$strMiddleName = QDataGen::GenerateMiddleInitial() . '.';
} else {
$strMiddleName = null;
}
$strLastName = QDataGen::GenerateLastName();
$strEmail = QDataGen::GenerateEmail($strFirstName, $strLastName);
$objCommunicationList->AddEntry($strEmail, $strFirstName, $strMiddleName, $strLastName);
}
}
}
}
示例14: foreach
As a final reminder, note that you can use either, both, more or none of these optional <b>QQClause</b>
parameters whenever you make your <b>LoadAll</b> or <b>LoadArrayBy</b> calls.
</div>
<h3>List All the People, Ordered by Last Name then First Name</h3>
<?php
// Load the Person array, sorted
$objPersonArray = Person::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
foreach ($objPersonArray as $objPerson) {
_p($objPerson->LastName . ', ' . $objPerson->FirstName . ' (ID #' . $objPerson->Id . ')');
_p('<br/>', false);
}
?>
<h3>List Five People, Start with the Third from the Top, Ordered by Last Name then First Name</h3>
<?php
// Load the Person array, sorted and limited
// Note that because we want to start with row #3, we need to define "2" as the offset
$objPersonArray = Person::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName), QQ::LimitInfo(5, 2)));
foreach ($objPersonArray as $objPerson) {
_p($objPerson->LastName . ', ' . $objPerson->FirstName . ' (ID #' . $objPerson->Id . ')');
_p('<br/>', false);
}
?>
<?php
require '../includes/footer.inc.php';
示例15: Refresh
/**
* Refresh this MetaControl with Data from the local Relationship object.
* @param boolean $blnReload reload Relationship from the database
* @return void
*/
public function Refresh($blnReload = false)
{
if ($blnReload) {
$this->objRelationship->Reload();
}
if ($this->lblId) {
if ($this->blnEditMode) {
$this->lblId->Text = $this->objRelationship->Id;
}
}
if ($this->lstPerson) {
$this->lstPerson->RemoveAllItems();
if (!$this->blnEditMode) {
$this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null);
}
$objPersonArray = Person::LoadAll();
if ($objPersonArray) {
foreach ($objPersonArray as $objPerson) {
$objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
if ($this->objRelationship->Person && $this->objRelationship->Person->Id == $objPerson->Id) {
$objListItem->Selected = true;
}
$this->lstPerson->AddItem($objListItem);
}
}
}
if ($this->lblPersonId) {
$this->lblPersonId->Text = $this->objRelationship->Person ? $this->objRelationship->Person->__toString() : null;
}
if ($this->lstRelatedToPerson) {
$this->lstRelatedToPerson->RemoveAllItems();
if (!$this->blnEditMode) {
$this->lstRelatedToPerson->AddItem(QApplication::Translate('- Select One -'), null);
}
$objRelatedToPersonArray = Person::LoadAll();
if ($objRelatedToPersonArray) {
foreach ($objRelatedToPersonArray as $objRelatedToPerson) {
$objListItem = new QListItem($objRelatedToPerson->__toString(), $objRelatedToPerson->Id);
if ($this->objRelationship->RelatedToPerson && $this->objRelationship->RelatedToPerson->Id == $objRelatedToPerson->Id) {
$objListItem->Selected = true;
}
$this->lstRelatedToPerson->AddItem($objListItem);
}
}
}
if ($this->lblRelatedToPersonId) {
$this->lblRelatedToPersonId->Text = $this->objRelationship->RelatedToPerson ? $this->objRelationship->RelatedToPerson->__toString() : null;
}
if ($this->lstRelationshipType) {
$this->lstRelationshipType->SelectedValue = $this->objRelationship->RelationshipTypeId;
}
if ($this->lblRelationshipTypeId) {
$this->lblRelationshipTypeId->Text = $this->objRelationship->RelationshipTypeId ? RelationshipType::$NameArray[$this->objRelationship->RelationshipTypeId] : null;
}
}