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'; $this->blnFormErrorFlag = true; return; } $this->strPageTitle = $this->objSignupForm->Name . ' - Signup'; // Ensure it is Active if (!$this->objSignupForm->ActiveFlag) { $this->strHtmlIncludeFilePath = '_notactive.tpl.php'; $this->blnFormErrorFlag = true; return; } // Ensure that the funding stuff is a-okay if ($this->objSignupForm->IsStewardshipFundMissing()) { $this->strHtmlIncludeFilePath = '_notactive.tpl.php'; $this->blnFormErrorFlag = true; return; } // Ensure we are not double registering where not allowed. // Only need to check if user is logged in. if (QApplication::$PublicLogin) { if (!$this->objSignupForm->AllowMultipleFlag && count(SignupEntry::LoadArrayBySignupFormIdPersonIdSignupEntryStatusTypeId($this->objSignupForm->Id, QApplication::$PublicLogin->PersonId, SignupEntryStatusType::Complete))) { $this->strHtmlIncludeFilePath = '_registered.tpl.php'; $this->blnFormErrorFlag = true; return; } } // Ensure capacity limits if (!$this->objSignupForm->IsWithinCapacity()) { $this->strHtmlIncludeFilePath = '_capacity.tpl.php'; $this->blnFormErrorFlag = true; return; } if (QApplication::$PublicLogin) { $objSignupEntryArray = SignupEntry::LoadArrayBySignupFormIdPersonIdSignupEntryStatusTypeId($this->objSignupForm->Id, QApplication::$PublicLogin->PersonId, SignupEntryStatusType::Incomplete); if (count($objSignupEntryArray)) { $this->objSignupEntry = $objSignupEntryArray[0]; } } // Create the Entry object if doesn't yet exists if (!$this->objSignupEntry) { $this->objSignupEntry = new SignupEntry(); $this->objSignupEntry->SignupForm = $this->objSignupForm; if (QApplication::$PublicLogin) { $this->objSignupEntry->Person = QApplication::$PublicLogin->Person; $this->objSignupEntry->SignupByPerson = QApplication::$PublicLogin->Person; } $this->objSignupEntry->SignupEntryStatusTypeId = SignupEntryStatusType::Incomplete; $this->objSignupEntry->DateCreated = QDateTime::Now(); } $this->btnSubmit = new QButton($this); $this->btnSubmit->CausesValidation = true; $this->btnSubmit->CssClass = 'primary'; if ($this->objSignupForm->CountFormProducts()) { $this->btnSubmit->Text = 'Next'; } else { $this->btnSubmit->Text = 'Submit Registration'; } $this->btnSubmit->AddAction(new QClickEvent(), new QAjaxAction('btnSubmit_Click')); }