function verifyID($lChapterID, $varID, $enumVerifyType, $bRedirectOnFail = true)
{
    /*---------------------------------------------------------------------
          another way... Note that get_instance is a CI function, defined in
          system/core/CodeIgniter.php
    
          from http://stackoverflow.com/questions/4740430/explain-ci-get-instance
    
          $CI =& get_instance(); // use get_instance, it is less prone to failure in this context.
       ---------------------------------------------------------------------*/
    $CI =& get_instance();
    $bValid = true;
    switch ($enumVerifyType) {
        //      case 'account ID':
        //         $bValid = vid_bGenericRecExists($lChapterID, $varID, 'gifts_accounts', 'ga_lKeyID', 'ga_lChapterID', 'ga_bRetired');
        //         break;
        case 'attributed to ID':
            $bValid = vid_bAttributedToIDExists($lChapterID, $varID);
            break;
        case 'patient ID':
            $bValid = vid_bGenericRecExists($lChapterID, $varID, 'patient_records', 'cr_lKeyID', 'cr_lChapterID', 'cr_bRetired');
            break;
        case 'patientContact ID':
            $bValid = vid_bGenericRecExists(null, $varID, 'patient_contacts', 'cc_lKeyID', null, 'cc_bRetired');
            break;
        case 'patientVisit ID':
            $bValid = vid_bGenericRecExists($lChapterID, $varID, 'patient_visit', 'pv_lKeyID', 'pv_lChapterID', 'pv_bRetired');
            break;
        case 'vpAssoc ID':
            $bValid = vid_bVPAssocRecExists($lChapterID, $varID);
            break;
        case 'image/document ID':
            $bValid = vid_bGenericRecExists($lChapterID, $varID, 'docs_images', 'di_lKeyID', 'di_lChapterID', 'di_bRetired');
            break;
        case 'organization ID':
            $bValid = vid_bGenericRecExists(null, $varID, 'admin_chapters', 'ch_lKeyID', null, 'ch_bRetired');
            break;
        case 'people ID':
            $bValid = vid_bPBRecExists($lChapterID, $varID, false, false);
            break;
        case 'user ID':
            $bValid = vid_bGenericRecExists($lChapterID, $varID, 'admin_users', 'us_lKeyID', 'us_lChapterID', null);
            break;
        case 'volunteer ID':
            $bValid = vid_bVolRecExists($lChapterID, $varID, 'vol_lChapterID');
            break;
        case 'vol training ID':
            $bValid = vid_bGenericRecExists($lChapterID, $varID, 'vol_training', 'vt_lKeyID', 'vt_lChapterID', 'vt_bRetired');
            break;
        default:
            screamForHelp($enumVerifyType . ': invalid verify type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
            break;
    }
    if ($bRedirectOnFail) {
        vid_bTestFail($bValid, $enumVerifyType, $varID);
    }
    return $bValid;
}
 function run($idx, $strSearch)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $idx = (int) $idx;
     $strSearch = trim(urldecode($strSearch));
     switch ($idx) {
         case 1:
             // search vol ID
             $this->load->helper('dl_util/verify_id');
             if (vid_bVolRecExists($this, $strSearch)) {
                 $lVID = (int) $strSearch;
                 redirect('volunteers/vol_record/volRecordView/' . $lVID);
             } else {
                 $this->session->set_flashdata('error', 'No records match volunteerID <b>' . htmlspecialchars($strSearch) . '</b>');
                 redirect('volunteers/vol_search/searchOpts');
             }
             break;
         case 2:
             // search vol via PID
             $this->load->helper('dl_util/verify_id');
             if (vid_bVolViaPIDExists($this, $strSearch, $lVolID)) {
                 redirect('volunteers/vol_record/volRecordView/' . $lVolID);
             } else {
                 $this->session->set_flashdata('error', 'No volunteer records match peopleID <b>' . htmlspecialchars($strSearch) . '</b>');
                 redirect('volunteers/vol_search/searchOpts');
             }
             break;
         case 3:
             // search first/last name
             $this->firstLastNameSearch($strSearch);
             break;
         default:
             screamForHelp($idx . ': invalid search type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
             break;
     }
 }
function verifyID(&$local, $varID, $enumVerifyType, $bRedirectOnFail = true)
{
    /*---------------------------------------------------------------------
          another way... Note that get_instance is a CI function, defined in
          system/core/CodeIgniter.php
    
          from http://stackoverflow.com/questions/4740430/explain-ci-get-instance
    
          $CI =& get_instance(); // use get_instance, it is less prone to failure in this context.
       ---------------------------------------------------------------------*/
    $bValid = true;
    switch ($enumVerifyType) {
        case 'account ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'gifts_accounts', 'ga_lKeyID', 'ga_bRetired');
            break;
        case 'attributed to ID':
            $bValid = vid_bAttributedToIDExists($local, $varID);
            break;
        case 'auction ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'gifts_auctions', 'auc_lKeyID', 'auc_bRetired');
            break;
        case 'auction item ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'gifts_auctions_items', 'ait_lKeyID', 'ait_bRetired');
            break;
        case 'autocharge ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'sponsor_autocharge_log', 'spcl_lKeyID', null);
            break;
        case 'bidsheet ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'gifts_auctions_bidsheets', 'abs_lKeyID', 'abs_bRetired');
            break;
        case 'business ID':
            $bValid = vid_bBizRecExists($local, $varID);
            break;
        case 'business contact ID':
            $bValid = vid_bBizConRecExists($local, $varID);
            break;
        case 'campaign ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'gifts_campaigns', 'gc_lKeyID', 'gc_bRetired');
            break;
        case 'client location ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'client_location', 'cl_lKeyID', 'cl_bRetired');
            break;
        case 'client ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'client_records', 'cr_lKeyID', 'cr_bRetired');
            break;
        case 'client program ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'cprograms', 'cp_lKeyID', 'cp_bRetired');
            break;
        case 'client vocabulary ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'lists_client_vocab', 'cv_lKeyID', 'cv_bRetired');
            break;
        case 'custom form ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'custom_forms', 'cf_lKeyID', 'cf_bRetired');
            break;
        case 'custom report ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'creport_dir', 'crd_lKeyID', 'crd_bRetired');
            break;
        case 'deposit ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'deposit_log', 'dl_lKeyID', 'dl_bRetired');
            break;
        case 'donation ID':
            $bValid = vid_bGiftExists($local, $varID);
            break;
        case 'event ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'vol_events', 'vem_lKeyID', 'vem_bRetired');
            break;
        case 'event date ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'vol_events_dates', 'ved_lKeyID', null);
            break;
        case 'grant ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'grants', 'gr_lKeyID', null);
            break;
        case 'group ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'groups_parent', 'gp_lKeyID', null);
            break;
        case 'honorarium/memorial ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'lists_hon_mem', 'ghm_lKeyID', 'ghm_bRetired');
            break;
        case 'household ID':
        case 'people ID':
            $bValid = vid_bPeopleRecExists($local, $varID);
            break;
        case 'image/document ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'docs_images', 'di_lKeyID', 'di_bRetired');
            break;
        case 'inventory cat ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'inv_cats', 'ivc_lKeyID', 'ivc_bRetired');
            break;
        case 'inventory item ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'inv_items', 'ivi_lKeyID', 'ivi_bRetired');
            break;
        case 'organization ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'admin_chapters', 'ch_lKeyID', 'ch_bRetired');
            break;
        case 'package ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'gifts_auctions_packages', 'ap_lKeyID', 'ap_bRetired');
            break;
        case 'people/business ID':
            $bValid = vid_bPBRecExists($local, $varID, false, false);
            break;
        case 'pledge ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'gifts_pledges', 'gp_lKeyID', 'gp_bRetired');
            break;
        case 'pre/post test ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'cpp_tests', 'cpp_lKeyID', 'cpp_bRetired');
            break;
        case 'provider ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'grant_providers', 'gpr_lKeyID', 'gpr_bRetired');
            break;
        case 'relationship ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'people_relationships', 'pr_lKeyID', 'pr_bRetired');
            break;
        case 'relationship entry ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'lists_people_relationships', 'lpr_lKeyID', 'lpr_bRetired');
            break;
        case 'reminder ID':
            $bValid = vid_bReminderIDExists($local, $varID);
            break;
        case 'search term ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'creport_search', 'crs_lKeyID', null);
            break;
        case 'shift ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'vol_events_dates_shifts', 'vs_lKeyID', 'vs_bRetired');
            break;
        case 'sponsor ID':
            $bValid = vid_bSponsorIDExists($local, $varID);
            break;
        case 'sponsorship charge ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'sponsor_charges', 'spc_lKeyID', 'spc_bRetired');
            break;
        case 'sponsor payment ID':
            $bValid = vid_bPaymentExists($local, $varID);
            break;
        case 'sponsorship program ID':
            $bValid = vid_bSponsorProgIDExists($local, $varID);
            break;
        case 'status category ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'client_status_cats', 'csc_lKeyID', 'csc_bRetired');
            break;
        case 'status ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'lists_client_status_entries', 'cst_lKeyID', 'cst_bRetired');
            break;
        case 'status entry ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'client_status', 'csh_lKeyID', 'csh_bRetired');
            break;
        case 'status entry list ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'lists_client_status_entries', 'cst_lKeyID', 'cst_bRetired');
            break;
        case 'user ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'admin_users', 'us_lKeyID', null);
            break;
        case 'volunteer ID':
            $bValid = vid_bVolRecExists($local, $varID);
            break;
        case 'volunteer assignment ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'vol_events_dates_shifts_assign', 'vsa_lKeyID', 'vsa_bRetired');
            break;
        case 'vol. registration ID':
            $bValid = vid_bGenericRecExists($local, $varID, 'vol_reg', 'vreg_lKeyID', 'vreg_bRetired');
            break;
        default:
            screamForHelp($enumVerifyType . ': invalid verify type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
            break;
    }
    if ($bRedirectOnFail) {
        vid_bTestFail($local, $bValid, $enumVerifyType, $varID);
    }
    return $bValid;
}