private function loadImgDocInfoViaContext($enumContext, $imgDoc, $row)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $genumDateFormat, $glChapterID;
     $lFID = (int) $imgDoc->lForeignID;
     switch ($enumContext) {
         case CENUM_CONTEXT_CLIENT:
             $imgDoc->strNameLabel = 'Client';
             $imgDoc->strName = strLinkView_ClientRecord($lFID, 'View Client Record', true) . '&nbsp;' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;<b>' . htmlspecialchars($row->cr_strLName . ', ' . $row->cr_strFName) . '</b>';
             $imgDoc->strAddressLabel = 'Address';
             $imgDoc->strAddr = strBuildAddress($row->cr_strAddr1, $row->cr_strAddr2, $row->cr_strCity, $row->cr_strState, $row->cr_strCountry, $row->cr_strZip, true);
             $strPhone = strPhoneCell($row->cr_strPhone, $row->cr_strCell);
             if ($strPhone != '') {
                 $imgDoc->strAddr .= '<br>' . $strPhone;
             }
             break;
         case CENUM_CONTEXT_PEOPLE:
             $imgDoc->strNameLabel = 'Name';
             $imgDoc->strName = strLinkView_PeopleRecord($lFID, 'View People Record', true) . '&nbsp;' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;<b>' . htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName) . '</b>';
             $imgDoc->strAddressLabel = 'Address';
             $imgDoc->strAddr = strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true);
             $strPhone = strPhoneCell($row->pe_strPhone, $row->pe_strCell);
             if ($strPhone != '') {
                 $imgDoc->strAddr .= '<br>' . $strPhone;
             }
             break;
         case CENUM_CONTEXT_LOCATION:
             $imgDoc->strNameLabel = 'Client Location';
             $imgDoc->strName = strLinkView_ClientLocation($lFID, 'View client location', true) . '&nbsp;' . htmlspecialchars($row->cl_strLocation);
             break;
         case CENUM_CONTEXT_GRANTPROVIDER:
             $imgDoc->strNameLabel = 'Funder/Provider';
             $imgDoc->strName = strLinkView_GrantProvider($lFID, 'View funder/provider', true) . '&nbsp;' . htmlspecialchars($row->gpr_strGrantOrg);
             break;
         case CENUM_CONTEXT_INVITEM:
             $imgDoc->strNameLabel = 'Inventory Item';
             $imgDoc->strName = strLinkView_InventoryItem($lFID, 'View inventory item', true) . '&nbsp;' . htmlspecialchars($row->ivi_strItemName);
             break;
         case CENUM_CONTEXT_AUCTION:
             $imgDoc->strNameLabel = 'Silent Auction';
             $imgDoc->strName = strLinkView_AuctionRecord($lFID, 'View Auction', true) . '&nbsp;' . htmlspecialchars($row->auc_strAuctionName) . ' (' . date($genumDateFormat, dteMySQLDate2Unix($row->auc_dteAuctionDate)) . ')';
             break;
         case CENUM_CONTEXT_AUCTIONITEM:
             $imgDoc->strNameLabel = 'Auction Item';
             $imgDoc->strName = strLinkView_AuctionItem($lFID, 'View Auction Item', true) . '&nbsp;' . 'item: ' . htmlspecialchars($row->ait_strItemName) . '<br>package: ' . htmlspecialchars($row->ap_strPackageName) . '<br>auction: ' . htmlspecialchars($row->auc_strAuctionName);
             break;
         case CENUM_CONTEXT_AUCTIONPACKAGE:
             $imgDoc->strNameLabel = 'Auction Package';
             $imgDoc->strName = strLinkView_AuctionPackageRecord($lFID, 'View Auction Package', true) . '&nbsp;' . 'package: ' . htmlspecialchars($row->ap_strPackageName) . '<br>auction: ' . htmlspecialchars($row->auc_strAuctionName);
             break;
         case CENUM_CONTEXT_BIZ:
             $imgDoc->strNameLabel = 'Business/Organization Name';
             $imgDoc->strName = strLinkView_BizRecord($lFID, 'View Business/Organization Record', true) . '&nbsp;' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;<b>' . htmlspecialchars($row->pe_strLName) . '</b>';
             $imgDoc->strAddressLabel = 'Address';
             $imgDoc->strAddr = strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true);
             $strPhone = strPhoneCell($row->pe_strPhone, $row->pe_strCell);
             if ($strPhone != '') {
                 $imgDoc->strAddr .= '<br>' . $strPhone;
             }
             break;
         case CENUM_CONTEXT_SPONSORSHIP:
             $bBiz = (bool) $row->pe_bBiz;
             if ($bBiz) {
                 $imgDoc->strNameLabel = 'Sponsor (Business/organization)';
                 $imgDoc->strName = strLinkView_PeopleRecord($lFID, 'View People Record', true) . '&nbsp;' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;<b>' . htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName) . '</b>';
             } else {
                 $imgDoc->strNameLabel = 'Sponsor (Individual)';
                 $imgDoc->strName = strLinkView_BizRecord($lFID, 'View Business/Organization Record', true) . '&nbsp;' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;<b>' . htmlspecialchars($row->pe_strLName) . '</b>';
             }
             $imgDoc->strAddressLabel = 'Address';
             $imgDoc->strAddr = strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true);
             $strPhone = strPhoneCell($row->pe_strPhone, $row->pe_strCell);
             if ($strPhone != '') {
                 $imgDoc->strAddr .= '<br>' . $strPhone;
             }
             break;
         case CENUM_CONTEXT_ORGANIZATION:
             $imgDoc->strNameLabel = 'Your organization';
             $imgDoc->strName = strLinkView_OrganizationRecord($lFID, 'View organization record', true) . '&nbsp;' . htmlspecialchars($row->ch_strChapterName);
             break;
         case CENUM_CONTEXT_STAFF:
             $imgDoc->strNameLabel = 'Staff Member';
             $imgDoc->strName = strLinkView_User($lFID, 'View staff member record', true) . '&nbsp;' . htmlspecialchars($row->strFirstName . ' ' . $row->strLastName);
             break;
         case CENUM_CONTEXT_VOLUNTEER:
             $imgDoc->strNameLabel = 'Name';
             $imgDoc->strName = strLinkView_Volunteer($lFID, 'View Volunteer Record', true) . '&nbsp;' . str_pad($lFID, 6, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;<b>' . htmlspecialchars($row->pe_strLName . ', ' . $row->pe_strFName) . '</b>';
             $imgDoc->strAddressLabel = 'Address';
             $imgDoc->strAddr = strBuildAddress($row->pe_strAddr1, $row->pe_strAddr2, $row->pe_strCity, $row->pe_strState, $row->pe_strCountry, $row->pe_strZip, true);
             $strPhone = strPhoneCell($row->pe_strPhone, $row->pe_strCell);
             if ($strPhone != '') {
                 $imgDoc->strAddr .= '<br>' . $strPhone;
             }
             break;
         default:
             screamForHelp($enumContext . ': image context not currently implemented<br>error on line  <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
             break;
     }
 }
