Ejemplo n.º 1
0
    <title>PHP/Jquery Calendar</title>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,800,700|Montserrat:400,700' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/calendar.css"/>
    <link rel="stylesheet" href="css/modal.css"/>
</head>
<body>
    <header>
        <div class="container">
            <h1><i class="icon-calendar"></i> PHP/Jquery Calendar <small>By Blondin</small></h1>
        </div>
    </header>
    <section>
        <div class="container">
            <table id="calendar">
                <?php 
echo $calendar->draw_calendar();
?>
            </table>
        </div>
    </section>

    <div class="md-modal md-effect-1" id="modal-1">
        <div class="md-content">
            <button type="button" class="md-close" aria-label="Close" onclick="$('#modal-1').removeClass('md-show');"><span class="icon-cross"></span></button>
            <h3>Demande de rendez-vous</h3>
            <p class="recap">
                <span class="recap-date"><i class="icon-calendar"></i> Jeudi 25 Juin 2015</span>
                <span class="recap-heure"><i class="icon-clock"></i> 9h00 - 9h20</span>
            </p>
            <div class="rdv-form-wrapper">
                <form action="" method="POST" id="rdv-form">
Ejemplo n.º 2
0
$month_names = array('1' => 'janvier', '2' => 'février', '3' => 'mars', '4' => 'avril', '5' => 'mai', '6' => 'juin', '7' => 'juillet', '8' => 'août', '9' => 'septembre', '10' => 'octobre', '11' => 'novembre', '12' => 'décembre');
$creneaux = array('0800-0900' => '08h00 - 09h00', '0900-1000' => '09h00 - 10h00', '1000-1100' => '10h00 - 11h00', '1100-1200' => '11h00 - 12h00', '1200-1300' => '12h00 - 13h00', '1300-1400' => '13h00 - 14h00', '1400-1500' => '14h00 - 15h00', '1500-1600' => '15h00 - 16h00', '1600-1700' => '16h00 - 17h00', '1700-1800' => '17h00 - 18h00');
include 'connexion.php';
include 'function.php';
include 'class/calendar.php';
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    if (isset($_POST['param1']) && isset($_POST['currentdate'])) {
        $currentDate = explode('-', $_POST['currentdate']);
        $current_month = $currentDate[0];
        $current_year = $currentDate[1];
        $postValue = intval($_POST['param1']);
        if ($postValue < 0) {
            $current_month--;
        } else {
            $current_month++;
        }
        if ($current_month > 12) {
            $current_month = 1;
            $current_year++;
        } elseif ($current_month < 1) {
            $current_month = 12;
            $current_year--;
        }
        $calendar = new Calendar($current_month, $current_year);
        $retVal = $calendar->draw_calendar();
        echo $retVal;
    }
    if (isset($_POST['param2']) && isset($_POST['currentdate'])) {
        echo show_slots($_POST['currentdate']);
    }
}
Ejemplo n.º 3
0
 public function Execute(Template $template, Session $session, $request)
 {
     $template = CreateAncestors($template, $template['L_CALENDAR'] . ' - ' . $template['L_YEARLY']);
     if ($template['calendarenabled'] == 1) {
         $cal = new Calendar();
         $template->content = array('file' => 'calendar_week.html');
         /* ------------------------------------------------------------
         					THIS IS ALL TO FIND THE WEEK IF ONE WAS NOT GIVEN
         			--------------------------------------------------------------*/
         if (!isset($request['week']) || !$request['week'] || intval($request['week']) == 0) {
             $day_of_week = date("w", mktime(0, 0, 0, date("n"), 1, date("Y")));
             // the day of the week 0 - 6
             $last_month = date("n") != 1 ? date("n") - 1 : 12;
             // the number of last month 1- 12
             $day_of_month = date("j");
             // the day of this month 1 - 31
             $year = $last_month != 1 ? date("Y") : date("Y") - 1;
             // year of the previous month
             $prev_month = date("t", mktime(0, 0, 0, $last_month, 1, $year));
             // number of days in previous month
             /* First week of a month */
             if ($day_of_month >= 1 && $day_of_week <= 7) {
                 $start = $prev_month - ($day_of_week - 1);
                 // start of the week
                 $week = mktime(0, 0, 0, $last_month, $start, $year);
             } else {
                 $week = mktime(0, 0, 0, date("n"), 1, date("Y"));
             }
         }
         /* -----------------------------------------------------------
         				DO THE OTHER LESS COMPLICATED STUFF
         			-------------------------------------------------------------*/
         $month = !isset($request['month']) ? date("n") : intval($request['month']);
         $year = !isset($request['year']) ? date("Y") : intval($request['year']);
         $week = !isset($request['week']) ? $week : intval($request['week']);
         $lm = $cal->rewind_month($month, $year);
         $template['prev_month'] = $cal->draw_calendar(1, 1, $lm['m'], $lm['y'], TRUE);
         $nm = $cal->advance_month($month, $year, TRUE);
         $template['next_month'] = $cal->draw_calendar(1, 1, $nm['m'], $nm['y'], TRUE);
         $weeks = $cal->week_range($week, $month, $year);
         //$template->week = !isset($weeks[$week-1]) ? @$weeks[$week+1] : @$weeks[$week-1];
         $template->week = $weeks;
     } else {
         return new Error($template['L_FEATUREDENIED'], $template);
     }
     /* Set the number of queries */
     $template['num_queries'] = $session->dba->num_queries;
     return TRUE;
 }