Code:
<?php
/***************************************************************
* Copyright notice
*
* (c) 2011 sdfg <sdfg>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* [CLASS/FUNCTION INDEX of SCRIPT]
*
* Hint: use extdeveval to insert/update function index above.
*/
require_once(PATH_tslib.'class.tslib_pibase.php');
/**
* Plugin 'test' for the 'paultest' extension.
*
* @author sdfg <sdfg>
* @package TYPO3
* @subpackage tx_paultest
*/
class tx_paultest_pi1 extends tslib_pibase {
var $prefixId = 'tx_paultest_pi1'; // Same as class name
var $scriptRelPath = 'pi1/class.tx_paultest_pi1.php'; // Path to this script relative to the extension dir.
var $extKey = 'paultest'; // The extension key.
var $pi_checkCHash = true;
/**
* dbhandler
*
* @var t3lib_DB
*/
var $db;
/**
* The main method of the PlugIn
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
* @return The content that is displayed on the website
*/
function main($content, $conf) {
$this->conf = $conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$this->db = &$GLOBALS['TYPO3_DB'];
if(intval($this->piVars['send']) == 1) {
$getUrl = 'tx_indexedsearch[sword]=';
if(!preg_match("/z.B./",htmlspecialchars($this->piVars['klinikname']))) {
$getUrl .= htmlspecialchars($this->piVars['klinikname']).',';
}
if(!preg_match("/z.B./",htmlspecialchars($this->piVars['arztname']))) {
$getUrl .= htmlspecialchars($this->piVars['arztname']).',';
}
if(!preg_match("/z.B./",htmlspecialchars($this->piVars['fachgebiet']))) {
$getUrl .= htmlspecialchars($this->piVars['fachgebiet']).',';
}
if(!preg_match("/z.B./",htmlspecialchars($this->piVars['krankheiten']))) {
$getUrl .= htmlspecialchars($this->piVars['krankheiten']).',';
}
if(!preg_match("/Hier ist eine Volltextsuche/",htmlspecialchars($this->piVars['volltextsuche']))) {
$getUrl .= htmlspecialchars($this->piVars['volltextsuche']);
}
//.$this->conf['suchSeitePid']S
//t3lib_div::debug($GLOBALS['TSFE']->tmpl->setup['config.']['baseURL'] . $this->pi_getPageLink($GLOBALS['TSFE']->id) . '?' . urlencode($getUrl));
header("Location: " . $GLOBALS['TSFE']->tmpl->setup['config.']['baseURL'] . $this->pi_getPageLink($this->conf['suchSeitePid']) . '&' . $getUrl);
//t3lib_div::_GET();
//t3lib_div::_POST();
exit();
}
//t3lib_div::debug($_POST['tx_paultest_pi1']);
$template = $this->cObj->fileResource($this->conf['templateFile']);
$markerArray = array(
'###PREFIX###' => $this->prefixId,
'###PAGELINK###' => $this->pi_getPageLink($GLOBALS['TSFE']->id),
'###BUTTON_LABEL###' => htmlspecialchars($this->pi_getLL('submit_button_label')),
'###TEXTAREA###' => htmlspecialchars($this->piVars['volltextsuche']),
'###LINK_SUCHSEITE###' => $GLOBALS['TSFE']->tmpl->setup['config.']['baseURL'] . $this->pi_getPageLink($this->conf['suchSeitePid']),
'###SELECT_KLINIK###' => htmlspecialchars($this->piVars['klinikname']),
'###SELECT_KRANKHEIT###' => htmlspecialchars($this->piVars['krankheiten']),
'###SELECT_ARZT###' => htmlspecialchars($this->piVars['arztname']),
'###SELECT_FACHGEBIET###' => htmlspecialchars($this->piVars['fachgebiet']),
'###SELECT_VOLLTEXTSUCHE###' => htmlspecialchars($this->piVars['volltextsuche']),
'###UEBERSCHRIFT###' => $this->pi_getLL('label_ueberschrift'),
'###LABEL_ERWEITERTESUCHE###' => $this->pi_getLL('label_erweitertesuche'),
'###LABEL_KLINIKNAME###' => $this->pi_getLL('label_klinikname'),
'###LABEL_KRANKHEITEN###' => $this->pi_getLL('label_krankheiten'),
'###LABEL_ARZTNAME###' => $this->pi_getLL('label_arztname'),
'###LABEL_FACHGEBIET###' => $this->pi_getLL('label_fachgebiet'),
'###OPTIONS_KLINIKNAME###' => '<option>'.$this->pi_getLL('options_klinikname').'</option>'.$this->getClinicOptions(),
'###OPTIONS_KRANKHEITEN###' => '<option>'.$this->pi_getLL('options_krankheiten').'</option>'.$this->getSicknessOptions(),
'###OPTIONS_ARZTNAME###' => '<option>'.$this->pi_getLL('options_arztname').'</option>'.$this->getDocOptions(),
'###OPTIONS_FACHGEBIET###' => '<option>'.$this->pi_getLL('options_fachgebiet').'</option>'.$this->getProfessionalDisciplineOptions(),
'###OPTIONS_TEXTAREA###' => $this->pi_getLL('options_textarea')
);
/*$markerArray['###BLA###'] = 'test'; <----- Array zuweisen wenn es schon angelegt*/
$content = $this->cObj->substituteMarkerArray($template, $markerArray);
return $this->pi_wrapInBaseClass($content);
}
function getClinicOptions () {
$res = $this->db->exec_SELECTquery(
$select_fields = '*',
$from_table = 'tx_paultest_klinikname',
$where_clause = '1=1 ' . $this->cObj->enableFields('tx_paultest_klinikname'),
$groupBy = '',
$orderBy = 'sorting asc',
$limit = ''
);
$optionString = '';
while($row = $this->db->sql_fetch_assoc($res)){
$optionString .= '<option value="'.$row['name'].'"'.($this->piVars['klinikname'] == $row['name'] ? 'selected="selected"' : '').'>'.$row['name'].'</option>';
}
return $optionString;
}
function getDocOptions () {
$res = $this->db->exec_SELECTquery(
$select_fields = '*',
$from_table = 'tx_paultest_arztname',
$where_clause = '1=1 ' . $this->cObj->enableFields('tx_paultest_arztname'),
$groupBy = '',
$orderBy = 'sorting asc',
$limit = ''
);
$optionString = '';
while($row = $this->db->sql_fetch_assoc($res)){
$optionString .= '<option value="'.$row['name'].'">'.$row['name'].'</option>';
}
return $optionString;
}
function getSicknessOptions () {
$res = $this->db->exec_SELECTquery(
$select_fields = '*',
$from_table = 'tx_paultest_krankheiten',
$where_clause = '1=1 ' . $this->cObj->enableFields('tx_paultest_krankheiten'),
$groupBy = '',
$orderBy = 'sorting asc',
$limit = ''
);
$optionString = '';
while($row = $this->db->sql_fetch_assoc($res)){
$optionString .= '<option value="'.$row['name'].'">'.$row['name'].'</option>';
}
return $optionString;
}
function getProfessionalDisciplineOptions () {
$res = $this->db->exec_SELECTquery(
$select_fields = '*',
$from_table = 'tx_paultest_fachgebiet',
$where_clause = '1=1 ' . $this->cObj->enableFields('tx_paultest_fachgebiet'),
$groupBy = '',
$orderBy = 'sorting asc',
$limit = ''
);
$optionString = '';
while($row = $this->db->sql_fetch_assoc($res)){
$optionString .= '<option value="'.$row['name'].'">'.$row['name'].'</option>';
}
return $optionString;
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/paultest/pi1/class.tx_paultest_pi1.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/paultest/pi1/class.tx_paultest_pi1.php']);
}
?>
Im Prinzip möchte ich nach dem abschicken des Formulars auf der Zielseite die ausgewählte option behalten die ich vorher gewählt habe. Nur funktioniert irgendwie es nicht so richtig hab es jetzt auch nur in der Funktion getClinicName() eingebunden evtl. kann mir ja jemand helfen! Für jeden Tipp bin ich dankbar