Zum Inhalt springen

ce_gallery Sortierung

Erstellt am 9. November 2010 · 1 Antwort · letzte Antwort am 12. November 2010

Tags: Dateien & FAL, Bilder, Frage

crossl ·

Typo3 4.4.4 und ce_gallery 2.05 mit DAM 1.1.5

Das läuft mal soweit ganz gut, ich möchte aber die Bilder nach dem Titel sortieren.
Dazu habe ich in pi1/class.tx_cegallery_pi1.php in function getContent() dei Sortierung geändert:

		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
			'tx_dam.uid, tx_dam.title, tx_dam.file_path, tx_dam.file_name, tx_dam.alt_text,' .
				'tx_dam.crdate, tx_dam.loc_desc',
			'tx_dam_mm_cat damcat LEFT JOIN tx_dam ON damcat.uid_local = tx_dam.uid',
			'damcat.uid_foreign = ' . $album . ' AND tx_dam.file_mime_type = \'image\' ' . $this->cObj->enableFields('tx_dam'),
			'',
			'tx_dam.title',
			$limit
		);

Das klappt auch, ABER wenn ich auf die Detailansicht eines Fotos klicke und dann auf "zurück - bzw. weiter" dann wird nicht nach tx_dam.title sortiert.

Wer weiss, wie ich da den Code umbauen muss?

crossl ·

Jetzt habe ichs doch selbst gelöst - wen's interessiert hier die Lösung:

in pi1/class.tx_cegallery_pi1.php

	function getDetail($album, $detail)	{
		$photo = '';

		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
			'tx_dam.uid, tx_dam.title, tx_dam.file_path, tx_dam.file_name, tx_dam.date_cr,' .
				'tx_dam.date_mod, tx_dam.alt_text, tx_dam.crdate, tx_dam.loc_desc, tx_dam.tstamp',
			'tx_dam',
			'tx_dam.uid = ' . $detail . ' AND tx_dam.file_mime_type = "image" ' . $this->cObj->enableFields('tx_dam')
		);

		$thephoto = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
		$imagePath = $thephoto['file_path'] . $thephoto['file_name'];

		$sortingToogle = array (
			'DESC' => array('>', '<', 'ASC', ),
			'ASC' => array('<', '>', 'DESC'));

		$sorting = split(' ', $this->lConf['thumbnails']['orderby']);

		list(, $sorting[3]) = split('\.', $sorting[0]);

		$criterion = (is_numeric($thephoto[$sorting[3]]) ?
			$thephoto[$sorting[3]]  : '\'' . $thephoto[$sorting[3]] . '\'');

		$sql = array (
			'SELECT' => 'tx_dam.uid, tx_dam.title',
			'FROM' => 'tx_dam_mm_cat damcat LEFT JOIN tx_dam ON damcat.uid_local = tx_dam.uid',
			'WHERE' => 'damcat.uid_foreign = ' . $album .
				' AND tx_dam.file_mime_type = "image" ' .
				' AND tx_dam.uid!=' . $detail .
				$this->cObj->enableFields('tx_dam'),
			'LIMIT' => '0,1');



