Sponsorenverwaltung - Team StarCraft e.V.
 All Data Structures Files Functions Variables
export.php
Go to the documentation of this file.
1 <?php
2  /**
3  * @file export.php
4  *
5  * @brief runs export.tpl
6  *
7  * @copyright (c) 2013, Team StarCraft e.V.
8  * @version 1.0.0
9  * @author Niklas Engelhardt
10  * @author Alexander Vorndran
11  * @date 02.07.2013
12  */
13 
14  /// @cond MAINPART
15  // include
16  include("inc/common.php");
17 
18  // UserCake
19  if (!accessGranted($_SERVER['PHP_SELF'])) {
20  if (isUserLoggedIn()) {
21  exitWithErrorTemplate(array('Die angeforderte Seite ist gesperrt.'));
22  } else {
23  exitWithErrorTemplateAndRedirect(array('Die angeforderte Seite ist gesperrt oder geschützt.'), 'login.php', 2);
24  }
25  }
26 
27  if (isset($_GET['result'])) {
28  // this result identifier is the key to obtain the data the user has seen last
29  $resultIdentifier = $_GET['result'];
30  if (ctype_alnum($resultIdentifier)) {
31  if ($loggedInUser->isResultAvailable($resultIdentifier)) {
32  // show the description for exporting selected information
33  $smarty->assign('exportSelected', TRUE);
34  // propagate the identifier as parameter for links
35  $smarty->assign('resultIdentifier', $resultIdentifier);
36  } else {
37  exitWithErrorTemplate(array("Es ist ein Fehler aufgetreten. Zugriff auf das Ergebnis nicht möglich."));
38  }
39  // run template
40  displayTemplateWithErrorsAndSuccesses('Export der Auswahl', 'export.tpl');
41  }
42  } else if (isset($_POST['exportSelection'])) {
43  $sponsorIds = $_POST['exportSelection'];
44  // the user has posted a list of sponsor ids
45  // store them and obtain the id of that result
46  $resultIdentifier = $loggedInUser->storeTemporaryResult($sponsorIds);
47  if (ctype_alnum($resultIdentifier)) {
48  // check if the result is still present or has been overwritten
49  if ($loggedInUser->isResultAvailable($resultIdentifier)) {
50  // show the description for exporting selected information
51  $smarty->assign('exportSelected', TRUE);
52  // propagate the identifier as parameter for links
53  $smarty->assign('resultIdentifier', $resultIdentifier);
54  } else {
55  exitWithErrorTemplate(array("Es ist ein Fehler aufgetreten. Zugriff auf das Ergebnis nicht möglich."));
56  }
57  // run template
58  displayTemplateWithErrorsAndSuccesses('Export der Auswahl', 'export.tpl');
59  }
60  } else {
61  // run default template
62  displayTemplateWithErrorsAndSuccesses('Exportfunktionen', 'export.tpl');
63  }
64  /// @endcond
65 ?>
66 
67 
68