function loadTimeZones() { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $sqlStr = 'SELECT tz_lKeyID, tz_strTimeZone, tz_lTZ_Const, tz_bTopList FROM lists_tz WHERE 1 ORDER BY tz_bTopList DESC, tz_lKeyID;'; $query = $this->db->query($sqlStr); $this->lNumTZ = $numRows = $query->num_rows(); if ($numRows == 0) { echo '<font face="monospace" style="font-size: 8pt;">' . __FILE__ . ' Line: <b>' . __LINE__ . ":</b><br><b>\$sqlStr=</b><br>" . nl2br(htmlspecialchars($sqlStr)) . "<br><br></font>\n"; screamForHelp('UNEXPECTED EOF - Time Zone Table: <br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } else { $idx = 0; foreach ($query->result() as $row) { $this->tz[$idx] = new stdClass(); $tzl =& $this->tz[$idx]; $tzl->lKeyID = (int) $row->tz_lKeyID; $tzl->strTimeZone = $row->tz_strTimeZone; $tzl->lTZ_Const = (int) $row->tz_lTZ_Const; $tzl->bTopList = (bool) $row->tz_bTopList; ++$idx; } } }
function load_cprogGeneric($lCProgID, $strCProgName, $bViaID) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $this->ccprog = new mcprograms(); if ($bViaID) { $this->ccprog->loadClientProgramsViaCPID($lCProgID); } else { $this->ccprog->loadClientProgramsViaProgramName($strCProgName); } if ($this->ccprog->lNumCProgs == 0) { screamForHelp($lCProgID . '/' . $strCProgName . ': unable to load client program<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } $this->cprog =& $this->ccprog->cprogs[0]; $this->lCProgID = $lCProgID = $this->cprog->lKeyID; $this->strProgramName = $strCProgName = $this->cprog->strProgramName; $this->lEnrollmentTableID = $this->cprog->lEnrollmentTableID; $this->lAttendanceTableID = $this->cprog->lAttendanceTableID; $this->strATableFNPrefix = $this->cprog->strATableFNPrefix; $this->strETableFNPrefix = $this->cprog->strETableFNPrefix; $this->strEnrollmentTable = $this->cprog->strEnrollmentTable; $this->strAttendanceTable = $this->cprog->strAttendanceTable; $this->lActivityFieldID = $this->cprog->lActivityFieldID; $this->strActivityFN = $this->cprog->strActivityFN; $this->cschema = new muser_schema(); // Enrollment table schema $this->cschema->loadUFSchemaSingleTable($this->lEnrollmentTableID); $this->etable =& $this->cschema->schema[$this->lEnrollmentTableID]; // Attendance table schema $this->cschema->loadUFSchemaSingleTable($this->lAttendanceTableID); $this->atable =& $this->cschema->schema[$this->lAttendanceTableID]; }
public function clientsAvailableForSponsorship() { //----------------------------------------------------------------------- // two client groups to consider: // clients with no sponsors // clients with sponsors (discarding inactive sponsorships) //----------------------------------------------------------------------- if (is_null($this->lSponProgID)) { screamForHelp('CLASS NOT INITIALIZED $this->lSponProgID<br>error on <b>line:</b> ' . __LINE__ . '<br><b>file: </b>' . __FILE__ . '<br><b>function: </b>' . __FUNCTION__); } $this->lNumAvail = 0; $this->lAvailList = array(); //---------------------------------------------------------- // find all clients with status that allows sponsorship // (optionally qualified by program); must have // max sponsorship > 0 //---------------------------------------------------------- $this->clientsEligibleViaStatus($this->lSponProgID, $lClientList, $lMaxSpon, $lNumEligibleClients); for ($idx = 0; $idx < $lNumEligibleClients; ++$idx) { $lClientID = $lClientList[$idx]; if ($this->lNumSponsorsViaClientID($lClientID) < $lMaxSpon[$idx]) { $this->lAvailList[$this->lNumAvail] = $lClientID; ++$this->lNumAvail; } } }
function ddl2sqlSpecial($field, &$strSelect, &$strJoin) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $strSelect = $strJoin = ''; if ($field->enumType != CS_FT_DDL_SPECIAL) { return; } switch ($field->strUserFN) { case 'Location': $strJoin = 'INNER JOIN client_location on cl_lKeyID=cr_lLocationID'; $strSelect = 'cl_strLocation AS `Client:Location`'; break; case 'Status Category': $strJoin = 'INNER JOIN client_status_cats on csc_lKeyID=cr_lStatusCatID'; $strSelect = 'csc_strCatName AS `Client:Status Category`'; break; case 'Vocabulary': $strJoin = 'LEFT JOIN lists_client_vocab ON cr_lVocID = cv_lKeyID'; $strSelect = 'cv_strVocTitle AS `Client:Vocabulary`'; break; default: screamForHelp($field->strUserFN . ': client special ddl type not available<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } }
function payerList($lSponID) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- if (!bTestForURLHack('showSponsorFinancials')) { return; } $this->load->helper('dl_util/verify_id'); verifyID($this, $lSponID, 'sponsor ID'); $displayData = array(); $displayData['lSponID'] = $lSponID = (int) $lSponID; //------------------------------------------------ // libraries and utilities //------------------------------------------------ $this->load->library('util/dl_date_time', '', 'clsDateTime'); $this->load->model('sponsorship/msponsorship', 'clsSpon'); $this->clsSpon->sponsorInfoViaID($lSponID); $enumPayType = $_REQUEST['rdoSP']; switch ($enumPayType) { case 'sponsor': redirect('sponsors/payments/addEditPayment/' . $lSponID . '/' . $this->clsSpon->sponInfo[0]->lForeignID . '/0'); break; case 'person': $this->searchSponPay($lSponID, $_REQUEST['txtSPP'], true, $this->clsSpon); break; case 'biz': $this->searchSponPay($lSponID, $_REQUEST['txtSPB'], false, $this->clsSpon); break; default: screamForHelp($enumPayType . ': UNRECOGNIZED PROCESSING OPTION</b><br>error on <b>line:</b> ' . __LINE__ . '<br><b>file:</b> ' . __FILE__ . '<br><b>function:</b> ' . __FUNCTION__); break; } }
public function lNumVols($enumType) { //--------------------------------------------------------------------- // $enumType: active / inactive / all //--------------------------------------------------------------------- switch ($enumType) { case 'active': $strWhere = 'AND NOT vol_bInactive '; break; case 'inactive': $strWhere = 'AND vol_bInactive '; break; case 'all': $strWhere = ''; break; default: screamForHelp($enumType . ': invalid type<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } $sqlStr = "SELECT COUNT(*) AS lNumVols\n FROM `volunteers`\n INNER JOIN people_names ON `vol_lPeopleID`=pe_lKeyID\n WHERE\n NOT `vol_bRetired`\n AND NOT pe_bRetired\n {$strWhere};"; $query = $this->db->query($sqlStr); if ($query->num_rows() == 0) { return 0; } else { $row = $query->row(); return (int) $row->lNumVols; } }
function consolidateDup($enumContext, $lGoodID, $dupIDs) { //--------------------------------------------------------------------- // note: currently group membership is not transferred //--------------------------------------------------------------------- $strInDupIDs = ' IN (' . implode(', ', $dupIDs) . ') '; $this->imgDoc = new mimage_doc(); switch ($enumContext) { case CENUM_CONTEXT_CLIENT: $enumAttachTypes = array(CENUM_CONTEXT_CLIENT, CENUM_CONTEXT_CPROGENROLL, CENUM_CONTEXT_CPROGATTEND); $this->uschema->loadUFSchemaViaAttachType($enumAttachTypes); $this->consolidateDupClients($lGoodID, $strInDupIDs, $dupIDs); break; case CENUM_CONTEXT_PEOPLE: $enumAttachTypes = array(CENUM_CONTEXT_PEOPLE); $this->uschema->loadUFSchemaViaAttachType($enumAttachTypes); $this->consolidateDupPeople($lGoodID, $strInDupIDs, $dupIDs); break; case CENUM_CONTEXT_BIZ: $enumAttachTypes = array(CENUM_CONTEXT_BIZ); $this->uschema->loadUFSchemaViaAttachType($enumAttachTypes); $this->consolidateDupBiz($lGoodID, $strInDupIDs, $dupIDs); break; default: screamForHelp($enumContext . ': invalid context for duplicate record consolidation<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } }
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; } }
function loadACOViaFieldID($lFieldID) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $sqlStr = "SELECT pff_lCurrencyACO\n FROM uf_fields\n WHERE pff_lKeyID={$lFieldID}"; $query = $this->db->query($sqlStr); $numRows = $query->num_rows(); if ($numRows == 0) { screamForHelp($lFieldID . ': invalid field ID<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } $row = $query->row(); $this->loadCountries(false, true, true, (int) $row->pff_lCurrencyACO); }
function parseAjaxCampaign($strType, $lAcctID) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- switch ($strType) { case 'loadViaAcctID': $this->buildCampaignXMLViaAcctID((int) $lAcctID); break; default: screamForHelp($strType . ': INVALID PROCESSING OPTIONS</b><br>error on <b>line:</b> ' . __LINE__ . '<br><b>file:</b> ' . __FILE__ . '<br><b>function:</b> ' . __FUNCTION__); break; } }
function strCustomFormsPageTitle($enumType) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- switch ($enumType) { case CENUM_CONTEXT_CLIENT: $strPageTitle = anchor('main/menu/admin', 'Admin', 'class="breadcrumb"') . ' | Custom Forms/Clients'; break; default: screamForHelp($enumType . ': Custom forms not available nyet.<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } return $strPageTitle; }
function showExtraOpts($clsGF, $enumFieldType, $opts) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- switch ($enumFieldType) { case CS_FT_CHECKBOX: showCheckboxOpts($opts->bCheckDef); break; case CS_FT_DATE: case CS_FT_DATETIME: showDateTimeOpts($opts); break; case CS_FT_TEXT255: showTextOpts($clsGF, $opts->strTxtDef, 255); break; case CS_FT_TEXT80: showTextOpts($clsGF, $opts->strTxtDef, 80); break; case CS_FT_TEXT20: showTextOpts($clsGF, $opts->strTxtDef, 20); break; case CS_FT_TEXTLONG: break; case CS_FT_CLIENTID: break; case CS_FT_HEADING: break; case CS_FT_INTEGER: showIntegerOpts($opts->lDef); break; case CS_FT_CURRENCY: showCurrencyOpts($opts->curDef, $opts->lCurrencyACO); break; case CS_FT_DDL: case CS_FT_DDLMULTI: showDDLOpts($opts); break; case CS_FT_LOG: showLogOpts($opts); break; default: screamForHelp($enumFieldType . ': Invalid field type<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } }
function lNumPeopleRecsViaLetter($strDirLetter, $enumRecType, $bIncludeInactive = false, $strWhereExtra = '') { //--------------------------------------------------------------------- // $bIncludeInactive applies to volunteers // // $enumRecType: 'biz' 'bizContact' 'people' 'volunteer' //--------------------------------------------------------------------- $strWhereName = strNameWhereClauseViaLetter('pe_strLName', $strDirLetter); $CI =& get_instance(); switch ($enumRecType) { case CENUM_CONTEXT_BIZ: $sqlStr = "SELECT\n COUNT(*) AS lNumRecs\n FROM people_names\n WHERE 1\n {$strWhereName} {$strWhereExtra}\n AND (NOT pe_bRetired)\n AND pe_bBiz;"; break; case CENUM_CONTEXT_BIZCONTACT: $sqlStr = "SELECT COUNT(*) AS lNumRecs\n FROM people_names\n INNER JOIN biz_contacts ON pe_lKeyID=bc_lContactID\n WHERE NOT pe_bBiz\n AND NOT pe_bRetired\n AND NOT bc_bRetired\n {$strWhereName} {$strWhereExtra}\n GROUP BY pe_lKeyID;"; break; case CENUM_CONTEXT_HOUSEHOLD: $sqlStr = "SELECT\n COUNT(*) AS lNumRecs\n FROM people_names\n WHERE 1\n {$strWhereName} {$strWhereExtra}\n AND pe_lHouseholdID=pe_lKeyID\n AND (NOT pe_bRetired)\n AND NOT pe_bBiz;"; break; case CENUM_CONTEXT_PEOPLE: $sqlStr = "SELECT\n COUNT(*) AS lNumRecs\n FROM people_names\n WHERE 1\n {$strWhereName} {$strWhereExtra}\n AND (NOT pe_bRetired)\n AND NOT pe_bBiz;"; break; case CENUM_CONTEXT_VOLUNTEER: if (!$bIncludeInactive) { $strWhereName .= ' AND NOT vol_bInactive '; } $sqlStr = "SELECT\n COUNT(*) AS lNumRecs\n FROM people_names\n INNER JOIN volunteers on pe_lKeyID=vol_lPeopleID\n WHERE 1\n {$strWhereName} {$strWhereExtra}\n AND (NOT pe_bRetired)\n AND NOT pe_bBiz;"; break; default: screamForHelp($enumRecType . ': invalid rec type<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } $query = $CI->db->query($sqlStr); $numRows = $query->num_rows(); if ($enumRecType == CENUM_CONTEXT_BIZCONTACT) { return $numRows; } else { if ($numRows == 0) { return 0; } else { $row = $query->row(); return $row->lNumRecs; } } }
function addStatRptViaField($utableSchema, $lTableID, $fieldInfo, $strFNSIClientID, &$fieldRptInfo, &$idx) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $fieldRptInfo[$idx] = new stdClass(); $strSITable = $utableSchema->schema[$lTableID]->strDataTableName; $fieldRptInfo[$idx]->strLabel = $fieldInfo->strFieldNameUser; switch ($fieldInfo->enumFieldType) { case CS_FT_CHECKBOX: $fieldRptInfo[$idx]->rptType = 'yesNo'; $fieldRptInfo[$idx]->bLeftAlign = false; $this->checkboxEnumerator($strSITable, $strFNSIClientID, $fieldInfo->strFieldNameInternal, $fieldRptInfo[$idx]->lNumYes); break; case CS_FT_DDL: $fieldRptInfo[$idx]->rptType = 'ddl'; $fieldRptInfo[$idx]->bLeftAlign = true; $this->ddlEnumerator($strSITable, $strFNSIClientID, $fieldInfo->strFieldNameInternal, $fieldRptInfo[$idx]->lNumGroups, $fieldRptInfo[$idx]->lTot, $fieldRptInfo[$idx]->enumGroups); break; case CS_FT_DDLMULTI: $fieldRptInfo[$idx]->rptType = 'multiDDL'; $fieldRptInfo[$idx]->bLeftAlign = true; $this->multiDDLEnumerator($utableSchema, $lTableID, $strSITable, $strFNSIClientID, $fieldInfo->lFieldID, $fieldRptInfo[$idx]->multiDDL); break; case CS_FT_INTEGER: $fieldRptInfo[$idx]->rptType = 'intCnt'; $fieldRptInfo[$idx]->bLeftAlign = true; $this->intCountEnumerator($strSITable, $strFNSIClientID, $fieldInfo->strFieldNameInternal, $fieldRptInfo[$idx]->lMin, $fieldRptInfo[$idx]->lMax, $fieldRptInfo[$idx]->sngAvg, $fieldRptInfo[$idx]->sngStdDev); break; case CS_FT_TEXT255: case CS_FT_TEXT80: case CS_FT_TEXT20: case CS_FT_TEXTLONG: case CS_FT_TEXT: case CS_FT_DATE: case CS_FT_HEADING: --$idx; break; default: screamForHelp($fieldInfo->enumFieldType . ': invalid field type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } ++$idx; }
public function loadClientVocabulary($bLoadViaVocID, $bSortByProtected) { //--------------------------------------------------------------------- // return all personalized vocabulary //--------------------------------------------------------------------- if ($bLoadViaVocID) { if (is_null($this->lVocID)) { screamForHelp('UNINITIALIZED CLASS<br></b>error on <b>line: </b>' . __LINE__ . '<br><b>file:</b> ' . __FILE__ . '<br><b>function:</b> ' . __FUNCTION__); } } $sqlStr = 'SELECT cv_lKeyID, cv_strVocTitle, cv_strVocClientS, cv_strVocClientP, cv_strVocSponsorS, cv_strVocSponsorP, cv_strVocLocS, cv_strVocLocP, cv_strVocSubLocS, cv_strVocSubLocP, cv_bProtected, cv_bRetired FROM lists_client_vocab WHERE 1 ' . ($bLoadViaVocID ? " AND cv_lKeyID={$this->lVocID} " : '') . ' ORDER BY ' . ($bSortByProtected ? ' cv_bProtected DESC, ' : '') . ' cv_strVocTitle, cv_lKeyID;'; $query = $this->db->query($sqlStr); $this->lNumVocs = $numRows = $query->num_rows(); if ($numRows == 0) { $this->initVoc(); } else { $idx = 0; $this->vocs = array(); foreach ($query->result() as $row) { $this->vocs[$idx] = new stdClass(); $this->vocs[$idx]->lKeyID = (int) $row->cv_lKeyID; $this->vocs[$idx]->strVocTitle = $row->cv_strVocTitle; $this->vocs[$idx]->strLocS = $row->cv_strVocLocS; $this->vocs[$idx]->strLocP = $row->cv_strVocLocP; $this->vocs[$idx]->strClientS = $row->cv_strVocClientS; $this->vocs[$idx]->strClientP = $row->cv_strVocClientP; $this->vocs[$idx]->strSponsorS = $row->cv_strVocSponsorS; $this->vocs[$idx]->strSponsorP = $row->cv_strVocSponsorP; $this->vocs[$idx]->strSubLocS = $row->cv_strVocSubLocS; $this->vocs[$idx]->strSubLocP = $row->cv_strVocSubLocP; $this->vocs[$idx]->bProtected = (bool) $row->cv_bProtected; $this->vocs[$idx]->bRetired = (bool) $row->cv_bRetired; ++$idx; } } }
public function bVerifyUniqueText($strTestText, $strTxtFN, $lKeyExclude, $strKeyFN, $bExcludeRetired, $strRetiredFN, $bQualSubGroup1, $lKeySubGroup1, $strSubGroupFN_1, $bQualSubGroup2, $lKeySubGroup2, $strSubGroupFN_2, $strTableName) { //--------------------------------------------------------------------- // return true if the text entry is not already in the database. // Inputs: // $strTestText - text to test against // $strTxtFN - field name of the text field // $lKeyExclude - exclusion key value (if testing for uniqueness but want to exclude // the current entry (for updates)) // $strKeyFN - the field name of the key // $bExcludeRetired - if true, exclude retired table entries from the test // $strRetiredFN - field name of retired entry flag (assumed to be boolean) // $strTableName - the database table name // // $bQualSubGroup1/2, $lKeySubGroup1/2, $strSubGroupFN_1/2 // - if true, qualify the search to records that have matching // key values //--------------------------------------------------------------------- $strQual1 = $strQual2 = ''; if ($bQualSubGroup1) { if (is_numeric($lKeySubGroup1)) { $strQual1 = "AND ({$strSubGroupFN_1} = {$lKeySubGroup1}) "; } else { $strQual1 = "AND ({$strSubGroupFN_1} = " . strPrepStr($lKeySubGroup1) . ') '; } } if ($bQualSubGroup2) { if (is_numeric($lKeySubGroup2)) { $strQual2 = "AND ({$strSubGroupFN_2} = {$lKeySubGroup2}) "; } else { $strQual2 = "AND ({$strSubGroupFN_2} = " . strPrepStr($lKeySubGroup2) . ') '; } } $sqlStr = "SELECT count({$strKeyFN}) as lNumMatch\n FROM {$strTableName}\n WHERE ucase({$strTxtFN})=" . strPrepStr(strtoupper($strTestText)) . "\n AND {$strKeyFN}<>{$lKeyExclude}\n {$strQual1}\n {$strQual2} " . ($bExcludeRetired ? "AND ({$strRetiredFN}=0) " : '') . ';'; $query = $this->db->query($sqlStr); if ($query->num_rows() == 0) { screamForHelp('Unexpected SQL error - forms/util/util_VerifyUnique.php/bVerifyUniqueText'); } else { $row = $query->row(); return $row->lNumMatch == 0; } }
function parentTableFieldInfo($fields) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- if (count($fields) == 0) { return; } foreach ($fields as $field) { if ($field->lTableID < 0) { switch ($field->lTableID) { case CL_STID_CLIENT: populateClientField($field); break; default: screamForHelp($field->lTableID . ': parent table type not available yet<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } } } }
function lAddLogEntry($bSuccess, $strUserName) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- if ($bSuccess) { if (is_null($this->el_lUserID)) { screamForHelp('UNITIALIZED CLASS</b><br>error on <b>line:</b> ' . __LINE__ . '<br><b>file:</b> ' . __FILE__ . '<br><b>function:</b> ' . __FUNCTION__); } } $sqlStr = 'INSERT INTO admin_usage_log SET el_lUserID = ' . strDBValueConvert_INT($this->el_lUserID) . ', el_str_Remote_Addr = ' . strPrepStr(@$_SERVER['REMOTE_ADDR']) . ', el_strUserName = '******', el_bLoginSuccessful= ' . ($bSuccess ? '1' : '0') . ', el_str_Remote_Host = ' . strPrepStr(@$_SERVER['REMOTE_HOST']) . ', el_str_Remote_Port = ' . strPrepStr(@$_SERVER['REMOTE_PORT']) . ';'; $query = $this->db->query($sqlStr); return $this->db->insert_id(); }
function strPageTitle($enumPageType, $lFIDs) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $strOut = ''; switch ($enumPageType) { case 'reminderBiz': $strOut = anchor('main/menu/biz', 'Businesses/Organizations', 'class="breadcrumb"') . ' | ' . anchor('biz/biz_record/view/' . $lFIDs[0], 'Record', 'class="breadcrumb"') . ' | Reminders'; break; case 'reminderPeople': $strOut = anchor('main/menu/people', 'People', 'class="breadcrumb"') . ' | ' . anchor('people/people_record/view/' . $lFIDs[0], 'Record', 'class="breadcrumb"') . ' | Reminders'; break; case 'reminderPeopleGift': $strOut = anchor('main/menu/people', 'People', 'class="breadcrumb"') . ' | ' . anchor('people/people_record/view/' . $lFIDs[1], 'Record', 'class="breadcrumb"') . ' | ' . anchor('donations/gift_record/view/' . $lFIDs[0], 'Gift Record', 'class="breadcrumb"') . ' | Reminders'; break; case 'reminderRecordPeople': $strOut = anchor('main/menu/people', 'People', 'class="breadcrumb"') . ' | ' . anchor('people/people_record/view/' . $lFIDs[0], 'Record', 'class="breadcrumb"') . ' | Reminders'; break; case 'reminderSponsor': $strOut = anchor('main/menu/sponsorship', 'Sponsorship', 'class="breadcrumb"') . ' | ' . anchor('sponsors/view_spon_rec/viewViaSponID/' . $lFIDs[0], 'Sponsorship Record', 'class="breadcrumb"') . ' | Reminders'; break; case 'reminderRecordPeopleGift': $strOut = anchor('main/menu/people', 'People', 'class="breadcrumb"') . ' | ' . anchor('people/people_record/view/' . $lFIDs[1], 'Record', 'class="breadcrumb"') . ' | ' . anchor('donations/gift_record/view/' . $lFIDs[0], 'Gift Record', 'class="breadcrumb"') . ' | Reminders'; break; case 'reminderRecordBizGift': $strOut = anchor('main/menu/biz', 'Businesses/Organizations', 'class="breadcrumb"') . ' | ' . anchor('biz/biz_record/view/' . $lFIDs[1], 'Record', 'class="breadcrumb"') . ' | ' . anchor('donations/gift_record/view/' . $lFIDs[0], 'Gift Record', 'class="breadcrumb"') . ' | Reminders'; break; case 'reminderClient': $strOut = anchor('main/menu/client', 'Clients', 'class="breadcrumb"') . ' | ' . anchor('clients/client_record/view/' . $lFIDs[0], 'Client Record', 'class="breadcrumb"') . ' | Reminders'; break; case 'reminderRecordUser': $strOut = 'Reminders'; break; default: screamForHelp($enumPageType . ': Invalide Page Type</b><br>error on <b>line:</b> ' . __LINE__ . '<br><b>file:</b> ' . __FILE__ . '<br><b>function:</b> ' . __FUNCTION__); break; } return $strOut; }
function lLogInCountsViaUserRole($enumRole, $sqlWhereExtra) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- switch ($enumRole) { case 'SuperUser': $strRoleFN = 'us_bSuperUser'; break; case 'VolMgr': $strRoleFN = 'us_bUserVolManager'; break; case 'Vol': $strRoleFN = 'us_bVolAccount'; break; default: screamForHelp($enumRole . ': invalid user role<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } $sqlStr = "SELECT COUNT(*) AS lNumRecs\n FROM admin_usage_log\n INNER JOIN admin_users ON el_lUserID=us_lKeyID\n WHERE el_bLoginSuccessful AND {$strRoleFN} {$sqlWhereExtra};"; $query = $this->db->query($sqlStr); $row = $query->row(); return (int) $row->lNumRecs; }
function bizOrPeopleViaFID($lFID, &$bBiz, &$clsPeople, &$clsBiz, &$strSafeName) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $CI =& get_instance(); $sqlStr = "SELECT pe_bBiz\n FROM people_names\n WHERE pe_lKeyID={$lFID}\n AND NOT pe_bRetired;"; $query = $CI->db->query($sqlStr); $numRows = $query->num_rows(); if ($numRows == 0) { screamForHelpSQL($sqlStr); screamForHelp('Unexpected EOF<br></b>error on <b>line:</b> ' . __LINE__ . '<br><b>file:</b> ' . __FILE__ . '<br><b>function:</b> ' . __FUNCTION__); } else { $row = $query->row(); $bBiz = (bool) $row->pe_bBiz; if ($bBiz) { $clsBiz->loadBizRecsViaBID($lFID); $strSafeName = $clsBiz->bizRecs[0]->strSafeName; } else { $clsPeople->loadPeopleViaPIDs($lFID, false, false); $strSafeName = $clsPeople->people[0]->strSafeName; } } }
function loadFieldTypes_pTable($utable) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $glUserID; // prepare the ddl and mddl verification $this->load->model('util/mlist_generic', 'clsList'); $idx = 0; foreach ($utable->fields as $field) { if ($field->enumFieldType == CS_FT_DDL || $field->enumFieldType == CS_FT_DDLMULTI) { $this->clsImport->initGenericListTable($idx, CENUM_LISTTYPE_USERTABLE, $this->clsList, $field->lFieldID); ++$idx; } } $this->clsImport->forceSet = array(); $this->clsImport->strImportTable = $utable->strDataTableName; $strFP = $utable->strFieldPrefix; $bMulti = $utable->bMultiEntry; $enumAttach = $utable->enumAttachType; $this->clsImport->forceSet[0] = array('fn' => $strFP . '_lOriginID', 'value' => $glUserID . ''); $this->clsImport->forceSet[1] = array('fn' => $strFP . '_lLastUpdateID', 'value' => $glUserID . ''); $this->clsImport->forceSet[2] = array('fn' => $strFP . '_dteOrigin', 'value' => 'NOW()'); $this->clsImport->forceSet[3] = array('fn' => $strFP . '_dteLastUpdate', 'value' => 'NOW()'); if (!$bMulti) { $this->clsImport->forceSet[4] = array('fn' => $strFP . '_bRecordEntered', 'value' => '1'); } switch ($enumAttach) { case CENUM_CONTEXT_PEOPLE: $this->clsImport->addImportField('people ID', 'ID', 0, '', true, $strFP . '_lForeignKey'); break; case CENUM_CONTEXT_BIZ: $this->clsImport->addImportField('business ID', 'ID', 0, '', true, $strFP . '_lForeignKey'); break; case CENUM_CONTEXT_CLIENT: $this->clsImport->addImportField('client ID', 'ID', 0, '', true, $strFP . '_lForeignKey'); break; case CENUM_CONTEXT_GIFT: $this->clsImport->addImportField('gift ID', 'ID', 0, '', true, $strFP . '_lForeignKey'); break; case CENUM_CONTEXT_SPONSORSHIP: $this->clsImport->addImportField('sponsorship ID', 'ID', 0, '', true, $strFP . '_lForeignKey'); break; case CENUM_CONTEXT_USER: $this->clsImport->addImportField('user ID', 'ID', 0, '', true, $strFP . '_lForeignKey'); break; case CENUM_CONTEXT_VOLUNTEER: $this->clsImport->addImportField('volunteer ID', 'ID', 0, '', true, $strFP . '_lForeignKey'); break; default: screamForHelp($enumAttach . ': unsupported import type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } $lListIDX = 0; foreach ($utable->fields as $field) { $enumFType = $field->enumFieldType; if ($enumFType != CS_FT_HEADING && $enumFType != CS_FT_LOG) { $bList = $enumFType == CS_FT_DDL || $enumFType == CS_FT_DDLMULTI; $this->clsImport->xlateUField2IField($enumFType, $enumIType, $lSize, $strDefault); $this->clsImport->addImportField($field->strFieldNameUser, $enumIType, $lSize, $strDefault, $field->bRequired, $field->strFieldNameInternal, $bList ? $lListIDX : 0, $field->lFieldID); if ($bList) { ++$lListIDX; } } } }
public function loadHonMem($enumLoadType) { //----------------------------------------------------------------- // $enumLoadType: // via HMID // via GiftID // all // all - Hon Only // all - Mem Only //----------------------------------------------------------------- $sqlSelect = $strInner = ''; $bViaGiftID = false; switch ($enumLoadType) { case 'all': $strWhere = ''; break; case 'all - Hon Only': $strWhere = ' AND ghm_bHon'; break; case 'all - Mem Only': $strWhere = ' AND NOT ghm_bHon'; break; case 'via GiftID': $bViaGiftID = true; $strWhere = " AND ghml_lGiftID={$this->lGID} "; $strInner = ' INNER JOIN gifts_hon_mem_links ON ghml_lHonMemID=ghm_lKeyID '; // $sqlSelect = ', ghml_lKeyID, ghml_bAck, UNIX_TIMESTAMP(ghml_dteAck) AS dteAck, ghml_lAckByID '; $sqlSelect = ', ghml_lKeyID, ghml_bAck, ghml_dteAck, ghml_lAckByID '; break; case 'via HMID': $strWhere = " AND ghm_lKeyID={$this->lHMID} "; break; default: screamForHelp($enumLoadType . ': not implemented yet<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } $sqlStr = "SELECT\n ghm_lKeyID, ghm_lFID, ghm_lMailContactID, ghm_bHon,\n ghm_bHidden, ghm_bRetired,\n ghm_lOriginID, ghm_lLastUpdateID,\n UNIX_TIMESTAMP(ghm_dteOrigin) AS dteOrigin,\n UNIX_TIMESTAMP(ghm_dteLastUpdate) AS dteLastUpdate,\n\n tblHM.pe_strFName AS strHM_FName, tblHM.pe_strLName AS strHM_LName,\n tblHM.pe_strAddr1 AS strHM_Addr1, tblHM.pe_strAddr2 AS strHM_Addr2,\n tblHM.pe_strCity AS strHM_City, tblHM.pe_strState AS strHM_State,\n tblHM.pe_strCountry AS strHM_Country, tblHM.pe_strZip AS strHM_Zip,\n tblHM.pe_strPhone AS strHM_Phone, tblHM.pe_strCell AS strHM_Cell,\n\n tblMC.pe_strFName AS strMC_FName, tblMC.pe_strLName AS strMC_LName,\n tblMC.pe_strAddr1 AS strMC_Addr1, tblMC.pe_strAddr2 AS strMC_Addr2,\n tblMC.pe_strCity AS strMC_City, tblMC.pe_strState AS strMC_State,\n tblMC.pe_strCountry AS strMC_Country, tblMC.pe_strZip AS strMC_Zip,\n tblMC.pe_strPhone AS strMC_Phone, tblMC.pe_strCell AS strMC_Cell\n {$sqlSelect}\n\n FROM lists_hon_mem\n INNER JOIN people_names AS tblHM ON tblHM.pe_lKeyID=ghm_lFID\n {$strInner}\n LEFT JOIN people_names AS tblMC ON tblMC.pe_lKeyID=ghm_lMailContactID\n\n WHERE\n 1\n {$strWhere}\n AND NOT ghm_bRetired\n\n ORDER BY NOT ghm_bHon, tblHM.pe_strLName, tblHM.pe_strFName, ghm_lFID, ghm_lKeyID;"; $query = $this->db->query($sqlStr); $this->lNumHonMem = $numRows = $query->num_rows(); if ($numRows == 0) { $this->honMemTable[0] = new stdClass(); $this->honMemTable[0]->ghm_lKeyID = $this->honMemTable[0]->ghm_lFID = $this->honMemTable[0]->ghm_lMailContactID = $this->honMemTable[0]->ghm_bHon = $this->honMemTable[0]->ghm_bHidden = $this->honMemTable[0]->ghm_strFName = $this->honMemTable[0]->ghm_strLName = $this->honMemTable[0]->ghm_strSafeName = $this->honMemTable[0]->ghm_lOriginID = $this->honMemTable[0]->ghm_lLastUpdateID = $this->honMemTable[0]->dteOrigin = $this->honMemTable[0]->dteLastUpdate = $this->honMemTable[0]->honorMem = $this->honMemTable[0]->mailContact = null; if ($bViaGiftID) { $this->honMemTable[0]->lHMLinkID = $this->honMemTable[0]->bAck = $this->honMemTable[0]->dteAck = $this->honMemTable[0]->lAckByID = null; } } else { $idx = 0; foreach ($query->result() as $row) { $this->honMemTable[$idx] = new stdClass(); $this->honMemTable[$idx]->ghm_lKeyID = $row->ghm_lKeyID; $this->honMemTable[$idx]->ghm_lFID = $row->ghm_lFID; $this->honMemTable[$idx]->ghm_lMailContactID = $row->ghm_lMailContactID; $this->honMemTable[$idx]->ghm_bHon = $row->ghm_bHon; $this->honMemTable[$idx]->ghm_bHidden = $row->ghm_bHidden; $this->honMemTable[$idx]->ghm_strFName = $row->strHM_FName; $this->honMemTable[$idx]->ghm_strLName = $row->strHM_LName; $this->honMemTable[$idx]->ghm_strSafeName = htmlspecialchars($row->strHM_FName . ' ' . $row->strHM_LName); $this->honMemTable[$idx]->ghm_lOriginID = $row->ghm_lOriginID; $this->honMemTable[$idx]->ghm_lLastUpdateID = $row->ghm_lLastUpdateID; $this->honMemTable[$idx]->dteOrigin = $row->dteOrigin; $this->honMemTable[$idx]->dteLastUpdate = $row->dteLastUpdate; $this->honMemTable[$idx]->honorMem = new stdClass(); $this->loadHonoree($this->honMemTable[$idx]->honorMem, $row, 'strHM'); $this->honMemTable[$idx]->mailContact = new stdClass(); $this->loadHonoree($this->honMemTable[$idx]->mailContact, $row, 'strMC'); if ($bViaGiftID) { $this->honMemTable[$idx]->lHMLinkID = $row->ghml_lKeyID; $this->honMemTable[$idx]->bAck = $row->ghml_bAck; $this->honMemTable[$idx]->dteAck = dteMySQLDate2Unix($row->ghml_dteAck); $this->honMemTable[$idx]->lAckByID = $row->ghml_lAckByID; } ++$idx; } } }
function xlateContextViaTagType($enumTagContext) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- switch ($enumTagContext) { case CENUM_CONTEXT_IMG_AUCTION: case CENUM_CONTEXT_DOC_AUCTION: $enumContext = CENUM_CONTEXT_AUCTION; break; case CENUM_CONTEXT_IMG_AUCTIONITEM: case CENUM_CONTEXT_DOC_AUCTIONITEM: $enumContext = CENUM_CONTEXT_AUCTIONITEM; break; case CENUM_CONTEXT_IMG_AUCTIONPACKAGE: case CENUM_CONTEXT_DOC_AUCTIONPACKAGE: $enumContext = CENUM_CONTEXT_AUCTIONPACKAGE; break; case CENUM_CONTEXT_IMG_PEOPLE: case CENUM_CONTEXT_DOC_PEOPLE: $enumContext = CENUM_CONTEXT_PEOPLE; break; case CENUM_CONTEXT_IMG_CLIENT: case CENUM_CONTEXT_DOC_CLIENT: $enumContext = CENUM_CONTEXT_CLIENT; break; case CENUM_CONTEXT_IMG_BIZ: case CENUM_CONTEXT_DOC_BIZ: $enumContext = CENUM_CONTEXT_BIZ; break; case CENUM_CONTEXT_IMG_GRANTS: case CENUM_CONTEXT_DOC_GRANTS: $enumContext = CENUM_CONTEXT_GRANTS; break; case CENUM_CONTEXT_IMG_GRANTPROVIDER: case CENUM_CONTEXT_DOC_GRANTPROVIDER: $enumContext = CENUM_CONTEXT_GRANTPROVIDER; break; case CENUM_CONTEXT_IMG_INVITEM: case CENUM_CONTEXT_DOC_INVITEM: $enumContext = CENUM_CONTEXT_INVITEM; break; case CENUM_CONTEXT_IMG_CLIENTLOCATION: case CENUM_CONTEXT_DOC_CLIENTLOCATION: $enumContext = CENUM_CONTEXT_LOCATION; break; case CENUM_CONTEXT_IMG_SPONSOR: case CENUM_CONTEXT_DOC_SPONSOR: $enumContext = CENUM_CONTEXT_SPONSORSHIP; break; case CENUM_CONTEXT_IMG_ORGANIZATION: case CENUM_CONTEXT_DOC_ORGANIZATION: $enumContext = CENUM_CONTEXT_ORGANIZATION; break; case CENUM_CONTEXT_IMG_STAFF: case CENUM_CONTEXT_DOC_STAFF: $enumContext = CENUM_CONTEXT_STAFF; break; case CENUM_CONTEXT_IMG_VOLUNTEER: case CENUM_CONTEXT_DOC_VOLUNTEER: $enumContext = CENUM_CONTEXT_VOLUNTEER; break; default: screamForHelp($enumContextType . ': invalid image/doc context<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } return $enumContext; }
function lDateDiff_DaysViaMDY($lEndMonth, $lEndDay, $lEndYear, $lStartMonth, $lStartDay, $lStartYear) { //--------------------------------------------------------------------- // created 2009-06-08 jpz //--------------------------------------------------------------------- if ($lStartYear > $lEndYear || $lStartYear == $lEndYear && $lStartMonth > $lEndMonth || $lStartYear == $lEndYear && $lStartMonth == $lEndMonth && $lStartDay > $lEndDay) { screamForHelp('Start date must be on or before End date!<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } //---------------------------------------- // special case - within the same month //---------------------------------------- if ($lEndMonth == $lStartMonth && $lEndYear == $lStartYear) { return $lEndDay - $lStartDay; } //---------------------------------------- // starting month days //---------------------------------------- $lHoldDayCount = lDaysInMonth($lStartMonth, $lStartYear) - $lStartDay; $lLoopMonth = $lStartMonth + 1; $lLoopYear = $lStartYear; if ($lLoopMonth > 12) { $lLoopMonth = 1; ++$lLoopYear; } $lAbsLoopMonth = $lLoopYear * 12 + $lLoopMonth; $lAbsMonthEnd = $lEndYear * 12 + $lEndMonth; for ($idx = $lAbsLoopMonth; $idx < $lAbsMonthEnd; ++$idx) { $lHoldDayCount += lDaysInMonth($lLoopMonth, $lLoopYear); ++$lLoopMonth; if ($lLoopMonth > 12) { $lLoopMonth = 1; ++$lLoopYear; } } $lHoldDayCount += $lEndDay; return $lHoldDayCount; }
private function writeCellGeneric($enumCellType, $strValue, $strWidth, $strStyleExtra, $lColSpan, $lRowSpan, $strTagExtra) { //--------------------------------------------------------------- // //--------------------------------------------------------------- if ($strWidth . '' == '') { switch ($enumCellType) { case 'label': $strWidth = $this->strWidthLabel; break; case 'cell': $strWidth = $this->strWidthCell; break; case 'title': $strWidth = $this->strWidthTitle; break; default: screamForHelp($enumCellType . ': invalid cell type</b><br>error on <b>line:</b> ' . __LINE__ . '<br><b>file:</b> ' . __FILE__ . '<br><b>function:</b> ' . __FUNCTION__); break; } } $strWidth = $strWidth == '' ? '' : ' width="' . $strWidth . '" '; $strColSpan = $lColSpan == 1 ? '' : ' colspan="' . $lColSpan . '" '; $strRowSpan = $lRowSpan == 1 ? '' : ' rowspan="' . $lRowSpan . '" '; $strStyle = $strStyleExtra == '' ? '' : ' style="' . $strStyleExtra . '" '; switch ($enumCellType) { case 'label': $strClass = $this->strLabelClass; break; case 'cell': $strClass = $this->strCellClass; break; case 'title': $strClass = $this->strTitleClass; break; default: screamForHelp($enumCellType . ': invalid cell type</b><br>error on <b>line:</b> ' . __LINE__ . '<br><b>file:</b> ' . __FILE__ . '<br><b>function:</b> ' . __FUNCTION__); break; } return '<td class="' . $strClass . '" ' . $strWidth . $strColSpan . $strRowSpan . $strStyle . $strTagExtra . '>' . $strValue . '</td>'; }
function addEditEntry($lSReportID, $lEntryID, $enumSRType) { //------------------------------------------------------------------------ // //------------------------------------------------------------------------ global $glUserID, $gdteNow; if (!bTestForURLHack('notVolunteer')) { return; } $displayData = array(); $displayData['js'] = ''; $displayData['lSReportID'] = $lSReportID = (int) $lSReportID; $displayData['lEntryID'] = $lEntryID = (int) $lEntryID; $displayData['bNew'] = $bNew = $lEntryID <= 0; $displayData['formData'] = new stdClass(); $displayData['enumSRType'] = $enumSRType; //------------------------------------- // models, libraries, and helpers //------------------------------------- $this->load->model('staff/mstaff_status', 'cstat'); $params = array('enumStyle' => 'terse'); $this->load->library('generic_rpt', $params); $this->load->helper('dl_util/web_layout'); $this->load->helper('staff/link_staff'); // load the status report $this->cstat->loadStatusReportViaRptID($lSReportID, false); $displayData['sreport'] = $sreport =& $this->cstat->sreports[0]; $displayData['formData']->bPublished = $bPublished = $sreport->bPublished; if ($bPublished) { return; } $strTypeLabel = $sreport->sections[$enumSRType]->strLabel1; // test for url hack into another's report if (!$bNew) { if ($glUserID != $sreport->lUserID) { return; } } if ($bNew) { $this->cstat->sreports[0]->sections[$enumSRType]->entries = array(); $this->cstat->sreports[0]->sections[$enumSRType]->entries[0] = new stdClass(); $entry =& $sreport->sections[$enumSRType]->entries[0]; $entry->lKeyID = 0; $entry->lStatusID = $lSReportID; $entry->enumStatusType = $enumSRType; $entry->strText01 = ''; $entry->strText02 = ''; $entry->curEstAmnt = 0.0; $entry->strUrgency = ''; } else { $this->cstat->loadSectionsViaSectionEntryID($lEntryID, $this->cstat->sreports[0]->sections); $entry =& $sreport->sections[$enumSRType]->entries[0]; } //------------------------- // validation rules //------------------------- $this->form_validation->set_error_delimiters('<div class="formError">', '</div>'); switch ($enumSRType) { case CENUM_STATCAT_CURRENTPROJECTS: $this->form_validation->set_rules('txtCurrentProject', 'Current Project', 'trim|required'); $this->form_validation->set_rules('txtStatus', 'Status', 'trim|required'); break; case CENUM_STATCAT_CURRENTACTIVITIES: $this->form_validation->set_rules('txtCurrentActivities', 'Current Activities', 'trim|required'); break; case CENUM_STATCAT_UPCOMINGEVENTS: $this->form_validation->set_rules('txtUpcomingEvents', 'Upcoming Events', 'trim|required'); break; case CENUM_STATCAT_UPCOMINGFUNDRQST: $this->form_validation->set_rules('txtUpcomingFundRequest', 'Upcoming Fund Requests', 'trim|required'); $this->form_validation->set_rules('txtAmount', 'Estimated Amount', 'trim|required|callback_stripCommas|numeric'); break; case CENUM_STATCAT_CONCERNSISSUES: $this->form_validation->set_rules('txtConcerns', 'Concerns / Issues', 'trim|required'); $this->form_validation->set_rules('txtUrgency', 'Urgency', 'trim|required'); break; default: screamForHelp($enumSRType . ': invalid status report entry type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } $this->form_validation->set_rules('chkPublished', 'Published?', 'trim|callback_verifyFormForPub'); if ($this->form_validation->run() == FALSE) { $displayData['formData'] = new stdClass(); $this->load->library('generic_form'); // first time displayed, no user data entry errors if (validation_errors() == '') { if ($bNew) { switch ($enumSRType) { case CENUM_STATCAT_CURRENTPROJECTS: $displayData['formData']->txtCurrentProject = ''; $displayData['formData']->txtStatus = ''; break; case CENUM_STATCAT_CURRENTACTIVITIES: $displayData['formData']->txtCurrentActivities = ''; break; case CENUM_STATCAT_UPCOMINGEVENTS: $displayData['formData']->txtUpcomingEvents = ''; break; case CENUM_STATCAT_UPCOMINGFUNDRQST: $displayData['formData']->txtUpcomingFundRequest = ''; $displayData['formData']->txtAmount = '0.00'; break; case CENUM_STATCAT_CONCERNSISSUES: $displayData['formData']->txtConcerns = ''; $displayData['formData']->txtUrgency = ''; break; default: screamForHelp($enumSRType . ': invalid status report entry type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } } else { switch ($enumSRType) { case CENUM_STATCAT_CURRENTPROJECTS: $displayData['formData']->txtCurrentProject = htmlspecialchars($entry->strText01); $displayData['formData']->txtStatus = htmlspecialchars($entry->strText02); break; case CENUM_STATCAT_CURRENTACTIVITIES: $displayData['formData']->txtCurrentActivities = htmlspecialchars($entry->strText01); break; case CENUM_STATCAT_UPCOMINGEVENTS: $displayData['formData']->txtUpcomingEvents = htmlspecialchars($entry->strText01); break; case CENUM_STATCAT_UPCOMINGFUNDRQST: $displayData['formData']->txtUpcomingFundRequest = htmlspecialchars($entry->strText01); $displayData['formData']->txtAmount = number_format($entry->curEstAmnt, 2, '.', ''); break; case CENUM_STATCAT_CONCERNSISSUES: $displayData['formData']->txtConcerns = htmlspecialchars($entry->strText01); $displayData['formData']->txtUrgency = htmlspecialchars($entry->strUrgency); break; default: screamForHelp($enumSRType . ': invalid status report entry type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } } } else { setOnFormError($displayData); switch ($enumSRType) { case CENUM_STATCAT_CURRENTPROJECTS: $displayData['formData']->txtCurrentProject = set_value('txtCurrentProject'); $displayData['formData']->txtStatus = set_value('txtStatus'); break; case CENUM_STATCAT_CURRENTACTIVITIES: $displayData['formData']->txtCurrentActivities = set_value('txtCurrentActivities'); break; case CENUM_STATCAT_UPCOMINGEVENTS: $displayData['formData']->txtUpcomingEvents = set_value('txtUpcomingEvents'); break; case CENUM_STATCAT_UPCOMINGFUNDRQST: $displayData['formData']->txtUpcomingFundRequest = set_value('txtUpcomingFundRequest'); $displayData['formData']->txtAmount = set_value('txtAmount'); break; case CENUM_STATCAT_CONCERNSISSUES: $displayData['formData']->txtConcerns = set_value('txtConcerns'); $displayData['formData']->txtUrgency = set_value('txtUrgency'); break; default: screamForHelp($enumSRType . ': invalid status report entry type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } } //-------------------------- // breadcrumbs //-------------------------- $displayData['pageTitle'] = anchor('aayhf/main/aayhfMenu', 'AAYHF', 'class="breadcrumb"') . ' | ' . anchor('staff/performance/addEditPR/' . $lSReportID, 'Status Report', 'class="breadcrumb"') . ' | ' . ($bNew ? 'Add New' : 'Edit') . ' <b>' . $strTypeLabel . '</b> Entry'; $displayData['title'] = CS_PROGNAME . ' | Status Report'; $displayData['nav'] = $this->mnav_brain_jar->navData(); $displayData['mainTemplate'] = 'aayhf/aayhf_staff/status_entry_add_edit_view'; $this->load->vars($displayData); $this->load->view('template'); } else { switch ($enumSRType) { case CENUM_STATCAT_CURRENTPROJECTS: $entry->strText01 = trim($_POST['txtCurrentProject']); $entry->strText02 = trim($_POST['txtStatus']); break; case CENUM_STATCAT_CURRENTACTIVITIES: $entry->strText01 = trim($_POST['txtCurrentActivities']); break; case CENUM_STATCAT_UPCOMINGEVENTS: $entry->strText01 = trim($_POST['txtUpcomingEvents']); break; case CENUM_STATCAT_UPCOMINGFUNDRQST: $entry->strText01 = trim($_POST['txtUpcomingFundRequest']); $entry->curEstAmnt = (double) trim($_POST['txtAmount']); break; case CENUM_STATCAT_CONCERNSISSUES: $entry->strText01 = trim($_POST['txtConcerns']); $entry->strUrgency = trim($_POST['txtUrgency']); break; default: screamForHelp($enumSRType . ': invalid status report entry type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } if ($bNew) { $lEntryID = $this->cstat->lInsertStatusEntry($lSReportID, $entry); } else { $this->cstat->updateStatusEntry($lEntryID, $entry); } $this->session->set_flashdata('msg', 'Your ' . $strTypeLabel . ' entry was ' . ($bNew ? 'added' : 'updated') . '.'); redirect('staff/performance/addEditPR/' . $lSReportID); } }
case CS_FT_DDLMULTI: case CS_FT_DDL: $strComparisionVal = strLoadDDLCompare($term) . form_error('ddlCompareTo'); break; case CS_FT_DDL_SPECIAL: $strComparisionVal = strLoadDDLSpecialCompare($term) . form_error('ddlCompareTo'); break; case CS_FT_DATETIME: case CS_FT_HEADING: case CS_FT_LOG: // case CS_FT_EMAIL: // case CS_FT_HLINK: // case CS_FT_EMAIL: // case CS_FT_HLINK: default: screamForHelp('INVALID FIELD TYPE ' . $term->enumFieldType . ', error on line ' . __LINE__ . ', file ' . __FILE__ . ', function ' . __FUNCTION__); break; } } echoT('<div style="vertical-align: middle;">' . '<b>' . $tableName . ' </b>' . htmlspecialchars($field->publicName) . ' ' . $strCompatorDDL . ' ' . $strComparisionVal . '</div><br>'); echoT(' <input type="submit" name="cmdSubmit" value="Save search term" style="" onclick="this.disabled=1; this.form.submit();" class="btn" onmouseover="this.className=\'btn btnhov\'" onmouseout="this.className=\'btn\'">'); echoT(form_close('<br>')); closeBlock(); function strLoadDDLSpecialCompare($term) {
function viewTSEntryOptions($lDisplayYear, $lUserID, $tst, $lNumTSDDL, $potentialTS) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- if ($lNumTSDDL == 0) { echoT('<br><i>You currently have no timesheets available for editing.</i><br><br>'); return; } $att = array('style' => 'display: inline'); $strOut = form_open('staff/timesheets/ts_log/add_edit_ts_prep/' . $lUserID, $att) . $lDisplayYear . ': '; switch ($tst->enumRptPeriod) { case 'Weekly': $strOut .= 'Time sheet for the week beginning: <select name="ddlTS">'; break; case 'Monthly': $strOut .= 'Time sheet for the month beginning: <select name="ddlTS">'; break; case 'Semi-monthly': $strOut .= 'Time sheet for the semi-monthly period beginning: <select name="ddlTS">'; break; default: screamForHelp($tst->enumRptPeriod . ': reporting time period not found<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } foreach ($potentialTS as $pTS) { $strOut .= ' <option value="' . $pTS->lTSLKeyID . '_' . $pTS->dteTSEntry . '" ' . ($pTS->bSelected ? 'selected' : '') . '>' . $pTS->strDate . '</option>'; } $strOut .= '</select>' . "\n"; $strOut .= '<input type="submit" name="cmdSubmit" value="Go" style="font-size: 8pt; height: 14pt;" class="btn" onmouseover="this.className=\'btn btnhov\'" onmouseout="this.className=\'btn\'"><br><br>' . form_close(); echoT($strOut); }
function dba_parseDateTime($strDateTime, $bCorrect2000, &$lMonth, &$lDay, &$lYear, &$lHour, &$lMinute, &$lSecond, &$bError, $bDebug = false) { //--------------------------------------------------------------------- // this is basically a strtotime that overcomes the windows (and to // a lesser extent Linux/Unix) timestamp limitations. // // If $bCorrect2000 is true and the year is 2-digit, add 2000 if the // year is <25; else add 1900. // // Supported formats: // m[m]/d[d]/yy[yy] // m[m]-d[d]-yy[yy] // m[m]/d[d]/yy[yy] h[h]:m[m]:s[s] [[a|A|p|P][m|M]] // m[m]-d[d]-yy[yy] h[h]:m[m]:s[s] [[a|A|p|P][m|M]] //--------------------------------------------------------------------- $strDateTime = trim($strDateTime); if ($bDebug) { echo $strDateTime . ' '; } $lState = 1; $bError = false; $strHold1 = ''; $strHold2 = ''; $strHold3 = ''; $strHold10 = ''; $strHold11 = ''; $strHold12 = ''; $strHoldAMPM = ''; for ($idx = 0; $idx < strlen($strDateTime); ++$idx) { if ($bError) { return; } $chrHold = substr($strDateTime, $idx, 1); if ($bDebug) { echo "\$lState={$lState}, \$chrHold={$chrHold}, \$bError=" . ($bError ? 'Yes' : 'No') . " <br>\n"; } switch ($lState) { case 1: if ($chrHold >= '0' && $chrHold <= '9') { $strHold1 .= $chrHold; } elseif ($chrHold == '/' || $chrHold == '-') { $lState = 2; } elseif ($chrHold == ':') { $strHold10 = $strHold1; $strHold1 = ''; $lState = 10; } else { $bError = true; } break; case 2: if ($chrHold >= '0' && $chrHold <= '9') { $strHold2 .= $chrHold; $lState = 3; } else { $bError = true; } break; case 3: if ($chrHold >= '0' && $chrHold <= '9') { $strHold2 .= $chrHold; } elseif ($chrHold == '/' || $chrHold == '-') { $lState = 4; } else { $bError = true; } break; case 4: if ($chrHold >= '0' && $chrHold <= '9') { $strHold3 .= $chrHold; $lState = 5; } else { $bError = true; } break; case 5: if ($chrHold >= '0' && $chrHold <= '9') { $strHold3 .= $chrHold; } elseif ($chrHold == ' ') { $lState = 6; } else { $bError = true; } break; case 6: if ($chrHold != ' ') { if ($chrHold >= '0' && $chrHold <= '9') { $strHold10 .= $chrHold; $lState = 7; } else { $bError = true; } } break; case 7: if ($chrHold >= '0' && $chrHold <= '9') { $strHold10 .= $chrHold; } elseif ($chrHold == ':') { $lState = 10; } else { $bError = true; } break; case 10: if ($chrHold >= '0' && $chrHold <= '9') { $strHold11 .= $chrHold; $lState = 11; } else { $bError = true; } break; case 11: $chrUpper = strtoupper($chrHold); if ($chrHold >= '0' && $chrHold <= '9') { $strHold11 .= $chrHold; } elseif ($chrHold == ':') { $lState = 12; } elseif ($chrHold == ' ') { $lState = 15; } elseif ($chrUpper == 'A' || $chrUpper == 'P') { $strHoldAMPM .= $chrUpper; $lState = 20; } else { $bError = true; } break; case 12: if ($chrHold >= '0' && $chrHold <= '9') { $strHold12 .= $chrHold; $lState = 13; } else { $bError = true; } break; case 13: $chrUpper = strtoupper($chrHold); if ($chrHold >= '0' && $chrHold <= '9') { $strHold12 .= $chrHold; } elseif ($chrHold == ' ') { $lState = 15; } elseif ($chrUpper == 'A' || $chrUpper == 'P') { $strHoldAMPM .= $chrUpper; $lState = 20; } else { $bError = true; } break; case 15: $chrUpper = strtoupper($chrHold); if ($chrUpper == 'A' || $chrUpper == 'P') { $strHoldAMPM .= $chrUpper; $lState = 20; } elseif ($chrHold != ' ') { $bError = true; } break; case 20: $chrUpper = strtoupper($chrHold); if ($chrUpper == 'M') { $strHoldAMPM .= $chrUpper; $lState = 21; } else { $bError = true; } break; case 21: $bError = true; break; default: if ($bDebug) { echo "\$strHold1={$strHold1} <br>\n"; echo "\$strHold2={$strHold2} <br>\n"; echo "\$strHold3={$strHold3} <br>\n"; echo "\$strHold10={$strHold10} <br>\n"; echo "\$strHold11={$strHold11} <br>\n"; echo "\$strHold12={$strHold12} <br>\n"; echo "\$strHoldAMPM={$strHoldAMPM} <br><br>\n"; } screamForHelp('INVALID PARSING STATE ' . $lState . ': error on line ' . __LINE__ . ', file ' . __FILE__ . ', function ' . __FUNCTION__); break; } } if ($bDebug) { echo "\$strHold1={$strHold1} <br>\n"; echo "\$strHold2={$strHold2} <br>\n"; echo "\$strHold3={$strHold3} <br>\n"; echo "\$strHold10={$strHold10} <br>\n"; echo "\$strHold11={$strHold11} <br>\n"; echo "\$strHold12={$strHold12} <br>\n"; echo "\$strHoldAMPM={$strHoldAMPM} <br>\n"; echo "\$bError=" . ($bError ? 'Yes' : 'No') . "<br><br>\n"; } $lMonth = (int) $strHold1; $lDay = (int) $strHold2; $lYear = (int) $strHold3; $lHour = (int) $strHold10; $lMinute = (int) $strHold11; $lSecond = (int) $strHold12; $bPM = $strHoldAMPM == 'PM'; // optionally correct for 2-digit year; if ($lYear <= 99) { if ($bCorrect2000) { if ($lYear < 25) { $lYear += 2000; } else { $lYear += 1900; } } } if ($bDebug) { echo "\$lMonth={$lMonth}, \$lDay={$lDay}, \$lYear={$lYear}, \$lHour={$lHour}, \$lMinute={$lMinute}, \$lSecond={$lSecond} <br><br>\n"; } //------------------------ // basic sanity checks //------------------------ if ($lMonth > 12 || $lMonth < 0) { $bError = true; if ($bDebug) { screamForHelp('<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } } elseif ($lDay < 0 || $lDay > 31) { $bError = true; if ($bDebug) { screamForHelp('<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } } elseif ($lHour > 23 || $lHour < 0) { $bError = true; if ($bDebug) { screamForHelp('<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } } elseif ($lMinute > 59 || $lMinute < 0) { $bError = true; if ($bDebug) { screamForHelp('<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } } elseif ($lSecond > 59 || $lSecond < 0) { $bError = true; if ($bDebug) { screamForHelp('<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } } if ($bError) { return; } if ($lMonth == 0 && ($lDay > 0 || $lYear != 0)) { $bError = true; if ($bDebug) { screamForHelp('<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } } if ($lDay == 0 && ($lMonth > 0 || $lYear != 0)) { $bError = true; if ($bDebug) { screamForHelp('<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } } //--------------------------------------------- // the day of the month test // 30 days have sept, april, june, and nov // 9 4 6 11 //--------------------------------------------- if ($lMonth == 9 || $lMonth == 4 || $lMonth == 6 || $lMonth == 11) { if ($lDay == 31) { $bError = true; if ($bDebug) { screamForHelp('<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } return; } } //--------------------------------------------- // that pesky February test //--------------------------------------------- if ($lMonth == 2) { if ($lDay > 29) { $bError = true; if ($bDebug) { screamForHelp('<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } return; } if ($lDay == 29) { if ($lYear % 4 != 0) { $bError = true; if ($bDebug) { screamForHelp('<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } return; } } } //------------------------- // weird leap year case //------------------------- if ($lMonth == 2 && $lDay == 29 && $lYear % 100 == 0 && $lYear % 400 != 0) { $bError = true; if ($bDebug) { screamForHelp('<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } return; } //--------------------------------------------- // don't allow PM designation on hours greater // than 12 //--------------------------------------------- if ($bPM && $lHour > 12) { $bError = true; if ($bDebug) { screamForHelp('<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); } return; } //--------------------------------------------- // if PM specified, convert post-noon times // to 24 hour format //--------------------------------------------- if ($bPM && $lHour != 12) { $lHour += 12; } //--------------------------------------------- // if AM explicity specified and the hour is 12, // convert to zero-hour. //--------------------------------------------- if ($strHoldAMPM == 'AM' && $lHour == 12) { $lHour = 0; } if ($bDebug) { echo "\$lMonth={$lMonth}, \$lDay={$lDay}, \$lYear={$lYear}, \$lHour={$lHour}, \$lMinute={$lMinute}, \$lSecond={$lSecond} <br><br>\n"; } }