protected function CreateControlsForSpouse() { // Fields for "Spouse" $this->txtSpouseFirstName = $this->mctSpouse->txtFirstName_Create(); $this->txtSpouseMiddleName = $this->mctSpouse->txtMiddleName_Create(); $this->txtSpouseLastName = $this->mctSpouse->txtLastName_Create(); $this->txtSpouseSuffix = $this->mctSpouse->txtSuffix_Create(); $this->txtSpouseNickname = $this->mctSpouse->txtNickname_Create(); $this->txtSpousePriorLastNames = $this->mctSpouse->txtPriorLastNames_Create(); $this->lstSpouseGender = $this->mctSpouse->lstGender_Create(); $this->dtxSpouseDateOfBirth = $this->mctSpouse->dtxDateOfBirth_Create(); $this->calSpouseDateOfBirth = $this->mctSpouse->calDateOfBirth_Create(); $this->txtSpouseHomePhone = new PhoneTextBox($this); $this->txtSpouseHomePhone->Name = 'Home Phone'; $this->txtSpouseCellPhone = new PhoneTextBox($this); $this->txtSpouseCellPhone->Name = 'Mobile Phone'; $this->txtSpouseWorkPhone = new PhoneTextBox($this); $this->txtSpouseWorkPhone->Name = 'Work Phone'; $this->lstSpouseMobileProvider = new QListBox($this); $this->lstSpouseMobileProvider->Name = 'Mobile Provider'; $this->lstSpouseMobileProvider->AddItem('- Select One -', null); foreach (MobileProvider::LoadAll(QQ::OrderBy(QQN::MobileProvider()->Name)) as $objMobileProvider) { $this->lstSpouseMobileProvider->AddItem($objMobileProvider->Name, $objMobileProvider->Id); } $this->txtSpouseEmail = new QEmailTextBox($this); $this->txtSpouseEmail->Name = 'Email Address'; }
/** * Constructor for this control * @param mixed $objParentObject Parent QForm or QControl that is responsible for rendering this control * @param string $strControlId optional control ID */ public function __construct($objParentObject, $strControlId = null) { try { parent::__construct($objParentObject, $strControlId); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } $this->strTemplate = dirname(__FILE__) . '/SelectPersonPanel.tpl.php'; $this->txtName = new QTextBox($this); $this->txtName->Name = 'Name'; $this->txtName->AddAction(new QFocusEvent(), new QAjaxControlAction($this, 'txtName_Focus')); $this->txtName->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'txtName_Change')); $this->txtName->AddAction(new QEnterKeyEvent(), new QAjaxControlAction($this, 'txtName_Change')); $this->txtName->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->dtgResults = new QDataGrid($this, 'selectPersonPanel'); $this->dtgResults->Name = ' '; $this->dtgResults->AddColumn(new QDataGridColumn('', '<?= $_CONTROL->ParentControl->RenderSelect($_ITEM); ?>', 'HtmlEntities=false', 'Width=24px')); $this->dtgResults->AddColumn(new QDataGridColumn('Name', '<?= $_CONTROL->ParentControl->RenderName($_ITEM); ?>', 'HtmlEntities=false', 'Width=150px')); $this->dtgResults->AddColumn(new QDataGridColumn('Address', '<?= $_ITEM->PrimaryAddressText; ?><?= ($_ITEM->PrimaryCityText) ? ", " . $_ITEM->PrimaryCityText : null; ?>', 'Width=350px')); $this->dtgResults->AddColumn(new QDataGridColumn('Phone', '<?= $_ITEM->PrimaryPhoneText; ?>', 'Width=100px')); $this->dtgResults->Visible = false; $this->dtgResults->SetDataBinder('dtgResults_Bind', $this); $this->btnCreatePerson = new QButton($this); $this->btnCreatePerson->Text = 'Create as a New Person'; $this->btnCreatePerson->CssClass = 'primary'; $this->btnCreatePerson->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCreatePerson_Click')); $this->pnlCreatePerson = new QPanel($this); $this->pnlCreatePerson->Name = ' '; $this->pnlCreatePerson->Visible = false; $this->pnlCreatePerson->CssClass = 'createPersonPanel'; $this->pnlCreatePerson->Template = dirname(__FILE__) . '/SelectPersonPanel_CreatePersonPanel.tpl.php'; $this->txtFirstName = new QTextBox($this->pnlCreatePerson); $this->txtFirstName->Name = 'First Name'; $this->txtFirstName->Required = true; $this->txtLastName = new QTextBox($this->pnlCreatePerson); $this->txtLastName->Name = 'Last Name'; $this->txtLastName->Required = true; $this->lstGender = new QListBox($this->pnlCreatePerson); $this->lstGender->Name = 'Gender'; $this->lstGender->AddItem('- Select One -', null); $this->lstGender->AddItem('Female', 'F'); $this->lstGender->AddItem('Male', 'M'); $this->txtEmail = new QEmailTextBox($this->pnlCreatePerson); $this->txtEmail->Name = 'Email'; $this->txtPhone = new PhoneTextBox($this->pnlCreatePerson); $this->txtPhone->Name = 'Phone'; $this->txtPhone->Width = '160px'; $this->lstPhone = new QListBox($this->pnlCreatePerson); $this->lstPhone->Name = ' '; $this->lstPhone->Width = '80px'; foreach (PhoneType::$NameArray as $intPhoneTypeId => $strLabel) { $this->lstPhone->AddItem($strLabel, $intPhoneTypeId); } $this->lstMobileProvider = new QListBox($this->pnlCreatePerson); $this->lstMobileProvider->Name = ' '; $this->lstMobileProvider->Width = '150px'; $this->lstMobileProvider->AddItem('- Select One -', null); foreach (MobileProvider::LoadAll(QQ::OrderBy(QQN::MobileProvider()->Name)) as $objMobileProvider) { $this->lstMobileProvider->AddItem($objMobileProvider->Name, $objMobileProvider->Id); } $this->lstPhone->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'lstPhone_Change')); $this->lstPhone_Change(); $this->dtxDateOfBirth = new QDateTimeTextBox($this->pnlCreatePerson); $this->dtxDateOfBirth->Name = 'Date of Birth'; $this->calDateOfBirth = new QCalendar($this->pnlCreatePerson, $this->dtxDateOfBirth); $this->dtxDateOfBirth->RemoveAllActions(QClickEvent::EventName); }
/** * 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; } }