Ejemplo n.º 1
0
Archivo: index.php Proyecto: alcf/chms
 protected function Form_Create()
 {
     $this->objDonationItemArray = array();
     // Online Tithes and Offering = 28
     $objDonationItem = new OnlineDonationLineItem();
     $objDonationItem->StewardshipFundId = 28;
     $this->objDonationItemArray[] = $objDonationItem;
     $objDonationItem = new OnlineDonationLineItem();
     $this->objDonationItemArray[] = $objDonationItem;
     $this->dtgDonationItems = new QDataGrid($this);
     $this->dtgDonationItems->AddColumn(new QDataGridColumn('Fund', '<?= $_FORM->RenderFund($_ITEM); ?>', 'HtmlEntities=false', 'Width=650px'));
     $this->dtgDonationItems->AddColumn(new QDataGridColumn('Amount', '<?= $_FORM->RenderAmount($_ITEM); ?>', 'HtmlEntities=false', 'Width=225px'));
     $this->dtgDonationItems->SetDataBinder('dtgDonationItems_Bind');
     // Figure out which address to use
     if (QApplication::$PublicLogin) {
         $objAddress = QApplication::$PublicLogin->Person->DeducePrimaryAddress();
     } else {
         $objAddress = new Address();
     }
     // Any Messaging
     $this->lblMessage = new QPanel($this);
     $this->lblMessage->CssClass = 'section';
     $this->lblMessage->Visible = false;
     // Total Label
     $this->lblTotal = new QLabel($this->dtgDonationItems);
     $this->lblTotal->FontBold = true;
     $this->lblTotal->Text = '$ 0.00';
     // Create the Email
     $this->txtEmail = new QEmailTextBox($this);
     $this->txtEmail->Name = 'Email Address';
     $this->txtEmail->Required = true;
     // Create the Payment Panel
     $strFirstName = QApplication::$PublicLogin ? QApplication::$PublicLogin->Person->FirstName : null;
     $strLastName = QApplication::$PublicLogin ? QApplication::$PublicLogin->Person->LastName : null;
     $this->pnlPayment = new PaymentPanel($this, null, $objAddress, $strFirstName, $strLastName);
     $this->pnlPayment->SetButtonText('Submit Donation');
 }
Ejemplo n.º 2
0
 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 . ' - Payment';
     // Ensure it is Active
     if (!$this->objSignupForm->ActiveFlag) {
         $this->strHtmlIncludeFilePath = '_notactive.tpl.php';
         return;
     }
     // Ensure we have Products that require some kind of payment
     if (!$this->objSignupForm->CountFormProducts()) {
         $this->strHtmlIncludeFilePath = '_notfound.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 || $this->objSignupEntry->SignupFormId != $this->objSignupForm->Id || $this->objSignupEntry->SignupByPersonId != QApplication::$PublicLogin->PersonId || $this->objSignupEntry->SignupEntryStatusTypeId != SignupEntryStatusType::Incomplete) {
         $this->strHtmlIncludeFilePath = '_notfound.tpl.php';
         return;
     }
     switch ($this->objSignupForm->SignupFormTypeId) {
         case SignupFormType::Event:
             $this->objChild = $this->objSignupForm->EventSignupForm;
             break;
         case SignupFormType::Course:
             $this->objChild = $this->objSignupForm->ClassMeeting;
             break;
     }
     $this->dtgProducts = new QDataGrid($this);
     $this->dtgProducts->AddColumn(new QDataGridColumn('Product / Item', '<?= $_FORM->RenderProduct($_ITEM); ?>', 'HtmlEntities=false', 'Width=550px'));
     $this->dtgProducts->AddColumn(new QDataGridColumn('Quantity', '<?= $_FORM->RenderQuantity($_ITEM); ?>', 'HtmlEntities=false', 'Width=100px'));
     $this->dtgProducts->AddColumn(new QDataGridColumn('Cost', '<?= $_FORM->RenderCost($_ITEM); ?>', 'HtmlEntities=false', 'Width=100px'));
     $this->dtgProducts->AddColumn(new QDataGridColumn('Total', '<?= $_FORM->RenderTotal($_ITEM); ?>', 'HtmlEntities=false', 'Width=100px'));
     $this->dtgProducts->SetDataBinder('dtgProducts_Bind');
     // Remove All Product Selections
     $this->objSignupEntry->DeleteAllSignupProducts();
     // Add Required Products
     foreach ($this->objSignupForm->GetFormProductArrayByType(FormProductType::Required, QQ::OrderBy(QQN::FormProduct()->OrderNumber)) as $objProduct) {
         if ($objProduct->IsAvailableRightNow()) {
             $objSignupProduct = SignupProduct::LoadBySignupEntryIdFormProductId($this->objSignupEntry->Id, $objProduct->Id);
             if (!$objSignupProduct) {
                 $this->objSignupEntry->AddProduct($objProduct);
             }
         }
     }
     // Deposit vs. Full Amount Choice
     $this->rblDeposit = new QRadioButtonList($this);
     $this->rblDeposit->Name = 'Payment Option';
     $this->rblDeposit->AddItem('Pay in Full', 1);
     $this->rblDeposit->AddItem('Deposit', 2);
     $this->rblDeposit->AddAction(new QClickEvent(), new QAjaxAction('rblDeposit_Click'));
     $this->btnRegister = new QButton($this);
     $this->btnRegister->CssClass = 'primary';
     $this->btnRegister->Text = 'Submit Registration';
     $this->btnRegister->AddAction(new QClickEvent(), new QAjaxAction('btnRegister_Click'));
     $this->btnRegister->CausesValidation = true;
     // Figure out which address to use
     $objAddress = $this->objSignupEntry->RetrieveAnyValidAddressObject();
     if (!$objAddress) {
         $objAddress = QApplication::$PublicLogin->Person->DeducePrimaryAddress();
     }
     // Create the Payment Panel
     $this->pnlPayment = new PaymentPanel($this, null, $objAddress, QApplication::$PublicLogin->Person->FirstName, QApplication::$PublicLogin->Person->LastName);
     $this->pnlPayment->SetButtonText('Submit Payment');
     $this->objSignupEntry->RefreshAmounts();
     $this->RefreshForm();
 }