コード例 #1
0
 /**
  * Generate the pagination menu and return it as HTML string.
  *
  * @param string $strSeparator Unused in this implementation.
  *
  * @return string
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  * @SuppressWarnings(PHPMD.CamelCaseVariableName)
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function generate($strSeparator = '')
 {
     $this->determineValues();
     // Return if there is only one page
     if ($this->intTotalPages < 2 || $this->intRows < 1) {
         return '';
     }
     if ($this->intPage == -1) {
         return '';
     }
     $template = new TwigFrontendTemplate('pagination');
     $template->hasFirst = $this->hasFirst();
     $template->hasPrevious = $this->hasPrevious();
     $template->hasNext = $this->hasNext();
     $template->hasLast = $this->hasLast();
     $template->items = $this->getItems();
     $template->page = $this->intPage;
     $template->total = $this->intTotalPages;
     $template->first = array('page' => 1, 'link' => $this->lblFirst, 'href' => $this->arrLinks[0]);
     $template->previous = array('page' => $this->intPage - 1, 'link' => $this->lblPrevious, 'href' => $this->arrLinks[$this->intPage - 2]);
     $template->next = array('page' => $this->intPage + 1, 'link' => $this->lblNext, 'href' => $this->arrLinks[$this->intPage]);
     $template->last = array('page' => $this->intTotalPages, 'link' => $this->lblLast, 'href' => $this->arrLinks[count($this->arrLinks) - 1]);
     $this->setHeadTags();
     return $template->parse();
 }
コード例 #2
0
 /**
  * Parse the template
  *
  * @return string
  */
 public function generate()
 {
     if ($this->arrData['space'][0] != '') {
         $this->arrStyle[] = 'margin-top:' . $this->arrData['space'][0] . 'px;';
     }
     if ($this->arrData['space'][1] != '') {
         $this->arrStyle[] = 'margin-bottom:' . $this->arrData['space'][1] . 'px;';
     }
     $this->Template = new TwigFrontendTemplate($this->strTemplate);
     $this->Template->setData($this->arrData);
     $this->compile();
     $this->Template->style = !empty($this->arrStyle) ? implode(' ', $this->arrStyle) : '';
     $this->Template->cssID = $this->cssID[0] != '' ? ' id="' . $this->cssID[0] . '"' : '';
     $this->Template->class = trim($this->typePrefix . $this->strKey . ' ' . $this->cssID[1]);
     if ($this->Template->headline == '') {
         $this->Template->headline = $this->headline;
     }
     if ($this->Template->hl == '') {
         $this->Template->hl = $this->hl;
     }
     return $this->Template->parse();
 }