function table_historical() { $date_set = find_distinct_course_date(); $output = ""; $output .= "<div class='table-responsive'>"; $output .= "<table class='table table-striped table-bordered table-hover table-condensed'>"; $output .= "<tr>"; // $output .= "<td class='text-center alert-danger'>Jour</td>"; //Heure $output .= "<th class='text-center' style='vertical-align:middle;'>Année</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Mois</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Semaine</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Date</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Total courses</th>"; if (!is_chauffeur()) { $output .= "<th class='text-center' style='vertical-align:middle;'>Prix course à 0</th>"; } $output .= "<th class='text-center' style='vertical-align:middle;'>Non Valid Chauff</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Valid Chauff</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Annulé</th>"; if (!is_chauffeur()) { $output .= "<th class='text-center' style='vertical-align:middle;'>Non Valid Manager</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Valid Manager</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Non Valid final</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Valid final</th>"; } $output .= "<th class='text-center' style='vertical-align:middle;'>Err Chauffeur</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Err Adresse</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Err Autres</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Err Patients</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Err Sang</th>"; $output .= "<th class='text-center' style='vertical-align:middle;'>Err total</th>"; $output .= "</tr>"; $prev_year = ""; $prev_mth = ""; $prev_wk = ""; while ($date = mysqli_fetch_assoc($date_set)) { foreach ($date as $key => $val) { ${$key} = htmlentities(trim($val), ENT_COMPAT, 'utf-8'); } if (isset($monthname)) { $monthname = mth_fr_name($monthname); } $today_date_sql = strftime("%Y-%m-%d", time()); $tomorrow_date_sql = strftime("%Y-%m-%d", strtotime("tomorrow")); $yesterday_date_sql = strftime("%Y-%m-%d", strtotime("yesterday")); // var_dump($date["course_date"]); // var_dump($tomorrow_date_sql); // var_dump($yesterday_date_sql); if ($today_date_sql == $date["course_date"]) { $color = "success"; } elseif ($tomorrow_date_sql == $date["course_date"]) { $color = "warning"; } elseif ($yesterday_date_sql == $date["course_date"]) { $color = "danger"; } else { $color = ""; } $output .= "<tr class='{$color}'>"; if (isset($year)) { if ($year == $prev_year) { $output .= "<td></td>"; } else { $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= ""; $output .= $year; $output .= "</td>"; $prev_year = $year; } } else { $output .= "<td></td>"; } if (isset($monthname)) { if ($monthname == $prev_mth) { $output .= "<td></td>"; } else { $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= $monthname; $output .= "</td>"; $prev_mth = $monthname; } } else { $output .= "<td></td>"; } if (isset($week)) { if ($week == $prev_wk) { $output .= "<td></td>"; } else { $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= ""; $output .= $week; $output .= "</td>"; } $prev_wk = $week; } else { $output .= "<td></td>"; } $href = $_SERVER['PHP_SELF']; if (isset($str_time)) { $href .= "?str_time=" . urlencode($str_time); } if (isset($date_format) && isset($course_date)) { $href_Course_date = "&historical_course_date=" . urlencode($course_date); $href_Course_date .= "&submit=" . urlencode('historical_details'); // $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href}{$href_Course_date}'>"; $output .= $date_format; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } if (isset($total_course)) { $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= $total_course; $output .= "</td>"; } else { $output .= "<td></td>"; } if (!is_chauffeur()) { if (isset($prix_course_0)) { $href_valid_0 = $href . "&prix_course=" . urlencode(0); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_valid_0}'>"; $output .= $prix_course_0; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } } if (isset($valid_chauf_0)) { $href_valid_0 = $href . "&validation_chauffeur=" . urlencode(0); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_valid_0}'>"; $output .= $valid_chauf_0; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } if (isset($valid_chauf_1)) { $href_valid_1 = $href . "&validation_chauffeur=" . urlencode(1); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_valid_1}'>"; $output .= $valid_chauf_1; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } if (isset($valid_chauf_2)) { $href_valid_2 = $href . "&validation_chauffeur=" . urlencode(2); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_valid_2}'>"; $output .= $valid_chauf_2; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } if (!is_chauffeur()) { if (isset($valid_mgr_0)) { $href_mgr_0 = $href . "&validation_mgr=" . urlencode(0); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_mgr_0}'>"; $output .= $valid_mgr_0; $output .= "</a>"; $output .= "</td>"; } } if (!is_chauffeur()) { if (isset($valid_mgr_1)) { $href_mgr_1 = $href . "&validation_mgr=" . urlencode(1); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_mgr_1}'>"; $output .= $valid_mgr_1; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } } if (!is_chauffeur()) { if (isset($valid_fina1_0)) { $href_final_0 = $href . "&validation_final=" . urlencode(0); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_final_0}'>"; $output .= $valid_fina1_0; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } } if (!is_chauffeur()) { if (isset($valid_fina1_1)) { $href_final_1 = $href . "&validation_final=" . urlencode(1); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_final_1}'>"; $output .= $valid_fina1_1; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } } if (isset($erreur_chauffeur)) { $href_erreur_chauffeur = $href . "&erreur_chauffeur=" . urlencode('yes'); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_erreur_chauffeur}'>"; $output .= $erreur_chauffeur; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } if (isset($erreur_address)) { $href_erreur_address = $href . "&erreur_address=" . urlencode('yes'); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_erreur_address}'>"; $output .= $erreur_address; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } if (isset($erreur_autres)) { $href_error_autres = $href . "&erreur_autres=" . urlencode('yes'); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_error_autres}'>"; $output .= $erreur_autres; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } if (isset($erreur_patients)) { $href_error_patients = $href . "&erreur_patients=" . urlencode('yes'); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_error_patients}'>"; $output .= $erreur_patients; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } if (isset($erreur_sang)) { $href_error_sang = $href . "&erreur_sang=" . urlencode('yes'); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_error_sang}'>"; $output .= $erreur_sang; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } if (isset($erreur_general)) { $href_error_general = $href . "&error_general=" . urlencode('yes'); $output .= "<td class='text-center' style='vertical-align: middle;'>"; $output .= "<a href='{$href_error_general}'>"; $output .= $erreur_general; $output .= "</a>"; $output .= "</td>"; } else { $output .= "<td></td>"; } $output .= "</tr>"; } $output .= "</table>"; mysqli_free_result($date_set); $output .= "</div>"; return $output; }
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); }
?> <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>"; echo "today_month_name_fr mth_fr_name({$today_month_name}) - " . $today_month_name_fr . "<br>"; echo "today_month_no:fr mth_fr_no({$today_month_name}) ) - " . $today_month_no_fr . "<br>"; echo strftime("%I %M", $today); echo "<br>"; echo "mktime(0,0,0,5,27,2015) - " . mktime(0, 0, 0, 5, 27, 2015) . "<br>";