} } tdcell_rowspan($c, $cellules[$id]); } $compteur[$id] = 1; } else { tdcell($c); } if (!isset($id) || est_hors_reservation(mktime(0, 0, 0, $month, $day, $year), $area)) { $hour = date("H", $t); $minute = date("i", $t); $date_booking = mktime($hour, $minute, 0, $month, $day, $year); if (est_hors_reservation(mktime(0, 0, 0, $month, $day, $year), $area)) { echo '<img src="img_grr/stop.png" alt="' . get_vocab("reservation_impossible") . '" title="' . get_vocab("reservation_impossible") . '" width="16" height="16" class="' . $class_image . '" />' . PHP_EOL; } else { if ((authGetUserLevel(getUserName(), -1) > 1 || auth_visiteur(getUserName(), $room) == 1) && UserRoomMaxBooking(getUserName(), $room, 1) != 0 && verif_booking_date(getUserName(), -1, $room, $date_booking, $date_now, $enable_periods) && verif_delais_max_resa_room(getUserName(), $room, $date_booking) && verif_delais_min_resa_room(getUserName(), $room, $date_booking) && ($statut_room[$room] == "1" || $statut_room[$room] == "0" && authGetUserLevel(getUserName(), $room) > 2) && $_GET['pview'] != 1) { if ($enable_periods == 'y') { echo '<a href="edit_entry.php?room=' . $room . '&period=' . $time_t_stripped . '&year=' . $year . '&month=' . $month . '&day=' . $day . '&page=day" title="' . get_vocab("cliquez_pour_effectuer_une_reservation") . '" ><span class="glyphicon glyphicon-plus"></span></a>' . PHP_EOL; } else { echo '<a href="edit_entry.php?room=' . $room . '&hour=' . $hour . '&minute=' . $minute . '&year=' . $year . '&month=' . $month . '&day=' . $day . '&page=day" title="' . get_vocab("cliquez_pour_effectuer_une_reservation") . '" ><span class="glyphicon glyphicon-plus"></span></a>' . PHP_EOL; } } else { echo ' '; } } echo '</td>' . PHP_EOL; } else { if ($descr != "") { if (isset($today[$room][$t]["statut"]) && $today[$room][$t]["statut"] != '-') { echo '<img src="img_grr/buzy.png" alt="' . get_vocab("ressource actuellement empruntee") . '" title="' . get_vocab("ressource actuellement empruntee") . '" width="20" height="20" class="image" />' . PHP_EOL; }
if ($row[4]==1) echo "<td class=\"empty_cell\">"; else echo "<td class=\"avertissement\">"; } else echo "<div class=\"empty_cell\">"; // Possibilité de faire une nouvelle réservation $hour = date("H",$date_now); // Heure actuelle $date_booking = mktime(24, 0, 0, $cmonth, $cday, $cyear); // minuit if (est_hors_reservation(mktime(0,0,0,$cmonth,$cday,$cyear),$area)) echo "<img src=\"img_grr/stop.png\" alt=\"".get_vocab("reservation_impossible")."\" title=\"".get_vocab("reservation_impossible")."\" width=\"16\" height=\"16\" class=\"".$class_image."\" />"; else if ((($authGetUserLevel > 1) or ($auth_visiteur == 1)) and ($UserRoomMaxBooking != 0) and verif_booking_date(getUserName(), -1, $row[2], $date_booking, $date_now, $enable_periods) and verif_delais_max_resa_room(getUserName(), $row[2], $date_booking) and verif_delais_min_resa_room(getUserName(), $row[2], $date_booking) and plages_libre_semaine_ressource($row[2], $cmonth, $cday, $cyear) and (($row[4] == "1") or (($row[4] == "0") and (authGetUserLevel(getUserName(),$row[2]) > 2) )) and $_GET['pview'] != 1) { if ($enable_periods == 'y') echo "<a href=\"edit_entry.php?room=".$row[2]."&period=&year=$cyear&month=$cmonth&day=$cday&page=week_all\" title=\"".get_vocab("cliquez_pour_effectuer_une_reservation")."\"><img src=\"img_grr/new.png\" alt=\"".get_vocab("add")."\" class=\"".$class_image."\" /></a>"; else echo "<a href=\"edit_entry.php?room=".$row[2]."&hour=$hour&minute=0&year=$cyear&month=$cmonth&day=$cday&page=week_all\" title=\"".get_vocab("cliquez_pour_effectuer_une_reservation")."\"><img src=\"img_grr/new.png\" alt=\"".get_vocab("add")."\" class=\"".$class_image."\" /></a>"; } else { echo " "; } if (!$no_td) echo "</div>";
if ($row['4'] == 1) { echo '<td class="empty_cell">'.PHP_EOL; } else { echo '<td class="avertissement">'.PHP_EOL; } } else { echo '<div class="empty_cell">'.PHP_EOL; }*/ $hour = date('H', $date_now); $date_booking = mktime(24, 0, 0, $cmonth, $cday, $cyear); if (est_hors_reservation(mktime(0, 0, 0, $cmonth, $cday, $cyear), $area)) { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['horsReservation'] = true; //echo '<img src="img_grr/stop.png" alt="',get_vocab('reservation_impossible'),'" title="',get_vocab('reservation_impossible'),'" width="16" height="16" class\"',$class_image,'" />',PHP_EOL; } else { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['horsReservation'] = false; if (($authGetUserLevel > 1 || $auth_visiteur == 1) && $UserRoomMaxBooking != 0 && verif_booking_date(getUserName(), -1, $row['2'], $date_booking, $date_now, $enable_periods) && verif_delais_max_resa_room(getUserName(), $row['2'], $date_booking) && verif_delais_min_resa_room(getUserName(), $row['2'], $date_booking) && plages_libre_semaine_ressource($row['2'], $cmonth, $cday, $cyear) && ($row['4'] == '1' || $row['4'] == '0' && authGetUserLevel(getUserName(), $row['2']) > 2) && $_GET['pview'] != 1) { if ($enable_periods == 'y') { //echo '<a href="edit_entry.php?room=',$row['2'],'&period=&year=',$cyear,'&month=',$cmonth,'&day=',$cday,'&page=week_all" title="',get_vocab('cliquez_pour_effectuer_une_reservation'),'"><span class="glyphicon glyphicon-plus"></span></a>',PHP_EOL; $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['editEntryLink'] = 'edit_entry.php?room=' . $row['2'] . '&period=&year=' . $cyear . '&month=' . $cmonth . '&day=' . $cday . '&page=week_all'; } else { //echo '<a href="edit_entry.php?room=',$row['2'],'&hour=',$hour,'&minute=0&year=',$cyear,'&month=',$cmonth,'&day=',$cday,'&page=week_all" title="',get_vocab('cliquez_pour_effectuer_une_reservation'),'"><span class="glyphicon glyphicon-plus"></span></a>',PHP_EOL; $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['editEntryLink'] = 'edit_entry.php?room=' . $row['2'] . '&hour=' . $hour . '&minute=0&year=' . $cyear . '&month=' . $cmonth . '&day=' . $cday . '&page=week_all'; } } else { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['editEntryLink'] = false; //echo ' '.PHP_EOL; } } /*if (!$no_td) { echo '</div>'.PHP_EOL; }
} if (!verif_heure_debut_fin($reps[$i], $reps[$i] + $diff, $area)) { $error_heure_debut_fin = 'yes'; } ++$i; } } else { if (authGetUserLevel(getUserName(), -1) < 2 && auth_visiteur(getUserName(), $room_id) == 0) { $error_booking_room_out = 'yes'; } if (isset($id) && $id != 0) { if (!verif_booking_date(getUserName(), $id, $room_id, $starttime, $date_now, $enable_periods, $endtime)) { $error_booking_in_past = 'yes'; } } else { if (!verif_booking_date(getUserName(), -1, $room_id, $starttime, $date_now, $enable_periods)) { $error_booking_in_past = 'yes'; } } if (!verif_duree_max_resa_area(getUserName(), $room_id, $starttime, $endtime)) { $error_duree_max_resa_area = 'yes'; } if (!verif_delais_max_resa_room(getUserName(), $room_id, $starttime)) { $error_delais_max_resa_room = 'yes'; } if (!verif_delais_min_resa_room(getUserName(), $room_id, $starttime)) { $error_delais_min_resa_room = 'yes'; } if (!verif_date_option_reservation($option_reservation, $starttime)) { $error_date_option_reservation = 'yes'; }
echo $d[$cday]["who1"][$i], '<br/>'; $Son_GenreRepeat = grr_sql_query1("SELECT type_name FROM " . TABLE_PREFIX . "_type_area ," . TABLE_PREFIX . "_entry WHERE " . TABLE_PREFIX . "_entry.id= " . $d[$cday]["id"][$i] . " AND " . TABLE_PREFIX . "_entry.type= " . TABLE_PREFIX . "_type_area.type_letter"); echo $Son_GenreRepeat, '<br/>'; if ($d[$cday]["description"][$i] != "") { echo '<br /><i>(', $d[$cday]["description"][$i], ')</i>'; } if ($acces_fiche_reservation) { echo '</a>', PHP_EOL; } echo '</span>', PHP_EOL, '</td>', PHP_EOL, '</tr>', PHP_EOL, '</table>', PHP_EOL; } } $date_now = time(); $hour = date("H", $date_now); $date_booking = mktime(24, 0, 0, $month, $cday, $year); if (($authGetUserLevel > 1 || $auth_visiteur == 1) && $UserRoomMaxBooking != 0 && verif_booking_date(getUserName(), -1, $room, $date_booking, $date_now, $enable_periods) && verif_delais_max_resa_room(getUserName(), $room, $date_booking) && verif_delais_min_resa_room(getUserName(), $room, $date_booking) && plages_libre_semaine_ressource($room, $month, $cday, $year) && ($this_statut_room == "1" || $this_statut_room == "0" && authGetUserLevel(getUserName(), $room) > 2) && $_GET['pview'] != 1) { echo '<div class="empty_cell">', PHP_EOL; if ($enable_periods == 'y') { echo '<a href="edit_entry.php?room=', $room, '&period=&year=', $year, '&month=', $month, '&day=', $cday, '&page=month" title="', get_vocab("cliquez_pour_effectuer_une_reservation"), '"><span class="glyphicon glyphicon-plus"></span></a>', PHP_EOL; } else { echo '<a href="edit_entry.php?room=', $room, '&hour=', $hour, '&minute=0&year=', $year, '&month=', $month, '&day=', $cday, '&page=month" title="', get_vocab("cliquez_pour_effectuer_une_reservation"), '"><span class="glyphicon glyphicon-plus"></span></a>', PHP_EOL; } echo '</div>' . PHP_EOL; } else { echo ' '; } } echo '</td>' . PHP_EOL; } if (++$weekcol == 7) { $weekcol = 0;
echo '<tr>', PHP_EOL, '<td><b>', get_vocab("rep_rep_day"), '</b></td>', PHP_EOL, '<td>', $opt, '</td>', PHP_EOL, '</tr>', PHP_EOL; } else { echo '<tr>', PHP_EOL, '<td><b>', get_vocab("rep_rep_days"), '</b></td>', PHP_EOL, '<td>', $opt, '</td>', PHP_EOL, '</tr>', PHP_EOL; } } } if ($rep_type == 6) { if (Settings::get("jours_cycles_actif") == "Oui" && intval($jour_cycle) > -1) { echo '<tr>', PHP_EOL, '<td><b>', get_vocab("rep_rep_day"), '</b></td>', PHP_EOL, '<td>', get_vocab('jour_cycle'), ' ', $jour_cycle, '</td>', PHP_EOL, '</tr>', PHP_EOL; } } echo '<tr><td><b>' . get_vocab("date") . get_vocab("deux_points") . '</b></td><td>' . $start_date . '</td></tr>'; echo '<tr><td><b>' . get_vocab("duration") . '</b></td><td>' . $duration . ' ' . $dur_units . '</td></tr>'; echo '<tr><td><b>' . get_vocab('rep_end_date') . '</b></td><td>' . $rep_end_date . '</td></tr>'; } if (getWritable($beneficiaire, getUserName(), $id) && verif_booking_date(getUserName(), $id, $room_id, -1, $date_now, $enable_periods) && verif_delais_min_resa_room(getUserName(), $room_id, $row[10]) && !$was_del) { $message_confirmation = str_replace("'", "\\'", get_vocab("confirmdel") . get_vocab("deleteseries")); echo '<tr>', PHP_EOL, '<td colspan="2">', PHP_EOL, '<input class="btn btn-primary" type="button" onclick="location.href=\'edit_entry.php?id=', $id, '&edit_type=series&day=', $day, '&month=', $month, '&year=', $year, '&page=', $page, '\'" value="', get_vocab("editseries"), '"></td>', PHP_EOL, '</tr>', PHP_EOL; echo '<tr>', PHP_EOL, '<td colspan="2">', PHP_EOL, '<a class="btn btn-danger" type="button" href="del_entry.php?id=', $id, '&series=1&day=', $day, '&month=', $month, '&year=', $year, '&page=', $page, '" onclick="return confirm(\'', $message_confirmation, '\');">', get_vocab("deleteseries"), '</a></td>', PHP_EOL, '</tr>', PHP_EOL; } echo '</table>', PHP_EOL, '</fieldset>', PHP_EOL; } if (!isset($area_id)) { $area_id = 1; } if (!isset($room)) { $room = 1; } if (authGetUserLevel(getUserName(), $area_id, "area") > 1 || authGetUserLevel(getUserName(), $room) >= 4) { echo '<br><input class="btn btn-primary" onclick="myFunction(', $id, ')" value="', get_vocab("Generer_pdf"), '" >', PHP_EOL; }
} if (!getWritable($info['beneficiaire'], getUserName(), $id)) { showAccessDenied($back); exit; } if (authUserAccesArea(getUserName(), $area) == 0) { showAccessDenied($back); exit; } if (Settings::get('automatic_mail') == 'yes') { $_SESSION['session_message_error'] = send_mail($id, 3, $dformat); } $room_id = grr_sql_query1('SELECT ' . TABLE_PREFIX . '_entry.room_id FROM ' . TABLE_PREFIX . '_entry, ' . TABLE_PREFIX . '_room WHERE ' . TABLE_PREFIX . '_entry.room_id = ' . TABLE_PREFIX . '_room.id AND ' . TABLE_PREFIX . "_entry.id='" . $id . "'"); $date_now = time(); get_planning_area_values($area); if (!verif_booking_date(getUserName(), $id, $room_id, -1, $date_now, $enable_periods) || verif_booking_date(getUserName(), $id, $room_id, -1, $date_now, $enable_periods) && $can_delete_or_create != 'y') { showAccessDenied($back); exit; } /* avant la suppression, dispatch de l'event */ $event = new EntryEventClass(false, false, $id, false); $dispatcher->dispatch(DelEntryEvent::DELENTRY_START, $event); $result = mrbsDelEntry(getUserName(), $id, $series, 1); /* après la suppression, dispatch de l'event */ $eventEnd = new EntryEventClass(false, false, $id, false); $dispatcher->dispatch(DelEntryEvent::DELENTRY_END, $eventEnd); if ($result) { $_SESSION['displ_msg'] = 'yes'; Header('Location: ' . $page . ".php?day={$day}&month={$month}&year={$year}&area={$area}&room=" . $info['room_id']); exit; }
if(authUserAccesArea(getUserName(), $area)==0) { showAccessDenied($day, $month, $year, $area,$back); exit(); } grr_sql_begin(); if (getSettingValue("automatic_mail") == 'yes') { $_SESSION['session_message_error'] = send_mail($id,3,$dformat); } // On vérifie les dates $room_id = grr_sql_query1("SELECT ".TABLE_PREFIX."_entry.room_id FROM ".TABLE_PREFIX."_entry, ".TABLE_PREFIX."_room WHERE ".TABLE_PREFIX."_entry.room_id = ".TABLE_PREFIX."_room.id AND ".TABLE_PREFIX."_entry.id='".$id."'"); $date_now = mktime(); get_planning_area_values($area); // Récupération des données concernant l'affichage du planning du domaine if ((!(verif_booking_date(getUserName(), $id, $room_id, -1, $date_now, $enable_periods))) or ((verif_booking_date(getUserName(), $id, $room_id, -1, $date_now, $enable_periods)) and ($can_delete_or_create!="y")) ) { showAccessDenied($day, $month, $year, $area,$back); exit(); } $result = mrbsDelEntry(getUserName(), $id, $series, 1); grr_sql_commit(); if ($result) { $_SESSION['displ_msg'] = 'yes'; Header("Location: ".$page.".php?day=$day&month=$month&year=$year&area=$area&room=".$info["room_id"]); exit(); } }
/** mrbsDelEntry() * * Delete an entry, or optionally all entrys. * * $user - Who's making the request * $id - The entry to delete * $series - If set, delete the series, except user modified entrys * $all - If set, include user modified entrys in the series delete * * Returns: * 0 - An error occured * non-zero - The entry was deleted */ function mrbsDelEntry($user, $id, $series, $all) { global $correct_diff_time_local_serveur, $enable_periods; $date_now = mktime(); $id_room = grr_sql_query1("select room_id FROM ".TABLE_PREFIX."_entry WHERE id='".$id."'"); $repeat_id = grr_sql_query1("SELECT repeat_id FROM ".TABLE_PREFIX."_entry WHERE id='".$id."'"); if ($repeat_id < 0) return 0; $sql = "SELECT beneficiaire, id, entry_type FROM ".TABLE_PREFIX."_entry WHERE "; if(($series) and ($repeat_id > 0)) $sql .= "repeat_id='".protect_data_sql($repeat_id)."'"; else $sql .= "id='".$id."'"; $res = grr_sql_query($sql); $removed = 0; for ($i = 0; ($row = grr_sql_row($res, $i)); $i++) { if(!getWritable($row[0], $user, $id)) continue; if (!verif_booking_date($user, $row[1], $id_room, "", $date_now, $enable_periods, "")) continue; if($series && $row[2] == 2 && !$all) continue; if (grr_sql_command("DELETE FROM ".TABLE_PREFIX."_entry WHERE id=" . $row[1]) > 0) $removed++; grr_sql_command("DELETE FROM ".TABLE_PREFIX."_entry_moderate WHERE id=" . $row[1]); } if ($repeat_id > 0 && grr_sql_query1("SELECT count(*) FROM ".TABLE_PREFIX."_entry WHERE repeat_id='".protect_data_sql($repeat_id)."'") == 0) grr_sql_command("DELETE FROM ".TABLE_PREFIX."_repeat WHERE id='".$repeat_id."'"); return $removed > 0; }
if ((authGetUserLevel(getUserName(),-1) < 2) and (auth_visiteur(getUserName(),$room_id) == 0)) $error_booking_room_out = 'yes'; if (!(verif_booking_date(getUserName(), -1, $room_id, $reps[$i], $date_now, $enable_periods))) $error_booking_in_past = 'yes'; if (!(verif_duree_max_resa_area(getUserName(), $room_id, $starttime, $endtime))) $error_duree_max_resa_aera = 'yes'; if (!(verif_delais_max_resa_room(getUserName(), $room_id, $reps[$i]))) $error_delais_max_resa_room = 'yes'; if (!(verif_delais_min_resa_room(getUserName(), $room_id, $reps[$i]))) $error_delais_min_resa_room = 'yes'; if (!(verif_date_option_reservation($option_reservation, $reps[$i]))) $error_date_option_reservation = 'yes'; if (!(verif_qui_peut_reserver_pour($room_id, getUserName(), $beneficiaire))) $error_qui_peut_reserver_pour = 'yes'; if (!(verif_heure_debut_fin($reps[$i], $reps[$i]+$diff, $area))) $error_heure_debut_fin = 'yes'; $i++; } } else { if ((authGetUserLevel(getUserName(),-1) < 2) and (auth_visiteur(getUserName(),$room_id) == 0)) $error_booking_room_out = 'yes'; if (isset($id) and ($id!=0)) { if (!(verif_booking_date(getUserName(), $id, $room_id, $starttime, $date_now, $enable_periods, $endtime))) $error_booking_in_past = 'yes'; } else { if (!(verif_booking_date(getUserName(), -1, $room_id, $starttime, $date_now, $enable_periods))) $error_booking_in_past = 'yes'; } if (!(verif_duree_max_resa_area(getUserName(), $room_id, $starttime, $endtime))) $error_duree_max_resa_area = 'yes'; if (!(verif_delais_max_resa_room(getUserName(), $room_id, $starttime))) $error_delais_max_resa_room = 'yes'; if (!(verif_delais_min_resa_room(getUserName(), $room_id, $starttime))) $error_delais_min_resa_room = 'yes'; if (!(verif_date_option_reservation($option_reservation, $starttime))) $error_date_option_reservation = 'yes'; if (!(verif_qui_peut_reserver_pour($room_id, getUserName(), $beneficiaire))) $error_qui_peut_reserver_pour = 'yes'; if (!(verif_heure_debut_fin($starttime, $endtime, $area))) $error_heure_debut_fin = 'yes'; if (resa_est_hors_reservation2($starttime, $endtime, $area)) $error_heure_debut_fin = 'yes'; } $statut_room = grr_sql_query1("select statut_room from ".TABLE_PREFIX."_room where id = '$room_id'"); // on vérifie qu'un utilisateur non autorisé ne tente pas de réserver une ressource non disponible if (($statut_room == "0") and authGetUserLevel(getUserName(),$room_id) < 3) $error_booking_room_out = 'yes'; // on vérifie qu'un utilisateur ne tente pas de réserver une ressource qui lui est normalement invisible if (!verif_acces_ressource(getUserName(), $room_id))