当前位置: 首页>>代码示例>>PHP>>正文


PHP Phone::Save方法代码示例

本文整理汇总了PHP中Phone::Save方法的典型用法代码示例。如果您正苦于以下问题:PHP Phone::Save方法的具体用法?PHP Phone::Save怎么用?PHP Phone::Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phone的用法示例。


在下文中一共展示了Phone::Save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GenerateAddressesAndPhonesForPerson

 protected static function GenerateAddressesAndPhonesForPerson(Person $objPerson)
 {
     $intAddressCount = rand(0, 5);
     for ($i = 0; $i < $intAddressCount; $i++) {
         $objAddress = new Address();
         $objAddress->AddressTypeId = QDataGen::GenerateFromArray(array_keys(AddressType::$NameArray));
         $objAddress->Person = $objPerson;
         $objAddress->Address1 = QDataGen::GenerateStreetAddress();
         if (rand(0, 1)) {
             $objAddress->Address2 = QDataGen::GenerateAddressLine2();
         }
         $objAddress->City = QDataGen::GenerateCity();
         $objAddress->State = QDataGen::GenerateUsState();
         $objAddress->ZipCode = rand(10000, 99999);
         $objAddress->Country = 'US';
         $objAddress->InvalidFlag = false;
         $objAddress->VerificationCheckedFlag = true;
         switch ($objAddress->AddressTypeId) {
             case AddressType::Temporary:
                 $objAddress->CurrentFlag = true;
                 $dttNextYear = QDateTime::Now();
                 $dttNextYear->Year++;
                 $objAddress->DateUntilWhen = QDataGen::GenerateDateTime(QDateTime::Now(), $dttNextYear);
                 break;
             default:
                 $objAddress->CurrentFlag = rand(0, 1);
                 break;
         }
         $objAddress->Save();
     }
     $intPhoneCount = rand(0, 5);
     $objPhoneArray = array();
     for ($i = 0; $i < $intPhoneCount; $i++) {
         $objPhone = new Phone();
         $objPhone->PhoneTypeId = QDataGen::GenerateFromArray(array_keys(PhoneType::$NameArray));
         while ($objPhone->PhoneTypeId == PhoneType::Home) {
             $objPhone->PhoneTypeId = QDataGen::GenerateFromArray(array_keys(PhoneType::$NameArray));
         }
         $objPhone->Number = QDataGen::GeneratePhone();
         $objPhone->Person = $objPerson;
         $objPhone->Save();
         $objPhoneArray[] = $objPhone;
     }
     if ($intPhoneCount && !rand(0, 2)) {
         QDataGen::GenerateFromArray($objPhoneArray)->SetAsPrimary();
     }
     $intEmailCount = rand(0, 5);
     $objEmailArray = array();
     for ($i = 0; $i < $intEmailCount; $i++) {
         $objEmail = new Email();
         $objEmail->Address = QDataGen::GenerateEmail($objPerson->FirstName, $objPerson->LastName);
         $objEmail->Person = $objPerson;
         $objEmail->Save();
         $objEmailArray[] = $objEmail;
     }
     if ($intEmailCount && !rand(0, 2)) {
         QDataGen::GenerateFromArray($objEmailArray)->SetAsPrimary();
     }
     $intMaxId = OtherContactMethod::CountAll();
     for ($intOtherContactMethodId = 1; $intOtherContactMethodId <= $intMaxId; $intOtherContactMethodId++) {
         if (!rand(0, 2)) {
             $objContactInfo = new OtherContactInfo();
             $objContactInfo->Person = $objPerson;
             $objContactInfo->OtherContactMethodId = $intOtherContactMethodId;
             $objContactInfo->Value = QDataGen::GenerateUsername($objPerson->FirstName, $objPerson->LastName);
             $objContactInfo->Save();
         }
     }
 }
开发者ID:alcf,项目名称:chms,代码行数:69,代码来源:datagen.cli.php

