Example #1
0
function dupliquer_batterie()
{
    global $page;
    global $batterie;
    global $message;
    $page['gabarit'] = "administration";
    if (isset($_SESSION['role_user']) && droit_acces($batterie['dupliquer_batterie'], $_SESSION['role_user'])) {
        //recuperation de l'id de la batterie
        if (isset($_GET['id'])) {
            $id = $_GET['id'];
        }
        if (isset($_POST['id_batterie'])) {
            $id = $_POST['id_batterie'];
        }
        //chargement des vues
        $page['vue'] = "batteries/batterie_test.vue.php";
        $page['colonne'] = "batteries/sidebar_batterie_test.vue.php";
        //chargement listes batteries, etats et motifs
        $page['batteries'] = liste_batteries();
        $page['etat'] = liste_etat();
        $page['motif'] = liste_motif();
        $page['lieu'] = liste_lieux_auteur();
        $page['batterie'] = get_batterie($id);
        $page['batterie'] = $page['batterie'][0];
        //retourne la valeur du tableau a l'indice 0
        $page['batterie']['id_batterie'] = $id;
        $page['projet'] = liste_projet();
        if (isset($_POST['dupli_batterie'])) {
            if (is_current_version_test($_POST['id_batterie'], $_POST['revision'])) {
                //champs obligatoires
                if ($_POST['code_batterie'] != "" && $_POST['version_batterie'] != "" && $_POST['projet_batterie'] != "") {
                    $id_projet = existe_projet($_POST['projet_batterie']);
                    //fonction de duplication
                    $id = duplication_batterie($_POST['id_batterie'], $_POST['code_batterie'], $_POST['version_batterie'], $id_projet);
                    if ($id == false) {
                        $page['message'] = $message['batterie_existe'];
                    } else {
                        //Redirection après modification
                        header('Location: index.php?controleur=batterie_test&tache=visualiser_batterie&id=' . $id);
                    }
                } else {
                    $page['message'] = $message['champs_obligatoire_2'];
                }
            } else {
                $page['message'] = $message['batterie_outdated'];
            }
        }
    } else {
        $page['vue'] = "erreur_droit.vue.php";
    }
}
Example #2
0
function modifier_item()
{
    global $page;
    global $item;
    global $message;
    $page['gabarit'] = "administration";
    if (isset($_SESSION['role_user']) && droit_acces($item['modifier_item'], $_SESSION['role_user'])) {
        $page['vue'] = "items/item.vue.php";
        $page['colonne'] = "items/sidebar_item.vue.php";
        $page['etat'] = liste_etat();
        $page['categorie'] = liste_categorie();
        $page['items'] = liste_item();
        $page['lieu'] = liste_lieux_auteur();
        $page['sphere'] = liste_sphere();
        $page['facteur'] = liste_facteur();
        $page['projet'] = liste_projet();
        if (isset($_GET['id'])) {
            $id = $_GET['id'];
        }
        if (isset($_POST['id_item'])) {
            $id = $_POST['id_item'];
        }
        if (is_proprietaire($id) || is_admin($_SESSION['id_user'])) {
            $page['item'] = get_item($id);
            $page['item'] = $page['item'][0];
            $page['item']['id_sphere'] = get_id_sphere($page['item']['id_categorie']);
            if (isset($_POST['modif_item'])) {
                if (is_current_version_item($_POST['id_item'], $_POST['revision'])) {
                    if (!has_resulat_item($_POST['id_item']) && !on_test($_POST['id_item']) && $page['item']['id_etat'] <= 2) {
                        if ($_POST['libelle_item'] != "" && $_POST['projet_item'] != "" && $_POST['id_sphere'] != "" && $_POST['id_facteur'] != "") {
                            $id_projet = existe_projet($_POST['projet_item']);
                            $resolution = $_POST['resolution'];
                            $resolutionitem = $page['item']['resolution_item'];
                            // decomposition de la variable rentre par l'utilisateur
                            $width = substr($resolution, 0, strpos($resolution, ' x '));
                            $height = substr($resolution, strpos($resolution, ' x ') + 3, strlen($resolution));
                            //calcul de la tolerance par rapport à la  valeur de resolution en base
                            $width0 = substr($resolutionitem, 0, strpos($resolutionitem, ' x '));
                            $height0 = substr($resolutionitem, strpos($resolutionitem, ' x ') + 3, strlen($resolutionitem));
                            $widthTol = (int) ($width0 - $width0 * tolerance);
                            $heightTol = (int) ($height0 - $height0 * tolerance);
                            if ($width >= $widthTol) {
                                if ($_POST['duree_item'] == '' || is_numeric($_POST['duree_item']) && $_POST['duree_item'] >= 0) {
                                    $res = modification_item($_POST['libelle_item'], $id_projet, $_POST['difficulte_item'], 1, $_POST['duree_item'], $_POST['id_facteur'], $_POST['id_item'], $resolution, $_POST['commentaire'], $_POST['revision'], $_POST['id_lieu']);
                                    if ($res == 'false') {
                                        $page['message'] = $message['item_existe'];
                                    } elseif ($res == 'true') {
                                        synchro_projet($_POST['ancien_projet']);
                                        header("Location: index.php?controleur=item&tache=visualiser_item&id=" . $_POST['id_item']);
                                    }
                                } else {
                                    $page['message'] = $message['erreur_duree'];
                                }
                            } else {
                                $tol = tolerance * 100;
                                $page['message'] = str_replace('{TOLERANCE}', $tol, $message['resolution_inferieure']);
                            }
                        } else {
                            $page['message'] = $message['champs_obligatoire_2'];
                        }
                    } else {
                        $page['message'] = $message['pblm_etat'];
                    }
                } else {
                    $page['message'] = $message['item_outdated'];
                }
            }
        } else {
            $page['message'] = $message['non_proprietaire'];
        }
    } else {
        $page['vue'] = "erreur_droit.vue.php";
    }
}
Example #3
0
function modifier_test()
{
    global $page;
    global $test;
    global $message;
    $page['gabarit'] = "administration";
    if (isset($_SESSION['role_user']) && droit_acces($test['modifier_test'], $_SESSION['role_user'])) {
        if (isset($_GET['id'])) {
            $id = $_GET['id'];
        }
        if (isset($_POST['id_test'])) {
            $id = $_POST['id_test'];
        }
        $page['sphere'] = liste_sphere();
        $page['facteur'] = liste_facteur();
        $page['lieu'] = liste_lieux_auteur();
        $page['vue'] = "tests/test.vue.php";
        $page['colonne'] = "tests/sidebar_test.vue.php";
        $page['tests'] = liste_test();
        $page['etat'] = liste_etat();
        $page['categorie'] = liste_categorie();
        $page['test'] = get_test($id);
        $page['test'] = $page['test'][0];
        $page['test']['id_test'] = $id;
        $page['projet'] = liste_projet();
        if (isset($_POST['modif_test'])) {
            if (is_current_version_test($id, $_POST['revision'])) {
                if (get_etat_test($id) <= 2 && !has_reponse_test($id)) {
                    if ($_POST['code_test'] != "" && $_POST['version_test'] != "" && $_POST['duree_test'] != "" && $_POST['projet_test'] != "" && is_numeric($_POST['duree_test'])) {
                        if (!isset($_POST['aleatoire'])) {
                            $_POST['aleatoire'] = 'off';
                        }
                        if (!isset($_POST['retour_arriere'])) {
                            $_POST['retour_arriere'] = 'off';
                        }
                        $id_projet = existe_projet($_POST['projet_test']);
                        $res = modification_test($_POST['id_test'], $_POST['code_test'], $_POST['libelle_long_test'], $_POST['id_etat'], $_POST['id_lieu'], $_POST['duree_test'], $_POST['version_test'], $_POST['id_facteur'], $_POST['retour_arriere'], $_POST['aleatoire'], $_POST['commentaires'], $id_projet);
                        if (!$res) {
                            $page['message'] = $message['test_existe'];
                        } else {
                            synchro_projet($_POST['ancien_projet']);
                            header("Location: index.php?controleur=test&tache=visualiser_test&id=" . $_POST['id_test']);
                        }
                    } else {
                        $page['message'] = $message['champs_obligatoire_2'];
                    }
                } else {
                    $page['message'] = $message['pblm_etat'];
                }
            } else {
                $page['message'] = $message['outdated_test'];
            }
        }
    } else {
        $page['vue'] = "erreur_droit.vue.php";
    }
}