benutze gerade die Extension sk_simplegallery. Nun möchte ich allerdings nur das ganze in der Einzelansicht haben. Und mit nur meine ich nur. Aber irgendwie habe ich keine Ahnung wie ich die Übersicht wegbekomme.
PHP-Code:
<?php
/***************************************************************
* Copyright notice
*
* (c) 2006 Steffen Kamper <info@sk-typo3.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 'Simple Gallery' for the 'sk_simplegallery' extension.
*
* @author Steffen Kamper <info@sk-typo3.de>
*/
require_once(PATH_tslib.'class.tslib_pibase.php');
require_once(t3lib_extMgm::extPath('sk_simplegallery').'res/PHP_JPEG_Metadata_Toolkit_1.11/EXIF.php');
class tx_sksimplegallery_pi1 extends tslib_pibase {
var $prefixId = 'tx_sksimplegallery_pi1'; // Same as class name
var $scriptRelPath = 'pi1/class.tx_sksimplegallery_pi1.php'; // Path to this script relative to the extension dir.
var $extKey = 'sk_simplegallery'; // The extension key.
var $pi_checkCHash = TRUE;
var $template;
var $uploaddir;
var $pidList;
var $caption;
/**
* 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->uploaddir = 'uploads/tx_sksimplegallery/';
if($this->conf['debug']) debug($this->piVars);
// sys_language_mode defines what to do if the requested translation is not found
$this->sys_language_mode = $this->conf['sys_language_mode']?$this->conf['sys_language_mode'] : $GLOBALS['TSFE']->sys_language_mode;
// parse XML data into php array
$this->pi_initPIflexForm();
//Flexform Values
//view
$this->conf['view'] = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'view_input', 'sVIEW');
$templateFile = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'template_file', 'sVIEW');
if($templateFile=='')
$this->conf['templateFile'] = $this->conf['templateFile']=='' ? 'typo3conf/ext/'.$this->extKey.'/pi1/template.html' : $this->conf['templateFile'];
else
$this->conf['templateFile'] ="uploads/tx_sksimplegallery/$templateFile";
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'gal_effects', 'sVIEW');
if($tmp!='') $this->conf['galEffects']=$tmp;
//gallery view
$singlePID = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'singlePID', 'sLIST');
if($singlePID!='') $this->conf['singlePID']=$singlePID;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'list_maxW', 'sLIST');
if($tmp!='') $this->conf['listView.']['file.']['maxW']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'list_maxH', 'sLIST');
if($tmp!='') $this->conf['listView.']['file.']['maxH']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'list_W', 'sLIST');
if($tmp!='') {
$this->conf['listView.']['file.']['maxW']='';
$this->conf['listView.']['file.']['width']=$tmp;
}
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'list_H', 'sLIST');
if($tmp!='') {
$this->conf['listView.']['file.']['maxH']='';
$this->conf['listView.']['file.']['height']=$tmp;
}
//single view
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'single_maxW', 'sSingle');
if($tmp!='') $this->conf['thumbView.']['file.']['maxW']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'single_maxH', 'sSingle');
if($tmp!='') $this->conf['thumbView.']['file.']['maxH']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'single_W', 'sSingle');
if($tmp!='') {
$this->conf['thumbView.']['file.']['maxW']='';
$this->conf['thumbView.']['file.']['width']=$tmp;
}
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'single_H', 'sSingle');
if($tmp!='') {
$this->conf['thumbView.']['file.']['maxH']='';
$this->conf['thumbView.']['file.']['height']=$tmp;
}
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'singleClickmode', 'sSingle');
if($tmp==1) $this->conf['thumbMode']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'singlePic_maxW', 'sSingle');
if($tmp!='') $this->conf['singleView.']['file.']['maxW']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'singlePic_maxH', 'sSingle');
if($tmp!='') $this->conf['singleView.']['file.']['maxH']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'singleID', 'sSingle');
if($tmp!='') $this->conf['singleView.']['singleID']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'singleLayout', 'sSingle');
if($tmp!='') $this->conf['singleLayout']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'eCards', 'sSingle');
if($tmp!='') $this->conf['activateEcards']=$tmp;
//teaser view
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'teaser_maxW', 'sTEASER');
if($tmp!='') $this->conf['teaserView.']['file.']['maxW']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'teaser_maxH', 'sTEASER');
if($tmp!='') $this->conf['teaserView.']['file.']['maxH']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'teaser_W', 'sTEASER');
if($tmp!='') {
$this->conf['teaserView.']['file.']['maxW']='';
$this->conf['teaserView.']['file.']['width']=$tmp;
}
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'teaser_H', 'sTEASER');
if($tmp!='') {
$this->conf['teaserView.']['file.']['maxH']='';
$this->conf['thumbView.']['file.']['height']=$tmp;
}
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'teaserCount', 'sTEASER');
if($tmp!='') $this->conf['teaserViewCount']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'teaser_order', 'sTEASER');
if($tmp!='') $this->conf['teaserViewSortBy']=$tmp;
$tmp=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'teaserTargetPID', 'sTEASER');
if($tmp!='') $this->conf['teaserViewTarget']=$tmp;
//which layout ?
$this->conf['singleLayout']=intval($this->conf['singleLayout']);
//pagebrowswer defaults
if(intval($this->conf['listPageRecords'])==0) $this->conf['listPageRecords'] = 20;
if(intval($this->conf['singlePageRecords'])==0) $this->conf['singlePageRecords'] = 20;
//proceed now
$this->template=$this->cObj->fileResource($this->conf['templateFile']);
$this->pidList = $this->pi_getPidList($this->cObj->data['pages'],$this->cObj->data['recursive']);
switch($this->conf['view']) {
case 'LIST':
$content=$this->Galleries();
break;
case 'SINGLE':
$content=$this->SingleGallery();
break;
case 'TEASER':
$content=$this->Teaser();
break;
case 'ECARD':
$content=$this->eCards();
break;
}
return $this->pi_wrapInBaseClass($content);
}
function Galleries() {
$template['total'] = $this->cObj->getSubpart($this->template,'###LISTVIEW###');
$template['item'] = $this->cObj->getSubpart($template['total'],'###LIST###');
$innercontent='';
//PB
$PB='';
if(intval($this->conf['listPageRecords'])>0 && $count>intval($this->conf['listPageRecords'])) {
$maxpages=ceil($count/intval($this->conf['listPageRecords']));
$limit=$page*$this->conf['pageRecords'].','.$this->conf['listPageRecords'];
$PB.='<p class="pagebrowser">'.$this->pi_getLL('pi_list_browseresults_page','Page').' ';
for($i=0;$i<$maxpages;$i++) {
$PB.=($i==$page ? '<span class="active">'.($i+1) : '<span><a href="'.$this->pi_linkTP_keepPIvars_url(array('page'=>$i),1,0,$GLOBALS['TSFE']->id).'">'.($i+1).'</a>').'</span>';
}
$PB.='</p>';
}
//language patch from Marcus Krause
$where = '';
if ($this->sys_language_mode == 'strict' && $GLOBALS['TSFE']->sys_language_content) {
$tmpres = $this->cObj->exec_getQuery('tx_sksimplegallery_galleries', array('selectFields' => 'tx_sksimplegallery_galleries.l18n_parent', 'where' => 'tx_sksimplegallery_galleries.sys_language_uid = '.$GLOBALS['TSFE']->sys_language_content.$this->enableFields, 'pidInList' => $this->pidList));
$strictUids = array();
while ($tmprow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($tmpres)) {
$strictUids[] = $tmprow['l18n_parent'];
}
$strStrictUids = implode(',', $strictUids);
$where .= '(tx_sksimplegallery_galleries.uid IN (' . ($strStrictUids?$strStrictUids:0) . ') OR tx_sksimplegallery_galleries.sys_language_uid=-1)';
} else {
$where .= 'tx_sksimplegallery_galleries.sys_language_uid IN (0,-1)';
}
// Auswahl des Ordners
if ($this->pidList) $where .= ' AND pid IN ('. $this->pidList .')';
$where .= ' AND deleted = 0 AND hidden = 0';
$query = $GLOBALS['TYPO3_DB']->SELECTquery(
'*', // SELECT ...
'tx_sksimplegallery_galleries', // FROM ...
$where, // WHERE...
'', // GROUP BY...
'sorting', // ORDER BY...
$limit // LIMIT ...
);
$res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db, $query);
while($temp = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
// get the translated record if the content language is not the default language
if ($GLOBALS['TSFE']->sys_language_content) {
$OLmode = ($this->sys_language_mode == 'strict'?'hideNonTranslated':'');
$temp = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_sksimplegallery_galleries', $temp, $GLOBALS['TSFE']->sys_language_content, $OLmode);
}
//prepare picture
$this->conf['listView.']['file']=$temp['altgalpicture'] ? $this->uploaddir.$temp['altgalpicture'] : $this->uploaddir.$this->getGalpicture($temp['galpicture']);
$this->conf['listView.']['params'] = $this->pi_classParam('image');
$this->conf['listView.']['altText'] = $temp['title'];
$this->conf['listView.']['titleText'] = $temp['title'];
$markerArray['###PICTURE###']=$this->ImageMarker($this->conf['listView.'],true);
$imginfo=$GLOBALS['TSFE']->lastImageInfo;
$markerArray['###WIDTH###']='style="width:'.$imginfo[0].'px;"';
$markerArray['###TITLE###']=$temp['title'];
$cache = 1;
$this->pi_USER_INT_obj = 0;
if($this->conf['linkSingleDirect']==1)
$subpartArray['###LINK_ITEM###']= explode('|',$this->pi_linkTP('|',$urlParameters=array($this->prefixId.'[id]'=>$temp['uid'],$this->prefixId.'[single]'=>$this->getFirstPicture($temp['uid']),$this->prefixId.'[backpid]'=>$GLOBALS["TSFE"]->id),$cache,$altPageId=$this->conf['singlePID']));
else
$subpartArray['###LINK_ITEM###']= explode('|',$this->pi_linkTP('|',$urlParameters=array($this->prefixId.'[id]'=>$temp['uid'],$this->prefixId.'[backpid]'=>$GLOBALS["TSFE"]->id),$cache,$altPageId=$this->conf['singlePID']));
$innercontent.=$this->cObj->substituteMarkerArrayCached($template['item'], $markerArray,array(),$subpartArray);
}
$markerArray=array();
$markerArray['###PAGEBROWSER###']=$PB;
$subpartArray['###LIST###']=$innercontent;
return $this->cObj->substituteMarkerArrayCached($template['total'], $markerArray,$subpartArray,array());
}
function getFirstPicture($gal) {
$res=$GLOBALS['TYPO3_DB']->exec_SELECTquery('*','tx_sksimplegallery_galleries','uid='.$gal);
$row=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$p=$row['pictures']!='' ? explode(',',$row['pictures']) : array(0);
return $p[0];
}
function getGalpicture($uid) {
$where = '';
if ($this->sys_language_mode == 'strict' && $GLOBALS['TSFE']->sys_language_content) {
$tmpres = $this->cObj->exec_getQuery('tx_sksimplegallery_pictures', array('selectFields' => 'tx_sksimplegallery_pictures.l18n_parent', 'where' => 'tx_sksimplegallery_pictures.sys_language_uid = '.$GLOBALS['TSFE']->sys_language_content.$this->enableFields, 'pidInList' => $this->pidList));
$strictUids = array();
while ($tmprow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($tmpres)) {
$strictUids[] = $tmprow['l18n_parent'];
}
$strStrictUids = implode(',', $strictUids);
$where .= '(tx_sksimplegallery_pictures.uid IN (' . ($strStrictUids?$strStrictUids:0) . ') OR tx_sksimplegallery_pictures.sys_language_uid=-1)';
} else {
$where .= 'tx_sksimplegallery_pictures.sys_language_uid IN (0,-1)';
}
$where .= ' AND uid = ' . intval($uid) . ' AND deleted = 0 AND hidden = 0';
$query = $GLOBALS['TYPO3_DB']->SELECTquery(
'*', // SELECT ...
'tx_sksimplegallery_pictures', // FROM ...
$where, // WHERE...
'', // GROUP BY...
'', // ORDER BY...
'' // LIMIT ...
);
$res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db, $query);
// already localized picture
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
$query = $GLOBALS['TYPO3_DB']->SELECTquery(
'picture', // SELECT ...
'tx_sksimplegallery_pictures', // FROM ...
'uid = ' . intval($uid) . ' AND deleted = 0 AND hidden = 0',
'', // GROUP BY...
'', // ORDER BY...
'' // LIMIT ...
);
$res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db, $query);
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
return $row['picture'];
} else {
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
// get the translated record if the content language is not the default language
if ($GLOBALS['TSFE']->sys_language_content) {
$OLmode = ($this->sys_language_mode == 'strict'?'hideNonTranslated':'');
$row = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_sksimplegallery_pictures', $row, $GLOBALS['TSFE']->sys_language_content, $OLmode);
}
return $row['picture'];
}
}
function Teaser() {
$template['total'] = $this->cObj->getSubpart($this->template,'###TEASERVIEW###');
$template['item'] = $this->cObj->getSubpart($template['total'],'###THUMBLIST###');
#get pictures from galleries
$res=$GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*',
'tx_sksimplegallery_galleries',
'hidden=0 and deleted=0 and pid IN('.$this->pidList.')');
while($row=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$pics.=$row['pictures']!=''?$row['pictures'].',':'';
}
$pics=substr($pics,0,strlen($pics)-1);
if ($this->sys_language_mode == 'strict' && $GLOBALS['TSFE']->sys_language_content) {
$tmpres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_sksimplegallery_pictures.l18n_parent', 'tx_sksimplegallery_pictures', 'tx_sksimplegallery_pictures.sys_language_uid = '.$GLOBALS['TSFE']->sys_language_content.$this->enableFields);
$strictUids = array();
while ($tmprow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($tmpres)) {
$strictUids[] = $tmprow['l18n_parent'];
}
$strStrictUids = implode(',', $strictUids);
$where .= '(tx_sksimplegallery_pictures.uid IN (' . ($strStrictUids?$strStrictUids:0) . ') OR tx_sksimplegallery_pictures.sys_language_uid=-1)';
} else
$where .= 'tx_sksimplegallery_pictures.sys_language_uid IN (0,-1)';
$res=$GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*',
'tx_sksimplegallery_pictures',
$where.' AND hidden=0 AND deleted=0 AND pid IN('.$this->pidList.') AND uid IN('.$pics.')',
'',$orderBy=$this->conf['teaserViewSortBy'],
$limit=$this->conf['teaserViewCount']);
&n