function loadPPCatsAndTests(&$lNumCats, &$ppCats, $bUserAccessible)
 {
     //---------------------------------------------------------------------
     // if $bUserAccessible, the test must be published and not hidden
     //---------------------------------------------------------------------
     // load the pre/post test categories
     $clist = new mlist_generic();
     $clist->enumListType = CENUM_LISTTYPE_CPREPOSTCAT;
     $clist->genericLoadList();
     $lNumInList = $clist->lNumInList;
     // we love scalars
     // add the "no category" to the bottom
     $lNumCats = $lNumInList + 1;
     $clist->listItems[$lNumInList] = new stdClass();
     $liLast =& $clist->listItems[$lNumInList];
     $liLast->lKeyID = null;
     $liLast->strListItem = '(no category)';
     $liLast->lSortIDX = 9999;
     $liLast->enumListType = CENUM_LISTTYPE_CPREPOSTCAT;
     $liLast->bRetired = false;
     // load the Pre/Post tests by category
     if ($clist->lNumInList > 0) {
         foreach ($clist->listItems as $li) {
             $this->loadPPTestsViaCat($li->lKeyID, $li->lNumPPTests, $li->pptests, $bUserAccessible);
         }
     }
     $this->loadPPTestsViaCat(null, $liLast->lNumPPTests, $liLast->pptests, $bUserAccessible);
     $ppCats = arrayCopy($clist->listItems);
 }
 function loadReportEnrolless(&$sRpt)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $this->sqlWhere = " AND cp_lKeyID {$sRpt->strCProgIn} ";
     $this->loadClientPrograms();
     $erecs = array();
     foreach ($this->cprogs as $cprog) {
         // note - interesting debate over where to use IN or temp table
         // http://stackoverflow.com/questions/1532366/mysql-number-of-items-within-in-clause
         // load the enrollees
         $this->extractCProgFields($cprog, $lETableID, $lATableID, $strETable, $strEFNPrefix, $strATable, $strAFNPrefix);
         $sqlStr = "SELECT {$strEFNPrefix}" . "_lForeignKey AS lClientID,\n                {$strEFNPrefix}" . "_lKeyID AS lERecID,\n                {$strEFNPrefix}" . "_dteStart AS mdteStart,\n                {$strEFNPrefix}" . "_dteEnd   AS mdteEnd\n             FROM {$strETable}\n             WHERE NOT {$strEFNPrefix}" . "_bRetired " . $this->strActivelyEnrolledDuringTimeFrameWhere($cprog, $sRpt->dteStart, $sRpt->dteEnd) . "\n             ORDER BY {$strEFNPrefix}" . "_lKeyID;";
         $query = $this->db->query($sqlStr);
         $lNumERecs = $query->num_rows();
         if ($lNumERecs > 0) {
             foreach ($query->result() as $row) {
                 $lClientID = $row->lClientID;
                 if (!isset($erecs[$lClientID])) {
                     $erecs[$lClientID] = new stdClass();
                     $erec =& $erecs[$lClientID];
                     $erec->programs = array();
                     $erec->lProgCnt = 0;
                 }
                 $lCnt = $erec->lProgCnt;
                 $erec->programs[$lCnt] = new stdClass();
                 $erec->programs[$lCnt]->strProgName = $cprog->strProgramName;
                 $erec->programs[$lCnt]->lCProgID = $cprog->lKeyID;
                 $erec->programs[$lCnt]->lETableID = $cprog->lEnrollmentTableID;
                 $erec->programs[$lCnt]->lERecID = $row->lERecID;
                 $erec->programs[$lCnt]->dteStart = dteMySQLDate2Unix($row->mdteStart);
                 $erec->programs[$lCnt]->dteEnd = dteMySQLDate2Unix($row->mdteEnd);
                 ++$erec->lProgCnt;
             }
         }
     }
     $this->lNumEnrollees = count($erecs);
     $this->enrollees = array();
     if ($this->lNumEnrollees > 0) {
         $strIn = implode(', ', array_keys($erecs));
         $sqlStr = "SELECT\n                  cr_lKeyID, cr_strFName, cr_strLName\n               FROM client_records\n               WHERE\n                  cr_lKeyID IN ({$strIn})\n                  AND NOT cr_bRetired\n               ORDER BY cr_strLName, cr_strFName, cr_lKeyID;";
         $query = $this->db->query($sqlStr);
         $lNumCRecs = $query->num_rows();
         if ($lNumCRecs > 0) {
             $idx = 0;
             foreach ($query->result() as $row) {
                 $lClientID = (int) $row->cr_lKeyID;
                 $this->enrollees[$idx] = new stdClass();
                 $crec =& $this->enrollees[$idx];
                 $crec->lClientID = $lClientID;
                 $crec->strCFName = $row->cr_strFName;
                 $crec->strCLName = $row->cr_strLName;
                 $crec->programs = arrayCopy($erecs[$lClientID]->programs);
                 ++$idx;
             }
         }
     }
 }
示例#3
0
function arrayCopy(array $array)
{
    $result = array();
    foreach ($array as $key => $val) {
        if (is_array($val)) {
            $result[$key] = arrayCopy($val);
        } elseif (is_object($val)) {
            $result[$key] = clone $val;
        } else {
            $result[$key] = $val;
        }
    }
    return $result;
}
 function run()
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $lEventIDs = array();
     foreach ($_POST['chkEvent'] as $strEventID) {
         $lEventIDs[] = (int) $strEventID;
     }
     $this->load->model('reports/mreports', 'clsReports');
     $reportAttributes = array('rptType' => CENUM_REPORTTYPE_PREDEFINED, 'rptName' => CENUM_REPORTNAME_VOLEVENTSCHEDULE, 'rptDestination' => CENUM_REPORTDEST_SCREEN, 'lStartRec' => 0, 'lRecsPerPage' => 50, 'bShowRecNav' => false, 'viewFile' => 'pre_vol_schedule_view', 'lEventIDs' => arrayCopy($lEventIDs));
     $this->clsReports->createReportSessionEntry($reportAttributes);
     $reportID = $this->clsReports->sRpt->reportID;
     redirect('reports/reports/run/' . $reportID);
 }
 public function showDebugDetails()
 {
     //-------------------------------------------------------------------------
     //
     //-------------------------------------------------------------------------
     global $glUserID;
     /*----------------------------
     echo(__FILE__.' '.__LINE__.'<br>'."\n"); $this->output->enable_profiler(TRUE);
     //----------------------------- */
     if (!bTestForURLHack('devOnly')) {
         return;
     }
     $displayData = array();
     $displayData['js'] = '';
     //-------------------------------------
     // models, libraries, and helpers
     //-------------------------------------
     $this->load->model('personalization/muser_fields', 'clsUF');
     $this->load->model('client_features/mcprograms', 'cprograms');
     $this->load->model('admin/mpermissions', 'perms');
     $this->load->helper('dl_util/web_layout');
     $params = array('enumStyle' => 'terse', 'clsRpt');
     $this->load->library('generic_rpt', $params);
     $this->load->helper('js/div_hide_show');
     $displayData['js'] .= showHideDiv();
     $this->cprograms->loadClientPrograms(true);
     $displayData['cprogs'] = $cprogs =& $this->cprograms->cprogs;
     $idx = 0;
     foreach ($cprogs as $cp) {
         $lETableID = $cp->lEnrollmentTableID;
         $this->clsUF->lTableID = $lETableID;
         $this->clsUF->loadTableFields();
         $cp->efields = arrayCopy($this->clsUF->fields);
         $lATableID = $cp->lAttendanceTableID;
         $this->clsUF->lTableID = $lATableID;
         $this->clsUF->loadTableFields();
         $cp->afields = arrayCopy($this->clsUF->fields);
     }
     //--------------------------
     // breadcrumbs
     //--------------------------
     $displayData['pageTitle'] = anchor('main/menu/admin', 'Admin', 'class="breadcrumb"') . ' | Client Programs';
     $displayData['title'] = CS_PROGNAME . ' | Admin';
     $displayData['nav'] = $this->mnav_brain_jar->navData();
     $displayData['mainTemplate'] = 'cprograms/cprograms_debug_detail_view';
     $this->load->vars($displayData);
     $this->load->view('template');
 }
 function prepJobCodeArray(&$jCodes, $sRpt, $bAllJobCodes, &$lNumJobCodes)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $glChapterID;
     $masterCodes = array();
     $jcList = new mlist_generic();
     $jcList->enumListType = CENUM_LISTTYPE_VOLJOBCODES;
     if ($bAllJobCodes) {
         $jcList->genericLoadList($glChapterID);
         $lNumJobCodes = count($jcList->listItems);
         if ($lNumJobCodes == 0) {
             return;
         }
         foreach ($jcList->listItems as $listItem) {
             $masterCodes[$listItem->lKeyID] = new stdClass();
             $mc =& $masterCodes[$listItem->lKeyID];
             $mc->strJobCode = $listItem->strListItem;
             $mc->sngNumShiftHours = 0.0;
             $mc->sngNumUnHours = 0.0;
         }
         $masterCodes[-1] = new stdClass();
         $mc =& $masterCodes[-1];
         $mc->strJobCode = '(no job code assigned)';
         $mc->sngNumShiftHours = 0.0;
         $mc->sngNumUnHours = 0.0;
     } else {
         $lNumJobCodes = 1;
         $masterCodes[$sRpt->lJobCodeID] = new stdClass();
         $mc =& $masterCodes[$sRpt->lJobCodeID];
         $mc->strJobCode = $jcList->genericLoadListItem($sRpt->lJobCodeID);
         $mc->sngNumShiftHours = 0.0;
         $mc->sngNumUnHours = 0.0;
     }
     for ($idx = 1; $idx <= 13; ++$idx) {
         // month 13 is used for annual total
         $jCodes[$idx] = new stdClass();
         $jc =& $jCodes[$idx];
         $jc->lMonth = $idx;
         if ($idx <= 12) {
             $jc->strMonth = strXlateMonth($idx);
         }
         $jc->hours = arrayCopy($masterCodes);
     }
 }
function arrayCopy(array $array)
{
    //---------------------------------------------------------------------
    // thanks to kolkabes at googlemail dot com
    // http://php.net/manual/en/ref.array.php
    //---------------------------------------------------------------------
    $result = array();
    foreach ($array as $key => $val) {
        if (is_array($val)) {
            $result[$key] = arrayCopy($val);
        } elseif (is_object($val)) {
            $result[$key] = clone $val;
        } else {
            $result[$key] = $val;
        }
    }
    return $result;
}
 function saveOpts($enumContext)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $bShowAny = $_POST['rdoAnyAll'] == 'any';
     $this->load->model('reports/mreports', 'clsReports');
     $groupList = array();
     $idx = 0;
     foreach ($_POST['chkGroup'] as $groupItem) {
         $groupList[$idx] = (int) $groupItem;
         ++$idx;
     }
     $reportAttributes = array('rptType' => CENUM_REPORTTYPE_PREDEFINED, 'rptName' => CENUM_REPORTNAME_GROUP, 'rptDestination' => CENUM_REPORTDEST_SCREEN, 'lStartRec' => 0, 'lRecsPerPage' => 50, 'bShowRecNav' => true, 'viewFile' => 'pre_generic_rpt_view', 'groupIDs' => arrayCopy($groupList), 'enumContext' => $enumContext, 'bShowAny' => $bShowAny);
     $this->clsReports->createReportSessionEntry($reportAttributes);
     $reportID = $this->clsReports->sRpt->reportID;
     redirect('reports/reports/run/' . $reportID);
 }
 function entireEventInfo($lEventID, &$lNumEvents, &$events)
 {
     /*-----------------------------------------------------------------------
           $lEventID can be a single event ID or an array of event IDs
     
           returns an array that has event info, dates, shifts, and vols
     
           $this->load->model('vols/mvol_events',                  'clsVolEvents');
           $this->load->model('vols/mvol_event_dates',             'clsVolEventDates');
           $this->load->model('vols/mvol_event_dates_shifts',      'clsShifts');
           $this->load->model('vols/mvol_event_dates_shifts_vols', 'clsSV');
     
        -----------------------------------------------------------------------*/
     $clsVolEventDates = new mvol_event_dates();
     $clsShifts = new mvol_event_dates_shifts();
     $clsSV = new mvol_event_dates_shifts_vols();
     $this->loadEventsViaEID($lEventID);
     $lNumEvents = $this->lNumEvents;
     $events = arrayCopy($this->events);
     foreach ($events as $event) {
         $lEID = $event->lKeyID;
         $clsVolEventDates->loadEventDates($lEID);
         $event->lNumDates = $lNumDates = $clsVolEventDates->lNumDates;
         if ($lNumDates > 0) {
             $event->dates = arrayCopy($clsVolEventDates->dates);
             foreach ($event->dates as $edate) {
                 $lEventDateID = $edate->lKeyID;
                 if ($edate->lNumShifts > 0) {
                     $clsShifts->loadShiftsViaEventDateID($lEventDateID);
                     $edate->shifts = arrayCopy($clsShifts->shifts);
                     foreach ($edate->shifts as $shift) {
                         $lShiftID = $shift->lKeyID;
                         $clsSV->loadVolsViaShiftID($lShiftID);
                         $shift->lNumVols = $lNumVols = $clsSV->lNumVols;
                         if ($lNumVols > 0) {
                             $shift->vols = arrayCopy($clsSV->vols);
                         }
                     }
                 }
             }
         }
     }
 }
 function saveOpts()
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $bShowAny = $_POST['rdoAnyAll'] == 'any';
     $bIncludeInactive = @$_POST['chkInactive'] == 'TRUE';
     $this->load->model('reports/mreports', 'clsReports');
     $groupList = array();
     $idx = 0;
     foreach ($_POST['chkSkill'] as $skillItem) {
         $skillList[$idx] = (int) $skillItem;
         ++$idx;
     }
     $reportAttributes = array('rptType' => CENUM_REPORTTYPE_PREDEFINED, 'rptName' => CENUM_REPORTNAME_VOLJOBSKILL, 'rptDestination' => CENUM_REPORTDEST_SCREEN, 'lStartRec' => 0, 'lRecsPerPage' => 50, 'bShowRecNav' => true, 'viewFile' => 'pre_generic_rpt_view', 'skillIDs' => arrayCopy($skillList), 'bShowAny' => $bShowAny, 'bIncludeInactive' => $bIncludeInactive);
     $this->clsReports->createReportSessionEntry($reportAttributes);
     $reportID = $this->clsReports->sRpt->reportID;
     redirect('reports/reports/run/' . $reportID);
 }