function contextNameLink($enumType, $lForeignID, &$strContextName, &$strContextLink)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $CI =& get_instance();
    $strContextLink = str_pad($lForeignID, 5, '0', STR_PAD_LEFT);
    switch ($enumType) {
        case CENUM_CONTEXT_PEOPLE:
            $CI->clsPeople->loadPeopleViaPIDs($lForeignID, false, false);
            $strContextName = $CI->clsPeople->people[0]->strFName . ' ' . $CI->clsPeople->people[0]->strLName;
            $strContextLink .= strLinkView_PeopleRecord($lForeignID, 'View people record', true);
            break;
        case CENUM_CONTEXT_CLIENT:
            $CI->clsClients->loadClientsViaClientID($lForeignID);
            $strContextName = $CI->clsClients->clients[0]->strFName . ' ' . $CI->clsClients->clients[0]->strLName;
            $strContextLink .= strLinkView_ClientRecord($lForeignID, 'View client record', true);
            break;
        case CENUM_CONTEXT_GIFT:
            $CI->clsGifts->loadGiftViaGID($lForeignID);
            $strContextName = 'Donation by ' . $CI->clsGifts->gifts[0]->strSafeName;
            $strContextLink .= strLinkView_GiftsRecord($lForeignID, 'View gift record', true);
            break;
        case CENUM_CONTEXT_BIZ:
            $CI->clsBiz->loadBizRecsViaBID($lForeignID);
            $strContextName = $CI->clsBiz->bizRecs[0]->strSafeName;
            $strContextLink .= strLinkView_BizRecord($lForeignID, 'View business record', true);
            break;
        case CENUM_CONTEXT_SPONSORSHIP:
            $CI->clsSpon->sponsorInfoViaID($lForeignID);
            $strContextName = 'Sponsor ' . $CI->clsSpon->sponInfo[0]->strSponSafeNameFL;
            $strContextLink .= strLinkView_Sponsorship($lForeignID, 'View sponsorship record', true);
            break;
        case CENUM_CONTEXT_VOLUNTEER:
            $CI->clsVol->loadVolRecsViaVolID($lForeignID, true);
            $strContextName = $CI->clsVol->volRecs[0]->strSafeNameFL;
            $strContextLink .= strLinkView_Volunteer($lForeignID, 'View volunteer record', true);
            break;
        case CENUM_CONTEXT_LOCATION:
            $CI->clsLoc->loadLocationRec($lForeignID);
            $strContextName = $CI->clsLoc->strLocation;
            $strContextLink .= strLinkView_ClientLocation($lForeignID, 'View client location record', true);
            break;
        case CENUM_CONTEXT_ORGANIZATION:
            $CI->clsLoc->loadLocationRec($lForeignID);
            $strContextName = $CI->clsChapter->chapterRec->strSafeChapterName;
            $strContextLink .= strLinkView_OrganizationRecord($lForeignID, 'View your organization record', true);
            break;
        default:
            screamForHelp($enumType . ': feature not available yet<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
            break;
    }
}
 public function strClientLocationHTMLSummary()
 {
     //-----------------------------------------------------------------------
     // assumes user has called $this->loadLocationRec($id)
     //-----------------------------------------------------------------------
     $strOut = '';
     $params = array('enumStyle' => 'terse');
     $clsRpt = new generic_rpt($params);
     $clsRpt->setEntrySummary();
     $lLocID = $this->lKeyID;
     $strOut .= $clsRpt->openReport('', '');
     $strOut .= $clsRpt->openRow(false) . $clsRpt->writeLabel('Location ID:') . $clsRpt->writeCell(strLinkView_ClientLocation($lLocID, 'View Client Location Record', true) . ' ' . str_pad($lLocID, 5, '0', STR_PAD_LEFT)) . $clsRpt->closeRow() . $clsRpt->openRow(false) . $clsRpt->writeLabel('Location:') . $clsRpt->writeCell(htmlspecialchars($this->strLocation)) . $clsRpt->closeRow();
     $strOut .= $clsRpt->openRow(false) . $clsRpt->writeLabel('Country:') . $clsRpt->writeCell(htmlspecialchars($this->strCountry)) . $clsRpt->closeRow();
     $strOut .= $clsRpt->openRow(false) . $clsRpt->writeLabel('Allow Medical Recs:') . $clsRpt->writeCell($this->bEnableEMR ? 'Yes' : 'No') . $clsRpt->closeRow();
     $strOut .= $clsRpt->closeReport('<br>');
     return $strOut;
 }
         </td>
         <td class="enpRptLabel">
           Allow<br>Medical Recs
         </td>
      </tr>
