function loadPPCatsAndTests(&$lNumCats, &$ppCats, $bUserAccessible)
 {
     //---------------------------------------------------------------------
     // if $bUserAccessible, the test must be published and not hidden
     //---------------------------------------------------------------------
     // load the pre/post test categories
     $clist = new mlist_generic();
     $clist->enumListType = CENUM_LISTTYPE_CPREPOSTCAT;
     $clist->genericLoadList();
     $lNumInList = $clist->lNumInList;
     // we love scalars
     // add the "no category" to the bottom
     $lNumCats = $lNumInList + 1;
     $clist->listItems[$lNumInList] = new stdClass();
     $liLast =& $clist->listItems[$lNumInList];
     $liLast->lKeyID = null;
     $liLast->strListItem = '(no category)';
     $liLast->lSortIDX = 9999;
     $liLast->enumListType = CENUM_LISTTYPE_CPREPOSTCAT;
     $liLast->bRetired = false;
     // load the Pre/Post tests by category
     if ($clist->lNumInList > 0) {
         foreach ($clist->listItems as $li) {
             $this->loadPPTestsViaCat($li->lKeyID, $li->lNumPPTests, $li->pptests, $bUserAccessible);
         }
     }
     $this->loadPPTestsViaCat(null, $liLast->lNumPPTests, $liLast->pptests, $bUserAccessible);
     $ppCats = arrayCopy($clist->listItems);
 }
Пример #2
0
 function prepJobCodeArray(&$jCodes, $sRpt, $bAllJobCodes, &$lNumJobCodes)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $glChapterID;
     $masterCodes = array();
     $jcList = new mlist_generic();
     $jcList->enumListType = CENUM_LISTTYPE_VOLJOBCODES;
     if ($bAllJobCodes) {
         $jcList->genericLoadList($glChapterID);
         $lNumJobCodes = count($jcList->listItems);
         if ($lNumJobCodes == 0) {
             return;
         }
         foreach ($jcList->listItems as $listItem) {
             $masterCodes[$listItem->lKeyID] = new stdClass();
             $mc =& $masterCodes[$listItem->lKeyID];
             $mc->strJobCode = $listItem->strListItem;
             $mc->sngNumShiftHours = 0.0;
             $mc->sngNumUnHours = 0.0;
         }
         $masterCodes[-1] = new stdClass();
         $mc =& $masterCodes[-1];
         $mc->strJobCode = '(no job code assigned)';
         $mc->sngNumShiftHours = 0.0;
         $mc->sngNumUnHours = 0.0;
     } else {
         $lNumJobCodes = 1;
         $masterCodes[$sRpt->lJobCodeID] = new stdClass();
         $mc =& $masterCodes[$sRpt->lJobCodeID];
         $mc->strJobCode = $jcList->genericLoadListItem($sRpt->lJobCodeID);
         $mc->sngNumShiftHours = 0.0;
         $mc->sngNumUnHours = 0.0;
     }
     for ($idx = 1; $idx <= 13; ++$idx) {
         // month 13 is used for annual total
         $jCodes[$idx] = new stdClass();
         $jc =& $jCodes[$idx];
         $jc->lMonth = $idx;
         if ($idx <= 12) {
             $jc->strMonth = strXlateMonth($idx);
         }
         $jc->hours = arrayCopy($masterCodes);
     }
 }
