[TYPO3-realty] Sorting in ListView

Ada Borlovan ada at borlovan.de
Fri May 7 11:36:22 CEST 2010


Hi,

 

I have resolved the problem with sorting in the ListView. I hope that now
work fine.

 

 

-          Class.tx_realty_pi1.php

 

private function createSorting() {

                               // Only have the sort form if at least one
sort criteria is selected in

                               // the BE.

                               if
(!$this->hasConfValueString('sortCriteria')) {

                                               return '';

                               }

 

                               $this->setMarker('self_url',
$this->getSelfUrl());

                               $selectedSortCriteria =
t3lib_div::trimExplode(

                                               ',',
$this->getConfValueString('sortCriteria'), true

                               );

                               

                                $options = array();

                               foreach ($selectedSortCriteria as
$selectedSortCriterion) {

                                               if
(in_array($selectedSortCriterion, self::$sortCriteria)) {

                                                               

 
$sortCriterion = isset($this->piVars['orderBy'])

 
? $this->piVars['orderBy']

 
: $this->getConfValueString('orderBy');

                                                               

                                                               if
($selectedSortCriterion == $sortCriterion) {

 
$selected = ' selected="selected"';

                                                               } else {

 
$selected = '';

                                                               }

                                                               

 
$this->setMarker('sort_value', $selectedSortCriterion);

 
$this->setMarker('sort_selected', $selected);

 
$this->setMarker(

 
'sort_label',

 
$this->translate('label_' . $selectedSortCriterion)

                                                               );

                                                               $options[] =
$this->getSubpart('SORT_OPTION');

                                               }

                               }

                               $this->setSubpart('sort_option', implode(LF,
$options));

                               

                               $descendingFlag =
isset($this->piVars['descFlag'])

                                               ? (boolean)
$this->piVars['descFlag']

                                               :
$this->getListViewConfValueBoolean('descFlag');

                                               

                               if (!$descendingFlag) {

 
$this->setMarker('sort_checked_asc', ' checked="checked"');

 
$this->setMarker('sort_checked_desc', '');

                               } else {

 
$this->setMarker('sort_checked_asc', '');

 
$this->setMarker('sort_checked_desc', ' checked="checked"');

                               }

 

                               return $this->getSubpart('WRAPPER_SORTING');

                }



More information about the TYPO3-project-realty mailing list