示例#11
0
 function tablePerms(&$utable, &$lNumPerms, &$perms)
 {
     //-----------------------------------------------------------------------
     // the indexes of the table array are the table IDs
     // A single table ID can also be passed.
     //-----------------------------------------------------------------------
     $lNumPerms = 0;
     if (is_array($utable)) {
         $locIDs = arrayCopy($utable);
     } else {
         $locIDs = array();
         $locIDs[0] = $utable;
     }
     if (count($locIDs) > 0) {
         foreach ($locIDs as $lTableID) {
             $query = $this->db->query($this->strSqlLoadGroups($lTableID));
             $lNumRows = $query->num_rows();
             if ($lNumRows > 0) {
                 foreach ($query->result() as $row) {
                     $lGroupChildID = $row->gc_lKeyID;
                     if (!isset($perms[$lGroupChildID])) {
                         ++$lNumPerms;
                         $perms[$lGroupChildID] = new stdClass();
                         $tab =& $perms[$lGroupChildID];
                         $tab->strGroupName = $row->gp_strGroupName;
                         $tab->strSafeGroupName = htmlspecialchars($row->gp_strGroupName);
                         $tab->lGroupChildID = $row->gc_lKeyID;
                         $tab->lGroupID = $row->gc_lGroupID;
                         $tab->lForeignID = $row->gc_lForeignID;
                         $tab->enumSubGroup = $row->gc_enumSubGroup;
                     }
                 }
             }
         }
     }
 }
示例#12
0
 function loadVolMgrUsers(&$lNumVM, &$vmUsers)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $this->sqlOrder = 'ch_strChapterName, us_lChapterID, us_strLastName, us_strFirstName, us_strUserName, us_lKeyID ';
     $this->sqlWhere = ' AND us_bUserVolManager ';
     $this->loadUserRecords();
     $lNumVM = $this->lNumRecs;
     $vmUsers = arrayCopy($this->userRec);
 }
 function viewBizCon($strLookupLetter, $lStartRec, $lRecsPerPage, $bShowContactNames)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     if (!bTestForURLHack('showPeople')) {
         return;
     }
     $strLookupLetter = urldecode($strLookupLetter);
     $displayData = array();
     $displayData['js'] = '';
     //------------------------------------------------
     // libraries and utilities
     //------------------------------------------------
     $this->load->helper('dl_util/rs_navigate');
     //      $this->load->helper ('dl_util/email_web');
     $this->load->helper('dl_util/record_view');
     $this->load->helper('img_docs/link_img_docs');
     $this->load->helper('biz/biz');
     $this->load->helper('people/people_display');
     $this->load->helper('dl_util/directory');
     $this->load->library('util/dl_date_time', '', 'clsDateTime');
     $this->load->model('sponsorship/msponsorship', 'clsSpon');
     $this->load->model('admin/madmin_aco', 'clsACO');
     $this->load->model('biz/mbiz', 'clsBiz');
     $this->load->model('donations/mdonations', 'clsGifts');
     $this->load->model('people/mpeople', 'clsPeople');
     $params = array('enumStyle' => 'terse');
     $this->load->library('generic_rpt', $params);
     //------------------------------------------------
     // sanitize the lookup letter and inputs
     //------------------------------------------------
     $displayData['strDirLetter'] = $strLookupLetter = strSanitizeLetter($strLookupLetter);
     //------------------------------------------------
     // stripes
     //------------------------------------------------
     $this->load->model('util/mbuild_on_ready', 'clsOnReady');
     $this->clsOnReady->addOnReadyTableStripes();
     $this->clsOnReady->closeOnReady();
     $displayData['js'] .= $this->clsOnReady->strOnReady;
     $this->clsSpon->bUseDateRange = false;
     $displayData['strDirTitle'] = 'Business Directory';
     $displayData['lNumRecsTot'] = lNumPeopleRecsViaLetter($strLookupLetter, CENUM_CONTEXT_BIZ);
     //$this->clsBiz->lNumBizRecords();
     if (bAllowAccess('showGiftHistory')) {
         $this->clsGifts->bUseDateRange = false;
         $this->clsGifts->cumulativeOpts = new stdClass();
         $this->clsGifts->cumulativeOpts->enumCumulativeSource = CENUM_CONTEXT_BIZ;
     }
     $lNumRecs = lNumPeopleRecsViaLetter($strLookupLetter, CENUM_CONTEXT_BIZ);
     //------------------------------------------------
     // set up directory display
     //------------------------------------------------
     if ($bShowContactNames) {
         $displayData['strRptTitle'] = 'Business Contact Directory';
         $displayData['strRecNavTitle'] = 'Business Contact Directory: ';
     } else {
         $displayData['strRptTitle'] = 'Business/Organization Directory';
         $displayData['strRecNavTitle'] = 'Business Directory: ';
     }
     $displayData['strDirLetter'] = $strLookupLetter;
     $displayData['strLinkBase'] = $strLinkBase = 'biz/biz_directory/' . ($bShowContactNames ? 'viewCBizName' : 'view') . '/';
     $displayData['strDirTitle'] = strDisplayDirectory($strLinkBase, ' class="directoryLetters" ', $strLookupLetter, true, $lStartRec, $lRecsPerPage);
     //------------------------------------------------
     // load biz directory page
     //------------------------------------------------
     $strWhereExtra = $this->clsPeople->strWhereByLetter($strLookupLetter, CENUM_CONTEXT_BIZ, false);
     $this->clsBiz->loadBizDirectoryPage($strWhereExtra, $lStartRec, $lRecsPerPage, !$bShowContactNames, !$bShowContactNames);
     $displayData['lNumDisplayRows'] = $lNumBizRecs = $this->clsBiz->lNumBizRecs;
     $displayData['directoryRecsPerPage'] = $lRecsPerPage;
     $displayData['directoryStartRec'] = $lStartRec;
     $displayData['bizRecs'] = $this->clsBiz->bizRecs;
     if ($lNumBizRecs > 0) {
         foreach ($this->clsBiz->bizRecs as $biz) {
             $this->clsBiz->lBID = $lBID = $biz->lKeyID;
             if ($bShowContactNames) {
                 $this->clsBiz->contactList(true, false, false, '', '');
                 $biz->lNumContacts = $lNumCon = $this->clsBiz->lNumContacts;
                 if ($lNumCon > 0) {
                     $biz->contacts = arrayCopy($this->clsBiz->contacts);
                 }
             } else {
                 $biz->lNumContacts = $this->clsBiz->lNumContacts(true, false);
             }
         }
     }
     initBizReportDisplay($displayData);
     if ($bShowContactNames) {
         $displayData['showFields']->bContactNames = true;
         $displayData['showFields']->bGiftSummary = $displayData['showFields']->bSponsor = $displayData['showFields']->bRemBiz = $displayData['showFields']->bContacts = false;
     }
     //------------------------------------------------
     // breadcrumbs / page setup
     //------------------------------------------------
     $displayData['mainTemplate'] = array('biz/biz_directory_view', 'biz/rpt_generic_biz_list');
     $displayData['pageTitle'] = anchor('main/menu/biz', 'Businesses/Organizations', 'class="breadcrumb"') . ' | Directory';
     $displayData['title'] = CS_PROGNAME . ' | Businesses';
     $displayData['nav'] = $this->mnav_brain_jar->navData();
     $this->load->vars($displayData);
     $this->load->view('template');
 }
 /**
  * @param &$config
  * @param $version
  */
 public static function normalizeConfig(&$config, $version)
 {
     $toMerge = [];
     foreach ($config as $key => &$value) {
         if (!is_array($value)) {
             $value = array('files' => $value);
         }
         if (array_key_exists($key, static::$defaults)) {
             foreach (static::$defaults[$key] as $defKey => $defValue) {
                 if ($defKey[0] === '_' && $defKey[1] === '_') {
                     continue;
                 }
                 if (!array_key_exists($defKey, $value)) {
                     // add it, use version if applicable
                     if ($defKey === 'files') {
                         $value[$defKey] = is_array($defValue) ? array_key_exists($version, $defValue) ? $defValue[$version] : $defValue['*'] : $defValue;
                     } else {
                         $value[$defKey] = $defValue;
                     }
                 }
             }
         } elseif (array_key_exists('__merge', $value)) {
             $toMerge[] = $key;
         } elseif ($key[0] === '_' && $key[1] === '_') {
             // just handle the includes sub-key
             if (!array_key_exists('include', $value)) {
                 $value['include'] = [];
             }
         }
         $value = static::normalizeInclude($value);
     }
     // add custom sections as mergers with vendor and workbench, these are custom mappings
     foreach ($toMerge as $custom) {
         if (!is_array($config[$custom]['__merge'])) {
             $config[$custom]['__merge'] = array($config[$custom]['__merge']);
         }
         foreach ($config[$custom]['__merge'] as $mergeWith) {
             $default = $config[$mergeWith];
             // see if this one is included in that section and only add it's merged version if it is
             $vars = array_combine(['{vendor}', '{package}'], explode('/', $custom));
             if (static::isPathIncluded($default, $vars)) {
                 // recursive will create a shared instance of array contents that $config[$custom]['include'] = array($custom) overwrites changing the value in $config[$mergeWith]['include'], which we do not want
                 $mergeWithCopy = arrayCopy($config[$mergeWith]);
                 $config[$custom] = array_replace_recursive($mergeWithCopy, $config[$custom]);
                 // add the vendor, package, variables
                 if (!array_key_exists('vars', $config[$custom])) {
                     $config[$custom]['vars'] = [];
                 }
                 $config[$custom]['vars'] = array_replace_recursive($vars, $config[$custom]['vars']);
                 // include itself so the rest of the code does not have to know anything special about it
                 $config[$custom]['include'] = array($custom);
                 break;
             }
         }
     }
     // can now create normalized path by combining root and files
     foreach ($config as $key => &$value) {
         // resolve any vendor and package now so that these get processed first
         if (array_key_exists('root', $value)) {
             $value['path'] = static::expandVars(appendPath($value['root'], $value['files']), array_key_exists('vars', $value) ? $value['vars'] : []);
         }
     }
 }
