コード例 #1
0
ファイル: confirmation.php プロジェクト: alcf/chms
 protected function Form_Create()
 {
     // Attempt to load by Token and then by ID
     $this->objSignupForm = SignupForm::LoadByToken(QApplication::PathInfo(0));
     if (!$this->objSignupForm) {
         $this->objSignupForm = SignupForm::Load(QApplication::PathInfo(0));
     }
     // Ensure it is the correct type and it exists
     if (!$this->objSignupForm) {
         $this->strHtmlIncludeFilePath = '_notfound.tpl.php';
         return;
     }
     $this->strPageTitle = $this->objSignupForm->Name . ' - Confirmation';
     // Ensure it is Active
     if (!$this->objSignupForm->ActiveFlag) {
         $this->strHtmlIncludeFilePath = '_notactive.tpl.php';
         return;
     }
     // Get the SignupEntry
     $this->objSignupEntry = SignupEntry::Load(QApplication::PathInfo(1));
     // Ensure it is correct for the form and the signup person
     if ($this->objSignupEntry->SignupByPersonId) {
         if (!$this->objSignupEntry || $this->objSignupEntry->SignupFormId != $this->objSignupForm->Id || $this->objSignupEntry->SignupByPersonId != QApplication::$PublicLogin->PersonId || $this->objSignupEntry->SignupEntryStatusTypeId != SignupEntryStatusType::Complete) {
             $this->strHtmlIncludeFilePath = '_notfound.tpl.php';
             return;
         }
     } else {
         if (!$this->objSignupEntry || $this->objSignupEntry->SignupFormId != $this->objSignupForm->Id || !$this->objSignupEntry->CommunicationsEntryId || $this->objSignupEntry->SignupEntryStatusTypeId != SignupEntryStatusType::Complete) {
             $this->strHtmlIncludeFilePath = '_notfound.tpl.php';
             return;
         }
     }
 }
コード例 #2
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objSignupEntry) {
         $objObject->objSignupEntry = SignupEntry::GetSoapObjectFromObject($objObject->objSignupEntry, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intSignupEntryId = null;
         }
     }
     if ($objObject->objClassMeeting) {
         $objObject->objClassMeeting = ClassMeeting::GetSoapObjectFromObject($objObject->objClassMeeting, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intClassMeetingId = null;
         }
     }
     if ($objObject->objPerson) {
         $objObject->objPerson = Person::GetSoapObjectFromObject($objObject->objPerson, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPersonId = null;
         }
     }
     if ($objObject->objClassGrade) {
         $objObject->objClassGrade = ClassGrade::GetSoapObjectFromObject($objObject->objClassGrade, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intClassGradeId = null;
         }
     }
     return $objObject;
 }
コード例 #3
0
ファイル: new_signup.php プロジェクト: alcf/chms
 protected function btnDialogOkay_Click()
 {
     $objPerson = $this->pnlSelectPerson->Person;
     // Try and find any INCOMPLETE one for this person and redirect to there
     $objSignupEntryArray = SignupEntry::QueryArray(QQ::AndCondition(QQ::Equal(QQN::SignupEntry()->SignupFormId, $this->objSignupForm->Id), QQ::Equal(QQN::SignupEntry()->PersonId, $objPerson->Id)));
     foreach ($objSignupEntryArray as $objSignupEntry) {
         switch ($objSignupEntry->SignupEntryStatusTypeId) {
             case SignupEntryStatusType::Incomplete:
                 QApplication::Redirect(sprintf('/events/result.php/%s/%s', $this->objSignupForm->Id, $objSignupEntry->Id));
                 return;
         }
     }
     // If we are here ,then no incompletes were found -- go ahead and create and redirect to a new one
     $this->CreateAndRedirect($objPerson);
 }
コード例 #4
0
ファイル: FormAnswerGen.class.php プロジェクト: alcf/chms
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objSignupEntry) {
         $objObject->objSignupEntry = SignupEntry::GetSoapObjectFromObject($objObject->objSignupEntry, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intSignupEntryId = null;
         }
     }
     if ($objObject->objFormQuestion) {
         $objObject->objFormQuestion = FormQuestion::GetSoapObjectFromObject($objObject->objFormQuestion, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intFormQuestionId = null;
         }
     }
     if ($objObject->objAddress) {
         $objObject->objAddress = Address::GetSoapObjectFromObject($objObject->objAddress, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intAddressId = null;
         }
     }
     if ($objObject->objPhone) {
         $objObject->objPhone = Phone::GetSoapObjectFromObject($objObject->objPhone, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPhoneId = null;
         }
     }
     if ($objObject->objEmail) {
         $objObject->objEmail = Email::GetSoapObjectFromObject($objObject->objEmail, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intEmailId = null;
         }
     }
     if ($objObject->dttDateValue) {
         $objObject->dttDateValue = $objObject->dttDateValue->__toString(QDateTime::FormatSoap);
     }
     return $objObject;
 }
