Пример #1
0
$sportifs = $sportifs->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP);
foreach ($sportifs as $i => $groupe) {
    foreach ($groupe as $j => $sportif) {
        $sportifs[$i][$j]['sport_sexe'] = $sportif['sport'] . ' ' . strip_tags(printSexe($sportif['ssexe']));
        $sportifs[$i][$j]['capitaine'] = $sportif['id_capitaine'] == $sportif['pid'] ? 'Oui' : '';
    }
}
//Labels pour le XLSX
$labels = ['Capitaine' => 'capitaine', 'Nom' => 'pnom', 'Prénom' => 'pprenom', 'Sexe' => 'psexe', 'Sport' => 'sport_sexe', 'Licence' => 'plicence', 'Téléphone' => 'ptelephone'];
//Téléchargement du fichier XLSX concerné
if (!empty($_GET['excel']) && intval($_GET['excel']) && in_array($_GET['excel'], array_keys($sportifs))) {
    $titre = 'Liste des sportifs (' . unsecure($sportifs[$_GET['excel']][0]['nom']) . ')';
    $fichier = 'liste_sportifs_ecole_' . onlyLetters(unsecure($sportifs[$_GET['excel']][0]['nom']));
    $items = $sportifs[$_GET['excel']];
    exportXLSX($items, $fichier, $titre, $labels);
} else {
    if (isset($_GET['excel'])) {
        $fichier = 'liste_sportifs_ecoles';
        $items = $titres = $feuilles[] = [];
        $i = 0;
        foreach ($sportifs as $sportifs_ecole) {
            $titres[$i] = 'Liste des sportifs (' . unsecure($sportifs_ecole[0]['nom']) . ')';
            $feuilles[$i] = unsecure($sportifs_ecole[0]['nom']);
            $items[$i] = $sportifs_ecole;
            $i++;
        }
        exportXLSXGroupe($items, $fichier, $feuilles, $titres, $labels);
    }
}
//Inclusion du bon fichier de template
require DIR . 'templates/admin/competition/sportifs_ecoles.php';
$capitaines = $pdo->query('SELECT ' . 'e.id AS id, ' . 'e.nom, ' . 'e.ecole_lyonnaise, ' . 's.sport, ' . 's.sexe AS ssexe, ' . 's.id AS sid, ' . 'p.nom AS pnom, ' . 'p.prenom AS pprenom, ' . 'p.licence AS plicence, ' . 'p.sexe AS psexe, ' . 'p.telephone AS ptelephone, ' . 'p.id AS pid ' . 'FROM ecoles AS e ' . 'LEFT JOIN equipes AS eq ON ' . 'eq.id_ecole = e.id ' . 'LEFT JOIN participants AS p ON ' . 'p.id = eq.id_capitaine ' . 'LEFT JOIN sports AS s ON ' . 's.id = eq.id_sport ' . 'ORDER BY ' . 'e.nom ASC, ' . 'p.nom ASC, ' . 'p.prenom ASC ') or DEBUG_ACTIVE && die(print_r($pdo->errorInfo()));
$capitaines = $capitaines->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP);
foreach ($capitaines as $i => $groupe) {
    foreach ($groupe as $j => $capitaine) {
        $capitaines[$i][$j]['sport_sexe'] = $capitaine['sport'] . ' ' . strip_tags(printSexe($capitaine['ssexe']));
    }
}
//Labels XLSX
$labels = ['Nom' => 'pnom', 'Prénom' => 'pprenom', 'Sexe' => 'psexe', 'Sport' => 'sport_sexe', 'Licence' => 'plicence', 'Téléphone' => 'ptelephone'];
//Téléchargement du fichier XLSX concerné
if (!empty($_GET['excel']) && intval($_GET['excel']) && in_array($_GET['excel'], array_keys($capitaines))) {
    $titre = 'Liste des capitaines (' . unsecure($capitaines[$_GET['excel']][0]['nom']) . ')';
    $fichier = 'liste_capitaines_ecole_' . onlyLetters(unsecure($capitaines[$_GET['excel']][0]['nom']));
    $items = $capitaines[$_GET['excel']];
    exportXLSX($items, $fichier, $titre, $labels);
} else {
    if (isset($_GET['excel'])) {
        $fichier = 'liste_capitaines_ecoles';
        $items = $titres = $feuilles[] = [];
        $i = 0;
        foreach ($capitaines as $capitaines_ecole) {
            $titres[$i] = 'Liste des capitaines (' . unsecure($capitaines_ecole[0]['nom']) . ')';
            $feuilles[$i] = unsecure($capitaines_ecole[0]['nom']);
            $items[$i] = $capitaines_ecole;
            $i++;
        }
        exportXLSXGroupe($items, $fichier, $feuilles, $titres, $labels);
    }
}
//Inclusion du bon fichier de template
require DIR . 'templates/admin/competition/capitaines_ecoles.php';
Пример #3
0
/* actions/admin/competition/action_fanfarons_ecoles.php ***/
/* Liste des fanfarons *************************************/
/* *********************************************************/
/* Dernière modification : le 18/12/14 *********************/
/* *********************************************************/
$fanfarons = $pdo->query('SELECT ' . 'e.id, ' . 'e.nom, ' . 'e.ecole_lyonnaise, ' . 'e.quota_fanfaron, ' . 'p.nom AS pnom, ' . 'p.prenom AS pprenom, ' . 'p.sexe AS psexe, ' . 'p.telephone AS ptelephone, ' . 'p.id AS pid ' . 'FROM ecoles AS e ' . 'LEFT JOIN participants AS p ON ' . 'p.fanfaron = 1 AND ' . 'p.id_ecole = e.id ' . 'ORDER BY ' . 'e.nom ASC, ' . 'p.nom ASC, ' . 'p.prenom ASC ') or DEBUG_ACTIVE && die(print_r($pdo->errorInfo()));
$fanfarons = $fanfarons->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP);
//Labels pour le XLSX
$labels = ['Nom' => 'pnom', 'Prénom' => 'pprenom', 'Sexe' => 'psexe', 'Téléphone' => 'ptelephone'];
//Téléchargement du fichier XLSX concerné
if (!empty($_GET['excel']) && intval($_GET['excel']) && in_array($_GET['excel'], array_keys($fanfarons))) {
    $titre = 'Liste des fanfarons (' . unsecure($fanfarons[$_GET['excel']][0]['nom']) . ')';
    $fichier = 'liste_fanfarons_ecole_' . onlyLetters(unsecure($fanfarons[$_GET['excel']][0]['nom']));
    $items = $fanfarons[$_GET['excel']];
    exportXLSX($items, $fichier, $titre, $labels);
} else {
    if (isset($_GET['excel'])) {
        $fichier = 'liste_fanfarons_ecoles';
        $items = $titres = $feuilles[] = [];
        $i = 0;
        foreach ($fanfarons as $fanfarons_ecole) {
            $titres[$i] = 'Liste des fanfarons (' . unsecure($fanfarons_ecole[0]['nom']) . ')';
            $feuilles[$i] = unsecure($fanfarons_ecole[0]['nom']);
            $items[$i] = $fanfarons_ecole;
            $i++;
        }
        exportXLSXGroupe($items, $fichier, $feuilles, $titres, $labels);
    }
}
//Inclusion du bon fichier de template
require DIR . 'templates/admin/competition/fanfarons_ecoles.php';
/* actions/admin/competition/action_sans_sport_ecoles.php **/
/* Liste des sportifs sans sport groupés par école *********/
/* *********************************************************/
/* Dernière modification : le 20/01/15 *********************/
/* *********************************************************/
$sans_sport = $pdo->query('SELECT ' . 'e.id AS eid, ' . 'p.id, ' . 'p.nom, ' . 'p.prenom, ' . 'p.sexe, ' . 'p.telephone, ' . 'p.licence, ' . 'e.nom AS enom ' . 'FROM ecoles AS e ' . 'LEFT JOIN participants AS p ON ' . 'e.id = p.id_ecole AND ' . 'p.sportif = 1 AND ' . 'p.id NOT IN (SELECT ' . 's.id_participant ' . 'FROM sportifs AS s WHERE ' . 's.id_ecole = e.id) ' . 'ORDER BY ' . 'e.nom ASC, ' . 'p.nom ASC, ' . 'p.prenom ASC') or DEBUG_ACTIVE && die(print_r($pdo->errorInfo()));
$sans_sport = $sans_sport->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP);
//Labels pour le XLSX
$labels = ['Nom' => 'nom', 'Prénom' => 'prenom', 'Sexe' => 'sexe', 'Licence' => 'licence', 'Téléphone' => 'telephone'];
//Téléchargement du fichier XLSX concerné
if (!empty($_GET['excel']) && intval($_GET['excel']) && in_array($_GET['excel'], array_keys($sans_sport))) {
    $titre = 'Liste des sportifs sans sport (' . unsecure($sans_sport[$_GET['excel']][0]['enom']) . ')';
    $fichier = 'liste_sans_sport_ecole_' . onlyLetters(unsecure($sans_sport[$_GET['excel']][0]['enom']));
    $items = $sans_sport[$_GET['excel']];
    exportXLSX($items, $fichier, $titre, $labels);
} else {
    if (isset($_GET['excel'])) {
        $fichier = 'liste_sans_sport_ecoles';
        $items = $titres = $feuilles[] = [];
        $i = 0;
        foreach ($sans_sport as $sans_sport_ecole) {
            $titres[$i] = 'Liste des sportifs sans sport (' . unsecure($sans_sport_ecole[0]['enom']) . ')';
            $feuilles[$i] = unsecure($sans_sport_ecole[0]['enom']);
            $items[$i] = $sans_sport_ecole;
            $i++;
        }
        exportXLSXGroupe($items, $fichier, $feuilles, $titres, $labels);
    }
}
//Inclusion du bon fichier de template
require DIR . 'templates/admin/competition/sans_sport_ecoles.php';
Пример #5
0
{
    return str_replace('https://', 'http://', $url);
}
// new releases of Hero define this in the config file
if (!function_exists('is_secure')) {
    function is_secure()
    {
        if (isset($_SERVER['SERVER_PORT']) and $_SERVER['SERVER_PORT'] == '443') {
            return TRUE;
        } elseif (isset($_SERVER['HTTP_X_FORWARDED_PORT']) and $_SERVER['HTTP_X_FORWARDED_PORT'] == '443') {
            return TRUE;
        } elseif (isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') {
            return TRUE;
        } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
            return TRUE;
        }
        return FALSE;
    }
}
// never redirect the user_activity controller!
if ($CI->uri->segment(2) != 'user_activity') {
    if ($CI->config->item('ssl_certificate') == '1') {
        if (in_array($CI->uri->segment(1), $CI->config->item('secure_modules')) and !is_secure()) {
            header("Location: " . secure(current_url()));
            die;
        } elseif (!in_array($CI->uri->segment(1), $CI->config->item('secure_modules')) and is_secure()) {
            header('Location: ' . unsecure(current_url()));
            die;
        }
    }
}
$sportifs = $pdo->query('SELECT ' . 's.id, ' . 's.sport, ' . 's.sexe, ' . 's.quota_max, ' . 's.quota_inscription, ' . 'p.nom AS pnom, ' . 'p.prenom AS pprenom, ' . 'p.licence AS plicence, ' . 'p.sexe AS psexe, ' . 'p.telephone AS ptelephone, ' . 'p.id AS pid, ' . 'eq.id_capitaine, ' . 'e.nom AS enom, ' . 'e.id AS eid ' . 'FROM sports AS s ' . 'LEFT JOIN sportifs AS sp ON ' . 'sp.id_sport = s.id ' . 'LEFT JOIN participants AS p ON ' . 'p.id = sp.id_participant ' . 'LEFT JOIN ecoles AS e ON ' . 'e.id = sp.id_ecole ' . 'LEFT JOIN equipes AS eq ON ' . 'eq.id_sport = s.id AND ' . 'eq.id_ecole = e.id ' . 'ORDER BY ' . 's.sport ASC, ' . 's.sexe ASC, ' . 'e.nom ASC, ' . 'p.nom ASC, ' . 'p.prenom ASC ') or DEBUG_ACTIVE && die(print_r($pdo->errorInfo()));
$sportifs = $sportifs->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP);
foreach ($sportifs as $i => $groupe) {
    foreach ($groupe as $j => $sportif) {
        $sportifs[$i][$j]['capitaine'] = $sportif['id_capitaine'] == $sportif['pid'] ? 'Oui' : '';
    }
}
//Labels pour le XLSX
$labels = ['Ecole' => 'enom', 'Capitaine' => 'capitaine', 'Nom' => 'pnom', 'Prénom' => 'pprenom', 'Sexe' => 'psexe', 'Licence' => 'plicence', 'Téléphone' => 'ptelephone'];
//Téléchargement du fichier XLSX concerné
if (!empty($_GET['excel']) && intval($_GET['excel']) && in_array($_GET['excel'], array_keys($sportifs))) {
    $titre = 'Liste des sportifs (' . unsecure($sportifs[$_GET['excel']][0]['sport'] . ' ' . strip_tags(printSexe($sportifs[$_GET['excel']][0]['sexe']))) . ')';
    $fichier = 'liste_sportifs_sport_' . onlyLetters(unsecure($sportifs[$_GET['excel']][0]['sport'] . '_' . strip_tags(printSexe($sportifs[$_GET['excel']][0]['sexe'])))) . '_groupes';
    $items = $sportifs[$_GET['excel']];
    exportXLSX($items, $fichier, $titre, $labels);
} else {
    if (isset($_GET['excel'])) {
        $fichier = 'liste_sportifs_sports_groupes';
        $items = $titres = $feuilles[] = [];
        $i = 0;
        foreach ($sportifs as $sportifs_sport) {
            $titres[$i] = 'Liste des sportifs (' . unsecure($sportifs_sport[0]['sport'] . ' ' . strip_tags(printSexe($sportifs_sport[0]['sexe']))) . ')';
            $feuilles[$i] = unsecure($sportifs_sport[0]['sport'] . ' ' . strip_tags(printSexe($sportifs_sport[0]['sexe'])));
            $items[$i] = $sportifs_sport;
            $i++;
        }
        exportXLSXGroupe($items, $fichier, $feuilles, $titres, $labels);
    }
}
//Inclusion du bon fichier de template
require DIR . 'templates/admin/competition/sportifs_sports_groupes.php';
    foreach ($groupe as $j => $participant) {
        $participants[$i][$j]['psportif'] = $participant['sportif'] ? 'Oui' : '';
        $participants[$i][$j]['pfanfaron'] = $participant['fanfaron'] ? 'Oui' : '';
        $participants[$i][$j]['ppompom'] = $participant['pompom'] ? 'Oui' : '';
        $participants[$i][$j]['plogement'] = $participant['logement'] ? 'Oui' : '';
    }
}
//Labels pour le XLSX
$labels = ['Nom' => 'pnom', 'Prénom' => 'pprenom', 'Sexe' => 'psexe', 'Sportif' => 'psportif', 'Fanfaron' => 'pfanfaron', 'Pompom' => 'ppompom', 'Téléphone' => 'ptelephone', 'Recharge' => 'recharge', 'Tarif' => 'tnom', 'Logement' => 'plogement'];
//Téléchargement du fichier XLSX concerné
if (!empty($_GET['excel']) && intval($_GET['excel']) && in_array($_GET['excel'], array_keys($participants))) {
    $titre = 'Liste des particpants (' . unsecure($participants[$_GET['excel']][0]['nom']) . ')';
    $fichier = 'liste_participants_ecole_' . onlyLetters(unsecure($participants[$_GET['excel']][0]['nom']));
    $items = $participants[$_GET['excel']];
    exportXLSX($items, $fichier, $titre, $labels);
} else {
    if (isset($_GET['excel'])) {
        $fichier = 'liste_participants_ecoles';
        $items = $titres = $feuilles[] = [];
        $i = 0;
        foreach ($participants as $participants_ecole) {
            $titres[$i] = 'Liste des participants (' . unsecure($participants_ecole[0]['nom']) . ')';
            $feuilles[$i] = unsecure($participants_ecole[0]['nom']);
            $items[$i] = $participants_ecole;
            $i++;
        }
        exportXLSXGroupe($items, $fichier, $feuilles, $titres, $labels);
    }
}
//Inclusion du bon fichier de template
require DIR . 'templates/admin/competition/participants_ecoles.php';
Пример #8
0
function makeSheet(&$excel, $id, $items, $titre, $labels, $feuille = null)
{
    $nbColumns = count($labels);
    $lastColumn = PHPExcel_Cell::stringFromColumnIndex($nbColumns - 1);
    if ($id) {
        $excel->createSheet();
    }
    $excel->setActiveSheetIndex($id)->setTitle(makeSheetTitle($feuille, $id));
    $excel->getDefaultStyle()->getFont()->setName('Arial')->setSize(12);
    //$excel->getActiveSheet()->setTitle($titre); //Max de 31 caractères
    $excel->getActiveSheet()->mergeCells('A1:' . $lastColumn . '1')->setCellValue('A1', 'Challenge, exporté le ' . date('d\\/m\\/Y à H:i'))->mergeCells('A2:' . $lastColumn . '2')->setCellValue('A2', $titre);
    $excel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $excel->getActiveSheet()->getStyle('A2:' . $lastColumn . '3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $excel->getActiveSheet()->getStyle('A2')->getFont()->setSize(20);
    $excel->getActiveSheet()->getStyle('A2:' . $lastColumn . '3')->getFont()->setBold(true);
    $excel->getActiveSheet()->getStyle('A2')->getFill()->applyFromArray(array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'startcolor' => array('rgb' => 'F79646')));
    $excel->getActiveSheet()->getStyle('A3:' . $lastColumn . '3')->getFill()->applyFromArray(array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'startcolor' => array('rgb' => '4F81BD')));
    $excel->getActiveSheet()->getStyle('A3:' . $lastColumn . '3')->getFont()->getColor()->setRGB('FFFFFF');
    $excel->getActiveSheet()->getRowDimension(1)->setRowHeight(20);
    $excel->getActiveSheet()->getRowDimension(2)->setRowHeight(30);
    $excel->getActiveSheet()->getRowDimension(3)->setRowHeight(20);
    $excel->getActiveSheet()->getStyle('A1:' . $lastColumn . '3')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
    $numColumn = 0;
    foreach ($labels as $label => $sql) {
        $column = PHPExcel_Cell::stringFromColumnIndex($numColumn++);
        $excel->getActiveSheet()->setCellValue($column . '3', $label);
    }
    $excel->getActiveSheet()->getStyle('A2:' . $lastColumn . '3')->applyFromArray(array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN))));
    $i = 4;
    foreach ($items as $item) {
        $numColumn = 0;
        foreach ($labels as $label => $indexSQL) {
            $column = PHPExcel_Cell::stringFromColumnIndex($numColumn++);
            $excel->getActiveSheet()->setCellValue($column . $i, unsecure($item[$indexSQL]));
        }
        $excel->getActiveSheet()->getStyle('A' . $i . ':' . $lastColumn . $i)->applyFromArray(array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN))));
        $excel->getActiveSheet()->getStyle('A' . $i . ':' . $lastColumn . $i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
        $excel->getActiveSheet()->getRowDimension($i)->setRowHeight(20);
        $i++;
    }
    foreach (range('A', $lastColumn) as $col) {
        $excel->getActiveSheet()->getColumnDimension($col)->setAutoSize(true);
    }
    $excel->getActiveSheet()->setSelectedCell('A1');
}
Пример #9
0
/* actions/admin/competition/action_pompoms_ecoles.php *****/
/* Liste des pompoms ***************************************/
/* *********************************************************/
/* Dernière modification : le 18/12/14 *********************/
/* *********************************************************/
$pompoms = $pdo->query('SELECT ' . 'e.id, ' . 'e.nom, ' . 'e.ecole_lyonnaise, ' . 'e.quota_pompom, ' . 'p.nom AS pnom, ' . 'p.prenom AS pprenom, ' . 'p.sexe AS psexe, ' . 'p.telephone AS ptelephone, ' . 'p.id AS pid ' . 'FROM ecoles AS e ' . 'LEFT JOIN participants AS p ON ' . 'p.pompom = 1 AND ' . 'p.id_ecole = e.id ' . 'ORDER BY ' . 'e.nom ASC, ' . 'p.nom ASC, ' . 'p.prenom ASC ') or DEBUG_ACTIVE && die(print_r($pdo->errorInfo()));
$pompoms = $pompoms->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP);
//Labels pour le XLSX
$labels = ['Nom' => 'pnom', 'Prénom' => 'pprenom', 'Sexe' => 'psexe', 'Téléphone' => 'ptelephone'];
//Téléchargement du fichier XLSX concerné
if (!empty($_GET['excel']) && intval($_GET['excel']) && in_array($_GET['excel'], array_keys($pompoms))) {
    $titre = 'Liste des pompoms (' . unsecure($pompoms[$_GET['excel']][0]['nom']) . ')';
    $fichier = 'liste_pompoms_ecole_' . onlyLetters(unsecure($pompoms[$_GET['excel']][0]['nom']));
    $items = $pompoms[$_GET['excel']];
    exportXLSX($items, $fichier, $titre, $labels);
} else {
    if (isset($_GET['excel'])) {
        $fichier = 'liste_pompoms_ecoles';
        $items = $titres = $feuilles[] = [];
        $i = 0;
        foreach ($pompoms as $pompoms_ecole) {
            $titres[$i] = 'Liste des pompoms (' . unsecure($pompoms_ecole[0]['nom']) . ')';
            $feuilles[$i] = unsecure($pompoms_ecole[0]['nom']);
            $items[$i] = $pompoms_ecole;
            $i++;
        }
        exportXLSXGroupe($items, $fichier, $feuilles, $titres, $labels);
    }
}
//Inclusion du bon fichier de template
require DIR . 'templates/admin/competition/pompoms_ecoles.php';