示例2: SaveSpouse

 protected function SaveSpouse()
 {
     // Fixup Middle
     $this->txtSpouseMiddleName->Text = trim($this->txtSpouseMiddleName->Text);
     if (strlen($this->txtSpouseMiddleName->Text) == 1) {
         $this->txtSpouseMiddleName->Text = strtoupper($this->txtSpouseMiddleName->Text);
     } else {
         if (strlen($this->txtSpouseMiddleName->Text) == 2 && $this->txtSpouseMiddleName->Text[1] == '.') {
             $this->txtSpouseMiddleName->Text = strtoupper($this->txtSpouseMiddleName->Text[0]);
         }
     }
     // Update Gender and Types and Save
     $this->mctSpouse->Person->Gender = $this->lstSpouseGender->SelectedValue;
     $this->mctSpouse->Person->MembershipStatusTypeId = MembershipStatusType::NonMember;
     $this->mctSpouse->Person->MaritalStatusTypeId = MaritalStatusType::NotSpecified;
     $this->mctSpouse->Person->DeceasedFlag = false;
     $this->mctSpouse->SavePerson();
     $this->mctSpouse->Person->RefreshNameItemAssociations();
     // Is there a home address?
     if ($objHousehold = Household::LoadByHeadPersonId($this->mctPerson->Person->Id)) {
         $objHousehold->AssociatePerson($this->mctSpouse->Person);
     }
     // Email
     if (trim($this->txtSpouseEmail->Text)) {
         $objEmail = new Email();
         $objEmail->Person = $this->mctSpouse->Person;
         $objEmail->Address = trim($this->txtSpouseEmail->Text);
         $objEmail->Save();
         $this->mctSpouse->Person->PrimaryEmail = $objEmail;
     }
     // Phones
     if (trim($this->txtSpouseCellPhone->Text)) {
         $objPhone = new Phone();
         $objPhone->PhoneTypeId = PhoneType::Mobile;
         $objPhone->Person = $this->mctSpouse->Person;
         $objPhone->Number = trim($this->txtSpouseCellPhone->Text);
         $objPhone->MobileProviderId = $this->lstSpouseMobileProvider->SelectedValue;
         $objPhone->Save();
         $this->mctSpouse->Person->PrimaryPhone = $objPhone;
     }
     if (trim($this->txtSpouseHomePhone->Text)) {
         if ($this->txtSpouseHomePhone->Text != $this->txtPersonHomePhone->Text) {
             $objPhone = new Phone();
             $objPhone->PhoneTypeId = PhoneType::Home;
             $objPhone->Number = trim($this->txtSpouseHomePhone->Text);
             if ($objHousehold) {
                 $objPhone->Address = $this->mctAddress->Address;
             } else {
                 $objPhone->Person = $this->mctSpouse->Person;
             }
             $objPhone->Save();
         } else {
             $objPhone = $this->objHomePhone;
         }
         if (!$this->mctSpouse->Person->PrimaryPhone) {
             $this->mctSpouse->Person->PrimaryPhone = $objPhone;
         }
         if ($this->mctAddress->Address->Id && !$this->mctAddress->Address->PrimaryPhone) {
             $this->mctAddress->Address->PrimaryPhone = $objPhone;
             $this->mctAddress->Address->Save();
         }
     }
     if (trim($this->txtSpouseWorkPhone->Text)) {
         $objPhone = new Phone();
         $objPhone->PhoneTypeId = PhoneType::Work;
         $objPhone->Person = $this->mctSpouse->Person;
         $objPhone->Number = trim($this->txtSpouseWorkPhone->Text);
         $objPhone->Save();
         if (!$this->mctSpouse->Person->PrimaryPhone) {
             $this->mctSpouse->Person->PrimaryPhone = $objPhone;
         }
     }
 }
开发者ID:alcf,项目名称:chms,代码行数:73,代码来源:new.php

