Пример #1
0
 function addFromCForm($lParentID, $lCFID)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $gErrMessages, $gbShowHiddenVerifyError;
     $this->load->helper('dl_util/verify_id');
     verifyID($this, $lCFID, 'custom form ID');
     $displayData = array();
     $displayData['js'] = '';
     $displayData['lCFID'] = $lCFID = (int) $lCFID;
     $displayData['lParentID'] = $lParentID = (int) $lParentID;
     $gbShowHiddenVerifyError = false;
     $gErrMessages = array();
     /*------------------------------------------------
           models/libraries/helpers
       ------------------------------------------------*/
     $params = array('enumStyle' => 'terse');
     $this->load->library('generic_rpt', $params);
     $this->load->model('custom_forms/mcustom_forms', 'cForm');
     $this->load->model('personalization/muser_fields', 'clsUF');
     $this->load->model('personalization/muser_fields_display', 'clsUFD');
     $this->load->model('admin/madmin_aco', 'clsACO');
     $this->load->model('admin/mpermissions', 'perms');
     $this->load->helper('dl_util/context');
     $this->load->helper('dl_util/custom_forms');
     $this->load->helper('dl_util/time_date');
     $this->load->library('util/dl_date_time', '', 'clsDateTime');
     // load the custom form
     $this->cForm->loadCustomFormsViaCFID($lCFID);
     $displayData['cForm'] = $cForm =& $this->cForm->customForms[0];
     $enumType = $cForm->enumContextType;
     // now that the context is known, verify the parent ID
     verifyIDsViaType($this, $enumType, $lParentID, true);
     // custom verification ?
     $displayData['bCusVerification'] = $bCusVerification = $cForm->strVerificationModule . '' != '';
     //-----------------------------
     // validation rules
     //-----------------------------
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     if ($bCusVerification) {
         $this->load->helper('path');
         $this->form_validation->set_rules('hVerify', 'Hidden verification', 'callback_hiddenVerify[' . $cForm->strVerificationModule . ',' . $cForm->strVModEntryPoint . ']');
     }
     // personalized tables and associated fields
     $this->cForm->loadPTablesForDisplay($lCFID, $this->clsUF);
     $displayData['utables'] = $utables =& $this->cForm->utables;
     $displayData['lNumTables'] = $lNumTables = $this->cForm->lNumTables;
     setValidationUTables($displayData['js'], $lNumTables, $utables);
     if ($this->form_validation->run() == FALSE) {
         $this->load->library('generic_form');
         $this->load->model('util/mlist_generic', 'clsList');
         $this->load->helper('dl_util/web_layout');
         loadSupportModels($enumType, $lParentID);
         initUTableDates($displayData['js'], $lNumTables, $utables);
         initUTableDDLs($lNumTables, $utables);
         if (validation_errors() == '') {
             populateCustomTables($lNumTables, $utables, $lParentID);
             setCustomUTableDDLs($lNumTables, $utables);
         } else {
             setOnFormError($displayData);
             repopulateCustomTables($lNumTables, $utables);
         }
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = $this->cForm->strCustomFormsPageTitleAddEdit($enumType, $cForm->strFormName);
         $displayData['strHTMLSummary'] = strContextHTML($enumType, $lParentID, $enumType);
         $displayData['errMessages'] = arrayCopy($gErrMessages);
         $displayData['title'] = CS_PROGNAME . ' | Custom Forms';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = array('custom_forms/custom_form_data_entry_view');
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         saveCustomPTables($lParentID, $lNumTables, $utables);
         $this->cForm->lLogFormSave($lParentID, $lCFID);
         $this->fromWhenceYeCame($lParentID, $enumType, $cForm);
     }
 }
