Sponsorenverwaltung - Team StarCraft e.V.
 All Data Structures Files Functions Variables
export_addresses.php
Go to the documentation of this file.
1 <?php
2  /**
3  * @file export_addresses.php
4  *
5  * @brief Downloads a *.csv file with addresses of sponsors.
6  *
7  * @copyright (c) 2013, Team StarCraft e.V.
8  * @version 1.0.0
9  * @author Niklas Engelhardt
10  * @author Clemens Heinrich
11  * @author Alexander Vorndran
12  * @date 02.07.2013
13  */
14 
15  /// @cond MAINPART
16  // include
17  include("inc/common.php");
18 
19  // UserCake
20  if(!accessGranted($_SERVER['PHP_SELF'])) {
21  if (isUserLoggedIn()) {
22  exitWithErrorTemplate(array('Die angeforderte Seite ist gesperrt.'));
23  }
24  else {
25  exitWithErrorTemplateAndRedirect(array('Die angeforderte Seite ist gesperrt oder geschützt.'), 'login.php', 2);
26  }
27  }
28 
29  if(isset($_GET['result'])) {
30  $sponsorIds = $loggedInUser->loadResult($_GET['result']);
31  $addresses = fetchSponsorAddresses($sponsorIds);
32  } else {
33  $addresses=(fetchSponsorAddresses());
34  }
35 
36  downloadCsvFile("Firmenadressen_Serienbrief_" . date("Y-m-d") . ".csv");
37  echo writeCsvFile($addresses,TRUE,";",FALSE);
38  die();
39  /// @endcond
40 ?>
41 
42 
43