Browse Source

Fix Bug #838070: Refactor the page browser in list view

pull/1/head
Sebastian Meyer 11 years ago
parent
commit
96f0743a32
  1. 46
      dlf/plugins/listview/class.tx_dlf_listview.php
  2. 10
      dlf/plugins/listview/locallang.xml

46
dlf/plugins/listview/class.tx_dlf_listview.php

@ -82,23 +82,59 @@ class tx_dlf_listview extends tx_dlf_plugin {
}
$output = ($this->piVars['pointer'] > 0 ? $this->pi_linkTP_keepPIvars($this->pi_getLL('firstPage', '<'), array ('pointer' => $this->piVars['pointer'] - 1), TRUE) : $this->pi_getLL('firstPage', '<'));
// Get separator.
$separator = $this->pi_getLL('separator', ' - ');
$output .= $this->pi_getLL('separator', ' - ');
// Add link to previous page.
if ($this->piVars['pointer'] > 0) {
$output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '<'), array ('pointer' => $this->piVars['pointer'] - 1), TRUE).$separator;
} else {
$output = $this->pi_getLL('prevPage', '<').$separator;
}
$i = 0;
while ($i < $maxPages) {
$output .= ($this->piVars['pointer'] != $i ? $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d'), $i + 1), array ('pointer' => $i), TRUE) : sprintf($this->pi_getLL('page', '%d'), $i + 1));
if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) {
if ($this->piVars['pointer'] != $i) {
$output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d'), $i + 1), array ('pointer' => $i), TRUE).$separator;
} else {
$output .= sprintf($this->pi_getLL('page', '%d'), $i + 1).$separator;
}
$output .= $this->pi_getLL('separator', ' - ');
$skip = TRUE;
} elseif ($skip == TRUE) {
$output .= $this->pi_getLL('skip', '...').$separator;
$skip = FALSE;
}
$i++;
}
$output .= ($this->piVars['pointer'] < $maxPages - 1 ? $this->pi_linkTP_keepPIvars($this->pi_getLL('lastPage', '&gt;'), array ('pointer' => $this->piVars['pointer'] + 1), TRUE) : $this->pi_getLL('lastPage', '&gt;'));
if ($this->piVars['pointer'] < $maxPages - 1) {
$output .= $this->pi_linkTP_keepPIvars($this->pi_getLL('nextPage', '&gt;'), array ('pointer' => $this->piVars['pointer'] + 1), TRUE);
} else {
$output .= $this->pi_getLL('nextPage', '&gt;');
}
return $output;

10
dlf/plugins/listview/locallang.xml

@ -13,10 +13,11 @@
<label index="tt_content.pi_flexform.templateFile">Template file</label>
<label index="nohits">Nothing found.</label>
<label index="count">Entries %d to %d of %d.</label>
<label index="firstPage">&lt;</label>
<label index="lastPage">&gt;</label>
<label index="prevPage">&lt;</label>
<label index="nextPage">&gt;</label>
<label index="page">%d</label>
<label index="separator"> - </label>
<label index="skip">...</label>
<label index="orderBy">Order by: </label>
<label index="noTitle">[no title]</label>
</languageKey>
@ -28,10 +29,11 @@
<label index="tt_content.pi_flexform.templateFile">HTML-Template</label>
<label index="nohits">Keine Treffer.</label>
<label index="count">Einträge %d bis %d von %d.</label>
<label index="firstPage">&lt;</label>
<label index="lastPage">&gt;</label>
<label index="prevPage">&lt;</label>
<label index="nextPage">&gt;</label>
<label index="page">%d</label>
<label index="separator"> - </label>
<label index="skip">...</label>
<label index="orderBy">Sortieren nach: </label>
<label index="noTitle">[kein Titel]</label>
</languageKey>

Loading…
Cancel
Save