예제 #1
0
 public function lstCompany_Change()
 {
     // Clear out the items from lstAddress
     $this->lstAddress->RemoveAllItems();
     if ($this->lstCompany->SelectedValue) {
         // Load the selected company
         $objCompany = Company::Load($this->lstCompany->SelectedValue);
         // Get all available addresses for that company
         if ($objCompany) {
             $objAddressArray = $objCompany->GetAddressArray();
             $this->lstAddress->Enabled = true;
         } else {
             $objAddressArray = null;
             $this->lstAddress->Enabled = false;
         }
     } else {
         // Or load all addresses for all companies
         $objAddressArray = Address::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Address()->ShortDescription)));
         $this->lstAddress->Enabled = true;
     }
     $this->lstAddress->AddItem('- Select One -', null);
     if ($objAddressArray) {
         foreach ($objAddressArray as $objAddress) {
             $objListItem = new QListItem($objAddress->__toString(), $objAddress->AddressId);
             $this->lstAddress->AddItem($objListItem);
         }
     }
 }
 protected function lstToAddress_Create()
 {
     $this->lstToAddress = new QListBox($this);
     $this->lstToAddress->Name = QApplication::Translate('To Address');
     $this->lstToAddress->Required = true;
     if (!$this->blnEditMode) {
         $this->lstToAddress->AddItem(QApplication::Translate('- Select One -'), null);
     }
     $objToAddressArray = Address::LoadAll();
     if ($objToAddressArray) {
         foreach ($objToAddressArray as $objToAddress) {
             $objListItem = new QListItem($objToAddress->__toString(), $objToAddress->AddressId);
             if ($this->objShipment->ToAddress && $this->objShipment->ToAddress->AddressId == $objToAddress->AddressId) {
                 $objListItem->Selected = true;
             }
             $this->lstToAddress->AddItem($objListItem);
         }
     }
 }
 /**
  * Refresh this MetaControl with Data from the local Shipment object.
  * @param boolean $blnReload reload Shipment from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objShipment->Reload();
     }
     if ($this->lblShipmentId) {
         if ($this->blnEditMode) {
             $this->lblShipmentId->Text = $this->objShipment->ShipmentId;
         }
     }
     if ($this->txtShipmentNumber) {
         $this->txtShipmentNumber->Text = $this->objShipment->ShipmentNumber;
     }
     if ($this->lblShipmentNumber) {
         $this->lblShipmentNumber->Text = $this->objShipment->ShipmentNumber;
     }
     if ($this->lstTransaction) {
         $this->lstTransaction->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstTransaction->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objTransactionArray = Transaction::LoadAll();
         if ($objTransactionArray) {
             foreach ($objTransactionArray as $objTransaction) {
                 $objListItem = new QListItem($objTransaction->__toString(), $objTransaction->TransactionId);
                 if ($this->objShipment->Transaction && $this->objShipment->Transaction->TransactionId == $objTransaction->TransactionId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstTransaction->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTransactionId) {
         $this->lblTransactionId->Text = $this->objShipment->Transaction ? $this->objShipment->Transaction->__toString() : null;
     }
     if ($this->lstFromCompany) {
         $this->lstFromCompany->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstFromCompany->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objFromCompanyArray = Company::LoadAll();
         if ($objFromCompanyArray) {
             foreach ($objFromCompanyArray as $objFromCompany) {
                 $objListItem = new QListItem($objFromCompany->__toString(), $objFromCompany->CompanyId);
                 if ($this->objShipment->FromCompany && $this->objShipment->FromCompany->CompanyId == $objFromCompany->CompanyId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstFromCompany->AddItem($objListItem);
             }
         }
     }
     if ($this->lblFromCompanyId) {
         $this->lblFromCompanyId->Text = $this->objShipment->FromCompany ? $this->objShipment->FromCompany->__toString() : null;
     }
     if ($this->lstFromContact) {
         $this->lstFromContact->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstFromContact->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objFromContactArray = Contact::LoadAll();
         if ($objFromContactArray) {
             foreach ($objFromContactArray as $objFromContact) {
                 $objListItem = new QListItem($objFromContact->__toString(), $objFromContact->ContactId);
                 if ($this->objShipment->FromContact && $this->objShipment->FromContact->ContactId == $objFromContact->ContactId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstFromContact->AddItem($objListItem);
             }
         }
     }
     if ($this->lblFromContactId) {
         $this->lblFromContactId->Text = $this->objShipment->FromContact ? $this->objShipment->FromContact->__toString() : null;
     }
     if ($this->lstFromAddress) {
         $this->lstFromAddress->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstFromAddress->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objFromAddressArray = Address::LoadAll();
         if ($objFromAddressArray) {
             foreach ($objFromAddressArray as $objFromAddress) {
                 $objListItem = new QListItem($objFromAddress->__toString(), $objFromAddress->AddressId);
                 if ($this->objShipment->FromAddress && $this->objShipment->FromAddress->AddressId == $objFromAddress->AddressId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstFromAddress->AddItem($objListItem);
             }
         }
     }
     if ($this->lblFromAddressId) {
         $this->lblFromAddressId->Text = $this->objShipment->FromAddress ? $this->objShipment->FromAddress->__toString() : null;
     }
     if ($this->lstToCompany) {
         $this->lstToCompany->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstToCompany->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objToCompanyArray = Company::LoadAll();
         if ($objToCompanyArray) {
             foreach ($objToCompanyArray as $objToCompany) {
                 $objListItem = new QListItem($objToCompany->__toString(), $objToCompany->CompanyId);
                 if ($this->objShipment->ToCompany && $this->objShipment->ToCompany->CompanyId == $objToCompany->CompanyId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstToCompany->AddItem($objListItem);
             }
         }
     }
     if ($this->lblToCompanyId) {
         $this->lblToCompanyId->Text = $this->objShipment->ToCompany ? $this->objShipment->ToCompany->__toString() : null;
     }
     if ($this->lstToContact) {
         $this->lstToContact->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstToContact->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objToContactArray = Contact::LoadAll();
         if ($objToContactArray) {
             foreach ($objToContactArray as $objToContact) {
                 $objListItem = new QListItem($objToContact->__toString(), $objToContact->ContactId);
                 if ($this->objShipment->ToContact && $this->objShipment->ToContact->ContactId == $objToContact->ContactId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstToContact->AddItem($objListItem);
             }
         }
     }
     if ($this->lblToContactId) {
         $this->lblToContactId->Text = $this->objShipment->ToContact ? $this->objShipment->ToContact->__toString() : null;
     }
     if ($this->lstToAddress) {
         $this->lstToAddress->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstToAddress->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objToAddressArray = Address::LoadAll();
         if ($objToAddressArray) {
             foreach ($objToAddressArray as $objToAddress) {
                 $objListItem = new QListItem($objToAddress->__toString(), $objToAddress->AddressId);
                 if ($this->objShipment->ToAddress && $this->objShipment->ToAddress->AddressId == $objToAddress->AddressId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstToAddress->AddItem($objListItem);
             }
         }
     }
     if ($this->lblToAddressId) {
         $this->lblToAddressId->Text = $this->objShipment->ToAddress ? $this->objShipment->ToAddress->__toString() : null;
     }
     if ($this->lstCourier) {
         $this->lstCourier->RemoveAllItems();
         $this->lstCourier->AddItem(QApplication::Translate('- Select One -'), null);
         $objCourierArray = Courier::LoadAll();
         if ($objCourierArray) {
             foreach ($objCourierArray as $objCourier) {
                 $objListItem = new QListItem($objCourier->__toString(), $objCourier->CourierId);
                 if ($this->objShipment->Courier && $this->objShipment->Courier->CourierId == $objCourier->CourierId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCourier->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCourierId) {
         $this->lblCourierId->Text = $this->objShipment->Courier ? $this->objShipment->Courier->__toString() : null;
     }
     if ($this->txtTrackingNumber) {
         $this->txtTrackingNumber->Text = $this->objShipment->TrackingNumber;
     }
     if ($this->lblTrackingNumber) {
         $this->lblTrackingNumber->Text = $this->objShipment->TrackingNumber;
     }
     if ($this->calShipDate) {
         $this->calShipDate->DateTime = $this->objShipment->ShipDate;
     }
     if ($this->lblShipDate) {
         $this->lblShipDate->Text = sprintf($this->objShipment->ShipDate) ? $this->objShipment->__toString($this->strShipDateDateTimeFormat) : null;
     }
     if ($this->chkShippedFlag) {
         $this->chkShippedFlag->Checked = $this->objShipment->ShippedFlag;
     }
     if ($this->lblShippedFlag) {
         $this->lblShippedFlag->Text = $this->objShipment->ShippedFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->lstCreatedByObject) {
         $this->lstCreatedByObject->RemoveAllItems();
         $this->lstCreatedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objCreatedByObjectArray = UserAccount::LoadAll();
         if ($objCreatedByObjectArray) {
             foreach ($objCreatedByObjectArray as $objCreatedByObject) {
                 $objListItem = new QListItem($objCreatedByObject->__toString(), $objCreatedByObject->UserAccountId);
                 if ($this->objShipment->CreatedByObject && $this->objShipment->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCreatedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCreatedBy) {
         $this->lblCreatedBy->Text = $this->objShipment->CreatedByObject ? $this->objShipment->CreatedByObject->__toString() : null;
     }
     if ($this->calCreationDate) {
         $this->calCreationDate->DateTime = $this->objShipment->CreationDate;
     }
     if ($this->lblCreationDate) {
         $this->lblCreationDate->Text = sprintf($this->objShipment->CreationDate) ? $this->objShipment->__toString($this->strCreationDateDateTimeFormat) : null;
     }
     if ($this->lstModifiedByObject) {
         $this->lstModifiedByObject->RemoveAllItems();
         $this->lstModifiedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objModifiedByObjectArray = UserAccount::LoadAll();
         if ($objModifiedByObjectArray) {
             foreach ($objModifiedByObjectArray as $objModifiedByObject) {
                 $objListItem = new QListItem($objModifiedByObject->__toString(), $objModifiedByObject->UserAccountId);
                 if ($this->objShipment->ModifiedByObject && $this->objShipment->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstModifiedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblModifiedBy) {
         $this->lblModifiedBy->Text = $this->objShipment->ModifiedByObject ? $this->objShipment->ModifiedByObject->__toString() : null;
     }
     if ($this->lblModifiedDate) {
         if ($this->blnEditMode) {
             $this->lblModifiedDate->Text = $this->objShipment->ModifiedDate;
         }
     }
     if ($this->lstShipmentCustomFieldHelper) {
         $this->lstShipmentCustomFieldHelper->RemoveAllItems();
         $this->lstShipmentCustomFieldHelper->AddItem(QApplication::Translate('- Select One -'), null);
         $objShipmentCustomFieldHelperArray = ShipmentCustomFieldHelper::LoadAll();
         if ($objShipmentCustomFieldHelperArray) {
             foreach ($objShipmentCustomFieldHelperArray as $objShipmentCustomFieldHelper) {
                 $objListItem = new QListItem($objShipmentCustomFieldHelper->__toString(), $objShipmentCustomFieldHelper->ShipmentId);
                 if ($objShipmentCustomFieldHelper->ShipmentId == $this->objShipment->ShipmentId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstShipmentCustomFieldHelper->AddItem($objListItem);
             }
         }
         // Because ShipmentCustomFieldHelper's ShipmentCustomFieldHelper is not null, if a value is already selected, it cannot be changed.
         if ($this->lstShipmentCustomFieldHelper->SelectedValue) {
             $this->lstShipmentCustomFieldHelper->Enabled = false;
         } else {
             $this->lstShipmentCustomFieldHelper->Enabled = true;
         }
     }
     if ($this->lblShipmentCustomFieldHelper) {
         $this->lblShipmentCustomFieldHelper->Text = $this->objShipment->ShipmentCustomFieldHelper ? $this->objShipment->ShipmentCustomFieldHelper->__toString() : null;
     }
 }
 protected function lstAddress_Create()
 {
     $this->lstAddress = new QListBox($this);
     $this->lstAddress->Name = QApplication::Translate('Address');
     $this->lstAddress->AddItem(QApplication::Translate('- Select One -'), null);
     $objAddressArray = Address::LoadAll();
     if ($objAddressArray) {
         foreach ($objAddressArray as $objAddress) {
             $objListItem = new QListItem($objAddress->__toString(), $objAddress->AddressId);
             if ($this->objCompany->Address && $this->objCompany->Address->AddressId == $objAddress->AddressId) {
                 $objListItem->Selected = true;
             }
             $this->lstAddress->AddItem($objListItem);
         }
     }
 }
예제 #5
0
<?php

ini_set('memory_limit', '1024M');
$objMySqli = new mysqli('localhost', 'root', '', 'alcf_address');
QDataGen::DisplayForEachTaskStart('Cleaning Addresses', Address::CountAll());
foreach (Address::LoadAll() as $objAddress) {
    QDataGen::DisplayForEachTaskNext('Cleaning Addresses');
    $strQuery = sprintf("SELECT id FROM address WHERE address_1 %s AND address_2 %s AND address_3 %s AND city %s AND state %s AND zip_code %s;", is_null($objAddress->Address1) ? 'IS NULL' : "='" . $objMySqli->escape_string($objAddress->Address1) . "'", is_null($objAddress->Address2) ? 'IS NULL' : "='" . $objMySqli->escape_string($objAddress->Address2) . "'", is_null($objAddress->Address3) ? 'IS NULL' : "='" . $objMySqli->escape_string($objAddress->Address3) . "'", is_null($objAddress->City) ? 'IS NULL' : "='" . $objMySqli->escape_string($objAddress->City) . "'", is_null($objAddress->State) ? 'IS NULL' : "='" . $objMySqli->escape_string($objAddress->State) . "'", is_null($objAddress->ZipCode) ? 'IS NULL' : "='" . $objMySqli->escape_string($objAddress->ZipCode) . "'");
    $objResult = $objMySqli->Query($strQuery);
    if ($objRow = $objResult->fetch_array()) {
        $objResult = $objMySqli->Query('SELECT * FROM corrected_address WHERE address_id=' . $objRow['id']);
        $objRow = $objResult->fetch_array();
        if ($objRow['status_flag'] == 1) {
            $objAddress->Address1 = $objRow['address_1'];
            $objAddress->Address2 = $objRow['address_2'];
            $objAddress->City = $objRow['city'];
            $objAddress->State = $objRow['state'];
            $objAddress->ZipCode = $objRow['zip_code'];
            $objAddress->InvalidFlag = false;
            $objAddress->VerificationCheckedFlag = true;
        } else {
            $objAddress->InvalidFlag = true;
        }
        $objAddress->Save();
    } else {
        if (!$objAddress->ValidateUsps()) {
            print "NONE FOUND FOR - " . $objAddress->Id . "\r\n";
            $objAddress->InvalidFlag = true;
            $objAddress->Save();
        }
    }
예제 #6
0
 protected function dtgAddress_Bind()
 {
     // 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->dtgAddress->TotalItemCount = Address::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->dtgAddress->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgAddress->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be the array of all Address objects, given the clauses above
     $this->dtgAddress->DataSource = Address::LoadAll($objClauses);
 }
 /**
  * Refresh this MetaControl with Data from the local Contact object.
  * @param boolean $blnReload reload Contact from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objContact->Reload();
     }
     if ($this->lblContactId) {
         if ($this->blnEditMode) {
             $this->lblContactId->Text = $this->objContact->ContactId;
         }
     }
     if ($this->lstCompany) {
         $this->lstCompany->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstCompany->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objCompanyArray = Company::LoadAll();
         if ($objCompanyArray) {
             foreach ($objCompanyArray as $objCompany) {
                 $objListItem = new QListItem($objCompany->__toString(), $objCompany->CompanyId);
                 if ($this->objContact->Company && $this->objContact->Company->CompanyId == $objCompany->CompanyId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCompany->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCompanyId) {
         $this->lblCompanyId->Text = $this->objContact->Company ? $this->objContact->Company->__toString() : null;
     }
     if ($this->lstAddress) {
         $this->lstAddress->RemoveAllItems();
         $this->lstAddress->AddItem(QApplication::Translate('- Select One -'), null);
         $objAddressArray = Address::LoadAll();
         if ($objAddressArray) {
             foreach ($objAddressArray as $objAddress) {
                 $objListItem = new QListItem($objAddress->__toString(), $objAddress->AddressId);
                 if ($this->objContact->Address && $this->objContact->Address->AddressId == $objAddress->AddressId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAddress->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAddressId) {
         $this->lblAddressId->Text = $this->objContact->Address ? $this->objContact->Address->__toString() : null;
     }
     if ($this->txtFirstName) {
         $this->txtFirstName->Text = $this->objContact->FirstName;
     }
     if ($this->lblFirstName) {
         $this->lblFirstName->Text = $this->objContact->FirstName;
     }
     if ($this->txtLastName) {
         $this->txtLastName->Text = $this->objContact->LastName;
     }
     if ($this->lblLastName) {
         $this->lblLastName->Text = $this->objContact->LastName;
     }
     if ($this->txtTitle) {
         $this->txtTitle->Text = $this->objContact->Title;
     }
     if ($this->lblTitle) {
         $this->lblTitle->Text = $this->objContact->Title;
     }
     if ($this->txtEmail) {
         $this->txtEmail->Text = $this->objContact->Email;
     }
     if ($this->lblEmail) {
         $this->lblEmail->Text = $this->objContact->Email;
     }
     if ($this->txtPhoneOffice) {
         $this->txtPhoneOffice->Text = $this->objContact->PhoneOffice;
     }
     if ($this->lblPhoneOffice) {
         $this->lblPhoneOffice->Text = $this->objContact->PhoneOffice;
     }
     if ($this->txtPhoneHome) {
         $this->txtPhoneHome->Text = $this->objContact->PhoneHome;
     }
     if ($this->lblPhoneHome) {
         $this->lblPhoneHome->Text = $this->objContact->PhoneHome;
     }
     if ($this->txtPhoneMobile) {
         $this->txtPhoneMobile->Text = $this->objContact->PhoneMobile;
     }
     if ($this->lblPhoneMobile) {
         $this->lblPhoneMobile->Text = $this->objContact->PhoneMobile;
     }
     if ($this->txtFax) {
         $this->txtFax->Text = $this->objContact->Fax;
     }
     if ($this->lblFax) {
         $this->lblFax->Text = $this->objContact->Fax;
     }
     if ($this->txtDescription) {
         $this->txtDescription->Text = $this->objContact->Description;
     }
     if ($this->lblDescription) {
         $this->lblDescription->Text = $this->objContact->Description;
     }
     if ($this->lstCreatedByObject) {
         $this->lstCreatedByObject->RemoveAllItems();
         $this->lstCreatedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objCreatedByObjectArray = UserAccount::LoadAll();
         if ($objCreatedByObjectArray) {
             foreach ($objCreatedByObjectArray as $objCreatedByObject) {
                 $objListItem = new QListItem($objCreatedByObject->__toString(), $objCreatedByObject->UserAccountId);
                 if ($this->objContact->CreatedByObject && $this->objContact->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCreatedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCreatedBy) {
         $this->lblCreatedBy->Text = $this->objContact->CreatedByObject ? $this->objContact->CreatedByObject->__toString() : null;
     }
     if ($this->calCreationDate) {
         $this->calCreationDate->DateTime = $this->objContact->CreationDate;
     }
     if ($this->lblCreationDate) {
         $this->lblCreationDate->Text = sprintf($this->objContact->CreationDate) ? $this->objContact->__toString($this->strCreationDateDateTimeFormat) : null;
     }
     if ($this->lstModifiedByObject) {
         $this->lstModifiedByObject->RemoveAllItems();
         $this->lstModifiedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objModifiedByObjectArray = UserAccount::LoadAll();
         if ($objModifiedByObjectArray) {
             foreach ($objModifiedByObjectArray as $objModifiedByObject) {
                 $objListItem = new QListItem($objModifiedByObject->__toString(), $objModifiedByObject->UserAccountId);
                 if ($this->objContact->ModifiedByObject && $this->objContact->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstModifiedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblModifiedBy) {
         $this->lblModifiedBy->Text = $this->objContact->ModifiedByObject ? $this->objContact->ModifiedByObject->__toString() : null;
     }
     if ($this->lblModifiedDate) {
         if ($this->blnEditMode) {
             $this->lblModifiedDate->Text = $this->objContact->ModifiedDate;
         }
     }
     if ($this->lstContactCustomFieldHelper) {
         $this->lstContactCustomFieldHelper->RemoveAllItems();
         $this->lstContactCustomFieldHelper->AddItem(QApplication::Translate('- Select One -'), null);
         $objContactCustomFieldHelperArray = ContactCustomFieldHelper::LoadAll();
         if ($objContactCustomFieldHelperArray) {
             foreach ($objContactCustomFieldHelperArray as $objContactCustomFieldHelper) {
                 $objListItem = new QListItem($objContactCustomFieldHelper->__toString(), $objContactCustomFieldHelper->ContactId);
                 if ($objContactCustomFieldHelper->ContactId == $this->objContact->ContactId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstContactCustomFieldHelper->AddItem($objListItem);
             }
         }
         // Because ContactCustomFieldHelper's ContactCustomFieldHelper is not null, if a value is already selected, it cannot be changed.
         if ($this->lstContactCustomFieldHelper->SelectedValue) {
             $this->lstContactCustomFieldHelper->Enabled = false;
         } else {
             $this->lstContactCustomFieldHelper->Enabled = true;
         }
     }
     if ($this->lblContactCustomFieldHelper) {
         $this->lblContactCustomFieldHelper->Text = $this->objContact->ContactCustomFieldHelper ? $this->objContact->ContactCustomFieldHelper->__toString() : null;
     }
 }
예제 #8
0
 /**
  * Refresh this MetaControl with Data from the local FormAnswer object.
  * @param boolean $blnReload reload FormAnswer from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objFormAnswer->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objFormAnswer->Id;
         }
     }
     if ($this->lstSignupEntry) {
         $this->lstSignupEntry->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstSignupEntry->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objSignupEntryArray = SignupEntry::LoadAll();
         if ($objSignupEntryArray) {
             foreach ($objSignupEntryArray as $objSignupEntry) {
                 $objListItem = new QListItem($objSignupEntry->__toString(), $objSignupEntry->Id);
                 if ($this->objFormAnswer->SignupEntry && $this->objFormAnswer->SignupEntry->Id == $objSignupEntry->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupEntry->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupEntryId) {
         $this->lblSignupEntryId->Text = $this->objFormAnswer->SignupEntry ? $this->objFormAnswer->SignupEntry->__toString() : null;
     }
     if ($this->lstFormQuestion) {
         $this->lstFormQuestion->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstFormQuestion->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objFormQuestionArray = FormQuestion::LoadAll();
         if ($objFormQuestionArray) {
             foreach ($objFormQuestionArray as $objFormQuestion) {
                 $objListItem = new QListItem($objFormQuestion->__toString(), $objFormQuestion->Id);
                 if ($this->objFormAnswer->FormQuestion && $this->objFormAnswer->FormQuestion->Id == $objFormQuestion->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstFormQuestion->AddItem($objListItem);
             }
         }
     }
     if ($this->lblFormQuestionId) {
         $this->lblFormQuestionId->Text = $this->objFormAnswer->FormQuestion ? $this->objFormAnswer->FormQuestion->__toString() : null;
     }
     if ($this->txtTextValue) {
         $this->txtTextValue->Text = $this->objFormAnswer->TextValue;
     }
     if ($this->lblTextValue) {
         $this->lblTextValue->Text = $this->objFormAnswer->TextValue;
     }
     if ($this->lstAddress) {
         $this->lstAddress->RemoveAllItems();
         $this->lstAddress->AddItem(QApplication::Translate('- Select One -'), null);
         $objAddressArray = Address::LoadAll();
         if ($objAddressArray) {
             foreach ($objAddressArray as $objAddress) {
                 $objListItem = new QListItem($objAddress->__toString(), $objAddress->Id);
                 if ($this->objFormAnswer->Address && $this->objFormAnswer->Address->Id == $objAddress->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAddress->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAddressId) {
         $this->lblAddressId->Text = $this->objFormAnswer->Address ? $this->objFormAnswer->Address->__toString() : null;
     }
     if ($this->lstPhone) {
         $this->lstPhone->RemoveAllItems();
         $this->lstPhone->AddItem(QApplication::Translate('- Select One -'), null);
         $objPhoneArray = Phone::LoadAll();
         if ($objPhoneArray) {
             foreach ($objPhoneArray as $objPhone) {
                 $objListItem = new QListItem($objPhone->__toString(), $objPhone->Id);
                 if ($this->objFormAnswer->Phone && $this->objFormAnswer->Phone->Id == $objPhone->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPhone->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPhoneId) {
         $this->lblPhoneId->Text = $this->objFormAnswer->Phone ? $this->objFormAnswer->Phone->__toString() : null;
     }
     if ($this->lstEmail) {
         $this->lstEmail->RemoveAllItems();
         $this->lstEmail->AddItem(QApplication::Translate('- Select One -'), null);
         $objEmailArray = Email::LoadAll();
         if ($objEmailArray) {
             foreach ($objEmailArray as $objEmail) {
                 $objListItem = new QListItem($objEmail->__toString(), $objEmail->Id);
                 if ($this->objFormAnswer->Email && $this->objFormAnswer->Email->Id == $objEmail->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstEmail->AddItem($objListItem);
             }
         }
     }
     if ($this->lblEmailId) {
         $this->lblEmailId->Text = $this->objFormAnswer->Email ? $this->objFormAnswer->Email->__toString() : null;
     }
     if ($this->txtIntegerValue) {
         $this->txtIntegerValue->Text = $this->objFormAnswer->IntegerValue;
     }
     if ($this->lblIntegerValue) {
         $this->lblIntegerValue->Text = $this->objFormAnswer->IntegerValue;
     }
     if ($this->chkBooleanValue) {
         $this->chkBooleanValue->Checked = $this->objFormAnswer->BooleanValue;
     }
     if ($this->lblBooleanValue) {
         $this->lblBooleanValue->Text = $this->objFormAnswer->BooleanValue ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->calDateValue) {
         $this->calDateValue->DateTime = $this->objFormAnswer->DateValue;
     }
     if ($this->lblDateValue) {
         $this->lblDateValue->Text = sprintf($this->objFormAnswer->DateValue) ? $this->objFormAnswer->__toString($this->strDateValueDateTimeFormat) : null;
     }
 }
 public function dtgAddress_Bind()
 {
     // Get Total Count b/c of Pagination
     $this->dtgAddress->TotalItemCount = Address::CountAll();
     $objClauses = array();
     if ($objClause = $this->dtgAddress->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = $this->dtgAddress->LimitClause) {
         array_push($objClauses, $objClause);
     }
     $this->dtgAddress->DataSource = Address::LoadAll($objClauses);
 }
예제 #10
0
 /**
  * Refresh this MetaControl with Data from the local Person object.
  * @param boolean $blnReload reload Person from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objPerson->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objPerson->Id;
         }
     }
     if ($this->lstMembershipStatusType) {
         $this->lstMembershipStatusType->SelectedValue = $this->objPerson->MembershipStatusTypeId;
     }
     if ($this->lblMembershipStatusTypeId) {
         $this->lblMembershipStatusTypeId->Text = $this->objPerson->MembershipStatusTypeId ? MembershipStatusType::$NameArray[$this->objPerson->MembershipStatusTypeId] : null;
     }
     if ($this->lstMaritalStatusType) {
         $this->lstMaritalStatusType->SelectedValue = $this->objPerson->MaritalStatusTypeId;
     }
     if ($this->lblMaritalStatusTypeId) {
         $this->lblMaritalStatusTypeId->Text = $this->objPerson->MaritalStatusTypeId ? MaritalStatusType::$NameArray[$this->objPerson->MaritalStatusTypeId] : null;
     }
     if ($this->txtFirstName) {
         $this->txtFirstName->Text = $this->objPerson->FirstName;
     }
     if ($this->lblFirstName) {
         $this->lblFirstName->Text = $this->objPerson->FirstName;
     }
     if ($this->txtMiddleName) {
         $this->txtMiddleName->Text = $this->objPerson->MiddleName;
     }
     if ($this->lblMiddleName) {
         $this->lblMiddleName->Text = $this->objPerson->MiddleName;
     }
     if ($this->txtLastName) {
         $this->txtLastName->Text = $this->objPerson->LastName;
     }
     if ($this->lblLastName) {
         $this->lblLastName->Text = $this->objPerson->LastName;
     }
     if ($this->txtMailingLabel) {
         $this->txtMailingLabel->Text = $this->objPerson->MailingLabel;
     }
     if ($this->lblMailingLabel) {
         $this->lblMailingLabel->Text = $this->objPerson->MailingLabel;
     }
     if ($this->txtPriorLastNames) {
         $this->txtPriorLastNames->Text = $this->objPerson->PriorLastNames;
     }
     if ($this->lblPriorLastNames) {
         $this->lblPriorLastNames->Text = $this->objPerson->PriorLastNames;
     }
     if ($this->txtNickname) {
         $this->txtNickname->Text = $this->objPerson->Nickname;
     }
     if ($this->lblNickname) {
         $this->lblNickname->Text = $this->objPerson->Nickname;
     }
     if ($this->txtTitle) {
         $this->txtTitle->Text = $this->objPerson->Title;
     }
     if ($this->lblTitle) {
         $this->lblTitle->Text = $this->objPerson->Title;
     }
     if ($this->txtSuffix) {
         $this->txtSuffix->Text = $this->objPerson->Suffix;
     }
     if ($this->lblSuffix) {
         $this->lblSuffix->Text = $this->objPerson->Suffix;
     }
     if ($this->txtGender) {
         $this->txtGender->Text = $this->objPerson->Gender;
     }
     if ($this->lblGender) {
         $this->lblGender->Text = $this->objPerson->Gender;
     }
     if ($this->calDateOfBirth) {
         $this->calDateOfBirth->DateTime = $this->objPerson->DateOfBirth;
     }
     if ($this->lblDateOfBirth) {
         $this->lblDateOfBirth->Text = sprintf($this->objPerson->DateOfBirth) ? $this->objPerson->__toString($this->strDateOfBirthDateTimeFormat) : null;
     }
     if ($this->chkDobYearApproximateFlag) {
         $this->chkDobYearApproximateFlag->Checked = $this->objPerson->DobYearApproximateFlag;
     }
     if ($this->lblDobYearApproximateFlag) {
         $this->lblDobYearApproximateFlag->Text = $this->objPerson->DobYearApproximateFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkDobGuessedFlag) {
         $this->chkDobGuessedFlag->Checked = $this->objPerson->DobGuessedFlag;
     }
     if ($this->lblDobGuessedFlag) {
         $this->lblDobGuessedFlag->Text = $this->objPerson->DobGuessedFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->txtAge) {
         $this->txtAge->Text = $this->objPerson->Age;
     }
     if ($this->lblAge) {
         $this->lblAge->Text = $this->objPerson->Age;
     }
     if ($this->chkDeceasedFlag) {
         $this->chkDeceasedFlag->Checked = $this->objPerson->DeceasedFlag;
     }
     if ($this->lblDeceasedFlag) {
         $this->lblDeceasedFlag->Text = $this->objPerson->DeceasedFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->calDateDeceased) {
         $this->calDateDeceased->DateTime = $this->objPerson->DateDeceased;
     }
     if ($this->lblDateDeceased) {
         $this->lblDateDeceased->Text = sprintf($this->objPerson->DateDeceased) ? $this->objPerson->__toString($this->strDateDeceasedDateTimeFormat) : null;
     }
     if ($this->lstCurrentHeadShot) {
         $this->lstCurrentHeadShot->RemoveAllItems();
         $this->lstCurrentHeadShot->AddItem(QApplication::Translate('- Select One -'), null);
         $objCurrentHeadShotArray = HeadShot::LoadAll();
         if ($objCurrentHeadShotArray) {
             foreach ($objCurrentHeadShotArray as $objCurrentHeadShot) {
                 $objListItem = new QListItem($objCurrentHeadShot->__toString(), $objCurrentHeadShot->Id);
                 if ($this->objPerson->CurrentHeadShot && $this->objPerson->CurrentHeadShot->Id == $objCurrentHeadShot->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCurrentHeadShot->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCurrentHeadShotId) {
         $this->lblCurrentHeadShotId->Text = $this->objPerson->CurrentHeadShot ? $this->objPerson->CurrentHeadShot->__toString() : null;
     }
     if ($this->lstMailingAddress) {
         $this->lstMailingAddress->RemoveAllItems();
         $this->lstMailingAddress->AddItem(QApplication::Translate('- Select One -'), null);
         $objMailingAddressArray = Address::LoadAll();
         if ($objMailingAddressArray) {
             foreach ($objMailingAddressArray as $objMailingAddress) {
                 $objListItem = new QListItem($objMailingAddress->__toString(), $objMailingAddress->Id);
                 if ($this->objPerson->MailingAddress && $this->objPerson->MailingAddress->Id == $objMailingAddress->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstMailingAddress->AddItem($objListItem);
             }
         }
     }
     if ($this->lblMailingAddressId) {
         $this->lblMailingAddressId->Text = $this->objPerson->MailingAddress ? $this->objPerson->MailingAddress->__toString() : null;
     }
     if ($this->lstStewardshipAddress) {
         $this->lstStewardshipAddress->RemoveAllItems();
         $this->lstStewardshipAddress->AddItem(QApplication::Translate('- Select One -'), null);
         $objStewardshipAddressArray = Address::LoadAll();
         if ($objStewardshipAddressArray) {
             foreach ($objStewardshipAddressArray as $objStewardshipAddress) {
                 $objListItem = new QListItem($objStewardshipAddress->__toString(), $objStewardshipAddress->Id);
                 if ($this->objPerson->StewardshipAddress && $this->objPerson->StewardshipAddress->Id == $objStewardshipAddress->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstStewardshipAddress->AddItem($objListItem);
             }
         }
     }
     if ($this->lblStewardshipAddressId) {
         $this->lblStewardshipAddressId->Text = $this->objPerson->StewardshipAddress ? $this->objPerson->StewardshipAddress->__toString() : null;
     }
     if ($this->lstPrimaryPhone) {
         $this->lstPrimaryPhone->RemoveAllItems();
         $this->lstPrimaryPhone->AddItem(QApplication::Translate('- Select One -'), null);
         $objPrimaryPhoneArray = Phone::LoadAll();
         if ($objPrimaryPhoneArray) {
             foreach ($objPrimaryPhoneArray as $objPrimaryPhone) {
                 $objListItem = new QListItem($objPrimaryPhone->__toString(), $objPrimaryPhone->Id);
                 if ($this->objPerson->PrimaryPhone && $this->objPerson->PrimaryPhone->Id == $objPrimaryPhone->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPrimaryPhone->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPrimaryPhoneId) {
         $this->lblPrimaryPhoneId->Text = $this->objPerson->PrimaryPhone ? $this->objPerson->PrimaryPhone->__toString() : null;
     }
     if ($this->lstPrimaryEmail) {
         $this->lstPrimaryEmail->RemoveAllItems();
         $this->lstPrimaryEmail->AddItem(QApplication::Translate('- Select One -'), null);
         $objPrimaryEmailArray = Email::LoadAll();
         if ($objPrimaryEmailArray) {
             foreach ($objPrimaryEmailArray as $objPrimaryEmail) {
                 $objListItem = new QListItem($objPrimaryEmail->__toString(), $objPrimaryEmail->Id);
                 if ($this->objPerson->PrimaryEmail && $this->objPerson->PrimaryEmail->Id == $objPrimaryEmail->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPrimaryEmail->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPrimaryEmailId) {
         $this->lblPrimaryEmailId->Text = $this->objPerson->PrimaryEmail ? $this->objPerson->PrimaryEmail->__toString() : null;
     }
     if ($this->chkCanMailFlag) {
         $this->chkCanMailFlag->Checked = $this->objPerson->CanMailFlag;
     }
     if ($this->lblCanMailFlag) {
         $this->lblCanMailFlag->Text = $this->objPerson->CanMailFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkCanPhoneFlag) {
         $this->chkCanPhoneFlag->Checked = $this->objPerson->CanPhoneFlag;
     }
     if ($this->lblCanPhoneFlag) {
         $this->lblCanPhoneFlag->Text = $this->objPerson->CanPhoneFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkCanEmailFlag) {
         $this->chkCanEmailFlag->Checked = $this->objPerson->CanEmailFlag;
     }
     if ($this->lblCanEmailFlag) {
         $this->lblCanEmailFlag->Text = $this->objPerson->CanEmailFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->txtPrimaryAddressText) {
         $this->txtPrimaryAddressText->Text = $this->objPerson->PrimaryAddressText;
     }
     if ($this->lblPrimaryAddressText) {
         $this->lblPrimaryAddressText->Text = $this->objPerson->PrimaryAddressText;
     }
     if ($this->txtPrimaryCityText) {
         $this->txtPrimaryCityText->Text = $this->objPerson->PrimaryCityText;
     }
     if ($this->lblPrimaryCityText) {
         $this->lblPrimaryCityText->Text = $this->objPerson->PrimaryCityText;
     }
     if ($this->txtPrimaryStateText) {
         $this->txtPrimaryStateText->Text = $this->objPerson->PrimaryStateText;
     }
     if ($this->lblPrimaryStateText) {
         $this->lblPrimaryStateText->Text = $this->objPerson->PrimaryStateText;
     }
     if ($this->txtPrimaryZipCodeText) {
         $this->txtPrimaryZipCodeText->Text = $this->objPerson->PrimaryZipCodeText;
     }
     if ($this->lblPrimaryZipCodeText) {
         $this->lblPrimaryZipCodeText->Text = $this->objPerson->PrimaryZipCodeText;
     }
     if ($this->txtPrimaryPhoneText) {
         $this->txtPrimaryPhoneText->Text = $this->objPerson->PrimaryPhoneText;
     }
     if ($this->lblPrimaryPhoneText) {
         $this->lblPrimaryPhoneText->Text = $this->objPerson->PrimaryPhoneText;
     }
     if ($this->chkPublicCreationFlag) {
         $this->chkPublicCreationFlag->Checked = $this->objPerson->PublicCreationFlag;
     }
     if ($this->lblPublicCreationFlag) {
         $this->lblPublicCreationFlag->Text = $this->objPerson->PublicCreationFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->lstCoPrimaryObject) {
         $this->lstCoPrimaryObject->RemoveAllItems();
         $this->lstCoPrimaryObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objCoPrimaryObjectArray = Person::LoadAll();
         if ($objCoPrimaryObjectArray) {
             foreach ($objCoPrimaryObjectArray as $objCoPrimaryObject) {
                 $objListItem = new QListItem($objCoPrimaryObject->__toString(), $objCoPrimaryObject->Id);
                 if ($this->objPerson->CoPrimaryObject && $this->objPerson->CoPrimaryObject->Id == $objCoPrimaryObject->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCoPrimaryObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCoPrimary) {
         $this->lblCoPrimary->Text = $this->objPerson->CoPrimaryObject ? $this->objPerson->CoPrimaryObject->__toString() : null;
     }
     if ($this->lstHouseholdAsHead) {
         $this->lstHouseholdAsHead->RemoveAllItems();
         $this->lstHouseholdAsHead->AddItem(QApplication::Translate('- Select One -'), null);
         $objHouseholdArray = Household::LoadAll();
         if ($objHouseholdArray) {
             foreach ($objHouseholdArray as $objHousehold) {
                 $objListItem = new QListItem($objHousehold->__toString(), $objHousehold->Id);
                 if ($objHousehold->HeadPersonId == $this->objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstHouseholdAsHead->AddItem($objListItem);
             }
         }
         // Because Household's HouseholdAsHead is not null, if a value is already selected, it cannot be changed.
         if ($this->lstHouseholdAsHead->SelectedValue) {
             $this->lstHouseholdAsHead->Enabled = false;
         } else {
             $this->lstHouseholdAsHead->Enabled = true;
         }
     }
     if ($this->lblHouseholdAsHead) {
         $this->lblHouseholdAsHead->Text = $this->objPerson->HouseholdAsHead ? $this->objPerson->HouseholdAsHead->__toString() : null;
     }
     if ($this->lstPublicLogin) {
         $this->lstPublicLogin->RemoveAllItems();
         $this->lstPublicLogin->AddItem(QApplication::Translate('- Select One -'), null);
         $objPublicLoginArray = PublicLogin::LoadAll();
         if ($objPublicLoginArray) {
             foreach ($objPublicLoginArray as $objPublicLogin) {
                 $objListItem = new QListItem($objPublicLogin->__toString(), $objPublicLogin->Id);
                 if ($objPublicLogin->PersonId == $this->objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPublicLogin->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPublicLogin) {
         $this->lblPublicLogin->Text = $this->objPerson->PublicLogin ? $this->objPerson->PublicLogin->__toString() : null;
     }
     if ($this->lstCheckingAccountLookups) {
         $this->lstCheckingAccountLookups->RemoveAllItems();
         $objAssociatedArray = $this->objPerson->GetCheckingAccountLookupArray();
         $objCheckingAccountLookupArray = CheckingAccountLookup::LoadAll();
         if ($objCheckingAccountLookupArray) {
             foreach ($objCheckingAccountLookupArray as $objCheckingAccountLookup) {
                 $objListItem = new QListItem($objCheckingAccountLookup->__toString(), $objCheckingAccountLookup->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objCheckingAccountLookup->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstCheckingAccountLookups->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCheckingAccountLookups) {
         $objAssociatedArray = $this->objPerson->GetCheckingAccountLookupArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblCheckingAccountLookups->Text = implode($strGlue, $strItems);
     }
     if ($this->lstCommunicationLists) {
         $this->lstCommunicationLists->RemoveAllItems();
         $objAssociatedArray = $this->objPerson->GetCommunicationListArray();
         $objCommunicationListArray = CommunicationList::LoadAll();
         if ($objCommunicationListArray) {
             foreach ($objCommunicationListArray as $objCommunicationList) {
                 $objListItem = new QListItem($objCommunicationList->__toString(), $objCommunicationList->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objCommunicationList->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstCommunicationLists->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCommunicationLists) {
         $objAssociatedArray = $this->objPerson->GetCommunicationListArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblCommunicationLists->Text = implode($strGlue, $strItems);
     }
     if ($this->lstNameItems) {
         $this->lstNameItems->RemoveAllItems();
         $objAssociatedArray = $this->objPerson->GetNameItemArray();
         $objNameItemArray = NameItem::LoadAll();
         if ($objNameItemArray) {
             foreach ($objNameItemArray as $objNameItem) {
                 $objListItem = new QListItem($objNameItem->__toString(), $objNameItem->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objNameItem->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstNameItems->AddItem($objListItem);
             }
         }
     }
     if ($this->lblNameItems) {
         $objAssociatedArray = $this->objPerson->GetNameItemArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblNameItems->Text = implode($strGlue, $strItems);
     }
 }
 /**
  * Refresh this MetaControl with Data from the local AddressCustomFieldHelper object.
  * @param boolean $blnReload reload AddressCustomFieldHelper from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objAddressCustomFieldHelper->Reload();
     }
     if ($this->lstAddress) {
         $this->lstAddress->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstAddress->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objAddressArray = Address::LoadAll();
         if ($objAddressArray) {
             foreach ($objAddressArray as $objAddress) {
                 $objListItem = new QListItem($objAddress->__toString(), $objAddress->AddressId);
                 if ($this->objAddressCustomFieldHelper->Address && $this->objAddressCustomFieldHelper->Address->AddressId == $objAddress->AddressId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAddress->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAddressId) {
         $this->lblAddressId->Text = $this->objAddressCustomFieldHelper->Address ? $this->objAddressCustomFieldHelper->Address->__toString() : null;
     }
 }
예제 #12
0
 /**
  * Refresh this MetaControl with Data from the local Phone object.
  * @param boolean $blnReload reload Phone from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objPhone->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objPhone->Id;
         }
     }
     if ($this->lstPhoneType) {
         $this->lstPhoneType->SelectedValue = $this->objPhone->PhoneTypeId;
     }
     if ($this->lblPhoneTypeId) {
         $this->lblPhoneTypeId->Text = $this->objPhone->PhoneTypeId ? PhoneType::$NameArray[$this->objPhone->PhoneTypeId] : null;
     }
     if ($this->lstAddress) {
         $this->lstAddress->RemoveAllItems();
         $this->lstAddress->AddItem(QApplication::Translate('- Select One -'), null);
         $objAddressArray = Address::LoadAll();
         if ($objAddressArray) {
             foreach ($objAddressArray as $objAddress) {
                 $objListItem = new QListItem($objAddress->__toString(), $objAddress->Id);
                 if ($this->objPhone->Address && $this->objPhone->Address->Id == $objAddress->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAddress->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAddressId) {
         $this->lblAddressId->Text = $this->objPhone->Address ? $this->objPhone->Address->__toString() : null;
     }
     if ($this->lstPerson) {
         $this->lstPerson->RemoveAllItems();
         $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->objPhone->Person && $this->objPhone->Person->Id == $objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPersonId) {
         $this->lblPersonId->Text = $this->objPhone->Person ? $this->objPhone->Person->__toString() : null;
     }
     if ($this->lstMobileProvider) {
         $this->lstMobileProvider->RemoveAllItems();
         $this->lstMobileProvider->AddItem(QApplication::Translate('- Select One -'), null);
         $objMobileProviderArray = MobileProvider::LoadAll();
         if ($objMobileProviderArray) {
             foreach ($objMobileProviderArray as $objMobileProvider) {
                 $objListItem = new QListItem($objMobileProvider->__toString(), $objMobileProvider->Id);
                 if ($this->objPhone->MobileProvider && $this->objPhone->MobileProvider->Id == $objMobileProvider->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstMobileProvider->AddItem($objListItem);
             }
         }
     }
     if ($this->lblMobileProviderId) {
         $this->lblMobileProviderId->Text = $this->objPhone->MobileProvider ? $this->objPhone->MobileProvider->__toString() : null;
     }
     if ($this->txtNumber) {
         $this->txtNumber->Text = $this->objPhone->Number;
     }
     if ($this->lblNumber) {
         $this->lblNumber->Text = $this->objPhone->Number;
     }
 }
예제 #13
0
	<div class='text-recherche'>
		<h1> Trouvez votre medecin </h1>
		<p> Et prenez rendez vous immédiatement </p>
		<div class="form-recherche">
			<form  method="post" action="traitement.php">
				<input type="text" name="spe" placeholder="Spécialité">
				<input type="text" name="ville" placeholder="Ville">
				<input type="text" name="adresse" id="pac-input" placeholder="Adresse" onFocus="geolocate()">
				<input type="submit" name="Rechercher" value="Rechercher" /><!--onclick="popupGPS()"--> 
			</form>
		</div>
	</div>

<?php 
$geocoder = "http://maps.googleapis.com/maps/api/geocode/json?address=%s&sensor=false";
$arrAddresses = Address::LoadAll();
// Notre collection d'objets Address
foreach ($arrAddresses as $address) {
    if (strlen($address->Lat) == 0 && strlen($address->Lng) == 0) {
        $adresse = $address->Rue;
        $adresse .= ', ' . $address->CodePostal;
        $adresse .= ', ' . $address->Ville;
        // Requête envoyée à l'API Geocoding
        $query = sprintf($geocoder, urlencode(utf8_encode($adresse)));
        $result = json_decode(file_get_contents($query));
        $json = $result->results[0];
        $adress->Lat = (string) $json->geometry->location->lat;
        $adress->Lng = (string) $json->geometry->location->lng;
        $adress->Save();
    }
}