Working Copy
[TYPO3CMS/Extensions/powermailCond.git] / Classes / Utility / EidReadSession.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010 Alexander Kellner <alexander.kellner@in2code.de>, in2code.
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 require_once(PATH_t3lib . 'class.t3lib_befunc.php');
26 require_once(PATH_t3lib . 'stddb/tables.php');
27 require_once(t3lib_extMgm::extPath('cms', 'ext_tables.php'));
28 require_once(PATH_tslib . 'class.tslib_pibase.php');
29 require_once(t3lib_extMgm::extPath('powermail_cond') . 'Classes/Utility/Div.php');
30
31 /**
32 * This class is for reading values from session
33 *
34 * @author Alex Kellner <alexander.kellner@in2code.de>, in2code.
35 * @package TYPO3
36 * @subpackage Tx_PowermailCond_Utility_EidReadSession
37 */
38 class Tx_PowermailCond_Utility_EidReadSession extends tslib_pibase {
39
40 /**
41 * The extension key
42 *
43 * @var string
44 */
45 public $extKey = 'powermail_cond'; // Extension key
46
47 /**
48 * Prefix Id
49 *
50 * @var string
51 */
52 public $prefixId = 'tx_powermailcond_pi1';
53
54 /**
55 * Read values from session - example: 18:braun;17:rot;12:xd;11:fc;
56 *
57 * @return void
58 */
59 public function main() {
60 // config
61 $this->getCObj(); // enable TSFE globals
62 $piVars = t3lib_div::_GP($this->prefixId); // GET param
63 $array = $this->div->getAllSessionValuesFromForm($piVars['form']);
64
65 $content = '';
66 foreach ((array) $array as $key => $value) {
67 $content .= str_replace('field_', '', $key) . ':' . $value . ';';
68 }
69 return $content;
70 }
71
72 /**
73 * Initialize cObj and TSFE Globals
74 *
75 * @return object cObj
76 */
77 private function getCObj() {
78 $this->div = t3lib_div::makeInstance('Tx_PowermailCond_Utility_Div'); // Create new instance for div class
79 $userObj = tslib_eidtools::initFeUser();
80 $temp_TSFEclassName = t3lib_div::makeInstance('tslib_fe');
81 $GLOBALS['TSFE'] = new $temp_TSFEclassName($TYPO3_CONF_VARS, 32, 0, true);
82 $GLOBALS['TSFE']->connectToDB();
83 $GLOBALS['TSFE']->fe_user = $userObj;
84 $GLOBALS['TSFE']->id = t3lib_div::_GET('id');
85 $GLOBALS['TSFE']->determineId();
86 $GLOBALS['TSFE']->getCompressedTCarray();
87 $GLOBALS['TSFE']->initTemplate();
88 $GLOBALS['TSFE']->getConfigArray();
89 $GLOBALS['TSFE']->includeTCA();
90
91 return t3lib_div::makeInstance('tslib_cObj');
92 }
93
94 }
95
96 $SOBE = t3lib_div::makeInstance('Tx_PowermailCond_Utility_EidReadSession'); // make instance
97 echo $SOBE->main(); // print content
98 ?>