User: Ashley Kodya Date: 1/14/16 Time: 9:05 PM
Inheritance: extends CI_Controller
Ejemplo n.º 1
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 . ' - 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;
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Creates a new User model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new User();
     $signup = new SignupForm(['scenario' => 'signup']);
     if (Yii::$app->request->isPost) {
         $signup->load(Yii::$app->request->post());
         if ($user = $signup->signup()) {
             $model->load(Yii::$app->request->post());
             $user->role = $model->role;
             $user->save();
             return $this->redirect(['view', 'id' => $user->id]);
         }
     } else {
         return $this->render('create', ['model' => $model, 'signup' => $signup]);
     }
 }
Ejemplo n.º 3
0
 public function dtgProducts_Bind()
 {
     $arrDataSource = array();
     // First add any required products
     foreach ($this->objSignupForm->GetFormProductArrayByType(FormProductType::Required, QQ::OrderBy(QQN::FormProduct()->OrderNumber)) as $objProduct) {
         if ($objProduct->IsAvailableRightNow()) {
             $arrDataSource[] = $objProduct;
         }
     }
     // If there are any valid "Required with Choice" products, add the row for it
     foreach ($this->objSignupForm->GetFormProductArrayByType(FormProductType::RequiredWithChoice, QQ::OrderBy(QQN::FormProduct()->OrderNumber)) as $objProduct) {
         if ($objProduct->IsAvailableRightNow()) {
             $arrDataSource[] = -1;
             break;
         }
     }
     // Add any optional products
     foreach ($this->objSignupForm->GetFormProductArrayByType(FormProductType::Optional, QQ::OrderBy(QQN::FormProduct()->OrderNumber)) as $objProduct) {
         if ($objProduct->IsAvailableRightNow()) {
             $arrDataSource[] = $objProduct;
         }
     }
     // Add any payments
     $arrDataSource = array_merge($arrDataSource, $this->objSignupEntry->GetSignupPaymentArray(QQ::OrderBy(QQN::SignupPayment()->TransactionDate)));
     // Add "Balance Due"
     $arrDataSource[] = null;
     $this->dtgProducts->DataSource = $arrDataSource;
 }
Ejemplo n.º 4
0
Archivo: index.php Proyecto: alcf/chms
 public function dtgSignupForms_Bind()
 {
     if ($this->intMinistryId) {
         $this->dtgSignupForms->DataSource = SignupForm::LoadOrderedArrayByMinistryIdAndConfidentiality($this->intMinistryId, Ministry::Load($this->intMinistryId)->IsLoginCanAdminMinistry(QApplication::$Login), !$this->chkViewAll->Checked);
         $this->dtgSignupForms->Visible = true;
     } else {
         $this->dtgSignupForms->DataSource = null;
         $this->dtgSignupForms->Visible = false;
     }
     $this->lblStartText->Visible = !$this->dtgSignupForms->Visible;
 }
Ejemplo n.º 5
0
 public function dtgMyClassAttendance_Bind()
 {
     $objSignupEntryArray = array();
     $i = 0;
     foreach ($this->objSignupForm->GetSignupEntryArray() as $objSignupentry) {
         if ($objSignupentry->SignupEntryStatusTypeId == SignupEntryStatusType::Complete) {
             array_push($objSignupEntryArray, $objSignupentry);
             $this->mctClassRegistrationArray[$objSignupentry->Id] = new ClassRegistrationMetaControl($this->dlgEdit, $objSignupentry->ClassRegistration);
             $i++;
         }
     }
     $this->dtgClassAttendance->DataSource = $objSignupEntryArray;
 }
Ejemplo n.º 6
0
 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());
 }
Ejemplo n.º 7
0
 public function dtgSignupEntries_SetupColumns()
 {
     $this->dtgSignupEntries->RemoveAllColumns();
     $this->dtgSignupEntries->MetaAddColumn(QQN::SignupEntry()->Person->LastName, 'Name=Name', 'Html=<?= $_FORM->RenderName($_ITEM); ?>', 'HtmlEntities=false');
     //			$this->dtgSignupEntries->MetaAddTypeColumn('SignupEntryStatusTypeId', 'SignupEntryStatusType', 'Name=Status');
     foreach ($this->objSignupForm->GetFormQuestionArray(QQ::OrderBy(QQN::FormQuestion()->OrderNumber)) as $objFormQuestion) {
         if ($objFormQuestion->ViewFlag) {
             $this->dtgSignupEntries->AddColumn(new QDataGridColumn($objFormQuestion->ShortDescription, '<?= $_FORM->RenderAnswer($_ITEM, ' . $objFormQuestion->Id . ',' . $objFormQuestion->FormQuestionTypeId . '); ?>', 'HtmlEntities=false'));
         }
     }
     foreach ($this->objSignupForm->GetFormProductArray(QQ::OrderBy(QQN::FormProduct()->FormProductTypeId, QQN::FormProduct()->OrderNumber)) as $objFormProduct) {
         if ($objFormProduct->ViewFlag) {
             /* $this->dtgSignupEntries->AddColumn(new QDataGridColumn($objFormProduct->Name. ' Quantity', '<?= $_FORM->RenderProductQuantity($_ITEM, ' . $objFormProduct->Id . '); ?>', 'HtmlEntities=false'));*/
             $this->dtgSignupEntries->AddColumn(new QDataGridColumn($objFormProduct->Name, '<?= $_FORM->RenderProductAmount($_ITEM, ' . $objFormProduct->Id . '); ?>', 'HtmlEntities=false'));
         }
     }
     if ($this->objSignupForm->CountFormProducts()) {
         $this->dtgSignupEntries->MetaAddColumn(QQN::SignupEntry()->AmountPaid, 'Name=Paid', 'Html=<?= $_FORM->RenderAmount($_ITEM->AmountPaid); ?>');
         $this->dtgSignupEntries->MetaAddColumn(QQN::SignupEntry()->AmountBalance, 'Name=Balance', 'Html=<?= $_FORM->RenderAmount($_ITEM->AmountBalance); ?>');
         $this->dtgSignupEntries->AddColumn(new QDataGridColumn('Payment Type', '<?= $_FORM->RenderPaymentType($_ITEM); ?>', 'HtmlEntities=false'));
     }
     $this->dtgSignupEntries->MetaAddColumn(QQN::SignupEntry()->DateSubmitted, 'Name=Submitted', 'Html=<?= $_ITEM->DateSubmitted ? $_ITEM->DateSubmitted->ToString("MMM D YYYY") : null; ?>');
 }
Ejemplo n.º 8
0
 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 &quot;yes&quot;';
             $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());
     }
 }
Ejemplo n.º 9
0
Archivo: result.php Proyecto: alcf/chms
 protected function dtgFormProducts_Bind()
 {
     $this->dtgFormProducts->DataSource = $this->objSignupForm->GetFormProductArray(QQ::OrderBy(QQN::FormProduct()->FormProductTypeId, QQN::FormProduct()->OrderNumber));
 }
Ejemplo n.º 10
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, SignupForm::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
Ejemplo n.º 11
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objSignupForm) {
         $objObject->objSignupForm = SignupForm::GetSoapObjectFromObject($objObject->objSignupForm, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intSignupFormId = null;
         }
     }
     return $objObject;
 }
