function configRemRecViewViaType($enumRemType, $lFID, &$displayData)
{
    $lFIDs = array($lFID);
    $CI =& get_instance();
    $CI->load->model('img_docs/mimage_doc', 'clsImgDoc');
    $CI->load->helper('img_docs/image_doc');
    $CI->load->helper('img_docs/link_img_docs');
    $CI->load->model('admin/mpermissions', 'perms');
    switch ($enumRemType) {
        case CENUM_CONTEXT_USER:
            $clsUser = new muser_accts();
            $clsUser->loadSingleUserRecord($lFID);
            $displayData['contextSummary'] = $clsUser->userHTMLSummary(0);
            $displayData['pageTitle'] = strPageTitle('reminderRecordUser', $lFIDs);
            break;
        case CENUM_CONTEXT_PEOPLE:
            $clsPeople = new mpeople();
            $clsPeople->loadPeopleViaPIDs($lFID, false, false);
            $displayData['contextSummary'] = $clsPeople->peopleHTMLSummary(0);
            $displayData['pageTitle'] = strPageTitle('reminderRecordPeople', $lFIDs);
            break;
        case CENUM_CONTEXT_GIFT:
            $clsGifts = new mdonations();
            $clsGifts->loadGiftViaGID($lFID);
            $displayData['contextSummary'] = $clsGifts->giftHTMLSummary();
            $lPeopleBizID = $clsGifts->gifts[0]->gi_lForeignID;
            $lFIDs[1] = $lPeopleBizID;
            if ($clsGifts->gifts[0]->pe_bBiz) {
                $displayData['pageTitle'] = strPageTitle('reminderRecordBizGift', $lFIDs);
            } else {
                $displayData['pageTitle'] = strPageTitle('reminderRecordPeopleGift', $lFIDs);
            }
            break;
        case CENUM_CONTEXT_SPONSORSHIP:
            $clsSpon = new msponsorship();
            $clsSpon->sponsorInfoViaID($lFID);
            $displayData['contextSummary'] = $clsSpon->sponsorshipHTMLSummary();
            $displayData['pageTitle'] = strPageTitle('reminderSponsor', $lFIDs);
            break;
        case CENUM_CONTEXT_CLIENT:
            $clsClients = new mclients();
            $clsClients->loadClientsViaClientID($lFID);
            $displayData['contextSummary'] = $clsClients->strClientHTMLSummary(0);
            $displayData['pageTitle'] = strPageTitle('reminderClient', $lFIDs);
            break;
        case CENUM_CONTEXT_BIZ:
            $clsBiz = new mbiz();
            $clsBiz->loadBizRecsViaBID($lFID);
            $displayData['contextSummary'] = $clsBiz->strBizHTMLSummary();
            $displayData['pageTitle'] = strPageTitle('reminderBiz', $lFIDs);
            break;
        case CENUM_CONTEXT_LOCATION:
        case CENUM_CONTEXT_VOLUNTEER:
        case CENUM_CONTEXT_GENERIC:
        default:
            screamForHelp($enumRemType . ': Switch type not implemented</b><br>error on <b>line:</b> ' . __LINE__ . '<br><b>file:</b> ' . __FILE__ . '<br><b>function:</b> ' . __FUNCTION__);
            break;
    }
}
Beispiel #2
0
 public function loadVolRecs()
 {
     //-----------------------------------------------------------------------
     //
     //-----------------------------------------------------------------------
     $this->volRecs = array();
     $clsPeople = new mpeople();
     if ($this->strOrderExtra . '' == '') {
         $this->strOrderExtra = ' ORDER BY pe_strLName, pe_strFName, pe_strMName, vol_lKeyID ';
     }
     $sqlStr = "SELECT\n            vol_lKeyID, vol_lPeopleID, vol_bInactive, vol_lRegFormID,\n            vol_Notes, vol_bRetired, vol_lOriginID, vol_lLastUpdateID,\n            UNIX_TIMESTAMP(vol_dteInactive) AS dteInactive,\n\n            vreg_strFormName, vreg_strURLHash,\n\n            pe_strLName, pe_strFName,\n            pe_strMName, pe_bRetired,\n            pe_strPreferredName, pe_strTitle,\n            pe_strAddr1, pe_strAddr2,\n            pe_strCity,  pe_strState,\n            pe_strZip,   pe_strCountry,\n            pe_strEmail, pe_strPhone, pe_strCell,\n            pe_lHouseholdID,\n\n            UNIX_TIMESTAMP(vol_dteOrigin)     AS dteOrigin,\n            UNIX_TIMESTAMP(vol_dteLastUpdate) AS dteLastUpdate,\n            uc.us_strFirstName AS strUCFName, uc.us_strLastName AS strUCLName,\n            ul.us_strFirstName AS strULFName, ul.us_strLastName AS strULLName\n\n         FROM volunteers\n            INNER JOIN people_names        ON vol_lPeopleID  = pe_lKeyID\n            INNER JOIN admin_users   AS uc ON uc.us_lKeyID   = vol_lOriginID\n            INNER JOIN admin_users   AS ul ON ul.us_lKeyID   = vol_lLastUpdateID\n            LEFT  JOIN vol_reg             ON vol_lRegFormID = vreg_lKeyID\n\n         WHERE\n            NOT vol_bRetired AND NOT pe_bRetired\n            {$this->strWhereExtra}\n         {$this->strOrderExtra}\n         {$this->sqlLimitExtra};";
     $query = $this->db->query($sqlStr);
     $this->lNumVolRecs = $numRows = $query->num_rows();
     if ($numRows == 0) {
         $this->volRecs[0] = new stdClass();
         $vRec =& $this->volRecs[0];
         $vRec->lKeyID = $vRec->lPeopleID = $vRec->lHouseholdID = $vRec->bInactive = $vRec->Notes = $vRec->bRetired = $vRec->dteInactive = $vRec->strLName = $vRec->strFName = $vRec->strMName = $vRec->strSafeNameFL = $vRec->bRetired = $vRec->strAddr1 = $vRec->strAddr2 = $vRec->strCity = $vRec->strState = $vRec->strZip = $vRec->strCountry = $vRec->strEmail = $vRec->strPhone = $vRec->strCell = $vRec->lOriginID = $vRec->lLastUpdateID = $vRec->dteOrigin = $vRec->dteLastUpdate = $vRec->strUCFName = $vRec->strUCLName = $vRec->strULFName = $vRec->strULLName = null;
     } else {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->volRecs[$idx] = new stdClass();
             $vRec =& $this->volRecs[$idx];
             $vRec->lKeyID = (int) $row->vol_lKeyID;
             $vRec->lPeopleID = (int) $row->vol_lPeopleID;
             $vRec->lHouseholdID = $lHID = (int) $row->pe_lHouseholdID;
             $vRec->strHouseholdName = $clsPeople->strHouseholdNameViaHID($lHID);
             $vRec->bInactive = $row->vol_bInactive;
             $vRec->Notes = $row->vol_Notes;
             $vRec->bRetired = $row->vol_bRetired;
             $vRec->dteInactive = $row->dteInactive;
             $vRec->strLName = $strLName = $row->pe_strLName;
             $vRec->strFName = $strFName = $row->pe_strFName;
             $vRec->strMName = $strMName = $row->pe_strMName;
             $vRec->strTitle = $strTitle = $row->pe_strTitle;
             $vRec->strPreferred = $strPreferred = $row->pe_strPreferredName;
             $vRec->lRegFormID = (int) $row->vol_lRegFormID;
             $vRec->strFormName = $row->vreg_strFormName;
             $vRec->strURLHash = $row->vreg_strURLHash;
             $vRec->strSafeName = $vRec->strSafeNameFL = htmlspecialchars(strBuildName(false, $strTitle, $strPreferred, $strFName, $strLName, $strMName));
             $vRec->strSafeNameLF = htmlspecialchars(strBuildName(true, $strTitle, $strPreferred, $strFName, $strLName, $strMName));
             $vRec->bRetired = $row->pe_bRetired;
             $vRec->strAddr1 = $row->pe_strAddr1;
             $vRec->strAddr2 = $row->pe_strAddr2;
             $vRec->strCity = $row->pe_strCity;
             $vRec->strState = $row->pe_strState;
             $vRec->strZip = $row->pe_strZip;
             $vRec->strCountry = $row->pe_strCountry;
             $vRec->strEmail = $strEmail = $row->pe_strEmail;
             $vRec->strEmailFormatted = strBuildEmailLink($strEmail, '', false, '');
             $vRec->strPhone = $row->pe_strPhone;
             $vRec->strCell = $row->pe_strCell;
             $vRec->strAddress = strBuildAddress($vRec->strAddr1, $vRec->strAddr2, $vRec->strCity, $vRec->strState, $vRec->strCountry, $vRec->strZip, true);
             $vRec->lOriginID = $row->vol_lOriginID;
             $vRec->lLastUpdateID = $row->vol_lLastUpdateID;
             $vRec->dteOrigin = $row->dteOrigin;
             $vRec->dteLastUpdate = $row->dteLastUpdate;
             $vRec->strUCFName = $row->strUCFName;
             $vRec->strUCLName = $row->strUCLName;
             $vRec->strULFName = $row->strULFName;
             $vRec->strULLName = $row->strULLName;
             ++$idx;
         }
     }
 }
