Example #1
0
 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());
     }
 }
Example #2
0
 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';
 }
Example #3
0
File: result.php Project: 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());
     }
 }
Example #4
0
File: form.php Project: alcf/chms
 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());
 }