function loadContactNameDirectoryPage($strWhereExtra, $lStartRec, $lRecsPerPage) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $sqlLimitExtra = " LIMIT {$lStartRec}, {$lRecsPerPage} "; $this->sqlWhereExtra = $strWhereExtra; $sqlStr = "SELECT\n pe_lKeyID, pe_strLName, pe_strFName, pe_strMName,\n pe_strTitle, pe_strPreferredName,\n pe_strAddr1,\n pe_strAddr2,\n pe_strCity,\n pe_strState,\n pe_strCountry,\n pe_strZip,\n pe_strPhone,\n pe_strCell,\n pe_strEmail\n FROM biz_contacts\n INNER JOIN people_names ON bc_lContactID=pe_lKeyID\n WHERE NOT pe_bBiz\n AND NOT pe_bRetired\n AND NOT bc_bRetired\n {$strWhereExtra}\n GROUP BY pe_lKeyID\n ORDER BY\n pe_strLName, pe_strFName, pe_strMName, pe_lKeyID\n {$sqlLimitExtra};"; $query = $this->db->query($sqlStr); $this->lNumContactsNames = $numRows = $query->num_rows(); $this->contactsNames = array(); if ($numRows > 0) { $idx = 0; foreach ($query->result() as $row) { $this->contactsNames[$idx] = new stdClass(); $cRec =& $this->contactsNames[$idx]; $cRec->lPeopleID = $row->pe_lKeyID; $cRec->strFName = $strFName = $row->pe_strFName; $cRec->strLName = $strLName = $row->pe_strLName; $cRec->strMName = $strMName = $row->pe_strMName; $cRec->strTitle = $strTitle = $row->pe_strTitle; $cRec->strPreferred = $strPreferred = $row->pe_strPreferredName; $cRec->strSafeName = htmlspecialchars(strBuildName(false, $strTitle, $strPreferred, $strFName, $strLName, $strMName)); $cRec->strSafeNameLF = htmlspecialchars(strBuildName(true, $strTitle, $strPreferred, $strFName, $strLName, $strMName)); $cRec->strAddr1 = $row->pe_strAddr1; $cRec->strAddr2 = $row->pe_strAddr2; $cRec->strCity = $row->pe_strCity; $cRec->strState = $row->pe_strState; $cRec->strCountry = $row->pe_strCountry; $cRec->strZip = $row->pe_strZip; $cRec->strPhone = $row->pe_strPhone; $cRec->strCell = $row->pe_strCell; $cRec->strEmail = $row->pe_strEmail; $cRec->strEmailFormatted = strBuildEmailLink($cRec->strEmail, '', false, ''); $cRec->strAddress = strBuildAddress($cRec->strAddr1, $cRec->strAddr2, $cRec->strCity, $cRec->strState, $cRec->strCountry, $cRec->strZip, true); $cRec->biz = $this->bizViaContactPID($cRec->lPeopleID, $cRec->lNumBiz); ++$idx; } } }
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; } } }
public function sponsorInfoGenericViaWhere($strWhere, $strLimit) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- if ($this->strOrderBy == '') { $strOrder = 'tblPeopleSpon.pe_strLName, tblPeopleSpon.pe_strFName, tblPeopleSpon.pe_lKeyID, cr_strLName, cr_strFName, sp_lClientID, sp_lKeyID '; } else { $strOrder = $this->strOrderBy; } $sqlStr = "SELECT\n sp_lKeyID, sp_lClientID,\n sp_lForeignID, sp_lHonoreeID, sp_bInactive,\n sp_lSponsorProgramID, sp_lDefPayType, sp_curCommitment, sp_lCommitmentACO,\n aco_strFlag, aco_strCurrencySymbol, aco_strName,\n\n sp_dteStartMoYr, sp_dteInactive, sp_lInactiveCatID,\n\n sp_strTerminationNote, sp_bInactiveDueToXfer,\n listInactive.lgen_strListItem AS strSponTermType,\n\n tblPeopleSpon.pe_strLName AS strLName_Spon, tblPeopleSpon.pe_strFName AS strFName_Spon,\n tblPeopleSpon.pe_strMName AS strMName_Spon, tblPeopleSpon.pe_bRetired AS bSponRetired,\n tblPeopleSpon.pe_strAddr1 AS strSponAddr1, tblPeopleSpon.pe_strAddr2 AS strSponAddr2,\n tblPeopleSpon.pe_strCity AS strSponCity, tblPeopleSpon.pe_strState AS strSponState,\n tblPeopleSpon.pe_strZip AS strSponZip, tblPeopleSpon.pe_strCountry AS strSponCountry,\n tblPeopleSpon.pe_strEmail AS strSponEmail,\n tblPeopleSpon.pe_strPhone AS strSponPhone,\n tblPeopleSpon.pe_strCell AS strSponCell,\n tblPeopleSpon.pe_strPreferredName AS strSponPName, tblPeopleSpon.pe_strTitle AS strSponTitle,\n\n tblPeopleSpon.pe_bBiz AS bSponBiz,\n\n tblPeopleHon.pe_strLName AS strLName_Hon, tblPeopleHon.pe_strFName AS strFName_Hon,\n tblPeopleHon.pe_strMName AS strMName_Hon, tblPeopleHon.pe_bRetired AS bHonRetired,\n tblPeopleHon.pe_strAddr1 AS strHonAddr1, tblPeopleHon.pe_strAddr2 AS strHonAddr2,\n tblPeopleHon.pe_strCity AS strHonCity, tblPeopleHon.pe_strState AS strHonState,\n tblPeopleHon.pe_strZip AS strHonZip, tblPeopleHon.pe_strCountry AS strHonCountry,\n tblPeopleHon.pe_strEmail AS strHonEmail,\n tblPeopleHon.pe_strPhone AS strHonPhone,\n tblPeopleHon.pe_strCell AS strHonCell,\n tblPeopleHon.pe_strPreferredName AS strHonPName, tblPeopleHon.pe_strTitle AS strHonTitle,\n\n tblPeopleHon.pe_bBiz AS bHonBiz,\n\n sp_lAttributedTo,\n listAttrib.lgen_strListItem AS strAttributedTo,\n\n cr_strFName, cr_strLName, cr_dteBirth, cr_lLocationID,\n cr_enumGender,\n cl_strLocation, cl_strCountry,\n cr_bRetired,\n sc_strProgram,\n\n UNIX_TIMESTAMP(sp_dteOrigin) AS dteOrigin,\n UNIX_TIMESTAMP(sp_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 sponsor\n INNER JOIN people_names AS tblPeopleSpon ON sp_lForeignID = tblPeopleSpon.pe_lKeyID\n INNER JOIN admin_users AS uc ON uc.us_lKeyID=sp_lOriginID\n INNER JOIN admin_users AS ul ON ul.us_lKeyID=sp_lLastUpdateID\n INNER JOIN admin_aco ON aco_lKeyID = sp_lCommitmentACO\n LEFT JOIN people_names AS tblPeopleHon ON sp_lHonoreeID = tblPeopleHon.pe_lKeyID\n LEFT JOIN client_records ON cr_lKeyID = sp_lClientID\n LEFT JOIN client_location ON cr_lLocationID = cl_lKeyID\n LEFT JOIN lists_sponsorship_programs ON sp_lSponsorProgramID = sc_lKeyID\n LEFT JOIN lists_generic AS listInactive ON sp_lInactiveCatID = listInactive.lgen_lKeyID\n LEFT JOIN lists_generic AS listAttrib ON sp_lAttributedTo = listAttrib.lgen_lKeyID\n\n WHERE NOT sp_bRetired\n {$strWhere}\n ORDER BY {$strOrder}\n {$strLimit};"; $query = $this->db->query($sqlStr); $this->lNumSponsors = $numRows = $query->num_rows(); if ($numRows == 0) { $this->sponInfo[0] = new stdClass(); $sRec =& $this->sponInfo[0]; $sRec->lKeyID = $sRec->lForeignID = $sRec->strSponsorFName = $sRec->strSponsorMName = $sRec->strSponsorLName = $sRec->bSponBiz = $sRec->strSponSafeNameFL = $sRec->strSponSafeNameLF = $sRec->bPersonRetired = $sRec->bClientRetired = $sRec->bHonoreeRetired = $sRec->lHonoreeID = $sRec->strSponsorFNameHon = $sRec->strSponsorMNameHon = $sRec->strSponsorLNameHon = $sRec->bHonBiz = $sRec->strHonSafeNameFL = $sRec->strHonSafeNameLF = $sRec->strSFConID_Spon = $sRec->strSFConID_Hon = $sRec->lClientID = $sRec->lItemID = $sRec->lSponsorProgID = $sRec->strSponProgram = $sRec->lAttributedTo = $sRec->strAttributedTo = $sRec->strClientFName = $sRec->strClientLName = $sRec->strClientSafeNameFL = $sRec->strClientSafeNameLF = $sRec->dteClientBDayMySQL = $sRec->strGender = $sRec->strLocationName = $sRec->strLocationCountry = $sRec->dteStart = $sRec->bInactive = $sRec->dteInactive = $sRec->lInactiveCatID = $sRec->strInactiveCat = $sRec->bInactiveViaXfer = $sRec->lDefPaymentType = $sRec->curCommitment = $sRec->lCommitACO = $sRec->objClientBirth = $sRec->strAgeBDay = $sRec->dteOrigin = $sRec->dteLastUpdate = $sRec->ucstrFName = $sRec->ucstrLName = $sRec->ulstrFName = $sRec->ulstrLName = null; } else { $idx = 0; foreach ($query->result() as $row) { $this->sponInfo[$idx] = new stdClass(); $sRec =& $this->sponInfo[$idx]; $sRec->lKeyID = $row->sp_lKeyID; $sRec->lForeignID = $row->sp_lForeignID; $sRec->strSponsorFName = $row->strFName_Spon; $sRec->strSponsorMName = $row->strMName_Spon; $sRec->strSponsorLName = $row->strLName_Spon; $sRec->strSponsorPName = $row->strSponPName; $sRec->strSponTitle = $row->strSponTitle; $sRec->bSponBiz = $row->bSponBiz; if ($row->bSponBiz) { $sRec->strSponSafeNameFL = $sRec->strSponSafeNameLF = htmlspecialchars($sRec->strSponsorLName); } else { $sRec->strSponSafeNameFL = htmlspecialchars(strBuildName(false, $sRec->strSponTitle, $sRec->strSponsorPName, $sRec->strSponsorFName, $sRec->strSponsorLName, $sRec->strSponsorMName)); $sRec->strSponSafeNameLF = htmlspecialchars(strBuildName(true, $sRec->strSponTitle, $sRec->strSponsorPName, $sRec->strSponsorFName, $sRec->strSponsorLName, $sRec->strSponsorMName)); } $sRec->bPersonRetired = (bool) $row->bSponRetired; $sRec->bClientRetired = (bool) $row->cr_bRetired; $sRec->bHonoreeRetired = (bool) $row->bHonRetired; $sRec->lHonoreeID = $row->sp_lHonoreeID; $sRec->bHonoree = !is_null($row->sp_lHonoreeID); $sRec->strSponsorFNameHon = $row->strFName_Hon; $sRec->strSponsorMNameHon = $row->strMName_Hon; $sRec->strSponsorLNameHon = $row->strLName_Hon; $sRec->bHonBiz = $row->bHonBiz; $sRec->strHonPName = $row->strHonPName; $sRec->strHonTitle = $row->strHonTitle; if ($row->bHonBiz) { $sRec->strHonSafeNameFL = $sRec->strHonSafeNameLF = htmlspecialchars($sRec->strSponsorLName); } else { $sRec->strHonSafeNameFL = htmlspecialchars(strBuildName(false, $sRec->strHonTitle, $sRec->strHonPName, $sRec->strSponsorFNameHon, $sRec->strSponsorLNameHon, $sRec->strSponsorMNameHon)); // htmlspecialchars($sRec->strSponsorFNameHon.' ' .$sRec->strSponsorLNameHon); $sRec->strHonSafeNameLF = htmlspecialchars(strBuildName(true, $sRec->strHonTitle, $sRec->strHonPName, $sRec->strSponsorFNameHon, $sRec->strSponsorLNameHon, $sRec->strSponsorMNameHon)); // htmlspecialchars($sRec->strSponsorLNameHon.', '.$sRec->strSponsorFNameHon); } //------------------------------ // sponsor contact info //------------------------------ $sRec->strSponAddr1 = $row->strSponAddr1; $sRec->strSponAddr2 = $row->strSponAddr2; $sRec->strSponCity = $row->strSponCity; $sRec->strSponState = $row->strSponState; $sRec->strSponZip = $row->strSponZip; $sRec->strSponCountry = $row->strSponCountry; $sRec->strSponEmail = $row->strSponEmail; $sRec->strSponPhone = $row->strSponPhone; $sRec->strAddr = strBuildAddress($row->strSponAddr1, $row->strSponAddr2, $row->strSponCity, $row->strSponState, $row->strSponCountry, $row->strSponZip, true); //------------------------------ // honoree contact info //------------------------------ $sRec->strHonAddr1 = $row->strHonAddr1; $sRec->strHonAddr2 = $row->strHonAddr2; $sRec->strHonCity = $row->strHonCity; $sRec->strHonState = $row->strHonState; $sRec->strHonZip = $row->strHonZip; $sRec->strHonCountry = $row->strHonCountry; $sRec->strHonEmail = $row->strHonEmail; $sRec->strHonPhone = $row->strHonPhone; $sRec->lClientID = $row->sp_lClientID; $sRec->lSponsorProgID = $row->sp_lSponsorProgramID; $sRec->strSponProgram = $row->sc_strProgram; $sRec->lAttributedTo = $row->sp_lAttributedTo; $sRec->strAttributedTo = $row->strAttributedTo; $sRec->strClientFName = $row->cr_strFName . ''; $sRec->strClientLName = $row->cr_strLName . ''; if (is_null($sRec->lClientID)) { $sRec->strClientSafeNameFL = $sRec->strClientSafeNameLF = null; } else { $sRec->strClientSafeNameFL = htmlspecialchars($row->cr_strFName . ' ' . $row->cr_strLName); $sRec->strClientSafeNameLF = htmlspecialchars($row->cr_strLName . ', ' . $row->cr_strFName); } $sRec->dteClientBDayMySQL = $row->cr_dteBirth; $sRec->enumGender = $row->cr_enumGender; $sRec->strLocation = $row->cl_strLocation . ''; $sRec->strLocationCountry = $row->cl_strCountry . ''; $sRec->dteStart = dteMySQLDate2Unix($row->sp_dteStartMoYr); $sRec->bInactive = (bool) $row->sp_bInactive; $sRec->dteInactive = dteMySQLDate2Unix($row->sp_dteInactive); $sRec->lInactiveCatID = $row->sp_lInactiveCatID; $sRec->strSponTermType = $row->strSponTermType; $sRec->bInactiveViaXfer = (bool) $row->sp_bInactiveDueToXfer; $sRec->lDefPaymentType = $row->sp_lDefPayType; $sRec->curCommitment = $row->sp_curCommitment; $sRec->lCommitACO = $row->sp_lCommitmentACO; $sRec->strCommitACOFlagImg = '<img src="' . DL_IMAGEPATH . '/flags/' . $row->aco_strFlag . '" alt="flag icon" title="' . $row->aco_strName . '">'; $sRec->strCommitACOCurSym = $row->aco_strCurrencySymbol; $sRec->strCommitACOName = $row->aco_strName; //------------------------------ // client age/birth day info //------------------------------ if (is_null($sRec->dteClientBDayMySQL)) { $sRec->objClientBirth = null; $sRec->strClientAgeBDay = 'n/a'; } else { $sRec->objClientBirth = new dl_date_time(); $sRec->objClientBirth->setDateViaMySQL(0, $sRec->dteClientBDayMySQL); $sRec->strClientAgeBDay = $sRec->objClientBirth->strPeopleAge(0, $sRec->dteClientBDayMySQL, $lAgeYears); } $sRec->dteOrigin = $row->dteOrigin; $sRec->dteLastUpdate = $row->dteLastUpdate; $sRec->ucstrFName = $row->strUCFName; $sRec->ucstrLName = $row->strUCLName; $sRec->ulstrFName = $row->strULFName; $sRec->ulstrLName = $row->strULLName; ++$idx; } } }
public function loadVolRecs() { //----------------------------------------------------------------------- // //----------------------------------------------------------------------- $this->volRecs = array(); if ($this->strOrderExtra . '' == '') { $this->strOrderExtra = ' ORDER BY vol_strLName, vol_strFName, vol_strMName, vol_lKeyID '; } $sqlStr = "SELECT\n vol_lKeyID, vol_lChapterID, ch_strChapterName,\n userAcct.us_lKeyID AS lAcctID, vol_bInactive,\n vol_strNotes, vol_bRetired, vol_lOriginID, vol_lLastUpdateID,\n UNIX_TIMESTAMP(vol_dteInactive) AS dteInactive,\n\n vol_strLName, vol_strFName,\n vol_strMName, vol_bRetired,\n vol_strPreferredName, vol_strTitle,\n vol_strAddr1, vol_strAddr2,\n vol_strCity, vol_strState,\n vol_strZip, vol_strCountry,\n vol_strEmail, vol_strPhone, vol_strCell,\n vol_dteBirthDate,\n\n vol_lAttributedTo, Attrib.lgen_strListItem AS strAttrib,\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 admin_chapters ON ch_lKeyID = vol_lChapterID\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 lists_generic AS Attrib ON vol_lAttributedTo = Attrib.lgen_lKeyID\n LEFT JOIN admin_users AS userAcct ON vol_lKeyID = userAcct.us_lVolID\n\n WHERE\n NOT vol_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->strNotes = $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->lAcctID = (int) $row->lAcctID; $vRec->lChapterID = (int) $row->vol_lChapterID; $vRec->strChapterName = $row->ch_strChapterName; $vRec->bInactive = (bool) $row->vol_bInactive; $vRec->bActive = !$vRec->bInactive; $vRec->strNotes = $row->vol_strNotes; $vRec->dteInactive = $row->dteInactive; $vRec->strLName = $strLName = $row->vol_strLName; $vRec->strFName = $strFName = $row->vol_strFName; $vRec->strMName = $strMName = $row->vol_strMName; $vRec->strTitle = $strTitle = $row->vol_strTitle; $vRec->strPreferred = $strPreferred = $row->vol_strPreferredName; $vRec->strSafeName = $vRec->strSafeNameFL = htmlspecialchars(strBuildName(false, $strTitle, $strPreferred, $strFName, $strLName, $strMName)); $vRec->strSafeNameLF = htmlspecialchars(strBuildName(true, $strTitle, $strPreferred, $strFName, $strLName, $strMName)); $vRec->bRetired = (bool) $row->vol_bRetired; $vRec->strAddr1 = $row->vol_strAddr1; $vRec->strAddr2 = $row->vol_strAddr2; $vRec->strCity = $row->vol_strCity; $vRec->strState = $row->vol_strState; $vRec->strZip = $row->vol_strZip; $vRec->strCountry = $row->vol_strCountry; $vRec->strEmail = $strEmail = $row->vol_strEmail; $vRec->strEmailFormatted = strBuildEmailLink($strEmail, '', false, ''); $vRec->strNotes = $row->vol_strNotes; $vRec->mdteBirthDate = $row->vol_dteBirthDate; $vRec->strPhone = $row->vol_strPhone; $vRec->strCell = $row->vol_strCell; $vRec->strAddress = strBuildAddress($vRec->strAddr1, $vRec->strAddr2, $vRec->strCity, $vRec->strState, $vRec->strCountry, $vRec->strZip, true); $vRec->lAttributedTo = $row->vol_lAttributedTo; $vRec->strAttrib = $row->strAttrib; $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; } } }
function showPeopleInfo(&$clsRpt, $lPID, &$people, $vol, &$clsDateTime) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $gbDateFormatUS, $glclsDTDateFormat, $genumDateFormat, $gbVolLogin; if (!$gbVolLogin) { if ($vol->bVol) { $strVol = strLinkView_Volunteer($vol->lVolID, 'View volunteer record', true) . ' '; if ($vol->bInactive) { $strVol .= '<i>Inactive since ' . date($genumDateFormat, $vol->dteInactive); } else { $strVol .= 'Active ' . strLinkView_Volunteer($vol->lVolID, '(view)', false); } } else { $strVol = 'Not a volunteer ' . strLinkAdd_VolFromPeople($lPID, 'Add as volunteer', true) . ' ' . strLinkAdd_VolFromPeople($lPID, 'Add as volunteer', false); } } if ($people->strPreferredName != $people->strFName && $people->strPreferredName != '') { $strPreferred = ' (' . $people->strPreferredName . ')'; } else { $strPreferred = ''; } $strName = strBuildName(false, $people->strTitle, $people->strPreferredName, $people->strFName, $people->strLName, $people->strMName); if ($gbVolLogin) { openBlock('Contact Info', strLinkEdit_PeopleContact('', 'Edit your contact information', true) . ' ' . strLinkEdit_PeopleContact('', 'Edit your contact information', false)); } else { openBlock('Contact Info', strLinkEdit_PeopleContact($lPID, 'Edit this person\'s contact information', true) . ' ' . strLinkRem_People($lPID, 'Remove this person\'s record', true, true)); } echoT($clsRpt->openReport(600)); //------------------------ // People ID //------------------------ echoT($clsRpt->openRow() . $clsRpt->writeLabel('People ID:') . $clsRpt->writeCell(str_pad($lPID, 5, '0', STR_PAD_LEFT)) . $clsRpt->closeRow()); //------------------------ // Name //------------------------ echoT($clsRpt->openRow() . $clsRpt->writeLabel('Name:') . $clsRpt->writeCell(htmlspecialchars($strName)) . $clsRpt->closeRow()); //------------------------ // Household //------------------------ if (!$gbVolLogin) { echoT($clsRpt->openRow() . $clsRpt->writeLabel('Household:') . $clsRpt->writeCell(strLinkView_Household($people->lHouseholdID, $lPID, 'View Household', true) . ' ' . htmlspecialchars($people->strHouseholdName)) . $clsRpt->closeRow()); } //------------------------ // Birthdate //------------------------ if (is_null($people->dteMysqlBirthDate)) { $strBDay = ' '; } else { $strBDay = $clsDateTime->strPeopleAge(0, $people->dteMysqlBirthDate, $lAgeYears, $glclsDTDateFormat); } echoT($clsRpt->openRow() . $clsRpt->writeLabel('Birthdate:') . $clsRpt->writeCell($strBDay) . $clsRpt->closeRow()); //------------------------ // Gender //------------------------ echoT($clsRpt->openRow() . $clsRpt->writeLabel('Gender:') . $clsRpt->writeCell($people->enumGender) . $clsRpt->closeRow()); //------------------------ // Address //------------------------ echoT($clsRpt->openRow() . $clsRpt->writeLabel('Address:') . $clsRpt->writeCell($people->strAddress) . $clsRpt->closeRow()); //------------------------ // Phone //------------------------ echoT($clsRpt->openRow() . $clsRpt->writeLabel('Phone:') . $clsRpt->writeCell(htmlspecialchars(strPhoneCell($people->strPhone, $people->strCell))) . $clsRpt->closeRow()); //------------------------ // Accounting Country //------------------------ if (!$gbVolLogin) { echoT($clsRpt->openRow() . $clsRpt->writeLabel('Accounting Country:') . $clsRpt->writeCell($people->strFlagImage . ' ' . $people->strCurSymbol) . $clsRpt->closeRow()); } //------------------------ // Email //------------------------ if ($gbVolLogin) { echoT($clsRpt->openRow() . $clsRpt->writeLabel('Email:') . $clsRpt->writeCell(htmlspecialchars($people->strEmail)) . $clsRpt->closeRow()); } else { echoT($clsRpt->openRow() . $clsRpt->writeLabel('Email:') . $clsRpt->writeCell($people->strEmailFormatted) . $clsRpt->closeRow()); } //------------------------ // Volunteer Status //------------------------ if (!$gbVolLogin) { echoT($clsRpt->openRow() . $clsRpt->writeLabel('Volunteer Status:') . $clsRpt->writeCell($strVol) . $clsRpt->closeRow()); } //------------------ // Attributed To //------------------ if (!$gbVolLogin) { echoT($clsRpt->openRow() . $clsRpt->writeLabel('Attributed To:') . $clsRpt->writeCell(htmlspecialchars($people->strAttrib)) . $clsRpt->closeRow()); } //------------------ // Notes //------------------ if (!$gbVolLogin) { echoT($clsRpt->openRow() . $clsRpt->writeLabel('Notes:') . $clsRpt->writeCell(nl2br(htmlspecialchars($people->strNotes))) . $clsRpt->closeRow()); } echoT($clsRpt->closeReport()); closeBlock(); }
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; } } }
function loadPeople($bIncludeSpon, $bIncludeGiftSum, $bPeople) { //------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ $clsACO = new madmin_aco(); $this->people = array(); if ($bIncludeSpon) { $clsSpon = new msponsorship(); } $sqlStr = "SELECT\n pe_lKeyID,\n pe_lHouseholdID, pe_strTitle, pe_strFName,\n pe_strMName, pe_strLName, pe_strPreferredName,\n pe_strSalutation, pe_strAddr1, pe_strAddr2,\n pe_strCity, pe_strState, pe_strCountry,\n pe_strZip, pe_strPhone, pe_strCell, pe_strEmail,\n pe_enumGender, pe_strNotes, pe_bNoGiftAcknowledge,\n pe_lAttributedTo, pe_strImportID,\n pe_lOriginID, pe_lLastUpdateID,\n tblAttrib.lgen_strListItem AS strAttrib,\n\n pe_lACO, aco_strFlag, aco_strName, aco_strCurrencySymbol,\n\n pe_dteBirthDate,\n pe_dteDeathDate,\n usersC.us_strFirstName AS strCFName, usersC.us_strLastName AS strCLName,\n usersL.us_strFirstName AS strLFName, usersL.us_strLastName AS strLLName,\n pe_dteExpire,\n UNIX_TIMESTAMP(pe_dteOrigin) AS dteOrigin,\n UNIX_TIMESTAMP(pe_dteLastUpdate) AS dteLastUpdate\n FROM people_names\n INNER JOIN admin_users AS usersC ON pe_lOriginID = usersC.us_lKeyID\n INNER JOIN admin_users AS usersL ON pe_lLastUpdateID= usersL.us_lKeyID\n INNER JOIN admin_aco ON pe_lACO = aco_lKeyID\n {$this->sqlInnerExtra}\n LEFT JOIN lists_generic AS tblAttrib ON pe_lAttributedTo=tblAttrib.lgen_lKeyID\n\n WHERE 1\n {$this->sqlWhereExtra}\n AND " . ($bPeople ? 'NOT ' : '') . "pe_bBiz\n AND NOT pe_bRetired\n {$this->sqlOrderExtra}\n {$this->sqlLimitExtra};"; $query = $this->db->query($sqlStr); $this->lNumPeople = $query->num_rows(); if ($this->lNumPeople == 0) { $this->people[0] = new stdClass(); $pRec =& $this->people[0]; $pRec->lKeyID = $pRec->lHouseholdID = $pRec->bHOH = $pRec->strHouseholdName = $pRec->strTitle = $pRec->strFName = $pRec->strMName = $pRec->strLName = $pRec->strPreferredName = $pRec->strSafeName = $pRec->strSafeNameLF = null; $pRec->strSalutation = $pRec->strAddr1 = $pRec->strAddr2 = $pRec->strCity = $pRec->strState = $pRec->strCountry = $pRec->strZip = $pRec->strPhone = $pRec->strCell = $pRec->strAddress = null; $pRec->strEmail = $pRec->strEmailFormatted = $pRec->enumGender = $pRec->lACO = $pRec->strACO = $pRec->strCurSymbol = $pRec->strFlag = $pRec->strFlagImage = $pRec->bNoGiftAcknowledge = $pRec->lAttributedTo = $pRec->strAttrib = $pRec->lImportID = $pRec->strImportRecID = $pRec->dteExpire = $pRec->lOriginID = $pRec->lLastUpdateID = $pRec->dteMysqlBirthDate = $pRec->dteMysqlDeath = $pRec->dteOrigin = $pRec->dteLastUpdate = $pRec->strStaffCFName = $pRec->strStaffCLName = $pRec->strStaffLFName = $pRec->strStaffLLName = null; } else { $idx = 0; if ($bIncludeGiftSum) { $clsGifts = new mdonations(); $clsGifts->bUseDateRange = false; $clsGifts->cumulativeOpts = new stdClass(); $clsGifts->cumulativeOpts->enumCumulativeSource = 'people'; } foreach ($query->result() as $row) { $this->people[$idx] = new stdClass(); $pRec =& $this->people[$idx]; $pRec->lKeyID = $lPID = $row->pe_lKeyID; $pRec->lHouseholdID = $lHID = $row->pe_lHouseholdID; $pRec->bHOH = $lHID == $lPID; $pRec->strHouseholdName = $this->strHouseholdNameViaHID($lHID); $pRec->strTitle = $strTitle = $row->pe_strTitle; $pRec->strFName = $strFName = $row->pe_strFName; $pRec->strMName = $strMName = $row->pe_strMName; $pRec->strLName = $strLName = $row->pe_strLName; $pRec->strPreferredName = $strPreferred = $row->pe_strPreferredName; $pRec->strSafeName = htmlspecialchars(strBuildName(false, $strTitle, $strPreferred, $strFName, $strLName, $strMName)); $pRec->strSafeNameLF = htmlspecialchars(strBuildName(true, $strTitle, $strPreferred, $strFName, $strLName, $strMName)); $pRec->strSalutation = $row->pe_strSalutation; $pRec->strAddr1 = $row->pe_strAddr1; $pRec->strAddr2 = $row->pe_strAddr2; $pRec->strCity = $row->pe_strCity; $pRec->strState = $row->pe_strState; $pRec->strCountry = $row->pe_strCountry; $pRec->strZip = $row->pe_strZip; $pRec->strPhone = $row->pe_strPhone; $pRec->strCell = $row->pe_strCell; $pRec->strAddress = strBuildAddress($pRec->strAddr1, $pRec->strAddr2, $pRec->strCity, $pRec->strState, $pRec->strCountry, $pRec->strZip, true); $pRec->strEmail = $row->pe_strEmail; $pRec->strEmailFormatted = strBuildEmailLink($pRec->strEmail, '', false, ''); $pRec->enumGender = $row->pe_enumGender; $pRec->lACO = $row->pe_lACO; $pRec->strACO = $row->aco_strName; $pRec->strCurSymbol = $row->aco_strCurrencySymbol; $pRec->strFlag = $row->aco_strFlag; $pRec->strFlagImage = $clsACO->strFlagImage($pRec->strFlag, $pRec->strACO); $pRec->bNoGiftAcknowledge = $row->pe_bNoGiftAcknowledge; $pRec->lAttributedTo = $row->pe_lAttributedTo; $pRec->strAttrib = $row->strAttrib; $pRec->lImportID = $row->pe_strImportID; $pRec->strImportRecID = $row->pe_strImportID; $pRec->dteExpire = dteMySQLDate2Unix($row->pe_dteExpire); $pRec->lOriginID = $row->pe_lOriginID; $pRec->lLastUpdateID = $row->pe_lLastUpdateID; $pRec->dteMysqlBirthDate = $row->pe_dteBirthDate; $pRec->dteMysqlDeath = $row->pe_dteDeathDate; $pRec->strNotes = $row->pe_strNotes; $pRec->dteOrigin = $row->dteOrigin; $pRec->dteLastUpdate = $row->dteLastUpdate; $pRec->strStaffCFName = $row->strCFName; $pRec->strStaffCLName = $row->strCLName; $pRec->strStaffLFName = $row->strLFName; $pRec->strStaffLLName = $row->strLLName; //------------------- // sponsorship //------------------- if ($bIncludeSpon) { $clsSpon->sponsorshipInfoViaPID($lPID); $pRec->lNumSponsorship = $lNumSpons = $clsSpon->lNumSponsors; if ($lNumSpons == 0) { $pRec->sponInfo = null; } else { $pRec->sponInfo = $clsSpon->sponInfo; } } //------------------- // cumulative gifts //------------------- if ($bIncludeGiftSum) { $clsGifts->lPeopleID = $lPID; $clsGifts->cumulativeOpts->enumMoneySet = 'all'; $clsGifts->cumulativeOpts->bSoft = false; $clsGifts->cumulativeDonation($clsACO, $pRec->lTotHardGifts); $pRec->lNumACODonationGroups_hard = $clsGifts->lNumCumulative; $pRec->donationsViaACO_hard = $clsGifts->cumulative; $clsGifts->cumulativeOpts->bSoft = true; $clsGifts->cumulativeDonation($clsACO, $pRec->lTotSoftGifts); $pRec->lNumACODonationGroups_soft = $clsGifts->lNumCumulative; $pRec->donationsViaACO_soft = $clsGifts->cumulative; } else { $pRec->lNumACODonationGroups_hard = $pRec->donationsViaACO_hard = $pRec->lNumACODonationGroups_soft = $pRec->donationsViaACO_soft = null; } ++$idx; } } }