Merge branch 'dev' of https://github.com/xdrm-brackets/SID into dev
Merge du taf de Cédric sur PHPExcel
This commit is contained in:
commit
4fbae9364f
|
@ -32,7 +32,7 @@ class DataBase{
|
||||||
|
|
||||||
/* retourne une instance de la classe */
|
/* retourne une instance de la classe */
|
||||||
public static function getInstance(){
|
public static function getInstance(){
|
||||||
return new DataBase("localhost", "sid2", "php", "Qt358nUdyeTxLDM8");
|
return new DataBase("localhost", "sid2", "root", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -517,4 +517,62 @@ if( permission('admin') ){ // si l'utilisateur est connecté et que c'est un él
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</section>';
|
echo '</section>';
|
||||||
} ?>
|
} ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/*********************************/
|
||||||
|
/*** IMPORTATION FICHIER EXCEL ***/
|
||||||
|
/*********************************/
|
||||||
|
|
||||||
|
if(permission('admin')){
|
||||||
|
echo "<section name='importexcel' title='Importation/Export' class='basic'>";
|
||||||
|
|
||||||
|
//inclusion des classes de PHPExcel
|
||||||
|
include __ROOT__.DIRECTORY_SEPARATOR.join(DIRECTORY_SEPARATOR, array("src", "phpexcel", "Classes", "PHPExcel.php"));
|
||||||
|
include __ROOT__.DIRECTORY_SEPARATOR.join(DIRECTORY_SEPARATOR, array("src", "phpexcel", "Classes", "PHPExcel", "Writer", "Excel2007.php"));
|
||||||
|
|
||||||
|
//On crée une instance du fichier xls, ainsi que de la feuille active
|
||||||
|
$workbook = new PHPExcel();
|
||||||
|
$sheet = $workbook->getActiveSheet();
|
||||||
|
$writer = new PHPExcel_Writer_Excel2007($workbook);
|
||||||
|
|
||||||
|
//on prépare le tableau
|
||||||
|
$sheet->setCellValue('A1', 'IAE Etape');
|
||||||
|
$sheet->setCellValue('B1', 'Nom');
|
||||||
|
$sheet->setCellValue('C1', 'Prénom');
|
||||||
|
$sheet->setCellValue('D1', 'Identifiant');
|
||||||
|
$sheet->setCellValue('E1', 'Sexe');
|
||||||
|
$sheet->setCellValue('F1', 'Mail étudiant');
|
||||||
|
|
||||||
|
|
||||||
|
//on récupère l'ensemble des étudiants
|
||||||
|
$request = new stdClass();
|
||||||
|
$answer = new stdClass();
|
||||||
|
|
||||||
|
$request->level_1 = 'grouplistForYear';
|
||||||
|
$request->annee = $_SESSION['annee'];
|
||||||
|
groups_switch_level_1($request, $answer);
|
||||||
|
|
||||||
|
//Si l'execution s'est proprement effectuée
|
||||||
|
$index = 2;
|
||||||
|
if($answer->request == 'success') {
|
||||||
|
foreach ($answer->grouplist as $group) {
|
||||||
|
$groupeName = $group->nom;
|
||||||
|
foreach ($group->userlist as $student) {
|
||||||
|
$sheet->setCellValue('A'.$index, $groupeName);
|
||||||
|
$sheet->setCellValue('B'.$index, $student['nom']);
|
||||||
|
$sheet->setCellValue('C'.$index, $student['prenom']);
|
||||||
|
$sheet->setCellValue('D'.$index, $student['identifiant']);
|
||||||
|
//$sheet->setCellValue('E'.$index, $student['sexe']);
|
||||||
|
$sheet->setCellValue('F'.$index, $student['mail']);
|
||||||
|
$index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//On enregistre le fichier
|
||||||
|
$writer->save('test.xlsx');
|
||||||
|
}
|
||||||
|
?>
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue