Esempio n. 1
0
File: day.php Progetto: swirly/GRR
                 if ($id_derniere_ligne_du_bloc != $id) {
                     $cellules[$id] = $cellules[$id] - 1;
                 }
             }
         }
         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 . '&amp;period=' . $time_t_stripped . '&amp;year=' . $year . '&amp;month=' . $month . '&amp;day=' . $day . '&amp;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 . '&amp;hour=' . $hour . '&amp;minute=' . $minute . '&amp;year=' . $year . '&amp;month=' . $month . '&amp;day=' . $day . '&amp;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 != "") {
Esempio n. 2
0
File: year.php Progetto: Birssan/GRR
 tdcell("cell_hours");
 echo htmlspecialchars($row[0]) . "</td>\n";
 $li++;
 //Corrige un bug avec certains fuseaux horaires (par exemple GMT-05:00 celui du Québec) :
 //plusieurs mois débutent par le dernier jours du mois précédent.
 //En changeant "gmmktime" par "mktime" le bug est corrigé
 //$t2=gmmktime(0,0,0,$month_num,1,$year_num);
 $t2 = mktime(0, 0, 0, $month_num, 1, $year_num);
 for ($k = 0; $k < $days_in_month; $k++) {
     $cday = date("j", $t2);
     $cweek = date("w", $t2);
     $t2 += 86400;
     if ($display_day[$cweek] == 1) {
         // Début condition "on n'affiche pas tous les jours de la semaine"
         echo "<td valign=\"top\" class=\"cell_month\"> \n";
         if (est_hors_reservation(mktime(0, 0, 0, $month_num, $cday, $year_num), $area)) {
             echo "<div class=\"empty_cell\">";
             echo "<img src=\"img_grr/stop.png\" alt=\"" . get_vocab("reservation_impossible") . "\"  title=\"" . get_vocab("reservation_impossible") . "\" width=\"16\" height=\"16\" class=\"" . $class_image . "\"  /></div>";
         }
         //Anything to display for this day?
         if (isset($d[$cday][$cmonth][$cyear]["id"][0])) {
             $n = count($d[$cday][$cmonth][$cyear]["id"]);
             //Show the start/stop times, 2 per line, linked to view_entry.
             //If there are 12 or fewer, show them, else show 11 and "...".
             for ($i = 0; $i < $n; $i++) {
                 if ($i == 11 && $n > 12) {
                     echo " ...\n";
                     break;
                 }
                 for ($i = 0; $i < $n; $i++) {
                     if ($d[$cday][$cmonth][$cyear]["room"][$i] == $row[0]) {
Esempio n. 3
0
                    echo "<a href=\"edit_entry.php?room=$room"
                        . "&amp;period=$time_t_stripped&amp;year=$wyear&amp;month=$wmonth"
                        . "&amp;day=$wday&amp;page=week\" title=\"".get_vocab("cliquez_pour_effectuer_une_reservation")."\"><img src=\"img_grr/new.png\" alt=\"".get_vocab("add")."\" width=\"16\" height=\"16\"  class=\"".$class_image."\"  />";
                    echo "</a>";
                } else {
                    echo "<a href=\"edit_entry.php?room=$room"
                    . "&amp;hour=$hour&amp;minute=$minute&amp;year=$wyear&amp;month=$wmonth"
                    . "&amp;day=$wday&amp;page=week\" title=\"".get_vocab("cliquez_pour_effectuer_une_reservation")."\"><img src=\"img_grr/new.png\" alt=\"".get_vocab("add")."\" width=\"16\" height=\"16\" class=\"".$class_image."\"  />";
                    echo "</a>";
                }
            } else {
                echo "&nbsp;";
            }

        } else {
          if (est_hors_reservation(mktime(0,0,0,$wmonth,$wday,$wyear),$area))
            echo tdcell($empty_color)."<img src=\"img_grr/stop.png\" alt=\"".get_vocab("reservation_impossible")."\"  title=\"".get_vocab("reservation_impossible")."\" width=\"16\" height=\"16\" class=\"".$class_image."\"  />";
          else {
            tdcell($d[$weekday][$slot-$decale_slot*$nb_case]["color"]);
            // si la ressource est "occupée, on l'affiche
            if ((isset($d[$weekday][$slot-$decale_slot*$nb_case]["statut"])) and ($d[$weekday][$slot-$decale_slot*$nb_case]["statut"]!='-')) echo "&nbsp;<img src=\"img_grr/buzy.png\" alt=\"".get_vocab("ressource actuellement empruntee")."\" title=\"".get_vocab("ressource actuellement empruntee")."\" width=\"20\" height=\"20\" class=\"image\" />&nbsp;\n";
            // si la réservation est à confirmer, on le signale
            if (($this_delais_option_reservation > 0) and (isset($d[$weekday][$slot-$decale_slot*$nb_case]["option_reser"])) and ($d[$weekday][$slot-$decale_slot*$nb_case]["option_reser"]!=-1)) echo "&nbsp;<img src=\"img_grr/small_flag.png\" alt=\"".get_vocab("reservation_a_confirmer_au_plus_tard_le")."\" title=\"".get_vocab("reservation_a_confirmer_au_plus_tard_le")."&nbsp;".time_date_string_jma($d[$weekday][$slot-$decale_slot*$nb_case]["option_reser"],$dformat)."\" width=\"20\" height=\"20\" class=\"image\" />&nbsp;\n";
            // si la réservation est à modérer, on le signale
            if ((isset($d[$weekday][$slot-$decale_slot*$nb_case]["moderation"])) and ($d[$weekday][$slot-$decale_slot*$nb_case]["moderation"]=='1'))
                echo "&nbsp;<img src=\"img_grr/flag_moderation.png\" alt=\"".get_vocab("en_attente_moderation")."\" title=\"".get_vocab("en_attente_moderation")."\" class=\"image\" />&nbsp;\n";

            if (!isset($d[$weekday][$slot-$decale_slot*$nb_case]["id"])) {
                echo "&nbsp;\"&nbsp;";
            } else {
                if (($this_statut_room == "1") or
Esempio n. 4
0
             echo "</td></tr></table>";
         }
     }
 }
 if ($no_td) {
     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]."&amp;period=&amp;year=$cyear&amp;month=$cmonth&amp;day=$cday&amp;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]."&amp;hour=$hour&amp;minute=0&amp;year=$cyear&amp;month=$cmonth&amp;day=$cday&amp;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>";
Esempio n. 5
0
/** mrbsGetRepeatEntryList
 *
 * Returns a list of the repeating entrys
 *
 * $time     - The start time
 * $enddate  - When the repeat ends
 * $rep_type - What type of repeat is it
 * $rep_opt  - The repeat entrys
 * $max_ittr - After going through this many entrys assume an error has occured
 * *$rep_jour_c - Le jour cycle d'une réservation, si aucun 0
 *
 * Returns:
 *   empty     - The entry does not repeat
 *   an array  - This is a list of start times of each of the repeat entrys
 */
function mrbsGetRepeatEntryList($time, $enddate, $rep_type, $rep_opt, $max_ittr, $rep_num_weeks, $rep_jour_c,$area)
{
    $sec   = date("s", $time);
    $min   = date("i", $time);
    $hour  = date("G", $time);
    $day   = date("d", $time);
    $month = date("m", $time);
    $year  = date("Y", $time);

    $entrys = "";
    $entrys_return = "";
    $k=0;
    for($i = 0; $i < $max_ittr; $i++)
    {
        $time = mktime($hour, $min, $sec, $month, $day, $year);
        if ($time > $enddate)
            break;
        $time2 = mktime(0, 0, 0, $month, $day, $year);

        if (!(est_hors_reservation($time2,$area))) {
            $entrys_return[$k] = $time;
            $k++;
        }
        $entrys[$i] = $time;
        switch($rep_type)
        {
            // Daily repeat
            case 1:
                $day += 1;
                break;

            // Weekly repeat
            case 2:
                $j = $cur_day = date("w", $entrys[$i]);
                // Skip over days of the week which are not enabled:
                while ((($j = ($j + 1) % (7*$rep_num_weeks)) != $cur_day && $j<7 &&!$rep_opt[$j]) or ($j>=7))
                {
                    $day += 1;
                }

                $day += 1;
                break;

            // Monthly repeat
            case 3:
                $month += 1;
                break;

            // Yearly repeat
            case 4:
                $year += 1;
                break;

            // Monthly repeat on same week number and day of week
            case 5:
                $day += same_day_next_month($time);
                break;

            // Si la périodicité est par Jours/Cycle
            case 6:
                $sql = "SELECT * FROM ".TABLE_PREFIX."_calendrier_jours_cycle WHERE DAY >= '".$time2."' AND DAY <= '".$enddate."' AND Jours = '".$rep_jour_c."'";
                $result = mysql_query($sql);
                $kk = 0;
                $tableFinale = array();
                while($table = mysql_fetch_array($result)){
                    $day   = date("d", $table['DAY']);
                    $month = date("m", $table['DAY']);
                    $year  = date("Y", $table['DAY']);
                    $tableFinale[$kk] = mktime($hour, $min, $sec, $month, $day, $year);
                    $kk++;
                }
                return $tableFinale;
                break;

            // Unknown repeat option
            default:
                return;
        }
    }

    return $entrys_return;
}