Ejemplo n.º 1
0
function get_output_panel_program($string_date = 'now')
{
    $date_unix = strtotime($string_date);
    $day_no = day_eng_no(strftime("%A", $date_unix));
    $date_formatted = strftime("%d %b %Y", $date_unix);
    $day_name_french = day_fr($day_no);
    $date_sql = strftime("%Y-%m-%d", $date_unix);
    $full_date_formatted = $day_name_french . " " . $date_formatted;
    $Dif = count_prog_by_date($date_sql) - count_modele_by_day($day_no);
    $glyph_ok = "<span class='glyphicon glyphicon-ok'style='color:red;' aria-hidden='true'></span>";
    $count_valid = "&nbsp;&nbsp;<span class='badge'>" . "{$glyph_ok}&nbsp;" . count_prog_by_date_validated_chauffeur($date_sql) . "</span>&nbsp;";
    $count_prog = "&nbsp;<span class='badge'>" . count_prog_by_date($date_sql) . "</span>";
    if (!is_chauffeur()) {
        if ($Dif == 0) {
            $count_mod = "";
        } else {
            $count_mod = "<span class='badge'>" . "M " . count_modele_by_day($day_no) . "</span>&nbsp;&nbsp;&nbsp;";
        }
    } else {
        $count_mod = "";
    }
    $output = "";
    if ($string_date == "now") {
        $text = "Aujourdhui ";
    } elseif ($string_date == "yesterday") {
        $text = "Hier ";
    } elseif ($string_date == "tomorrow") {
        $text = "demain ";
    } elseif ($string_date == "2 day ago") {
        $text = "{$string_date}";
    } else {
        $text = "{$string_date}";
    }
    //$output.="<div class='row'>" ;
    //$output.="<div class='col-md-3 '>" ;
    if (isset($_GET["validation_chauffeur"])) {
        $valid_chauffeur = $_GET["validation_chauffeur"];
        if ($valid_chauffeur == 1) {
            $color = "success";
        } elseif ($valid_chauffeur == 2) {
            $color = "danger";
        } elseif ($valid_chauffeur == 0) {
            $color = "info";
        } else {
            $color = "primary";
        }
    } else {
        $valid_chauffeur = 3;
        $color = "primary";
    }
    $output .= "<div class='panel panel-{$color}'>";
    //<!-- Default panel contents -->
    $output .= "<div class='panel-heading text-center'>";
    $output .= "<h3 class='panel-title text-center'>{$count_mod}{$text} {$count_prog}{$count_valid}</h3>";
    $output .= "</div>";
    $output .= output_program_day($string_date);
    $output .= "</div>";
    //  $output.="</div>" ;
    //  $output.="</div>" ;
    return $output;
}
Ejemplo n.º 2
0
function output_all_modele_pivot_search($time = "tomorrow")
{
    global $visible;
    $modele_set = find_all_modele_pivot($visible);
    $page_name = "modele_export.php";
    // page which import the day
    $output = "";
    //    $now = strtotime("now");
    //    $now_no = day_eng_no(strftime("%A" ,$now));
    //    $now_date_formatted = strftime("%d-%m-%Y" ,$now);
    //    $today_day_name_french = day_fr($now_no);
    $tomorrow = strtotime($time);
    $tomorrow_no = day_eng_no(strftime("%A", $tomorrow));
    $tomorrow_date_formatted = strftime("%d-%m-%Y", $tomorrow);
    $tomorrow_day_name_french = day_fr($tomorrow_no);
    $tomorrow_date_sql = strftime("%Y-%m-%d", $tomorrow);
    //    echo "now - <strong>".$now."</strong><br>";
    //    echo "now_no - <strong>".$now_no."</strong><br>";
    //    echo "now_date_formatted - <strong>".$now_date_formatted."</strong><br>";
    //    echo "today_day_name_french - <strong>".$today_day_name_french."</strong><br>";
    //
    //    echo "<hr>";
    //
    //    echo "tomorrow - <strong>".$tomorrow."</strong><br>";
    //    echo "tomorrow_no - <strong>".$tomorrow_no."</strong><br>";
    //    echo "tomorrow_date_formatted - <strong>".$tomorrow_date_formatted."</strong><br>";
    //    echo "tomorrow_day_name_french - <strong>".$tomorrow_day_name_french."</strong><br>";
    $output .= "<div class='table-responsive'>";
    $output .= "<table class='table table-striped table-bordered table-hover table-condensed'>";
    $output .= "<tr>";
    $output .= "<th class='text-center' style='vertical-align:middle;'>Heure</th>";
    for ($a = 1; $a <= 7; $a++) {
        $day = day_fr($a);
        // func return Lundi, Mardi...
        if ($a == $tomorrow_no) {
            $output .= "<td class='text-center alert-danger' style='color: white'><strong>";
            $output .= "<a href=\"{$page_name}?jour=";
            $output .= urlencode($a);
            $output .= "&";
            $output .= "modele_date=";
            $output .= urldecode($tomorrow_date_sql);
            $output .= "\" onclick=\"return confirm('Importer {$day}?');";
            $output .= "\">";
            $output .= $day . " " . $tomorrow_date_formatted;
            $output .= "&nbsp;&nbsp&nbsp";
            $output .= "<span class='glyphicon glyphicon-plus'style='color:green;' aria-hidden='true'></span>";
            $output .= "&nbsp;&nbsp&nbsp";
            $output .= "</a>";
            $output .= "</strong>";
            $output .= "</td>";
            //    $output .= "<td class='text-center' colspan='3'>Actions</td>";
            $output .= "</tr>";
            $output .= "<tr>";
            //  $output .= "<td></td>";
        }
        // end if
    }
    // end for
    $old_heure = "";
    while ($modele = mysqli_fetch_assoc($modele_set)) {
        for ($a = 1; $a <= 7; $a++) {
            $day = day_fr($a);
            // func return Lundi, Mardi...
            $modele_id = $modele[$day];
            // return value of array
            if ($a == $tomorrow_no && $modele[$day]) {
                $output .= "<tr>";
                $new_heure = $modele['heure'];
                if ($new_heure !== $old_heure) {
                    $output .= "<td class='text-center' style='vertical-align:middle;'><strong>" . htmlentities(visu_heure($modele["heure"]), ENT_COMPAT, 'utf-8') . "</strong></td>";
                } else {
                    $output .= "<td></td>";
                }
                $old_heure = $modele["heure"];
            }
        }
        $p_edit = "edit_course_modele.php";
        $p_del = "delete_course_modele.php";
        $p_new = "new_course_modele.php";
        $web_view = htmlentities($modele["web_view"]);
        $pseudo = htmlentities($modele["pseudo"]);
        $heure = $modele['heure'];
        $client_id = $modele['client_id'];
        if ($web_view) {
            $client_name = $web_view;
        } else {
            $client_name = $pseudo;
        }
        for ($a = 1; $a <= 7; $a++) {
            $day = day_fr($a);
            // func return Lundi, Mardi...
            $modele_id = $modele[$day];
            // return value of array
            if ($a == $tomorrow_no && $modele[$day]) {
                if ($day == $tomorrow_day_name_french) {
                    $output .= "<td class='text-center'>";
                }
                //                $output.= tooltips_modele($modele_id,$client_name);
                $output .= tooltips_modele($modele_id);
                $output .= "<span class='btn'>";
                if ($visible == 1) {
                    $output .= "<a class='btn btn-primary  btn-xm' style='width:14em;' ";
                } else {
                    $output .= "<a class='btn btn-info  btn-xm' style='width:14em;' ";
                }
                $output .= get_modal_modele($modele_id, $tomorrow_date_sql);
                $output .= "</a>";
                $output .= "</span>";
                $output .= "</td>";
                //                $output .= "<td>";
                //                $output .= "<a href=\"{$p_edit}?client_id=";
                //                $output .= urlencode($client_id) . "&modele_id=" . urlencode($modele_id) . "&jour_id=" . urlencode($a);
                //                $output .= " \" onclick=\"return confirm('Editer modele {$pseudo} ?');";
                //                $output .= " \">";
                //                $output.="&nbsp;&nbsp&nbsp";
                //                $output .= "<span class='glyphicon glyphicon-pencil'style='color:blue;' aria-hidden='true'></span>";
                //                $output.="&nbsp;&nbsp&nbsp";
                //                $output .= "</a>";
                //                $output .= "</td>";
                //
                //                $output .= "<td>";
                //                $output .= "<a href=\"{$p_new}?client_id=";
                //                $output .= urlencode($client_id) . "&modele_id=" . urlencode($modele_id);
                //                $output .= " \" onclick=\"return confirm('Nouveau modele {$pseudo} ?');";
                //                $output .= " \">";
                //                $output.="&nbsp;&nbsp&nbsp";
                //                $output .= "<span class='glyphicon glyphicon-plus'style='color:green;' aria-hidden='true'></span>";
                //                $output.="&nbsp;&nbsp&nbsp";
                //                $output .= "</a>";
                //                $output .= "</td>";
                //
                //
                //                $output .= "<td>";
                //                $output .= "<a href=\"{$p_del}?modele_id=" . urlencode($modele_id);
                //                $output .= " \" onclick=\"return confirm('Delete modele {$pseudo} {$day} à {$heure}?');";
                //                $output .= " \">";
                //                $output.="&nbsp;&nbsp&nbsp";
                //                $output .= "<span class='glyphicon glyphicon-remove'style='color:red;' aria-hidden='true'></span>";
                //                $output.="&nbsp;&nbsp&nbsp";
                //                $output .= "</a>";
                //
                //                $output .= "</td>";
                $output .= "</tr>";
            }
        }
    }
    // while
    $output .= "</table>";
    mysqli_free_result($modele_set);
    $output .= "</div>";
    return $output;
}
Ejemplo n.º 3
0
function date_fr($str_time = 'now')
{
    $unix_time = strtotime($str_time);
    $day_wk_no = day_eng_no(strftime("%A", $unix_time));
    $nom_jour = day_fr($day_wk_no);
    $nom_jour_short = substr($nom_jour, 0, 3);
    $jour_no = strftime("*%d", $unix_time);
    $jour_no = str_replace('*0', '', $jour_no);
    $jour_no = str_replace('*', '', $jour_no);
    $now_month = mth_fr_name(strftime("%B", $unix_time));
    $now_month_short = substr($now_month, 0, 4);
    $now_year = strftime("%Y", $unix_time);
    $now_year_short = substr($now_year, 2, 2);
    $hour_minute = strftime("*%H:%M", $unix_time);
    $hour_minute = str_replace('*0', '', $hour_minute);
    $hour_minute = str_replace('*', '', $hour_minute);
    $date_fr = h($jour_no . "." . $now_month . "." . $now_year);
    $date_fr_short = h($nom_jour_short . " " . $jour_no . " " . $now_month_short . " " . $now_year_short);
    $date_fr_long = h($nom_jour . " " . $jour_no . " " . $now_month . " " . $now_year);
    $date_fr_hr = h($jour_no . "." . $now_month . "." . $now_year . " - " . $hour_minute);
    $date_fr_short_hr = $nom_jour_short . " " . $jour_no . " " . $now_month_short . " " . $now_year_short . " - " . $hour_minute;
    $date_fr_long_hr = h($nom_jour . " " . $jour_no . " " . $now_month . " " . $now_year . " - " . $hour_minute);
    $date_fr_full_hr = h($nom_jour . " " . $jour_no . " " . $now_month . " " . $now_year . " " . $hour_minute);
    return array($date_fr, $date_fr_short, $date_fr_long, $date_fr_hr, $date_fr_short_hr, $date_fr_long_hr, $date_fr_full_hr);
    //    list ($date_fr,$date_fr_short,$date_fr_long,$date_fr_hr,$date_fr_short_hr,$date_fr_long_hr,$date_fr_full_hr)= date_fr($date_sql);
}
Ejemplo n.º 4
0
include "../includes/layouts/header_2.php";
include "../includes/layouts/nav.php";
?>

