コード例 #1
0
ファイル: resultat.php プロジェクト: arnodinho/symfony2
function visualiser_resultat()
{
    global $page;
    global $resultat;
    $page['gabarit'] = "administration";
    if (isset($_SESSION['role_user']) && droit_acces($resultat['visualiser_resultat'], $_SESSION['role_user'])) {
        $page['vue'] = "resultats/resultat_candidat.vue.php";
        $page['colonne'] = "participants/sidebar_candidat.vue.php";
        $page['candidats'] = liste_candidats();
        $nid = get_nid($_GET['id']);
        $nid = $nid[0]['nid_candidat'];
        $page['nid'] = $nid;
        $page['resultats'] = get_contenu_test($_GET['id_test']);
        $test = get_test($_GET['id_test']);
        $page['code_test'] = $test[0]['code_test'];
        $i = 0;
        foreach ($page['resultats'] as $key => $content) {
            if ($content['type'] == 'item') {
                $item = get_item($content['id_element']);
                $page['resultats'][$i] = $item[0];
                $page['resultats'][$i]['reponse'] = get_reponse_item_candidat($content['id_element'], $nid, $_GET['id_test']);
                $page['resultats'][$i]['score'] = get_score_item_candidat($content['id_element'], $nid, $_GET['id_test']);
                $i++;
            } else {
                /*je parcours tout les items de la section*/
                $items = get_item_by_section($content['id_element']);
                foreach ($items as $it) {
                    $page['resultats'][$i] = $it;
                    $page['resultats'][$i]['reponse'] = get_reponse_item_candidat($it['id_item'], $nid, $_GET['id_test']);
                    $page['resultats'][$i]['score'] = get_score_item_candidat($it['id_item'], $nid, $_GET['id_test']);
                    $i++;
                }
            }
        }
    } else {
        $page['vue'] = "erreur_droit.vue.php";
    }
}
コード例 #2
0
ファイル: test.php プロジェクト: arnodinho/symfony2
function production_test()
{
    global $message;
    global $page;
    //passage en prod si etat 2 + popup + item en prod
    $page['vue'] = "tests/test.vue.php";
    $page['colonne'] = "tests/sidebar_test.vue.php";
    $page['tests'] = liste_test();
    $page['sphere'] = liste_sphere();
    $page['facteur'] = liste_facteur();
    $page['lieu'] = liste_lieux_auteur();
    $page['projet'] = liste_projet();
    if (isset($_GET['id'])) {
        $id = $_GET['id'];
    }
    if (isset($_POST['id_test'])) {
        $id = $_POST['id_test'];
    }
    $page['gabarit'] = "administration";
    $page['test'] = get_test($id);
    $page['test'] = $page['test'][0];
    $page['test']['id_test'] = $id;
    $page['etat'] = liste_etat();
    if (has_reponse_test($id)) {
        $page['message_info'] = $message['info_test_prod'];
    }
    if (isset($_POST['prod'])) {
        $page['test'] = get_test($id);
        $page['test'] = $page['test'][0];
        if (is_current_version_test($id, $_POST['revision'])) {
            if ($_POST['code_test'] != "" && $_POST['libelle_long_test'] != "" && $_POST['version_test'] != "") {
                if ($page['test']['id_etat'] == 2) {
                    if (has_reponse_test($id)) {
                        /*duplication: la source passe en archive et le nouveau passe en production*/
                        $new_id = dupliquation_test_prod($_POST['id_test'], $_POST['code_test'], $_POST['libelle_long_test'], $_POST['version_test']);
                        if ($new_id != false) {
                            $page['test']['contenu_test'] = get_contenu_test($_POST['id_test']);
                            foreach ($page['test']['contenu_test'] as $key => $content) {
                                if ($content['type'] == 'item') {
                                    set_item_to_archive($content['id_element']);
                                } else {
                                    $section = get_section($content['id_element']);
                                    foreach ($section[0] as $k => $v) {
                                        $items = get_item_by_section($content['id_element']);
                                        foreach ($items as $it) {
                                            set_item_to_archive($it['id_item']);
                                        }
                                    }
                                }
                            }
                            set_test_to_archive($id);
                            header("Location: index.php?controleur=test&tache=visualiser_test&id=" . $new_id);
                        } else {
                            $page['message'] = $message['test_existe'] . "<br/> Merci de les modifier pour le passage en production";
                        }
                    } else {
                        $mprod = set_test_to_production($id, $_POST['code_test'], $_POST['libelle_long_test'], $_POST['version_test']);
                        if (mprod) {
                            $page['test']['contenu_test'] = get_contenu_test($_POST['id_test']);
                            foreach ($page['test']['contenu_test'] as $key => $content) {
                                if ($content['type'] == 'item') {
                                    set_item_to_production($content['id_element']);
                                } else {
                                    $section = get_section($content['id_element']);
                                    foreach ($section[0] as $k => $v) {
                                        $items = get_item_by_section($content['id_element']);
                                        foreach ($items as $it) {
                                            set_item_to_production($it['id_item']);
                                        }
                                    }
                                }
                            }
                            header("Location: index.php?controleur=test&tache=visualiser_test&id=" . $id);
                        } else {
                            $page['message'] = $message['test_existe'] . "<br/> Merci de les modifier pour le passage en production";
                        }
                    }
                }
            } else {
                $page['message'] = $message['champs_obligatoire_2'];
            }
        } else {
            header("Location: index.php?controleur=test&tache=visualiser_test&id=" . $id . "&message=outdated_test");
        }
    }
}