Пример #3
0
 function lAddNewLocation(&$locRec)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $glUserID;
     $sqlStr = 'INSERT INTO admin_chapters
        SET ' . $this->strSQLCommon($locRec) . ",\n               ch_bActive          = 1,\n               ch_bRetired         = 0,\n               ch_lOrigID          = {$glUserID},\n               ch_dteOrigin        = NOW();";
     $query = $this->db->query($sqlStr);
     $lLocID = $this->db->insert_id();
     // pre-fill a couple lists
     $clist = new mlist_generic();
     $clist->strListTable = 'lists_generic';
     $clist->strListItemFN = 'lgen_strListItem';
     $clist->strQualFN = 'lgen_enumListType';
     $clist->strFieldPrefix = 'lgen_';
     $clist->enumListQual = CENUM_LISTTYPE_ATTRIB;
     $clist->lInsertNewListItem($lLocID, '(other)');
     $clist->lInsertNewListItem($lLocID, '(unknown)');
     $clist->lInsertNewListItem($lLocID, 'Internet');
     $clist->lInsertNewListItem($lLocID, 'Staff Member');
     $clist->lInsertNewListItem($lLocID, 'Web Site');
     $clist->enumListQual = CENUM_LISTTYPE_VOLACT;
     $clist->lInsertNewListItem($lLocID, '(Other)');
     $clist->lInsertNewListItem($lLocID, 'Accounting/Bookkeeping');
     $clist->lInsertNewListItem($lLocID, 'Administrative Support');
     $clist->lInsertNewListItem($lLocID, 'Data Entry');
     $clist->lInsertNewListItem($lLocID, 'Errands');
     $clist->lInsertNewListItem($lLocID, 'Event Planning');
     $clist->lInsertNewListItem($lLocID, 'Facilities Management');
     $clist->lInsertNewListItem($lLocID, 'Landscaping');
     $clist->lInsertNewListItem($lLocID, 'Office Support');
     $clist->lInsertNewListItem($lLocID, 'Software/Database/Computers');
     $clist->lInsertNewListItem($lLocID, 'Tuck-In');
     $clist->lInsertNewListItem($lLocID, 'Web Design/Update');
     $clist->enumListQual = CENUM_LISTTYPE_VOLJOBCODES;
     $clist->lInsertNewListItem($lLocID, '2000 Administrative Support');
     $clist->lInsertNewListItem($lLocID, '2010 Event Planning');
     $clist->lInsertNewListItem($lLocID, '2020 Office Support');
     $clist->lInsertNewListItem($lLocID, '5000 Tuck-In');
     $clist->lInsertNewListItem($lLocID, '6000 Data Entry');
     $clist->lInsertNewListItem($lLocID, '6010 Database/Software');
     $clist->lInsertNewListItem($lLocID, '6020 Web Design/Updates');
     $clist->enumListQual = CENUM_LISTTYPE_VOLTRAINING;
     $clist->lInsertNewListItem($lLocID, '(other)');
     $clist->lInsertNewListItem($lLocID, 'Annual Refresher');
     $clist->lInsertNewListItem($lLocID, 'Orientation');
     $clist->enumListQual = CENUM_LISTTYPE_VOLTRAININGBY;
     $clist->lInsertNewListItem($lLocID, '(other)');
     $clist->lInsertNewListItem($lLocID, 'Contracted Facilitator');
     $clist->lInsertNewListItem($lLocID, 'Staff Member');
     $clist->lInsertNewListItem($lLocID, 'Volunteer Coordinator');
     $clist->enumListQual = CENUM_LISTTYPE_PV_ACTIVITIES;
     $clist->lInsertNewListItem($lLocID, '(Other - please specify in notes)');
     $clist->lInsertNewListItem($lLocID, 'Bereavement');
     $clist->lInsertNewListItem($lLocID, 'Telephone Call');
     $clist->lInsertNewListItem($lLocID, 'Visit');
     $clist->enumListQual = CENUM_LISTTYPE_PV_LOCATIONS;
     $clist->lInsertNewListItem($lLocID, '(Other - please specify in notes)');
     $clist->lInsertNewListItem($lLocID, 'Assisted Living Facility');
     $clist->lInsertNewListItem($lLocID, 'Group Home');
     $clist->lInsertNewListItem($lLocID, 'Home');
     $clist->lInsertNewListItem($lLocID, 'Hospital');
     $clist->lInsertNewListItem($lLocID, 'Nursing Home');
     $clist->enumListQual = CENUM_LISTTYPE_PV_PSTATUS;
     $clist->lInsertNewListItem($lLocID, '(Does not apply)');
     $clist->lInsertNewListItem($lLocID, 'Alert');
     $clist->lInsertNewListItem($lLocID, 'Appeared calm');
     $clist->lInsertNewListItem($lLocID, 'Appeared cheerful');
     $clist->lInsertNewListItem($lLocID, 'Appeared confused');
     $clist->lInsertNewListItem($lLocID, 'Appeared sad');
     $clist->lInsertNewListItem($lLocID, 'Awake');
     $clist->lInsertNewListItem($lLocID, 'Drowsy');
     $clist->lInsertNewListItem($lLocID, 'In bed');
     $clist->lInsertNewListItem($lLocID, 'In wheelchair');
     $clist->lInsertNewListItem($lLocID, 'Sleeping');
     $clist->lInsertNewListItem($lLocID, 'Up in a chair');
     $clist->enumListQual = CENUM_LISTTYPE_PV_VISITTASKS;
     $clist->lInsertNewListItem($lLocID, '(Does not apply)');
     $clist->lInsertNewListItem($lLocID, '(Other - please specify in notes)');
     $clist->lInsertNewListItem($lLocID, 'Confimed patient\'s emotional reactions');
     $clist->lInsertNewListItem($lLocID, 'Did light housekeeping');
     $clist->lInsertNewListItem($lLocID, 'Listened to music with patient');
     $clist->lInsertNewListItem($lLocID, 'Looked at pictures with patient');
     $clist->lInsertNewListItem($lLocID, 'Read to patient');
     $clist->lInsertNewListItem($lLocID, 'Socialized with patient during volunteer visit');
     $clist->lInsertNewListItem($lLocID, 'Talked to patient');
     $clist->lInsertNewListItem($lLocID, 'Took patient to activities');
     $clist->lInsertNewListItem($lLocID, 'Walked along side of patient');
     $clist->enumListQual = CENUM_LISTTYPE_PCON_RELATION;
     $clist->lInsertNewListItem($lLocID, '(other)');
     $clist->lInsertNewListItem($lLocID, 'Adult Child');
     $clist->lInsertNewListItem($lLocID, 'Brother');
     $clist->lInsertNewListItem($lLocID, 'Child');
     $clist->lInsertNewListItem($lLocID, 'Daughter');
     $clist->lInsertNewListItem($lLocID, 'Father');
     $clist->lInsertNewListItem($lLocID, 'Friend');
     $clist->lInsertNewListItem($lLocID, 'Husband');
     $clist->lInsertNewListItem($lLocID, 'Mother');
     $clist->lInsertNewListItem($lLocID, 'Other Family Member');
     $clist->lInsertNewListItem($lLocID, 'Sister');
     $clist->lInsertNewListItem($lLocID, 'Son');
     $clist->lInsertNewListItem($lLocID, 'Wife');
     return $lLocID;
 }
 function addEditBiz($lBID)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $gclsChapterACO;
     global $gstrDuplicateWarning;
     $gstrDuplicateWarning = '';
     $this->load->helper('dl_util/verify_id');
     if ($lBID . '' != '0') {
         verifyID($this, $lBID, 'business ID');
     }
     $displayData = array();
     $displayData['lBID'] = $lBID = (int) $lBID;
     $displayData['bNew'] = $bNew = $lBID <= 0;
     if ($bNew) {
         if (!bTestForURLHack('dataEntryPeopleBizVol')) {
             return;
         }
     } else {
         if (!bTestForURLHack('editPeopleBizVol')) {
             return;
         }
     }
     //-------------------------
     // models & helpers
     //-------------------------
     $this->load->model('admin/madmin_aco', 'clsACO');
     $this->load->model('biz/mbiz', 'clsBiz');
     //      $this->load->helper('dl_util/email_web');
     $this->load->helper('dl_util/web_layout');
     $this->clsBiz->loadBizRecsViaBID($lBID);
     $biz =& $this->clsBiz->bizRecs[0];
     if ($bNew) {
         $this->load->model('util/mdup_checker', 'cDupChecker');
     }
     //-----------------------------
     // validation rules
     //-----------------------------
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     $this->form_validation->set_rules('txtBizName', 'Name of Business/Organization', 'trim|required');
     $this->form_validation->set_rules('txtAddr1', 'Address Line 1', 'trim');
     $this->form_validation->set_rules('txtAddr2', 'Address Line 2', 'trim');
     $this->form_validation->set_rules('txtCity', 'City', 'trim');
     $this->form_validation->set_rules('txtState', 'State', 'trim');
     $this->form_validation->set_rules('txtZip', 'Zip', 'trim');
     $this->form_validation->set_rules('txtCountry', 'Country', 'trim');
     $this->form_validation->set_rules('txtEmail', 'Email', 'trim|valid_email');
     $this->form_validation->set_rules('txtPhone', 'Phone', 'trim');
     $this->form_validation->set_rules('txtCell', 'Cell', 'trim');
     $this->form_validation->set_rules('txtFax', 'Fax', 'trim');
     $this->form_validation->set_rules('txtWebSite', 'Web Site', 'trim');
     $this->form_validation->set_rules('txtNotes', 'Notes', 'trim');
     $this->form_validation->set_rules('rdoACO', 'Accounting Country', 'trim|required');
     $this->form_validation->set_rules('ddlBizCat', 'Business Category', 'trim|required');
     $this->form_validation->set_rules('txtBizName', 'Name of Business/Organization', 'trim|required');
     $this->form_validation->set_rules('ddlAttrib', 'Attributed to');
     // test for duplicate biz
     if ($bNew) {
         $this->form_validation->set_rules('hiddenTestDup', 'dummy', 'callback_verifyNoDups');
         $displayData['bHiddenNewTestDup'] = true;
     }
     if ($this->form_validation->run() == FALSE) {
         $displayData['formData'] = new stdClass();
         $this->load->library('generic_form');
         $this->load->model('util/mlist_generic', 'clsList');
         $displayData['strDuplicateWarning'] = $gstrDuplicateWarning;
         $this->clsList->enumListType = 'bizCat';
         $displayData['bizCatCnt'] = $bizCatCnt = $this->clsList->lListCnt();
         $clsAttrib = new mlist_generic();
         $clsAttrib->enumListType = 'attrib';
         $displayData['biz'] =& $biz;
         // first time displayed, no user data entry errors
         if (validation_errors() == '') {
             if ($bNew) {
                 $displayData['formData']->txtBizName = $displayData['formData']->txtAddr1 = $displayData['formData']->txtAddr2 = $displayData['formData']->txtCity = $displayData['formData']->txtState = $displayData['formData']->txtZip = $displayData['formData']->txtCountry = $displayData['formData']->txtNotes = $displayData['formData']->txtEmail = $displayData['formData']->txtPhone = $displayData['formData']->txtCell = $displayData['formData']->txtFax = $displayData['formData']->txtWebSite = '';
                 $displayData['formData']->rdoACO = $this->clsACO->strACO_Radios($gclsChapterACO->lKeyID, 'rdoACO');
                 if ($bizCatCnt > 0) {
                     $displayData['formData']->strBizList = $this->clsList->strLoadListDDL('ddlBizCat', true, -1);
                 }
                 $displayData['strAttribDDL'] = $clsAttrib->strLoadListDDL('ddlAttrib', true, -1);
             } else {
                 $displayData['formData']->txtBizName = htmlspecialchars($biz->strBizName);
                 $displayData['formData']->txtAddr1 = htmlspecialchars($biz->strAddr1);
                 $displayData['formData']->txtAddr2 = htmlspecialchars($biz->strAddr2);
                 $displayData['formData']->txtCity = htmlspecialchars($biz->strCity);
                 $displayData['formData']->txtState = htmlspecialchars($biz->strState);
                 $displayData['formData']->txtZip = htmlspecialchars($biz->strCountry);
                 $displayData['formData']->txtCountry = htmlspecialchars($biz->strZip);
                 $displayData['formData']->txtNotes = htmlspecialchars($biz->strNotes);
                 $displayData['formData']->txtEmail = htmlspecialchars($biz->strEmail);
                 $displayData['formData']->txtPhone = htmlspecialchars($biz->strPhone);
                 $displayData['formData']->txtCell = htmlspecialchars($biz->strCell);
                 $displayData['formData']->txtFax = htmlspecialchars($biz->strFax);
                 $displayData['formData']->txtWebSite = htmlspecialchars($biz->strWebSite);
                 $displayData['formData']->rdoACO = $this->clsACO->strACO_Radios($biz->lACO, 'rdoACO');
                 if ($bizCatCnt > 0) {
                     $displayData['formData']->strBizList = $this->clsList->strLoadListDDL('ddlBizCat', true, $biz->lIndustryID);
                 }
                 $displayData['strAttribDDL'] = $clsAttrib->strLoadListDDL('ddlAttrib', true, $biz->lAttributedTo);
             }
         } else {
             setOnFormError($displayData);
             $displayData['formData']->txtBizName = set_value('txtBizName');
             $displayData['formData']->txtAddr1 = set_value('txtAddr1');
             $displayData['formData']->txtAddr2 = set_value('txtAddr2');
             $displayData['formData']->txtCity = set_value('txtCity');
             $displayData['formData']->txtState = set_value('txtState');
             $displayData['formData']->txtZip = set_value('txtZip');
             $displayData['formData']->txtCountry = set_value('txtCountry');
             $displayData['formData']->txtNotes = set_value('txtNotes');
             $displayData['formData']->txtEmail = set_value('txtEmail');
             $displayData['formData']->txtPhone = set_value('txtPhone');
             $displayData['formData']->txtCell = set_value('txtCell');
             $displayData['formData']->txtFax = set_value('txtFax');
             $displayData['formData']->txtWebSite = set_value('txtWebSite');
             $displayData['formData']->rdoACO = $this->clsACO->strACO_Radios((int) set_value('rdoACO'), 'rdoACO');
             $displayData['strAttribDDL'] = $clsAttrib->strLoadListDDL('ddlAttrib', true, set_value('ddlAttrib'));
             if ($bizCatCnt > 0) {
                 $displayData['formData']->strBizList = $this->clsList->strLoadListDDL('ddlBizCat', true, (int) set_value('ddlBizCat'));
             }
         }
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = anchor('main/menu/biz', 'Businesses/Organizations', 'class="breadcrumb"') . ' | ' . anchor('biz/biz_record/view/' . $lBID, 'Business Record', 'class="breadcrumb"') . ' | ' . ($bNew ? 'Add New' : 'Edit') . '  Record';
         $displayData['title'] = CS_PROGNAME . ' | Businesses';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'biz/biz_add_edit_view';
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         $this->load->model('personalization/muser_fields', 'clsUF');
         $this->load->model('personalization/muser_fields_create', 'clsUFC');
         $this->load->model('admin/mpermissions', 'perms');
         $this->load->helper('dl_util/util_db');
         $biz = new stdClass();
         $biz->strBizName = trim($_POST['txtBizName']);
         $biz->strAddr1 = trim($_POST['txtAddr1']);
         $biz->strAddr2 = trim($_POST['txtAddr2']);
         $biz->strCity = trim($_POST['txtCity']);
         $biz->strState = trim($_POST['txtState']);
         $biz->strCountry = trim($_POST['txtCountry']);
         $biz->strZip = trim($_POST['txtZip']);
         $biz->strNotes = trim($_POST['txtNotes']);
         $biz->strEmail = trim($_POST['txtEmail']);
         $biz->strPhone = trim($_POST['txtPhone']);
         $biz->strCell = trim($_POST['txtCell']);
         $biz->strFax = trim($_POST['txtFax']);
         $biz->strWebSite = trim($_POST['txtWebSite']);
         $biz->lACO = (int) $_POST['rdoACO'];
         $biz->lIndustryID = (int) $_POST['ddlBizCat'];
         $lAttrib = (int) $_REQUEST['ddlAttrib'];
         if ($lAttrib <= 0) {
             $biz->lAttributedTo = null;
         } else {
             $biz->lAttributedTo = $lAttrib;
         }
         if ($bNew) {
             $lBID = $this->clsBiz->lCreateNewBizRec();
             $this->session->set_flashdata('msg', 'The business/organization record was added');
         } else {
             $this->clsBiz->updateBizRec($lBID);
             $this->session->set_flashdata('msg', 'The business/organization record was updated');
         }
         redirect_Biz($lBID);
     }
 }