コード例 #5
0
ファイル: PersonGen.class.php プロジェクト: alcf/chms
    /**
     * Deletes all associated SignupEntriesAsSignupBy
     * @return void
     */
    public function DeleteAllSignupEntriesAsSignupBy()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateSignupEntryAsSignupBy on this unsaved Person.');
        }
        // Get the Database Object for this Class
        $objDatabase = Person::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (SignupEntry::LoadArrayBySignupByPersonId($this->intId) as $objSignupEntry) {
                $objSignupEntry->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`signup_entry`
				WHERE
					`signup_by_person_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }
コード例 #6
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;
     }
 }
コード例 #7
0
ファイル: payment.php プロジェクト: alcf/chms
 /**
  * Called back from PaymentPanel to perform final tasks after we know
  * the payment has been submitted successfully.
  */
 public function PaymentPanel_Success(SignupPayment $objPaymentObject)
 {
     $this->objSignupEntry->Complete($objPaymentObject);
     QApplication::Redirect($this->objSignupEntry->ConfirmationUrl);
 }
コード例 #8
0
ファイル: export_to_excel.php プロジェクト: alcf/chms
    } else {
        print "," . EscapeCsv($objFormQuestion->ShortDescription);
    }
}
if ($objSignupForm->CountFormProducts() > 0) {
    foreach ($objSignupForm->GetFormProductArray(QQ::OrderBy(QQN::FormProduct()->FormProductTypeId, QQN::FormProduct()->OrderNumber)) as $objFormProduct) {
        if ($objFormProduct->ViewFlag) {
            print ",";
            print $objFormProduct->Name;
        }
    }
    print ",Total,Paid,Balance,Payment Type";
}
print ",Date Submitted\r\n";
$objCursor = SignupEntry::QueryCursor(QQ::Equal(QQN::SignupEntry()->SignupFormId, $objSignupForm->Id), QQ::OrderBy(QQN::SignupEntry()->DateSubmitted));
while ($objSignupEntry = SignupEntry::InstantiateCursor($objCursor)) {
    if ($objSignupEntry->SignupEntryStatusTypeId == SignupEntryStatusType::Complete) {
        print EscapeCsv($objSignupEntry->Person->FirstName);
        print ",";
        print EscapeCsv($objSignupEntry->Person->LastName);
        print ",";
        foreach ($objFormQuestionArray as $objFormQuestion) {
            $objAnswer = FormAnswer::LoadBySignupEntryIdFormQuestionId($objSignupEntry->Id, $objFormQuestion->Id);
            if ($objAnswer) {
                switch ($objFormQuestion->FormQuestionTypeId) {
                    case FormQuestionType::YesNo:
                        if ($objAnswer->BooleanValue) {
                            print 'Yes';
                        }
                        break;
                    case FormQuestionType::SpouseName:
コード例 #9
0
 /**
  * Refresh this MetaControl with Data from the local SignupPayment object.
  * @param boolean $blnReload reload SignupPayment from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objSignupPayment->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objSignupPayment->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->objSignupPayment->SignupEntry && $this->objSignupPayment->SignupEntry->Id == $objSignupEntry->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupEntry->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupEntryId) {
         $this->lblSignupEntryId->Text = $this->objSignupPayment->SignupEntry ? $this->objSignupPayment->SignupEntry->__toString() : null;
     }
     if ($this->lstSignupPaymentType) {
         $this->lstSignupPaymentType->SelectedValue = $this->objSignupPayment->SignupPaymentTypeId;
     }
     if ($this->lblSignupPaymentTypeId) {
         $this->lblSignupPaymentTypeId->Text = $this->objSignupPayment->SignupPaymentTypeId ? SignupPaymentType::$NameArray[$this->objSignupPayment->SignupPaymentTypeId] : null;
     }
     if ($this->calTransactionDate) {
         $this->calTransactionDate->DateTime = $this->objSignupPayment->TransactionDate;
     }
     if ($this->lblTransactionDate) {
         $this->lblTransactionDate->Text = sprintf($this->objSignupPayment->TransactionDate) ? $this->objSignupPayment->__toString($this->strTransactionDateDateTimeFormat) : null;
     }
     if ($this->txtTransactionDescription) {
         $this->txtTransactionDescription->Text = $this->objSignupPayment->TransactionDescription;
     }
     if ($this->lblTransactionDescription) {
         $this->lblTransactionDescription->Text = $this->objSignupPayment->TransactionDescription;
     }
     if ($this->txtAmount) {
         $this->txtAmount->Text = $this->objSignupPayment->Amount;
     }
     if ($this->lblAmount) {
         $this->lblAmount->Text = $this->objSignupPayment->Amount;
     }
     if ($this->txtFundingAccount) {
         $this->txtFundingAccount->Text = $this->objSignupPayment->FundingAccount;
     }
     if ($this->lblFundingAccount) {
         $this->lblFundingAccount->Text = $this->objSignupPayment->FundingAccount;
     }
     if ($this->lstDonationStewardshipFund) {
         $this->lstDonationStewardshipFund->RemoveAllItems();
         $this->lstDonationStewardshipFund->AddItem(QApplication::Translate('- Select One -'), null);
         $objDonationStewardshipFundArray = StewardshipFund::LoadAll();
         if ($objDonationStewardshipFundArray) {
             foreach ($objDonationStewardshipFundArray as $objDonationStewardshipFund) {
                 $objListItem = new QListItem($objDonationStewardshipFund->__toString(), $objDonationStewardshipFund->Id);
                 if ($this->objSignupPayment->DonationStewardshipFund && $this->objSignupPayment->DonationStewardshipFund->Id == $objDonationStewardshipFund->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstDonationStewardshipFund->AddItem($objListItem);
             }
         }
     }
     if ($this->lblDonationStewardshipFundId) {
         $this->lblDonationStewardshipFundId->Text = $this->objSignupPayment->DonationStewardshipFund ? $this->objSignupPayment->DonationStewardshipFund->__toString() : null;
     }
     if ($this->txtAmountDonation) {
         $this->txtAmountDonation->Text = $this->objSignupPayment->AmountDonation;
     }
     if ($this->lblAmountDonation) {
         $this->lblAmountDonation->Text = $this->objSignupPayment->AmountDonation;
     }
     if ($this->txtAmountNonDonation) {
         $this->txtAmountNonDonation->Text = $this->objSignupPayment->AmountNonDonation;
     }
     if ($this->lblAmountNonDonation) {
         $this->lblAmountNonDonation->Text = $this->objSignupPayment->AmountNonDonation;
     }
     if ($this->lstCreditCardPayment) {
         $this->lstCreditCardPayment->RemoveAllItems();
         $this->lstCreditCardPayment->AddItem(QApplication::Translate('- Select One -'), null);
         $objCreditCardPaymentArray = CreditCardPayment::LoadAll();
         if ($objCreditCardPaymentArray) {
             foreach ($objCreditCardPaymentArray as $objCreditCardPayment) {
                 $objListItem = new QListItem($objCreditCardPayment->__toString(), $objCreditCardPayment->Id);
                 if ($this->objSignupPayment->CreditCardPayment && $this->objSignupPayment->CreditCardPayment->Id == $objCreditCardPayment->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCreditCardPayment->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCreditCardPaymentId) {
         $this->lblCreditCardPaymentId->Text = $this->objSignupPayment->CreditCardPayment ? $this->objSignupPayment->CreditCardPayment->__toString() : null;
     }
 }
コード例 #10
0
 /**
  * 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 SignupEntryMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing SignupEntry object creation - defaults to CreateOrEdit
  * @return SignupEntryMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objSignupEntry = SignupEntry::Load($intId);
         // SignupEntry was found -- return it!
         if ($objSignupEntry) {
             return new SignupEntryMetaControl($objParentObject, $objSignupEntry);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a SignupEntry 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 SignupEntryMetaControl($objParentObject, new SignupEntry());
 }
コード例 #11
0
ファイル: SignupQForm.class.php プロジェクト: alcf/chms
 protected function btnSubmit_Click($strFormId, $strControlId, $strParameter)
 {
     $this->objSignupEntry->Save();
     $this->CreateChildObject();
     if (!QApplication::$PublicLogin) {
         // Create a communcations entry object or use an existing communcations_entry
         // if user is not logged in
         $txtEmail = $this->GetControl($this->strEmailCtrlId);
         $objCommunicationsEntry = CommunicationListEntry::LoadByEmail($txtEmail->Text);
         if (!$objCommunicationsEntry) {
             $objCommunicationsEntry = new CommunicationListEntry();
             $objCommunicationsEntry->FirstName = $this->objFormQuestionControlArray[0]->Text;
             $objCommunicationsEntry->LastName = $this->objFormQuestionControlArray[1]->Text;
             if ($txtEmail) {
                 $objCommunicationsEntry->Email = $txtEmail->Text;
             }
             $objCommunicationsEntry->Save();
         }
         $this->objSignupEntry->CommunicationsEntryId = $objCommunicationsEntry->Id;
     }
     foreach ($this->objSignupForm->GetFormQuestionArray() as $objFormQuestion) {
         // Only update if this is NOT "InternalFlag"
         if ($objFormQuestion->InternalFlag) {
             continue;
         }
         $strControlId = 'fq' . $objFormQuestion->Id;
         $objFormAnswer = FormAnswer::LoadBySignupEntryIdFormQuestionId($this->objSignupEntry->Id, $objFormQuestion->Id);
         if (!$objFormAnswer) {
             $objFormAnswer = new FormAnswer();
             $objFormAnswer->SignupEntry = $this->objSignupEntry;
             $objFormAnswer->FormQuestion = $objFormQuestion;
         }
         switch ($objFormQuestion->FormQuestionTypeId) {
             case FormQuestionType::SpouseName:
                 $lstSpouse = $this->GetControl($strControlId . 'id');
                 $txtSpouse = $this->GetControl($strControlId . 'nm');
                 if ($lstSpouse && $lstSpouse->SelectedValue) {
                     $objFormAnswer->TextValue = Person::Load($lstSpouse->SelectedValue)->Name;
                 } else {
                     $objFormAnswer->TextValue = trim($txtSpouse->Text);
                 }
                 break;
             case FormQuestionType::Address:
                 $rblAddress = $this->GetControl($strControlId . 'switch');
                 $txtAddress1 = $this->GetControl($strControlId . 'address1');
                 $txtAddress2 = $this->GetControl($strControlId . 'address2');
                 $txtCity = $this->GetControl($strControlId . 'city');
                 $lstState = $this->GetControl($strControlId . 'state');
                 $txtZipCode = $this->GetControl($strControlId . 'zipcode');
                 if ($rblAddress && $rblAddress->SelectedValue) {
                     $objFormAnswer->AddressId = $rblAddress->SelectedValue;
                     $objFormAnswer->TextValue = $objFormAnswer->Address->AddressFullLine;
                 } else {
                     $objFormAnswer->AddressId = null;
                     $objAddress = new Address();
                     $objAddress->Address1 = trim($txtAddress1->Text);
                     $objAddress->Address2 = trim($txtAddress2->Text);
                     $objAddress->City = trim($txtCity->Text);
                     $objAddress->State = $lstState->SelectedValue;
                     $objAddress->ZipCode = trim($txtZipCode->Text);
                     $objFormAnswer->TextValue = $objAddress->AddressFullLine;
                 }
                 break;
             case FormQuestionType::Age:
                 $txtAge = $this->GetControl($strControlId . 'age');
                 if (strlen(trim($txtAge->Text))) {
                     $objFormAnswer->IntegerValue = $txtAge->Text;
                 } else {
                     $objFormAnswer->IntegerValue = null;
                 }
                 break;
             case FormQuestionType::DateofBirth:
                 $dtxDateOfBirth = $this->GetControl($strControlId . 'dob');
                 if ($dtxDateOfBirth->DateTime) {
                     $objFormAnswer->DateValue = $dtxDateOfBirth->DateTime;
                     // Update the Person Information
                     if (QApplication::$PublicLogin) {
                         $this->objSignupEntry->Person->DateOfBirth = $objFormAnswer->DateValue;
                         $this->objSignupEntry->Person->DobGuessedFlag = false;
                         $this->objSignupEntry->Person->DobYearApproximateFlag = false;
                         $this->objSignupEntry->Person->Save();
                     }
                 } else {
                     $objFormAnswer->DateValue = null;
                 }
                 break;
             case FormQuestionType::Gender:
                 $lstGender = $this->GetControl($strControlId . 'gender');
                 if ($lstGender->SelectedValue === true) {
                     $objFormAnswer->TextValue = 'Male';
                     $objFormAnswer->BooleanValue = true;
                     if (QApplication::$PublicLogin) {
                         $this->objSignupEntry->Person->Gender = 'M';
                         $this->objSignupEntry->Person->Save();
                     }
                 } else {
                     if ($lstGender->SelectedValue === false) {
                         $objFormAnswer->TextValue = 'Female';
                         $objFormAnswer->BooleanValue = false;
                         if (QApplication::$PublicLogin) {
                             $this->objSignupEntry->Person->Gender = 'F';
                             $this->objSignupEntry->Person->Save();
                         }
                     } else {
                         $objFormAnswer->TextValue = null;
                         $objFormAnswer->BooleanValue = null;
                     }
                 }
                 break;
             case FormQuestionType::Phone:
                 $lstPhone = $this->GetControl($strControlId . 'id');
                 $txtPhone = $this->GetControl($strControlId . 'phone');
                 if ($lstPhone && $lstPhone->SelectedValue) {
                     $objFormAnswer->PhoneId = $lstPhone->SelectedValue;
                     $objFormAnswer->TextValue = $objFormAnswer->Phone->Number;
                 } else {
                     if ($strNumber = trim($txtPhone->Text)) {
                         $objFormAnswer->PhoneId = null;
                         $objFormAnswer->TextValue = $strNumber;
                     } else {
                         $objFormAnswer->PhoneId = null;
                         $objFormAnswer->TextValue = null;
                     }
                 }
                 break;
             case FormQuestionType::Email:
                 $lstEmail = $this->GetControl($strControlId . 'id');
                 $txtEmail = $this->GetControl($strControlId . 'email');
                 if ($lstEmail && $lstEmail->SelectedValue) {
                     $objFormAnswer->EmailId = $lstEmail->SelectedValue;
                     $objFormAnswer->TextValue = $objFormAnswer->Email->Address;
                 } else {
                     if ($strNumber = trim($txtEmail->Text)) {
                         $objFormAnswer->EmailId = null;
                         $objFormAnswer->TextValue = $strNumber;
                     } else {
                         $objFormAnswer->EmailId = null;
                         $objFormAnswer->TextValue = null;
                     }
                 }
                 break;
             case FormQuestionType::ShortText:
             case FormQuestionType::LongText:
                 $txtAnswer = $this->GetControl($strControlId);
                 if (strlen($strText = trim($txtAnswer->Text))) {
                     $objFormAnswer->TextValue = $strText;
                 } else {
                     $objFormAnswer->TextValue = null;
                 }
                 break;
             case FormQuestionType::Number:
                 $txtAnswer = $this->GetControl($strControlId);
                 if (strlen($strText = trim($txtAnswer->Text))) {
                     $objFormAnswer->IntegerValue = $strText;
                 } else {
                     $objFormAnswer->IntegerValue = null;
                 }
                 break;
             case FormQuestionType::YesNo:
                 $chkAnswer = $this->GetControl($strControlId);
                 $objFormAnswer->BooleanValue = $chkAnswer->Checked;
                 break;
             case FormQuestionType::SingleSelect:
                 $lstAnswer = $this->GetControl($strControlId);
                 $txtAnswer = $this->GetControl($strControlId . 'other');
                 // No item selected ("-select one-" still selected)
                 if (is_null($lstAnswer->SelectedValue)) {
                     $objFormAnswer->TextValue = null;
                     // "Other" option
                 } else {
                     if ($lstAnswer->SelectedValue === false) {
                         if (strlen($strText = trim($txtAnswer->Text))) {
                             $objFormAnswer->TextValue = $strText;
                         } else {
                             $objFormAnswer->TextValue = null;
                         }
                         // Regular List Selection
                     } else {
                         $objFormAnswer->TextValue = trim($lstAnswer->SelectedValue);
                     }
                 }
                 break;
             case FormQuestionType::MultipleSelect:
                 //GJS - changing to multiple check boxes
                 $chkAnswer = $this->GetControl($strControlId);
                 $objItemsArray = $chkAnswer->GetAllItems();
                 if (count($objItemsArray)) {
                     $strSelectedArray = array();
                     foreach ($objItemsArray as $objItem) {
                         if ($objItem->Selected) {
                             $strSelectedArray[] = $objItem->Name;
                         }
                     }
                     $objFormAnswer->TextValue = implode("\r\n", $strSelectedArray);
                 } else {
                     $objFormAnswer->TextValue = null;
                 }
                 break;
             case FormQuestionType::Instructions:
                 // Don't need to do anything here!
                 break;
             default:
                 throw new Exception('Invalid FormQuestionTypeId: ' . $objFormQuestion->FormQuestionTypeId);
         }
         $objFormAnswer->Save();
     }
     if ($this->objSignupForm->CountFormProducts()) {
         QApplication::Redirect($this->objSignupEntry->PaymentUrl);
     } else {
         $this->objSignupEntry->Complete();
         QApplication::Redirect($this->objSignupEntry->ConfirmationUrl);
     }
 }
コード例 #12
0
ファイル: datagen-forms.cli.php プロジェクト: alcf/chms
 public static function GenerateFormInMinistry(Ministry $objMinistry)
 {
     $objSignupForm = new SignupForm();
     $objSignupForm->SignupFormTypeId = SignupFormType::Event;
     $objSignupForm->Ministry = $objMinistry;
     $objSignupForm->Name = self::GenerateTitle(3, 8);
     if (rand(0, 2)) {
         $strToken = strtolower($objSignupForm->Name);
         $strToken = str_replace(' ', '_', $strToken);
         if (!SignupForm::LoadByToken($strToken)) {
             $objSignupForm->Token = $strToken;
         }
     }
     $objSignupForm->ActiveFlag = rand(0, 10);
     $objSignupForm->Description = self::GenerateContent(rand(1, 3), 8, 20);
     $objSignupForm->InformationUrl = 'http://www.yahoo.com/';
     $objSignupForm->EmailNotification = rand(0, 1) ? 'mike@michaelho.com, mike.ho@alcf.net' : null;
     $objSignupForm->AllowOtherFlag = rand(0, 1);
     $objSignupForm->AllowMultipleFlag = rand(0, 1);
     switch (rand(0, 5)) {
         case 1:
             $objSignupForm->SignupLimit = 50;
             break;
         case 2:
             $objSignupForm->SignupMaleLimit = 50;
             $objSignupForm->SignupFemaleLimit = 50;
             break;
     }
     $objSignupForm->DateCreated = self::GenerateDateTime(self::$SystemStartDate, QDateTime::Now());
     $objSignupForm->Save();
     $objEventSignupForm = new EventSignupForm();
     $objEventSignupForm->SignupForm = $objSignupForm;
     $objEventSignupForm->DateStart = new QDateTime('2011-06-27 17:00');
     $objEventSignupForm->DateEnd = new QDateTime('2011-06-30 12:00');
     $objEventSignupForm->Location = 'Camp Hammer, Boulder Creek, CA';
     $objEventSignupForm->Save();
     // Add form products information
     // 1: Required Product
     $intOrderNumber = 1;
     if (rand(0, 1)) {
         $objFormProduct = new FormProduct();
         $objFormProduct->SignupForm = $objSignupForm;
         $objFormProduct->FormProductTypeId = FormProductType::Required;
         $objFormProduct->FormPaymentTypeId = self::GenerateFromArray(array_keys(FormPaymentType::$NameArray));
         $objFormProduct->Name = 'Main Registration Fee';
         switch ($objFormProduct->FormPaymentTypeId) {
             case FormPaymentType::DepositRequired:
                 $objFormProduct->Cost = rand(1, 10) * 10;
                 $objFormProduct->Deposit = $objFormProduct->Cost / 2;
                 break;
             case FormPaymentType::PayInFull:
                 $objFormProduct->Cost = rand(1, 10) * 10;
                 break;
             case FormPaymentType::Donation:
                 $objFormProduct->FormPaymentTypeId = FormPaymentType::PayInFull;
                 $objFormProduct->Cost = rand(1, 10) * 10;
                 break;
         }
         $objFormProduct->OrderNumber = $intOrderNumber;
         $intOrderNumber++;
         $objFormProduct->ViewFlag = true;
         $objFormProduct->MinimumQuantity = 1;
         $objFormProduct->MaximumQuantity = 1;
         $objFormProduct->Save();
     }
     // 2: Required w/ Choice Product
     if (rand(0, 1)) {
         $arrProduct = array('100' => 'Standard Accommodation', '150' => 'Deluxe Accommodation');
         foreach ($arrProduct as $fltAmount => $strName) {
             $objFormProduct = new FormProduct();
             $objFormProduct->SignupForm = $objSignupForm;
             $objFormProduct->FormProductTypeId = FormProductType::RequiredWithChoice;
             $objFormProduct->FormPaymentTypeId = FormPaymentType::PayInFull;
             $objFormProduct->Name = $strName;
             $objFormProduct->Description = self::GenerateContent(1, 3, 10);
             $objFormProduct->Cost = $fltAmount;
             $objFormProduct->OrderNumber = $intOrderNumber;
             $objFormProduct->MinimumQuantity = 1;
             $objFormProduct->MaximumQuantity = 1;
             $intOrderNumber++;
             $objFormProduct->ViewFlag = true;
             $objFormProduct->Save();
         }
     }
     // 3: Optional Product(s)
     $intProductCount = rand(0, 3);
     for ($i = 0; $i < $intProductCount; $i++) {
         $objFormProduct = new FormProduct();
         $objFormProduct->SignupForm = $objSignupForm;
         $objFormProduct->FormProductTypeId = FormProductType::Optional;
         $objFormProduct->FormPaymentTypeId = FormPaymentType::PayInFull;
         $objFormProduct->Name = self::GenerateTitle(2, 5);
         $objFormProduct->Description = self::GenerateContent(1, 3, 10);
         $objFormProduct->MinimumQuantity = 1;
         $objFormProduct->MaximumQuantity = rand(1, 3);
         $objFormProduct->Cost = rand(1, 10) * 5;
         $objFormProduct->OrderNumber = $intOrderNumber;
         $intOrderNumber++;
         $objFormProduct->ViewFlag = true;
         $objFormProduct->Save();
     }
     // 4: Otpional Donation
     if (rand(0, 1)) {
         $objFormProduct = new FormProduct();
         $objFormProduct->SignupForm = $objSignupForm;
         $objFormProduct->FormProductTypeId = FormProductType::Optional;
         $objFormProduct->FormPaymentTypeId = FormPaymentType::Donation;
         $objFormProduct->Name = 'Donation';
         $objFormProduct->Description = self::GenerateContent(1, 3, 10);
         $objFormProduct->MinimumQuantity = 1;
         $objFormProduct->MaximumQuantity = 1;
         $objFormProduct->OrderNumber = $intOrderNumber;
         $intOrderNumber++;
         $objFormProduct->ViewFlag = true;
         $objFormProduct->Save();
     }
     // Add Form Questions
     $intOrderNumber = 1;
     foreach (FormQuestionType::$NameArray as $intFormQuestionTypeId => $strName) {
         if (rand(0, 1)) {
             $objFormQuestion = null;
         } else {
             $objFormQuestion = new FormQuestion();
             $objFormQuestion->SignupForm = $objSignupForm;
             $objFormQuestion->OrderNumber = $intOrderNumber;
             $objFormQuestion->FormQuestionTypeId = $intFormQuestionTypeId;
             $objFormQuestion->RequiredFlag = rand(0, 1);
             $objFormQuestion->ViewFlag = rand(0, 1);
             switch ($intFormQuestionTypeId) {
                 case FormQuestionType::SpouseName:
                     $objFormQuestion->ShortDescription = 'Spouse\'s Name';
                     $objFormQuestion->Question = 'What is your spouse\'s name?';
                     break;
                 case FormQuestionType::Address:
                     $objFormQuestion->ShortDescription = 'Home Address';
                     $objFormQuestion->Question = 'What is your address?';
                     break;
                 case FormQuestionType::Age:
                     $objFormQuestion->ShortDescription = 'Age';
                     $objFormQuestion->Question = 'How old are you?';
                     break;
                 case FormQuestionType::DateofBirth:
                     $objFormQuestion->ShortDescription = 'Date of Birth';
                     $objFormQuestion->Question = 'When were you born';
                     break;
                 case FormQuestionType::Gender:
                     $objFormQuestion->ShortDescription = 'Gender';
                     $objFormQuestion->Question = 'What is your gender?';
                     break;
                 case FormQuestionType::Phone:
                     $objFormQuestion->ShortDescription = 'Phone';
                     $objFormQuestion->Question = 'What is your phone number?';
                     break;
                 case FormQuestionType::Email:
                     $objFormQuestion->ShortDescription = 'Email';
                     $objFormQuestion->Question = 'What is your email address?';
                     break;
                 case FormQuestionType::ShortText:
                     $objFormQuestion->ShortDescription = 'Foo Bar';
                     $objFormQuestion->Question = 'What is your foo bar?';
                     break;
                 case FormQuestionType::LongText:
                     $objFormQuestion->ShortDescription = 'Foo Bar Long';
                     $objFormQuestion->Question = 'What is your foo bar long?';
                     break;
                 case FormQuestionType::Number:
                     $objFormQuestion->ShortDescription = 'Number of Baz';
                     $objFormQuestion->Question = 'How many baz?';
                     break;
                 case FormQuestionType::YesNo:
                     $objFormQuestion->ShortDescription = 'Blue Color';
                     $objFormQuestion->Question = 'Is it blue?';
                     break;
                 case FormQuestionType::SingleSelect:
                     $objFormQuestion->ShortDescription = 'One Item';
                     $objFormQuestion->Question = 'Which is it?';
                     $objFormQuestion->Options = "Option One\nOption Two\nOption Three";
                     break;
                 case FormQuestionType::MultipleSelect:
                     $objFormQuestion->ShortDescription = 'Multiple Item';
                     $objFormQuestion->Question = 'What are they?';
                     $objFormQuestion->Options = "Option One\nOption Two\nOption Three";
                     break;
                 default:
                     throw new QCallerException(sprintf('Invalid intFormQuestionTypeId: %s', $intFormQuestionTypeId));
             }
             $objFormQuestion->Save();
             $intPersonCount = rand(self::SignupsPerFormMinimum, self::SignupsPerFormMaximum);
             for ($i = 0; $i < $intPersonCount; $i++) {
                 $objPerson = null;
                 while (!$objPerson) {
                     $objPerson = Person::Load(rand(1, self::$MaximumPersonId));
                     if ($objPerson && !$objSignupForm->AllowMultipleFlag && $objSignupForm->IsPersonRegistered($objPerson)) {
                         $objPerson = null;
                     }
                 }
                 $objSignup = new SignupEntry();
                 $objSignup->SignupForm = $objSignupForm;
                 $objSignup->Person = $objPerson;
                 $objSignup->SignupByPerson = $objPerson;
                 $objSignup->DateCreated = self::GenerateDateTime($objSignupForm->DateCreated, QDateTime::Now());
                 $objSignup->SignupEntryStatusTypeId = SignupEntryStatusType::Incomplete;
                 $objSignup->InternalNotes = !rand(0, 2) ? self::GenerateContent(1, 5, 10) : null;
                 $objSignup->Save();
                 // Rqeuired Products
                 foreach ($objSignupForm->GetFormProductArrayByType(FormProductType::Required) as $objFormProduct) {
                     $objSignup->AddProduct($objFormProduct);
                 }
                 // Required with Choice
                 $objArray = $objSignupForm->GetFormProductArrayByType(FormProductType::RequiredWithChoice);
                 if (count($objArray)) {
                     $objSignup->AddProduct(self::GenerateFromArray($objArray));
                 }
                 // Optionals (including donations)
                 foreach ($objSignupForm->GetFormProductArrayByType(FormProductType::Optional) as $objFormProduct) {
                     if (rand(0, 1)) {
                         if ($objFormProduct->FormPaymentTypeId == FormPaymentType::Donation) {
                             $objSignup->AddProduct($objFormProduct, rand($objFormProduct->MinimumQuantity, $objFormProduct->MaximumQuantity), rand(1, 10) * 10);
                         } else {
                             $objSignup->AddProduct($objFormProduct, rand($objFormProduct->MinimumQuantity, $objFormProduct->MaximumQuantity));
                         }
                     }
                 }
                 // Payments
                 if (rand(0, 14)) {
                     $objSignup->SignupEntryStatusTypeId = SignupEntryStatusType::Complete;
                     $objSignup->DateSubmitted = new QDateTime($objSignup->DateCreated);
                     $objSignup->DateSubmitted->Minute += 1;
                     $objSignup->Save();
                     $fltAmount = rand(0, 1) ? $objSignup->AmountTotal : $objSignup->CalculateMinimumDeposit();
                     $objSignup->AddPayment(SignupPaymentType::CreditCard, $fltAmount, 'DATAGEN1234', new QDateTime($objSignup->DateSubmitted));
                 }
                 // Create the form answers for each question
                 foreach ($objSignupForm->GetFormQuestionArray(QQ::OrderBy(QQN::FormQuestion()->OrderNumber)) as $objFormQuestion) {
                     if ($objFormQuestion->RequiredFlag || rand(0, 1)) {
                         $objFormAnswer = new FormAnswer();
                         $objFormAnswer->SignupEntry = $objSignup;
                         $objFormAnswer->FormQuestion = $objFormQuestion;
                         switch ($objFormQuestion->FormQuestionTypeId) {
                             case FormQuestionType::SpouseName:
                                 $objFormAnswer->TextValue = 'Spouse Name';
                                 break;
                             case FormQuestionType::Address:
                                 $objFormAnswer->TextValue = $objPerson->PrimaryAddressText . ', ' . $objPerson->PrimaryCityText;
                                 $objArray = $objPerson->GetHouseholdParticipationArray();
                                 if (count($objArray)) {
                                     $objAddress = $objArray[0]->Household->GetCurrentAddress();
                                     if ($objAddress) {
                                         $objFormAnswer->AddressId = $objAddress->Id;
                                     } else {
                                         $objFormAnswer = null;
                                     }
                                 } else {
                                     $objArray = $objPerson->GetAddressArray();
                                     if (count($objArray)) {
                                         $objFormAnswer->AddressId = $objArray[0]->Id;
                                     } else {
                                         $objFormAnswer = null;
                                     }
                                 }
                                 break;
                             case FormQuestionType::Age:
                                 $objFormAnswer->IntegerValue = $objPerson->Age;
                                 break;
                             case FormQuestionType::DateofBirth:
                                 if ($objPerson->DateOfBirth) {
                                     $objFormAnswer->DateValue = $objPerson->DateOfBirth;
                                 }
                                 break;
                             case FormQuestionType::Gender:
                                 switch ($objPerson->Gender) {
                                     case 'M':
                                         $objFormAnswer->BooleanValue = true;
                                         $objFormAnswer->TextValue = 'Male';
                                         break;
                                     case 'F':
                                         $objFormAnswer->BooleanValue = false;
                                         $objFormAnswer->TextValue = 'Female';
                                         break;
                                     default:
                                         $objFormAnswer = null;
                                         break;
                                 }
                                 break;
                             case FormQuestionType::Phone:
                                 if (count($objArray = $objPerson->GetPhoneArray())) {
                                     $objFormAnswer->TextValue = $objArray[0]->Number;
                                     $objFormAnswer->PhoneId = $objArray[0]->Id;
                                 }
                                 break;
                             case FormQuestionType::Email:
                                 if (count($objArray = $objPerson->GetEmailArray())) {
                                     $objFormAnswer->TextValue = $objArray[0]->Address;
                                     $objFormAnswer->EmailId = $objArray[0]->Id;
                                 }
                                 break;
                             case FormQuestionType::ShortText:
                                 $objFormAnswer->TextValue = 'Foo Bar';
                                 break;
                             case FormQuestionType::LongText:
                                 $objFormAnswer->TextValue = 'The quick brown fox jumps over the lazy dog.';
                                 break;
                             case FormQuestionType::Number:
                                 $objFormAnswer->IntegerValue = 28;
                                 break;
                             case FormQuestionType::YesNo:
                                 $objFormAnswer->BooleanValue = rand(0, 1);
                                 break;
                             case FormQuestionType::SingleSelect:
                                 $objFormAnswer->TextValue = "Option Two";
                                 break;
                             case FormQuestionType::MultipleSelect:
                                 $objFormAnswer->TextValue = "Option One\nOption Three";
                                 break;
                         }
                         if ($objFormAnswer) {
                             $objFormAnswer->Save();
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #13
0
ファイル: results.php プロジェクト: alcf/chms
 public function RenderPaymentType(SignupEntry $objSignupEntry)
 {
     $strReturn = '';
     if ($objSignupEntry->CountSignupPayments()) {
         $objArray = $objSignupEntry->GetSignupPaymentArray();
         $strReturn .= SignupPaymentType::ToString($objArray[0]->SignupPaymentTypeId);
     } else {
         $strReturn = 'No payment';
     }
     return $strReturn;
 }
コード例 #14
0
ファイル: SignupForm.class.php プロジェクト: alcf/chms
 /**
  * Specifies whether or not this is signup is still within the capacity limits
  * (or if no capacity is specified, we always return true)
  * @return boolean
  */
 public function IsWithinCapacity()
 {
     if (!$this->intSignupLimit) {
         return true;
     }
     return SignupEntry::CountBySignupFormIdSignupEntryStatusTypeId($this->intId, SignupEntryStatusType::Complete) < $this->intSignupLimit;
 }
コード例 #15
0
ファイル: SignupEntryGen.class.php プロジェクト: alcf/chms
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, SignupEntry::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
コード例 #16
0
 /**
  * Refresh this MetaControl with Data from the local ClassRegistration object.
  * @param boolean $blnReload reload ClassRegistration from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objClassRegistration->Reload();
     }
     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->objClassRegistration->SignupEntry && $this->objClassRegistration->SignupEntry->Id == $objSignupEntry->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupEntry->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupEntryId) {
         $this->lblSignupEntryId->Text = $this->objClassRegistration->SignupEntry ? $this->objClassRegistration->SignupEntry->__toString() : null;
     }
     if ($this->lstClassMeeting) {
         $this->lstClassMeeting->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstClassMeeting->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objClassMeetingArray = ClassMeeting::LoadAll();
         if ($objClassMeetingArray) {
             foreach ($objClassMeetingArray as $objClassMeeting) {
                 $objListItem = new QListItem($objClassMeeting->__toString(), $objClassMeeting->SignupFormId);
                 if ($this->objClassRegistration->ClassMeeting && $this->objClassRegistration->ClassMeeting->SignupFormId == $objClassMeeting->SignupFormId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstClassMeeting->AddItem($objListItem);
             }
         }
     }
     if ($this->lblClassMeetingId) {
         $this->lblClassMeetingId->Text = $this->objClassRegistration->ClassMeeting ? $this->objClassRegistration->ClassMeeting->__toString() : null;
     }
     if ($this->lstPerson) {
         $this->lstPerson->RemoveAllItems();
         if (!$this->blnEditMode) {
             $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->objClassRegistration->Person && $this->objClassRegistration->Person->Id == $objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPersonId) {
         $this->lblPersonId->Text = $this->objClassRegistration->Person ? $this->objClassRegistration->Person->__toString() : null;
     }
     if ($this->lstClassGrade) {
         $this->lstClassGrade->RemoveAllItems();
         $this->lstClassGrade->AddItem(QApplication::Translate('- Select One -'), null);
         $objClassGradeArray = ClassGrade::LoadAll();
         if ($objClassGradeArray) {
             foreach ($objClassGradeArray as $objClassGrade) {
                 $objListItem = new QListItem($objClassGrade->__toString(), $objClassGrade->Id);
                 if ($this->objClassRegistration->ClassGrade && $this->objClassRegistration->ClassGrade->Id == $objClassGrade->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstClassGrade->AddItem($objListItem);
             }
         }
     }
     if ($this->lblClassGradeId) {
         $this->lblClassGradeId->Text = $this->objClassRegistration->ClassGrade ? $this->objClassRegistration->ClassGrade->__toString() : null;
     }
     if ($this->txtChildcareNotes) {
         $this->txtChildcareNotes->Text = $this->objClassRegistration->ChildcareNotes;
     }
     if ($this->lblChildcareNotes) {
         $this->lblChildcareNotes->Text = $this->objClassRegistration->ChildcareNotes;
     }
 }
コード例 #17
0
 /**
  * Refresh this MetaControl with Data from the local SignupProduct object.
  * @param boolean $blnReload reload SignupProduct from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objSignupProduct->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objSignupProduct->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->objSignupProduct->SignupEntry && $this->objSignupProduct->SignupEntry->Id == $objSignupEntry->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupEntry->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupEntryId) {
         $this->lblSignupEntryId->Text = $this->objSignupProduct->SignupEntry ? $this->objSignupProduct->SignupEntry->__toString() : null;
     }
     if ($this->lstFormProduct) {
         $this->lstFormProduct->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstFormProduct->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objFormProductArray = FormProduct::LoadAll();
         if ($objFormProductArray) {
             foreach ($objFormProductArray as $objFormProduct) {
                 $objListItem = new QListItem($objFormProduct->__toString(), $objFormProduct->Id);
                 if ($this->objSignupProduct->FormProduct && $this->objSignupProduct->FormProduct->Id == $objFormProduct->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstFormProduct->AddItem($objListItem);
             }
         }
     }
     if ($this->lblFormProductId) {
         $this->lblFormProductId->Text = $this->objSignupProduct->FormProduct ? $this->objSignupProduct->FormProduct->__toString() : null;
     }
     if ($this->txtQuantity) {
         $this->txtQuantity->Text = $this->objSignupProduct->Quantity;
     }
     if ($this->lblQuantity) {
         $this->lblQuantity->Text = $this->objSignupProduct->Quantity;
     }
     if ($this->txtAmount) {
         $this->txtAmount->Text = $this->objSignupProduct->Amount;
     }
     if ($this->lblAmount) {
         $this->lblAmount->Text = $this->objSignupProduct->Amount;
     }
     if ($this->txtDeposit) {
         $this->txtDeposit->Text = $this->objSignupProduct->Deposit;
     }
     if ($this->lblDeposit) {
         $this->lblDeposit->Text = $this->objSignupProduct->Deposit;
     }
 }
コード例 #18
0
ファイル: result.php プロジェクト: alcf/chms
 protected function Form_Create()
 {
     $this->objSignupForm = SignupForm::Load(QApplication::PathInfo(0));
     if (!$this->objSignupForm) {
         QApplication::Redirect('/events/');
     }
     // Check for view *and* admin permissions on this ministry
     if (!$this->objSignupForm->IsLoginCanView(QApplication::$Login)) {
         QApplication::Redirect('/events/');
     }
     if (!$this->objSignupForm->Ministry->IsLoginCanAdminMinistry(QApplication::$Login)) {
         QApplication::Redirect('/events/');
     }
     switch ($this->objSignupForm->SignupFormTypeId) {
         case SignupFormType::Event:
             $this->strPageTitle .= $this->objSignupForm->Name;
             break;
         case SignupFormType::Course:
             $this->strPageTitle = 'Class Registration - ' . $this->objSignupForm->Name;
             break;
         default:
             throw new Exception('Invalid SignupFormTypeId for SignupForm: ' . $this->objSignupForm->Id);
     }
     // Check for the SignupEntry
     if (QApplication::PathInfo(1)) {
         $objSignupEntry = SignupEntry::Load(QApplication::PathInfo(1));
         if (!$objSignupEntry) {
             QApplication::Redirect('/events/');
         }
         if ($objSignupEntry->SignupFormId != $this->objSignupForm->Id) {
             QApplication::Redirect('/events/');
         }
     } else {
         QApplication::Redirect('/events/results.php/' . $this->objSignupForm->Id);
     }
     $this->mctSignupEntry = new SignupEntryMetaControl($this, $objSignupEntry);
     $this->lblPerson = new QLabel($this);
     $this->lblPerson->Name = 'Person';
     $this->lblPerson->HtmlEntities = false;
     $this->lblPersonName = new QLabel($this);
     $this->lblPersonName->Name = 'Person Name';
     $this->lblPersonName->HtmlEntities = true;
     if ($this->mctSignupEntry->SignupEntry->Person) {
         $this->lblPerson->Text = $this->mctSignupEntry->SignupEntry->Person->LinkHtml;
         $this->lblPersonName->Text = $this->mctSignupEntry->SignupEntry->Person->Name;
     } else {
         $this->lblPerson->Text = sprintf("%s %s", $objSignupEntry->CommunicationsEntry->FirstName, $objSignupEntry->CommunicationsEntry->LastName);
         $this->lblPersonName->Text = $this->lblPerson->Text;
     }
     $this->lblSignupEntryStatusType = $this->mctSignupEntry->lblSignupEntryStatusTypeId_Create();
     $this->lblDateCreated = $this->mctSignupEntry->lblDateCreated_Create();
     $this->lblDateSubmitted = $this->mctSignupEntry->lblDateSubmitted_Create();
     if ($this->mctSignupEntry->SignupEntry->PersonId != $this->mctSignupEntry->SignupEntry->SignupByPersonId && $this->mctSignupEntry->SignupEntry->SignupByPersonId) {
         $this->lblSignupByPerson = new QLabel($this);
         $this->lblSignupByPerson->HtmlEntities = false;
         $this->lblSignupByPerson->Text = $this->mctSignupEntry->SignupEntry->SignupByPerson->LinkHtml;
     }
     $this->lblInternalNotes = $this->mctSignupEntry->lblInternalNotes_Create();
     $this->btnEditNote = new QButton($this);
     $this->btnEditNote->Text = 'Edit Internal Note';
     $this->btnEditNote->AddAction(new QClickEvent(), new QAjaxAction('btnEditNote_Click'));
     $this->btnEditNote->CssClass = 'alternate';
     $this->btnToggleStatus = new QButton($this);
     $this->btnToggleStatus->Text = 'Change Registration Status';
     $this->btnToggleStatus->CssClass = 'alternate';
     $this->btnToggleStatus->AddAction(new QClickEvent(), new QAjaxAction('btnToggleStatus_Click'));
     $this->dtgFormQuestions = new QDataGrid($this);
     $this->dtgFormQuestions->AddColumn(new QDataGridColumn('Question', '<?= $_ITEM->ShortDescriptionBoldIfRequiredHtml; ?>', 'Width=300px', 'HtmlEntities=false'));
     $this->dtgFormQuestions->AddColumn(new QDataGridColumn('Response', '<?= $_FORM->RenderResponse($_ITEM); ?>', 'Width=640px', 'HtmlEntities=false'));
     $this->dtgFormQuestions->SetDataBinder('dtgFormQuestions_Bind');
     $this->pxyEditFormQuestion = new QControlProxy($this);
     $this->pxyEditFormQuestion->AddAction(new QClickEvent(), new QAjaxAction('pxyEditFormQuestion_Click'));
     $this->pxyEditFormQuestion->AddAction(new QClickEvent(), new QTerminateAction());
     $this->dtgFormProducts = new QDataGrid($this);
     $this->dtgFormProducts->AddColumn(new QDataGridColumn('Product Name', '<?= $_FORM->RenderProductName($_ITEM); ?>', 'Width=300px', 'HtmlEntities=false'));
     $this->dtgFormProducts->AddColumn(new QDataGridColumn('Purchased / Quantity', '<?= $_FORM->RenderProductQuantity($_ITEM); ?>', 'Width=475px', 'HtmlEntities=false'));
     $this->dtgFormProducts->AddColumn(new QDataGridColumn('Total Cost', '<?= $_FORM->RenderProductCost($_ITEM); ?>', 'Width=150px', 'HtmlEntities=false'));
     $this->dtgFormProducts->SetDataBinder('dtgFormProducts_Bind');
     $this->pxyEditFormProduct = new QControlProxy($this);
     $this->pxyEditFormProduct->AddAction(new QClickEvent(), new QAjaxAction('pxyEditFormProduct_Click'));
     $this->pxyEditFormProduct->AddAction(new QClickEvent(), new QTerminateAction());
     $this->dtgPayments = new SignupPaymentDataGrid($this);
     $this->dtgPayments->MetaAddColumn('TransactionDate', 'Width=160px');
     $this->dtgPayments->MetaAddTypeColumn('SignupPaymentTypeId', 'SignupPaymentType', 'Name=Type', 'Width=160px');
     $this->dtgPayments->MetaAddColumn('TransactionDescription', 'Name=Description', 'Width=445px', 'Html=<?= $_FORM->RenderPaymentCode($_ITEM); ?>', 'HtmlEntities=false');
     $this->dtgPayments->MetaAddColumn('Amount', 'Width=150px', 'Html=<?= $_FORM->RenderPaymentAmount($_ITEM); ?>', 'HtmlEntities=false', 'FontBold=true');
     $this->dtgPayments->SetDataBinder('dtgPayments_Bind');
     $this->dtgPayments->SortColumnIndex = 0;
     $this->lstAddPayment = new QListBox($this);
     $this->lstAddPayment->AddItem('- Add Payment -');
     foreach (SignupPaymentType::$NameArray as $intId => $strName) {
         if ($intId != SignupPaymentType::CreditCard) {
             $this->lstAddPayment->AddItem($strName, $intId);
         }
     }
     $this->lstAddPayment->AddAction(new QChangeEvent(), new QAjaxAction('lstAddPayment_Change'));
     $this->dlgEdit_Create();
     // Child Object
     switch ($this->objSignupForm->SignupFormTypeId) {
         case SignupFormType::Event:
             break;
         case SignupFormType::Course:
             $this->mctClassRegistration = new ClassRegistrationMetaControl($this->dlgEdit, $objSignupEntry->ClassRegistration);
             break;
         default:
             throw new Exception('Invalid SignupFormTypeId for SignupForm: ' . $this->objSignupForm->Id);
     }
     // Specifically for class registrations
     if ($this->mctClassRegistration) {
         $this->dtgClassAttendance = new QDataGrid($this);
         $this->dtgClassAttendance->AddColumn(new QDataGridColumn('Class Meeting', '<?= $_FORM->dttClassMeetingArrayForIndex[$_ITEM->MeetingNumber - 1]->ToString("DDDD, MMMM D, YYYY"); ?>', 'Width=300px'));
         $this->dtgClassAttendance->AddColumn(new QDataGridColumn('Attendance', '<?= $_FORM->RenderAttendance($_ITEM); ?>', 'Width=640px', 'HtmlEntities=false'));
         $this->dtgClassAttendance->SetDataBinder('dtgClassAttendance_Bind');
         $this->pxyEditClassAttendance = new QControlProxy($this);
         $this->pxyEditClassAttendance->AddAction(new QClickEvent(), new QAjaxAction('pxyEditClassAttendance_Click'));
         $this->pxyEditClassAttendance->AddAction(new QClickEvent(), new QTerminateAction());
         $this->dtgClassGrade = new QDataGrid($this);
         $this->dtgClassGrade->AddColumn(new QDataGridColumn('Class Grade', 'Final Class Grade', 'Width=300px'));
         $this->dtgClassGrade->AddColumn(new QDataGridColumn('Grade', '<?= $_FORM->RenderClassGrade(); ?>', 'Width=640px', 'HtmlEntities=false'));
         $this->dtgClassGrade->SetDataBinder('dtgClassGrade_Bind');
         $this->pxyEditClassGrade = new QControlProxy($this);
         $this->pxyEditClassGrade->AddAction(new QClickEvent(), new QAjaxAction('pxyEditClassGrade_Click'));
         $this->pxyEditClassGrade->AddAction(new QClickEvent(), new QTerminateAction());
     }
 }
コード例 #19
0
ファイル: SignupPaymentGen.class.php プロジェクト: alcf/chms
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objSignupEntry) {
         $objObject->objSignupEntry = SignupEntry::GetSoapObjectFromObject($objObject->objSignupEntry, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intSignupEntryId = null;
         }
     }
     if ($objObject->dttTransactionDate) {
         $objObject->dttTransactionDate = $objObject->dttTransactionDate->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->objDonationStewardshipFund) {
         $objObject->objDonationStewardshipFund = StewardshipFund::GetSoapObjectFromObject($objObject->objDonationStewardshipFund, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intDonationStewardshipFundId = null;
         }
     }
     if ($objObject->objCreditCardPayment) {
         $objObject->objCreditCardPayment = CreditCardPayment::GetSoapObjectFromObject($objObject->objCreditCardPayment, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intCreditCardPaymentId = null;
         }
     }
     return $objObject;
 }
コード例 #20
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 = SignupEntry::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 SignupEntry, given the clauses above
     $this->DataSource = SignupEntry::QueryArray($objCondition, $objClauses);
 }