function eventUpdate($lEventID)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $this->load->helper('dl_util/verify_id');
     if ($lEventID . '' != '0') {
         verifyID($this, $lEventID, 'event ID');
     }
     $lEventID = (int) $lEventID;
     $this->load->model('vols/mvol_events', 'clsVolEvents');
     $this->load->model('vols/mvol_event_dates', 'clsVolEventDates');
     $this->load->model('util/mrecurring', 'clsRecurring');
     $this->load->helper('dl_util/time_date');
     $bNew = $lEventID <= 0;
     $this->clsVolEvents->loadEventsViaEID($lEventID);
     $clsE =& $this->clsVolEvents->events[0];
     $clsE->strEventName = trim($_POST['txtEvent']);
     $clsE->strDescription = trim($_POST['txtNote']);
     $clsE->strLocation = trim($_POST['txtLocation']);
     $clsE->strContact = trim($_POST['txtContact']);
     $clsE->strPhone = trim($_POST['txtPhone']);
     $clsE->strEmail = trim($_POST['txtEmail']);
     $clsE->strWebSite = trim($_POST['txtWebLink']);
     if ($bNew) {
         $strMsg = 'Event added!';
         $lEventID = $this->clsVolEvents->lAddNewEvent();
         $this->clsRecurring->lDaysExtend = 7;
         $this->clsRecurring->loadFormRecur();
         $this->clsRecurring->generateDateList();
         foreach ($this->clsRecurring->dateList as $dteRem) {
             $lEventDateID = $this->clsVolEventDates->lInsertEventDate($lEventID, $dteRem->uts);
         }
     } else {
         $strMsg = 'Event updated!';
         $this->clsVolEvents->updateEvent();
     }
     $this->session->set_flashdata('msg', $strMsg);
     redirect_VolEvent($lEventID);
 }
 function editShiftHrsCommon($bAsVol, $lVolID, $lEventID, $lShiftID, $strReturn)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $this->load->helper('dl_util/verify_id');
     verifyID($this, $lEventID, 'event ID');
     verifyID($this, $lShiftID, 'shift ID');
     $displayData = array();
     $displayData['lEventID'] = $lEventID = (int) $lEventID;
     $displayData['lShiftID'] = $lShiftID = (int) $lShiftID;
     $displayData['strReturn'] = trim($strReturn);
     $displayData['bAsVol'] = $bAsVol;
     $displayData['lVolID'] = $lVolID;
     //-------------------------
     // models & helpers
     //-------------------------
     $this->load->helper('dl_util/time_date');
     // for date verification
     $params = array('enumStyle' => 'terse');
     $this->load->library('generic_rpt', $params);
     $this->load->model('vols/mvol_event_dates', 'clsVolEventDates');
     $this->load->model('vols/mvol_event_hours', 'clsVolHours');
     $this->load->model('vols/mvol_event_dates_shifts', 'clsShifts');
     $this->load->model('vols/mvol_event_dates_shifts_vols', 'clsSV');
     $this->load->model('vols/mvol_events', 'clsVolEvents');
     $this->load->helper('dl_util/web_layout');
     $this->load->helper('dl_util/time_date');
     //---------------------------------
     // event and shift information
     //---------------------------------
     $this->clsVolHours->volEventHoursViaShift($lShiftID, $bAsVol, $lVolID);
     $displayData['lNumVols'] = $lNumVols = $this->clsVolHours->lNumVolsInShift;
     $this->clsShifts->loadShiftsViaEventShiftID($lShiftID, $bAsVol, $lVolID);
     $this->clsVolEvents->loadEventsViaEID($lEventID);
     $lEventDateID = $this->clsShifts->shifts[0]->lEventDateID;
     $displayData['shift'] = $shift =& $this->clsShifts->shifts[0];
     $displayData['strShiftLabel'] = $strShiftLabel = date('F j Y', $shift->dteEvent) . '&nbsp&nbsp;' . date('g:i a', $shift->dteEventStartTime) . ': ' . '<b>' . htmlspecialchars($shift->strShiftName) . '</b> (' . $shift->enumDuration . ')';
     //-------------------------
     // validation rules
     //-------------------------
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     if ($lNumVols > 0) {
         foreach ($this->clsVolHours->volEHrs as $vol) {
             $this->form_validation->set_rules('txtHR_' . $vol->lVolShiftAssignID, 'Volunteer Hours ', 'trim|required|greater_than[-0.01]');
         }
     }
     if ($this->form_validation->run() == FALSE) {
         $this->load->library('generic_form');
         $displayData['contextSummary'] = $this->clsVolEvents->volEventHTMLSummary(0);
         // first time displayed, no user data entry errors
         if (validation_errors() == '') {
             if ($lNumVols > 0) {
                 foreach ($this->clsVolHours->volEHrs as $vol) {
                     $vol->strHours = number_format($vol->dHoursWorked, 2);
                 }
             }
         } else {
             setOnFormError($displayData);
             foreach ($this->clsVolHours->volEHrs as $vol) {
                 $vol->strHours = @$_POST['txtHR_' . $vol->lVolShiftAssignID];
             }
         }
         $displayData['vols'] =& $this->clsVolHours->volEHrs;
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['title'] = CS_PROGNAME . ' | Volunteer Hours';
         if ($bAsVol) {
             $displayData['pageTitle'] = 'Edit Volunteer Hours';
         } else {
             $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/vol_event_hours/viewHoursViaEvent/true/' . $lEventID, 'Volunteer Hours', 'class="breadcrumb"') . ' | Edit Hours';
         }
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'vols/vol_shift_hours_edit_view';
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         foreach ($this->clsVolHours->volEHrs as $vol) {
             $lVolShiftAssignID = $vol->lVolShiftAssignID;
             $dHours = (double) @$_POST['txtHR_' . $lVolShiftAssignID];
             $this->clsVolHours->setVolHours($lVolShiftAssignID, $dHours);
         }
         switch ($strReturn) {
             case 'event':
                 redirect_VolEvent($lEventID);
                 break;
             case 'eventDate':
                 redirect_VolEventDate($lEventDateID);
                 break;
             case 'volunteerUser':
                 $this->session->set_flashdata('msg', 'Your volunteer hours were updated for <b>' . $strShiftLabel . '</b>');
                 redirect('vol_reg/vol_hours/view');
                 break;
             default:
                 redirect_VolEventHours($lEventID);
                 break;
         }
     }
 }
 function cloneShift($lEventID, $lEventDateID, $lShiftID)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $this->load->helper('dl_util/verify_id');
     verifyID($this, $lEventID, 'event ID');
     verifyID($this, $lEventDateID, 'event date ID');
     verifyID($this, $lShiftID, 'shift ID');
     $lEventDateID = (int) $lEventDateID;
     $lShiftID = (int) $lShiftID;
     $lEventID = (int) $lEventID;
     $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');
     $bCloneVols = @$_POST['chkVols'] == 'TRUE';
     $this->clsVolEvents->loadEventsViaEID($lEventID);
     $lNumClones = 0;
     if (isset($_REQUEST['chkDate'])) {
         foreach ($_REQUEST['chkDate'] as $strDateID) {
             $this->clsShifts->cloneShift($lShiftID, (int) $strDateID, $bCloneVols);
             ++$lNumClones;
         }
     }
     $this->session->set_flashdata('msg', $lNumClones . ' cloned shift' . ($lNumClones == 1 ? '' : 's') . ' added to event <b>' . htmlspecialchars($this->clsShifts->shifts[0]->strShiftName) . '</b>');
     redirect_VolEvent($lEventID);
 }
 function remove($lEventID, $lDateID)
 {
     //---------------------------------------------------------------------
     // remove date from event
     //---------------------------------------------------------------------
     $this->load->helper('dl_util/verify_id');
     verifyID($this, $lEventID, 'event ID');
     verifyID($this, $lDateID, 'event date ID');
     $lEventID = (int) $lEventID;
     $lDateID = (int) $lDateID;
     $this->load->model('vols/mvol_event_dates', 'clsVolEventDates');
     $this->clsVolEventDates->deleteEventDate($lDateID);
     $this->session->set_flashdata('msg', 'The specified date was removed from this event');
     redirect_VolEvent($lEventID);
 }