예제 #1
0
파일: new.php 프로젝트: alcf/chms
 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';
 }
예제 #2
0
 /**
  * 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 = '&nbsp;';
     $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 = '&nbsp;';
     $this->lstPhone->Width = '80px';
     foreach (PhoneType::$NameArray as $intPhoneTypeId => $strLabel) {
         $this->lstPhone->AddItem($strLabel, $intPhoneTypeId);
     }
     $this->lstMobileProvider = new QListBox($this->pnlCreatePerson);
     $this->lstMobileProvider->Name = '&nbsp;';
     $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);
 }
예제 #3
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objAddress) {
         $objObject->objAddress = Address::GetSoapObjectFromObject($objObject->objAddress, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intAddressId = null;
         }
     }
     if ($objObject->objPerson) {
         $objObject->objPerson = Person::GetSoapObjectFromObject($objObject->objPerson, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPersonId = null;
         }
     }
     if ($objObject->objMobileProvider) {
         $objObject->objMobileProvider = MobileProvider::GetSoapObjectFromObject($objObject->objMobileProvider, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intMobileProviderId = null;
         }
     }
     return $objObject;
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this MobileProviderMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing MobileProvider object creation - defaults to CreateOrEdit
  * @return MobileProviderMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objMobileProvider = MobileProvider::Load($intId);
         // MobileProvider was found -- return it!
         if ($objMobileProvider) {
             return new MobileProviderMetaControl($objParentObject, $objMobileProvider);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a MobileProvider object with PK arguments: ' . $intId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new MobileProviderMetaControl($objParentObject, new MobileProvider());
 }
예제 #5
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, MobileProvider::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
예제 #6
0
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = MobileProvider::QueryCount($objCondition, $objClauses);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from MobileProvider, given the clauses above
     $this->DataSource = MobileProvider::QueryArray($objCondition, $objClauses);
 }
예제 #7
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;
     }
 }