Ejemplo n.º 12
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objSignupForm) {
         $objObject->objSignupForm = SignupForm::GetSoapObjectFromObject($objObject->objSignupForm, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intSignupFormId = null;
         }
     }
     if ($objObject->objPerson) {
         $objObject->objPerson = Person::GetSoapObjectFromObject($objObject->objPerson, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPersonId = null;
         }
     }
     if ($objObject->objSignupByPerson) {
         $objObject->objSignupByPerson = Person::GetSoapObjectFromObject($objObject->objSignupByPerson, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intSignupByPersonId = null;
         }
     }
     if ($objObject->dttDateCreated) {
         $objObject->dttDateCreated = $objObject->dttDateCreated->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->dttDateSubmitted) {
         $objObject->dttDateSubmitted = $objObject->dttDateSubmitted->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->objCommunicationsEntry) {
         $objObject->objCommunicationsEntry = CommunicationListEntry::GetSoapObjectFromObject($objObject->objCommunicationsEntry, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intCommunicationsEntryId = null;
         }
     }
     return $objObject;
 }
Ejemplo n.º 13
0
 public static function GenerateFormInMinistry(Ministry $objMinistry)
 {
     $objSignupForm = new SignupForm();
     $objSignupForm->SignupFormTypeId = SignupFormType::Event;
     $objSignupForm->Ministry = $objMinistry;
     $objSignupForm->Name = self::GenerateTitle(3, 8);
     if (rand(0, 2)) {
         $strToken = strtolower($objSignupForm->Name);
         $strToken = str_replace(' ', '_', $strToken);
         if (!SignupForm::LoadByToken($strToken)) {
             $objSignupForm->Token = $strToken;
         }
     }
     $objSignupForm->ActiveFlag = rand(0, 10);
     $objSignupForm->Description = self::GenerateContent(rand(1, 3), 8, 20);
     $objSignupForm->InformationUrl = 'http://www.yahoo.com/';
     $objSignupForm->EmailNotification = rand(0, 1) ? 'mike@michaelho.com, mike.ho@alcf.net' : null;
     $objSignupForm->AllowOtherFlag = rand(0, 1);
     $objSignupForm->AllowMultipleFlag = rand(0, 1);
     switch (rand(0, 5)) {
         case 1:
             $objSignupForm->SignupLimit = 50;
             break;
         case 2:
             $objSignupForm->SignupMaleLimit = 50;
             $objSignupForm->SignupFemaleLimit = 50;
             break;
     }
     $objSignupForm->DateCreated = self::GenerateDateTime(self::$SystemStartDate, QDateTime::Now());
     $objSignupForm->Save();
     $objEventSignupForm = new EventSignupForm();
     $objEventSignupForm->SignupForm = $objSignupForm;
     $objEventSignupForm->DateStart = new QDateTime('2011-06-27 17:00');
     $objEventSignupForm->DateEnd = new QDateTime('2011-06-30 12:00');
     $objEventSignupForm->Location = 'Camp Hammer, Boulder Creek, CA';
     $objEventSignupForm->Save();
     // Add form products information
     // 1: Required Product
     $intOrderNumber = 1;
     if (rand(0, 1)) {
         $objFormProduct = new FormProduct();
         $objFormProduct->SignupForm = $objSignupForm;
         $objFormProduct->FormProductTypeId = FormProductType::Required;
         $objFormProduct->FormPaymentTypeId = self::GenerateFromArray(array_keys(FormPaymentType::$NameArray));
         $objFormProduct->Name = 'Main Registration Fee';
         switch ($objFormProduct->FormPaymentTypeId) {
             case FormPaymentType::DepositRequired:
                 $objFormProduct->Cost = rand(1, 10) * 10;
                 $objFormProduct->Deposit = $objFormProduct->Cost / 2;
                 break;
             case FormPaymentType::PayInFull:
                 $objFormProduct->Cost = rand(1, 10) * 10;
                 break;
             case FormPaymentType::Donation:
                 $objFormProduct->FormPaymentTypeId = FormPaymentType::PayInFull;
                 $objFormProduct->Cost = rand(1, 10) * 10;
                 break;
         }
         $objFormProduct->OrderNumber = $intOrderNumber;
         $intOrderNumber++;
         $objFormProduct->ViewFlag = true;
         $objFormProduct->MinimumQuantity = 1;
         $objFormProduct->MaximumQuantity = 1;
         $objFormProduct->Save();
     }
     // 2: Required w/ Choice Product
     if (rand(0, 1)) {
         $arrProduct = array('100' => 'Standard Accommodation', '150' => 'Deluxe Accommodation');
         foreach ($arrProduct as $fltAmount => $strName) {
             $objFormProduct = new FormProduct();
             $objFormProduct->SignupForm = $objSignupForm;
             $objFormProduct->FormProductTypeId = FormProductType::RequiredWithChoice;
             $objFormProduct->FormPaymentTypeId = FormPaymentType::PayInFull;
             $objFormProduct->Name = $strName;
             $objFormProduct->Description = self::GenerateContent(1, 3, 10);
             $objFormProduct->Cost = $fltAmount;
             $objFormProduct->OrderNumber = $intOrderNumber;
             $objFormProduct->MinimumQuantity = 1;
             $objFormProduct->MaximumQuantity = 1;
             $intOrderNumber++;
             $objFormProduct->ViewFlag = true;
             $objFormProduct->Save();
         }
     }
     // 3: Optional Product(s)
     $intProductCount = rand(0, 3);
     for ($i = 0; $i < $intProductCount; $i++) {
         $objFormProduct = new FormProduct();
         $objFormProduct->SignupForm = $objSignupForm;
         $objFormProduct->FormProductTypeId = FormProductType::Optional;
         $objFormProduct->FormPaymentTypeId = FormPaymentType::PayInFull;
         $objFormProduct->Name = self::GenerateTitle(2, 5);
         $objFormProduct->Description = self::GenerateContent(1, 3, 10);
         $objFormProduct->MinimumQuantity = 1;
         $objFormProduct->MaximumQuantity = rand(1, 3);
         $objFormProduct->Cost = rand(1, 10) * 5;
         $objFormProduct->OrderNumber = $intOrderNumber;
         $intOrderNumber++;
         $objFormProduct->ViewFlag = true;
         $objFormProduct->Save();
     }
     // 4: Otpional Donation
     if (rand(0, 1)) {
         $objFormProduct = new FormProduct();
         $objFormProduct->SignupForm = $objSignupForm;
         $objFormProduct->FormProductTypeId = FormProductType::Optional;
         $objFormProduct->FormPaymentTypeId = FormPaymentType::Donation;
         $objFormProduct->Name = 'Donation';
         $objFormProduct->Description = self::GenerateContent(1, 3, 10);
         $objFormProduct->MinimumQuantity = 1;
         $objFormProduct->MaximumQuantity = 1;
         $objFormProduct->OrderNumber = $intOrderNumber;
         $intOrderNumber++;
         $objFormProduct->ViewFlag = true;
         $objFormProduct->Save();
     }
     // Add Form Questions
     $intOrderNumber = 1;
     foreach (FormQuestionType::$NameArray as $intFormQuestionTypeId => $strName) {
         if (rand(0, 1)) {
             $objFormQuestion = null;
         } else {
             $objFormQuestion = new FormQuestion();
             $objFormQuestion->SignupForm = $objSignupForm;
             $objFormQuestion->OrderNumber = $intOrderNumber;
             $objFormQuestion->FormQuestionTypeId = $intFormQuestionTypeId;
             $objFormQuestion->RequiredFlag = rand(0, 1);
             $objFormQuestion->ViewFlag = rand(0, 1);
             switch ($intFormQuestionTypeId) {
                 case FormQuestionType::SpouseName:
                     $objFormQuestion->ShortDescription = 'Spouse\'s Name';
                     $objFormQuestion->Question = 'What is your spouse\'s name?';
                     break;
                 case FormQuestionType::Address:
                     $objFormQuestion->ShortDescription = 'Home Address';
                     $objFormQuestion->Question = 'What is your address?';
                     break;
                 case FormQuestionType::Age:
                     $objFormQuestion->ShortDescription = 'Age';
                     $objFormQuestion->Question = 'How old are you?';
                     break;
                 case FormQuestionType::DateofBirth:
                     $objFormQuestion->ShortDescription = 'Date of Birth';
                     $objFormQuestion->Question = 'When were you born';
                     break;
                 case FormQuestionType::Gender:
                     $objFormQuestion->ShortDescription = 'Gender';
                     $objFormQuestion->Question = 'What is your gender?';
                     break;
                 case FormQuestionType::Phone:
                     $objFormQuestion->ShortDescription = 'Phone';
                     $objFormQuestion->Question = 'What is your phone number?';
                     break;
                 case FormQuestionType::Email:
                     $objFormQuestion->ShortDescription = 'Email';
                     $objFormQuestion->Question = 'What is your email address?';
                     break;
                 case FormQuestionType::ShortText:
                     $objFormQuestion->ShortDescription = 'Foo Bar';
                     $objFormQuestion->Question = 'What is your foo bar?';
                     break;
                 case FormQuestionType::LongText:
                     $objFormQuestion->ShortDescription = 'Foo Bar Long';
                     $objFormQuestion->Question = 'What is your foo bar long?';
                     break;
                 case FormQuestionType::Number:
                     $objFormQuestion->ShortDescription = 'Number of Baz';
                     $objFormQuestion->Question = 'How many baz?';
                     break;
                 case FormQuestionType::YesNo:
                     $objFormQuestion->ShortDescription = 'Blue Color';
                     $objFormQuestion->Question = 'Is it blue?';
                     break;
                 case FormQuestionType::SingleSelect:
                     $objFormQuestion->ShortDescription = 'One Item';
                     $objFormQuestion->Question = 'Which is it?';
                     $objFormQuestion->Options = "Option One\nOption Two\nOption Three";
                     break;
                 case FormQuestionType::MultipleSelect:
                     $objFormQuestion->ShortDescription = 'Multiple Item';
                     $objFormQuestion->Question = 'What are they?';
                     $objFormQuestion->Options = "Option One\nOption Two\nOption Three";
                     break;
                 default:
                     throw new QCallerException(sprintf('Invalid intFormQuestionTypeId: %s', $intFormQuestionTypeId));
             }
             $objFormQuestion->Save();
             $intPersonCount = rand(self::SignupsPerFormMinimum, self::SignupsPerFormMaximum);
             for ($i = 0; $i < $intPersonCount; $i++) {
                 $objPerson = null;
                 while (!$objPerson) {
                     $objPerson = Person::Load(rand(1, self::$MaximumPersonId));
                     if ($objPerson && !$objSignupForm->AllowMultipleFlag && $objSignupForm->IsPersonRegistered($objPerson)) {
                         $objPerson = null;
                     }
                 }
                 $objSignup = new SignupEntry();
                 $objSignup->SignupForm = $objSignupForm;
                 $objSignup->Person = $objPerson;
                 $objSignup->SignupByPerson = $objPerson;
                 $objSignup->DateCreated = self::GenerateDateTime($objSignupForm->DateCreated, QDateTime::Now());
                 $objSignup->SignupEntryStatusTypeId = SignupEntryStatusType::Incomplete;
                 $objSignup->InternalNotes = !rand(0, 2) ? self::GenerateContent(1, 5, 10) : null;
                 $objSignup->Save();
                 // Rqeuired Products
                 foreach ($objSignupForm->GetFormProductArrayByType(FormProductType::Required) as $objFormProduct) {
                     $objSignup->AddProduct($objFormProduct);
                 }
                 // Required with Choice
                 $objArray = $objSignupForm->GetFormProductArrayByType(FormProductType::RequiredWithChoice);
                 if (count($objArray)) {
                     $objSignup->AddProduct(self::GenerateFromArray($objArray));
                 }
                 // Optionals (including donations)
                 foreach ($objSignupForm->GetFormProductArrayByType(FormProductType::Optional) as $objFormProduct) {
                     if (rand(0, 1)) {
                         if ($objFormProduct->FormPaymentTypeId == FormPaymentType::Donation) {
                             $objSignup->AddProduct($objFormProduct, rand($objFormProduct->MinimumQuantity, $objFormProduct->MaximumQuantity), rand(1, 10) * 10);
                         } else {
                             $objSignup->AddProduct($objFormProduct, rand($objFormProduct->MinimumQuantity, $objFormProduct->MaximumQuantity));
                         }
                     }
                 }
                 // Payments
                 if (rand(0, 14)) {
                     $objSignup->SignupEntryStatusTypeId = SignupEntryStatusType::Complete;
                     $objSignup->DateSubmitted = new QDateTime($objSignup->DateCreated);
                     $objSignup->DateSubmitted->Minute += 1;
                     $objSignup->Save();
                     $fltAmount = rand(0, 1) ? $objSignup->AmountTotal : $objSignup->CalculateMinimumDeposit();
                     $objSignup->AddPayment(SignupPaymentType::CreditCard, $fltAmount, 'DATAGEN1234', new QDateTime($objSignup->DateSubmitted));
                 }
                 // Create the form answers for each question
                 foreach ($objSignupForm->GetFormQuestionArray(QQ::OrderBy(QQN::FormQuestion()->OrderNumber)) as $objFormQuestion) {
                     if ($objFormQuestion->RequiredFlag || rand(0, 1)) {
                         $objFormAnswer = new FormAnswer();
                         $objFormAnswer->SignupEntry = $objSignup;
                         $objFormAnswer->FormQuestion = $objFormQuestion;
                         switch ($objFormQuestion->FormQuestionTypeId) {
                             case FormQuestionType::SpouseName:
                                 $objFormAnswer->TextValue = 'Spouse Name';
                                 break;
                             case FormQuestionType::Address:
                                 $objFormAnswer->TextValue = $objPerson->PrimaryAddressText . ', ' . $objPerson->PrimaryCityText;
                                 $objArray = $objPerson->GetHouseholdParticipationArray();
                                 if (count($objArray)) {
                                     $objAddress = $objArray[0]->Household->GetCurrentAddress();
                                     if ($objAddress) {
                                         $objFormAnswer->AddressId = $objAddress->Id;
                                     } else {
                                         $objFormAnswer = null;
                                     }
                                 } else {
                                     $objArray = $objPerson->GetAddressArray();
                                     if (count($objArray)) {
                                         $objFormAnswer->AddressId = $objArray[0]->Id;
                                     } else {
                                         $objFormAnswer = null;
                                     }
                                 }
                                 break;
                             case FormQuestionType::Age:
                                 $objFormAnswer->IntegerValue = $objPerson->Age;
                                 break;
                             case FormQuestionType::DateofBirth:
                                 if ($objPerson->DateOfBirth) {
                                     $objFormAnswer->DateValue = $objPerson->DateOfBirth;
                                 }
                                 break;
                             case FormQuestionType::Gender:
                                 switch ($objPerson->Gender) {
                                     case 'M':
                                         $objFormAnswer->BooleanValue = true;
                                         $objFormAnswer->TextValue = 'Male';
                                         break;
                                     case 'F':
                                         $objFormAnswer->BooleanValue = false;
                                         $objFormAnswer->TextValue = 'Female';
                                         break;
                                     default:
                                         $objFormAnswer = null;
                                         break;
                                 }
                                 break;
                             case FormQuestionType::Phone:
                                 if (count($objArray = $objPerson->GetPhoneArray())) {
                                     $objFormAnswer->TextValue = $objArray[0]->Number;
                                     $objFormAnswer->PhoneId = $objArray[0]->Id;
                                 }
                                 break;
                             case FormQuestionType::Email:
                                 if (count($objArray = $objPerson->GetEmailArray())) {
                                     $objFormAnswer->TextValue = $objArray[0]->Address;
                                     $objFormAnswer->EmailId = $objArray[0]->Id;
                                 }
                                 break;
                             case FormQuestionType::ShortText:
                                 $objFormAnswer->TextValue = 'Foo Bar';
                                 break;
                             case FormQuestionType::LongText:
                                 $objFormAnswer->TextValue = 'The quick brown fox jumps over the lazy dog.';
                                 break;
                             case FormQuestionType::Number:
                                 $objFormAnswer->IntegerValue = 28;
                                 break;
                             case FormQuestionType::YesNo:
                                 $objFormAnswer->BooleanValue = rand(0, 1);
                                 break;
                             case FormQuestionType::SingleSelect:
                                 $objFormAnswer->TextValue = "Option Two";
                                 break;
                             case FormQuestionType::MultipleSelect:
                                 $objFormAnswer->TextValue = "Option One\nOption Three";
                                 break;
                         }
                         if ($objFormAnswer) {
                             $objFormAnswer->Save();
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 14
0
 /**
  * Refresh this MetaControl with Data from the local FormQuestion object.
  * @param boolean $blnReload reload FormQuestion from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objFormQuestion->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objFormQuestion->Id;
         }
     }
     if ($this->lstSignupForm) {
         $this->lstSignupForm->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstSignupForm->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objSignupFormArray = SignupForm::LoadAll();
         if ($objSignupFormArray) {
             foreach ($objSignupFormArray as $objSignupForm) {
                 $objListItem = new QListItem($objSignupForm->__toString(), $objSignupForm->Id);
                 if ($this->objFormQuestion->SignupForm && $this->objFormQuestion->SignupForm->Id == $objSignupForm->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupForm->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupFormId) {
         $this->lblSignupFormId->Text = $this->objFormQuestion->SignupForm ? $this->objFormQuestion->SignupForm->__toString() : null;
     }
     if ($this->txtOrderNumber) {
         $this->txtOrderNumber->Text = $this->objFormQuestion->OrderNumber;
     }
     if ($this->lblOrderNumber) {
         $this->lblOrderNumber->Text = $this->objFormQuestion->OrderNumber;
     }
     if ($this->lstFormQuestionType) {
         $this->lstFormQuestionType->SelectedValue = $this->objFormQuestion->FormQuestionTypeId;
     }
     if ($this->lblFormQuestionTypeId) {
         $this->lblFormQuestionTypeId->Text = $this->objFormQuestion->FormQuestionTypeId ? FormQuestionType::$NameArray[$this->objFormQuestion->FormQuestionTypeId] : null;
     }
     if ($this->txtShortDescription) {
         $this->txtShortDescription->Text = $this->objFormQuestion->ShortDescription;
     }
     if ($this->lblShortDescription) {
         $this->lblShortDescription->Text = $this->objFormQuestion->ShortDescription;
     }
     if ($this->txtQuestion) {
         $this->txtQuestion->Text = $this->objFormQuestion->Question;
     }
     if ($this->lblQuestion) {
         $this->lblQuestion->Text = $this->objFormQuestion->Question;
     }
     if ($this->chkRequiredFlag) {
         $this->chkRequiredFlag->Checked = $this->objFormQuestion->RequiredFlag;
     }
     if ($this->lblRequiredFlag) {
         $this->lblRequiredFlag->Text = $this->objFormQuestion->RequiredFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkInternalFlag) {
         $this->chkInternalFlag->Checked = $this->objFormQuestion->InternalFlag;
     }
     if ($this->lblInternalFlag) {
         $this->lblInternalFlag->Text = $this->objFormQuestion->InternalFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->txtOptions) {
         $this->txtOptions->Text = $this->objFormQuestion->Options;
     }
     if ($this->lblOptions) {
         $this->lblOptions->Text = $this->objFormQuestion->Options;
     }
     if ($this->chkAllowOtherFlag) {
         $this->chkAllowOtherFlag->Checked = $this->objFormQuestion->AllowOtherFlag;
     }
     if ($this->lblAllowOtherFlag) {
         $this->lblAllowOtherFlag->Text = $this->objFormQuestion->AllowOtherFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkViewFlag) {
         $this->chkViewFlag->Checked = $this->objFormQuestion->ViewFlag;
     }
     if ($this->lblViewFlag) {
         $this->lblViewFlag->Text = $this->objFormQuestion->ViewFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
 }
Ejemplo n.º 15
0
 /**
  * Refresh this MetaControl with Data from the local ClassMeeting object.
  * @param boolean $blnReload reload ClassMeeting from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objClassMeeting->Reload();
     }
     if ($this->lstSignupForm) {
         $this->lstSignupForm->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstSignupForm->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objSignupFormArray = SignupForm::LoadAll();
         if ($objSignupFormArray) {
             foreach ($objSignupFormArray as $objSignupForm) {
                 $objListItem = new QListItem($objSignupForm->__toString(), $objSignupForm->Id);
                 if ($this->objClassMeeting->SignupForm && $this->objClassMeeting->SignupForm->Id == $objSignupForm->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupForm->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupFormId) {
         $this->lblSignupFormId->Text = $this->objClassMeeting->SignupForm ? $this->objClassMeeting->SignupForm->__toString() : null;
     }
     if ($this->lstClassTerm) {
         $this->lstClassTerm->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstClassTerm->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objClassTermArray = ClassTerm::LoadAll();
         if ($objClassTermArray) {
             foreach ($objClassTermArray as $objClassTerm) {
                 $objListItem = new QListItem($objClassTerm->__toString(), $objClassTerm->Id);
                 if ($this->objClassMeeting->ClassTerm && $this->objClassMeeting->ClassTerm->Id == $objClassTerm->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstClassTerm->AddItem($objListItem);
             }
         }
     }
     if ($this->lblClassTermId) {
         $this->lblClassTermId->Text = $this->objClassMeeting->ClassTerm ? $this->objClassMeeting->ClassTerm->__toString() : null;
     }
     if ($this->lstClassCourse) {
         $this->lstClassCourse->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstClassCourse->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objClassCourseArray = ClassCourse::LoadAll();
         if ($objClassCourseArray) {
             foreach ($objClassCourseArray as $objClassCourse) {
                 $objListItem = new QListItem($objClassCourse->__toString(), $objClassCourse->Id);
                 if ($this->objClassMeeting->ClassCourse && $this->objClassMeeting->ClassCourse->Id == $objClassCourse->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstClassCourse->AddItem($objListItem);
             }
         }
     }
     if ($this->lblClassCourseId) {
         $this->lblClassCourseId->Text = $this->objClassMeeting->ClassCourse ? $this->objClassMeeting->ClassCourse->__toString() : null;
     }
     if ($this->lstClassInstructor) {
         $this->lstClassInstructor->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstClassInstructor->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objClassInstructorArray = ClassInstructor::LoadAll();
         if ($objClassInstructorArray) {
             foreach ($objClassInstructorArray as $objClassInstructor) {
                 $objListItem = new QListItem($objClassInstructor->__toString(), $objClassInstructor->Id);
                 if ($this->objClassMeeting->ClassInstructor && $this->objClassMeeting->ClassInstructor->Id == $objClassInstructor->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstClassInstructor->AddItem($objListItem);
             }
         }
     }
     if ($this->lblClassInstructorId) {
         $this->lblClassInstructorId->Text = $this->objClassMeeting->ClassInstructor ? $this->objClassMeeting->ClassInstructor->__toString() : null;
     }
     if ($this->calDateStart) {
         $this->calDateStart->DateTime = $this->objClassMeeting->DateStart;
     }
     if ($this->lblDateStart) {
         $this->lblDateStart->Text = sprintf($this->objClassMeeting->DateStart) ? $this->objClassMeeting->__toString($this->strDateStartDateTimeFormat) : null;
     }
     if ($this->calDateEnd) {
         $this->calDateEnd->DateTime = $this->objClassMeeting->DateEnd;
     }
     if ($this->lblDateEnd) {
         $this->lblDateEnd->Text = sprintf($this->objClassMeeting->DateEnd) ? $this->objClassMeeting->__toString($this->strDateEndDateTimeFormat) : null;
     }
     if ($this->txtLocation) {
         $this->txtLocation->Text = $this->objClassMeeting->Location;
     }
     if ($this->lblLocation) {
         $this->lblLocation->Text = $this->objClassMeeting->Location;
     }
     if ($this->txtMeetingDay) {
         $this->txtMeetingDay->Text = $this->objClassMeeting->MeetingDay;
     }
     if ($this->lblMeetingDay) {
         $this->lblMeetingDay->Text = $this->objClassMeeting->MeetingDay;
     }
     if ($this->txtMeetingStartTime) {
         $this->txtMeetingStartTime->Text = $this->objClassMeeting->MeetingStartTime;
     }
     if ($this->lblMeetingStartTime) {
         $this->lblMeetingStartTime->Text = $this->objClassMeeting->MeetingStartTime;
     }
     if ($this->txtMeetingEndTime) {
         $this->txtMeetingEndTime->Text = $this->objClassMeeting->MeetingEndTime;
     }
     if ($this->lblMeetingEndTime) {
         $this->lblMeetingEndTime->Text = $this->objClassMeeting->MeetingEndTime;
     }
 }
Ejemplo n.º 16
0
    /**
     * Deletes all associated SignupForms
     * @return void
     */
    public function DeleteAllSignupForms()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateSignupForm on this unsaved Ministry.');
        }
        // Get the Database Object for this Class
        $objDatabase = Ministry::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (SignupForm::LoadArrayByMinistryId($this->intId) as $objSignupForm) {
                $objSignupForm->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`signup_form`
				WHERE
					`ministry_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }
 /**
  * Refresh this MetaControl with Data from the local EventSignupForm object.
  * @param boolean $blnReload reload EventSignupForm from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objEventSignupForm->Reload();
     }
     if ($this->lstSignupForm) {
         $this->lstSignupForm->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstSignupForm->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objSignupFormArray = SignupForm::LoadAll();
         if ($objSignupFormArray) {
             foreach ($objSignupFormArray as $objSignupForm) {
                 $objListItem = new QListItem($objSignupForm->__toString(), $objSignupForm->Id);
                 if ($this->objEventSignupForm->SignupForm && $this->objEventSignupForm->SignupForm->Id == $objSignupForm->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupForm->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupFormId) {
         $this->lblSignupFormId->Text = $this->objEventSignupForm->SignupForm ? $this->objEventSignupForm->SignupForm->__toString() : null;
     }
     if ($this->calDateStart) {
         $this->calDateStart->DateTime = $this->objEventSignupForm->DateStart;
     }
     if ($this->lblDateStart) {
         $this->lblDateStart->Text = sprintf($this->objEventSignupForm->DateStart) ? $this->objEventSignupForm->__toString($this->strDateStartDateTimeFormat) : null;
     }
     if ($this->calDateEnd) {
         $this->calDateEnd->DateTime = $this->objEventSignupForm->DateEnd;
     }
     if ($this->lblDateEnd) {
         $this->lblDateEnd->Text = sprintf($this->objEventSignupForm->DateEnd) ? $this->objEventSignupForm->__toString($this->strDateEndDateTimeFormat) : null;
     }
     if ($this->txtLocation) {
         $this->txtLocation->Text = $this->objEventSignupForm->Location;
     }
     if ($this->lblLocation) {
         $this->lblLocation->Text = $this->objEventSignupForm->Location;
     }
 }
Ejemplo n.º 18
0
<?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 {
Ejemplo n.º 19
0
 protected function btnSubmit_Click($strFormId, $strControlId, $strParameter)
 {
     $this->objSignupEntry->Save();
     $this->CreateChildObject();
     if (!QApplication::$PublicLogin) {
         // Create a communcations entry object or use an existing communcations_entry
         // if user is not logged in
         $txtEmail = $this->GetControl($this->strEmailCtrlId);
         $objCommunicationsEntry = CommunicationListEntry::LoadByEmail($txtEmail->Text);
         if (!$objCommunicationsEntry) {
             $objCommunicationsEntry = new CommunicationListEntry();
             $objCommunicationsEntry->FirstName = $this->objFormQuestionControlArray[0]->Text;
             $objCommunicationsEntry->LastName = $this->objFormQuestionControlArray[1]->Text;
             if ($txtEmail) {
                 $objCommunicationsEntry->Email = $txtEmail->Text;
             }
             $objCommunicationsEntry->Save();
         }
         $this->objSignupEntry->CommunicationsEntryId = $objCommunicationsEntry->Id;
     }
     foreach ($this->objSignupForm->GetFormQuestionArray() as $objFormQuestion) {
         // Only update if this is NOT "InternalFlag"
         if ($objFormQuestion->InternalFlag) {
             continue;
         }
         $strControlId = 'fq' . $objFormQuestion->Id;
         $objFormAnswer = FormAnswer::LoadBySignupEntryIdFormQuestionId($this->objSignupEntry->Id, $objFormQuestion->Id);
         if (!$objFormAnswer) {
             $objFormAnswer = new FormAnswer();
             $objFormAnswer->SignupEntry = $this->objSignupEntry;
             $objFormAnswer->FormQuestion = $objFormQuestion;
         }
         switch ($objFormQuestion->FormQuestionTypeId) {
             case FormQuestionType::SpouseName:
                 $lstSpouse = $this->GetControl($strControlId . 'id');
                 $txtSpouse = $this->GetControl($strControlId . 'nm');
                 if ($lstSpouse && $lstSpouse->SelectedValue) {
                     $objFormAnswer->TextValue = Person::Load($lstSpouse->SelectedValue)->Name;
                 } else {
                     $objFormAnswer->TextValue = trim($txtSpouse->Text);
                 }
                 break;
             case FormQuestionType::Address:
                 $rblAddress = $this->GetControl($strControlId . 'switch');
                 $txtAddress1 = $this->GetControl($strControlId . 'address1');
                 $txtAddress2 = $this->GetControl($strControlId . 'address2');
                 $txtCity = $this->GetControl($strControlId . 'city');
                 $lstState = $this->GetControl($strControlId . 'state');
                 $txtZipCode = $this->GetControl($strControlId . 'zipcode');
                 if ($rblAddress && $rblAddress->SelectedValue) {
                     $objFormAnswer->AddressId = $rblAddress->SelectedValue;
                     $objFormAnswer->TextValue = $objFormAnswer->Address->AddressFullLine;
                 } else {
                     $objFormAnswer->AddressId = null;
                     $objAddress = new Address();
                     $objAddress->Address1 = trim($txtAddress1->Text);
                     $objAddress->Address2 = trim($txtAddress2->Text);
                     $objAddress->City = trim($txtCity->Text);
                     $objAddress->State = $lstState->SelectedValue;
                     $objAddress->ZipCode = trim($txtZipCode->Text);
                     $objFormAnswer->TextValue = $objAddress->AddressFullLine;
                 }
                 break;
             case FormQuestionType::Age:
                 $txtAge = $this->GetControl($strControlId . 'age');
                 if (strlen(trim($txtAge->Text))) {
                     $objFormAnswer->IntegerValue = $txtAge->Text;
                 } else {
                     $objFormAnswer->IntegerValue = null;
                 }
                 break;
             case FormQuestionType::DateofBirth:
                 $dtxDateOfBirth = $this->GetControl($strControlId . 'dob');
                 if ($dtxDateOfBirth->DateTime) {
                     $objFormAnswer->DateValue = $dtxDateOfBirth->DateTime;
                     // Update the Person Information
                     if (QApplication::$PublicLogin) {
                         $this->objSignupEntry->Person->DateOfBirth = $objFormAnswer->DateValue;
                         $this->objSignupEntry->Person->DobGuessedFlag = false;
                         $this->objSignupEntry->Person->DobYearApproximateFlag = false;
                         $this->objSignupEntry->Person->Save();
                     }
                 } else {
                     $objFormAnswer->DateValue = null;
                 }
                 break;
             case FormQuestionType::Gender:
                 $lstGender = $this->GetControl($strControlId . 'gender');
                 if ($lstGender->SelectedValue === true) {
                     $objFormAnswer->TextValue = 'Male';
                     $objFormAnswer->BooleanValue = true;
                     if (QApplication::$PublicLogin) {
                         $this->objSignupEntry->Person->Gender = 'M';
                         $this->objSignupEntry->Person->Save();
                     }
                 } else {
                     if ($lstGender->SelectedValue === false) {
                         $objFormAnswer->TextValue = 'Female';
                         $objFormAnswer->BooleanValue = false;
                         if (QApplication::$PublicLogin) {
                             $this->objSignupEntry->Person->Gender = 'F';
                             $this->objSignupEntry->Person->Save();
                         }
                     } else {
                         $objFormAnswer->TextValue = null;
                         $objFormAnswer->BooleanValue = null;
                     }
                 }
                 break;
             case FormQuestionType::Phone:
                 $lstPhone = $this->GetControl($strControlId . 'id');
                 $txtPhone = $this->GetControl($strControlId . 'phone');
                 if ($lstPhone && $lstPhone->SelectedValue) {
                     $objFormAnswer->PhoneId = $lstPhone->SelectedValue;
                     $objFormAnswer->TextValue = $objFormAnswer->Phone->Number;
                 } else {
                     if ($strNumber = trim($txtPhone->Text)) {
                         $objFormAnswer->PhoneId = null;
                         $objFormAnswer->TextValue = $strNumber;
                     } else {
                         $objFormAnswer->PhoneId = null;
                         $objFormAnswer->TextValue = null;
                     }
                 }
                 break;
             case FormQuestionType::Email:
                 $lstEmail = $this->GetControl($strControlId . 'id');
                 $txtEmail = $this->GetControl($strControlId . 'email');
                 if ($lstEmail && $lstEmail->SelectedValue) {
                     $objFormAnswer->EmailId = $lstEmail->SelectedValue;
                     $objFormAnswer->TextValue = $objFormAnswer->Email->Address;
                 } else {
                     if ($strNumber = trim($txtEmail->Text)) {
                         $objFormAnswer->EmailId = null;
                         $objFormAnswer->TextValue = $strNumber;
                     } else {
                         $objFormAnswer->EmailId = null;
                         $objFormAnswer->TextValue = null;
                     }
                 }
                 break;
             case FormQuestionType::ShortText:
             case FormQuestionType::LongText:
                 $txtAnswer = $this->GetControl($strControlId);
                 if (strlen($strText = trim($txtAnswer->Text))) {
                     $objFormAnswer->TextValue = $strText;
                 } else {
                     $objFormAnswer->TextValue = null;
                 }
                 break;
             case FormQuestionType::Number:
                 $txtAnswer = $this->GetControl($strControlId);
                 if (strlen($strText = trim($txtAnswer->Text))) {
                     $objFormAnswer->IntegerValue = $strText;
                 } else {
                     $objFormAnswer->IntegerValue = null;
                 }
                 break;
             case FormQuestionType::YesNo:
                 $chkAnswer = $this->GetControl($strControlId);
                 $objFormAnswer->BooleanValue = $chkAnswer->Checked;
                 break;
             case FormQuestionType::SingleSelect:
                 $lstAnswer = $this->GetControl($strControlId);
                 $txtAnswer = $this->GetControl($strControlId . 'other');
                 // No item selected ("-select one-" still selected)
                 if (is_null($lstAnswer->SelectedValue)) {
                     $objFormAnswer->TextValue = null;
                     // "Other" option
                 } else {
                     if ($lstAnswer->SelectedValue === false) {
                         if (strlen($strText = trim($txtAnswer->Text))) {
                             $objFormAnswer->TextValue = $strText;
                         } else {
                             $objFormAnswer->TextValue = null;
                         }
                         // Regular List Selection
                     } else {
                         $objFormAnswer->TextValue = trim($lstAnswer->SelectedValue);
                     }
                 }
                 break;
             case FormQuestionType::MultipleSelect:
                 //GJS - changing to multiple check boxes
                 $chkAnswer = $this->GetControl($strControlId);
                 $objItemsArray = $chkAnswer->GetAllItems();
                 if (count($objItemsArray)) {
                     $strSelectedArray = array();
                     foreach ($objItemsArray as $objItem) {
                         if ($objItem->Selected) {
                             $strSelectedArray[] = $objItem->Name;
                         }
                     }
                     $objFormAnswer->TextValue = implode("\r\n", $strSelectedArray);
                 } else {
                     $objFormAnswer->TextValue = null;
                 }
                 break;
             case FormQuestionType::Instructions:
                 // Don't need to do anything here!
                 break;
             default:
                 throw new Exception('Invalid FormQuestionTypeId: ' . $objFormQuestion->FormQuestionTypeId);
         }
         $objFormAnswer->Save();
     }
     if ($this->objSignupForm->CountFormProducts()) {
         QApplication::Redirect($this->objSignupEntry->PaymentUrl);
     } else {
         $this->objSignupEntry->Complete();
         QApplication::Redirect($this->objSignupEntry->ConfirmationUrl);
     }
 }
Ejemplo n.º 20
0
 /**
  * Refresh this MetaControl with Data from the local SignupEntry object.
  * @param boolean $blnReload reload SignupEntry from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objSignupEntry->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objSignupEntry->Id;
         }
     }
     if ($this->lstSignupForm) {
         $this->lstSignupForm->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstSignupForm->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objSignupFormArray = SignupForm::LoadAll();
         if ($objSignupFormArray) {
             foreach ($objSignupFormArray as $objSignupForm) {
                 $objListItem = new QListItem($objSignupForm->__toString(), $objSignupForm->Id);
                 if ($this->objSignupEntry->SignupForm && $this->objSignupEntry->SignupForm->Id == $objSignupForm->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupForm->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupFormId) {
         $this->lblSignupFormId->Text = $this->objSignupEntry->SignupForm ? $this->objSignupEntry->SignupForm->__toString() : null;
     }
     if ($this->lstPerson) {
         $this->lstPerson->RemoveAllItems();
         $this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null);
         $objPersonArray = Person::LoadAll();
         if ($objPersonArray) {
             foreach ($objPersonArray as $objPerson) {
                 $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
                 if ($this->objSignupEntry->Person && $this->objSignupEntry->Person->Id == $objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPersonId) {
         $this->lblPersonId->Text = $this->objSignupEntry->Person ? $this->objSignupEntry->Person->__toString() : null;
     }
     if ($this->lstSignupByPerson) {
         $this->lstSignupByPerson->RemoveAllItems();
         $this->lstSignupByPerson->AddItem(QApplication::Translate('- Select One -'), null);
         $objSignupByPersonArray = Person::LoadAll();
         if ($objSignupByPersonArray) {
             foreach ($objSignupByPersonArray as $objSignupByPerson) {
                 $objListItem = new QListItem($objSignupByPerson->__toString(), $objSignupByPerson->Id);
                 if ($this->objSignupEntry->SignupByPerson && $this->objSignupEntry->SignupByPerson->Id == $objSignupByPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupByPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupByPersonId) {
         $this->lblSignupByPersonId->Text = $this->objSignupEntry->SignupByPerson ? $this->objSignupEntry->SignupByPerson->__toString() : null;
     }
     if ($this->lstSignupEntryStatusType) {
         $this->lstSignupEntryStatusType->SelectedValue = $this->objSignupEntry->SignupEntryStatusTypeId;
     }
     if ($this->lblSignupEntryStatusTypeId) {
         $this->lblSignupEntryStatusTypeId->Text = $this->objSignupEntry->SignupEntryStatusTypeId ? SignupEntryStatusType::$NameArray[$this->objSignupEntry->SignupEntryStatusTypeId] : null;
     }
     if ($this->calDateCreated) {
         $this->calDateCreated->DateTime = $this->objSignupEntry->DateCreated;
     }
     if ($this->lblDateCreated) {
         $this->lblDateCreated->Text = sprintf($this->objSignupEntry->DateCreated) ? $this->objSignupEntry->__toString($this->strDateCreatedDateTimeFormat) : null;
     }
     if ($this->calDateSubmitted) {
         $this->calDateSubmitted->DateTime = $this->objSignupEntry->DateSubmitted;
     }
     if ($this->lblDateSubmitted) {
         $this->lblDateSubmitted->Text = sprintf($this->objSignupEntry->DateSubmitted) ? $this->objSignupEntry->__toString($this->strDateSubmittedDateTimeFormat) : null;
     }
     if ($this->txtAmountTotal) {
         $this->txtAmountTotal->Text = $this->objSignupEntry->AmountTotal;
     }
     if ($this->lblAmountTotal) {
         $this->lblAmountTotal->Text = $this->objSignupEntry->AmountTotal;
     }
     if ($this->txtAmountPaid) {
         $this->txtAmountPaid->Text = $this->objSignupEntry->AmountPaid;
     }
     if ($this->lblAmountPaid) {
         $this->lblAmountPaid->Text = $this->objSignupEntry->AmountPaid;
     }
     if ($this->txtAmountBalance) {
         $this->txtAmountBalance->Text = $this->objSignupEntry->AmountBalance;
     }
     if ($this->lblAmountBalance) {
         $this->lblAmountBalance->Text = $this->objSignupEntry->AmountBalance;
     }
     if ($this->txtInternalNotes) {
         $this->txtInternalNotes->Text = $this->objSignupEntry->InternalNotes;
     }
     if ($this->lblInternalNotes) {
         $this->lblInternalNotes->Text = $this->objSignupEntry->InternalNotes;
     }
     if ($this->lstCommunicationsEntry) {
         $this->lstCommunicationsEntry->RemoveAllItems();
         $this->lstCommunicationsEntry->AddItem(QApplication::Translate('- Select One -'), null);
         $objCommunicationsEntryArray = CommunicationListEntry::LoadAll();
         if ($objCommunicationsEntryArray) {
             foreach ($objCommunicationsEntryArray as $objCommunicationsEntry) {
                 $objListItem = new QListItem($objCommunicationsEntry->__toString(), $objCommunicationsEntry->Id);
                 if ($this->objSignupEntry->CommunicationsEntry && $this->objSignupEntry->CommunicationsEntry->Id == $objCommunicationsEntry->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCommunicationsEntry->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCommunicationsEntryId) {
         $this->lblCommunicationsEntryId->Text = $this->objSignupEntry->CommunicationsEntry ? $this->objSignupEntry->CommunicationsEntry->__toString() : null;
     }
     if ($this->lstClassRegistration) {
         $this->lstClassRegistration->RemoveAllItems();
         $this->lstClassRegistration->AddItem(QApplication::Translate('- Select One -'), null);
         $objClassRegistrationArray = ClassRegistration::LoadAll();
         if ($objClassRegistrationArray) {
             foreach ($objClassRegistrationArray as $objClassRegistration) {
                 $objListItem = new QListItem($objClassRegistration->__toString(), $objClassRegistration->SignupEntryId);
                 if ($objClassRegistration->SignupEntryId == $this->objSignupEntry->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstClassRegistration->AddItem($objListItem);
             }
         }
         // Because ClassRegistration's ClassRegistration is not null, if a value is already selected, it cannot be changed.
         if ($this->lstClassRegistration->SelectedValue) {
             $this->lstClassRegistration->Enabled = false;
         } else {
             $this->lstClassRegistration->Enabled = true;
         }
     }
     if ($this->lblClassRegistration) {
         $this->lblClassRegistration->Text = $this->objSignupEntry->ClassRegistration ? $this->objSignupEntry->ClassRegistration->__toString() : null;
     }
 }
 public function SignupForm()
 {
     // http://doc.silverstripe.org/framework/en/3.1/topics/forms
     return SignupForm::create($this, "SignupForm");
 }
Ejemplo n.º 22
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objSignupForm) {
         $objObject->objSignupForm = SignupForm::GetSoapObjectFromObject($objObject->objSignupForm, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intSignupFormId = null;
         }
     }
     if ($objObject->dttDateStart) {
         $objObject->dttDateStart = $objObject->dttDateStart->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->dttDateEnd) {
         $objObject->dttDateEnd = $objObject->dttDateEnd->__toString(QDateTime::FormatSoap);
     }
     return $objObject;
 }
Ejemplo n.º 23
0
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this 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());
 }
Ejemplo n.º 24
0
 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());
         }
     }
 }
Ejemplo n.º 25
0
 /**
  * Refresh this MetaControl with Data from the local FormProduct object.
  * @param boolean $blnReload reload FormProduct from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objFormProduct->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objFormProduct->Id;
         }
     }
     if ($this->lstSignupForm) {
         $this->lstSignupForm->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstSignupForm->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objSignupFormArray = SignupForm::LoadAll();
         if ($objSignupFormArray) {
             foreach ($objSignupFormArray as $objSignupForm) {
                 $objListItem = new QListItem($objSignupForm->__toString(), $objSignupForm->Id);
                 if ($this->objFormProduct->SignupForm && $this->objFormProduct->SignupForm->Id == $objSignupForm->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupForm->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupFormId) {
         $this->lblSignupFormId->Text = $this->objFormProduct->SignupForm ? $this->objFormProduct->SignupForm->__toString() : null;
     }
     if ($this->txtOrderNumber) {
         $this->txtOrderNumber->Text = $this->objFormProduct->OrderNumber;
     }
     if ($this->lblOrderNumber) {
         $this->lblOrderNumber->Text = $this->objFormProduct->OrderNumber;
     }
     if ($this->lstFormProductType) {
         $this->lstFormProductType->SelectedValue = $this->objFormProduct->FormProductTypeId;
     }
     if ($this->lblFormProductTypeId) {
         $this->lblFormProductTypeId->Text = $this->objFormProduct->FormProductTypeId ? FormProductType::$NameArray[$this->objFormProduct->FormProductTypeId] : null;
     }
     if ($this->lstFormPaymentType) {
         $this->lstFormPaymentType->SelectedValue = $this->objFormProduct->FormPaymentTypeId;
     }
     if ($this->lblFormPaymentTypeId) {
         $this->lblFormPaymentTypeId->Text = $this->objFormProduct->FormPaymentTypeId ? FormPaymentType::$NameArray[$this->objFormProduct->FormPaymentTypeId] : null;
     }
     if ($this->txtName) {
         $this->txtName->Text = $this->objFormProduct->Name;
     }
     if ($this->lblName) {
         $this->lblName->Text = $this->objFormProduct->Name;
     }
     if ($this->txtDescription) {
         $this->txtDescription->Text = $this->objFormProduct->Description;
     }
     if ($this->lblDescription) {
         $this->lblDescription->Text = $this->objFormProduct->Description;
     }
     if ($this->calDateStart) {
         $this->calDateStart->DateTime = $this->objFormProduct->DateStart;
     }
     if ($this->lblDateStart) {
         $this->lblDateStart->Text = sprintf($this->objFormProduct->DateStart) ? $this->objFormProduct->__toString($this->strDateStartDateTimeFormat) : null;
     }
     if ($this->calDateEnd) {
         $this->calDateEnd->DateTime = $this->objFormProduct->DateEnd;
     }
     if ($this->lblDateEnd) {
         $this->lblDateEnd->Text = sprintf($this->objFormProduct->DateEnd) ? $this->objFormProduct->__toString($this->strDateEndDateTimeFormat) : null;
     }
     if ($this->txtMinimumQuantity) {
         $this->txtMinimumQuantity->Text = $this->objFormProduct->MinimumQuantity;
     }
     if ($this->lblMinimumQuantity) {
         $this->lblMinimumQuantity->Text = $this->objFormProduct->MinimumQuantity;
     }
     if ($this->txtMaximumQuantity) {
         $this->txtMaximumQuantity->Text = $this->objFormProduct->MaximumQuantity;
     }
     if ($this->lblMaximumQuantity) {
         $this->lblMaximumQuantity->Text = $this->objFormProduct->MaximumQuantity;
     }
     if ($this->txtCost) {
         $this->txtCost->Text = $this->objFormProduct->Cost;
     }
     if ($this->lblCost) {
         $this->lblCost->Text = $this->objFormProduct->Cost;
     }
     if ($this->txtDeposit) {
         $this->txtDeposit->Text = $this->objFormProduct->Deposit;
     }
     if ($this->lblDeposit) {
         $this->lblDeposit->Text = $this->objFormProduct->Deposit;
     }
     if ($this->chkViewFlag) {
         $this->chkViewFlag->Checked = $this->objFormProduct->ViewFlag;
     }
     if ($this->lblViewFlag) {
         $this->lblViewFlag->Text = $this->objFormProduct->ViewFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
 }
Ejemplo n.º 26
0
Archivo: form.php Proyecto: alcf/chms
 public function dtgQuestions_Bind()
 {
     $this->dtgQuestions->DataSource = $this->objSignupForm->GetFormQuestionArray(QQ::OrderBy(QQN::FormQuestion()->OrderNumber));
 }
Ejemplo n.º 27
0
 public function actionSignup()
 {
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->signup()) {
             if (Yii::$app->getUser()->login($user)) {
                 return $this->goHome();
             }
         }
     }
     return $this->render('signup', ['model' => $model]);
 }
Ejemplo n.º 28
0
    /**
     * Deletes all associated SignupFormsAsDonation
     * @return void
     */
    public function DeleteAllSignupFormsAsDonation()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateSignupFormAsDonation on this unsaved StewardshipFund.');
        }
        // Get the Database Object for this Class
        $objDatabase = StewardshipFund::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (SignupForm::LoadArrayByDonationStewardshipFundId($this->intId) as $objSignupForm) {
                $objSignupForm->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`signup_form`
				WHERE
					`donation_stewardship_fund_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }
Ejemplo n.º 29
0
<?php

include_once 'common/base.php';
/*
 *check if the form is submitted, and verify and register
 *if not then print the form
 */
$title = "signUp";
include_once 'common/header.php';
include_once './forms/form.signup.php';
$form = new SignupForm($db);
if ($form->read()) {
    //echo "The form is submitted.";
    if ($form->isValid()) {
        //echo "<br/>The form is valid";
        $fields = $form->getArray();
        include_once './models/class.users.php';
        $user = new UserClass($db);
        if ($user->insert($fields)) {
            echo "<div id='note'>\n\t\t \t\t\t\t\t\t\t\t<p>Congratulation. You are registered.</p>\n\t\t \t\t\t\t\t\t\t\t<p><a href='./login.php'>Login</a></p>\n\t\t \t\t\t\t\t\t\t</div>";
        }
    } else {
        //echo "<br/>form is invalid.";
        $form->display();
    }
} else {
    //echo "The signup is not posted.";
    $form->display();
}
$footer = "copyright &copy; 2012 reserved to rajan prasad upadhyay.";
include_once './common/footer.php';
Ejemplo n.º 30
0
Archivo: edit.php Proyecto: alcf/chms
 public function btnSave_Click()
 {
     // Check for unique token
     $strToken = QApplication::Tokenize($this->txtToken->Text);
     if (strlen($strToken)) {
         if (is_numeric($strToken)) {
             $this->txtToken->Warning = 'URL must have more than just numbers';
         }
         if (($objTest = SignupForm::LoadByToken($strToken)) && $objTest->Id != $this->mctSignupForm->SignupForm->Id) {
             $this->txtToken->Warning = 'URL is already taken';
         }
         if ($this->txtToken->Warning) {
             $this->txtToken->Blink();
             $this->txtToken->Focus();
             return;
         }
         $this->txtToken->Text = $strToken;
     } else {
         $this->txtToken->Text = null;
     }
     $this->mctSignupForm->SaveSignupForm();
     // Add Child
     switch ($this->mctSignupForm->SignupForm->SignupFormTypeId) {
         case SignupFormType::Event:
             if (!$this->mctSignupChild->EventSignupForm->SignupForm) {
                 $this->mctSignupChild->EventSignupForm->SignupForm = $this->mctSignupForm->SignupForm;
             }
             $this->mctSignupChild->SaveEventSignupForm();
             break;
         case SignupFormType::Course:
             if (!$this->mctSignupChild->ClassMeeting->SignupForm) {
                 $this->mctSignupChild->ClassMeeting->SignupForm = $this->mctSignupForm->SignupForm;
             }
             $this->mctSignupChild->SaveClassMeeting();
             break;
         default:
             throw new Exception('Invalid SignupFormTypeId: ' . $objSignupForm->SignupFormTypeId);
     }
     // Redirect to View Page
     QApplication::Redirect('/events/form.php/' . $this->mctSignupForm->SignupForm->Id);
 }