示例#15
0
 function loadRegistrationGeneric($sqlWhere, $lRegFormID, &$lNumRegs, &$regTable)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $glclsDTDateFormat;
     $lNumRegs = 0;
     $regTable = array();
     // load vol registration form
     $this->loadVolRegFormsViaRFID($lRegFormID);
     $rRec =& $this->regRecs[0];
     // load user field meta-data
     $cUF = new muser_fields();
     $this->loadPTablesForDisplay($lRegFormID, $cUF, true);
     // load job skill meta-data
     $this->loadAllJobSkills($lRegFormID);
     // build a bit-map template array of job codes
     $bmJobCodes = array();
     if ($this->lNumSkills > 0) {
         foreach ($this->skills as $skill) {
             if ($skill->bOnForm) {
                 $bmJobCodes[(int) $skill->lSkillID] = false;
             }
         }
     }
     // load the people/volunteer info
     $sqlStr = "SELECT\n            vol_lKeyID, vol_lPeopleID, vol_Notes,\n\n            pe_strTitle, pe_strFName, pe_strMName, pe_strLName,\n            pe_dteBirthDate, pe_strAddr1, pe_strAddr2, pe_strCity,\n            pe_strState, pe_strCountry, pe_strZip, pe_strPhone, pe_strCell, pe_strFax,\n            pe_strEmail,\n\n            aco_lKeyID, aco_strName\n         FROM volunteers\n            INNER JOIN people_names ON vol_lPeopleID = pe_lKeyID\n            INNER JOIN admin_aco    ON aco_lKeyID    = pe_lACO\n         WHERE 1\n            {$sqlWhere}\n            AND NOT vol_bRetired\n            AND NOT pe_bRetired\n            AND NOT vol_bInactive\n         ORDER BY pe_strLName, pe_strFName, pe_strMName, pe_lKeyID;";
     $query = $this->db->query($sqlStr);
     $lNumRegs = $this->lNumRegRecs = $query->num_rows();
     if ($lNumRegs > 0) {
         $volIDs = array();
         $idx = 0;
         foreach ($query->result() as $row) {
             $lVolID = $volIDs[] = (int) $row->vol_lKeyID;
             $regTable[$lVolID] = new stdClass();
             $rRec =& $regTable[$lVolID];
             $rRec->lVolID = (int) $row->vol_lKeyID;
             $rRec->lPeopleID = (int) $row->vol_lPeopleID;
             $rRec->strVolNotes = $row->vol_Notes;
             $rRec->strTitle = $row->pe_strTitle;
             $rRec->strFName = $row->pe_strFName;
             $rRec->strMName = $row->pe_strMName;
             $rRec->strLName = $row->pe_strLName;
             $rRec->dteBirthDate = $mySQLdteBirth = $row->pe_dteBirthDate;
             $rRec->strAddr1 = $row->pe_strAddr1;
             $rRec->strAddr2 = $row->pe_strAddr2;
             $rRec->strCity = $row->pe_strCity;
             $rRec->strState = $row->pe_strState;
             $rRec->strCountry = $row->pe_strCountry;
             $rRec->strZip = $row->pe_strZip;
             $rRec->strPhone = $row->pe_strPhone;
             $rRec->strCell = $row->pe_strCell;
             $rRec->strFax = $row->pe_strFax;
             $rRec->strEmail = $row->pe_strEmail;
             $rRec->lACOID = $row->aco_lKeyID;
             $rRec->strACOName = $row->aco_strName;
             $rRec->jobSkills = array();
             $rRec->bmJobCodes = arrayCopy($bmJobCodes);
             $rRec->pTableData = array();
             //------------------------------
             // vol age/birth day info
             //------------------------------
             if (is_null($mySQLdteBirth)) {
                 $rRec->objVolBirth = null;
                 $rRec->lAgeYears = null;
                 $rRec->strVolAgeBDay = '(age n/a)';
             } else {
                 $rRec->objVolBirth = new dl_date_time();
                 $rRec->objVolBirth->setDateViaMySQL(0, $mySQLdteBirth);
                 $rRec->strVolAgeBDay = $rRec->objVolBirth->strPeopleAge(0, $mySQLdteBirth, $rRec->lAgeYears, $glclsDTDateFormat);
             }
             ++$idx;
         }
         $strVolIDs = implode(',', $volIDs);
     }
     // load the job skills for the registrants
     $sqlStr = "SELECT\n            vs_lVolID, vs_lSkillID, lgen_strListItem\n         FROM vol_skills\n            INNER JOIN lists_generic ON vs_lSkillID = lgen_lKeyID\n         WHERE\n            vs_lVolID IN ({$strVolIDs})\n            AND NOT lgen_bRetired\n         ORDER BY lgen_strListItem;";
     $query = $this->db->query($sqlStr);
     $lNumJobSkills = $query->num_rows();
     if ($lNumJobSkills > 0) {
         foreach ($query->result() as $row) {
             $lVolID = (int) $row->vs_lVolID;
             $lSkillID = (int) $row->vs_lSkillID;
             $regRec =& $regTable[$lVolID];
             $regRec->jobSkills[] = $row->lgen_strListItem;
             $regRec->bmJobCodes[$lSkillID] = true;
         }
     }
     // load the personalized table records
     // for multi-records, export just the first entry
     if ($this->lNumTables > 0) {
         foreach ($this->utables as $ut) {
             $this->loadRegUTableData($ut, $strVolIDs, $regTable);
         }
     }
 }
 function strCProgEnrolleeRpt(&$viewOpts, $enumRptType)
 {
     //---------------------------------------------------------------------
     // return reportID
     //---------------------------------------------------------------------
     global $gbDateFormatUS;
     $this->load->model('reports/mreports', 'clsReports');
     $reportAttributes = array('rptType' => CENUM_REPORTTYPE_PREDEFINED, 'rptName' => $enumRptType, 'rptDestination' => CENUM_REPORTDEST_SCREEN, 'cProgIDs' => arrayCopy($_POST['chkCProgs']), 'lStartRec' => 0, 'lRecsPerPage' => 50, 'bShowRecNav' => false);
     $reportAttributes['viewFile'] = 'pre_generic_rpt_view';
     tf_getDateRanges($viewOpts, $formDates);
     $reportAttributes['dteStart'] = $formDates->dteStart;
     $reportAttributes['dteEnd'] = $formDates->dteEnd;
     $reportAttributes['strDateRange'] = $formDates->strDateRange;
     $reportAttributes['strBetween'] = $formDates->strBetween;
     $this->clsReports->createReportSessionEntry($reportAttributes);
     return $this->clsReports->sRpt->reportID;
 }
 function addFromCForm($lParentID, $lCFID)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $gErrMessages, $gbShowHiddenVerifyError;
     $this->load->helper('dl_util/verify_id');
     verifyID($this, $lCFID, 'custom form ID');
     $displayData = array();
     $displayData['js'] = '';
     $displayData['lCFID'] = $lCFID = (int) $lCFID;
     $displayData['lParentID'] = $lParentID = (int) $lParentID;
     $gbShowHiddenVerifyError = false;
     $gErrMessages = array();
     /*------------------------------------------------
           models/libraries/helpers
       ------------------------------------------------*/
     $params = array('enumStyle' => 'terse');
     $this->load->library('generic_rpt', $params);
     $this->load->model('custom_forms/mcustom_forms', 'cForm');
     $this->load->model('personalization/muser_fields', 'clsUF');
     $this->load->model('personalization/muser_fields_display', 'clsUFD');
     $this->load->model('admin/madmin_aco', 'clsACO');
     $this->load->model('admin/mpermissions', 'perms');
     $this->load->helper('dl_util/context');
     $this->load->helper('dl_util/custom_forms');
     $this->load->helper('dl_util/time_date');
     $this->load->library('util/dl_date_time', '', 'clsDateTime');
     // load the custom form
     $this->cForm->loadCustomFormsViaCFID($lCFID);
     $displayData['cForm'] = $cForm =& $this->cForm->customForms[0];
     $enumType = $cForm->enumContextType;
     // now that the context is known, verify the parent ID
     verifyIDsViaType($this, $enumType, $lParentID, true);
     // custom verification ?
     $displayData['bCusVerification'] = $bCusVerification = $cForm->strVerificationModule . '' != '';
     //-----------------------------
     // validation rules
     //-----------------------------
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     if ($bCusVerification) {
         $this->load->helper('path');
         $this->form_validation->set_rules('hVerify', 'Hidden verification', 'callback_hiddenVerify[' . $cForm->strVerificationModule . ',' . $cForm->strVModEntryPoint . ']');
     }
     // personalized tables and associated fields
     $this->cForm->loadPTablesForDisplay($lCFID, $this->clsUF);
     $displayData['utables'] = $utables =& $this->cForm->utables;
     $displayData['lNumTables'] = $lNumTables = $this->cForm->lNumTables;
     setValidationUTables($displayData['js'], $lNumTables, $utables);
     if ($this->form_validation->run() == FALSE) {
         $this->load->library('generic_form');
         $this->load->model('util/mlist_generic', 'clsList');
         $this->load->helper('dl_util/web_layout');
         loadSupportModels($enumType, $lParentID);
         initUTableDates($displayData['js'], $lNumTables, $utables);
         initUTableDDLs($lNumTables, $utables);
         if (validation_errors() == '') {
             populateCustomTables($lNumTables, $utables, $lParentID);
             setCustomUTableDDLs($lNumTables, $utables);
         } else {
             setOnFormError($displayData);
             repopulateCustomTables($lNumTables, $utables);
         }
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = $this->cForm->strCustomFormsPageTitleAddEdit($enumType, $cForm->strFormName);
         $displayData['strHTMLSummary'] = strContextHTML($enumType, $lParentID, $enumType);
         $displayData['errMessages'] = arrayCopy($gErrMessages);
         $displayData['title'] = CS_PROGNAME . ' | Custom Forms';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = array('custom_forms/custom_form_data_entry_view');
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         saveCustomPTables($lParentID, $lNumTables, $utables);
         $this->cForm->lLogFormSave($lParentID, $lCFID);
         $this->fromWhenceYeCame($lParentID, $enumType, $cForm);
     }
 }
 function addEditCForm($lCFID, $enumType)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $gclsChapter, $glChapterID;
     if (!bTestForURLHack('adminOnly')) {
         return false;
     }
     $this->load->helper('dl_util/verify_id');
     if ($lCFID . '' != '0') {
         verifyID($this, $lCFID, 'custom form ID');
     }
     $displayData = array();
     $displayData['js'] = '';
     $displayData['lCFID'] = $lCFID = (int) $lCFID;
     $displayData['bNew'] = $bNew = $lCFID <= 0;
     //-------------------------
     // models & helpers
     //-------------------------
     $this->load->model('custom_forms/mcustom_forms', 'cForm');
     $this->load->model('personalization/muser_fields', 'clsUF');
     $this->load->model('admin/mpermissions', 'perms');
     $this->load->model('groups/mgroups', 'groups');
     $this->load->helper('groups/groups');
     $this->load->helper('dl_util/context');
     $this->load->helper('img_docs/image_doc');
     $this->load->helper('img_docs/link_img_docs');
     $this->load->helper('js/clear_set_check_on_check');
     $this->load->helper('dl_util/custom_forms');
     $this->load->helper('personalization/validate_custom_verification');
     $displayData['enumType'] = $enumType;
     contextLabels($enumType, $displayData['contextLabel']);
     $displayData['js'] .= clearCheckOnUnCheck();
     $displayData['js'] .= setCheckOnCheck();
     $this->cForm->loadCustomFormsViaCFID($lCFID);
     $cForm =& $this->cForm->customForms[0];
     $this->load->helper('js/div_hide_show');
     $displayData['js'] .= showHideDiv();
     $this->load->helper('js/check_boxes_in_div');
     $displayData['js'] .= checkUncheckInDiv();
     //-----------------------------
     // validation rules
     //-----------------------------
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     $this->form_validation->set_rules('txtCustomFormName', 'Name of the Custom Form', 'trim|required|callback_testDupForm[' . $enumType . ',' . $lCFID . ']');
     $this->form_validation->set_rules('txtDescription', 'Description', 'trim');
     $this->form_validation->set_rules('txtBannerTitle', 'Banner Text: Custom Form Title', 'trim|required');
     $this->form_validation->set_rules('txtIntro', 'Custom Form Introductory Text', 'trim|required');
     $this->form_validation->set_rules('txtSubmissionText', 'Text Shown After Submission', 'trim|required');
     $this->form_validation->set_rules('ddlParentGroup', 'Parent Group ID', 'trim');
     $this->form_validation->set_rules('txtVerificationModule', 'Validation Module', 'callback_verifyVerMod');
     $this->form_validation->set_rules('txtVModEntryPoint', 'Validation Mod Entry Point', 'callback_verifyVModEntry');
     /*
        personalized  tables
     */
     $this->clsUF->enumTType = $enumType;
     $this->clsUF->loadTablesViaTType();
     $displayData['lNumTables'] = $lNumTables = $this->clsUF->lNumTables;
     if ($lNumTables > 0) {
         $displayData['userTables'] = $userTables =& $this->clsUF->userTables;
         foreach ($userTables as $utable) {
             $this->clsUF->lTableID = $lTableID = $utable->lKeyID;
             $this->clsUF->loadTableFields();
             // exclude log fields
             if ($this->clsUF->lNumFields == 0) {
                 --$displayData['lNumTables'];
             } else {
                 foreach ($this->clsUF->fields as $field) {
                     if ($field->enumFieldType == CS_FT_LOG) {
                         --$this->clsUF->lNumFields;
                     } else {
                         $lFieldID = $field->pff_lKeyID;
                         $field->strFNShow = 'chkUFShow_' . $lTableID . '_' . $lFieldID;
                         $field->strFNRequired = 'chkUFReq_' . $lTableID . '_' . $lFieldID;
                         $this->cForm->bShowRequiredUFFields($lCFID, $lTableID, $lFieldID, $field->bShow, $field->bRequired);
                         $this->form_validation->set_rules($field->strFNShow, 'Personalized Field/Show', '');
                         $this->form_validation->set_rules($field->strFNRequired, 'Personalized Field/Required', '');
                     }
                 }
             }
             $utable->lNumFields = $lNumFields = $this->clsUF->lNumFields;
             if ($lNumFields > 0) {
                 $utable->fields = arrayCopy($this->clsUF->fields);
             }
             $utable->strTableLabel = $this->cForm->strPublicUFTable($lTableID, $lCFID, $utable->strUserTableName);
         }
     }
     if ($this->form_validation->run() == FALSE) {
         $displayData['formData'] = new stdClass();
         $this->load->library('generic_form');
         $this->load->model('util/mlist_generic', 'clsList');
         $this->load->helper('dl_util/web_layout');
         $displayData['cForm'] = $cForm;
         // first time displayed, no user data entry errors
         if (validation_errors() == '') {
             if ($bNew) {
                 $displayData['formData']->txtCustomFormName = '';
                 $displayData['formData']->txtDescription = '';
                 $displayData['formData']->txtBannerTitle = '';
                 $displayData['formData']->txtIntro = '';
                 $displayData['formData']->txtSubmissionText = '';
                 $displayData['formData']->txtVerificationModule = '';
                 $displayData['formData']->txtVModEntryPoint = '';
             } else {
                 $displayData['formData']->txtCustomFormName = htmlspecialchars($cForm->strFormName);
                 $displayData['formData']->txtDescription = htmlspecialchars($cForm->strDescription);
                 $displayData['formData']->txtBannerTitle = htmlspecialchars($cForm->strBannerTitle);
                 $displayData['formData']->txtIntro = htmlspecialchars($cForm->strIntro);
                 $displayData['formData']->txtSubmissionText = htmlspecialchars($cForm->strSubmissionText);
                 $displayData['formData']->txtVerificationModule = htmlspecialchars($cForm->strVerificationModule);
                 $displayData['formData']->txtVModEntryPoint = htmlspecialchars($cForm->strVModEntryPoint);
             }
             // client group ddl
             $displayData['formData']->ddlParentGroup = $this->groups->strDDLActiveGroupEntries('ddlParentGroup', $enumType, $cForm->lParentGroupID, true);
             $displayData['formData']->lNumParentGroups = $this->groups->lNumGroupList;
         } else {
             setOnFormError($displayData);
             $displayData['formData']->txtCustomFormName = set_value('txtCustomFormName');
             $displayData['formData']->txtDescription = set_value('txtDescription');
             $displayData['formData']->txtBannerTitle = set_value('txtBannerTitle');
             $displayData['formData']->txtIntro = set_value('txtIntro');
             $displayData['formData']->txtSubmissionText = set_value('txtSubmissionText');
             $displayData['formData']->txtVerificationModule = set_value('txtVerificationModule');
             $displayData['formData']->txtVModEntryPoint = set_value('txtVModEntryPoint');
             // parent group ddl
             $displayData['formData']->ddlParentGroup = $this->groups->strDDLActiveGroupEntries('ddlParentGroup', $enumType, set_value('ddlParentGroup'), true);
             $displayData['formData']->lNumParentGroups = $this->groups->lNumGroupList;
             if ($lNumTables > 0) {
                 foreach ($userTables as $utable) {
                     if ($utable->lNumFields > 0) {
                         // exclude log fields
                         foreach ($utable->fields as $field) {
                             if ($field->enumFieldType != CS_FT_LOG) {
                                 $field->bShow = set_value($field->strFNShow) == 'true';
                                 $field->bRequired = set_value($field->strFNRequired) == 'true';
                             }
                         }
                     }
                 }
             }
         }
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = $this->cForm->strCustomFormsPageTitleAddEdit($enumType, ($bNew ? 'Add New' : 'Edit') . '  Form');
         $displayData['title'] = CS_PROGNAME . ' | Custom Forms';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'custom_forms/custom_form_add_edit_view';
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         // internal fields
         $cForm->strFormName = trim($_POST['txtCustomFormName']);
         $cForm->strDescription = trim($_POST['txtDescription']);
         $cForm->strVerificationModule = trim($_POST['txtVerificationModule']);
         $cForm->strVModEntryPoint = trim($_POST['txtVModEntryPoint']);
         $cForm->lParentGroupID = (int) @$_POST['ddlParentGroup'];
         if ($cForm->lParentGroupID <= 0) {
             $cForm->lParentGroupID = null;
         }
         // top banner
         $cForm->strBannerTitle = trim($_POST['txtBannerTitle']);
         $cForm->strIntro = trim($_POST['txtIntro']);
         $cForm->strSubmissionText = trim($_POST['txtSubmissionText']);
         // personalized tables
         if ($lNumTables > 0) {
             foreach ($userTables as $utable) {
                 if ($utable->lNumFields > 0) {
                     foreach ($utable->fields as $field) {
                         if ($field->enumFieldType != CS_FT_LOG) {
                             $field->bShow = trim(@$_POST[$field->strFNShow]) == 'true';
                             $field->bRequired = trim(@$_POST[$field->strFNRequired]) == 'true';
                         }
                     }
                 }
             }
         }
         if ($bNew) {
             $lCFID = addNewCustomForm($enumType, $cForm);
         } else {
             updateCustomForm($enumType, $lCFID, $cForm);
         }
         updateFormPTableFields($enumType, $lCFID, $lNumTables, $userTables);
         $this->session->set_flashdata('msg', 'The custom form was ' . ($bNew ? 'added' : 'updated') . '.');
         redirect('custom_forms/custom_form_add_edit/view/' . $enumType);
     }
 }
