Hallo
Ich möchte aus der tabelle tx_infopunkteipbuero_messages nicht alle Datensätze ausgeben, so wie der nachfolgende PHP Code dies tut, sondern ausschliesslich die jeweiligen des angemeldeten users.
Dazu habe ich in meiner Tabelle tx_infopunkteipbuero_messages das Feld "ipb_costumer" angelegt.
Im Prinzip muss ich irgendwo hier im php Code nachfolgend Inhaltliche where Klausel integrieren:
table = tx_infopunkteipbuero_contract
where {
1 {
col = ipb_customer
value = fe_user_id
}
leider habe ich schon alles versucht.....
ganz unten habe ich ein paar Code-Schnippsel auskommentiert, mit welchen ich versuche angestellt hatte.
Frage 1: Wo muss welche sql Filteranweisung rein, damit nur Datensätze des eingeloggten Users ausgegeben werden?
Frage 2: mit welcher Globalen Variable sprich "fe_user_id" kann ich hier die o.g. Anweisung abbilden?
<?php
/***************************************************************
* Copyright notice
*
* (c) 2005 Jan Ohlmann (jan.ohlmann@infopunkte.de)
* 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!
***************************************************************/
/**
* Plugin 'ipBuero' for the 'infopunkte_ipbuero' extension.
*
* @author Jan Ohlmann <jan.ohlmann@infopunkte.de>
*/
require_once(PATH_tslib.'class.tslib_pibase.php');
class tx_infopunkteipbuero_pi1 extends tslib_pibase {
var $prefixId = 'tx_infopunkteipbuero_pi1'; // Same as class name
var $scriptRelPath = 'pi1/class.tx_infopunkteipbuero_pi1.php'; // Path to this script relative to the extension dir.
var $extKey = 'infopunkte_ipbuero'; // The extension key.
var $pi_checkCHash = TRUE;
/**
* [Put your description here]
*/
function main($content,$conf) {
switch((string)$conf['CMD']) {
case 'singleView':
list($t) = explode(':',$this->cObj->currentRecord);
$this->internal['currentTable']=$t;
$this->internal['currentRow']=$this->cObj->data;
return $this->pi_wrapInBaseClass($this->singleView($content,$conf));
break;
default:
if (strstr($this->cObj->currentRecord,'tt_content')) {
$conf['pidList'] = $this->cObj->data['pages'];
$conf['recursive'] = $this->cObj->data['recursive'];
}
return $this->pi_wrapInBaseClass($this->listView($content,$conf));
break;
}
}
/**
* [Put your description here]
*/
function listView($content,$conf) {
$this->conf=$conf; // Setting the TypoScript passed to this function in $this->conf
$this->pi_setPiVarDefaults();
$this->pi_loadLL(); // Loading the LOCAL_LANG values
$lConf = $this->conf['listView.']; // Local settings for the listView function
if ($this->piVars['showUid']) { // If a single element should be displayed:
$this->internal['currentTable'] = 'tx_infopunkteipbuero_messages';
$this->internal['currentRow'] = $this->pi_getRecord('tx_infopunkteipbuero_messages',$this->piVars['showUid']);
$content = $this->singleView($content,$conf);
return $content;
} else {
$items=array(
'1'=> $this->pi_getLL('list_mode_1','Mode 1'),
'2'=> $this->pi_getLL('list_mode_2','Mode 2'),
'3'=> $this->pi_getLL('list_mode_3','Mode 3'),
);
if (!isset($this->piVars['pointer'])) $this->piVars['pointer']=0;
if (!isset($this->piVars['mode'])) $this->piVars['mode']=1;
// Initializing the query parameters:
list($this->internal['orderBy'],$this->internal['descFlag']) = explode(':',$this->piVars['sort']);
$this->internal['results_at_a_time']=t3lib_div::intInRange($lConf['results_at_a_time'],0,1000,3); // Number of results to show in a listing.
$this->internal['maxPages']=t3lib_div::intInRange($lConf['maxPages'],0,1000,2);; // The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc.
$this->internal['searchFieldList']='subject,notice,callagent';
$this->internal['orderByList']='uid,subject,callagent';
// Get number of records:
$res = $this->pi_exec_query('tx_infopunkteipbuero_messages',1);
list($this->internal['res_count']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
// Make listing query, pass query to SQL database:
$res = $this->pi_exec_query('tx_infopunkteipbuero_messages');
$this->internal['currentTable'] = 'tx_infopunkteipbuero_messages';
// Put the whole list together:
$fullTable=''; // Clear var;
# $fullTable.=t3lib_div::view_array($this->piVars); // DEBUG: Output the content of $this->piVars for debug purposes. REMEMBER to comment out the IP-lock in the debug() function in t3lib/config_default.php if nothing happens when you un-comment this line!
// Adds the mode selector.
$fullTable.=$this->pi_list_modeSelector($items);
// Adds the whole list table
$fullTable.=$this->pi_list_makelist($res);
// Adds the search box:
$fullTable.=$this->pi_list_searchBox();
// Adds the result browser:
$fullTable.=$this->pi_list_browseresults();
// Returns the content from the plugin.
return $fullTable;
}
}
/**
* [Put your description here]
*/
function singleView($content,$conf) {
$this->conf=$conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
// This sets the title of the page for use in indexed search results:
if ($this->internal['currentRow']['title']) $GLOBALS['TSFE']->indexedDocTitle=$this->internal['currentRow']['title'];
$content='<div this-="">pi_classParam('singleView').'>
<table border="0" width="100%">
<tbody>
<tr>
<td rowspan="9" valign="top" width="20%" align="right"><img src="uploads/tf/pixel.gif" width="180" height="1" alt="" border="0" /><h4 class="contentSubject">Gesprächsnotiz<br />Details</h4></td>
<td rowspan="9" align="left" bgcolor="#660000" width="1px"><img src="uploads/tf/pixel.gif" width="1" height="1" alt="" border="0" /></td><td colspan="5"><ul class="p" style="list-style-image:url(fileadmin/ip.icons/m2.1.gif); font-size:13px"><li>Record "'.$this->internal['currentRow']['uid'].'" from table "'.$this->internal['currentTable'].'":</li></ul></td>
</tr>
<tr align="left">
<tr class="contentConfig" style="color:black"><td align="right">am:</td><td width="70%"><input type="text" name="'.$this-" />getFieldHeader('timedate').'" value="'.$this->getFieldContent('timedate').'" readonly class="contentNoticeDetails"></td></tr>
<tr class="contentConfig" style="color:black"><td align="right">Betreff:</td><td width="70%"><input type="text" name="'.$this-" />getFieldHeader('subject').'" value="'.$this->getFieldContent('subject').'" readonly class="contentNoticeDetails"></td></tr>
<tr class="contentConfig" style="color:black"><td align="right">Mitteilung:</td><td width="70%"><textarea name="'.$this-">getFieldHeader('notice').'" readonly style="font-size:1em;font-family:arial;width:25em;border:1px solid #B0B0B0;letter-spacing:0.3em; height:10em; padding:0.5em 0.5em 0.5em 0.5em; background-color: #EDEDED;">'.$this->getFieldContent('notice').'
Danke Für Euche Hilfe. Ich sitz schon ein paar tage an dem Problem...
// Die Datenbank ansprechen und in einer Schleife ausgeben
//$query = "SELECT * FROM tx_infopunkteipbuero_messages";
//$query = 'SELECT * FROM tx_infopunkteipbuero_messages WHERE ipb_costumer ='.intval($GLOBALS["TSFE"]->id);
//$query.= " WHERE ipb_costumer = 1 AND hidden = 0";
//$res = mysql(TYPO3_db,$query);
//while($row = mysql_fetch_assoc($res)) {
// Ein Array mit Platzhaltern als Schlüssel mit den Werten füllen
//$marker["###NAME###"] = $row["vorname"]." ".$row["nachname"];
//$marker["###BILD###"] = $row["bild"];
//$content .= $row;
//}