Пример #2
0
 function regForm($strHash)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $gbDev;
     global $gclsChapter, $glChapterID, $gbDateFormatUS, $gclsChapterACO;
     global $gErrMessages;
     global $gclsChapterVoc;
     $displayData = array();
     $displayData['js'] = '';
     $gErrMessages = array();
     // load models & helpers
     $this->load->model('vol_reg/mvol_reg', 'volReg');
     $this->load->model('admin/madmin_aco', 'clsACO');
     $this->load->model('img_docs/mimage_doc', 'clsImgDoc');
     $this->load->model('personalization/muser_fields', 'clsUF');
     $this->load->model('admin/mpermissions', 'perms');
     $this->load->model('util/mcaptcha', 'clsCaptcha');
     $this->load->library('util/dl_date_time', '', 'clsDateTime');
     $this->load->helper('img_docs/image_doc');
     $this->load->helper('img_docs/link_img_docs');
     $this->load->helper('dl_util/time_date');
     $this->load->helper('email');
     $this->load->helper('captcha');
     $this->load->helper('dl_util/custom_forms');
     $displayData['formData'] = new stdClass();
     $displayData['title'] = 'Volunteer Registration';
     if (!$this->verifyHash($strHash, $displayData, $lFormID)) {
         return;
     }
     $rRec =& $displayData['rRec'];
     $displayData['bCreateAcct'] = $bCreateAcct = $rRec->bPermEditContact || $rRec->bPermPassReset || $rRec->bPermViewGiftHistory || $rRec->bPermEditJobSkills || $rRec->bPermViewHrsHistory || $rRec->bPermAddVolHours || $rRec->bVolShiftSignup;
     //-----------------------------
     // validation rules
     //-----------------------------
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     $this->setValText($rRec->bShowFName, $rRec->bFNameRequired, 'txtFName', 'First Name');
     $this->setValText($rRec->bShowLName, $rRec->bLNameRequired, 'txtLName', 'Last Name');
     $this->setValText($rRec->bShowAddr, $rRec->bAddrRequired, 'txtAddr1', 'Address');
     $this->setValText($rRec->bShowAddr, false, 'txtAddr2', 'Address 2');
     $this->setValText($rRec->bShowAddr, $rRec->bAddrRequired, 'txtCity', 'City');
     $this->setValText($rRec->bShowAddr, $rRec->bAddrRequired, 'txtState', 'State');
     $this->setValText($rRec->bShowAddr, $rRec->bAddrRequired, 'txtZip', 'Zip');
     $this->setValText($rRec->bShowAddr, $rRec->bAddrRequired, 'txtCountry', 'Country');
     if ($rRec->bShowEmail) {
         if ($rRec->bEmailRequired) {
             $this->form_validation->set_rules('txtEmail', 'Email', 'required|callback_verifyEmail');
         } else {
             $this->form_validation->set_rules('txtEmail', 'Email', 'callback_verifyEmail');
         }
     }
     $this->setValText($rRec->bShowPhone, $rRec->bPhoneRequired, 'txtPhone', 'Phone');
     $this->setValText($rRec->bShowCell, $rRec->bCellRequired, 'txtCell', 'Cell');
     cusFormSetValDate($rRec->bShowBDay, $rRec->bBDateRequired, 'txtBDate', 'Birth Date', false);
     if ($rRec->bDisclaimerAckRqrd) {
         $this->form_validation->set_rules('chkDisclaimer', 'Disclaimer', 'callback_verifyDisclaimer');
     }
     if ($rRec->bCaptchaRequired) {
         $this->form_validation->set_rules('txtCaptcha', 'Captcha', 'callback_verifyCaptcha');
     }
     if ($bCreateAcct) {
         $this->form_validation->set_rules('txtPWord1', 'Password', 'callback_verifyPWords');
         $this->form_validation->set_rules('txtPWord2', 'Password', 'trim');
     }
     // basic info
     $displayData['basicInfo'] = array();
     $this->setBasicInfo($displayData['basicInfo'][0], 'First Name', $rRec->bShowFName, $rRec->bFNameRequired, 'txtFName', 40, 80);
     $this->setBasicInfo($displayData['basicInfo'][1], 'Last Name', $rRec->bShowLName, $rRec->bLNameRequired, 'txtLName', 40, 80);
     $this->setBasicInfo($displayData['basicInfo'][2], 'Address', $rRec->bShowAddr, $rRec->bAddrRequired, 'txtAddr1', 40, 80);
     $this->setBasicInfo($displayData['basicInfo'][3], 'Address 2', $rRec->bShowAddr, false, 'txtAddr2', 40, 80);
     $this->setBasicInfo($displayData['basicInfo'][4], 'City', $rRec->bShowAddr, $rRec->bAddrRequired, 'txtCity', 20, 80);
     $this->setBasicInfo($displayData['basicInfo'][5], $gclsChapterVoc->vocState, $rRec->bShowAddr, $rRec->bAddrRequired, 'txtState', 20, 80);
     $this->setBasicInfo($displayData['basicInfo'][6], $gclsChapterVoc->vocZip, $rRec->bShowAddr, $rRec->bAddrRequired, 'txtZip', 20, 40);
     $this->setBasicInfo($displayData['basicInfo'][7], 'Country', $rRec->bShowAddr, $rRec->bAddrRequired, 'txtCountry', 20, 80);
     $this->setBasicInfo($displayData['basicInfo'][8], 'Email', $rRec->bShowEmail, $rRec->bEmailRequired, 'txtEmail', 40, 120);
     $this->setBasicInfo($displayData['basicInfo'][9], 'Phone', $rRec->bShowPhone, $rRec->bPhoneRequired, 'txtPhone', 20, 40);
     $this->setBasicInfo($displayData['basicInfo'][10], 'Cell', $rRec->bShowCell, $rRec->bCellRequired, 'txtCell', 20, 40);
     // job skills
     $this->volReg->loadVolRegFormSkills($lFormID, false);
     $displayData['lNumSkills'] = $lNumSkills = $this->volReg->lOnFormSkills;
     $displayData['skills'] = $jobSkills = arrayCopy($this->volReg->skills);
     $skills =& $displayData['skills'];
     if ($lNumSkills > 0) {
         foreach ($skills as $skill) {
             $skill->bChecked = false;
             $skill->checkFN = $strChkFN = 'chkJobSkill_' . $skill->lKeyID;
             $this->form_validation->set_rules($strChkFN, 'Job Skill', 'trim');
             $displayData['formData']->txtPWord1 = $displayData['formData']->txtPWord2 = '';
         }
     }
     // personalized tables and associated fields
     $this->volReg->loadPTablesForDisplay($lFormID, $this->clsUF);
     $displayData['utables'] = $utables =& $this->volReg->utables;
     $displayData['lNumTables'] = $lNumTables = $this->volReg->lNumTables;
     setValidationUTables($displayData['js'], $lNumTables, $utables);
     if ($this->form_validation->run() == FALSE) {
         $this->load->library('generic_form');
         $this->load->model('util/mlist_generic', 'clsList');
         $this->load->helper('dl_util/web_layout');
         $displayData['strHash'] = $strHash;
         $this->volReg->setLogoImageTag();
         // captcha setup
         if ($rRec->bCaptchaRequired) {
             $this->initCaptcha($displayData['imgCaptcha']);
         }
         if ($rRec->bShowBDay) {
             $displayData['js'] .= strDatePicker('datepickerBDate', false);
         }
         initUTableDates($displayData['js'], $lNumTables, $utables);
         initUTableDDLs($lNumTables, $utables);
         if (validation_errors() == '') {
             // basic info
             $displayData['basicInfo'][0]->value = $displayData['basicInfo'][1]->value = $displayData['basicInfo'][2]->value = $displayData['basicInfo'][3]->value = $displayData['basicInfo'][4]->value = $displayData['basicInfo'][5]->value = $displayData['basicInfo'][6]->value = $displayData['basicInfo'][7]->value = $displayData['basicInfo'][8]->value = $displayData['basicInfo'][9]->value = $displayData['basicInfo'][10]->value = '';
             $displayData['formData']->txtBDate = '';
             if ($rRec->bDisclaimerAckRqrd) {
                 $rRec->bDisclaimerChecked = false;
             }
             // job skills
             if ($lNumSkills > 0) {
                 foreach ($skills as $skill) {
                     $skill->bChecked = false;
                 }
             }
             // personalized tables
             setCustomUTableDDLs($lNumTables, $utables);
         } else {
             setOnFormError($displayData);
             $displayData['basicInfo'][0]->value = set_value('txtFName');
             $displayData['basicInfo'][1]->value = set_value('txtLName');
             $displayData['basicInfo'][2]->value = set_value('txtAddr1');
             $displayData['basicInfo'][3]->value = set_value('txtAddr2');
             $displayData['basicInfo'][4]->value = set_value('txtCity');
             $displayData['basicInfo'][5]->value = set_value('txtState');
             $displayData['basicInfo'][6]->value = set_value('txtZip');
             $displayData['basicInfo'][7]->value = set_value('txtCountry');
             $displayData['basicInfo'][8]->value = set_value('txtEmail');
             $displayData['basicInfo'][9]->value = set_value('txtPhone');
             $displayData['basicInfo'][10]->value = set_value('txtCell');
             $displayData['formData']->txtBDate = set_value('txtBDate');
             if (form_error('txtPWord1') == '') {
                 $displayData['formData']->txtPWord1 = $displayData['formData']->txtPWord2 = set_value('txtPWord1');
             } else {
                 $displayData['formData']->txtPWord1 = $displayData['formData']->txtPWord2 = '';
             }
             if ($rRec->bDisclaimerAckRqrd) {
                 $rRec->bDisclaimerChecked = set_value('chkDisclaimer') == 'true';
             }
             // job skills
             if ($lNumSkills > 0) {
                 foreach ($skills as $skill) {
                     $skill->bChecked = set_value($skill->checkFN) == 'true';
                 }
             }
             // personalized tables
             repopulateCustomTables($lNumTables, $utables);
         }
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['strOrg'] = $this->clsChapter->chapterRec->strChapterName;
         $displayData['errMessages'] = arrayCopy($gErrMessages);
         $this->load->vars($displayData);
         $this->load->view('vol_reg/register');
     } else {
         $this->saveVolReg($rRec, $lNumTables, $utables, $lNumSkills, $jobSkills, $bCreateAcct);
         redirect('vol_reg/vol/submitted/' . $strHash);
     }
 }