fxGetRow($sqlVolunteer); if($tabVolunteer != null){ // todosl: update resultats_benevolets_positions_shifts par_id = // echo "infjsdkfjsdk"; // exit; $intParId = $tabVolunteer['par_id']; } else{ $intParId = 0; } $qry = "insert into resultats_benevoles_positions_shifts (pec_id, bps_id, com_id, par_id) values (" . intval($int_pec_id) . ", " . intval($int_bps_id) . ", ". intval($_SESSION['com_info']['com_id']) . ", " . intval($intParId) . ")"; $result = $objDatabase->fxQuery($qry); if(!$result){ fxcreer_log('CAN24HVOL_ERROR: Error creating new volunteer record.\n' . $result); } else // log info about "transaction" fxcreer_log('CAN24HVOL_REPORT: Volunteer BOOKED.', 24, 0, intval($int_eve_id), intval($_GET['epr_id']), 0, '', intval($_SESSION['com_info']['com_id']), $_SESSION['com_info']['com_courriel']); } } elseif($str_action == 'cancel'){ $qry = "delete from resultats_benevoles_positions_shifts where pec_id = " . intval($int_pec_id) . " and bps_id = " . intval($int_bps_id); $result = $objDatabase->fxQuery($qry); if(!$result){ fxcreer_log('CAN24HVOL_ERROR: Error deleting volunteer record.\n' . $result); } else // log info about "transaction" fxcreer_log('CAN24HVOL_REPORT: Volunteer CANCELLED.', 24, 0, intval($int_eve_id), intval($_GET['epr_id']), 0, '', intval($_SESSION['com_info']['com_id']), $_SESSION['com_info']['com_courriel']); } } /** * */ function fxDrawVolunteersTab($str_permissions, $int_eve_id){ global $tabEpreuve; global $tabAllowedResources; global $tabReservedResources; $strButtonDisabled = ''; if($str_permissions == 'view'){ $strButtonDisabled = "disabled='disabled' style='cursor:default' class='camp_reserve'"; } ?>

">
Volunteer shift"; } else{ echo "
Number of volunteers required
  • " . $bookedJob['bs_nom_' . $strLangue] . "
  • " . $bookedJob['bp_nom_' . $strLangue] . "
No volunteer scheduled."; } ?>

'; } else { $strEcho = ''; } $strDate = explode("-", $tabShifts[$i]['bs_nom_en']); $strDay = $strDate[0]; $strTime = $strDate[1]; // tableau des places pour chaque position (spots) de la rangee $tabSpots = fxSelectQuery('*', 'inscriptions_benevoles_positions_shifts', ' where bps_id = ' . intval($tabShifts[$i]['bs_id']), '', 'row'); $strEcho .= ""; echo $strEcho; echo ""; } ?>
" . $strDay . "" . $strTime . "
" . fxDrawShiftTable($tabSpots['bps_id'], count($tabVolunteerBooked), $tabVolunteerBooked, $strButtonDisabled, $int_eve_id) . "
'; $tabJobs = fxSelectQuery('*', 'inscriptions_benevoles_positions', ' WHERE bp_actif = 1 AND eve_id = ' . intval($int_eve_id), ' ORDER BY bp_id', 'results'); // $tabJobs = fxSelectQuery('*', 'inscriptions_benevoles_positions', ' WHERE eve_id = ' . intval($tabEvenement['general']['eve_id']), '', 'results'); if ($strLangue == 'fr') $strPage = '/reserver/'; else $strPage = '/book/'; $strPostUrl = $strPage . $tabEvenement['general']['eve_label_url'] . '/0'; for($i = 1; $i <= count($tabJobs); $i++){ $tabBenevolePosShift = fxSelectQuery('*', 'inscriptions_benevoles_positions_shifts', ' where bp_id = ' . intval($tabJobs[$i]['bp_id']) . ' and bs_id = ' . intval($int_bs_id), '', 'row'); // get number of booked jobs for current position_shift $tabJobsShiftQtyBooked = fxSelectQuery('count(*)', 'resultats_benevoles_positions_shifts', ' where bps_id = ' . intval($tabBenevolePosShift['bps_id']), '', 'row'); // var_dump($tabBenevolePosShift['bps_qte']); if($tab_volunteer_booked['bps_id'] == $tabBenevolePosShift['bps_id']){ $strReservee ='This is your job!'; } elseif(!$bool_shift_booked && $tabBenevolePosShift['bps_qte'] != $tabJobsShiftQtyBooked['count(*)']){ $strReservee = '
'; } elseif(!$bool_shift_booked && $tabBenevolePosShift['bps_qte'] == $tabJobsShiftQtyBooked['count(*)']){ $strReservee = '
All taken.
'; } else{ $strReservee = ''; } $strStyle = 'style="color: black; font-size:80%; font-weight: bold"'; if($tab_volunteer_booked['bps_id'] == $tabBenevolePosShift['bps_id']){ $strClass = 'yours'; // $strStyle = ''; $strReservee = '
'; } elseif($tabBenevolePosShift['bps_qte'] <= $tabJobsShiftQtyBooked['count(*)']){ // elseif($tabBenevolePosShift['bps_qte'] == $tabJobsShiftQtyBooked['count(*)']){ $strClass = 'taken'; $strReservee = '
All taken.
'; } else{ $strClass = 'available'; } if($tabBenevolePosShift['bps_qte'] - $tabJobsShiftQtyBooked['count(*)'] <= 0) { $intQteTaken = $tabBenevolePosShift['bps_qte']; $intNbDispoRestant = 0; } else { $intQteTaken = $tabJobsShiftQtyBooked['count(*)']; $intNbDispoRestant = $tabBenevolePosShift['bps_qte'] - $tabJobsShiftQtyBooked['count(*)']; } $return .= '
'; $return .= '#'. $i . 'job ' . $tabBenevolePosShift['bps_id'] . ''; $return .= '' . $tabJobs[$i]['bp_nom_en'] .'
'; $return .= '' . $intQteTaken . ' taken / ' . $intNbDispoRestant. ' free
'; // $return .= '' . $tabJobsShiftQtyBooked['count(*)'] . ' taken / ' . $intNbDispoRestant. ' free
'; // $return .= '' . $tabJobsShiftQtyBooked['count(*)'] . ' taken / ' . ($tabBenevolePosShift['bps_qte'] - $tabJobsShiftQtyBooked['count(*)']). ' free
'; $return .= '' .$strReservee. ''; $return .= '' . ''; $return .= '
'; } $return .= ''; return $return; } function fxGetBenevoles($intEvenement) { global $objDatabase; $sqlBenevoles = "SELECT * FROM inscriptions_epreuves WHERE epr_actif = 1 AND tep_id = 2 AND eve_id = " . intval($intEvenement); $arrBenevoles = $objDatabase->fxGetResults($sqlBenevoles); return $arrBenevoles; } function fxGetQteBenevoles($intEpreuve) { global $objDatabase; $sqlQte = "SELECT (epr_qte + COUNT(ec.pec_id)) AS dispo, COUNT(ec.pec_id) AS booked FROM inscriptions_epreuves e, resultats_epreuves_commandees ec WHERE e.epr_id = ec.epr_id AND ec.is_cancelled = 0 AND ec.pec_actif = 1 AND e.epr_id = " . intval($intEpreuve); $arrQte = $objDatabase->fxGetRow($sqlQte); return $arrQte; }