function setGlobals(&$clsLocal)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    setNameSpace(false);
    // also loads the database
    //--------------------------------------------------------------------------------
    // to insure global scope, global vars defined in helpers/lnpConfig_helper.php
    //--------------------------------------------------------------------------------
    global $gstrFName, $gstrLName, $gstrUserName, $gstrSafeName, $gbAdmin, $gbStandardUser, $gbDev, $gbVolLogin, $gVolPerms, $gUserPerms, $glVolPeopleID, $gbUserInMgrGroup, $genumDateFormat, $glclsDTDateFormat, $glclsDTDateTimeFormat, $gstrDateFormatLabel, $gbDateFormatUS, $gstrFormatDatePicker, $genumMeasurePref, $gbMetric, $gstrBrowser, $gstrBrowser, $gbBrowserIE, $gbBrowserChrome, $gbBrowserFirefox, $gbBrowserSafari, $gdteNow, $glUserID, $gclsChapter, $glChapterID;
    // did we lose our session?
    if (!isset($_SESSION[CS_NAMESPACE . 'user'])) {
        redirect('login');
    }
    $glChapterID = 1;
    // reserved
    $glUserID = @$_SESSION[CS_NAMESPACE . 'user']->lUserID;
    $gstrFName = @$_SESSION[CS_NAMESPACE . 'user']->strFirstName;
    $gstrLName = @$_SESSION[CS_NAMESPACE . 'user']->strLastName;
    $gstrUserName = @$_SESSION[CS_NAMESPACE . 'user']->strUserName;
    $gstrSafeName = @$_SESSION[CS_NAMESPACE . 'user']->strSafeName;
    $gbAdmin = @$_SESSION[CS_NAMESPACE . 'user']->bAdmin;
    $gbStandardUser = @$_SESSION[CS_NAMESPACE . 'user']->bStandardUser;
    $gbVolLogin = @$_SESSION[CS_NAMESPACE . 'user']->bVolLogin;
    $gbDev = @$_SESSION[CS_NAMESPACE . 'user']->bDebugger;
    $genumDateFormat = @$_SESSION[CS_NAMESPACE . 'user']->enumDateFormat;
    $genumMeasurePref = @$_SESSION[CS_NAMESPACE . 'user']->enumMeasurePref;
    $gbMetric = $genumMeasurePref == 'metric';
    if ($gbVolLogin) {
        $gVolPerms = new stdClass();
        $gVolPerms->bVolEditContact = $_SESSION[CS_NAMESPACE . 'user']->volPerms->bVolEditContact;
        $gVolPerms->bVolPassReset = $_SESSION[CS_NAMESPACE . 'user']->volPerms->bVolPassReset;
        $gVolPerms->bVolViewGiftHistory = $_SESSION[CS_NAMESPACE . 'user']->volPerms->bVolViewGiftHistory;
        $gVolPerms->bVolEditJobSkills = $_SESSION[CS_NAMESPACE . 'user']->volPerms->bVolEditJobSkills;
        $gVolPerms->bVolViewHrsHistory = $_SESSION[CS_NAMESPACE . 'user']->volPerms->bVolViewHrsHistory;
        $gVolPerms->bVolAddVolHours = $_SESSION[CS_NAMESPACE . 'user']->volPerms->bVolAddVolHours;
        $gVolPerms->bVolShiftSignup = $_SESSION[CS_NAMESPACE . 'user']->volPerms->bVolShiftSignup;
        $glVolPeopleID = $_SESSION[CS_NAMESPACE . 'user']->lPeopleID;
    } elseif ($gbStandardUser) {
        $gUserPerms = new stdClass();
        $gUserPerms->bUserDataEntryPeople = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserDataEntryPeople;
        $gUserPerms->bUserDataEntryGifts = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserDataEntryGifts;
        $gUserPerms->bUserEditPeople = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserEditPeople;
        $gUserPerms->bUserEditGifts = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserEditGifts;
        $gUserPerms->bUserViewPeople = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserViewPeople;
        $gUserPerms->bUserViewGiftHistory = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserViewGiftHistory;
        $gUserPerms->bUserViewReports = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserViewReports;
        $gUserPerms->bUserAllowExports = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserAllowExports;
        $gUserPerms->bUserAllowSponsorship = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserAllowSponsorship;
        $gUserPerms->bUserAllowSponFinancial = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserAllowSponFinancial;
        $gUserPerms->bUserAllowClient = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserAllowClient;
        $gUserPerms->bUserAllowAuctions = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserAllowAuctions;
        $gUserPerms->bUserAllowGrants = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserAllowGrants;
        $gUserPerms->bUserAllowInventory = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserAllowInventory;
        $gUserPerms->bTimeSheetAdmin = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bTimeSheetAdmin;
        $gUserPerms->bUserVolManager = $_SESSION[CS_NAMESPACE . 'user']->userPerms->bUserVolManager;
        // personalized table access
        $gUserPerms->ptables = @$_SESSION[CS_NAMESPACE . 'user']->userPerms->ptables;
        $gUserPerms->lNumPTables = @$_SESSION[CS_NAMESPACE . 'user']->userPerms->lNumPTables;
        $gUserPerms->lNumUserGroups = $lNumGroups = @$_SESSION[CS_NAMESPACE . 'user']->lNumUserGroups;
        if ($lNumGroups > 0) {
            $gUserPerms->strUGroups = arrayCopy($_SESSION[CS_NAMESPACE . 'user']->strUGroups);
        }
    } else {
        $gVolPerms = $gUserPerms = null;
    }
    if (!$gbVolLogin) {
        if (isset($_SESSION[CS_NAMESPACE . 'user']->bUserMgrStaffGroup)) {
            $gbUserInMgrGroup = $_SESSION[CS_NAMESPACE . 'user']->bUserMgrStaffGroup;
        } else {
            $gbUserInMgrGroup = $_SESSION[CS_NAMESPACE . 'user']->bUserMgrStaffGroup = false;
        }
    }
    $gstrBrowser = @$_SESSION[CS_NAMESPACE . 'browser'];
    $gbBrowserIE = $gstrBrowser == 'IE';
    $gbBrowserChrome = $gstrBrowser == 'Chrome';
    $gbBrowserFirefox = $gstrBrowser == 'Firefox';
    $gbBrowserSafari = $gstrBrowser == 'Safari';
    $gdteNow = time();
    // php error testing
    if ($gbDev) {
        error_reporting(E_ALL | E_STRICT);
    } else {
        error_reporting(0);
    }
    switch ($genumDateFormat) {
        case 'j M Y':
        case 'j F Y':
        case 'd/m/Y':
            $gstrDateFormatLabel = 'dd/mm/yyyy';
            $gbDateFormatUS = false;
            $gstrFormatDatePicker = 'd/m/Y';
            break;
        case 'M j Y':
        case 'F j Y':
        case 'm/d/Y':
        default:
            $gstrDateFormatLabel = 'mm/dd/yyyy';
            $gbDateFormatUS = true;
            $gstrFormatDatePicker = 'm/d/Y';
            break;
    }
    switch ($genumDateFormat) {
        case 'M j Y':
            $glclsDTDateFormat = 6;
            $glclsDTDateTimeFormat = 4;
            break;
        case 'F j Y':
            $glclsDTDateFormat = 7;
            $glclsDTDateTimeFormat = 4;
            break;
        case 'm/d/Y':
            $glclsDTDateFormat = 1;
            $glclsDTDateTimeFormat = 4;
            break;
        case 'j M Y':
            $glclsDTDateFormat = 16;
            $glclsDTDateTimeFormat = 14;
            break;
        case 'j F Y':
            $glclsDTDateFormat = 17;
            $glclsDTDateTimeFormat = 14;
            break;
        case 'd/m/Y':
            $glclsDTDateFormat = 11;
            $glclsDTDateTimeFormat = 14;
            break;
        default:
            $glclsDTDateFormat = 2;
            $glclsDTDateTimeFormat = 4;
            break;
    }
    setChapterGlobals();
    if (CB_AAYHF) {
        aayhf\setSession();
    }
    // set the time zone
    //      date_default_timezone_set($clsLocal->config->item('dl_timezone'));
    date_default_timezone_set($gclsChapter->strTimeZone);
    //$zzzlPos = strrpos(__FILE__, '\\'); $zzzlLen=strlen(__FILE__); echo('<font class="debug">'.substr(__FILE__, strrpos(__FILE__, '\\',-(($zzzlLen-$zzzlPos)+1))) .': '.__LINE__
    //.":\date_default_timezone_get  = ".date_default_timezone_get ()."<br></font>\n");
}
 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);
 }
 function peopleDirView($strLookupLetter, $lStartRec, $lRecsPerPage, $bRelDir)
 {
     //------------------------------------------------------------------------------
     //
     //------------------------------------------------------------------------------
     if (!bTestForURLHack('showPeople')) {
         return;
     }
     $strLookupLetter = urldecode($strLookupLetter);
     $displayData = array();
     //------------------------------------------------
     // libraries and utilities
     //------------------------------------------------
     $this->load->helper('people/people');
     $this->load->helper('people/people_display');
     $this->load->helper('dl_util/directory');
     $this->load->helper('dl_util/rs_navigate');
     //      $this->load->helper('dl_util/email_web');
     $this->load->helper('dl_util/record_view');
     $this->load->helper('img_docs/link_img_docs');
     $params = array('enumStyle' => 'terse');
     $this->load->library('generic_rpt', $params);
     $this->load->library('util/dl_date_time', '', 'clsDateTime');
     $this->load->model('people/mpeople', 'clsPeople');
     $this->load->model('admin/madmin_aco', 'clsACO');
     $this->load->model('sponsorship/msponsorship');
     $this->load->model('donations/mdonations');
     $this->load->model('people/mrelationships', 'clsRel');
     //------------------------------------------------
     // sanitize the lookup letter
     //------------------------------------------------
     $displayData['strDirLetter'] = $strLookupLetter = strSanitizeLetter($strLookupLetter);
     $displayData['bRelDir'] = $bRelDir;
     //------------------------------------------------
     // stripes
     //------------------------------------------------
     $this->load->model('util/mbuild_on_ready', 'clsOnReady');
     $this->clsOnReady->addOnReadyTableStripes();
     $this->clsOnReady->closeOnReady();
     $displayData['js'] = $this->clsOnReady->strOnReady;
     initPeopleReportDisplay($displayData);
     $displayData['strRptTitle'] = 'People ' . ($bRelDir ? 'Relationship ' : '') . 'Directory';
     $displayData['strDirLetter'] = $strLookupLetter;
     $displayData['strLinkBase'] = $strLinkBase = 'people/people_dir/' . ($bRelDir ? 'relView' : 'view') . '/';
     $displayData['strDirTitle'] = strDisplayDirectory($strLinkBase, ' class="directoryLetters" ', $strLookupLetter, true, $lStartRec, $lRecsPerPage);
     //------------------------------------------------
     // total # people for this letter
     //------------------------------------------------
     $displayData['lNumRecsTot'] = $lNumRecsTot = lNumPeopleRecsViaLetter($strLookupLetter, CENUM_CONTEXT_PEOPLE);
     $displayData['lNumPeople'] = $lNumRecsTot;
     $displayData['strPeopleType'] = CENUM_CONTEXT_PEOPLE;
     //------------------------------------------------
     // load people directory page
     //------------------------------------------------
     $strWhereExtra = $this->clsPeople->strWhereByLetter($strLookupLetter, CENUM_CONTEXT_PEOPLE, false);
     $this->clsPeople->loadPeopleDirectoryPage($strWhereExtra, $lStartRec, $lRecsPerPage);
     $displayData['lNumDisplayRows'] = $this->clsPeople->lNumPeople;
     $displayData['directoryRecsPerPage'] = $lRecsPerPage;
     $displayData['directoryStartRec'] = $lStartRec;
     $displayData['people'] =& $this->clsPeople->people;
     if ($bRelDir) {
         if ($this->clsPeople->lNumPeople > 0) {
             foreach ($this->clsPeople->people as $person) {
                 $this->clsRel->lPID = $person->lKeyID;
                 $this->clsRel->loadFromRelViaPID();
                 $person->lNumFromRels = $this->clsRel->lNumRelAB;
                 if ($person->lNumFromRels > 0) {
                     $person->fromRels = arrayCopy($this->clsRel->arrRelAB);
                 }
                 $this->clsRel->loadToRelViaPID();
                 $person->lNumToRels = $this->clsRel->lNumRelAB;
                 if ($person->lNumToRels > 0) {
                     $person->toRels = arrayCopy($this->clsRel->arrRelAB);
                 }
             }
         }
     }
     //------------------------------------------------
     // breadcrumbs / page setup
     //------------------------------------------------
     $displayData['mainTemplate'] = array('people/people_directory_view', 'people/' . ($bRelDir ? 'rpt_people_rel_dir_view' : 'rpt_generic_people_list'));
     $displayData['pageTitle'] = anchor('main/menu/people', 'People', 'class="breadcrumb"') . ' | People' . ($bRelDir ? ' Relationship' : '') . ' Directory';
     $displayData['title'] = CS_PROGNAME . ' | People';
     $displayData['nav'] = $this->mnav_brain_jar->navData();
     $this->load->vars($displayData);
     $this->load->view('template');
 }
 function setUTableDDLs(&$utable, $bNew, $mRec)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     if ($utable->lNumEditableFields > 0) {
         foreach ($utable->ufields as $ufield) {
             $enumType = $ufield->enumFieldType;
             $lFieldID = $ufield->pff_lKeyID;
             $strFN = $ufield->strFieldNameInternal;
             if ($enumType == CS_FT_DDL) {
                 if (!isset($mRec->{$strFN})) {
                     $lMatchID = $ufield->lMatch;
                 } else {
                     $lMatchID = $mRec->{$strFN};
                 }
                 $ufield->strDDL = '<select name="' . $strFN . '">
                    <option value="-1">&nbsp;</option>' . "\n" . $this->clsUF->strDisplayUF_DDL($lFieldID, $lMatchID) . '</select>' . "\n";
             } elseif ($enumType == CS_FT_DDLMULTI) {
                 $strMDDLFN = $strFN . '_ddlMulti';
                 $lMatchIDs = array();
                 if ($bNew && !isset($mRec->{$strMDDLFN}->lNumEntries)) {
                     $lMatchIDs = arrayCopy($ufield->lMatch);
                 } else {
                     if ($mRec->{$strMDDLFN}->lNumEntries > 0) {
                         foreach ($mRec->{$strMDDLFN}->entries as $en) {
                             $lMatchIDs[] = $en->lDDLID;
                         }
                     }
                 }
                 $ufield->strDDLMulti = '<select multiple size=5 name="' . $strFN . '[]">
                    <option value="-1">&nbsp;</option>' . "\n" . $this->clsUF->strDisplayUF_DDL($lFieldID, $lMatchIDs) . '</select>' . "\n";
             }
         }
     }
 }
 public function addEditVolsForShift($lDateID, $lShiftID, $skillList = null)
 {
     //-------------------------------------------------------------------------
     // is skillList is not null, limit display of volunteers to those
     // possessing skills in the list
     //-------------------------------------------------------------------------
     $this->load->helper('dl_util/verify_id');
     verifyID($this, $lDateID, 'event date ID');
     verifyID($this, $lShiftID, 'shift ID');
     $displayData = array();
     $displayData['lDateID'] = $lDateID = (int) $lDateID;
     $displayData['lShiftID'] = $lShiftID = (int) $lShiftID;
     //--------------------------
     // models, y todos
     //--------------------------
     $this->load->model('vols/mvol_skills', 'clsVolSkills');
     $this->load->model('vols/mvol_events', 'clsVolEvents');
     $this->load->model('vols/mvol_event_dates', 'clsVolEventDates');
     $this->load->model('vols/mvol_event_dates_shifts', 'clsShifts');
     $this->load->model('vols/mvol_event_dates_shifts_vols', 'clsSV');
     $this->load->model('util/mlist_generic', 'listGeneric');
     $params = array('enumStyle' => 'terse');
     $this->load->library('generic_rpt', $params);
     $this->load->helper('dl_util/time_date');
     $this->clsVolEventDates->loadEventDateViaDateID($lDateID);
     $lEventID = $this->clsVolEventDates->dates[0]->lVolEventID;
     // load the job skills list
     $this->listGeneric->initializeListManager('generic', CENUM_LISTTYPE_VOLSKILLS);
     $this->listGeneric->loadList();
     $displayData['skills'] = arrayCopy($this->listGeneric->listItems);
     //---------------------
     // shift summary
     //---------------------
     $this->clsShifts->loadShiftsViaEventShiftID($lShiftID);
     $displayData['contextSummary'] = $this->clsShifts->volEventDateShiftHTMLSummary();
     //----------------------------------------------------
     // find volunteers already assigned to this shift
     //----------------------------------------------------
     $this->clsSV->loadVolsViaShiftID($lShiftID);
     $strExcludeIDs = $this->clsSV->strVolIDsAsStr();
     //----------------------------------------------------------
     // load all available volunteers, excluding those already
     // assigned to this shift (populates ->volsA[]
     //----------------------------------------------------------
     $this->clsSV->loadAvailVols($strExcludeIDs, false);
     /*      
     echo('<font class="debug">'.substr(__FILE__, strrpos(__FILE__, '\\'))
        .': '.__LINE__.'<pre>'); print_r($this->clsSV->volsA); echo('</pre></font><br>');      
     */
     $displayData['volsA'] = $volsA =& $this->clsSV->volsA;
     $displayData['lNumVolsAvail'] = $lNumVolsAvail = $this->clsSV->lNumVolsAvail;
     $bSkillTest = !is_null($skillList);
     if ($lNumVolsAvail > 0) {
         foreach ($volsA as $vol) {
             $this->clsVolSkills->lVolID = $lVolID = $vol->lVolID;
             $this->clsVolSkills->loadSingleVolSkills();
             $vol->lNumVolSkills = $this->clsVolSkills->lNumSingleVolSkills;
             $vol->volSkills = $this->clsVolSkills->singleVolSkills;
             if ($bSkillTest) {
                 $skillTest = array();
                 foreach ($vol->volSkills as $vSkill) {
                     $skillTest[] = $vSkill->lSkillID;
                 }
                 $vol->bEligible = $this->allSkills($skillTest, $skillList);
             } else {
                 $vol->bEligible = true;
             }
         }
     }
     //--------------------------
     // breadcrumbs
     //--------------------------
     $displayData['pageTitle'] = anchor('main/menu/vols', 'Volunteers', 'class="breadcrumb"') . ' | ' . anchor('volunteers/events_schedule/viewEventsList', 'Event List', 'class="breadcrumb"') . ' | ' . anchor('volunteers/events_record/viewEvent/' . $lEventID, 'Event', 'class="breadcrumb"') . ' | ' . anchor('volunteers/event_dates_view/viewDates/' . $lDateID, 'Event Date', 'class="breadcrumb"') . ' | Add Volunteers to Shift';
     $displayData['title'] = CS_PROGNAME . ' | Volunteers';
     $displayData['nav'] = $this->mnav_brain_jar->navData();
     $displayData['mainTemplate'] = 'vols/vol_event_shift_add_vols_view';
     $this->load->vars($displayData);
     $this->load->view('template');
 }
