Exemplo n.º 1
0
 public function choisir_chauffeur()
 {
     global $connection;
     $query = "SELECT DISTINCT ";
     $query .= "pseudo ";
     $query .= "FROM courses ";
     if (is_chauffeur()) {
         $query .= "WHERE chauffeur ='{$_SESSION['nom']}' ";
     }
     $query .= "ORDER BY pseudo DESC ";
 }
Exemplo n.º 2
0
<?php

require_once '../includes/initialize.php';
confirm_logged_in();
if (is_chauffeur()) {
    redirect_to('manage_program.php');
}
?>



<?php 
if (isset($_GET["url"])) {
    $url = $_GET["url"];
} else {
    $url = "mylinks.php";
}
$errors = array();
$missing = array();
$missing_Categ = array();
if (isset($_POST['submit_category'])) {
    $expected = array("category_group");
    $required_fields = array("category_group");
    //   require(LIB_PATH . DS . 'validation_functions_2.php');
    foreach ($_POST as $key => $value) {
        $temp = is_array($value) ? $value : trim($value);
        if (empty($temp) && in_array($key, $required_fields)) {
            $missing_Categ[] = $key;
            ${$key} = '';
        } elseif (in_array($key, $expected)) {
            ${$key} = mysql_prep($temp);
Exemplo n.º 3
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;
}
Exemplo n.º 4
0
                    <div class="col-sm-9">
                        <select class="form-control"  name="chauffeur" id="chauffeur"  >
                             <option value=
                            "<?php 
echo htmlentities($modele['chauffeur'], ENT_COMPAT, 'utf-8');
?>
">

                             <?php 
echo htmlentities($modele['chauffeur'], ENT_COMPAT, 'utf-8');
?>
                            </option>


                            <?php 
if (!is_chauffeur()) {
    ?>
                                <?php 
    if (isset($chauffeur)) {
        echo selection_chauffeurs($chauffeur);
    } else {
        echo selection_chauffeurs();
    }
    ?>
                            <?php 
}
?>

                        </select>
                    </div></div>
Exemplo n.º 5
0
Arquivo: nav.php Projeto: kamy333/kamy
                </ul>




            </div>
         </nav>
    </div>

<?php 
//  echo "<p class='text-left'><small>".$complete_date."</small></p>";
?>


<?php 
if (isset($_SESSION['user_type_id']) && (is_manager() || is_admin() || is_chauffeur())) {
    ?>

    <?php 
    if ($layout_context == "admin") {
        ?>



<ol class="breadcrumb">

    <li
        <?php 
        if (isset($javascript) && $javascript == "admin_course") {
            echo "class=\"active \"";
        }
Exemplo n.º 6
0
function find_course_by_id($course_id)
{
    global $connection;
    $safe_course_id = mysqli_real_escape_string($connection, $course_id);
    $query = "SELECT * ";
    $query .= "FROM courses ";
    $query .= "WHERE id = {$safe_course_id} ";
    $restrict = is_chauffeur();
    if ($restrict) {
        $query .= " AND chauffeur ='{$_SESSION['nom']}' ";
    }
    $query .= "LIMIT 1";
    $course_set = mysqli_query($connection, $query);
    confirm_query($course_set);
    if ($course = mysqli_fetch_assoc($course_set)) {
        return $course;
    } else {
        return null;
    }
}
Exemplo n.º 7
0
function output_clients_select_list_all()
{
    global $connection;
    $table_name = 'clients';
    $liste_rank = true;
    if (is_chauffeur()) {
        $liste_restrictive = true;
    } else {
        $liste_restrictive = false;
    }
    $output = "";
    // $output_form = "";
    $query = "SELECT ";
    $query .= " * ";
    $query .= "FROM {$table_name} ";
    if ($liste_restrictive) {
        $query .= "WHERE liste_restrictive = 1 ";
    }
    $query .= "ORDER BY liste_rank ASC, liste_restrictive DESC, pseudo ASC ";
    $return_query_set = mysqli_query($connection, $query);
    confirm_query($return_query_set);
    while ($return_query = mysqli_fetch_assoc($return_query_set)) {
        $data = htmlentities($return_query['pseudo'], ENT_COMPAT, 'utf-8');
        $web_view = htmlentities($return_query['web_view'], ENT_COMPAT, 'utf-8');
        $output .= "<option value= '{$data}'>";
        $output .= $web_view;
        $output .= "</option>";
    }
    mysqli_free_result($return_query);
    return $output;
}
Exemplo n.º 8
0
    // admin ID was missing or invalid or
    // admin couldn't be found in database
    $_SESSION["message"] = "La course a déjà été validé. Veuillez la reactiver puis l'annuller.";
    redirect_to($url);
}
$chauffeur_existing = $program["chauffeur"];
$chauffeur = $_SESSION["nom"];
// todo error report kevin course on another page
validate_chauffeur_by_name($chauffeur);
if (!empty($errors)) {
    $_SESSION["errors"] = $errors;
    redirect_to($url);
}
$safe_chauffeur = mysql_prep($chauffeur);
$validated_chauffeur = $program["validated_chauffeur"];
if (is_chauffeur() && ($validated_chauffeur == 1 || $validated_chauffeur == 2)) {
    if ($_SESSION['nom'] !== $chauffeur_existing) {
        $_SESSION["message"] = " La course a déjà été validé ou Annullé par " . htmlentities($chauffeur_existing, ENT_COMPAT, 'utf-8');
        redirect_to($url);
    }
}
if (empty($errors)) {
    $id = $program["id"];
    if ($validated_chauffeur == 1 || $validated_chauffeur == 0) {
        $id_valid = 2;
    } else {
        $id_valid = 0;
    }
    $query = "UPDATE programmed_courses SET" . " ";
    $query .= "validated_chauffeur = {$id_valid}, ";
    $query .= "chauffeur = '{$safe_chauffeur}' ";
    $_SESSION["message"] = "Program Course does not exist in  database.";
    //   redirect_to("manage_program.php");
    redirect_to($url);
}
$chauffeur_existing = $program["chauffeur"];
$chauffeur = $_SESSION["nom"];
// todo error report kevin course on another page
validate_chauffeur_by_name($chauffeur);
if (!empty($errors)) {
    $_SESSION["errors"] = $errors;
    //  redirect_to("manage_program.php");
    redirect_to($url);
}
$safe_chauffeur = mysql_prep($chauffeur);
$validated_chauffeur = $program["validated_chauffeur"];
if (is_chauffeur() && $validated_chauffeur == 1) {
    if ($_SESSION['nom'] !== $chauffeur_existing) {
        $_SESSION["message"] = " La course a déjà été validé par " . htmlentities($chauffeur_existing, ENT_COMPAT, 'utf-8');
        //  redirect_to("manage_program.php");
        redirect_to($url);
    }
}
if (empty($errors)) {
    $id = $program["id"];
    if ($validated_chauffeur == 1) {
        $id_valid = 0;
    } else {
        $id_valid = 1;
    }
    $query = "UPDATE programmed_courses SET" . " ";
    $query .= "validated_chauffeur = {$id_valid}, ";
Exemplo n.º 10
0
function output_historical_program_details()
{
    $output = "";
    $program_set = find_all_programmed_courses();
    $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;'>Validation</th>";
    if (!is_chauffeur()) {
        $output .= "<th class='text-center' style='vertical-align:middle;'>Val Mgr</th>";
        $output .= "<th class='text-center' style='vertical-align:middle;'>Val Final</th>";
    }
    $output .= "<th class='text-center' style='vertical-align:middle;'>ID</th>";
    $output .= "<th class='text-center' style='vertical-align:middle;'>Date</th>";
    //  $output .= "<th class='text-center' style='vertical-align:middle;'>Client ID</th>";
    $output .= "<th class='text-center' style='vertical-align:middle;'>Pseudo</th>";
    $output .= "<th class='text-center' style='vertical-align:middle;'>Heure</th>";
    $output .= "<th class='text-center' style='vertical-align:middle;'>Chauffeur</th>";
    $output .= "<th class='text-center' style='vertical-align:middle;'>départ</th>";
    $output .= "<th class='text-center' style='vertical-align:middle;'>Arrivée</th>";
    if (!is_chauffeur()) {
        $output .= "<th class='text-center' style='vertical-align:middle;'>Prix Course</th>";
    }
    $output .= "<th class='text-center' style='vertical-align:middle;'>Pseudo Autres</th>";
    $output .= "<th class='text-center' style='vertical-align:middle;'>Nom Patient</th>";
    $output .= "<th class='text-center' style='vertical-align:middle;'>Bon_no</th>";
    $output .= "<th class='text-center' style='vertical-align:middle;'>Action</th>";
    $output .= "</tr>";
    $prev_year = "";
    $prev_mth = "";
    $prev_wk = "";
    while ($program = mysqli_fetch_assoc($program_set)) {
        foreach ($program as $key => $val) {
            ${$key} = htmlentities(trim($val), ENT_COMPAT, 'utf-8');
        }
        $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 == $program["course_date"]) {
            $color = "success";
        } elseif ($tomorrow_date_sql == $program["course_date"]) {
            $color = "warning";
        } elseif ($yesterday_date_sql == $program["course_date"]) {
            $color = "danger";
        } else {
            $color = "";
        }
        $href = $_SERVER['PHP_SELF'];
        // $query_string=$_SERVER['QUERY_STRING'];
        // $query_string=str_replace("str_time","str_time_old",$query_string);
        //     var_dump($query_string);
        if (isset($course_date)) {
            $href .= "?str_time=" . urlencode($course_date);
            $href .= "&historical_course_date=" . urlencode($course_date);
            $href .= "&submit=" . urlencode("historical_details");
        }
        $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>";}
        if (isset($validated_chauffeur)) {
            if ($validated_chauffeur == 0) {
                $validated_chauffeur_view = "<span class='glyphicon glyphicon-question-sign' style='color:#0000ff' aria-hidden='true'></span>";
            } elseif ($validated_chauffeur == 1) {
                $validated_chauffeur_view = "<span class='glyphicon glyphicon-ok' style='color: green' aria-hidden='true'></span>";
            } elseif ($validated_chauffeur == 2) {
                $validated_chauffeur_view = "<span class='glyphicon glyphicon-remove' style='color: #ff0000' aria-hidden='true'></span>";
            } else {
                $validated_chauffeur_view = "bug";
            }
            $href_chauffeur = $href . "&validation_chauffeur=" . urlencode($validated_chauffeur);
            $output .= "<td class='text-center' style='vertical-align: middle;'>";
            $output .= "<a href='{$href_chauffeur}'>";
            $output .= $validated_chauffeur_view;
            $output .= "</a>";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        if (!is_chauffeur()) {
            if (isset($validated_mgr)) {
                if ($validated_mgr == 0) {
                    $validated_mgr_view = "<span class='glyphicon glyphicon-question-sign' style='color:#0000ff' aria-hidden='true'></span>";
                } elseif ($validated_mgr == 1) {
                    $validated_mgr_view = "<span class='glyphicon glyphicon-ok' style='color: green' aria-hidden='true'></span>";
                } else {
                    $validated_mgr_view = "bug";
                }
                $href_mgr = $href . "&validation_mgr=" . urlencode($validated_mgr);
                $output .= "<td class='text-center' style='vertical-align: middle;'>";
                $output .= "<a href='{$href_mgr}'>";
                $output .= $validated_mgr_view;
                $output .= "</a>";
                $output .= "</td>";
            } else {
                $output .= "<td></td>";
            }
            if (isset($validated_final)) {
                if ($validated_final == 0) {
                    $validated_final_view = "<span class='glyphicon glyphicon-question-sign' style='color:#0000ff' aria-hidden='true'></span>";
                } elseif ($validated_final == 1) {
                    $validated_final_view = "<span class='glyphicon glyphicon-ok' style='color: green' aria-hidden='true'></span>";
                } else {
                    $validated_final_view = "bug";
                }
                $href_final = $href . "&validation_final=" . urlencode($validated_final);
                $output .= "<td class='text-center' style='vertical-align: middle;'>";
                $output .= "<a href='{$href_final}'>";
                $output .= $validated_final_view;
                $output .= "</a>";
                $output .= "</td>";
            } else {
                $output .= "<td></td>";
            }
        }
        if (isset($id)) {
            $href_id = $href . "&program_id=" . urlencode($id);
            $output .= "<td class='text-center' style='vertical-align: middle;'>";
            $output .= "<a href='{$href_id}'>";
            $output .= $id;
            $output .= "</a>";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        if (isset($course_date)) {
            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($course_date);
            $output .= "<td class='text-center' style='vertical-align: middle;'>";
            $output .= "<a href='{$href}'>";
            $output .= $date_fr_short;
            $output .= "</a>";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        if (isset($pseudo) && isset($id)) {
            //  $href_id=$href."&program_id=". urlencode($id);
            $href_pseudo = $_SERVER['PHP_SELF'];
            $href_pseudo .= "?historical_pseudo=" . urlencode($pseudo);
            $href_pseudo .= "&submit=" . urlencode("historical_details");
            $output .= "<td class='text-center' style='vertical-align: middle;'>";
            $output .= "<a href='{$href_pseudo}'>";
            $output .= $pseudo;
            $output .= "</a>";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        if (isset($heure)) {
            //  $href_id=$href."&program_id=". urlencode($id);
            $output .= "<td class='text-center' style='vertical-align: middle;'>";
            //      $output .= "<a href='{$href_id}'>";
            $output .= $heure;
            //     $output .="</a>";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        if (isset($chauffeur)) {
            //  $href_id=$href."&program_id=". urlencode($id);
            $output .= "<td class='text-center' style='vertical-align: middle;'>";
            //      $output .= "<a href='{$href_id}'>";
            $output .= $chauffeur;
            //     $output .="</a>";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        if (isset($depart)) {
            //  $href_id=$href."&program_id=". urlencode($id);
            $output .= "<td class='text-center' style='vertical-align: middle;'>";
            //      $output .= "<a href='{$href_id}'>";
            $output .= $depart;
            //     $output .="</a>";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        if (isset($arrivee)) {
            //  $href_id=$href."&program_id=". urlencode($id);
            $output .= "<td class='text-center' style='vertical-align: middle;'>";
            //      $output .= "<a href='{$href_id}'>";
            $output .= $arrivee;
            //     $output .="</a>";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        if (isset($prix_course)) {
            //  $href_id=$href."&program_id=". urlencode($id);
            $output .= "<td class='text-center' style='vertical-align: middle;'>";
            //      $output .= "<a href='{$href_id}'>";
            $output .= $prix_course;
            //     $output .="</a>";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        if (isset($pseudo_autres)) {
            //  $href_id=$href."&program_id=". urlencode($id);
            $output .= "<td class='text-center' style='vertical-align: middle;'>";
            //      $output .= "<a href='{$href_id}'>";
            $output .= $pseudo_autres;
            //     $output .="</a>";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        if (isset($nom_patient) && isset($error_pseudo)) {
            if ($nom_patient) {
                $nom_patient_view = $nom_patient;
            } else {
                if ($error_pseudo == "Erreur:nom patient vide") {
                    $nom_patient_view = $error_pseudo;
                } else {
                    $nom_patient_view = $nom_patient;
                }
            }
            //  $href_id=$href."&program_id=". urlencode($id);
            $output .= "<td class='text-center' style='vertical-align: middle;'>";
            //      $output .= "<a href='{$href_id}'>";
            $output .= $nom_patient_view;
            //     $output .="</a>";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        if (isset($bon_no)) {
            //  $href_id=$href."&program_id=". urlencode($id);
            $output .= "<td class='text-center' style='vertical-align: middle;'>";
            //      $output .= "<a href='{$href_id}'>";
            $output .= $bon_no;
            //     $output .="</a>";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        if (isset($id) && isset($course_date)) {
            $output .= "<td>";
            $url = "&url=" . urlencode($_SERVER['PHP_SELF']);
            $query_string = "&str_time=" . urlencode($course_date);
            $query_string .= "&historical_course_date=" . urlencode($course_date);
            $query_string .= "&submit=" . urlencode('historical_details');
            $p_edit = "<li><a href=' " . "edit_course_program.php?program_id=" . urlencode($id) . $query_string . $url . "'>Edit</a>";
            $p_del = "<li><a href=' " . "delete_course_program.php?program_id=" . urlencode($id) . $query_string . $url . "'>Delete</a>";
            $p_new = "<li><a href=' " . "new_course_program.php?program_id=" . urlencode($id) . $query_string . $url . "'>Add</a>";
            $p_annulation = "<li><a href=' " . "edit_annuler_course_program.php?program_id=" . urlencode($id) . $query_string . $url . "'>Annuler</a>";
            $p_validation = "<li><a href=' " . "edit_validation_chauffeur_program.php?program_id=" . urlencode($id) . $query_string . $url . "'>Valid chauffeur</a>";
            $p_validation_mgr = "<li><a href=' " . "edit_validation_mgr_program.php?program_id=" . urlencode($id) . $query_string . $url . "'>Valid mgr</a>";
            $p_validation_final = "<li><a href=' " . "edit_validation_final_program.php?program_id=" . urlencode($id) . $query_string . $url . "'>Valid final</a>";
            $output .= "     <div class='dropdown'>\n  <button id='dLabel' type='button' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>\n            Action &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n        <span class='caret'></span>\n  </button>\n  <ul class='dropdown-menu' aria-labelledby='dLabel'>\n   {$p_edit}{$p_del}{$p_new}{$p_annulation} {$p_validation} {$p_validation_mgr} {$p_validation_final}\n  </ul>\n</div> ";
            $output .= "";
            $output .= "</td>";
        } else {
            $output .= "<td></td>";
        }
        $output .= "</tr>";
    }
    // end while
    $output .= "</table>";
    $output .= "</div>";
    mysqli_free_result($program_set);
    return $output;
}