Exemple #1
0
 /**
  * remove boundaries from TYPO3 content
  *
  * @param    string $content : the content with boundaries in comment
  * @return    string        the content without boundaries
  */
 function stripInnerBoundaries($content)
 {
     // only dummy code at the moment
     $searchString = $this->cObj->wrap('[\\d,]*', $this->boundaryStartWrap);
     $content = preg_replace('/' . $searchString . '/', '', $content);
     $content = preg_replace('/' . $this->boundaryEnd . '/', '', $content);
     return $content;
 }
 /**
  * Provides a "show all link" if a certain limit of facet options is
  * reached.
  *
  * (non-PHPdoc)
  * @see Tx_Solr_Facet_AbstractFacetRenderer::getFacetProperties()
  */
 public function getFacetProperties()
 {
     $facet = parent::getFacetProperties();
     if ($facet['count'] > $this->solrConfiguration['search.']['faceting.']['limit']) {
         $showAllLink = '<a href="#" class="tx-solr-facet-show-all">###LLL:faceting_showMore###</a>';
         $showAllLink = tslib_cObj::wrap($showAllLink, $this->solrConfiguration['search.']['faceting.']['showAllLink.']['wrap']);
         $facet['show_all_link'] = $showAllLink;
     }
     return $facet;
 }
 /**
  * render a hidden field
  * They are needed to not forget setted options while search for another word
  *
  * @param integer $filterUid The filter uid
  * @param array $option An array containing the option
  * @return string A HTML formatted hidden input field
  */
 public function renderHiddenField($filterUid, $option)
 {
     $attributes = array();
     $attributes['type'] = 'hidden';
     $attributes['name'] = 'tx_kesearch_pi1[filter][' . $filterUid . '][' . $option['uid'] . ']';
     $attributes['id'] = 'tx_kesearch_pi1_' . $filterUid . '_' . $option['uid'];
     $attributes['value'] = htmlspecialchars($option['tag']);
     foreach ($attributes as $key => $attribut) {
         $attributes[$key] = $key . $this->cObj->wrap($attribut, '="|"');
     }
     return '<input ' . implode(' ', $attributes) . ' />';
 }
 /**
  * generate the link for the given sorting value
  *
  * @param string $field
  * @param string $sortByDir
  * @return string The complete link as A-Tag
  */
 public function generateSortingLink($field, $sortByDir)
 {
     $params = array();
     $params['sortByField'] = $field;
     $params['sortByDir'] = $sortByDir;
     foreach ($params as $key => $value) {
         $params[$key] = $this->cObj->wrap($value, $this->pObj->prefixId . '[' . $key . ']=|');
     }
     $conf = array();
     $conf['parameter'] = $GLOBALS['TSFE']->id;
     $conf['addQueryString'] = '1';
     $conf['addQueryString.']['exclude'] = 'id,tx_kesearch_pi1[multi],cHash';
     $conf['additionalParams'] = '&' . implode('&', $params);
     return $this->cObj->typoLink($this->pObj->pi_getLL('orderlink_' . $field, $field), $conf);
 }
 /**
  * Fills the image markers for the SINGLE view with data. Supports Optionssplit for some parameters
  *
  * @param $lConf
  * @param $imgs
  * @param $imgsCaptions
  * @param $imgsAltTexts
  * @param $imgsTitleTexts
  * @param $imageNum
  * @param $markerArray
  * @return mixed
  */
 function getSingleViewImages($lConf, $imgs, $imgsCaptions, $imgsAltTexts, $imgsTitleTexts, $imageNum, $markerArray)
 {
     $marker = 'NEWS_IMAGE';
     $sViewSplitLConf = array();
     $tmpMarkers = array();
     $iC = count($imgs);
     // remove first img from image array in single view if the TSvar firstImageIsPreview is set
     if ($iC > 1 && $this->config['firstImageIsPreview'] || $iC >= 1 && $this->config['forceFirstImageIsPreview']) {
         array_shift($imgs);
         array_shift($imgsCaptions);
         array_shift($imgsAltTexts);
         array_shift($imgsTitleTexts);
         $iC--;
     }
     if ($iC > $imageNum) {
         $iC = $imageNum;
     }
     // get img array parts for single view pages
     if ($this->piVars[$this->config['singleViewPointerName']]) {
         /**
          * TODO
          * does this work with optionsplit ?
          */
         $spage = $this->piVars[$this->config['singleViewPointerName']];
         $astart = $imageNum * $spage;
         $imgs = array_slice($imgs, $astart, $imageNum);
         $imgsCaptions = array_slice($imgsCaptions, $astart, $imageNum);
         $imgsAltTexts = array_slice($imgsAltTexts, $astart, $imageNum);
         $imgsTitleTexts = array_slice($imgsTitleTexts, $astart, $imageNum);
     }
     $osCount = 0;
     if ($this->conf['enableOptionSplit']) {
         if ($lConf['imageMarkerOptionSplit']) {
             $ostmp = explode('|*|', $lConf['imageMarkerOptionSplit']);
             $osCount = count($ostmp);
         }
         $sViewSplitLConf = $this->processOptionSplit($lConf, $iC);
     }
     // reset markers for optionSplitted images
     for ($m = 1; $m <= $imageNum; $m++) {
         $markerArray['###' . $marker . '_' . $m . '###'] = '';
     }
     $cc = 0;
     $theImgCode = '';
     foreach ($imgs as $val) {
         if ($cc == $imageNum) {
             break;
         }
         if ($val) {
             if (!empty($sViewSplitLConf[$cc])) {
                 $lConf = $sViewSplitLConf[$cc];
             }
             //				if (1) {
             //					$lConf['image.']['imgList.'] = '';
             //					$lConf['image.']['imgList'] = $val;
             //					$lConf['image.']['imgPath'] = 'uploads/pics/';
             //	debug($lConf['image.'], ' ('.__CLASS__.'::'.__FUNCTION__.')', __LINE__, __FILE__, 3);
             //
             //					$imgHtml = $this->local_cObj->IMGTEXT($lConf['image.']);
             //
             //				} else {
             $lConf['image.']['altText'] = $imgsAltTexts[$cc];
             $lConf['image.']['titleText'] = $imgsTitleTexts[$cc];
             $lConf['image.']['file'] = 'uploads/pics/' . $val;
             $imgHtml = $this->local_cObj->IMAGE($lConf['image.']) . $this->local_cObj->stdWrap($imgsCaptions[$cc], $lConf['caption_stdWrap.']);
             //				}
             //debug($imgHtml, '$imgHtml ('.__CLASS__.'::'.__FUNCTION__.')', __LINE__, __FILE__, 3);
             if ($osCount) {
                 if ($iC > 1) {
                     $mName = '###' . $marker . '_' . $lConf['imageMarkerOptionSplit'] . '###';
                 } else {
                     // fall back to the first image marker if only one image has been found
                     $mName = '###' . $marker . '_1###';
                 }
                 $tmpMarkers[$mName]['html'] .= $imgHtml;
                 $tmpMarkers[$mName]['wrap'] = $lConf['imageWrapIfAny'];
             } else {
                 $theImgCode .= $imgHtml;
             }
         }
         $cc++;
     }
     if ($cc) {
         if ($osCount) {
             foreach ($tmpMarkers as $mName => $res) {
                 $markerArray[$mName] = $this->local_cObj->wrap($res['html'], $res['wrap']);
             }
         } else {
             $markerArray['###' . $marker . '###'] = $this->local_cObj->wrap($theImgCode, $lConf['imageWrapIfAny']);
         }
     } else {
         if ($lConf['imageMarkerOptionSplit']) {
             $m = '_1';
         } else {
             $m = '';
         }
         $markerArray['###' . $marker . $m . '###'] = $this->local_cObj->stdWrap($markerArray['###' . $marker . $m . '###'], $lConf['image.']['noImage_stdWrap.']);
     }
     //		debug($sViewSplitLConf, '$sViewSplitLConf ('.__CLASS__.'::'.__FUNCTION__.')', __LINE__, __FILE__, 2);
     return $markerArray;
 }
    /**
     * Generates the "edit panels" which can be shown for a page or records on a page when the Admin Panel is enabled for a backend users surfing the frontend.
     * With the "edit panel" the user will see buttons with links to editing, moving, hiding, deleting the element
     * This function is used for the cObject EDITPANEL and the stdWrap property ".editPanel"
     *
     * @param	string		A content string containing the content related to the edit panel. For cObject "EDITPANEL" this is empty but not so for the stdWrap property. The edit panel is appended to this string and returned.
     * @param	array		TypoScript configuration properties for the editPanel
     * @param	string		The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW"
     * @param	array		Alternative data array to use. Default is $this->data
     * @return	string		The input content string with the editPanel appended. This function returns only an edit panel appended to the content string if a backend user is logged in (and has the correct permissions). Otherwise the content string is directly returned.
     * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=375&cHash=7d8915d508
     */
    public function editPanel($content, array $conf, $currentRecord = '', array $dataArr = array(), $table = '', $allow = '', $newUID = 0, array $hiddenFields = array())
    {
        // Special content is about to be shown, so the cache must be disabled.
        $GLOBALS['TSFE']->set_no_cache();
        $formName = 'TSFE_EDIT_FORM_' . substr($GLOBALS['TSFE']->uniqueHash(), 0, 4);
        $formTag = '<form name="' . $formName . '" id ="' . $formName . '" action="' . htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" onsubmit="return TBE_EDITOR.checkSubmit(1);" style="margin: 0 0 0 0;">';
        $sortField = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
        $labelField = $GLOBALS['TCA'][$table]['ctrl']['label'];
        $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
        $blackLine = $conf['line'] ? '<img src="clear.gif" width="1" height="' . intval($conf['line']) . '" alt="" title="" /><br /><table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="black" style="border: 0px;" summary=""><tr style="border: 0px;"><td style="border: 0px;"><img src="clear.gif" width="1" height="1" alt="" title="" /></td></tr></table><br />' : '';
        $theCmd = '';
        $TSFE_EDIT = $GLOBALS['BE_USER']->frontendEdit->TSFE_EDIT;
        if (is_array($TSFE_EDIT) && $TSFE_EDIT['record'] == $currentRecord && !$TSFE_EDIT['update_close']) {
            $theCmd = $TSFE_EDIT['cmd'];
        }
        switch ($theCmd) {
            case 'edit':
            case 'new':
                $finalOut = $this->editContent($formTag, $formName, $theCmd, $newUID, $dataArr, $table, $currentRecord, $blackLine);
                break;
            default:
                $panel = '';
                if (isset($allow['toolbar']) && $GLOBALS['BE_USER']->adminPanel instanceof tslib_AdminPanel) {
                    $panel .= $GLOBALS['BE_USER']->adminPanel->ext_makeToolBar() . '<img src="clear.gif" width="2" height="1" alt="" title="" />';
                }
                if (isset($allow['edit'])) {
                    $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/edit2.gif" width="11" height="12" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_editRecord') . '" align="top" alt="" />', $formName, 'edit', $dataArr['_LOCALIZED_UID'] ? $table . ':' . $dataArr['_LOCALIZED_UID'] : $currentRecord);
                }
                // Hiding in workspaces because implementation is incomplete
                if (isset($allow['move']) && $sortField && $GLOBALS['BE_USER']->workspace === 0) {
                    $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/button_up.gif" width="11" height="10" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_moveUp') . '" align="top" alt="" />', $formName, 'up');
                    $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/button_down.gif" width="11" height="10" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_moveDown') . '" align="top" alt="" />', $formName, 'down');
                }
                // Hiding in workspaces because implementation is incomplete, Hiding for localizations because it is unknown what should be the function in that case
                if (isset($allow['hide']) && $hideField && $GLOBALS['BE_USER']->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
                    if ($dataArr[$hideField]) {
                        $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/button_unhide.gif" width="11" height="10" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_unhide') . '" align="top" alt="" />', $formName, 'unhide');
                    } else {
                        $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/button_hide.gif" width="11" height="10" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_hide') . '" align="top" alt="" />', $formName, 'hide', '', $GLOBALS['BE_USER']->extGetLL('p_hideConfirm'));
                    }
                }
                if (isset($allow['new'])) {
                    if ($table == 'pages') {
                        $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/new_page.gif" width="13" height="12" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_newSubpage') . '" align="top" alt="" />', $formName, 'new', $currentRecord, '', $nPid);
                    } else {
                        $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/new_record.gif" width="16" height="12" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_newRecordAfter') . '" align="top" alt="" />', $formName, 'new', $currentRecord, '', $nPid);
                    }
                }
                // Hiding in workspaces because implementation is incomplete, Hiding for localizations because it is unknown what should be the function in that case
                if (isset($allow['delete']) && $GLOBALS['BE_USER']->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
                    $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/delete_record.gif" width="12" height="12" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_delete') . '" align="top" alt="" />', $formName, 'delete', '', $GLOBALS['BE_USER']->extGetLL('p_deleteConfirm'));
                }
                //	Final
                $labelTxt = $this->cObj->stdWrap($conf['label'], $conf['label.']);
                foreach ((array) $hiddenFields as $name => $value) {
                    $hiddenFieldString .= '<input type="hidden" name="TSFE_EDIT[' . $name . ']" value="' . $value . '"/>' . LF;
                }
                $panel = '

							<!-- BE_USER Edit Panel: -->
							' . $formTag . $hiddenFieldString . '
								<input type="hidden" name="TSFE_EDIT[cmd]" value="" />
								<input type="hidden" name="TSFE_EDIT[record]" value="' . $currentRecord . '" />
								<table border="0" cellpadding="0" cellspacing="0" class="typo3-editPanel" summary="">
									<tr>
										<td nowrap="nowrap" bgcolor="#ABBBB4" class="typo3-editPanel-controls">' . $panel . '</td>' . ($labelTxt ? '<td nowrap="nowrap" bgcolor="#F6F2E6" class="typo3-editPanel-label"><font face="verdana" size="1" color="black">&nbsp;' . sprintf($labelTxt, htmlspecialchars(t3lib_div::fixed_lgd_cs($dataArr[$labelField], 50))) . '&nbsp;</font></td>' : '') . '
									</tr>
								</table>
							</form>';
                // wrap the panel
                if ($conf['innerWrap']) {
                    $panel = $this->cObj->wrap($panel, $conf['innerWrap']);
                }
                if ($conf['innerWrap.']) {
                    $panel = $this->cObj->stdWrap($panel, $conf['innerWrap.']);
                }
                // add black line:
                $panel .= $blackLine;
                // wrap the complete panel
                if ($conf['outerWrap']) {
                    $panel = $this->cObj->wrap($panel, $conf['outerWrap']);
                }
                if ($conf['outerWrap.']) {
                    $panel = $this->cObj->stdWrap($panel, $conf['outerWrap.']);
                }
                if ($conf['printBeforeContent']) {
                    $finalOut = $panel . $content;
                } else {
                    $finalOut = $content . $panel;
                }
                break;
        }
        if ($conf['previewBorder']) {
            if (!is_array($conf['previewBorder.'])) {
                $conf['previewBorder.'] = array();
            }
            $finalOut = $this->editPanelPreviewBorder($table, $dataArr, $finalOut, $conf['previewBorder'], $conf['previewBorder.']);
        }
        return $finalOut;
    }
    /**
     * Returns a results browser. This means a bar of page numbers plus a "previous" and "next" link. For each entry in the bar the piVars "pointer" will be pointing to the "result page" to show.
     * Using $this->piVars['pointer'] as pointer to the page to display. Can be overwritten with another string ($pointerName) to make it possible to have more than one pagebrowser on a page)
     * Using $this->internal['res_count'], $this->internal['results_at_a_time'] and $this->internal['maxPages'] for count number, how many results to show and the max number of pages to include in the browse bar.
     * Using $this->internal['dontLinkActivePage'] as switch if the active (current) page should be displayed as pure text or as a link to itself
     * Using $this->internal['showFirstLast'] as switch if the two links named "<< First" and "LAST >>" will be shown and point to the first or last page.
     * Using $this->internal['pagefloat']: this defines were the current page is shown in the list of pages in the Pagebrowser. If this var is an integer it will be interpreted as position in the list of pages. If its value is the keyword "center" the current page will be shown in the middle of the pagelist.
     * Using $this->internal['showRange']: this var switches the display of the pagelinks from pagenumbers to ranges f.e.: 1-5 6-10 11-15... instead of 1 2 3...
     * Using $this->pi_isOnlyFields: this holds a comma-separated list of fieldnames which - if they are among the GETvars - will not disable caching for the page with pagebrowser.
     *
     * The third parameter is an array with several wraps for the parts of the pagebrowser. The following elements will be recognized:
     * disabledLinkWrap, inactiveLinkWrap, activeLinkWrap, browseLinksWrap, showResultsWrap, showResultsNumbersWrap, browseBoxWrap.
     *
     * If $wrapArr['showResultsNumbersWrap'] is set, the formatting string is expected to hold template markers (###FROM###, ###TO###, ###OUT_OF###, ###FROM_TO###, ###CURRENT_PAGE###, ###TOTAL_PAGES###)
     * otherwise the formatting string is expected to hold sprintf-markers (%s) for from, to, outof (in that sequence)
     *
     * @param	integer		determines how the results of the pagerowser will be shown. See description below
     * @param	string		Attributes for the table tag which is wrapped around the table cells containing the browse links
     * @param	array		Array with elements to overwrite the default $wrapper-array.
     * @param	string		varname for the pointer.
     * @param	boolean		enable htmlspecialchars() for the pi_getLL function (set this to FALSE if you want f.e use images instead of text for links like 'previous' and 'next').
     * @param   boolean     forces the output of the page browser if you set this option to "true" (otherwise it's only drawn if enough entries are available)
     * @return	string		Output HTML-Table, wrapped in <div>-tags with a class attribute (if $wrapArr is not passed,
     */
    function pi_list_browseresults($showResultCount = 1, $tableParams = '', $wrapArr = array(), $pointerName = 'pointer', $hscText = TRUE, $forceOutput = FALSE)
    {
        // example $wrapArr-array how it could be traversed from an extension
        /* $wrapArr = array(
        			'browseBoxWrap' => '<div class="browseBoxWrap">|</div>',
        			'showResultsWrap' => '<div class="showResultsWrap">|</div>',
        			'browseLinksWrap' => '<div class="browseLinksWrap">|</div>',
        			'showResultsNumbersWrap' => '<span class="showResultsNumbersWrap">|</span>',
        			'disabledLinkWrap' => '<span class="disabledLinkWrap">|</span>',
        			'inactiveLinkWrap' => '<span class="inactiveLinkWrap">|</span>',
        			'activeLinkWrap' => '<span class="activeLinkWrap">|</span>'
        		); */
        // Initializing variables:
        $pointer = intval($this->piVars[$pointerName]);
        $count = intval($this->internal['res_count']);
        $results_at_a_time = t3lib_div::intInRange($this->internal['results_at_a_time'], 1, 1000);
        $totalPages = ceil($count / $results_at_a_time);
        $maxPages = t3lib_div::intInRange($this->internal['maxPages'], 1, 100);
        $pi_isOnlyFields = $this->pi_isOnlyFields($this->pi_isOnlyFields);
        if (!$forceOutput && $count <= $results_at_a_time) {
            return '';
        }
        // $showResultCount determines how the results of the pagerowser will be shown.
        // If set to 0: only the result-browser will be shown
        //	 		 1: (default) the text "Displaying results..." and the result-browser will be shown.
        //	 		 2: only the text "Displaying results..." will be shown
        $showResultCount = intval($showResultCount);
        // if this is set, two links named "<< First" and "LAST >>" will be shown and point to the very first or last page.
        $showFirstLast = $this->internal['showFirstLast'];
        // if this has a value the "previous" button is always visible (will be forced if "showFirstLast" is set)
        $alwaysPrev = $showFirstLast ? 1 : $this->pi_alwaysPrev;
        if (isset($this->internal['pagefloat'])) {
            if (strtoupper($this->internal['pagefloat']) == 'CENTER') {
                $pagefloat = ceil(($maxPages - 1) / 2);
            } else {
                // pagefloat set as integer. 0 = left, value >= $this->internal['maxPages'] = right
                $pagefloat = t3lib_div::intInRange($this->internal['pagefloat'], -1, $maxPages - 1);
            }
        } else {
            $pagefloat = -1;
            // pagefloat disabled
        }
        // default values for "traditional" wrapping with a table. Can be overwritten by vars from $wrapArr
        $wrapper['disabledLinkWrap'] = '<td nowrap="nowrap"><p>|</p></td>';
        $wrapper['inactiveLinkWrap'] = '<td nowrap="nowrap"><p>|</p></td>';
        $wrapper['activeLinkWrap'] = '<td' . $this->pi_classParam('browsebox-SCell') . ' nowrap="nowrap"><p>|</p></td>';
        $wrapper['browseLinksWrap'] = trim('<table ' . $tableParams) . '><tr>|</tr></table>';
        $wrapper['showResultsWrap'] = '<p>|</p>';
        $wrapper['browseBoxWrap'] = '
		<!--
			List browsing box:
		-->
		<div ' . $this->pi_classParam('browsebox') . '>
			|
		</div>';
        // now overwrite all entries in $wrapper which are also in $wrapArr
        $wrapper = array_merge($wrapper, $wrapArr);
        if ($showResultCount != 2) {
            //show pagebrowser
            if ($pagefloat > -1) {
                $lastPage = min($totalPages, max($pointer + 1 + $pagefloat, $maxPages));
                $firstPage = max(0, $lastPage - $maxPages);
            } else {
                $firstPage = 0;
                $lastPage = t3lib_div::intInRange($totalPages, 1, $maxPages);
            }
            $links = array();
            // Make browse-table/links:
            if ($showFirstLast) {
                // Link to first page
                if ($pointer > 0) {
                    $links[] = $this->cObj->wrap($this->pi_linkTP_keepPIvars($this->pi_getLL('pi_list_browseresults_first', '<< First', $hscText), array($pointerName => null), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']);
                } else {
                    $links[] = $this->cObj->wrap($this->pi_getLL('pi_list_browseresults_first', '<< First', $hscText), $wrapper['disabledLinkWrap']);
                }
            }
            if ($alwaysPrev >= 0) {
                // Link to previous page
                if ($pointer > 0) {
                    $links[] = $this->cObj->wrap($this->pi_linkTP_keepPIvars($this->pi_getLL('pi_list_browseresults_prev', '< Previous', $hscText), array($pointerName => $pointer - 1 ? $pointer - 1 : ''), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']);
                } elseif ($alwaysPrev) {
                    $links[] = $this->cObj->wrap($this->pi_getLL('pi_list_browseresults_prev', '< Previous', $hscText), $wrapper['disabledLinkWrap']);
                }
            }
            for ($a = $firstPage; $a < $lastPage; $a++) {
                // Links to pages
                if ($this->internal['showRange']) {
                    $pageText = $a * $results_at_a_time + 1 . '-' . min($count, ($a + 1) * $results_at_a_time);
                } else {
                    $pageText = trim($this->pi_getLL('pi_list_browseresults_page', 'Page', $hscText) . ' ' . ($a + 1));
                }
                if ($pointer == $a) {
                    // current page
                    if ($this->internal['dontLinkActivePage']) {
                        $links[] = $this->cObj->wrap($pageText, $wrapper['activeLinkWrap']);
                    } else {
                        $links[] = $this->cObj->wrap($this->pi_linkTP_keepPIvars($pageText, array($pointerName => $a ? $a : ''), $pi_isOnlyFields), $wrapper['activeLinkWrap']);
                    }
                } else {
                    $links[] = $this->cObj->wrap($this->pi_linkTP_keepPIvars($pageText, array($pointerName => $a ? $a : ''), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']);
                }
            }
            if ($pointer < $totalPages - 1 || $showFirstLast) {
                if ($pointer >= $totalPages - 1) {
                    // Link to next page
                    $links[] = $this->cObj->wrap($this->pi_getLL('pi_list_browseresults_next', 'Next >', $hscText), $wrapper['disabledLinkWrap']);
                } else {
                    $links[] = $this->cObj->wrap($this->pi_linkTP_keepPIvars($this->pi_getLL('pi_list_browseresults_next', 'Next >', $hscText), array($pointerName => $pointer + 1), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']);
                }
            }
            if ($showFirstLast) {
                // Link to last page
                if ($pointer < $totalPages - 1) {
                    $links[] = $this->cObj->wrap($this->pi_linkTP_keepPIvars($this->pi_getLL('pi_list_browseresults_last', 'Last >>', $hscText), array($pointerName => $totalPages - 1), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']);
                } else {
                    $links[] = $this->cObj->wrap($this->pi_getLL('pi_list_browseresults_last', 'Last >>', $hscText), $wrapper['disabledLinkWrap']);
                }
            }
            $theLinks = $this->cObj->wrap(implode(LF, $links), $wrapper['browseLinksWrap']);
        } else {
            $theLinks = '';
        }
        $pR1 = $pointer * $results_at_a_time + 1;
        $pR2 = $pointer * $results_at_a_time + $results_at_a_time;
        if ($showResultCount) {
            if ($wrapper['showResultsNumbersWrap']) {
                // this will render the resultcount in a more flexible way using markers (new in TYPO3 3.8.0).
                // the formatting string is expected to hold template markers (see function header). Example: 'Displaying results ###FROM### to ###TO### out of ###OUT_OF###'
                $markerArray['###FROM###'] = $this->cObj->wrap($this->internal['res_count'] > 0 ? $pR1 : 0, $wrapper['showResultsNumbersWrap']);
                $markerArray['###TO###'] = $this->cObj->wrap(min($this->internal['res_count'], $pR2), $wrapper['showResultsNumbersWrap']);
                $markerArray['###OUT_OF###'] = $this->cObj->wrap($this->internal['res_count'], $wrapper['showResultsNumbersWrap']);
                $markerArray['###FROM_TO###'] = $this->cObj->wrap(($this->internal['res_count'] > 0 ? $pR1 : 0) . ' ' . $this->pi_getLL('pi_list_browseresults_to', 'to') . ' ' . min($this->internal['res_count'], $pR2), $wrapper['showResultsNumbersWrap']);
                $markerArray['###CURRENT_PAGE###'] = $this->cObj->wrap($pointer + 1, $wrapper['showResultsNumbersWrap']);
                $markerArray['###TOTAL_PAGES###'] = $this->cObj->wrap($totalPages, $wrapper['showResultsNumbersWrap']);
                // substitute markers
                $resultCountMsg = $this->cObj->substituteMarkerArray($this->pi_getLL('pi_list_browseresults_displays', 'Displaying results ###FROM### to ###TO### out of ###OUT_OF###'), $markerArray);
            } else {
                // render the resultcount in the "traditional" way using sprintf
                $resultCountMsg = sprintf(str_replace('###SPAN_BEGIN###', '<span' . $this->pi_classParam('browsebox-strong') . '>', $this->pi_getLL('pi_list_browseresults_displays', 'Displaying results ###SPAN_BEGIN###%s to %s</span> out of ###SPAN_BEGIN###%s</span>')), $count > 0 ? $pR1 : 0, min($count, $pR2), $count);
            }
            $resultCountMsg = $this->cObj->wrap($resultCountMsg, $wrapper['showResultsWrap']);
        } else {
            $resultCountMsg = '';
        }
        $sTables = $this->cObj->wrap($resultCountMsg . $theLinks, $wrapper['browseBoxWrap']);
        return $sTables;
    }
 /**
  * Renders the complete facet.
  *
  * @return	string	Facet markup.
  */
 public function renderFacet()
 {
     $facetContent = '';
     $showEmptyFacets = $this->solrConfiguration['search.']['faceting.']['showEmptyFacets'];
     // don't render the given facet if it doesn't have any options and
     // rendering of empty facets is disabled
     if ($showEmptyFacets != '0' || !$this->isEmpty()) {
         $facetTemplate = clone $this->template;
         $facetTemplate->workOnSubpart('single_facet');
         $facetOptions = $this->renderFacetOptions();
         $facetTemplate->addSubpart('single_facet_option', $facetOptions);
         $facet = $this->facetConfiguration;
         $facet['name'] = $this->facetName;
         $facet['count'] = $this->getFacetOptionsCount();
         if ($facet['count'] > $this->solrConfiguration['search.']['faceting.']['limit']) {
             $showAllLink = '<a href="#" class="tx-solr-facet-show-all">###LLL:faceting_showMore###</a>';
             $showAllLink = tslib_cObj::wrap($showAllLink, $this->solrConfiguration['search.']['faceting.']['showAllLink.']['wrap']);
             $facet['show_all_link'] = $showAllLink;
         }
         $facetTemplate->addVariable('facet', $facet);
         $facetContent = $facetTemplate->render();
     }
     return $facetContent;
 }