示例#24
0
 function loadGiftsViaDIDPayID($lDepositID, $lPaymentID, &$lNumGifts, &$gifts)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $cGifts = new mdonations();
     $cGifts->sqlExtraWhere = " AND gi_lDepositLogID={$lDepositID} AND gi_lPaymentType={$lPaymentID} ";
     $cGifts->loadGifts();
     $lNumGifts = $cGifts->lNumGifts;
     $gifts = arrayCopy($cGifts->gifts);
 }
 private function loadStaffGroups()
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $this->staffGroups = array();
     $this->cgroups->loadActiveGroupsViaType(CENUM_CONTEXT_STAFF, 'groupName', '', false, null);
     $this->lNumStaffGroups = $this->cgroups->lNumGroupList;
     if ($this->lNumStaffGroups > 0) {
         $this->staffGroups = arrayCopy($this->cgroups->arrGroupList);
         foreach ($this->staffGroups as $sg) {
             $this->cgroups->loadGroupMembership(CENUM_CONTEXT_STAFF, $sg->lKeyID);
             $sg->lNumMembers = $this->cgroups->lCntMembersInGroup;
             if ($sg->lNumMembers > 0) {
                 $sg->staffMembers = arrayCopy($this->cgroups->groupMembers);
             }
         }
     }
     /*
              // and one to grow on
           $this->staffGroups[$this->lNumStaffGroups] = new stdClass;
           $sg = &$this->staffGroups[$this->lNumStaffGroups];
           $sg->lKeyID       = null;
           $sg->strGroupName = '(not a member of any staff group)';
           $sg->bTempGroup   = false;
           $sg->strNotes     = '';
           $sg->dteExpire    = null;
           $sg->dteOrigin    = null;
           ++$this->lNumStaffGroups;
     */
     foreach ($this->staffGroups as $sge) {
         $sge->lNumEntries = 0;
     }
     /* -------------------------------------
     echo('<font class="debug">'.substr(__FILE__, strrpos(__FILE__, '\\'))
        .': '.__LINE__.'<br>$this->staffGroups   <pre>');
     echo(htmlspecialchars( print_r($this->staffGroups, true))); echo('</pre></font><br>');
     die;
     // -------------------------------------*/
 }
 function addEditRegForm($lRegFormID)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $gclsChapter, $glChapterID;
     if (!bTestForURLHack('editPeopleBizVol')) {
         return;
     }
     $this->load->helper('dl_util/verify_id');
     if ($lRegFormID . '' != '0') {
         verifyID($this, $lRegFormID, 'vol. registration ID');
     }
     $displayData = array();
     $displayData['js'] = '';
     $displayData['lRegFormID'] = $lRegFormID = (int) $lRegFormID;
     $displayData['bNew'] = $bNew = $lRegFormID <= 0;
     //-------------------------
     // models & helpers
     //-------------------------
     $this->load->model('vol_reg/mvol_reg', 'volReg');
     $this->load->model('img_docs/mimage_doc', 'cImgDoc');
     $this->load->model('admin/morganization', 'clsChapter');
     $this->load->model('admin/madmin_aco', 'clsACO');
     $this->load->model('groups/mgroups', 'groups');
     $this->load->helper('img_docs/image_doc');
     $this->load->helper('img_docs/link_img_docs');
     $this->load->helper('js/clear_set_check_on_check');
     $this->load->helper('dl_util/web_layout');
     $this->load->helper('dl_util/custom_forms');
     $this->load->helper('groups/groups');
     $displayData['js'] .= clearCheckOnUnCheck();
     $displayData['js'] .= setCheckOnCheck();
     $this->volReg->loadVolRegFormsViaRFID($lRegFormID);
     $rRec =& $this->volReg->regRecs[0];
     //-----------------------------
     // validation rules
     //-----------------------------
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     $this->form_validation->set_rules('txtRegFormName', 'Name of the Registration Form', 'trim|required');
     $this->form_validation->set_rules('txtDescription', 'Description', 'trim');
     $this->form_validation->set_rules('txtBannerOrg', 'Banner Text: Organization Name', 'trim|required');
     $this->form_validation->set_rules('txtBannerTitle', 'Banner Text: Registration Form Title', 'trim|required');
     $this->form_validation->set_rules('txtIntro', 'Registration Form Introductory Text', 'trim|required');
     $this->form_validation->set_rules('txtSubmissionText', 'Text Shown After Submission', 'trim|required');
     $this->form_validation->set_rules('txtVolCoordinatorEmail', 'Volunteer Coordinator Email', 'trim|required|valid_email');
     $this->form_validation->set_rules('chkAddrShow', 'Show', 'trim');
     $this->form_validation->set_rules('chkPermContactInfo', 'Show', 'trim');
     $this->form_validation->set_rules('chkPermPassReset', 'Show', 'trim');
     $this->form_validation->set_rules('chkPermGiftHistory', 'Show', 'trim');
     $this->form_validation->set_rules('chkPermJobSkills', 'Show', 'trim');
     $this->form_validation->set_rules('chkPermViewVolLog', 'Show', 'trim');
     $this->form_validation->set_rules('chkPermAddVolHrs', 'Show', 'trim');
     $this->form_validation->set_rules('chkPermVolShiftSignup', 'Show', 'trim');
     $this->form_validation->set_rules('chkAddrShow', 'Show', 'trim');
     $this->form_validation->set_rules('chkAddrReq', 'Required', 'trim');
     $this->form_validation->set_rules('chkEmailShow', 'Show', 'callback_validateEmailPerms');
     $this->form_validation->set_rules('chkEmailReq', 'Required', 'trim');
     $this->form_validation->set_rules('chkPhoneShow', 'Show', 'trim');
     $this->form_validation->set_rules('chkPhoneReq', 'Required', 'trim');
     $this->form_validation->set_rules('chkCellShow', 'Show', 'trim');
     $this->form_validation->set_rules('chkCellReq', 'Required', 'trim');
     $this->form_validation->set_rules('chkBDayShow', 'Show', 'trim');
     $this->form_validation->set_rules('chkBDayReq', 'Required', 'trim');
     $this->form_validation->set_rules('rdoLogo', 'LogoID', 'trim');
     $this->form_validation->set_rules('ddlVolGroup', 'Volunteer Group ID', 'trim');
     $this->form_validation->set_rules('chkShowDisclaimer', 'Show Disclaimer', 'trim');
     $this->form_validation->set_rules('txtDisclaimerAck', 'Disclaimer Acknowledgement', 'callback_verifyDisclaimerAck');
     $this->form_validation->set_rules('txtDisclaimer', 'Disclaimer', 'callback_verifyDisclaimer');
     $this->form_validation->set_rules('ddlCSS', 'Stylesheet File', 'trim');
     /*
        load stylesheet files
     */
     $this->volReg->availableStyleSheets();
     $displayData['lNumStyleSheets'] = $this->volReg->lNumStyleSheets;
     $displayData['styleSheets'] = arrayCopy($this->volReg->styleSheets);
     /*
        job skills
     */
     $this->volReg->loadVolRegFormSkills($lRegFormID, true);
     $displayData['lNumSkills'] = $lNumSkills = $this->volReg->lNumSkillTot;
     if ($lNumSkills > 0) {
         $displayData['jobSkills'] = $jobSkills =& $this->volReg->skills;
         foreach ($jobSkills as $skill) {
             $lSkillID = $skill->lSkillID;
             $skill->chkShow = $chkShow = 'chkSkillShow_' . $lSkillID;
             $skill->bShow = false;
             $this->form_validation->set_rules($chkShow, 'Job Skill', '');
         }
     } else {
         $displayData['jobSkills'] = $jobSkills = null;
     }
     /*
        personalized volunteer tables
     */
     $this->load->model('personalization/muser_fields', 'clsUF');
     $this->load->model('admin/mpermissions', 'perms');
     $this->clsUF->enumTType = CENUM_CONTEXT_VOLUNTEER;
     $this->clsUF->loadTablesViaTType();
     $displayData['lNumTables'] = $lNumTables = $this->clsUF->lNumTables;
     if ($lNumTables > 0) {
         $displayData['userTables'] = $userTables =& $this->clsUF->userTables;
         foreach ($userTables as $utable) {
             $this->clsUF->lTableID = $lTableID = $utable->lKeyID;
             $this->clsUF->loadTableFields();
             // exclude log fields
             if ($this->clsUF->lNumFields > 0) {
                 foreach ($this->clsUF->fields as $field) {
                     if ($field->enumFieldType == CS_FT_LOG) {
                         --$this->clsUF->lNumFields;
                     } else {
                         $lFieldID = $field->pff_lKeyID;
                         $field->strFNShow = 'chkUFShow_' . $lTableID . '_' . $lFieldID;
                         $field->strFNRequired = 'chkUFReq_' . $lTableID . '_' . $lFieldID;
                         $this->volReg->bShowRequiredUFFields($lRegFormID, $lTableID, $lFieldID, $field->bShow, $field->bRequired);
                         $this->form_validation->set_rules($field->strFNShow, 'Personalized Field/Show', '');
                         $this->form_validation->set_rules($field->strFNRequired, 'Personalized Field/Required', '');
                     }
                 }
             }
             $utable->lNumFields = $lNumFields = $this->clsUF->lNumFields;
             if ($lNumFields > 0) {
                 $utable->fields = arrayCopy($this->clsUF->fields);
             }
             $utable->strTableLabel = $this->volReg->strPublicUFTable($lTableID, $lRegFormID, $utable->strUserTableName);
         }
     } else {
     }
     if ($this->form_validation->run() == FALSE) {
         $displayData['formData'] = new stdClass();
         $this->load->library('generic_form');
         $this->load->model('util/mlist_generic', 'clsList');
         $this->load->helper('dl_util/web_layout');
         $displayData['rRec'] = $rRec;
         // first time displayed, no user data entry errors
         if (validation_errors() == '') {
             if ($bNew) {
                 $displayData['formData']->txtRegFormName = '';
                 $displayData['formData']->txtDescription = '';
                 $displayData['formData']->txtBannerOrg = htmlspecialchars($gclsChapter->strChapterName);
                 $displayData['formData']->txtBannerTitle = 'Volunteer Registration';
                 $displayData['formData']->txtIntro = '';
                 $displayData['formData']->txtSubmissionText = '';
                 $displayData['formData']->txtVolCoordinatorEmail = '';
                 $displayData['formData']->bCaptchaRequired = true;
                 $displayData['formData']->bPermContactInfo = true;
                 $displayData['formData']->bPermPassReset = true;
                 $displayData['formData']->bPermGiftHistory = true;
                 $displayData['formData']->bPermJobSkills = true;
                 $displayData['formData']->bPermViewVolLog = true;
                 $displayData['formData']->bPermAddVolHrs = true;
                 $displayData['formData']->bVolShiftSignup = true;
                 $displayData['formData']->bShowAddr = true;
                 $displayData['formData']->bAddrRequired = true;
                 $displayData['formData']->bShowEmail = true;
                 $displayData['formData']->bEmailRequired = true;
                 $displayData['formData']->bShowPhone = true;
                 $displayData['formData']->bPhoneRequired = true;
                 $displayData['formData']->bShowCell = true;
                 $displayData['formData']->bCellRequired = true;
                 $displayData['formData']->bShowBDay = true;
                 $displayData['formData']->bBDayRequired = false;
                 $displayData['formData']->bShowDisclaimer = false;
                 $displayData['formData']->txtDisclaimer = '';
                 $displayData['formData']->txtDisclaimerAck = 'I agree to the terms stated below.';
                 $displayData['formData']->strDDLCSS = $this->volReg->strCSSDropDown('ddlCSS', 'default.css', false);
                 // organization logos
                 $this->cImgDoc->loadProfileImage(CENUM_CONTEXT_ORGANIZATION, $glChapterID);
                 if ($this->cImgDoc->lNumImageDocs == 0) {
                     $lLogoID = null;
                 } else {
                     $lLogoID = $this->cImgDoc->imageDocs[0]->lKeyID;
                 }
             } else {
                 $displayData['formData']->txtRegFormName = htmlspecialchars($rRec->strFormName);
                 $displayData['formData']->txtDescription = htmlspecialchars($rRec->strDescription);
                 $displayData['formData']->txtBannerOrg = htmlspecialchars($rRec->strBannerOrg);
                 $displayData['formData']->txtBannerTitle = htmlspecialchars($rRec->strBannerTitle);
                 $displayData['formData']->txtIntro = htmlspecialchars($rRec->strIntro);
                 $displayData['formData']->txtSubmissionText = htmlspecialchars($rRec->strSubmissionText);
                 $displayData['formData']->txtVolCoordinatorEmail = htmlspecialchars($rRec->strContactEmail);
                 $displayData['formData']->bCaptchaRequired = $rRec->bCaptchaRequired;
                 $displayData['formData']->bPermContactInfo = $rRec->bPermEditContact;
                 $displayData['formData']->bPermPassReset = $rRec->bPermPassReset;
                 $displayData['formData']->bPermGiftHistory = $rRec->bPermViewGiftHistory;
                 $displayData['formData']->bPermJobSkills = $rRec->bPermEditJobSkills;
                 $displayData['formData']->bPermViewVolLog = $rRec->bPermViewHrsHistory;
                 $displayData['formData']->bPermAddVolHrs = $rRec->bPermAddVolHours;
                 $displayData['formData']->bVolShiftSignup = $rRec->bVolShiftSignup;
                 $displayData['formData']->bShowAddr = $rRec->bShowAddr;
                 $displayData['formData']->bAddrRequired = $rRec->bAddrRequired;
                 $displayData['formData']->bShowEmail = $rRec->bShowEmail;
                 $displayData['formData']->bEmailRequired = $rRec->bEmailRequired;
                 $displayData['formData']->bShowPhone = $rRec->bShowPhone;
                 $displayData['formData']->bPhoneRequired = $rRec->bPhoneRequired;
                 $displayData['formData']->bShowCell = $rRec->bShowCell;
                 $displayData['formData']->bCellRequired = $rRec->bCellRequired;
                 $displayData['formData']->bShowBDay = $rRec->bShowBDay;
                 $displayData['formData']->bBDayRequired = $rRec->bBDateRequired;
                 $displayData['formData']->bShowDisclaimer = $rRec->bShowDisclaimer;
                 $displayData['formData']->txtDisclaimer = $rRec->strDisclaimer;
                 $displayData['formData']->txtDisclaimerAck = $rRec->strDisclaimerAck;
                 $displayData['formData']->strDDLCSS = $this->volReg->strCSSDropDown('ddlCSS', $rRec->strCSSFN, false);
                 $lLogoID = $rRec->lLogoImageID;
                 if ($lNumSkills > 0) {
                     foreach ($jobSkills as $skill) {
                         $skill->bShow = $skill->bOnForm;
                     }
                 }
             }
             // volunteer group ddl
             $displayData['formData']->ddlVolGroup = $this->groups->strDDLActiveGroupEntries('ddlVolGroup', CENUM_CONTEXT_VOLUNTEER, $rRec->lVolGroupID, true);
         } else {
             setOnFormError($displayData);
             $displayData['formData']->txtRegFormName = set_value('txtRegFormName');
             $displayData['formData']->txtDescription = set_value('txtDescription');
             $displayData['formData']->txtBannerOrg = set_value('txtBannerOrg');
             $displayData['formData']->txtBannerTitle = set_value('txtBannerTitle');
             $displayData['formData']->txtIntro = set_value('txtIntro');
             $displayData['formData']->txtSubmissionText = set_value('txtSubmissionText');
             $displayData['formData']->txtVolCoordinatorEmail = set_value('txtVolCoordinatorEmail');
             $displayData['formData']->bCaptchaRequired = set_value('chkCaptchaRequired') == 'true';
             $lLogoID = set_value('rdoLogo');
             $displayData['formData']->bPermContactInfo = set_value('chkPermContactInfo') == 'true';
             $displayData['formData']->bPermPassReset = set_value('chkPermPassReset') == 'true';
             $displayData['formData']->bPermGiftHistory = set_value('chkPermGiftHistory') == 'true';
             $displayData['formData']->bPermJobSkills = set_value('chkPermJobSkills') == 'true';
             $displayData['formData']->bPermViewVolLog = set_value('chkPermViewVolLog') == 'true';
             $displayData['formData']->bPermAddVolHrs = set_value('chkPermAddVolHrs') == 'true';
             $displayData['formData']->bVolShiftSignup = set_value('chkPermVolShiftSignup') == 'true';
             $displayData['formData']->bShowAddr = set_value('chkAddrShow') == 'true';
             $displayData['formData']->bAddrRequired = set_value('chkAddrReq') == 'true';
             $displayData['formData']->bShowEmail = set_value('chkEmailShow') == 'true';
             $displayData['formData']->bEmailRequired = set_value('chkEmailReq') == 'true';
             $displayData['formData']->bShowPhone = set_value('chkPhoneShow') == 'true';
             $displayData['formData']->bPhoneRequired = set_value('chkPhoneReq') == 'true';
             $displayData['formData']->bShowCell = set_value('chkCellShow') == 'true';
             $displayData['formData']->bCellRequired = set_value('chkCellReq') == 'true';
             $displayData['formData']->bShowBDay = set_value('chkBDayShow') == 'true';
             $displayData['formData']->bBDayRequired = set_value('chkBDayReq') == 'true';
             $displayData['formData']->bShowDisclaimer = set_value('chkShowDisclaimer') == 'true';
             $displayData['formData']->txtDisclaimer = set_value('txtDisclaimer');
             $displayData['formData']->txtDisclaimerAck = set_value('txtDisclaimerAck');
             // volunteer group ddl
             $displayData['formData']->ddlVolGroup = $this->groups->strDDLActiveGroupEntries('ddlVolGroup', CENUM_CONTEXT_VOLUNTEER, set_value('ddlVolGroup'), true);
             $displayData['formData']->strDDLCSS = $this->volReg->strCSSDropDown('ddlCSS', set_value('ddlCSS'), false);
             if ($lNumSkills > 0) {
                 foreach ($jobSkills as $skill) {
                     $skill->bShow = set_value($skill->chkShow) == 'true';
                 }
             }
             if ($lNumTables > 0) {
                 foreach ($userTables as $utable) {
                     if ($utable->lNumFields > 0) {
                         // exclude log fields
                         foreach ($utable->fields as $field) {
                             if ($field->enumFieldType != CS_FT_LOG) {
                                 $field->bShow = set_value($field->strFNShow) == 'true';
                                 $field->bRequired = set_value($field->strFNRequired) == 'true';
                             }
                         }
                     }
                 }
             }
         }
         // logo selection table
         $logoOpts = new stdClass();
         $logoOpts->enumEntryType = CENUM_IMGDOC_ENTRY_IMAGE;
         $logoOpts->enumContextType = CENUM_CONTEXT_ORGANIZATION;
         $logoOpts->lFID = $glChapterID;
         $logoOpts->lCellWidth = 90;
         $logoOpts->lCellHeight = 90;
         $logoOpts->lBorderWidth = 1;
         $logoOpts->lCellsPerRow = 4;
         $logoOpts->bShowCaption = false;
         $logoOpts->bShowDescription = false;
         $logoOpts->bShowDate = false;
         $logoOpts->bShowOriginalFN = false;
         $logoOpts->bAddRadioSelect = true;
         $logoOpts->strRadioFieldName = 'rdoLogo';
         $logoOpts->lMatchID = $lLogoID;
         $logoOpts->bShowNone = true;
         $logoOpts->strShowNoneLabel = 'No logo image';
         $displayData['formData']->rdoLogo = $this->cImgDoc->strImageDocTerseTable($logoOpts, $displayData['lNumLogoImages']);
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = anchor('main/menu/vols', 'Volunteers', 'class="breadcrumb"') . ' | ' . anchor('volunteers/registration/view', 'Registration', 'class="breadcrumb"') . ' | ' . ($bNew ? 'Add New' : 'Edit') . '  Form';
         $displayData['title'] = CS_PROGNAME . ' | Volunteers';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'vol_reg/reg_form_add_edit_view';
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         // internal fields
         $rRec->strFormName = trim($_POST['txtRegFormName']);
         $rRec->strContactEmail = trim($_POST['txtVolCoordinatorEmail']);
         $rRec->strDescription = trim($_POST['txtDescription']);
         $rRec->bCaptchaRequired = trim(@$_POST['chkCaptchaRequired']) == 'true';
         $rRec->lLogoImageID = (int) @$_POST['rdoLogo'];
         if ($rRec->lLogoImageID <= 0) {
             $rRec->lLogoImgID = null;
         }
         $rRec->lVolGroupID = (int) @$_POST['ddlVolGroup'];
         if ($rRec->lVolGroupID <= 0) {
             $rRec->lVolGroupID = null;
         }
         $rRec->strCSSFN = trim(@$_POST['ddlCSS']);
         // form registration permissions
         $rRec->bPermEditContact = trim(@$_POST['chkPermContactInfo']) == 'true';
         $rRec->bPermPassReset = trim(@$_POST['chkPermPassReset']) == 'true';
         $rRec->bPermViewGiftHistory = trim(@$_POST['chkPermGiftHistory']) == 'true';
         $rRec->bPermEditJobSkills = trim(@$_POST['chkPermJobSkills']) == 'true';
         $rRec->bPermViewHrsHistory = trim(@$_POST['chkPermViewVolLog']) == 'true';
         $rRec->bPermAddVolHours = trim(@$_POST['chkPermAddVolHrs']) == 'true';
         $rRec->bVolShiftSignup = trim(@$_POST['chkPermVolShiftSignup']) == 'true';
         // top banner
         $rRec->strBannerOrg = trim($_POST['txtBannerOrg']);
         $rRec->strBannerTitle = trim($_POST['txtBannerTitle']);
         $rRec->strIntro = trim($_POST['txtIntro']);
         $rRec->strSubmissionText = trim($_POST['txtSubmissionText']);
         // Standard Fields - show
         $rRec->bShowFName = true;
         $rRec->bShowLName = true;
         $rRec->bShowAddr = trim(@$_POST['chkAddrShow']) == 'true';
         $rRec->bShowEmail = trim(@$_POST['chkEmailShow']) == 'true';
         $rRec->bShowPhone = trim(@$_POST['chkPhoneShow']) == 'true';
         $rRec->bShowCell = trim(@$_POST['chkCellShow']) == 'true';
         $rRec->bShowBDay = trim(@$_POST['chkBDayShow']) == 'true';
         // Standard Fields - required
         $rRec->bFNameRequired = true;
         $rRec->bLNameRequired = true;
         $rRec->bAddrRequired = trim(@$_POST['chkAddrReq']) == 'true';
         $rRec->bEmailRequired = trim(@$_POST['chkEmailReq']) == 'true';
         $rRec->bPhoneRequired = trim(@$_POST['chkPhoneReq']) == 'true';
         $rRec->bCellRequired = trim(@$_POST['chkCellReq']) == 'true';
         $rRec->bBDateRequired = trim(@$_POST['chkBDayReq']) == 'true';
         // Disclaimer
         $rRec->bShowDisclaimer = $rRec->bDisclaimerAckRqrd = trim(@$_POST['chkShowDisclaimer']) == 'true';
         $rRec->strDisclaimer = trim($_POST['txtDisclaimer']);
         $rRec->strDisclaimerAck = trim($_POST['txtDisclaimerAck']);
         // Job Skills
         if ($lNumSkills > 0) {
             foreach ($jobSkills as $skill) {
                 $skill->bShow = trim(@$_POST[$skill->chkShow]) == 'true';
             }
         }
         // personalized tables
         if ($lNumTables > 0) {
             foreach ($userTables as $utable) {
                 if ($utable->lNumFields > 0) {
                     foreach ($utable->fields as $field) {
                         if ($field->enumFieldType != CS_FT_LOG) {
                             $field->bShow = trim(@$_POST[$field->strFNShow]) == 'true';
                             $field->bRequired = trim(@$_POST[$field->strFNRequired]) == 'true';
                         }
                     }
                 }
             }
         }
         if ($bNew) {
             $lRegFormID = addNewCustomForm(CENUM_CONTEXT_VOLUNTEER, $rRec);
         } else {
             updateCustomForm(CENUM_CONTEXT_VOLUNTEER, $lRegFormID, $rRec);
         }
         $this->volReg->updateJobSkillFields($lRegFormID, $lNumSkills, $jobSkills);
         updateFormPTableFields(CENUM_CONTEXT_VOLUNTEER, $lRegFormID, $lNumTables, $userTables);
         $this->session->set_flashdata('msg', 'The registration form was ' . ($bNew ? 'added' : 'updated') . '.');
         redirect('volunteers/registration/view');
     }
 }