Beispiel #3
0
 function loadNameViaContextFID($clsID, $enumContextType, $lFID)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     switch ($enumContextType) {
         case CENUM_CONTEXT_AUCTION:
             $cAuction = new mauctions();
             $cAuction->loadAuctionByAucID($lFID);
             $clsID->strName = $cAuction->auctions[0]->strAuctionName;
             break;
         case CENUM_CONTEXT_AUCTIONITEM:
             $cItem = new mitems();
             $cItem->loadItemViaItemID($lFID);
             $clsID->strName = $cItem->items[0]->strItemName;
             break;
         case CENUM_CONTEXT_AUCTIONPACKAGE:
             $cPackage = new mpackages();
             $cPackage->loadPackageByPacID($lFID);
             $clsID->strName = $cPackage->packages[0]->strPackageName;
             break;
         case CENUM_CONTEXT_BIZ:
             $clsBiz = new mbiz();
             $clsBiz->loadBizRecsViaBID($lFID);
             $clsID->strName = $clsBiz->bizRecs[0]->strSafeName;
             break;
         case CENUM_CONTEXT_CLIENT:
             $clsClient = new mclients();
             $clsClient->loadClientsViaClientID($lFID);
             $clsID->strName = $clsClient->clients[0]->strFName . ' ' . $clsClient->clients[0]->strLName;
             break;
         case CENUM_CONTEXT_GRANTPROVIDER:
             $cgrant = new mgrants();
             $cgrant->loadGrantProviderViaGPID($lFID, $lNumProviders, $providers);
             $clsID->strName = $providers[0]->strGrantOrg;
             break;
         case CENUM_CONTEXT_INVITEM:
             $cinv = new minventory();
             $cinv->loadSingleInventoryItem($lFID, $lNumItems, $items);
             $clsID->strName = $items[0]->strItemName;
             break;
         case CENUM_CONTEXT_LOCATION:
             $clsLoc = new mclient_locations();
             $clsLoc->loadLocationRec($lFID);
             $clsID->strName = $clsLoc->strLocation;
             break;
         case CENUM_CONTEXT_ORGANIZATION:
             $clsOrg = new morganization();
             $clsOrg->lChapterID = $lFID;
             $clsOrg->loadChapterInfo();
             $clsID->strName = $clsOrg->chapterRec->strSafeChapterName;
             break;
         case CENUM_CONTEXT_PEOPLE:
             $clsPeople = new mpeople();
             $clsPeople->loadPeopleViaPIDs($lFID, false, false);
             $clsID->strName = $clsPeople->people[0]->strFName . ' ' . $clsPeople->people[0]->strLName;
             break;
         case CENUM_CONTEXT_SPONSORSHIP:
             $clsSpon = new msponsorship();
             $clsSpon->sponsorInfoViaID($lFID);
             $clsID->strName = $clsSpon->sponInfo[0]->strSponSafeNameFL;
             break;
         case CENUM_CONTEXT_STAFF:
             $cStaff = new muser_accts();
             $clsID->strName = $cStaff->strSafeUserNameViaID($lFID);
             break;
         case CENUM_CONTEXT_VOLUNTEER:
             $clsVol = new mvol();
             $clsVol->loadVolRecsViaVolID($lFID, true);
             $clsID->strName = $clsVol->volRecs[0]->strSafeName;
             break;
         case CENUM_CONTEXT_HOUSEHOLD:
         default:
             screamForHelp($enumContextType . ': not implemented yet<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
             break;
     }
 }
 public function contact($lPID = '', $lHID = 0)
 {
     //-------------------------------------------------------------------------
     //
     //-------------------------------------------------------------------------
     global $gclsChapterACO, $gbDateFormatUS, $gbVolLogin, $gVolPerms, $glVolPeopleID, $glUserID;
     global $gstrDuplicateWarning;
     $gstrDuplicateWarning = '';
     if ($gbVolLogin) {
         $lPID = $glVolPeopleID;
     }
     $this->load->helper('dl_util/verify_id');
     if ($lPID . '' != '0') {
         verifyID($this, $lPID, 'people ID');
     }
     if ($lHID . '' != '0') {
         verifyID($this, $lHID, 'household ID');
     }
     $displayData = array();
     $displayData['formData'] = new stdClass();
     $displayData['lPID'] = $lPID = (int) $lPID;
     $displayData['bNew'] = $bNew = $lPID <= 0;
     $bExistingHousehold = $lHID > 0;
     if ($bNew) {
         if (!bTestForURLHack('dataEntryPeopleBizVol')) {
             return;
         }
     } else {
         $bOkayToEdit = bAllowAccess('dataEntryPeopleBizVol') || bAllowAccess('volEditContact');
         if (!$bOkayToEdit) {
             bTestForURLHack('forceFail');
             return;
         }
     }
     // models associated with the people record
     $this->load->model('people/mpeople', 'clsPeople');
     $this->load->model('admin/madmin_aco', 'clsACO');
     if (!$gbVolLogin) {
         $this->load->model('sponsorship/msponsorship', 'clsSpon');
         $this->load->model('donations/mdonations', 'clsGifts');
     }
     if ($bNew) {
         $this->load->model('util/mdup_checker', 'cDupChecker');
     }
     $this->load->helper('dl_util/time_date');
     $this->load->helper('dl_util/web_layout');
     //      $this->load->helper('dl_util/email_web');
     $this->load->library('util/dl_date_time', '', 'clsDateTime');
     //--------------------------
     // load people record
     //--------------------------
     $this->clsPeople->sqlWhereExtra = " AND pe_lKeyID = {$lPID} ";
     if ($gbVolLogin) {
         $this->clsPeople->loadPeople(false, false, true);
     } else {
         $this->clsPeople->loadPeople(true, true, true);
     }
     $people = $this->clsPeople->people[0];
     // validation rules
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     $this->form_validation->set_rules('txtFName', 'First Name', 'trim|required');
     $this->form_validation->set_rules('txtTitle', '', 'trim');
     $this->form_validation->set_rules('txtMName', '', 'trim');
     $this->form_validation->set_rules('txtLName', 'Last Name', 'trim|required');
     $this->form_validation->set_rules('txtPName', '', 'trim');
     $this->form_validation->set_rules('txtSal', '', 'trim');
     $this->form_validation->set_rules('txtAddr1', '', 'trim');
     $this->form_validation->set_rules('txtAddr2', '', 'trim');
     $this->form_validation->set_rules('txtCity', '', 'trim');
     $this->form_validation->set_rules('txtState', '', 'trim');
     $this->form_validation->set_rules('txtZip', '', 'trim');
     $this->form_validation->set_rules('txtCountry', '', 'trim');
     $this->form_validation->set_rules('txtNotes', '', 'trim');
     $this->form_validation->set_rules('txtPhone', '', 'trim');
     $this->form_validation->set_rules('txtCell', '', 'trim');
     $this->form_validation->set_rules('rdoGender', '', 'trim');
     $this->form_validation->set_rules('txtBDate', '', 'trim|callback_peopleRecVerifyBDateValid' . '|callback_peopleRecVerifyBDatePast');
     if ($gbVolLogin) {
         $this->form_validation->set_rules('txtEmail', 'Email', 'trim|required|valid_email|callback_verifyUniqueUserID');
     } else {
         $this->form_validation->set_rules('txtEmail', 'Email', 'trim|valid_email');
         $this->form_validation->set_rules('rdoACO', '', 'trim');
         $this->form_validation->set_rules('ddlAttrib', 'Attributed to');
     }
     // test for duplicate people
     if ($bNew) {
         $this->form_validation->set_rules('hiddenTestDup', 'dummy', 'callback_verifyNoDups');
         $displayData['bHiddenNewTestDup'] = true;
     }
     if ($bNew) {
         $people->lHouseholdID = $lHID;
         if ($lHID <= 0) {
             $people->strHouseholdName = '<i>new</i>';
         } else {
             $people->strHouseholdName = $this->clsPeople->strHouseholdNameViaHID($lHID);
         }
     }
     if ($this->form_validation->run() == FALSE) {
         $displayData['js'] = '';
         $this->load->library('generic_form');
         $this->load->model('util/mlist_generic', 'clsList');
         $this->clsList->enumListType = CENUM_LISTTYPE_ATTRIB;
         $displayData['strDuplicateWarning'] = $gstrDuplicateWarning;
         if (validation_errors() == '') {
             if ($bNew) {
                 $displayData['formData']->strBDay = $displayData['formData']->txtTitle = $displayData['formData']->txtFName = $displayData['formData']->txtMName = $displayData['formData']->txtLName = $displayData['formData']->txtPName = $displayData['formData']->txtSal = $displayData['formData']->txtNotes = $displayData['formData']->txtEmail = $displayData['formData']->txtCell = '';
                 $displayData['formData']->enumGender = 'Unknown';
                 $displayData['formData']->dteMysqlBirthDate = '';
                 if ($bExistingHousehold) {
                     $clsHouse = new mpeople();
                     $clsHouse->loadPeopleViaPIDs($lHID, false, false);
                     $house = $clsHouse->people[0];
                     $displayData['formData']->txtAddr1 = htmlspecialchars($house->strAddr1);
                     $displayData['formData']->txtAddr2 = htmlspecialchars($house->strAddr2);
                     $displayData['formData']->txtCity = htmlspecialchars($house->strCity);
                     $displayData['formData']->txtState = htmlspecialchars($house->strState);
                     $displayData['formData']->txtZip = htmlspecialchars($house->strZip);
                     $displayData['formData']->txtCountry = htmlspecialchars($house->strCountry);
                     $displayData['formData']->txtPhone = htmlspecialchars($house->strPhone);
                     $lACO = $house->lACO;
                 } else {
                     $displayData['formData']->txtAddr1 = $displayData['formData']->txtAddr2 = $displayData['formData']->txtCity = $displayData['formData']->txtState = $displayData['formData']->txtZip = $displayData['formData']->txtCountry = $displayData['formData']->txtPhone = '';
                     $lACO = $gclsChapterACO->lKeyID;
                 }
                 if (!$gbVolLogin) {
                     $displayData['formData']->rdoACO = $this->clsACO->strACO_Radios($lACO, 'rdoACO');
                     $displayData['strAttribDDL'] = $this->clsList->strLoadListDDL('ddlAttrib', true, -1);
                 }
             } else {
                 $displayData['formData']->txtTitle = $people->strTitle;
                 $displayData['formData']->txtFName = htmlspecialchars($people->strFName);
                 $displayData['formData']->txtMName = htmlspecialchars($people->strMName);
                 $displayData['formData']->txtLName = htmlspecialchars($people->strLName);
                 $displayData['formData']->txtPName = htmlspecialchars($people->strPreferredName);
                 $displayData['formData']->txtSal = htmlspecialchars($people->strSalutation);
                 $displayData['formData']->txtNotes = htmlspecialchars($people->strNotes);
                 $displayData['formData']->txtAddr1 = htmlspecialchars($people->strAddr1);
                 $displayData['formData']->txtAddr2 = htmlspecialchars($people->strAddr2);
                 $displayData['formData']->txtCity = htmlspecialchars($people->strCity);
                 $displayData['formData']->txtState = htmlspecialchars($people->strState);
                 $displayData['formData']->txtZip = htmlspecialchars($people->strZip);
                 $displayData['formData']->txtCountry = htmlspecialchars($people->strCountry);
                 $displayData['formData']->txtEmail = htmlspecialchars($people->strEmail);
                 $displayData['formData']->txtPhone = htmlspecialchars($people->strPhone);
                 $displayData['formData']->txtCell = htmlspecialchars($people->strCell);
                 $displayData['formData']->enumGender = $people->enumGender;
                 if (is_null($people->dteMysqlBirthDate)) {
                     $displayData['formData']->strBDay = '';
                 } else {
                     $displayData['formData']->strBDay = strNumericDateViaMysqlDate($people->dteMysqlBirthDate, $gbDateFormatUS);
                 }
                 if (!$gbVolLogin) {
                     $displayData['formData']->rdoACO = $this->clsACO->strACO_Radios($people->lACO, 'rdoACO');
                     $displayData['strAttribDDL'] = $this->clsList->strLoadListDDL('ddlAttrib', true, $people->lAttributedTo);
                 }
             }
         } else {
             setOnFormError($displayData);
             $displayData['formData']->txtTitle = set_value('txtTitle');
             $displayData['formData']->txtFName = set_value('txtFName');
             $displayData['formData']->txtMName = set_value('txtMName');
             $displayData['formData']->txtLName = set_value('txtLName');
             $displayData['formData']->txtPName = set_value('txtPName');
             $displayData['formData']->txtSal = set_value('txtSal');
             $displayData['formData']->txtNotes = set_value('txtNotes');
             $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']->txtEmail = set_value('txtEmail');
             $displayData['formData']->txtPhone = set_value('txtPhone');
             $displayData['formData']->txtCell = set_value('txtCell');
             $displayData['formData']->enumGender = set_value('rdoGender');
             $displayData['formData']->strBDay = set_value('txtBDate');
             if (!$gbVolLogin) {
                 $displayData['formData']->rdoACO = $this->clsACO->strACO_Radios(set_value('rdoACO'), 'rdoACO');
                 $displayData['strAttribDDL'] = $this->clsList->strLoadListDDL('ddlAttrib', true, set_value('ddlAttrib'));
             }
         }
         $displayData['people'] = $people;
         //--------------------------
         // breadcrumbs
         //--------------------------
         if ($gbVolLogin) {
             $displayData['pageTitle'] = anchor('people/people_record/view/' . $lPID, 'Record', 'class="breadcrumb"') . ' | Edit';
         } else {
             $displayData['pageTitle'] = anchor('main/menu/people', 'People', 'class="breadcrumb"') . ' | ' . ($bNew ? 'Record' : anchor('people/people_record/view/' . $lPID, 'Record', 'class="breadcrumb"')) . ' | ' . ($bNew ? 'Add New' : 'Edit');
         }
         $displayData['title'] = CS_PROGNAME . ' | People';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'people/people_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');
         $people =& $this->clsPeople->people[0];
         $people->lHouseholdID = (int) $lHID;
         $people->strTitle = trim($_POST['txtTitle']);
         $people->strFName = trim($_POST['txtFName']);
         $people->strMName = trim($_POST['txtMName']);
         $people->strLName = trim($_POST['txtLName']);
         $people->strPreferredName = trim($_POST['txtPName']);
         $people->strSalutation = trim($_POST['txtSal']);
         $people->strNotes = trim($_POST['txtNotes']);
         if ($people->strPreferredName == '') {
             $people->strPreferredName = $people->strFName;
         }
         if ($people->strSalutation == '') {
             $people->strSalutation = $people->strFName;
         }
         $people->strAddr1 = trim($_POST['txtAddr1']);
         $people->strAddr2 = trim($_POST['txtAddr2']);
         $people->strCity = trim($_POST['txtCity']);
         $people->strState = trim($_POST['txtState']);
         $people->strZip = trim($_POST['txtZip']);
         $people->strCountry = trim($_POST['txtCountry']);
         if ($gbVolLogin) {
             $strOriginalEmail = $people->strEmail;
         }
         $people->strEmail = trim($_POST['txtEmail']);
         $people->strPhone = trim($_POST['txtPhone']);
         $people->strCell = trim($_POST['txtCell']);
         $people->enumGender = trim($_POST['rdoGender']);
         if ($gbVolLogin) {
             $this->load->model('admin/muser_accts', 'clsUser');
             $this->clsUser->updateUserAcctViaPeopleInfo($glUserID, $people);
         }
         if (!$gbVolLogin) {
             $people->lACO = (int) $_POST['rdoACO'];
             $lAttrib = (int) $_REQUEST['ddlAttrib'];
             if ($lAttrib <= 0) {
                 $people->lAttributedTo = null;
             } else {
                 $people->lAttributedTo = $lAttrib;
             }
         }
         $strBDate = trim($_POST['txtBDate']);
         if ($strBDate == '') {
             $people->dteMysqlBirthDate = null;
         } else {
             MDY_ViaUserForm($strBDate, $lMon, $lDay, $lYear, $gbDateFormatUS);
             $people->dteMysqlBirthDate = strMoDaYr2MySQLDate($lMon, $lDay, $lYear);
         }
         if ($bNew) {
             $people->dteExpire = $people->dteMysqlDeath = null;
             $lPID = $this->clsPeople->lCreateNewPeopleRec();
             $this->session->set_flashdata('msg', 'The people record was added');
         } else {
             $this->clsPeople->updatePeopleRec($lPID);
             if ($gbVolLogin) {
                 $this->session->set_flashdata('msg', 'Your contact information was updated.');
             } else {
                 $this->session->set_flashdata('msg', 'The people record was updated');
             }
         }
         redirect('people/people_record/view/' . $lPID);
     }
 }
 function setRelType($lPeople_A_ID, $lPeople_B_ID, $lRelID_A2B = 0, $lRelID_B2A = 0, $bShowA = true, $bShowB = true)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $this->load->helper('dl_util/verify_id');
     verifyID($this, $lPeople_A_ID, 'people ID');
     verifyID($this, $lPeople_B_ID, 'people ID');
     $bNew = $lRelID_A2B == 0 && $lRelID_B2A == 0;
     $bShowA = (bool) $bShowA;
     $bShowB = (bool) $bShowB;
     $displayData = array();
     $displayData['relInfo'] = new stdClass();
     $displayData['lPeople_A_ID'] = $lPeople_A_ID = (int) $lPeople_A_ID;
     $displayData['lPeople_B_ID'] = $lPeople_B_ID = (int) $lPeople_B_ID;
     //-------------------------
     // load models
     //-------------------------
     $this->load->model('people/mpeople');
     $this->load->model('admin/madmin_aco', 'clsACO');
     $this->load->model('people/mrelationships', 'clsRel');
     //      $this->load->helper('dl_util/email_web');
     $params = array('enumStyle' => 'terse');
     $this->load->library('generic_rpt', $params);
     //-----------------------------
     // validation rules
     //-----------------------------
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     //		$this->form_validation->set_rules('ddlRel_A',       'Relationship A to B', 'trim|required');
     $this->form_validation->set_rules('ddlRel_A', 'Relationship A to B', 'trim' . ($lRelID_A2B || $bNew ? '|required' : ''));
     $this->form_validation->set_rules('ddlRel_B', 'Relationship B to A', 'trim' . ($lRelID_B2A ? '|required' : ''));
     $this->form_validation->set_rules('chkSoftCash_A', 'Soft Cash (A)', 'trim');
     $this->form_validation->set_rules('chkSoftCash_B', 'Soft Cash (B)', 'trim|callback_relBSoftCash');
     $this->form_validation->set_rules('txtNotes_A', 'Notes', 'trim');
     $this->form_validation->set_rules('txtNotes_B', 'Notes', 'trim');
     if ($this->form_validation->run() == FALSE) {
         $displayData['relInfo']->lRelID_A2B = $lRelID_A2B;
         $displayData['relInfo']->lRelID_B2A = $lRelID_B2A;
         $displayData['bShowA'] = $bShowA;
         $displayData['bShowB'] = $bShowB;
         $clsPersonA = new mpeople();
         $clsPersonB = new mpeople();
         $clsPersonA->loadPeopleViaPIDs($lPeople_A_ID, false, false);
         $displayData['contextSummary'] = $clsPersonA->peopleHTMLSummary(0);
         $clsPersonA->loadPeopleViaPIDs($lPeople_A_ID, false, false);
         $clsPersonB->loadPeopleViaPIDs($lPeople_B_ID, false, false);
         $displayData['strSafeName_A'] = $clsPersonA->people[0]->strSafeName;
         $displayData['strSafeName_B'] = $clsPersonB->people[0]->strSafeName;
         $displayData['relInfo']->lRelNameID_B2A = null;
         $displayData['relInfo']->lRelNameID_A2B = null;
         if (validation_errors() == '') {
             if ($bNew) {
                 $displayData['relInfo']->strRelationship_A2B = '';
                 $displayData['relInfo']->bSoftMoneyShare_A2B = false;
                 $displayData['relInfo']->strNotes_A2B = '';
                 $displayData['relInfo']->strRelationship_B2A = '';
                 $displayData['relInfo']->bSoftMoneyShare_B2A = false;
                 $displayData['relInfo']->strNotes_B2A = '';
                 $displayData['bShowA'] = $displayData['bShowB'] = true;
                 $displayData['strRelDDL_A'] = $this->clsRel->strPeopleRelationshipsDDL(true, $displayData['relInfo']->lRelNameID_A2B);
                 $displayData['strRelDDL_B'] = $this->clsRel->strPeopleRelationshipsDDL(true, $displayData['relInfo']->lRelNameID_B2A);
             } else {
                 $displayData['relInfo']->bSoftMoneyShare_A2B = $displayData['relInfo']->bSoftMoneyShare_B2A = false;
                 if ($bShowA) {
                     $this->clsRel->relationshipInfoViaRelID($lRelID_A2B);
                     $displayData['relInfo']->bSoftMoneyShare_A2B = $this->clsRel->bSoftCash;
                     $displayData['relInfo']->strNotes_A2B = $this->clsRel->strNotes;
                     $displayData['strRelDDL_A'] = $this->clsRel->strPeopleRelationshipsDDL(true, $this->clsRel->lRelNameID);
                 }
                 if ($bShowB) {
                     $this->clsRel->relationshipInfoViaRelID($lRelID_B2A);
                     $displayData['relInfo']->bSoftMoneyShare_B2A = $this->clsRel->bSoftCash;
                     $displayData['relInfo']->strNotes_B2A = $this->clsRel->strNotes;
                     $displayData['strRelDDL_B'] = $this->clsRel->strPeopleRelationshipsDDL(true, $this->clsRel->lRelNameID);
                 }
             }
         } else {
             setOnFormError($displayData);
             $displayData['relInfo']->bSoftMoneyShare_A2B = set_value('chkSoftCash_A') == 'TRUE';
             $displayData['relInfo']->strNotes_A2B = set_value('txtNotes_A');
             $displayData['strRelDDL_A'] = $this->clsRel->strPeopleRelationshipsDDL(true, set_value('ddlRel_A'));
             $displayData['relInfo']->bSoftMoneyShare_B2A = set_value('chkSoftCash_B') == 'TRUE';
             $displayData['relInfo']->strNotes_B2A = set_value('txtNotes_B');
             $displayData['strRelDDL_B'] = $this->clsRel->strPeopleRelationshipsDDL(true, set_value('ddlRel_B'));
         }
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = anchor('main/menu/people', 'People', 'class="breadcrumb"') . ' | ' . anchor('people/people_record/view/' . $lPeople_A_ID, 'Record', 'class="breadcrumb"') . ' | Relationships';
         $displayData['title'] = CS_PROGNAME . ' | People';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'people/relationship_add_edit';
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         //echo(__FILE__.' '.__LINE__.'<br>'."\n"); die;
         $this->addUpdate($lPeople_A_ID, $lPeople_B_ID, $lRelID_A2B, $lRelID_B2A, $bShowA, $bShowB);
     }
 }
 function lPeopleVolRecViaAcct($lChapterID, $lACOID, $lUserID)
 {
     //---------------------------------------------------------------------
     // create a people/volunteer rec based on the the info in
     // $this->userRec[0]; Update the peopleID in the db record;
     // return the new people ID.
     //---------------------------------------------------------------------
     global $glUserID, $glChapterID;
     $holdUserID = $glUserID;
     $holdChapterID = $glChapterID;
     $glUserID = $lACOID;
     $glChapterID = $lChapterID;
     $ur =& $this->userRec[0];
     $cp = new mpeople();
     $cv = new mvol();
     $cp->loadPeopleViaPIDs(-1, false, false);
     $pr =& $cp->people[0];
     $pr->lHouseholdID = 0;
     $pr->lAttributedTo = null;
     $pr->strTitle = $ur->us_strTitle;
     $pr->strFName = $ur->us_strFirstName;
     $pr->strMName = '';
     $pr->strLName = $ur->us_strLastName;
     $pr->strPreferredName = $ur->us_strFirstName;
     $pr->strSalutation = $ur->us_strFirstName;
     $pr->strAddr1 = $ur->us_strAddr1;
     $pr->strAddr2 = $ur->us_strAddr2;
     $pr->strCity = $ur->us_strCity;
     $pr->strState = $ur->us_strState;
     $pr->strCountry = $ur->us_strCountry;
     $pr->strZip = $ur->us_strZip;
     $pr->strPhone = $ur->us_strPhone;
     $pr->strCell = $ur->us_strCell;
     $pr->strNotes = '';
     $pr->strEmail = $ur->us_strEmail;
     $pr->enumGender = 'Unknown';
     $pr->dteExpire = null;
     $pr->lACO = $lACOID;
     $pr->dteMysqlBirthDate = null;
     $pr->dteMysqlDeath = null;
     $lPID = $cp->lCreateNewPeopleRec();
     $cv->loadVolRecsViaVolID(-1, true);
     $vr =& $cv->volRecs[0];
     $vr->lRegFormID = null;
     $vr->lPeopleID = $lPID;
     $vr->Notes = '';
     $cv->lAddNewVolunteer();
     $glUserID = $holdUserID;
     $glChapterID = $holdChapterID;
     return $lPID;
 }
 function review($reportID)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $displayData = array();
     $displayData['js'] = '';
     $displayData['reportID'] = $reportID;
     //------------------------------------------------
     // models, libraries and utilities
     //------------------------------------------------
     $this->load->model('reports/mreports', 'clsReports');
     $this->load->library('util/dl_date_time', '', 'clsDateTime');
     $this->load->helper('dl_util/web_layout');
     $this->load->helper('reports/report_util');
     $params = array('enumStyle' => 'terse', 'clsRpt');
     $this->load->library('generic_rpt', $params);
     if (!isset($_SESSION[CS_NAMESPACE . 'Reports'][$reportID])) {
         $this->session->set_flashdata('error', 'The report you requested is no longer available. Please run the report again.');
         redirect_Reports();
     }
     $sRpt = $_SESSION[CS_NAMESPACE . 'Reports'][$reportID];
     $displayData['enumContext'] = $enumContext = $sRpt->enumContext;
     $displayData['strLabel'] = $strLabel = $this->strContextLabel($enumContext);
     switch ($enumContext) {
         case CENUM_CONTEXT_CLIENT:
             $this->load->model('clients/mclients');
             $cGood = new mclients();
             $cGood->loadClientsViaClientID($sRpt->goodID);
             $displayData['lNumGoodClients'] = $cGood->lNumClients;
             $displayData['goodClient'] = $cGood->clients;
             $cDup = new mclients();
             $cDup->loadClientsViaClientID($sRpt->dupIDs);
             $displayData['lNumDupClients'] = $cDup->lNumClients;
             $displayData['dupClients'] = $cDup->clients;
             $displayData['title'] = CS_PROGNAME . ' | Clients';
             $displayData['pageTitle'] = anchor('main/menu/client', 'Clients', 'class="breadcrumb"') . ' | ' . anchor('util/dup_records/opts/' . CENUM_CONTEXT_CLIENT, 'Client Duplicates', 'class="breadcrumb"') . ' | Client Duplicates: Review';
             break;
         case CENUM_CONTEXT_PEOPLE:
             $this->load->model('admin/madmin_aco', 'clsACO');
             $this->load->model('people/mpeople', 'clsPeople');
             $cGood = new mpeople();
             $cGood->loadPeopleViaPIDs($sRpt->goodID, false, false);
             $displayData['lNumGoodPeople'] = $cGood->lNumPeople;
             $displayData['goodPeople'] = $cGood->people;
             $cDup = new mpeople();
             $cDup->loadPeopleViaPIDs($sRpt->dupIDs, false, false);
             $displayData['lNumDupPeople'] = $cDup->lNumPeople;
             $displayData['dupPeople'] = $cDup->people;
             $displayData['title'] = CS_PROGNAME . ' | People';
             $displayData['pageTitle'] = anchor('main/menu/people', 'People', 'class="breadcrumb"') . ' | ' . anchor('util/dup_records/opts/' . CENUM_CONTEXT_PEOPLE, 'People Duplicates', 'class="breadcrumb"') . ' | Duplicate People Records: Review';
             break;
         case CENUM_CONTEXT_BIZ:
             $this->load->model('admin/madmin_aco', 'clsACO');
             $this->load->model('biz/mbiz', 'clsBiz');
             $cGood = new mbiz();
             $cGood->loadBizRecsViaBID($sRpt->goodID, false, false);
             $displayData['lNumGoodBiz'] = $cGood->lNumBizRecs;
             $displayData['goodBiz'] = $cGood->bizRecs;
             $cDup = new mbiz();
             $cDup->loadBizRecsViaBID($sRpt->dupIDs, false, false);
             $displayData['lNumDupBiz'] = $cDup->lNumBizRecs;
             $displayData['dupBiz'] = $cDup->bizRecs;
             $displayData['title'] = CS_PROGNAME . ' | Businesses/Organizations';
             $displayData['pageTitle'] = anchor('main/menu/biz', 'Business/Organizations', 'class="breadcrumb"') . ' | ' . anchor('util/dup_records/opts/' . CENUM_CONTEXT_BIZ, 'Business Duplicates', 'class="breadcrumb"') . ' | Duplicate Business Records: Review';
             break;
         default:
             screamForHelp($enumContext . ': invalid context for duplicate record consolidation<br>error on line  <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
             break;
     }
     //--------------------------
     // breadcrumbs
     //--------------------------
     $displayData['nav'] = $this->mnav_brain_jar->navData();
     $displayData['mainTemplate'] = 'util/dup_rec_review_view';
     $this->load->vars($displayData);
     $this->load->view('template');
 }
 private function searchPeopleTableGeneric($bHofH, $bBiz, $enumSearchType, $bNewVol)
 {
     //-----------------------------------------------------------------------
     //
     //-----------------------------------------------------------------------
     $clsPeople = new mpeople();
     if ($bHofH) {
         $strWhereHofH = ' AND pe_lKeyID=pe_lHouseholdID ';
     } else {
         $strWhereHofH = '';
     }
     $strWhereVol = $strSelectVol = '';
     if ($enumSearchType == CENUM_CONTEXT_VOLUNTEER) {
         $strSelectVol = ', vol_lKeyID, vol_bInactive ';
         if ($bNewVol) {
             $strInnerVol = ' LEFT JOIN volunteers ON pe_lKeyID=vol_lPeopleID ';
             $strWhereVol = ' AND ((vol_lKeyID IS NULL) OR (vol_bInactive)) ';
         } else {
             $strInnerVol = ' INNER JOIN volunteers ON pe_lKeyID=vol_lPeopleID ';
         }
     } else {
         $strInnerVol = '';
     }
     $strWhereBiz = ' AND ' . ($bBiz ? '' : ' NOT ') . ' pe_bBiz ';
     $sqlStr = "SELECT\n            pe_lKeyID, pe_strFName, pe_strLName, pe_strMName,\n            pe_strPreferredName, pe_strTitle, pe_lHouseholdID,\n            pe_strAddr1, pe_strAddr2, pe_strCity, pe_strState,\n            pe_strCountry, pe_strZip\n            {$strSelectVol}\n         FROM people_names\n            {$strInnerVol}\n         WHERE 1\n            AND NOT pe_bRetired\n            {$strWhereHofH}\n            {$strWhereBiz}\n            {$strWhereVol}\n            {$this->strWhereExtra}\n         ORDER BY pe_strLName, pe_strFName, pe_lKeyID;";
     $query = $this->db->query($sqlStr);
     $numRows = $query->num_rows();
     if ($numRows > 0) {
         $idx = 0;
         foreach ($query->result() as $row) {
             $this->searchResults[$this->lNumSearchResults] = new stdClass();
             $clsResult = $this->searchResults[$this->lNumSearchResults];
             if ($enumSearchType == CENUM_CONTEXT_VOLUNTEER && !$bNewVol) {
                 $clsResult->lKeyID = $row->vol_lKeyID;
             } else {
                 $clsResult->lKeyID = $row->pe_lKeyID;
             }
             $clsResult->enumSearchType = $enumSearchType;
             switch ($enumSearchType) {
                 case CENUM_CONTEXT_HOUSEHOLD:
                     $clsResult->strResult = '<b>The ' . htmlspecialchars($row->pe_strFName . ' ' . $row->pe_strLName) . ' Household</b><br>' . strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true, true);
                     break;
                 case CENUM_CONTEXT_VOLUNTEER:
                     $strSafeNameLF = htmlspecialchars(strBuildName(true, $row->pe_strTitle, $row->pe_strPreferredName, $row->pe_strFName, $row->pe_strLName, $row->pe_strMName));
                     $strFont = $strFontEnd = '';
                     if (!is_null($row->vol_lKeyID) && $row->vol_bInactive) {
                         $strFont = '<font style="color: #777777"><i>';
                         $strFontEnd = '<br>(inactive volunteer)</i></font> ';
                     }
                     $clsResult->strResult = $strFont . '<b>' . $strSafeNameLF . "</b><br>\n" . strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true, true) . $strFontEnd;
                     break;
                 case CENUM_CONTEXT_PEOPLE:
                     $strHousehold = $clsPeople->strHouseholdNameViaHID($row->pe_lHouseholdID);
                     $strSafeNameLF = htmlspecialchars(strBuildName(true, $row->pe_strTitle, $row->pe_strPreferredName, $row->pe_strFName, $row->pe_strLName, $row->pe_strMName));
                     $clsResult->strResult = '<b>' . $strSafeNameLF . "</b><br>\n" . '<i>' . htmlspecialchars($strHousehold) . '</i><br>' . strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true, true);
                     break;
                 case CENUM_CONTEXT_BIZ:
                     $clsResult->strResult = '<b>' . htmlspecialchars($row->pe_strLName) . '</b><br>' . strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true, true);
                     break;
                 default:
                     screamForHelp($enumSearchType . ': invalid switch type<br>error on <b>line:</b> ' . __LINE__ . '<br><b>file: </b>' . __FILE__ . '<br><b>function: </b>' . __FUNCTION__);
                     break;
             }
             ++$this->lNumSearchResults;
             ++$idx;
         }
     }
 }
 public function loadGiftHistory($lPID, $enumSortType, $lACOID, &$clsACO, &$lNumGiftsGH, &$giftHistory)
 {
     //---------------------------------------------------------------------
     // $enumSortType - date, giftID, name, amount, acctCamp
     //---------------------------------------------------------------------
     $cPeople = new mpeople();
     $bBiz = $cPeople->bBizRec($lPID);
     $clsHonMem = new mhon_mem();
     $clsACO->loadCountries(false, false, true, $lACOID);
     $strFlag = $clsACO->countries[0]->strFlagImg;
     $strCurSymbol = $clsACO->countries[0]->strCurrencySymbol;
     $strCountry = $clsACO->countries[0]->strName;
     $strTableName = 'tmpGift';
     $this->createTempGiftTable($strTableName);
     //-------------------------------------------
     // straight donations/sponsorship payments
     //-------------------------------------------
     $sqlStr = "INSERT INTO {$strTableName} (tgi_lGiftID, tgi_lPID)\n             SELECT gi_lKeyID, gi_lForeignID\n             FROM gifts\n             WHERE gi_lForeignID={$lPID}\n                AND gi_lACOID={$lACOID}\n                AND NOT gi_bRetired;";
     $this->db->query($sqlStr);
     //-------------------------------------------
     // soft donations/sponsorship payments
     //-------------------------------------------
     $sqlStr = "INSERT INTO {$strTableName} (tgi_lGiftID, tgi_lPID)\n             SELECT gi_lKeyID, gi_lForeignID\n             FROM gifts\n                INNER JOIN people_relationships ON pr_lPerson_A_ID=gi_lForeignID\n             WHERE pr_lPerson_B_ID={$lPID}\n                AND gi_lACOID={$lACOID}\n                AND pr_bSoftDonations\n                AND NOT gi_bRetired;";
     $this->db->query($sqlStr);
     //-------------------------------------------
     // people-to-business soft cash relationships
     //-------------------------------------------
     if ($bBiz) {
         $sqlStr = "INSERT INTO {$strTableName} (tgi_lGiftID, tgi_lPID)\n               SELECT gi_lKeyID, gi_lForeignID\n               FROM gifts\n               INNER JOIN biz_contacts ON bc_lContactID=gi_lForeignID\n               WHERE bc_lBizID={$lPID}\n                  AND bc_bSoftCash\n                  AND gi_lACOID={$lACOID}\n                  AND NOT bc_bRetired\n                  AND NOT gi_bRetired;";
     } else {
         $sqlStr = "INSERT INTO {$strTableName} (tgi_lGiftID, tgi_lPID)\n               SELECT gi_lKeyID, gi_lForeignID\n               FROM gifts\n                  INNER JOIN biz_contacts ON bc_lBizID=gi_lForeignID\n               WHERE bc_lContactID={$lPID}\n                  AND bc_bSoftCash\n                  AND gi_lACOID={$lACOID}\n                  AND NOT bc_bRetired\n                  AND NOT gi_bRetired;";
     }
     $this->db->query($sqlStr);
     if ($this->bDebug) {
         $this->dumpTempTable($strTableName);
     }
     //-------------------------
     // set the sort order
     //-------------------------
     $strSort = $this->strSetSortOrder($enumSortType);
     $sqlStr = "SELECT\n            gi_lKeyID, gi_lForeignID, gi_lSponsorID,\n            gi_curAmnt, gi_dteDonation, \n            gi_bHon, gi_bMem, gi_lACOID,\n            pe_lKeyID, pe_bBiz, pe_strFName, pe_strLName,\n            gc_lKeyID, gc_strCampaign, gi_bGIK, lgen_strListItem AS strGIK,\n            ga_lKeyID, ga_strAccount\n\n         FROM {$strTableName}\n            INNER JOIN gifts           ON gi_lKeyID  = tgi_lGiftID\n            INNER JOIN gifts_campaigns ON gi_lCampID = gc_lKeyID\n            INNER JOIN gifts_accounts  ON gc_lAcctID = ga_lKeyID\n            INNER JOIN people_names    ON pe_lKeyID  = gi_lForeignID\n            LEFT  JOIN lists_generic   ON gi_lGIK_ID = lgen_lKeyID\n\n         ORDER BY {$strSort};";
     $query = $this->db->query($sqlStr);
     $lNumGiftsGH = $numRows = $query->num_rows();
     $giftHistory = array();
     if ($lNumGiftsGH > 0) {
         $idx = 0;
         foreach ($query->result() as $row) {
             $giftHistory[$idx] = new stdClass();
             $giftHistory[$idx]->gi_lKeyID = $lGiftID = $row->gi_lKeyID;
             $giftHistory[$idx]->gi_lForeignID = $row->gi_lForeignID;
             $giftHistory[$idx]->gi_lSponsorID = $row->gi_lSponsorID;
             $giftHistory[$idx]->gi_curAmnt = $row->gi_curAmnt;
             $giftHistory[$idx]->gi_dteDonation = dteMySQLDate2Unix($row->gi_dteDonation);
             $giftHistory[$idx]->gi_bGIK = $row->gi_bGIK;
             $giftHistory[$idx]->strGIK = $row->strGIK;
             $giftHistory[$idx]->pe_lKeyID = $row->pe_lKeyID;
             $giftHistory[$idx]->pe_bBiz = $row->pe_bBiz;
             $giftHistory[$idx]->pe_strFName = $row->pe_strFName;
             $giftHistory[$idx]->pe_strLName = $row->pe_strLName;
             $giftHistory[$idx]->gc_lKeyID = $row->gc_lKeyID;
             $giftHistory[$idx]->gc_strCampaign = $row->gc_strCampaign;
             $giftHistory[$idx]->ga_lKeyID = $row->ga_lKeyID;
             $giftHistory[$idx]->ga_strAccount = $row->ga_strAccount;
             $giftHistory[$idx]->bHon = $clsHonMem->lNumHonViaGID($lGiftID) > 0;
             $giftHistory[$idx]->bMem = $clsHonMem->lNumMemViaGID($lGiftID) > 0;
             $giftHistory[$idx]->lACOID = $lACOID;
             $giftHistory[$idx]->strACOFlag = $strFlag;
             $giftHistory[$idx]->strACOCurSymbol = $strCurSymbol;
             $giftHistory[$idx]->strACOCountry = $strCountry;
             ++$idx;
         }
     }
     $this->dropTempGiftTable($strTableName);
 }
 public function strHTMLOneLineLink($clsSingleRem)
 {
     /*---------------------------------------------------------------------
           sample call:
           $clsRem->loadReminders();
     
           if ($clsRem->lNumReminders > 0){
              foreach ($clsRem->reminders as $clsSingleRem){
                 $strRemLink = $clsRem->strHTMLOneLineLink($clsSingleRem);
              }
           }
        ---------------------------------------------------------------------*/
     global $genumDateFormat;
     $enumRemType = $clsSingleRem->enumSource;
     $lFID = $clsSingleRem->lForeignID;
     switch ($enumRemType) {
         case CENUM_CONTEXT_PEOPLE:
             $people = new mpeople();
             $people->lPeopleID = $lFID;
             $people->peopleInfoLight();
             $strRemLink = 'people reminder for ' . $people->strSafeName . strLinkView_PeopleRecord($lFID, 'View people record', true);
             break;
         case CENUM_CONTEXT_BIZ:
             $clsBiz = new mbiz();
             $clsBiz->lBID = $lFID;
             $clsBiz->bizInfoLight();
             $strRemLink = 'business reminder for ' . $clsBiz->strSafeName . strLinkView_BizRecord($lFID, 'View business record', true);
             break;
         case CENUM_CONTEXT_CLIENT:
             $clsClient = new mclients();
             $clsClient->loadClientsViaClientID($lFID);
             $strRemLink = 'client reminder for ' . $clsClient->clients[0]->strSafeName . ' ' . strLinkView_ClientRecord($lFID, 'View client record', true);
             break;
         case CENUM_CONTEXT_GIFT:
             $clsGifts = new mdonations();
             $clsGifts->loadGiftViaGID($lFID);
             $gift = $clsGifts->gifts[0];
             $strRemLink = 'gift reminder for ' . $gift->strACOCurSymbol . number_format($gift->gi_curAmnt, 2) . ' ' . $gift->strSafeName . ' of ' . date($genumDateFormat, $gift->gi_dteDonation) . ' ' . strLinkView_GiftsRecord($lFID, 'View gift record', true);
             break;
         case CENUM_CONTEXT_USER:
             $clsUser = new muser_accts();
             $clsUser->loadSingleUserRecord($lFID);
             $user =& $clsUser->userRec[0];
             $strRemLink = 'user reminder for ' . $user->strSafeName . ' ' . strLinkView_User($lFID, 'View user record', true);
             break;
         case CENUM_CONTEXT_SPONSORSHIP:
             $cSpon = new msponsorship();
             $cSpon->sponsorInfoViaID($lFID);
             $strRemLink = 'sponsorship reminder for sponsor ' . $cSpon->sponInfo[0]->strSponSafeNameFL . ' ' . strLinkView_Sponsorship($lFID, 'View sponsorship record', true);
             break;
         case CENUM_CONTEXT_LOCATION:
         case CENUM_CONTEXT_VOLUNTEER:
         default:
             screamForHelp($enumRemType . ': Switch type not implemented</b><br>error on <b>line:</b> ' . __LINE__ . '<br><b>file:</b> ' . __FILE__ . '<br><b>function:</b> ' . __FUNCTION__);
             break;
     }
     return $strRemLink;
 }