/**
  * 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 EventSignupFormMetaControl
  * @param integer $intSignupFormId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing EventSignupForm object creation - defaults to CreateOrEdit
  * @return EventSignupFormMetaControl
  */
 public static function Create($objParentObject, $intSignupFormId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intSignupFormId)) {
         $objEventSignupForm = EventSignupForm::Load($intSignupFormId);
         // EventSignupForm was found -- return it!
         if ($objEventSignupForm) {
             return new EventSignupFormMetaControl($objParentObject, $objEventSignupForm);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a EventSignupForm object with PK arguments: ' . $intSignupFormId);
             }
         }
         // 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 EventSignupFormMetaControl($objParentObject, new EventSignupForm());
 }
Ejemplo n.º 2
0
 /**
  * This will save this object's SignupForm instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveSignupForm()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstSignupFormType) {
             $this->objSignupForm->SignupFormTypeId = $this->lstSignupFormType->SelectedValue;
         }
         if ($this->lstMinistry) {
             $this->objSignupForm->MinistryId = $this->lstMinistry->SelectedValue;
         }
         if ($this->txtName) {
             $this->objSignupForm->Name = $this->txtName->Text;
         }
         if ($this->txtToken) {
             $this->objSignupForm->Token = $this->txtToken->Text;
         }
         if ($this->chkActiveFlag) {
             $this->objSignupForm->ActiveFlag = $this->chkActiveFlag->Checked;
         }
         if ($this->chkConfidentialFlag) {
             $this->objSignupForm->ConfidentialFlag = $this->chkConfidentialFlag->Checked;
         }
         if ($this->txtDescription) {
             $this->objSignupForm->Description = $this->txtDescription->Text;
         }
         if ($this->txtInformationUrl) {
             $this->objSignupForm->InformationUrl = $this->txtInformationUrl->Text;
         }
         if ($this->txtSupportEmail) {
             $this->objSignupForm->SupportEmail = $this->txtSupportEmail->Text;
         }
         if ($this->txtEmailNotification) {
             $this->objSignupForm->EmailNotification = $this->txtEmailNotification->Text;
         }
         if ($this->chkAllowOtherFlag) {
             $this->objSignupForm->AllowOtherFlag = $this->chkAllowOtherFlag->Checked;
         }
         if ($this->chkAllowMultipleFlag) {
             $this->objSignupForm->AllowMultipleFlag = $this->chkAllowMultipleFlag->Checked;
         }
         if ($this->txtSignupLimit) {
             $this->objSignupForm->SignupLimit = $this->txtSignupLimit->Text;
         }
         if ($this->txtSignupMaleLimit) {
             $this->objSignupForm->SignupMaleLimit = $this->txtSignupMaleLimit->Text;
         }
         if ($this->txtSignupFemaleLimit) {
             $this->objSignupForm->SignupFemaleLimit = $this->txtSignupFemaleLimit->Text;
         }
         if ($this->txtFundingAccount) {
             $this->objSignupForm->FundingAccount = $this->txtFundingAccount->Text;
         }
         if ($this->lstDonationStewardshipFund) {
             $this->objSignupForm->DonationStewardshipFundId = $this->lstDonationStewardshipFund->SelectedValue;
         }
         if ($this->calDateCreated) {
             $this->objSignupForm->DateCreated = $this->calDateCreated->DateTime;
         }
         if ($this->chkLoginNotRequiredFlag) {
             $this->objSignupForm->LoginNotRequiredFlag = $this->chkLoginNotRequiredFlag->Checked;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstClassMeeting) {
             $this->objSignupForm->ClassMeeting = ClassMeeting::Load($this->lstClassMeeting->SelectedValue);
         }
         if ($this->lstEventSignupForm) {
             $this->objSignupForm->EventSignupForm = EventSignupForm::Load($this->lstEventSignupForm->SelectedValue);
         }
         // Save the SignupForm object
         $this->objSignupForm->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
Ejemplo n.º 3
0
 /**
  * Reload this EventSignupForm from the database.
  * @return void
  */
 public function Reload()
 {
     // Make sure we are actually Restored from the database
     if (!$this->__blnRestored) {
         throw new QCallerException('Cannot call Reload() on a new, unsaved EventSignupForm object.');
     }
     // Reload the Object
     $objReloaded = EventSignupForm::Load($this->intSignupFormId);
     // Update $this's local variables to match
     $this->SignupFormId = $objReloaded->SignupFormId;
     $this->__intSignupFormId = $this->intSignupFormId;
     $this->dttDateStart = $objReloaded->dttDateStart;
     $this->dttDateEnd = $objReloaded->dttDateEnd;
     $this->strLocation = $objReloaded->strLocation;
 }