示例#27
0
 public function shifts($lNumMonths = '4')
 {
     //-------------------------------------------------------------------------
     //
     //-------------------------------------------------------------------------
     global $gbVolLogin, $glVolPeopleID, $gdteNow;
     if (!bTestForURLHack('volViewHours')) {
         return;
     }
     $displayData = array();
     $displayData['js'] = '';
     //--------------------------------
     // Models & Helpers
     //--------------------------------
     $this->load->helper('dl_util/time_date');
     $this->load->helper('dl_util/web_layout');
     $this->load->helper('vols/vol');
     $this->load->helper('dl_util/time_duration_helper');
     $this->load->model('vols/mvol', 'clsVol');
     $this->load->model('vols/mvol_event_dates', 'clsVolEventDates');
     $this->load->model('vols/mvol_event_hours', 'clsVolHours');
     $this->load->model('vols/mvol_event_dates_shifts_vols', 'clsSV');
     $this->load->model('vols/mvol_event_dates_shifts', 'clsShifts');
     $this->load->helper('js/div_hide_show');
     $displayData['js'] .= showHideDiv();
     $displayData['lVolID'] = $lVolID = $this->clsVol->lVolIDViaPeopleID($glVolPeopleID);
     //------------------------------------------------
     // stripes
     //------------------------------------------------
     $this->load->model('util/mbuild_on_ready', 'clsOnReady');
     $this->clsOnReady->addOnReadyTableStripes();
     $this->clsOnReady->closeOnReady();
     $displayData['js'] .= $this->clsOnReady->strOnReady;
     $lNumMonths = (int) $lNumMonths;
     numsMoDaYr($gdteNow, $lMonth, $lDay, $lYear);
     $events = array();
     for ($idx = 0; $idx < $lNumMonths; ++$idx) {
         $this->clsVolEventDates->eventIDsViaMonth($lMonth, $lYear, $eventsMonths[$idx]);
         $eMonth =& $eventsMonths[$idx];
         if ($eMonth->lNumEvents > 0) {
             foreach ($eMonth->events as $event) {
                 $lEventID = $event->lEventID;
                 $strWhere = " AND ved_lVolEventID={$lEventID}\n                             AND MONTH(ved_dteEvent)={$lMonth}\n                             AND YEAR(ved_dteEvent)={$lYear} ";
                 $this->clsVolEventDates->loadEventDatesArray($strWhere);
                 $event->dates = arrayCopy($this->clsVolEventDates->dates);
                 // load shifts for each date
                 if ($event->lNumDates > 0) {
                     foreach ($event->dates as $eDate) {
                         $lDateID = $eDate->lKeyID;
                         $this->clsVolEventDates->shiftsByDateID($lDateID, $eDate->shifts, $eDate->lNumShifts);
                         if ($eDate->lNumShifts > 0) {
                             foreach ($eDate->shifts as $shift) {
                                 $shift->bCurrentVolRegistered = false;
                                 if ($shift->lNumVols > 0) {
                                     foreach ($shift->vols as $registeredVol) {
                                         if ($registeredVol->lVolID == $lVolID) {
                                             $shift->bCurrentVolRegistered = true;
                                             $shift->lCurVolAssignID = $registeredVol->lAssignID;
                                             break;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         ++$lMonth;
         if ($lMonth > 12) {
             $lMonth = 1;
             ++$lYear;
         }
     }
     $displayData['eventsMonths'] =& $eventsMonths;
     // breadcrumbs and navigation
     $displayData['pageTitle'] = 'Volunteer Registration';
     $displayData['mainTemplate'] = 'vols/register_upcoming_view';
     $displayData['title'] = CS_PROGNAME . ' | Upcoming Events';
     $displayData['nav'] = $this->mnav_brain_jar->navData();
     $this->load->vars($displayData);
     $this->load->view('template');
 }
示例#28
0
 public function addEditPatientVisit($lVolID, $lPVRecID = 0, $lPatientID = 0)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $glChapterID, $gbVolMgr, $gbDateFormatUS, $gstrFormatDatePicker;
     $this->load->helper('dl_util/verify_id');
     verifyID($glChapterID, $lPatientID, 'patient ID');
     verifyID($glChapterID, $lVolID, 'volunteer ID');
     if ($lPVRecID != 0) {
         verifyID($glChapterID, $lPVRecID, 'patientVisit ID');
     }
     $displayData = array();
     $displayData['formData'] = new stdClass();
     $displayData['lVolID'] = $lVolID = (int) $lVolID;
     $displayData['lPVRecID'] = $lPVRecID = (int) $lPVRecID;
     $displayData['lPatientID'] = $lPatientID = (int) $lPatientID;
     $displayData['bNew'] = $bNew = $lPVRecID <= 0;
     //----------------------------------------------
     // models / helpers
     //----------------------------------------------
     $this->load->library('util/dl_date_time', '', 'clsDateTime');
     $this->load->model('patients/mpatients', 'cPatients');
     $this->load->model('vols/mvol', 'cVol');
     $this->load->model('util/mlist_generic', 'cList');
     $this->load->model('hospice/mhospice_pvisit', 'cPVisit');
     $this->load->helper('dl_util/web_layout');
     $this->load->helper('dl_util/time_date');
     $this->load->helper('hospice/patient_visit');
     $this->load->helper('hospice/hospice_util');
     $this->cVol->loadVolClientAssocViaVolID($lVolID, $volClients, false);
     if (!hospiceUtil\bVerifyVolClientAssoc($lVolID, $lPatientID, $volClients, $lVCIDX)) {
         $this->session->set_flashdata('error', 'Invalid volunteer/patient association. Please contact your volunteer manager.');
         redirect('hospice/hospice_error/error');
         return;
     }
     // load patient record
     $this->cPatients->loadPatientsViaPatientID($lPatientID);
     $displayData['patient'] =& $this->cPatients->patients[0];
     // load volunteer record
     $this->cVol->loadVolRecsViaVolID($lVolID, false);
     $displayData['volRec'] = $volRec =& $this->cVol->volRecs[0];
     // load patient visit record
     $this->cPVisit->loadPVisitsViaVisitID($lPVRecID, $lNumPVRecs, $pVisits);
     $displayData['pVisit'] = $pVisit =& $pVisits[0];
     // validation rules
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     $this->form_validation->set_rules('txtMedRecNum', '<b>Medical Record Number</b>', 'trim|required');
     $this->form_validation->set_rules('ddlDuration', '', 'trim|callback_verifyDurationDDL');
     $this->form_validation->set_rules('ddlStart', '', 'trim|callback_verifyStartTimeDDL');
     $this->form_validation->set_rules('txtDateOfVisit', '<b>Visit Date</b>', 'trim|required|callback_verifyVisitDate');
     // person served
     $this->form_validation->set_rules('chkPS_Patient');
     $this->form_validation->set_rules('chkPS_Caregiver');
     $this->form_validation->set_rules('chkPS_Bereaved');
     $this->form_validation->set_rules('chkPS_Other');
     $this->form_validation->set_rules('txtPS_Notes', '', 'trim|callback_verifyPS');
     // location
     $this->form_validation->set_rules('ddlLocation', '', 'trim|callback_verifyLocation');
     $this->form_validation->set_rules('txtLocationNotes', '', 'trim|callback_verifyLocationNotes');
     // Activity
     $this->form_validation->set_rules('ddlActivity', '', 'trim|callback_verifyActivity');
     $this->form_validation->set_rules('txtActivityNotes', '', 'trim|callback_verifyActivityNotes');
     // Interventions
     $this->form_validation->set_rules('chkI_Companionship');
     $this->form_validation->set_rules('chkI_CaregiverRelief');
     $this->form_validation->set_rules('chkI_EmotionalSupport');
     $this->form_validation->set_rules('chkI_Socialization');
     $this->form_validation->set_rules('chkI_Bereavement');
     $this->form_validation->set_rules('chkI_TelephoneCall');
     $this->form_validation->set_rules('chkI_ExcursionErrands');
     $this->form_validation->set_rules('chkI_MusicPetArtSupport');
     $this->form_validation->set_rules('chkI_FoodPreparation');
     $this->form_validation->set_rules('chkI_HouseholdChores');
     $this->form_validation->set_rules('chkI_OtherIntervention');
     $this->form_validation->set_rules('txtI_Notes', '', 'trim|callback_verifyIntervention');
     // Visit Info
     $this->form_validation->set_rules('ddlM_PatientStatus', '', 'callback_verifyPatientStatus');
     $this->form_validation->set_rules('ddlM_VisitTasks', '', 'callback_verifyVisitTasks');
     $this->form_validation->set_rules('txtVisitNotes', '', 'trim|callback_verifyVisitNotes');
     $this->form_validation->set_rules('chkTSK_Visitors');
     $this->form_validation->set_rules('txtTSKPatientComfort', '<b>Patient Comfort</b>', 'trim|required');
     $this->form_validation->set_rules('txtTSKPatientPain');
     $this->form_validation->set_rules('txtTSKPatientConcerns');
     if ($this->form_validation->run() == FALSE) {
         $matchIDs_PStatus = array();
         $matchIDs_VTasks = array();
         $displayData['js'] = '';
         $this->load->library('generic_form');
         if (validation_errors() == '') {
             if ($bNew) {
                 $displayData['formData']->txtDateOfVisit = $displayData['formData']->txtMedRecNum = '';
                 $displayData['formData']->ddlDuration = pvisit\strDurationDDL(-1, true, 'ddlDuration', 'dur');
                 $displayData['formData']->ddlStart = pvisit\strTimeDDL(-1, true, 'ddlStart', 'start');
                 // person served
                 $displayData['formData']->ps_bPatient = $displayData['formData']->ps_bCaregiver = $displayData['formData']->ps_bBereaved = $displayData['formData']->ps_bOther = false;
                 $displayData['formData']->ps_txtNotes = '';
                 // location
                 $this->cList->enumListType = CENUM_LISTTYPE_PV_LOCATIONS;
                 $displayData['formData']->ddlLocation = $this->cList->strLoadListDDL($glChapterID, 'ddlLocation', true, -1);
                 $displayData['formData']->txtLocationNotes = '';
                 // Activity
                 $this->cList->enumListType = CENUM_LISTTYPE_PV_ACTIVITIES;
                 $displayData['formData']->ddlActivity = $this->cList->strLoadListDDL($glChapterID, 'ddlActivity', true, -1);
                 $displayData['formData']->txtActivityNotes = '';
                 // Interventions
                 $displayData['formData']->i_bCompanionship = $displayData['formData']->i_bCaregiverRelief = $displayData['formData']->i_bEmotionalSupport = $displayData['formData']->i_bSocialization = $displayData['formData']->i_bBereavement = $displayData['formData']->i_bTelephoneCall = $displayData['formData']->i_bExcursionErrands = $displayData['formData']->i_bMusicPetArtSupport = $displayData['formData']->i_bFoodPreparation = $displayData['formData']->i_bHouseholdChores = $displayData['formData']->i_bOtherIntervention = false;
                 $displayData['formData']->txtI_Notes = '';
                 // Visit Info
                 $this->cList->enumListType = CENUM_LISTTYPE_PV_PSTATUS;
                 $displayData['formData']->ddlM_PatientStatus = $this->cList->strLoadListMultiDDL($glChapterID, 'ddlM_PatientStatus', 5, true, $matchIDs_PStatus);
                 $this->cList->enumListType = CENUM_LISTTYPE_PV_VISITTASKS;
                 $displayData['formData']->ddlM_VisitTasks = $this->cList->strLoadListMultiDDL($glChapterID, 'ddlM_VisitTasks', 5, true, $matchIDs_VTasks);
                 $displayData['formData']->txtVisitNotes = '';
                 $displayData['formData']->TSK_bVisitors = false;
                 $displayData['formData']->txtTSKPatientComfort = '';
                 $displayData['formData']->txtTSKPatientPain = '';
                 $displayData['formData']->txtTSKPatientConcerns = '';
             } else {
                 $displayData['formData']->txtDateOfVisit = strNumericDateViaMysqlDate($pVisit->mdteVisit, $gbDateFormatUS);
                 $displayData['formData']->txtMedRecNum = htmlspecialchars($pVisit->strMedRec);
                 $displayData['formData']->ddlDuration = pvisit\strDurationDDL($pVisit->lDuration, true, 'ddlDuration', 'dur');
                 $displayData['formData']->ddlStart = pvisit\strTimeDDL($pVisit->lStartTime, true, 'ddlStart', 'start');
                 // person served
                 $displayData['formData']->ps_bPatient = $pVisit->ps_bPatient;
                 $displayData['formData']->ps_bCaregiver = $pVisit->ps_bCaregiver;
                 $displayData['formData']->ps_bBereaved = $pVisit->ps_bBereaved;
                 $displayData['formData']->ps_bOther = $pVisit->ps_bOther;
                 $displayData['formData']->ps_txtNotes = htmlspecialchars($pVisit->ps_strNotes);
                 // location
                 $this->cList->enumListType = CENUM_LISTTYPE_PV_LOCATIONS;
                 $displayData['formData']->ddlLocation = $this->cList->strLoadListDDL($glChapterID, 'ddlLocation', true, $pVisit->loc_lLocationID);
                 $displayData['formData']->txtLocationNotes = htmlspecialchars($pVisit->loc_strNotes);
                 // Activity
                 $this->cList->enumListType = CENUM_LISTTYPE_PV_ACTIVITIES;
                 $displayData['formData']->ddlActivity = $this->cList->strLoadListDDL($glChapterID, 'ddlActivity', true, $pVisit->act_lActivityID);
                 $displayData['formData']->txtActivityNotes = htmlspecialchars($pVisit->act_strNotes);
                 // Interventions
                 $displayData['formData']->i_bCompanionship = $pVisit->in_bCompanionship;
                 $displayData['formData']->i_bCaregiverRelief = $pVisit->in_bCaregiverRelief;
                 $displayData['formData']->i_bEmotionalSupport = $pVisit->in_bEmotionalSupport;
                 $displayData['formData']->i_bSocialization = $pVisit->in_bSocialization;
                 $displayData['formData']->i_bBereavement = $pVisit->in_bBereavement;
                 $displayData['formData']->i_bTelephoneCall = $pVisit->in_bTelephoneCall;
                 $displayData['formData']->i_bExcursionErrands = $pVisit->in_bExcursionErrands;
                 $displayData['formData']->i_bMusicPetArtSupport = $pVisit->in_bMusicPetArt;
                 $displayData['formData']->i_bFoodPreparation = $pVisit->in_bFoodPrep;
                 $displayData['formData']->i_bHouseholdChores = $pVisit->in_bHouseholdChores;
                 $displayData['formData']->i_bOtherIntervention = $pVisit->in_bOther;
                 $displayData['formData']->txtI_Notes = htmlspecialchars($pVisit->in_strNotes);
                 // Visit Info
                 $this->cList->enumListType = CENUM_LISTTYPE_PV_PSTATUS;
                 $displayData['formData']->ddlM_PatientStatus = $this->cList->strLoadListMultiDDL($glChapterID, 'ddlM_PatientStatus', 5, true, $pVisit->status->IDs);
                 $this->cList->enumListType = CENUM_LISTTYPE_PV_VISITTASKS;
                 $displayData['formData']->ddlM_VisitTasks = $this->cList->strLoadListMultiDDL($glChapterID, 'ddlM_VisitTasks', 5, true, $pVisit->tasks->IDs);
                 $displayData['formData']->txtVisitNotes = htmlspecialchars($pVisit->tsk_strOtherNotes);
                 $displayData['formData']->TSK_bVisitors = $pVisit->tsk_bVisitors;
                 $displayData['formData']->txtTSKPatientComfort = htmlspecialchars($pVisit->tsk_strPatientComfort);
                 $displayData['formData']->txtTSKPatientPain = htmlspecialchars($pVisit->tsk_strPatientPain);
                 $displayData['formData']->txtTSKPatientConcerns = htmlspecialchars($pVisit->tsk_strChangesConcerns);
             }
         } else {
             setOnFormError($displayData);
             $displayData['formData']->txtDateOfVisit = set_value('txtDateOfVisit');
             $displayData['formData']->txtMedRecNum = set_value('txtMedRecNum');
             $displayData['formData']->ddlDuration = pvisit\strDurationDDL(set_value('ddlDuration'), true, 'ddlDuration', 'dur');
             $displayData['formData']->ddlStart = pvisit\strTimeDDL(set_value('ddlStart'), true, 'ddlStart', 'start');
             // person served
             $displayData['formData']->ps_bPatient = set_value('chkPS_Patient') == 'TRUE';
             $displayData['formData']->ps_bCaregiver = set_value('chkPS_Caregiver') == 'TRUE';
             $displayData['formData']->ps_bBereaved = set_value('chkPS_Bereaved') == 'TRUE';
             $displayData['formData']->ps_bOther = set_value('chkPS_Other') == 'TRUE';
             $displayData['formData']->ps_txtNotes = set_value('txtPS_Notes');
             // location
             $this->cList->enumListType = CENUM_LISTTYPE_PV_LOCATIONS;
             $displayData['formData']->ddlLocation = $this->cList->strLoadListDDL($glChapterID, 'ddlLocation', true, (int) @$_POST['ddlLocation']);
             $displayData['formData']->txtLocationNotes = set_value('txtLocationNotes');
             // Activity
             $this->cList->enumListType = CENUM_LISTTYPE_PV_ACTIVITIES;
             $displayData['formData']->ddlActivity = $this->cList->strLoadListDDL($glChapterID, 'ddlActivity', true, (int) @$_POST['ddlActivity']);
             $displayData['formData']->txtActivityNotes = set_value('txtActivityNotes');
             // Interventions
             $displayData['formData']->i_bCompanionship = set_value('chkI_Companionship') == 'TRUE';
             $displayData['formData']->i_bCaregiverRelief = set_value('chkI_CaregiverRelief') == 'TRUE';
             $displayData['formData']->i_bEmotionalSupport = set_value('chkI_EmotionalSupport') == 'TRUE';
             $displayData['formData']->i_bSocialization = set_value('chkI_Socialization') == 'TRUE';
             $displayData['formData']->i_bBereavement = set_value('chkI_Bereavement') == 'TRUE';
             $displayData['formData']->i_bTelephoneCall = set_value('chkI_TelephoneCall') == 'TRUE';
             $displayData['formData']->i_bExcursionErrands = set_value('chkI_ExcursionErrands') == 'TRUE';
             $displayData['formData']->i_bMusicPetArtSupport = set_value('chkI_MusicPetArtSupport') == 'TRUE';
             $displayData['formData']->i_bFoodPreparation = set_value('chkI_FoodPreparation') == 'TRUE';
             $displayData['formData']->i_bHouseholdChores = set_value('chkI_HouseholdChores') == 'TRUE';
             $displayData['formData']->i_bOtherIntervention = set_value('chkI_OtherIntervention') == 'TRUE';
             $displayData['formData']->txtI_Notes = set_value('txtI_Notes');
             // Visit Info
             $this->cList->enumListType = CENUM_LISTTYPE_PV_PSTATUS;
             $this->loadMultiIDs('ddlM_PatientStatus', $matchIDs_PStatus);
             $displayData['formData']->ddlM_PatientStatus = $this->cList->strLoadListMultiDDL($glChapterID, 'ddlM_PatientStatus', 5, true, $matchIDs_PStatus);
             $this->cList->enumListType = CENUM_LISTTYPE_PV_VISITTASKS;
             $this->loadMultiIDs('ddlM_VisitTasks', $matchIDs_VTasks);
             $displayData['formData']->ddlM_VisitTasks = $this->cList->strLoadListMultiDDL($glChapterID, 'ddlM_VisitTasks', 5, true, $matchIDs_VTasks);
             $displayData['formData']->txtVisitNotes = set_value('txtVisitNotes');
             $displayData['formData']->TSK_bVisitors = set_value('chkTSK_Visitors') == 'TRUE';
             $displayData['formData']->txtTSKPatientComfort = set_value('txtTSKPatientComfort');
             $displayData['formData']->txtTSKPatientPain = set_value('txtTSKPatientPain');
             $displayData['formData']->txtTSKPatientConcerns = set_value('txtTSKPatientConcerns');
         }
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = ' Patient Visit';
         $displayData['title'] = CS_PROGNAME . ' | Patient Visit';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'hospice/patient_visit_add_edit_view';
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         $pVisit->lChapterID = $glChapterID;
         $pVisit->lPatientID = $lPatientID;
         $pVisit->lVolID = $lVolID;
         $strDate = trim($_POST['txtDateOfVisit']);
         MDY_ViaUserForm($strDate, $lMon, $lDay, $lYear, $gbDateFormatUS);
         $pVisit->dteVisit = mktime(0, 0, 0, $lMon, $lDay, $lYear);
         $pVisit->lStartTime = (int) $_POST['ddlStart'];
         $pVisit->lDuration = (int) $_POST['ddlDuration'];
         $pVisit->strMedRec = $_POST['txtMedRecNum'];
         $pVisit->ps_bPatient = @$_POST['chkPS_Patient'] == 'TRUE';
         $pVisit->ps_bCaregiver = @$_POST['chkPS_Caregiver'] == 'TRUE';
         $pVisit->ps_bBereaved = @$_POST['chkPS_Bereaved'] == 'TRUE';
         $pVisit->ps_bOther = @$_POST['chkPS_Other'] == 'TRUE';
         $pVisit->ps_strNotes = $_POST['txtPS_Notes'];
         $pVisit->act_lActivityID = (int) $_POST['ddlActivity'];
         $pVisit->act_strNotes = $_POST['txtActivityNotes'];
         $pVisit->loc_lLocationID = (int) $_POST['ddlLocation'];
         $pVisit->loc_strNotes = $_POST['txtLocationNotes'];
         $pVisit->in_bCompanionship = @$_POST['chkI_Companionship'] == 'TRUE';
         $pVisit->in_bCaregiverRelief = @$_POST['chkI_CaregiverRelief'] == 'TRUE';
         $pVisit->in_bEmotionalSupport = @$_POST['chkI_EmotionalSupport'] == 'TRUE';
         $pVisit->in_bSocialization = @$_POST['chkI_Socialization'] == 'TRUE';
         $pVisit->in_bBereavement = @$_POST['chkI_Bereavement'] == 'TRUE';
         $pVisit->in_bTelephoneCall = @$_POST['chkI_TelephoneCall'] == 'TRUE';
         $pVisit->in_bExcursionErrands = @$_POST['chkI_ExcursionErrands'] == 'TRUE';
         $pVisit->in_bMusicPetArt = @$_POST['chkI_MusicPetArtSupport'] == 'TRUE';
         $pVisit->in_bFoodPrep = @$_POST['chkI_FoodPreparation'] == 'TRUE';
         $pVisit->in_bHouseholdChores = @$_POST['chkI_HouseholdChores'] == 'TRUE';
         $pVisit->in_bOther = @$_POST['chkI_OtherIntervention'] == 'TRUE';
         $pVisit->in_strNotes = $_POST['txtI_Notes'];
         $pVisit->tsk_strOtherNotes = $_POST['txtVisitNotes'];
         $pVisit->tsk_bVisitors = @$_POST['chkTSK_Visitors'] == 'TRUE';
         $pVisit->tsk_strPatientComfort = $_POST['txtTSKPatientComfort'];
         $pVisit->tsk_strPatientPain = $_POST['txtTSKPatientPain'];
         $pVisit->tsk_strChangesConcerns = $_POST['txtTSKPatientConcerns'];
         // multi-select DDLs
         $pVisit->status = new stdClass();
         $pVisit->status->IDs = arrayCopy($_POST['ddlM_PatientStatus']);
         $pVisit->status->lNumInList = count($pVisit->status->IDs);
         $pVisit->tasks = new stdClass();
         $pVisit->tasks->IDs = arrayCopy($_POST['ddlM_VisitTasks']);
         $pVisit->tasks->lNumInList = count($pVisit->tasks->IDs);
         if ($bNew) {
             $lPVRecID = $this->cPVisit->lAddNewPVisit($pVisit);
             $this->session->set_flashdata('msg', 'The patient visit record was added.');
         } else {
             $this->cPVisit->updatePVisit($lPVRecID, $pVisit);
             $this->session->set_flashdata('msg', 'The patient visit record was updated.');
         }
         redirect('hospice/patient_visit/visitRecView/' . $lPVRecID);
     }
 }
示例#29
0
 private function importDetailsVolunteers($lImportID, &$displayData, $bViaPTable = false, $logEntry = null)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     //------------------------------------------------
     // define columns to display
     //------------------------------------------------
     initVolReportDisplay($displayData);
     $displayData['showFields']->bSkills = true;
     if ($this->clsImport->lNumFIDs > 0) {
         if ($bViaPTable) {
             $strVIDs = implode(',', $this->clsImport->pTableForeignIDsViaImportID($lImportID, $logEntry->lUTableID, $lNumFIDs));
         } else {
             screamForHelp('Volunteers: invalid import type<br>error on line  <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
         }
         $strWhereExtra = " AND vol_lKeyID IN ({$strVIDs}) ";
         $this->clsVol->loadVolDirectoryPage($strWhereExtra, 0, 99999);
         $displayData['lNumDisplayRows'] = $displayData['lNumVols'] = $lNumVols = $this->clsVol->lNumVolRecs;
     }
     if ($lNumVols) {
         foreach ($this->clsVol->volRecs as $volRec) {
             $this->clsVolSkills->lVolID = $lVolID = $volRec->lKeyID;
             $this->clsVolSkills->loadSingleVolSkills();
             $volRec->lNumJobSkills = $lNumSkills = $this->clsVolSkills->lNumSingleVolSkills;
             if ($lNumSkills > 0) {
                 $volRec->volSkills = arrayCopy($this->clsVolSkills->singleVolSkills);
             }
         }
     }
     $displayData['vols'] =& $this->clsVol->volRecs;
     $displayData['strRptTitle'] = 'Import Log Details';
     $displayData['mainTemplate'] = array('admin/import_summary_view', 'vols/rpt_generic_vol_list');
 }
示例#30
0
 function view_generic($strShowInactive = 'true', $strLookupLetter = 'A', $lStartRec = 0, $lRecsPerPage = 50)
 {
     //------------------------------------------------------------------------------
     //
     //------------------------------------------------------------------------------
     global $glChapterID;
     if (!bTestForURLHack('volMgr')) {
         return;
     }
     $strLookupLetter = urldecode($strLookupLetter);
     $displayData = array();
     $displayData['bShowInactive'] = $bShowInactive = strtoupper($strShowInactive) == 'TRUE';
     $displayData['js'] = '';
     //------------------------------------------------
     // models / libraries / helpers
     //------------------------------------------------
     $this->load->helper('people/people');
     $this->load->helper('people/people_display');
     $this->load->model('vols/mvol', 'clsVol');
     $this->load->model('vols/mvol_skills', 'clsVolSkills');
     $this->load->helper('vols/vol');
     $this->load->helper('dl_util/time_duration_helper');
     $this->load->helper('dl_util/directory');
     $this->load->helper('dl_util/rs_navigate');
     $this->load->helper('hospice/link_hospice');
     $this->load->helper('dl_util/record_view');
     $this->load->helper('img_docs/link_img_docs');
     $params = array('enumStyle' => 'terse');
     $this->load->library('generic_rpt', $params);
     $this->load->library('util/dl_date_time', '', 'clsDateTime');
     //------------------------------------------------
     // sanitize the lookup letter
     //------------------------------------------------
     $displayData['strDirLetter'] = $strLookupLetter = strSanitizeLetter($strLookupLetter);
     // the toggle-a-tizer
     $strLabelToggle = ($bShowInactive ? '<b>Hide</b>' : '<b>Show</b> active and ') . ' inactive volunteers';
     $strLinkEnd = $lStartRec . '/' . $lRecsPerPage;
     $displayData['strToggleLink'] = anchor('hospice/vols/vol_directory/view/' . ($bShowInactive ? 'false' : 'true') . '/' . ($strLookupLetter == '*' ? '%2A' : $strLookupLetter) . '/' . $strLinkEnd, $strLabelToggle);
     //------------------------------------------------
     // stripes
     //------------------------------------------------
     $this->load->model('util/mbuild_on_ready', 'clsOnReady');
     $this->clsOnReady->addOnReadyTableStripes();
     $this->clsOnReady->closeOnReady();
     $displayData['js'] .= $this->clsOnReady->strOnReady;
     //------------------------------------------------
     // define columns to display
     //------------------------------------------------
     initVolReportDisplay($displayData);
     $displayData['showFields']->bSkills = true;
     //------------------------------------------------
     // set up directory display
     //------------------------------------------------
     $displayData['strRptTitle'] = 'Volunteer Directory <span style="font-weight: normal;">(' . ($bShowInactive ? 'Active and Inactive' : 'Active Only') . ')</span>';
     $displayData['strLinkBase'] = $strLinkBase = 'hospice/vols/vol_directory/view/' . ($bShowInactive ? 'true' : 'false') . '/';
     $strWhereExtraReg = " AND vol_lChapterID={$glChapterID} ";
     $displayData['strDirLetter'] = $strLookupLetter;
     $displayData['strDirTitle'] = strDisplayDirectory($strLinkBase, ' class="directoryLetters" ', $strLookupLetter, true, $lStartRec, $lRecsPerPage);
     //------------------------------------------------
     // total # people for this letter
     //------------------------------------------------
     $displayData['lNumRecsTot'] = $lNumRecsTot = lNumVolRecsViaLetter($glChapterID, $strLookupLetter, CENUM_CONTEXT_VOLUNTEER, $bShowInactive, $strWhereExtraReg);
     $displayData['lNumVols'] = $lNumRecsTot;
     $displayData['strPeopleType'] = 'volunteer';
     //------------------------------------------------
     // load volunteer directory page
     //------------------------------------------------
     $strWhereExtra = $this->clsVol->strWhereByLetter($strLookupLetter) . $strWhereExtraReg;
     if (!$bShowInactive) {
         $strWhereExtra .= ' AND NOT vol_bInactive ';
     }
     $this->clsVol->loadVolDirectoryPage($strWhereExtra, $lStartRec, $lRecsPerPage);
     $displayData['lNumDisplayRows'] = $lNumVols = $this->clsVol->lNumVolRecs;
     $displayData['directoryRecsPerPage'] = $lRecsPerPage;
     $displayData['directoryStartRec'] = $lStartRec;
     if ($lNumVols) {
         foreach ($this->clsVol->volRecs as $volRec) {
             $this->clsVolSkills->lVolID = $lVolID = $volRec->lKeyID;
             $this->clsVolSkills->loadSingleVolSkills();
             $volRec->lNumJobSkills = $lNumSkills = $this->clsVolSkills->lNumSingleVolSkills;
             if ($lNumSkills > 0) {
                 $volRec->volSkills = arrayCopy($this->clsVolSkills->singleVolSkills);
             }
             $this->clsVol->loadVolClientAssocViaVolID($lVolID, $volRec->volClient, true);
         }
     }
     $displayData['vols'] =& $this->clsVol->volRecs;
     //------------------------------------------------
     // breadcrumbs / page setup
     //------------------------------------------------
     $displayData['mainTemplate'] = array('hospice/vols/vol_directory_view', 'hospice/vols/rpt_generic_vol_list');
     $displayData['pageTitle'] = 'Volunteer Directory';
     $displayData['title'] = CS_PROGNAME . ' | Volunteers';
     $displayData['nav'] = $this->mnav_brain_jar->navData();
     $this->load->vars($displayData);
     $this->load->view('template');
 }