示例3: UpdateAddressInformation

 /**
  * Given a home (and optional mailing) address validator (which is unlinked from any db entry), go ahead and make updates
  * to this person record accordingly.
  * 
  * If this person is part of multiple households, it will throw an error.
  * 
  * If this person is part of one household, it will update the information for the household.
  * 
  * If this person is not part of any houseold, it will create one for him/her.
  * 
  * @param AddressValidator $objHomeAddressValidator
  * @param AddressValidator $objMailingAddressValidator optional
  * @param string $strHomePhone optional
  */
 public function UpdateAddressInformation(AddressValidator $objHomeAddressValidator, AddressValidator $objMailingAddressValidator = null, $strHomePhone = null)
 {
     $objHouseholdArray = array();
     foreach ($this->GetHouseholdParticipationArray() as $objHouseholdParticipation) {
         $objHouseholdArray[] = $objHouseholdParticipation->Household;
     }
     // Figure Out Household Information
     if (count($objHouseholdArray) > 1) {
         throw new QCallerException('Cannot call UpdateAddressInformation on a person who is part of multiple households: ' . $this->intId);
     }
     if (count($objHouseholdArray)) {
         $objHousehold = $objHouseholdArray[0];
     } else {
         $objHousehold = Household::CreateHousehold($this);
     }
     // Home Address
     $objHomeAddress = $objHousehold->GetCurrentAddress();
     $objAddress = $objHomeAddressValidator->CreateAddressRecord();
     // Are we using the existing Household CurrentAddress record?
     if ($objHomeAddress && $objHomeAddress->IsEqualTo($objAddress)) {
         // Yes -- so all we're handling is the phones
         $objHomePhoneArray = $objHomeAddress->GetPhoneArray();
         // Are we setting a home phone?
         if ($strHomePhone) {
             // Try and find the phone within the array
             foreach ($objHomePhoneArray as $objPhone) {
                 $blnFound = false;
                 if ($objPhone->Number == $strHomePhone) {
                     $objPhone->SetAsPrimary(null, $objHomeAddress);
                     $blnFound = true;
                 }
             }
             // If we didn't find an existing home phone, we will update the current primary (if applicable)
             // Or create a new one as primary
             if (!$blnFound) {
                 if (count($objHomePhoneArray)) {
                     $objHomePhoneArray[0]->Number = $strHomePhone;
                     $objHomePhoneArray[0]->Save();
                 } else {
                     $objPhone = new Phone();
                     $objPhone->Number = $strHomePhone;
                     $objPhone->Address = $objHomeAddress;
                     $objPhone->PhoneTypeId = PhoneType::Home;
                     $objPhone->Save();
                     $objPhone->SetAsPrimary(null, $objHomeAddress);
                 }
             }
             // Nope - we are deleting the home phone
         } else {
             foreach ($objHomePhoneArray as $objPhone) {
                 $objPhone->Delete();
             }
         }
         // Not an existing Household CurrentAddress record that matches -- so we are creating a new one
     } else {
         $objAddress->Household = $objHousehold;
         $objAddress->CurrentFlag = true;
         $objAddress->AddressTypeId = AddressType::Home;
         $objAddress->Save();
         $objHousehold->SetAsCurrentAddress($objAddress);
         // Add the phone if applicable
         if ($strHomePhone) {
             $objPhone = new Phone();
             $objPhone->Number = $strHomePhone;
             $objPhone->Address = $objAddress;
             $objPhone->PhoneTypeId = PhoneType::Home;
             $objPhone->Save();
             $objPhone->SetAsPrimary(null, $objAddress);
         }
     }
     // Mailing Address?
     if ($objMailingAddressValidator) {
         $objAddress = $objMailingAddressValidator->CreateAddressRecord();
         $blnFound = false;
         foreach ($this->GetAllAssociatedAddressArray($objHousehold) as $objExistingAddress) {
             if ($objExistingAddress->IsEqualTo($objAddress)) {
                 $this->MailingAddress = $objExistingAddress;
                 $this->RefreshPrimaryContactInfo();
                 $blnFound = true;
             }
         }
         if (!$blnFound) {
             $objAddress->AddressTypeId = AddressType::Other;
             $objAddress->Person = $this;
             $objAddress->CurrentFlag = true;
             $objAddress->Save();
//.........这里部分代码省略.........
开发者ID:alcf,项目名称:chms,代码行数:101,代码来源:Person.class.php

示例4: Reconcile


//.........这里部分代码省略.........
                         if ($intScore > $intCurrentScore) {
                             $intCurrentScore = $intScore;
                             $objPerson = $objMatchedPerson;
                         }
                     }
                 }
             }
         }
     }
     // If we have a person, make sure it's not already linked
     if ($objPerson) {
         if ($objPerson->PublicLogin) {
             return $objPerson;
         }
     }
     // We now have either a unlinked Person record or no person record
     // Let's make all the DB updates we need to
     Person::GetDatabase()->TransactionBegin();
     // Do we have a single Person object?
     // If not, let's create it
     if (!$objPerson) {
         $blnMaleFlag = null;
         if ($strGenderFlag = trim(strtoupper($strGenderFlag))) {
             $blnMaleFlag = $strGenderFlag == 'M';
         }
         $intPhoneTypeId = $strMobilePhone ? PhoneType::Mobile : null;
         $objPerson = Person::CreatePerson($this->FirstName, null, $this->LastName, $blnMaleFlag, $this->EmailAddress, $strMobilePhone, $intPhoneTypeId);
         $objPerson->DateOfBirth = $dttDateOfBirth;
         if ($objPerson->DateOfBirth) {
             $objPerson->DobGuessedFlag = false;
             $objPerson->DobYearApproximateFlag = false;
         }
         $objPerson->PublicCreationFlag = true;
         $objPerson->Save();
     }
     //////////////////////////////////
     // Let's update the information
     //////////////////////////////////
     // Email Address
     $objPerson->ChangePrimaryEmailTo($this->EmailAddress, false);
     // Gender and DOB
     if ($strGenderFlag = trim(strtoupper($strGenderFlag))) {
         $objPerson->Gender = $strGenderFlag;
     }
     if ($dttDateOfBirth) {
         $objPerson->DateOfBirth = $dttDateOfBirth;
         $objPerson->DobGuessedFlag = false;
         $objPerson->DobYearApproximateFlag = false;
     }
     // Mobile Phone
     if ($strMobilePhone) {
         $blnFound = false;
         foreach ($objPerson->GetAllAssociatedPhoneArray() as $objPhone) {
             if ($objPhone->Number == $strMobilePhone) {
                 $objPhone->PhoneTypeId = PhoneType::Mobile;
                 $objPhone->Save();
                 $blnFound = true;
             }
         }
         if (!$blnFound) {
             $objPhone = new Phone();
             $objPhone->Number = $strMobilePhone;
             $objPhone->PhoneTypeId = PhoneType::Mobile;
             $objPhone->Save();
             $objPerson->PrimaryPhone = $objPhone;
         }
开发者ID:alcf,项目名称:chms,代码行数:67,代码来源:ProvisionalPublicLogin.class.php


注:本文中的Phone::Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。