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; } } }
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); } $this->dlgEdit_Create(); $this->bIsCourse = false; // Child Object switch ($this->objSignupForm->SignupFormTypeId) { case SignupFormType::Event: break; case SignupFormType::Course: $this->bIsCourse = true; break; default: throw new Exception('Invalid SignupFormTypeId for SignupForm: ' . $this->objSignupForm->Id); } // Specifically for class registrations if ($this->bIsCourse) { $this->dtgClassAttendance = new QDataGrid($this); $this->dtgClassAttendance->AddColumn(new QDataGridColumn('Signups', '<?= $_FORM->RenderSignups($_ITEM); ?>', 'Width=300px', 'HtmlEntities=false')); $ClassMeetingArrayForIndex = $this->objSignupForm->ClassMeeting->GetClassMeetingDays(); foreach ($ClassMeetingArrayForIndex as $dtClassMeeting) { $strClassDate = $dtClassMeeting->ToString("DDDD, MMMM D, YYYY"); $this->dtgClassAttendance->AddColumn(new QDataGridColumn($strClassDate, '<?= $_FORM->RenderAttendance($_ITEM, $_COLUMN->Name); ?>', 'Width=300px', 'HtmlEntities=false')); } $this->dtgClassAttendance->SetDataBinder('dtgMyClassAttendance_Bind'); $this->pxyEditClassAttendance = new QControlProxy($this); $this->pxyEditClassAttendance->AddAction(new QClickEvent(), new QAjaxAction('pxyEditClassAttendance_Click')); $this->pxyEditClassAttendance->AddAction(new QClickEvent(), new QTerminateAction()); } }
protected function Form_Create() { $this->objSignupForm = SignupForm::Load(QApplication::PathInfo(0)); if (!$this->objSignupForm) { QApplication::Redirect('/events/'); } if (!$this->objSignupForm->IsLoginCanView(QApplication::$Login)) { QApplication::Redirect('/events/'); } $this->strPageTitle .= $this->objSignupForm->Name; $this->dtgSignupEntries = new SignupEntryDataGrid($this); $this->dtgSignupEntries->CssClass = 'datagrid'; $this->dtgSignupEntries->SetDataBinder('dtgSignupEntries_Bind'); $this->dtgSignupEntries->Paginator = new QPaginator($this->dtgSignupEntries); $this->dtgSignupEntries->SortColumnIndex = 0; $this->dtgSignupEntries->FontSize = '10px'; $this->cblColumns = new QCheckBoxList($this); $this->cblColumns->HtmlEntities = false; $this->cblColumns->AddAction(new QClickEvent(), new QAjaxAction('cblColumns_Click')); foreach ($this->objSignupForm->GetFormQuestionArray(QQ::OrderBy(QQN::FormQuestion()->OrderNumber)) as $objFormQuestion) { if ($objFormQuestion->FormQuestionTypeId != FormQuestionType::Instructions) { if ($objFormQuestion->RequiredFlag) { $strDescription = '<strong>' . QApplication::HtmlEntities($objFormQuestion->ShortDescription) . '</strong>'; } else { $strDescription = QApplication::HtmlEntities($objFormQuestion->ShortDescription); } $this->cblColumns->AddItem($strDescription, 'q' . $objFormQuestion->Id, $objFormQuestion->ViewFlag); } } foreach ($this->objSignupForm->GetFormProductArray(QQ::OrderBy(QQN::FormProduct()->FormProductTypeId, QQN::FormProduct()->OrderNumber)) as $objFormProduct) { $this->cblColumns->AddItem(QApplication::HtmlEntities($objFormProduct->Name), 'p' . $objFormProduct->Id, $objFormProduct->ViewFlag); } // Setup dtgSignups $this->dtgSignupEntries_SetupColumns(); $this->lstStatus = new QListBox($this); foreach (SignupEntryStatusType::$NameArray as $intId => $strName) { $this->lstStatus->AddItem($strName, $intId, $intId == SignupEntryStatusType::Complete); } $this->lstStatus->AddAction(new QChangeEvent(), new QAjaxAction('lstStatus_Change')); $this->lblViewing = new QLabel($this); $this->lblViewing->TagName = 'h3'; $this->lblViewing->Text = 'Viewing "Complete" Signups'; }
protected function Form_Create() { $this->objSignupForm = SignupForm::Load(QApplication::PathInfo(0)); if (!$this->objSignupForm) { QApplication::Redirect('/events/'); } if (!$this->objSignupForm->Ministry->IsLoginCanAdminMinistry(QApplication::$Login)) { QApplication::Redirect('/events/'); } $this->strPageTitle .= $this->objSignupForm->Name; $this->pnlSelectPerson = new SelectPersonPanel($this); $this->pnlSelectPerson->Name = 'Person Name'; $this->pnlSelectPerson->AllowCreate = true; $this->pnlSelectPerson->Required = true; $this->pnlSelectPerson->txtName->Focus(); $this->btnNext = new QButton($this); $this->btnNext->Text = 'Next'; $this->btnNext->CausesValidation = true; $this->btnNext->CssClass = 'primary'; $this->btnNext->AddAction(new QClickEvent(), new QAjaxAction('btnNext_Click')); $this->btnCancel = new QLinkButton($this); $this->btnCancel->Text = 'Cancel'; $this->btnCancel->CssClass = 'cancel'; $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click')); $this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction()); $this->dlgMessage = new QDialogBox($this); $this->dlgMessage->MatteClickable = false; $this->dlgMessage->HideDialogBox(); $this->dlgMessage->AutoRenderChildren = true; $this->btnDialogOkay = new QButton($this->dlgMessage); $this->btnDialogOkay->Text = 'Okay'; $this->btnDialogOkay->CssClass = 'primary'; $this->btnDialogOkay->AddAction(new QClickEvent(), new QAjaxAction('btnDialogOkay_Click')); $this->btnDialogCancel = new QLinkButton($this->dlgMessage); $this->btnDialogCancel->Text = 'Cancel'; $this->btnDialogCancel->CssClass = 'cancel'; $this->btnDialogCancel->AddAction(new QClickEvent(), new QAjaxAction('btnDialogCancel_Click')); $this->btnDialogCancel->AddAction(new QClickEvent(), new QTerminateAction()); }
protected function Form_Create() { $this->objSignupForm = SignupForm::Load(QApplication::PathInfo(0)); $this->lblHeading = new QLabel($this); if (!$this->objSignupForm) { QApplication::Redirect('/events/'); } if (!$this->objSignupForm->Ministry->IsLoginCanAdminMinistry(QApplication::$Login)) { QApplication::Redirect('/events/form.php/' . $this->objSignupForm->Id); } if (QApplication::PathInfo(1)) { $objQuestion = FormQuestion::Load(QApplication::PathInfo(1)); if (!$objQuestion) { QApplication::Redirect('/events/form.php/' . $this->objSignupForm->Id); } if ($objQuestion->SignupFormId != $this->objSignupForm->Id) { QApplication::Redirect('/events/form.php/' . $this->objSignupForm->Id); } $this->strPageTitle .= 'Edit Question'; $this->lblHeading->Text = 'Edit ' . $objQuestion->Type . ' Question'; } else { if (!QApplication::PathInfo(2)) { QApplication::Redirect('/events/form.php/' . $this->objSignupForm->Id); } $objQuestion = new FormQuestion(); $objQuestion->SignupForm = $this->objSignupForm; $objQuestion->FormQuestionTypeId = QApplication::PathInfo(2); $objQuestion->OrderNumber = 100000; $this->strPageTitle .= 'Create New Question'; $this->lblHeading->Text = 'Create New ' . $objQuestion->Type . ' Question'; // Pre-setup certain fields based on type switch ($objQuestion->FormQuestionTypeId) { case FormQuestionType::SpouseName: $objQuestion->ShortDescription = 'Spouse\'s Name'; $objQuestion->Question = 'Spouse\'s Name'; break; case FormQuestionType::Address: $objQuestion->ShortDescription = 'Home Address'; $objQuestion->Question = 'Home Address'; break; case FormQuestionType::Age: $objQuestion->ShortDescription = 'Age'; $objQuestion->Question = 'Age'; break; case FormQuestionType::DateofBirth: $objQuestion->ShortDescription = 'Date of Birth'; $objQuestion->Question = 'Date of Birth'; break; case FormQuestionType::Gender: $objQuestion->ShortDescription = 'Gender'; $objQuestion->Question = 'Gender'; break; case FormQuestionType::Phone: $objQuestion->ShortDescription = 'Phone Number'; $objQuestion->Question = 'Phone Number'; break; case FormQuestionType::Email: $objQuestion->ShortDescription = 'Email Address'; $objQuestion->Question = 'Email Address'; break; } } $this->mctQuestion = new FormQuestionMetaControl($this, $objQuestion); // Fields $this->lblFormQuestionType = $this->mctQuestion->lblFormQuestionTypeId_Create(); $this->txtShortDescription = $this->mctQuestion->txtShortDescription_Create(); $this->txtShortDescription->Required = true; $this->txtShortDescription->Instructions = 'This is the label that will show up on reports and forms'; $this->chkInternalFlag = $this->mctQuestion->chkInternalFlag_Create(); $this->chkInternalFlag->Text = 'Check if this question is only for internal use, and is <strong>NOT</strong> to be displayed on the registration form'; $this->chkInternalFlag->HtmlEntities = false; $this->txtQuestion = $this->mctQuestion->txtQuestion_Create(); $this->txtQuestion->Required = true; $this->txtQuestion->Instructions = 'This is the label that will show up on the signup form online'; $this->chkRequiredFlag = $this->mctQuestion->chkRequiredFlag_Create(); $this->chkRequiredFlag->Name = 'Answer Required?'; $this->chkRequiredFlag->Text = 'Check if an answer to this question is required'; $this->txtOptions = $this->mctQuestion->txtOptions_Create(); $this->chkAllowOtherFlag = $this->mctQuestion->chkAllowOtherFlag_Create(); // Field options based on type switch ($intFormQuestionTypeId = $this->mctQuestion->FormQuestion->FormQuestionTypeId) { case FormQuestionType::SpouseName: case FormQuestionType::Address: case FormQuestionType::Age: case FormQuestionType::DateofBirth: case FormQuestionType::Gender: case FormQuestionType::Phone: case FormQuestionType::Email: case FormQuestionType::ShortText: case FormQuestionType::LongText: case FormQuestionType::Number: $this->txtOptions->Text = null; $this->txtOptions->Required = false; $this->txtOptions->Visible = false; $this->chkAllowOtherFlag->Checked = false; $this->chkAllowOtherFlag->Required = false; $this->chkAllowOtherFlag->Visible = false; break; case FormQuestionType::YesNo: $this->txtOptions->TextMode = QTextMode::SingleLine; $this->txtOptions->Name = 'Text by the Checkbox'; $this->txtOptions->Required = false; $this->txtOptions->Visible = true; $this->chkAllowOtherFlag->Checked = false; $this->chkAllowOtherFlag->Required = false; $this->chkAllowOtherFlag->Visible = false; $this->chkRequiredFlag->Text = 'Check if the registrant is <strong>REQUIRED</strong> check "yes"'; $this->chkRequiredFlag->HtmlEntities = false; break; case FormQuestionType::SingleSelect: case FormQuestionType::MultipleSelect: $this->txtOptions->Required = true; $this->txtOptions->Visible = true; $this->chkAllowOtherFlag->Required = false; $this->chkAllowOtherFlag->Visible = true; break; case FormQuestionType::Instructions: $this->txtOptions->Name = 'Instructions Text'; $this->txtOptions->Required = true; $this->txtOptions->Visible = true; $this->chkAllowOtherFlag->Checked = false; $this->chkAllowOtherFlag->Required = false; $this->chkAllowOtherFlag->Visible = false; $this->chkRequiredFlag->Visible = false; $this->txtShortDescription->Text = '(instructions)'; $this->txtShortDescription->Visible = false; $this->chkRequiredFlag->Visible = false; $this->txtQuestion->Name = 'Label'; $this->txtQuestion->Instructions = null; $this->txtQuestion->Required = false; $this->chkInternalFlag->Visible = false; break; default: throw new Exception(sprintf('Invalid intFormQuestionTypeId: %s', $intFormQuestionTypeId)); } // Buttons $this->btnSave = new QButton($this); $this->btnSave->Text = 'Save'; $this->btnSave->CssClass = 'primary'; $this->btnSave->CausesValidation = true; $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click')); $this->btnCancel = new QLinkButton($this); $this->btnCancel->Text = 'Cancel'; $this->btnCancel->CssClass = 'cancel'; $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click')); // Delete? if ($this->mctQuestion->EditMode) { $this->btnDelete = new QLinkButton($this); $this->btnDelete->Text = 'Delete'; $this->btnDelete->CssClass = 'delete'; $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to DELETE this Signup Form? Any responsese from existing registrations will be deleted as well, and this cannot be undone.')); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click')); $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction()); } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'Id': // Gets the value for intId (Read-Only PK) // @return integer return $this->intId; case 'SignupFormId': // Gets the value for intSignupFormId (Not Null) // @return integer return $this->intSignupFormId; case 'OrderNumber': // Gets the value for intOrderNumber // @return integer return $this->intOrderNumber; case 'FormQuestionTypeId': // Gets the value for intFormQuestionTypeId (Not Null) // @return integer return $this->intFormQuestionTypeId; case 'ShortDescription': // Gets the value for strShortDescription // @return string return $this->strShortDescription; case 'Question': // Gets the value for strQuestion // @return string return $this->strQuestion; case 'RequiredFlag': // Gets the value for blnRequiredFlag // @return boolean return $this->blnRequiredFlag; case 'InternalFlag': // Gets the value for blnInternalFlag // @return boolean return $this->blnInternalFlag; case 'Options': // Gets the value for strOptions // @return string return $this->strOptions; case 'AllowOtherFlag': // Gets the value for blnAllowOtherFlag // @return boolean return $this->blnAllowOtherFlag; case 'ViewFlag': // Gets the value for blnViewFlag // @return boolean return $this->blnViewFlag; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'SignupForm': // Gets the value for the SignupForm object referenced by intSignupFormId (Not Null) // @return SignupForm try { if (!$this->objSignupForm && !is_null($this->intSignupFormId)) { $this->objSignupForm = SignupForm::Load($this->intSignupFormId); } return $this->objSignupForm; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '_FormAnswer': // Gets the value for the private _objFormAnswer (Read-Only) // if set due to an expansion on the form_answer.form_question_id reverse relationship // @return FormAnswer return $this->_objFormAnswer; case '_FormAnswerArray': // Gets the value for the private _objFormAnswerArray (Read-Only) // if set due to an ExpandAsArray on the form_answer.form_question_id reverse relationship // @return FormAnswer[] return (array) $this->_objFormAnswerArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
protected function Form_Create() { $this->lblHeading = new QLabel($this); if (QApplication::PathInfo(0)) { $objSignupForm = SignupForm::Load(QApplication::PathInfo(0)); if (!$objSignupForm) { QApplication::Redirect('/events/'); } if (!$objSignupForm->Ministry->IsLoginCanAdminMinistry(QApplication::$Login)) { QApplication::Redirect('/events/'); } $this->strPageTitle .= 'Edit Form'; $this->lblHeading->Text = 'Edit ' . $objSignupForm->Type . ' Form'; switch ($objSignupForm->SignupFormTypeId) { case SignupFormType::Event: $objChild = $objSignupForm->EventSignupForm; break; case SignupFormType::Course: $objChild = $objSignupForm->ClassMeeting; break; default: throw new Exception('Invalid SignupFormTypeId: ' . $objSignupForm->SignupFormTypeId); } } else { if (!QApplication::PathInfo(1)) { QApplication::Redirect('/events/'); } $objSignupForm = new SignupForm(); $objSignupForm->SignupFormTypeId = QApplication::PathInfo(1); $objSignupForm->DateCreated = QDateTime::Now(); $objSignupForm->ActiveFlag = true; $this->strPageTitle .= 'Create New Form'; $this->lblHeading->Text = 'Create New ' . $objSignupForm->Type . ' Form'; switch ($objSignupForm->SignupFormTypeId) { case SignupFormType::Event: $objChild = new EventSignupForm(); break; case SignupFormType::Course: $objChild = new ClassMeeting(); break; default: throw new Exception('Invalid SignupFormTypeId: ' . $objSignupForm->SignupFormTypeId); } } // Setup MCTs for Signup and Child $this->mctSignupForm = new SignupFormMetaControl($this, $objSignupForm); switch ($objSignupForm->SignupFormTypeId) { case SignupFormType::Event: $this->mctSignupChild = new EventSignupFormMetaControl($this, $objChild); break; case SignupFormType::Course: $this->mctSignupChild = new ClassMeetingMetaControl($this, $objChild); break; default: throw new Exception('Invalid SignupFormTypeId: ' . $objSignupForm->SignupFormTypeId); } $this->txtName = $this->mctSignupForm->txtName_Create(); $this->txtName->Select(); $this->txtName->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->txtName->Required = true; $this->txtDescription = $this->mctSignupForm->txtDescription_Create(); $this->txtInformationUrl = $this->mctSignupForm->txtInformationUrl_Create(); $this->chkAllowMultipleFlag = $this->mctSignupForm->chkAllowMultipleFlag_Create(); $this->chkAllowMultipleFlag->Name = 'Allow Multiple Registrations?'; $this->chkAllowMultipleFlag->Text = 'Check if people are allowed to be registered multiple times.'; $this->chkAllowOtherFlag = $this->mctSignupForm->chkAllowOtherFlag_Create(); $this->chkAllowOtherFlag->Name = 'Allow Registering for Others?'; $this->chkAllowOtherFlag->Text = 'Check if people are allowed to register on behalf of someone else.'; $this->chkAllowOtherFlag->Visible = false; $this->chkActiveFlag = $this->mctSignupForm->chkActiveFlag_Create(); $this->chkActiveFlag->Name = 'Active?'; $this->chkActiveFlag->Text = 'Check if this is an "Active" form.'; $this->txtToken = $this->mctSignupForm->txtToken_Create(); $this->txtToken->Name = 'Custom Signup Web Address'; $this->txtToken->HtmlBefore = '<span>https://my.alcf.net/signup/event.php / </span>'; $this->chkConfidentialFlag = $this->mctSignupForm->chkConfidentialFlag_Create(); $this->chkConfidentialFlag->Name = 'Confidential?'; $this->chkConfidentialFlag->Text = 'Check if this form is considered a "Confidential" form.'; $this->chkNoLoginSupportFlag = $this->mctSignupForm->chkLoginNotRequiredFlag_Create(); $this->chkNoLoginSupportFlag->Name = 'Support No Login?'; $this->chkNoLoginSupportFlag->Text = 'Check if you would like to allow users to signup without having to log in.'; $this->txtFundingAccount = $this->mctSignupForm->txtFundingAccount_Create(); if ($this->mctSignupForm->SignupForm->CountFormProducts()) { $this->txtFundingAccount->Required = true; } $this->lstDonationStewardshipFund = $this->mctSignupForm->lstDonationStewardshipFund_Create(null, QQ::Equal(QQN::StewardshipFund()->ActiveFlag, true), QQ::OrderBy(QQN::StewardshipFund()->Name)); $this->lstDonationStewardshipFund->Name = 'Funding Account for Donations'; if ($this->mctSignupForm->SignupForm->IsDonationAccepted()) { $this->lstDonationStewardshipFund->Required = true; } // Setup Ministry with Rules if (QApplication::$Login->RoleTypeId == RoleType::ChMSAdministrator) { $this->lstMinistry = $this->mctSignupForm->lstMinistry_Create(null, null, QQ::OrderBy(QQN::Ministry()->Name)); } else { $intMinistryIdArray = array(); foreach (QApplication::$Login->GetMinistryArray() as $objMinistry) { $intMinistryIdArray[] = $objMinistry->Id; } $this->lstMinistry = $this->mctSignupForm->lstMinistry_Create(null, QQ::In(QQN::Ministry()->Id, $intMinistryIdArray), QQ::OrderBy(QQN::Ministry()->Name)); } if ($this->mctSignupForm->EditMode) { $this->lstMinistry->Enabled = false; } // Communciation $this->txtSupportEmail = $this->mctSignupForm->txtSupportEmail_Create(); $this->txtEmailNotification = $this->mctSignupForm->txtEmailNotification_Create(); // Setup Limit $this->txtSignupLimit = $this->mctSignupForm->txtSignupLimit_Create(); $this->txtSignupLimit->Minimum = 0; // TODO: Implement Gender-Specific Limits $this->txtSignupMaleLimit = $this->mctSignupForm->txtSignupMaleLimit_Create(); $this->txtSignupMaleLimit->Visible = false; $this->txtSignupMaleLimit->Minimum = 0; $this->txtSignupFemaleLimit = $this->mctSignupForm->txtSignupFemaleLimit_Create(); $this->txtSignupFemaleLimit->Minimum = 0; $this->txtSignupFemaleLimit->Visible = false; // Setup Controls for Child switch ($objSignupForm->SignupFormTypeId) { case SignupFormType::Event: $this->dtxDateStart = $this->mctSignupChild->dtxDateStart_Create(); $this->calDateStart = $this->mctSignupChild->calDateStart_Create(); $this->dtxDateEnd = $this->mctSignupChild->dtxDateEnd_Create(); $this->calDateEnd = $this->mctSignupChild->calDateEnd_Create(); $this->txtLocation = $this->mctSignupChild->txtLocation_Create(); break; case SignupFormType::Course: $this->lstClassTerm = $this->mctSignupChild->lstClassTerm_Create(null, QQ::OrCondition(QQ::Equal(QQN::ClassTerm()->ActiveFlag, true), QQ::Equal(QQN::ClassTerm()->Id, $this->mctSignupChild->ClassMeeting->ClassTermId))); $this->lstClassCourse = $this->mctSignupChild->lstClassCourse_Create(null, null, QQ::OrderBy(QQN::ClassCourse()->Code)); $this->lstClassInstructor = $this->mctSignupChild->lstClassInstructor_Create(null, null, QQ::OrderBy(QQN::ClassInstructor()->DisplayName)); $this->calDateStart = $this->mctSignupChild->calDateStart_Create(); $this->calDateEnd = $this->mctSignupChild->calDateEnd_Create(); $this->txtLocation = $this->mctSignupChild->txtLocation_Create(); $this->lstMeetingDay = $this->mctSignupChild->lstMeetingDay_Create(); $this->lstMeetingStartTime = $this->mctSignupChild->lstMeetingStartTime_Create(); $this->lstMeetingEndTime = $this->mctSignupChild->lstMeetingEndTime_Create(); // Make some upates to the default fields $this->txtName->Enabled = false; $this->lstClassCourse->AddAction(new QChangeEvent(), new QAjaxAction('lstClassCourse_Change')); break; default: throw new Exception('Invalid SignupFormTypeId: ' . $objSignupForm->SignupFormTypeId); } // Buttons $this->btnSave = new QButton($this); $this->btnSave->Text = 'Save'; $this->btnSave->CssClass = 'primary'; $this->btnSave->CausesValidation = true; $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click')); $this->btnCancel = new QLinkButton($this); $this->btnCancel->Text = 'Cancel'; $this->btnCancel->CssClass = 'cancel'; $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click')); // Delete? if ($this->mctSignupForm->EditMode) { $this->btnDelete = new QLinkButton($this); $this->btnDelete->Text = 'Delete'; $this->btnDelete->CssClass = 'delete'; if ($this->mctSignupForm->SignupForm->CountSignupEntries()) { $this->btnDelete->AddAction(new QClickEvent(), new QAlertAction('This signup form already has signup entries and therefore cannot be deleted. An alternative option would be to simply mark this form as "Inactive".')); $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction()); } else { $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to DELETE this Signup Form? This cannot be undone.')); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click')); $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction()); } } }
protected function Form_Create() { $this->objSignupForm = SignupForm::Load(QApplication::PathInfo(0)); $this->lblHeading = new QLabel($this); if (!$this->objSignupForm) { QApplication::Redirect('/events/'); } if (!$this->objSignupForm->Ministry->IsLoginCanAdminMinistry(QApplication::$Login)) { QApplication::Redirect('/events/form.php/' . $this->objSignupForm->Id); } if (QApplication::PathInfo(1)) { $objProduct = FormProduct::Load(QApplication::PathInfo(1)); if (!$objProduct) { QApplication::Redirect('/events/form.php/' . $this->objSignupForm->Id); } if ($objProduct->SignupFormId != $this->objSignupForm->Id) { QApplication::Redirect('/events/form.php/' . $this->objSignupForm->Id); } $this->strPageTitle .= 'Edit Product'; $this->lblHeading->Text = 'Edit ' . $objProduct->Type . ' Product'; } else { if (!QApplication::PathInfo(2)) { QApplication::Redirect('/events/form.php/' . $this->objSignupForm->Id); } $objProduct = new FormProduct(); $objProduct->SignupForm = $this->objSignupForm; $objProduct->FormProductTypeId = QApplication::PathInfo(2); $objProduct->OrderNumber = 100000; $this->strPageTitle .= 'Create New Product'; $this->lblHeading->Text = 'Create New ' . $objProduct->Type . ' Product'; switch ($objProduct->FormProductTypeId) { case FormProductType::Required: $objProduct->MinimumQuantity = 1; $objProduct->MaximumQuantity = 1; break; case FormProductType::RequiredWithChoice: $objProduct->MinimumQuantity = 1; $objProduct->MaximumQuantity = 1; break; case FormProductType::Optional: break; default: throw new Exception('Invalid FormProductType: ' . $objProduct->FormProductTypeId); } $objProduct->FormPaymentTypeId = FormPaymentType::PayInFull; } $this->mctProduct = new FormProductMetaControl($this, $objProduct); // Fields $this->lblFormProductType = $this->mctProduct->lblFormProductTypeId_Create(); $this->txtName = $this->mctProduct->txtName_Create(); $this->txtName->Required = true; $this->txtDescription = $this->mctProduct->txtDescription_Create(); $this->dtxDateStart = $this->mctProduct->dtxDateStart_Create(); $this->calDateStart = $this->mctProduct->calDateStart_Create(); $this->dtxDateEnd = $this->mctProduct->dtxDateEnd_Create(); $this->calDateEnd = $this->mctProduct->calDateEnd_Create(); switch ($objProduct->FormProductTypeId) { case FormProductType::Required: break; case FormProductType::RequiredWithChoice: break; case FormProductType::Optional: $this->txtMaximumQuantity = $this->mctProduct->txtMaximumQuantity_Create(); $this->txtMaximumQuantity->Required = true; $this->txtMaximumQuantity->Minimum = 0; $this->txtMinimumQuantity = $this->mctProduct->txtMinimumQuantity_Create(); $this->txtMinimumQuantity->Required = true; $this->txtMinimumQuantity->Minimum = 0; break; default: throw new Exception('Invalid FormProductType: ' . $objProduct->FormProductTypeId); } // Setup Payment $this->lstFormPaymentTypeId = $this->mctProduct->lstFormPaymentType_Create(); $this->lstFormPaymentTypeId->AddAction(new QChangeEvent(), new QAjaxAction('lstFormPaymentTypeId_Refresh')); $this->txtCost = $this->mctProduct->txtCost_Create(); $this->txtCost->HtmlBefore = '<span>$ </span>'; $this->txtCost->Minimum = 0; $this->txtDeposit = $this->mctProduct->txtDeposit_Create(); $this->txtDeposit->HtmlBefore = '<span>$ </span>'; $this->txtDeposit->Minimum = 0; $this->lstFormPaymentTypeId_Refresh(null, null, null); // Buttons $this->btnSave = new QButton($this); $this->btnSave->Text = 'Save'; $this->btnSave->CssClass = 'primary'; $this->btnSave->CausesValidation = true; $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click')); $this->btnCancel = new QLinkButton($this); $this->btnCancel->Text = 'Cancel'; $this->btnCancel->CssClass = 'cancel'; $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click')); // Delete? if ($this->mctProduct->EditMode) { $this->btnDelete = new QLinkButton($this); $this->btnDelete->Text = 'Delete'; $this->btnDelete->CssClass = 'delete'; if ($this->mctProduct->FormProduct->CountSignupProducts()) { $this->btnDelete->AddAction(new QClickEvent(), new QAlertAction('You cannot delete this product as there are already registrations that have selected it. A better idea would be to put an "end date" in the past.')); $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction()); } else { $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to DELETE this Product? This cannot be undone.')); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click')); $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction()); } } }
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()); } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'SignupFormId': // Gets the value for intSignupFormId (PK) // @return integer return $this->intSignupFormId; case 'ClassTermId': // Gets the value for intClassTermId (Not Null) // @return integer return $this->intClassTermId; case 'ClassCourseId': // Gets the value for intClassCourseId (Not Null) // @return integer return $this->intClassCourseId; case 'ClassInstructorId': // Gets the value for intClassInstructorId (Not Null) // @return integer return $this->intClassInstructorId; case 'DateStart': // Gets the value for dttDateStart (Not Null) // @return QDateTime return $this->dttDateStart; case 'DateEnd': // Gets the value for dttDateEnd (Not Null) // @return QDateTime return $this->dttDateEnd; case 'Location': // Gets the value for strLocation // @return string return $this->strLocation; case 'MeetingDay': // Gets the value for intMeetingDay // @return integer return $this->intMeetingDay; case 'MeetingStartTime': // Gets the value for intMeetingStartTime // @return integer return $this->intMeetingStartTime; case 'MeetingEndTime': // Gets the value for intMeetingEndTime // @return integer return $this->intMeetingEndTime; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'SignupForm': // Gets the value for the SignupForm object referenced by intSignupFormId (PK) // @return SignupForm try { if (!$this->objSignupForm && !is_null($this->intSignupFormId)) { $this->objSignupForm = SignupForm::Load($this->intSignupFormId); } return $this->objSignupForm; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ClassTerm': // Gets the value for the ClassTerm object referenced by intClassTermId (Not Null) // @return ClassTerm try { if (!$this->objClassTerm && !is_null($this->intClassTermId)) { $this->objClassTerm = ClassTerm::Load($this->intClassTermId); } return $this->objClassTerm; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ClassCourse': // Gets the value for the ClassCourse object referenced by intClassCourseId (Not Null) // @return ClassCourse try { if (!$this->objClassCourse && !is_null($this->intClassCourseId)) { $this->objClassCourse = ClassCourse::Load($this->intClassCourseId); } return $this->objClassCourse; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ClassInstructor': // Gets the value for the ClassInstructor object referenced by intClassInstructorId (Not Null) // @return ClassInstructor try { if (!$this->objClassInstructor && !is_null($this->intClassInstructorId)) { $this->objClassInstructor = ClassInstructor::Load($this->intClassInstructorId); } return $this->objClassInstructor; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '_ClassRegistration': // Gets the value for the private _objClassRegistration (Read-Only) // if set due to an expansion on the class_registration.class_meeting_id reverse relationship // @return ClassRegistration return $this->_objClassRegistration; case '_ClassRegistrationArray': // Gets the value for the private _objClassRegistrationArray (Read-Only) // if set due to an ExpandAsArray on the class_registration.class_meeting_id reverse relationship // @return ClassRegistration[] return (array) $this->_objClassRegistrationArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'Id': // Gets the value for intId (Read-Only PK) // @return integer return $this->intId; case 'SignupFormId': // Gets the value for intSignupFormId (Not Null) // @return integer return $this->intSignupFormId; case 'PersonId': // Gets the value for intPersonId // @return integer return $this->intPersonId; case 'SignupByPersonId': // Gets the value for intSignupByPersonId // @return integer return $this->intSignupByPersonId; case 'SignupEntryStatusTypeId': // Gets the value for intSignupEntryStatusTypeId (Not Null) // @return integer return $this->intSignupEntryStatusTypeId; case 'DateCreated': // Gets the value for dttDateCreated (Not Null) // @return QDateTime return $this->dttDateCreated; case 'DateSubmitted': // Gets the value for dttDateSubmitted // @return QDateTime return $this->dttDateSubmitted; case 'AmountTotal': // Gets the value for fltAmountTotal // @return double return $this->fltAmountTotal; case 'AmountPaid': // Gets the value for fltAmountPaid // @return double return $this->fltAmountPaid; case 'AmountBalance': // Gets the value for fltAmountBalance // @return double return $this->fltAmountBalance; case 'InternalNotes': // Gets the value for strInternalNotes // @return string return $this->strInternalNotes; case 'CommunicationsEntryId': // Gets the value for intCommunicationsEntryId // @return integer return $this->intCommunicationsEntryId; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'SignupForm': // Gets the value for the SignupForm object referenced by intSignupFormId (Not Null) // @return SignupForm try { if (!$this->objSignupForm && !is_null($this->intSignupFormId)) { $this->objSignupForm = SignupForm::Load($this->intSignupFormId); } return $this->objSignupForm; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Person': // Gets the value for the Person object referenced by intPersonId // @return Person try { if (!$this->objPerson && !is_null($this->intPersonId)) { $this->objPerson = Person::Load($this->intPersonId); } return $this->objPerson; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'SignupByPerson': // Gets the value for the Person object referenced by intSignupByPersonId // @return Person try { if (!$this->objSignupByPerson && !is_null($this->intSignupByPersonId)) { $this->objSignupByPerson = Person::Load($this->intSignupByPersonId); } return $this->objSignupByPerson; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CommunicationsEntry': // Gets the value for the CommunicationListEntry object referenced by intCommunicationsEntryId // @return CommunicationListEntry try { if (!$this->objCommunicationsEntry && !is_null($this->intCommunicationsEntryId)) { $this->objCommunicationsEntry = CommunicationListEntry::Load($this->intCommunicationsEntryId); } return $this->objCommunicationsEntry; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ClassRegistration': // Gets the value for the ClassRegistration object that uniquely references this SignupEntry // by objClassRegistration (Unique) // @return ClassRegistration try { if ($this->objClassRegistration === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objClassRegistration) { $this->objClassRegistration = ClassRegistration::LoadBySignupEntryId($this->intId); } return $this->objClassRegistration; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '_FormAnswer': // Gets the value for the private _objFormAnswer (Read-Only) // if set due to an expansion on the form_answer.signup_entry_id reverse relationship // @return FormAnswer return $this->_objFormAnswer; case '_FormAnswerArray': // Gets the value for the private _objFormAnswerArray (Read-Only) // if set due to an ExpandAsArray on the form_answer.signup_entry_id reverse relationship // @return FormAnswer[] return (array) $this->_objFormAnswerArray; case '_SignupPayment': // Gets the value for the private _objSignupPayment (Read-Only) // if set due to an expansion on the signup_payment.signup_entry_id reverse relationship // @return SignupPayment return $this->_objSignupPayment; case '_SignupPaymentArray': // Gets the value for the private _objSignupPaymentArray (Read-Only) // if set due to an ExpandAsArray on the signup_payment.signup_entry_id reverse relationship // @return SignupPayment[] return (array) $this->_objSignupPaymentArray; case '_SignupProduct': // Gets the value for the private _objSignupProduct (Read-Only) // if set due to an expansion on the signup_product.signup_entry_id reverse relationship // @return SignupProduct return $this->_objSignupProduct; case '_SignupProductArray': // Gets the value for the private _objSignupProductArray (Read-Only) // if set due to an ExpandAsArray on the signup_product.signup_entry_id reverse relationship // @return SignupProduct[] return (array) $this->_objSignupProductArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'SignupFormId': // Gets the value for intSignupFormId (PK) // @return integer return $this->intSignupFormId; case 'DateStart': // Gets the value for dttDateStart // @return QDateTime return $this->dttDateStart; case 'DateEnd': // Gets the value for dttDateEnd // @return QDateTime return $this->dttDateEnd; case 'Location': // Gets the value for strLocation // @return string return $this->strLocation; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'SignupForm': // Gets the value for the SignupForm object referenced by intSignupFormId (PK) // @return SignupForm try { if (!$this->objSignupForm && !is_null($this->intSignupFormId)) { $this->objSignupForm = SignupForm::Load($this->intSignupFormId); } return $this->objSignupForm; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
protected function Form_Create() { $this->objSignupForm = SignupForm::Load(QApplication::PathInfo(0)); if (!$this->objSignupForm) { QApplication::Redirect('/events/'); } $this->mctSignupForm = SignupFormMetaControl::Create($this, $this->objSignupForm->Id); if (!$this->objSignupForm->IsLoginCanView(QApplication::$Login)) { QApplication::Redirect('/events/'); } $this->strPageTitle .= $this->objSignupForm->Name; $this->dtgQuestions = new FormQuestionDataGrid($this); $this->dtgQuestions->AddColumn(new QDataGridColumn('Reorder', '<?= $_FORM->RenderReorderQuestion($_ITEM); ?>', 'HtmlEntities=false', 'Width=60px')); $this->dtgQuestions->MetaAddTypeColumn('FormQuestionTypeId', 'FormQuestionType', 'Name=Question Type', 'Width=140px'); $this->dtgQuestions->MetaAddColumn('ShortDescription', 'Html=<?= $_FORM->RenderShortDescription($_ITEM); ?>', 'Width=170px', 'HtmlEntities=false'); $this->dtgQuestions->MetaAddColumn('Question', 'Width=400px'); $this->dtgQuestions->MetaAddColumn('RequiredFlag', 'Width=60px', 'Name=Required?', 'Html=<?= ($_ITEM->RequiredFlag ? "Yes" : null) ?>'); $this->dtgQuestions->MetaAddColumn('InternalFlag', 'Width=60px', 'Name=Internal Only', 'Html=<?= ($_ITEM->InternalFlag ? "Yes" : null) ?>'); $this->dtgQuestions->SetDataBinder('dtgQuestions_Bind'); $this->dtgProductsArray = array(); foreach (FormProductType::$NameArray as $intFormProductTypeId => $strName) { if (FormProduct::CountBySignupFormIdFormProductTypeId($this->objSignupForm->Id, $intFormProductTypeId)) { $dtgProducts = new FormProductDataGrid($this); $dtgProducts->Name = $intFormProductTypeId; $dtgProducts->SetDataBinder('dtgProducts_Bind'); $dtgProducts->AddColumn(new QDataGridColumn('Reorder', '<?= $_FORM->RenderReorderProduct($_ITEM, $_CONTROL); ?>', 'HtmlEntities=false', 'Width=60px')); $dtgProducts->MetaAddColumn('Name', 'Html=<?= $_FORM->RenderName($_ITEM); ?>', 'Width=250px', 'HtmlEntities=false'); $dtgProducts->MetaAddColumn('DateStart', 'Name=Date Available', 'Html=<?= $_ITEM->DateStartHtml; ?>', 'HtmlEntities=false', 'Width=100px'); $dtgProducts->MetaAddColumn('DateEnd', 'Name=Date Unavail.', 'Html=<?= $_ITEM->DateEndHtml; ?>', 'HtmlEntities=false', 'Width=100px'); $dtgProducts->MetaAddColumn('MinimumQuantity', 'Name=Min. Qty.', 'Width=70px'); $dtgProducts->MetaAddColumn('MaximumQuantity', 'Name=Max. Qty.', 'Width=70px'); $dtgProducts->MetaAddTypeColumn('FormPaymentTypeId', 'FormPaymentType', 'Name=Pay Type', 'Width=70px'); $dtgProducts->MetaAddColumn('Cost', 'Html=<?= $_FORM->RenderAmount($_ITEM->Cost, false); ?>', 'Width=70px'); $dtgProducts->MetaAddColumn('Deposit', 'Html=<?= $_FORM->RenderAmount($_ITEM->Deposit, false); ?>', 'Width=70px'); $this->dtgProductsArray[] = $dtgProducts; } } if ($this->objSignupForm->Ministry->IsLoginCanAdminMinistry(QApplication::$Login)) { $this->lstCreateNew = new QListBox($this); $this->lstCreateNew->AddItem('- Create New Question or Product -', null); foreach (FormQuestionType::$NameArray as $intId => $strName) { $this->lstCreateNew->AddItem($strName, $intId, false, 'Question Types'); } foreach (FormProductType::$NameArray as $intId => $strName) { $this->lstCreateNew->AddItem($strName, $intId * -1, false, 'Product Types'); } $this->lstCreateNew->AddAction(new QChangeEvent(), new QAjaxAction('lstCreateNew_Change')); } // Setup "About Event" label controls $this->SetupLabels(); switch ($this->objSignupForm->SignupFormTypeId) { case SignupFormType::Event: $this->SetupLabelsForEvent(); break; case SignupFormType::Course: $this->SetupLabelsForCourse(); break; } // Add email automatically if "Allow No Login" is selected // and if email is not already there. $bHasEmail = false; $objQuestionArray = FormQuestion::LoadArrayBySignupFormId($this->objSignupForm->Id); foreach ($objQuestionArray as $objQuestionItem) { if ($objQuestionItem->FormQuestionTypeId == 7) { $bHasEmail = true; break; } } if ($this->objSignupForm->LoginNotRequiredFlag && !$bHasEmail) { $objQuestion = new FormQuestion(); $objQuestion->SignupForm = $this->objSignupForm; $objQuestion->FormQuestionTypeId = 7; // email $objQuestion->OrderNumber = 100000; $objQuestion->ShortDescription = 'Email Address'; $objQuestion->Question = 'Email Address'; $objQuestion->RequiredFlag = true; $objQuestion->ViewFlag = true; $objQuestion->Save(); } $this->pxyMoveDownQuestion = new QControlProxy($this); $this->pxyMoveDownQuestion->AddAction(new QClickEvent(), new QAjaxAction('pxyMoveDownQuestion_Click')); $this->pxyMoveDownQuestion->AddAction(new QClickEvent(), new QTerminateAction()); $this->pxyMoveUpQuestion = new QControlProxy($this); $this->pxyMoveUpQuestion->AddAction(new QClickEvent(), new QAjaxAction('pxyMoveUpQuestion_Click')); $this->pxyMoveUpQuestion->AddAction(new QClickEvent(), new QTerminateAction()); $this->pxyMoveDownProduct = new QControlProxy($this); $this->pxyMoveDownProduct->AddAction(new QClickEvent(), new QAjaxAction('pxyMoveDownProduct_Click')); $this->pxyMoveDownProduct->AddAction(new QClickEvent(), new QTerminateAction()); $this->pxyMoveUpProduct = new QControlProxy($this); $this->pxyMoveUpProduct->AddAction(new QClickEvent(), new QAjaxAction('pxyMoveUpProduct_Click')); $this->pxyMoveUpProduct->AddAction(new QClickEvent(), new QTerminateAction()); }
/** * Reload this SignupForm 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 SignupForm object.'); } // Reload the Object $objReloaded = SignupForm::Load($this->intId); // Update $this's local variables to match $this->SignupFormTypeId = $objReloaded->SignupFormTypeId; $this->MinistryId = $objReloaded->MinistryId; $this->strName = $objReloaded->strName; $this->strToken = $objReloaded->strToken; $this->blnActiveFlag = $objReloaded->blnActiveFlag; $this->blnConfidentialFlag = $objReloaded->blnConfidentialFlag; $this->strDescription = $objReloaded->strDescription; $this->strInformationUrl = $objReloaded->strInformationUrl; $this->strSupportEmail = $objReloaded->strSupportEmail; $this->strEmailNotification = $objReloaded->strEmailNotification; $this->blnAllowOtherFlag = $objReloaded->blnAllowOtherFlag; $this->blnAllowMultipleFlag = $objReloaded->blnAllowMultipleFlag; $this->intSignupLimit = $objReloaded->intSignupLimit; $this->intSignupMaleLimit = $objReloaded->intSignupMaleLimit; $this->intSignupFemaleLimit = $objReloaded->intSignupFemaleLimit; $this->strFundingAccount = $objReloaded->strFundingAccount; $this->DonationStewardshipFundId = $objReloaded->DonationStewardshipFundId; $this->dttDateCreated = $objReloaded->dttDateCreated; $this->blnLoginNotRequiredFlag = $objReloaded->blnLoginNotRequiredFlag; }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'Id': // Gets the value for intId (Read-Only PK) // @return integer return $this->intId; case 'SignupFormId': // Gets the value for intSignupFormId (Not Null) // @return integer return $this->intSignupFormId; case 'OrderNumber': // Gets the value for intOrderNumber // @return integer return $this->intOrderNumber; case 'FormProductTypeId': // Gets the value for intFormProductTypeId (Not Null) // @return integer return $this->intFormProductTypeId; case 'FormPaymentTypeId': // Gets the value for intFormPaymentTypeId (Not Null) // @return integer return $this->intFormPaymentTypeId; case 'Name': // Gets the value for strName // @return string return $this->strName; case 'Description': // Gets the value for strDescription // @return string return $this->strDescription; case 'DateStart': // Gets the value for dttDateStart // @return QDateTime return $this->dttDateStart; case 'DateEnd': // Gets the value for dttDateEnd // @return QDateTime return $this->dttDateEnd; case 'MinimumQuantity': // Gets the value for intMinimumQuantity // @return integer return $this->intMinimumQuantity; case 'MaximumQuantity': // Gets the value for intMaximumQuantity // @return integer return $this->intMaximumQuantity; case 'Cost': // Gets the value for fltCost // @return double return $this->fltCost; case 'Deposit': // Gets the value for fltDeposit // @return double return $this->fltDeposit; case 'ViewFlag': // Gets the value for blnViewFlag // @return boolean return $this->blnViewFlag; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'SignupForm': // Gets the value for the SignupForm object referenced by intSignupFormId (Not Null) // @return SignupForm try { if (!$this->objSignupForm && !is_null($this->intSignupFormId)) { $this->objSignupForm = SignupForm::Load($this->intSignupFormId); } return $this->objSignupForm; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '_SignupProduct': // Gets the value for the private _objSignupProduct (Read-Only) // if set due to an expansion on the signup_product.form_product_id reverse relationship // @return SignupProduct return $this->_objSignupProduct; case '_SignupProductArray': // Gets the value for the private _objSignupProductArray (Read-Only) // if set due to an ExpandAsArray on the signup_product.form_product_id reverse relationship // @return SignupProduct[] return (array) $this->_objSignupProductArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * 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 SignupFormMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing SignupForm object creation - defaults to CreateOrEdit * @return SignupFormMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objSignupForm = SignupForm::Load($intId); // SignupForm was found -- return it! if ($objSignupForm) { return new SignupFormMetaControl($objParentObject, $objSignupForm); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a SignupForm 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 SignupFormMetaControl($objParentObject, new SignupForm()); }
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')); }
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(); }
<?php require dirname(__FILE__) . '/../../includes/prepend.inc.php'; QApplication::Authenticate(); function EscapeCsv($strString) { return '"' . str_replace('"', '""', $strString) . '"'; } $objSignupForm = SignupForm::Load(QApplication::PathInfo(0)); if (!$objSignupForm) { QApplication::Redirect('/events/'); } if (!$objSignupForm->IsLoginCanView(QApplication::$Login)) { QApplication::Redirect('/events/'); } // Disable strict no-cache for IE due to IE issues with downloading no-cache items if (QApplication::IsBrowser(QBrowserType::InternetExplorer)) { header("Pragma:"); header("Expires:"); } header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename=' . $objSignupForm->CsvFilename); $objFormQuestionArray = $objSignupForm->GetFormQuestionArray(QQ::OrderBy(QQN::FormQuestion()->OrderNumber)); // Get Column Titles print "First Name,Last Name"; foreach ($objFormQuestionArray as $objFormQuestion) { if ($objFormQuestion->FormQuestionTypeId == FormQuestionType::Address) { print ", Street"; print ", City"; print ", State And Zip Code"; } else {