<?php 
?>



<h2 class="text-center">test<a href="manage_courses_modele.php">toutes les courses</a> </h2>
<?php 
echo "<hr>";
$date = "2015-05-27";
$today = strtotime($date);
$today_day_name = strftime("%A", $today);
$today_no = day_eng_no($today_day_name);
$today_french_name = day_fr($today_no);
$today_date_sql = strftime("%Y-%m-%d", $today);
$today_month_name = strftime("%B", $today);
$today_month_no = strftime("%m", $today);
$today_month_name_fr = mth_fr_name($today_month_name);
$today_month_no_fr = mth_fr_no($today_month_no);
echo "Date first variable - " . $date . "<br>";
echo "mktime(0,0,0,5,27,2015)  - " . mktime(0, 0, 0, 5, 27, 2015) . "<br>";
echo "day - strtotime('2015-05-27') - " . $today . "<br>";
echo "day_day_name - strftime('%A' ,{$today}) - " . $today_day_name . "<br>";
echo "day_no - day_eng_no({$today_day_name}) - " . $today_no . "<br>";
echo "day_french_name - day_fr({$today_no}) - " . $today_french_name . "<br>";
echo "day_date_sql - strftime('%Y-%m-%d' ,{$today}) - " . $today_date_sql . "<br>";
echo "today_month_name  strftime('%B' ) - " . $today_month_name . "<br>";
echo "today_month_no  strftime('%m' ) - " . $today_month_no . "<br>";