Esempio n. 1
0
function imprimer()
{
    global $page;
    global $session;
    global $url;
    global $message;
    $page['gabarit'] = "print";
    if (isset($_SESSION['role_user']) && droit_acces($session['imprimer'], $_SESSION['role_user'])) {
        $page['vue'] = "sessions/print_session.vue.php";
        $page['colonne'] = "sessions/sidebar_session.vue.php";
        $page['sessions'] = liste_session();
        $page['lieu'] = liste_lieux();
        $page['session'] = detail_session($_GET['id']);
        $candidatures = liste_candidature($_GET['id']);
        $absent = array();
        $present = array();
        foreach ($candidatures as $key => $val) {
            $candidatures[$key]['motifs'] = get_motif_candidature($val['id_candidature']);
            if ($candidatures[$key]['presence'] == 0) {
                $absent[] = $candidatures[$key];
            } else {
                $present[] = $candidatures[$key];
            }
        }
        $page['session'] = $page['session'][0];
        $page['candidatures_absent'] = $absent;
        $page['candidatures_present'] = $present;
    } else {
        $page['vue'] = "erreur_droit.vue.php";
    }
}
Esempio n. 2
0
function liste_motif_json($id_candidature)
{
    global $db;
    $sqlc = "select count(*) as count from motif ";
    $reqc = $db->prepare($sqlc);
    if (!$reqc->execute()) {
        write_log('Erreur SQL:' . $sql . ' sur fonction : ' . __FUNCTION__ . ' ligne : ' . __LINE__);
    }
    $resc = $reqc->fetchAll(PDO::FETCH_ASSOC);
    $sql = "select  * from motif order by id_motif ";
    $req = $db->prepare($sql);
    if (!$req->execute()) {
        write_log('Erreur SQL:' . $sql . ' sur fonction : ' . __FUNCTION__ . ' ligne : ' . __LINE__);
    }
    $res = $req->fetchAll(PDO::FETCH_ASSOC);
    $reponse = (object) array('records' => "", 'total' => "", 'page' => "", 'rows' => "");
    $count = $resc[0]['count'];
    $total = ceil($count / 1);
    $reponse->page = 1;
    $reponse->total = $total;
    $reponse->records = $count;
    $i = 0;
    $roles = get_motif_candidature($id_candidature);
    foreach ($res as $key => $user) {
        foreach ($res[$key] as $k => $v) {
            $res[$key][$k] = utf8_encode($v);
        }
        if ($roles != null) {
            foreach ($roles as $r) {
                if ($r['id_motif'] == $user['id_motif']) {
                    $res[$key]['identifiant'] = "<input class='motif' checked='checked' name='motif[]' type='checkbox' value='" . $user['id_motif'] . "'   />";
                    break;
                } else {
                    $res[$key]['identifiant'] = "<input class='motif' name='motif[]' type='checkbox' value='" . $user['id_motif'] . "'/>";
                }
            }
        } else {
            $res[$key]['identifiant'] = "<input name='motif[]' class='motif' type='checkbox' value='" . $user['id_motif'] . "'/>";
        }
    }
    foreach ($res as $line) {
        $reponse->rows[$i]['id'] = $line['id_motif'];
        $reponse->rows[$i]['cell'] = array($line['identifiant'], $line['libelle_court_motif']);
        $i++;
    }
    return $reponse;
}