diff --git a/index.php b/index.php index 32aeb28..91cb619 100755 --- a/index.php +++ b/index.php @@ -1,5 +1,14 @@ '; -} ?> \ No newline at end of file +} ?> + + + +"; + + //inclusion des classes de PHPExcel + include buildPath("src", "phpexcel", "Classes", "PHPExcel.php"); + include buildPath("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'); +} +?> \ No newline at end of file diff --git a/page/test.xlsx b/page/test.xlsx new file mode 100644 index 0000000..f9296ab Binary files /dev/null and b/page/test.xlsx differ diff --git a/src/phpexcel/Documentation/~$PExcel developer documentation.doc b/src/phpexcel/Documentation/~$PExcel developer documentation.doc new file mode 100644 index 0000000..cb3de1e Binary files /dev/null and b/src/phpexcel/Documentation/~$PExcel developer documentation.doc differ