<?php 
foreach ($locations as $clsLoc) {
    $lCLID = $clsLoc->lKeyID;
    if ($clsLoc->lNumberClients > 0) {
        $strLinkRemove = strCantDelete('Location can\'t be removed until all clients are transfered');
    } else {
        $strLinkRemove = strLinkRem_ClientLocation($lCLID, 'Remove client location', true, true);
    }
    echoT('
              <tr class="makeStripe">
                 <td class="enpRpt" style="text-align: center; width: 60pt;">' . strLinkView_ClientLocation($lCLID, 'View client location', true, 'id="cLocView_' . $lCLID . '"') . ' ' . str_pad($lCLID, 5, '0', STR_PAD_LEFT) . '
                 </td>
                 <td class="enpRpt" style="text-align: center; width: 18pt;">' . $strLinkRemove . '
                 </td>
                 <td class="enpRpt" style=" width: 160pt;"><b>' . htmlspecialchars($clsLoc->strLocation) . '</b><br>');
    echoT($clsLoc->strSponProg);
    $lNumSponsors = $clsLoc->lNumSponsors;
    if ($lNumSponsors > 0) {
        $strLinkSpon = strLinkView_SponsorsViaLocProg($lCLID, 'View sponsors for this location', true);
    } else {
        $strLinkSpon = '&nbsp;&nbsp;';
    }
    echoT('
                 </td>
                 <td class="enpRpt" style=" width: 160pt;">' . strBuildAddress($clsLoc->strAddress1, $clsLoc->strAddress2, $clsLoc->strCity, $clsLoc->strState, $clsLoc->strCountry, $clsLoc->strPostalCode, true) . '
                 </td>