// T3 mysql Wrapper Klasse
$resPrev = mysql(TYPO3_db, 'SELECT tx_dam.uid, tx_dam.title FROM tx_dam_mm_cat damcat LEFT JOIN tx_dam ON damcat.uid_local = tx_dam.uid WHERE 
damcat.uid_foreign = '.$album .' AND tx_dam.file_mime_type = "image"  AND tx_dam.deleted=0 AND tx_dam.t3ver_state<=0 
AND tx_dam.hidden=0 AND tx_dam.title<
(SELECT tx_dam.title FROM tx_dam_mm_cat damcat LEFT JOIN tx_dam ON damcat.uid_local = tx_dam.uid WHERE 
damcat.uid_foreign = '.$album .' AND tx_dam.file_mime_type = "image"  AND tx_dam.deleted=0 AND tx_dam.t3ver_state<=0 
AND tx_dam.hidden=0 AND tx_dam.uid='.$detail.' ORDER BY tx_dam.title ASC) ORDER BY tx_dam.title DESC limit 0,1');


$resNext=mysql(TYPO3_db, 'SELECT tx_dam.uid, tx_dam.title FROM tx_dam_mm_cat damcat LEFT JOIN tx_dam ON damcat.uid_local = tx_dam.uid WHERE 
damcat.uid_foreign = '.$album .' AND tx_dam.file_mime_type = "image"  AND tx_dam.deleted=0 AND tx_dam.t3ver_state<=0 
AND tx_dam.hidden=0 AND tx_dam.title>
(SELECT tx_dam.title FROM tx_dam_mm_cat damcat LEFT JOIN tx_dam ON damcat.uid_local = tx_dam.uid WHERE 
damcat.uid_foreign = '.$album .' AND tx_dam.file_mime_type = "image"  AND tx_dam.deleted=0 AND tx_dam.t3ver_state<=0 
AND tx_dam.hidden=0 AND tx_dam.uid='.$detail.' ORDER BY tx_dam.title DESC) ORDER BY tx_dam.title ASC limit 0,1') ;






		$prevphoto = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resPrev);
		$nextphoto = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resNext);
/*
		t3lib_div::debug($resPrev);
		t3lib_div::debug($resNext);
		t3lib_div::debug($criterion);
		t3lib_div::debug($prevphoto);
		t3lib_div::debug($nextphoto);
*/

		$photo .= '<div' . $this->pi_classParam('detail_header') . '>';
		$photo .= '<h2' . $this->pi_classParam('detail_header') . '>' . $thephoto['title'] . '</h2>';
		$conf = array();
		$conf['parameter'] = $imagePath;
		if ($this->lConf['thumbnails']['fullscreen']) {
				$photo .= '<span' . $this->pi_classParam('detail_fulllink') . '>' .
					$this->cObj->typoLink(' (' . $this->pi_getLL('fullscreen') . ')', $conf) . '</span>';
		}
		$photo .= '</div>';
		$photo .= '<div' . $this->pi_classParam('detail_nav') . '>';
		$photo .= '<span' . $this->pi_classParam('photo_prev') . '>';
		if (isset($prevphoto['uid'])) {
			$photo .= $this->pi_linkTP($this->pi_getLL('prev').'&nbsp;',
				array(
					$this->prefixId . '[album]' => $album,
					$this->prefixId . '[uid]' => $prevphoto['uid'],
					$this->prefixId . '[detail]' => $prevphoto['uid']
				),
				true
			);
		}
		$photo .= '&nbsp;</span>';
		// $photo .= '<span' . $this->pi_classParam('album_back_link') . '>';
		// $photo .= $this->albumBackLink($album);
		// $photo .= '</span>';
		$photo .= '<span' . $this->pi_classParam('photo_next') . '>';
		if (isset($nextphoto['uid'])) {
			$photo .= $this->pi_linkTP($this->pi_getLL('next').'&nbsp;&nbsp;',
				array(
					$this->prefixId . '[album]' => $album,
					$this->prefixId . '[uid]' => $nextphoto['uid'],
					$this->prefixId . '[detail]' => $nextphoto['uid']
				),
				true
			);
		}
		$photo .= '&nbsp;</span>';
		$photo .= '</div>';
		 //$photo .= '<div' . $this->pi_classParam('detail_entry') . '>';
		// backlink auf Foto
		$photo .= '<br/>'.$this->albumBackLink2($album).'<div' . $this->pi_classParam('detail_entry') . '>';

		$imagePath = $thephoto['file_path'] . $thephoto['file_name'];

		$altTag = $thephoto['alt_text'] ? $thephoto['alt_text'] : $thephoto['title'];

		$photo .= $this->buildDetail($imagePath, $thephoto['uid'], $altTag);
		 // $photo .= '</div>';
		$photo .= '</div></a>';
		$photo .= '<p' . $this->pi_classParam('album_header') . '>' . $thephoto['loc_desc'] . '</p>';

		return $photo;
	}