function __construct() { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- parent::__construct(); }
public function removeClient($lClientID) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $glUserID; $sqlStr = "UPDATE client_records\n SET\n cr_lLastUpdateID = {$glUserID},\n cr_bRetired = 1\n WHERE cr_lKeyID={$lClientID};"; $query = $this->db->query($sqlStr); // remove group membership $clsGroups = new mgroups(); $clsGroups->removeMemFromAllGroups(CENUM_CONTEXT_CLIENT, $lClientID); // delete client entries in personalized tables $uf = new muser_fields(); $uf->deleteForeignViaUFTableType(CENUM_CONTEXT_CLIENT, $lClientID); $uf->deleteForeignViaUFTableType(CENUM_CONTEXT_CPROGENROLL, $lClientID); $uf->deleteForeignViaUFTableType(CENUM_CONTEXT_CPROGATTEND, $lClientID); $uf->deleteForeignViaUFTableType(CENUM_CONTEXT_CPREPOST, $lClientID); }
function loadClientPrograms($bShowHidden = true) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $cUF = new muser_fields(); $cperms = new mpermissions(); if ($bShowHidden) { $strHidden = ''; } else { $strHidden = ' AND NOT cp_bHidden '; } if ($this->sqlOrder == '') { $strOrder = ' cp_strProgramName, cp_lKeyID '; } else { $strOrder = $this->sqlOrder; } $sqlStr = "SELECT\n cp_lKeyID, cp_strProgramName, cp_strDescription,\n cp_strVocEnroll, cp_strVocAttendance,\n cp_lEnrollmentTableID, cp_lAttendanceTableID, cp_lActivityFieldID,\n cp_dteStart, cp_dteEnd,\n cp_bMentorMentee,\n\n cp_strE_VerificationModule, cp_strE_VModEntryPoint,\n cp_strA_VerificationModule, cp_strA_VModEntryPoint,\n\n ute.pft_bReadOnly AS bETableReadOnly,\n uta.pft_bReadOnly AS bATableReadOnly,\n\n cp_bHidden, cp_bRetired,\n cp_lOriginID, cp_lLastUpdateID,\n\n UNIX_TIMESTAMP(cp_dteOrigin) AS dteOrigin,\n UNIX_TIMESTAMP(cp_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 cprograms\n INNER JOIN uf_tables AS ute ON ute.pft_lKeyID = cp_lEnrollmentTableID\n INNER JOIN uf_tables AS uta ON uta.pft_lKeyID = cp_lAttendanceTableID\n INNER JOIN admin_users AS uc ON uc.us_lKeyID=cp_lOriginID\n INNER JOIN admin_users AS ul ON ul.us_lKeyID=cp_lLastUpdateID\n\n WHERE NOT cp_bRetired {$this->sqlWhere} {$strHidden}\n ORDER BY {$strOrder};"; $query = $this->db->query($sqlStr); $this->lNumCProgs = $numRows = $query->num_rows(); $this->cprogs = array(); if ($numRows == 0) { $this->cprogs[0] = new stdClass(); $cprog =& $this->cprogs[0]; $cprog->lKeyID = $cprog->strProgramName = $cprog->strEnrollmentLabel = $cprog->strAttendanceLabel = $cprog->strSafeEnrollLabel = $cprog->strSafeAttendLabel = $cprog->bETableReadOnly = $cprog->bATableReadOnly = $cprog->strE_VerificationModule = $cprog->strE_VModEntryPoint = $cprog->strA_VerificationModule = $cprog->strA_VModEntryPoint = $cprog->strDescription = $cprog->dteMysqlStart = $cprog->dteMysqlEnd = $cprog->dteStart = $cprog->dteEnd = $cprog->bHidden = $cprog->lEnrollmentTableID = $cprog->lAttendanceTableID = $cprog->lActivityFieldID = $cprog->strActivityFN = $cprog->bMentorMentee = $cprog->lOriginID = $cprog->lLastUpdateID = $cprog->dteOrigin = $cprog->dteLastUpdate = $cprog->ucstrFName = $cprog->ucstrLName = $cprog->ulstrFName = $cprog->ulstrLName = null; } else { $idx = 0; foreach ($query->result() as $row) { $this->cprogs[$idx] = new stdClass(); $cprog =& $this->cprogs[$idx]; $cprog->lKeyID = $lCProgID = (int) $row->cp_lKeyID; $cprog->strProgramName = $row->cp_strProgramName; $cprog->strEnrollmentLabel = $row->cp_strVocEnroll; $cprog->strAttendanceLabel = $row->cp_strVocAttendance; $cprog->strSafeEnrollLabel = htmlspecialchars($row->cp_strVocEnroll); $cprog->strSafeAttendLabel = htmlspecialchars($row->cp_strVocAttendance); $cprog->bETableReadOnly = (bool) $row->bETableReadOnly; $cprog->bATableReadOnly = (bool) $row->bATableReadOnly; $cprog->strE_VerificationModule = $row->cp_strE_VerificationModule; $cprog->strE_VModEntryPoint = $row->cp_strE_VModEntryPoint; $cprog->strA_VerificationModule = $row->cp_strA_VerificationModule; $cprog->strA_VModEntryPoint = $row->cp_strA_VModEntryPoint; $cprog->strDescription = $row->cp_strDescription; $cprog->dteMysqlStart = $row->cp_dteStart; $cprog->dteMysqlEnd = $row->cp_dteEnd; $cprog->dteStart = dteMySQLDate2Unix($row->cp_dteStart); $cprog->dteEnd = dteMySQLDate2Unix($row->cp_dteEnd); $cprog->bHidden = (bool) $row->cp_bHidden; $cprog->lEnrollmentTableID = (int) $row->cp_lEnrollmentTableID; $cprog->lAttendanceTableID = $lATableID = (int) $row->cp_lAttendanceTableID; $cprog->strEnrollmentTable = $cUF->strGenUF_TableName($cprog->lEnrollmentTableID); $cprog->strETableFNPrefix = $cUF->strGenUF_KeyFieldPrefix($cprog->lEnrollmentTableID); $cprog->strAttendanceTable = $cUF->strGenUF_TableName($cprog->lAttendanceTableID); $cprog->strATableFNPrefix = $cUF->strGenUF_KeyFieldPrefix($cprog->lAttendanceTableID); $cprog->lActivityFieldID = $lActivityFieldID = (int) $row->cp_lActivityFieldID; $cprog->strActivityFN = $this->strActivityDDLFN($lATableID, $lActivityFieldID); $cprog->bMentorMentee = (bool) $row->cp_bMentorMentee; $cprog->lOriginID = (int) $row->cp_lOriginID; $cprog->lLastUpdateID = (int) $row->cp_lLastUpdateID; $cprog->dteOrigin = (int) $row->dteOrigin; $cprog->dteLastUpdate = (int) $row->dteLastUpdate; $cprog->ucstrFName = $row->strUCFName; $cprog->ucstrLName = $row->strUCLName; $cprog->ulstrFName = $row->strULFName; $cprog->ulstrLName = $row->strULLName; // user-group permissions for this program $cprog->lNumPerms = $cperms->lGroupPerms($lCProgID, CENUM_CONTEXT_CPROGRAM, $cprog->perms); ++$idx; } } }
public function retireSingleSponsorship($lSponID, &$lGroupID) { //--------------------------------------------------------------------- // $lGroupID is the recyle bin group id; set to null if deleting // a single gift //--------------------------------------------------------------------- global $glUserID; $sqlStr = "UPDATE sponsor\n SET\n sp_bRetired=1,\n sp_lLastUpdateID={$glUserID}\n WHERE sp_lKeyID={$lSponID};"; $this->db->query($sqlStr); $this->logSponsorshipRetire($lSponID, $lGroupID); // remove UF table entries $uf = new muser_fields(); $uf->deleteForeignViaUFTableType(CENUM_CONTEXT_SPONSORSHIP, $lSponID); }
function bVerifyUserAccessToReport($report, &$lNumFails, &$failTables) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $glUserID, $gbAdmin; $lNumFails = 0; $failTables = array(); if ($gbAdmin) { return true; } $lReportID = $report->lKeyID; // load search terms $this->loadSearchTermViaReportID($lReportID); // load sort terms $this->loadSortFieldsViaReportID($lReportID, $lNumSortTerms, $sortTerms); $this->uf = new muser_fields(); // tables needed for the report crptTables\tablesUsed($report, $this->terms, $sortTerms, $tableIDs); if (count($tableIDs) == 0) { return true; } $cperm = new mpermissions(); $cperm->loadUserAcctInfo($glUserID, $acctAccess); $cUF = new muser_fields(); $cUF->lTableID = array(); foreach ($tableIDs as $TID) { $cUF->lTableID[] = $TID; } $cUF->loadTableViaTableID(false); foreach ($cUF->userTables as $utable) { if (!$cperm->bDoesUserHaveAccess($acctAccess, $utable->lNumConsolidated, $utable->cperms)) { $failTables[$lNumFails] = '[' . $utable->enumTType . '] ' . $utable->strUserTableName; ++$lNumFails; } } return $lNumFails == 0; }
public function strExportUserTable($lTableID) { $cUF = new muser_fields(); $cUF->lTableID = $lTableID; $cUF->loadTableViaTableID(); $lNumFields = $cUF->lNumUF_TableFields($lTableID); if ($lNumFields == 0) { return ''; } $cUF->loadTableFields(); $enumTType = $cUF->userTables[0]->enumTType; $strTmpTable = 'tmpUFExport'; $sqlStr = $this->strCreateTempTableUFExport($cUF->fields, $strTmpTable, $sqlDelete, $strFieldNamesSel); $this->db->query($sqlDelete); $this->db->query($sqlStr); //------------------------------------------------ // populate the temp table with personalized data //------------------------------------------------ $this->strPopulateUFTempData($cUF, $lTableID, $strTmpTable, $enumTType, $cUF->fields); //--------------------------- // tie it all together //--------------------------- $sqlStr = $this->strTmpTableJoinedToContext($enumTType, $strTmpTable, $strFieldNamesSel, 'tmp_lForeignID', true, '', ''); $query = $this->db->query($sqlStr); return $this->dbutil->csv_from_result($query); }
function setDDLOptions(&$term, $field) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $term->ddlCompare = array(); $term->ddlCompare[0] = new stdClass(); $term->ddlCompare[0]->name = CS_SRCH_EQ; $term->ddlCompare[0]->bSel = $term->lCompareOpt == CL_SRCH_EQ; $term->ddlCompare[0]->optVal = CL_SRCH_EQ; $term->ddlCompare[1] = new stdClass(); $term->ddlCompare[1]->name = CS_SRCH_NEQ; $term->ddlCompare[1]->bSel = $term->lCompareOpt == CL_SRCH_NEQ; $term->ddlCompare[1]->optVal = CL_SRCH_NEQ; // load ddl entries $cddl = new muser_fields(); $cddl->loadDDLEntries($field->lFieldID); $term->lNumDDLEntries = $lNumEntries = $cddl->clsDDL_Info->lNumEntries; $term->ddlEntries = arrayCopy($cddl->clsDDL_Info->clsEntries); }
public function retireSingleGift($lGiftID, $lGroupID) { //--------------------------------------------------------------------- // $lGroupID is the recyle bin group id; set to null if deleting // a single gift //--------------------------------------------------------------------- global $glUserID; $sqlStr = "UPDATE gifts\n SET\n gi_bRetired=1,\n gi_lLastUpdateID={$glUserID}\n WHERE gi_lKeyID={$lGiftID};"; $this->db->query($sqlStr); // if this is a silent auction donation, // remove gift ID $sqlStr = "UPDATE gifts_auctions_packages\n SET\n ap_lGiftID = NULL,\n ap_lLastUpdateID = {$glUserID}\n WHERE ap_lGiftID = {$lGiftID};"; $this->db->query($sqlStr); $uf = new muser_fields(); $uf->deleteForeignViaUFTableType(CENUM_CONTEXT_GIFT, $lGiftID); $this->logGiftRetire($lGiftID, $lGroupID); }
public function removePersonBiz($bBiz = false) { //----------------------------------------------------------------------- // caller must first set // $this->lPeopleID (set to bizID if business) // // note that both businesses and people are removed from this routine //----------------------------------------------------------------------- global $glUserID; if (is_null($this->lPeopleID)) { screamForHelp('PEOPLE ID NOT SET!<br>error on <b>line:</b> ' . __LINE__ . '<br><b>file: </b>' . __FILE__ . '<br><b>function: </b>' . __FUNCTION__); } $lPID = $this->lPeopleID; $sqlStr = "UPDATE people_names\n SET\n pe_bRetired=1,\n pe_lLastUpdateID={$glUserID}\n WHERE pe_lKeyID={$lPID};"; $this->db->query($sqlStr); $lGroupID = null; $this->logPeopleRetire($lGroupID); //----------------------------- // remove associated gifts //----------------------------- $clsGifts = new mdonations(); $clsGifts->retireGiftsViaPID($lPID, $lGroupID); //--------------------------------- // remove associated sponsorships //--------------------------------- $clsSpon = new msponsorship(); $clsSpon->retireSponsorshipsViaPID($lPID, $lGroupID); //--------------------------------- // remove business contacts //--------------------------------- $clsBiz = new mbiz(); $clsBiz->lPID = $lPID; $clsBiz->deleteBizContact(false, true, false, $lGroupID); //--------------------------------- // remove group membership //--------------------------------- $clsGroups = new mgroups(); $clsGroups->removeMemFromAllGroups($bBiz ? CENUM_CONTEXT_BIZ : CENUM_CONTEXT_PEOPLE, $lPID); // delete people/biz entries in personalized tables $uf = new muser_fields(); $uf->deleteForeignViaUFTableType(CENUM_CONTEXT_PEOPLE, $lPID); $uf->deleteForeignViaUFTableType(CENUM_CONTEXT_BIZ, $lPID); $uf->deleteForeignViaUFTableType(CENUM_CONTEXT_VOLUNTEER, $lPID); }
function strComparitor(&$term) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $gbDateFormatUS; switch ($term->enumFieldType) { case CS_FT_CHECKBOX: $strOut = $term->bCompareBool ? CS_SRCH_CHK_YES : CS_SRCH_CHK_NO; break; case CS_FT_ID: case CS_FT_INTEGER: $strOut = number_format($term->lCompVal); break; case CS_FT_CURRENCY: $strOut = $term->ACO->strFlagImg . ' ' . number_format($term->curCompVal, 2); break; case CS_FT_DDL: case CS_FT_DDLMULTI: $cuf = new muser_fields(); $strOut = '"' . htmlspecialchars($cuf->strDDLValue($term->lCompVal)) . '"'; break; case CS_FT_DDL_SPECIAL: $strOut = '"' . htmlspecialchars(sddl\loadSpecialDDLValue($term->strFieldID, $term->strCompVal)) . '"'; break; case CS_FT_DATE: $strOut = strNumericDateViaMysqlDate($term->mdteCompVal, $gbDateFormatUS); break; case CS_FT_TEXTLONG: case CS_FT_TEXT255: case CS_FT_TEXT80: case CS_FT_TEXT20: case CS_FT_TEXT: $strOut = '"' . htmlspecialchars($term->strCompVal) . '"'; break; default: screamForHelp($term->enumFieldType . ': unsupported field type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } return $strOut; }