Ejemplo n.º 1
0
function retirer_partage_batterie()
{
    global $page;
    global $batterie;
    global $message;
    $page['gabarit'] = "administration";
    if (isset($_SESSION['role_user']) && droit_acces($batterie['partage_batterie'], $_SESSION['role_user'])) {
        $page['vue'] = "batteries/retrait_partage.vue.php";
        $page['colonne'] = "batteries/sidebar_batterie_test.vue.php";
        //*recuperation de la liste des  motifs, et des tests pour la sidebar batterie
        $page['motif'] = liste_motif();
        $page['etat'] = liste_etat();
        //	$page['tests']                 =  liste_des_tests();
        $page['lieu'] = liste_lieux_auteur();
        //organismes auteurs
        $page['lieu2'] = liste_lieux();
        $page['projet'] = liste_projet();
        //chargement de la liste des batteries
        $page['batteries'] = liste_batteries();
        if (isset($_POST['rech_bat'])) {
            $page['tests'] = liste_des_tests($_POST['projet_batterie']);
            $page['batteries_recherche'] = json_encode(rechercher_partage2_batterie_json(1, 0, $_POST['code_batterie'], $_POST['id_etat'], $_POST['id_motif'], $_POST['version'], date_fr_to_en($_POST['date_mise_en_prod']), date_fr_to_en($_POST['date_retrait']), $_POST['id_lieu'], $_POST['projet_batterie']));
            //$error =json_last_error();	var_dump($page['batteries_recherche'] ,$error ==JSON_ERROR_UTF8);
        } elseif (isset($_POST['retirer'])) {
            if (isset($_POST['droits'])) {
                foreach ($_POST['droits'] as $droit) {
                    retirer_droit_test($droit);
                }
                //redirection sur la page d'accueil du controleur
                header("Location: index.php?controleur=batterie_test&tache=base");
            } else {
                $page['message'] = $message['batterie_obligatoire'];
            }
        }
    } else {
        $page['vue'] = "erreur_droit.vue.php";
    }
}
Ejemplo n.º 2
0
function modifier_motif()
{
    global $page;
    global $session;
    global $url;
    $page['gabarit'] = "administration";
    if (isset($_SESSION['role_user']) && droit_acces($session['modifier_motif'], $_SESSION['role_user'])) {
        $page['vue'] = "sessions/modif_motif.vue.php";
        $page['colonne'] = "sessions/sidebar_session.vue.php";
        $page['sessions'] = liste_session();
        $page['motif'] = liste_motif();
        $page['lieu'] = liste_lieux();
        if (isset($_POST['modif_motif'])) {
            if (isset($_POST['motif'])) {
                supprimer_motif_candidature($_POST['id_candidature']);
                if (isset($_POST['motif'])) {
                    foreach ($_POST['motif'] as $m) {
                        creation_motif_candidature($_POST['id_candidature'], $m);
                        //modification_motif($_POST['id_candidature'],$m);
                    }
                }
                //base();
            } else {
                supprimer_motif_candidature($_POST['id_candidature']);
                suppression_candidature($_POST['id_candidature'], $_POST['id_session']);
            }
            header("Location: index.php?controleur=session&tache=modifier_session&id=" . $_POST['id_session']);
        } else {
            $page['candidature'] = detail_candidature($_GET['id']);
            $page['candidature'] = $page['candidature'][0];
            $motif_json = liste_motif_json($_GET['id']);
            $page['motif_json'] = json_encode($motif_json);
            $page['session'] = detail_session($page['candidature']['id_session']);
            $page['session'] = $page['session'][0];
        }
    } else {
        $page['vue'] = "erreur_droit.vue.php";
    }
}
Ejemplo n.º 3
0
function exporter_test()
{
    global $page;
    global $resultat;
    global $message;
    $page['gabarit'] = "administration";
    if (isset($_SESSION['role_user']) && droit_acces($resultat['exporter_test'], $_SESSION['role_user'])) {
        $page['vue'] = "resultats/exporter_test.vue.php";
        $page['colonne'] = "tests/sidebar_test.vue.php";
        $page['tests'] = liste_test();
        $page['motifs'] = liste_motif();
        $page['lieux'] = liste_lieux();
        if (isset($_GET['id'])) {
            $id = $_GET['id'];
        }
        if (isset($_POST['id_test'])) {
            $id = $_POST['id_test'];
        }
        $page['id_test'] = $id;
        $page['test'] = get_test($id);
        $page['test'] = $page['test'][0];
        if (isset($_POST['exporter'])) {
            if (isset($_POST['type_export'])) {
                $test = get_contenu_test_actif($id);
                $i = 0;
                foreach ($test as $key => $content) {
                    if ($content['type'] == 'item') {
                        $item = get_item($content['id_element']);
                        $test[$i] = $item[0];
                        $i++;
                    } else {
                        $items = get_item_by_section($content['id_element']);
                        foreach ($items as $it) {
                            $test[$i] = $it;
                            $i++;
                        }
                    }
                }
                if ($_POST['type_export'] == 'valeur') {
                    $column = array();
                    foreach ($_POST["critere"] as $c) {
                        if ($c == 'distinct(candidat.nid_candidat)') {
                            $c = 'nid_candidat';
                        }
                        $column[] = $c;
                    }
                    foreach ($test as $item) {
                        $column[] = $item['libelle_item'];
                        $column[] = $item['libelle_item'] . ' position';
                    }
                    // output headers so that the file is downloaded rather than displayed
                    // create a file pointer connected to the output stream
                    $output = fopen('php://output', 'w');
                    // output the column headings
                    fputcsv($output, $column, ';');
                    // fetch the data
                    $candidats = get_candidats_filtre_reponse($_POST['id_test'], $_POST['crea1'], $_POST['crea1'], $_POST['id_motif'], $_POST['id_organisme'], $_POST['critere']);
                    // loop over the rows, outputting them
                    foreach ($candidats as $c) {
                        foreach ($test as $item) {
                            $rep = get_reponse_item_candidat($item['id_item'], $c['nid_candidat'], $id);
                            $reponse = "";
                            $reponsep = "";
                            foreach ($rep as $r) {
                                $reponse .= $r['libelle_reponse'] . '|';
                            }
                            $c[] = $reponse;
                            foreach ($rep as $r) {
                                $reponsep .= $r['position_reponse'] . '|';
                            }
                            $c[] = $reponsep;
                        }
                        fputcsv($output, $c, ';');
                    }
                    fclose($output);
                    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                    header('Content-Description: File Transfer');
                    header("Content-type: text/csv");
                    header("Content-Disposition: attachment; filename=data.csv");
                    header("Expires: 0");
                    header("Pragma: public");
                    exit;
                }
                if ($_POST['type_export'] == 'score') {
                    // output headers so that the file is downloaded rather than displayed
                    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                    header('Content-Description: File Transfer');
                    header("Content-type: text/csv");
                    header("Content-Disposition: attachment; filename=data.csv");
                    header("Expires: 0");
                    header("Pragma: public");
                    // create a file pointer connected to the output stream
                    $output = fopen('php://output', 'w');
                    $column = array();
                    foreach ($_POST["critere"] as $c) {
                        $column[] = $c;
                    }
                    foreach ($test as $item) {
                        $dims = get_dim_item($item['id_item']);
                        foreach ($dims as $dim) {
                            $column[] = $item['libelle_item'] . "_" . $dim['libelle_court_dimension'];
                        }
                    }
                    // output the column headings
                    fputcsv($output, $column, ';');
                    // fetch the data
                    $candidats = get_candidats_filtre_reponse($_POST['id_test'], $_POST['crea1'], $_POST['crea1'], $_POST['id_motif'], $_POST['id_organisme'], $_POST['critere']);
                    foreach ($candidats as $c) {
                        foreach ($test as $item) {
                            $dims = get_dim_item($item['id_item']);
                            foreach ($dims as $dim) {
                                $rep = get_score_dim_item_candidat($item['id_item'], $c['nid_candidat'], $id, $dim['id_dimension']);
                                $reponse = "";
                                foreach ($rep as $r) {
                                    $reponse .= $r['score_brut'] . ' | ';
                                }
                                $c[] = $reponse;
                            }
                        }
                        fputcsv($output, $c, ';');
                    }
                    fclose($output);
                    exit;
                }
            } else {
                $page['message'] = $message['champs_obligatoire_2'];
            }
        }
    } else {
        $page['vue'] = "erreur_droit.vue.php";
    }
}