FORMidable RAD Framework

class.tx_rdtlister.php

00001 <?php
00009 class tx_rdtlister extends formidable_mainrenderlet {
00010 
00011         var $oDataStream = FALSE;
00012         var $sDsType = FALSE;
00013         var $aOColumns = FALSE;
00014         var $aPager = FALSE;
00015         var $aLimitAndSort = FALSE;
00016         var $bDefaultTemplate = FALSE;
00017         var $bNoTemplate = FALSE;
00018         var $bResetPager = FALSE;
00019 
00020         function _render() {
00021 
00022                 $this->_initDataStream();
00023                 $this->_initColumns();
00024                 $this->aLimitAndSort = FALSE;
00025                 $this->_initLimitAndSort();
00026 
00027                 $aData = $this->_fetchData(
00028                         $aConfig = array(
00029                                 "page" => ($this->aLimitAndSort["curpage"] - 1),
00030                                 "perpage" => $this->aLimitAndSort["rowsperpage"],
00031                                 "sortcolumn" => $this->aLimitAndSort["sortby"],
00032                                 "sortdirection" => $this->aLimitAndSort["sortdir"],
00033                         )
00034                 );
00035 
00036                 if(intval($aData["numrows"]) === 0) {
00037                         if(($mEmpty = $this->_navConf("/ifempty")) !== FALSE) {
00038                                 if(is_array($mEmpty)) {
00039                                         if($this->oForm->_defaultTrue("/process", $mEmpty) === FALSE) {
00040                                                 return array(
00041                                                         "__compiled" => "",
00042                                                         "pager." => array(
00043                                                                 "numrows" => 0,
00044                                                         )
00045                                                 );
00046                                         }
00047 
00048                                         if($this->oForm->_navConf("/message", $mEmpty) !== FALSE) {
00049                                                 if($this->oForm->isUserObj($mEmpty["message"])) {
00050                                                         $sMessage = $this->oForm->_callUserObj($mEmpty["message"]);
00051                                                 } else {
00052                                                         $sMessage = $mEmpty["message"];
00053                                                 }
00054 
00055                                                 return array(
00056                                                         "__compiled" => $this->oForm->_getLLLabel($sMessage),
00057                                                         "pager." => array(
00058                                                                 "numrows" => 0,
00059                                                         )
00060                                                 );
00061                                         }
00062                                 } else {
00063                                         return array(
00064                                                 "__compiled" => $this->oForm->_getLLLabel($mEmpty),
00065                                                 "pager." => array(
00066                                                         "numrows" => 0,
00067                                                 )
00068                                         );
00069                                 }
00070                         }
00071                 }
00072 
00073                 $this->_initPager($aData["numrows"]);
00074 
00075                 $aHtmlBag = array(
00076                         "__compiled" => $this->_wrapIntoContainer($this->_renderList($aData)),
00077                         "pager." => array(
00078                                 "display" => ($this->aPager["display"] === TRUE) ? "1" : "0",
00079                                 "page" => $this->aPager["page"],
00080                                 "pagemax" => $this->aPager["pagemax"],
00081                                 "offset" => $this->aPager["offset"],
00082                                 "numrows" => $this->aPager["numrows"],
00083                                 "links." => array(
00084                                         "first" => $this->aPager["links"]["first"],
00085                                         "prev" => $this->aPager["links"]["prev"],
00086                                         "next" => $this->aPager["links"]["next"],
00087                                         "last" => $this->aPager["links"]["last"],
00088                                 ),
00089                                 "rowsperpage" => $this->aLimitAndSort["rowsperpage"],
00090                                 "limitoffset" => $this->aLimitAndSort["limitoffset"],
00091                                 "limitdisplayed" => $this->aLimitAndSort["limitdisplayed"],
00092                                 "sortby" => $this->aLimitAndSort["sortby"],
00093                                 "sortdir" => $this->aLimitAndSort["sortdir"],
00094                         ),
00095                 );
00096 
00097                 //debug(array($aHtmlBag["__compiled"]), "iciii");
00098                 return $aHtmlBag;
00099         }
00100 
00101         function _wrapIntoContainer($sHtml) {
00102                 if($this->bDefaultTemplate === TRUE) {
00103                         return "<div id=\"" . $this->_getElementHtmlId() . "\" class=\"ameosformidable-rdtlister-defaultwrap\">" . $sHtml . "</div>";
00104                 } elseif($this->bNoTemplate === TRUE) {
00105                         return $sHtml;
00106                 } else {
00107                         return "<div id=\"" . $this->_getElementHtmlId() . "\">" . $sHtml . "</div>";
00108                 }
00109         }
00110 
00111         function _initDataStream() {
00112                 
00113                 if($this->oDataStream === FALSE) {
00114 
00115                         if(($sDsToUse = $this->_navConf("/searchform/use")) === FALSE) {
00116                                 if(($sDsToUse = $this->_navConf("/datasource/use")) === FALSE) {
00117                                         $this->oForm->mayday("RENDERLET LISTER <b>" . $this->_getName() . "</b> - requires <b>/datasource/use</b> OR <b>/searchform/use</b> to be properly set. Check your XML conf.");
00118                                 } else {
00119                                         if(!array_key_exists($sDsToUse, $this->oForm->aODataSources)) {
00120                                                 $this->oForm->mayday("RENDERLET LISTER <b>" . $this->_getName() . "</b> - refers to undefined datasource '" . $sDsToUse . "'. Check your XML conf.");
00121                                         } else {
00122                                                 $this->oDataStream =& $this->oForm->aODataSources[$sDsToUse];
00123                                                 $this->sDsType = "datasource";
00124                                         }
00125                                 }
00126                         } else {
00127                                 if(!array_key_exists($sDsToUse, $this->oForm->aORenderlets)) {
00128                                         $this->oForm->mayday("RENDERLET LISTER - refers to undefined searchform '" . $sDsToUse . "'. Check your XML conf.");
00129                                 } elseif(($sDsType = $this->oForm->aORenderlets[$sDsToUse]->_getType()) !== "SEARCHFORM") {
00130                                         $this->oForm->mayday("RENDERLET LISTER - defined searchform <b>'" . $sDsToUse . "'</b> is not of <b>SEARCHFORM</b> type, but of <b>" . $sDsType . "</b> type");
00131                                 } else {
00132                                         $this->oDataStream =& $this->oForm->aORenderlets[$sDsToUse];
00133                                         $this->sDsType = "searchform";
00134                                         if($this->oDataStream->shouldUpdateCriterias()) {
00135                                                 $this->bResetPager = TRUE;
00136                                         }
00137                                 }
00138                         }
00139                 }
00140         }
00141 
00142         function _initLimitAndSort() {
00143 
00144                 if($this->aLimitAndSort === FALSE) {
00145                         $iCurPage = $this->_getPage();
00146                         $iRowsPerPage = 5;      // default value
00147 
00148                         if(($mRowsPerPage = $this->_navConf("/pager/rows/perpage")) !== FALSE) {
00149                                 if($this->oForm->isUserObj($mRowsPerPage)) {
00150                                         $mRowsPerPage = $this->oForm->_callUserObj($mRowsPerPage);
00151                                 }
00152                                 
00153                                 if(intval($mRowsPerPage) > 0) {
00154                                         $iRowsPerPage = $mRowsPerPage;
00155                                 } elseif(intval($mRowsPerPage) === -1) {
00156                                         $iRowsPerPage = 1000000;
00157                                 }
00158                         }
00159 
00160                         $aSort = $this->_getSortColAndDirection();
00161 
00162                         $this->aLimitAndSort = array(
00163                                 "curpage" => $iCurPage,
00164                                 "rowsperpage" => $iRowsPerPage,
00165                                 "limitoffset" => ($iCurPage - 1) * $iRowsPerPage,
00166                                 "limitdisplayed" => $iRowsPerPage,
00167                                 "sortby" => $aSort["col"],
00168                                 "sortdir" => $aSort["dir"],
00169                         );
00170                 }
00171         }
00172 
00173         function _initPager($iNumRows) {
00174 
00175                 $iPageMax = (ceil($iNumRows/ $this->aLimitAndSort["rowsperpage"]));
00176                 
00177                 if($iPageMax > 1 || $this->_defaultFalse("/pager/alwaysdisplay")) {
00178                         $bDisplay = TRUE;
00179                 } else {
00180                         $bDisplay = FALSE;
00181                 }
00182 
00183                 // generating javascript links & functions
00184 
00185                 $sLinkFirst = $sLinkPrev = $sLinkNext = $sLinkLast = "";
00186 
00187                 if($iPageMax >= 1) {
00188 
00189                         if($this->aLimitAndSort["curpage"] > 1) {
00190 
00191                                 $sLinkFirst = $this->_buildLink(array(
00192                                         "page" => 1
00193                                 ));
00194 
00195                                 $sLinkPrev = $this->_buildLink(array(
00196                                         "page" => $this->aLimitAndSort["curpage"] - 1
00197                                 ));
00198 
00199                         }
00200                         
00201                         // print 'next' link only if we're not
00202                         // on the last page
00203                         
00204                         if($this->aLimitAndSort["curpage"] < $iPageMax) {
00205 
00206                                 $sLinkNext = $this->_buildLink(array(
00207                                         "page" => ($this->aLimitAndSort["curpage"] + 1)
00208                                 ));
00209 
00210                                 $sLinkLast = $this->_buildLink(array(
00211                                         "page" => $iPageMax
00212                                 ));
00213                         }
00214                 }
00215 
00216                 $iPage = ($iPageMax == 0) ? 0 : $this->aLimitAndSort["curpage"];
00217                 $aWindow = array();
00218 
00219                 if(($iWindow = $this->_navConf("/pager/window")) !== FALSE && $iNumRows > 0) {
00220 
00221                         // on génère une fenetre de liens de navigation
00222                         // generating something like < 24 25 *26* 27 28 >
00223 
00224                         /*
00225                                 window pager patch by Manuel Rego Casasnovas
00226                                 @see http://lists.netfielders.de/pipermail/typo3-project-formidable/2008-January/000816.html
00227                         */
00228 
00229                         #$iStart = $iPage - 3;
00230                         #$iStart = $iPage - $iWindow;
00231                         #if($iStart < 0) {
00232                         #       $iStart = 0;
00233                         #}
00234 
00235                         $iStart = $iPage - ($iWindow - 1);
00236                         if($iStart < 1) {
00237                                 $iStart = 1;
00238                         }
00239                         
00240                         if($iStart == 1) {
00241                                 $sLinkFirst = "";
00242                         }
00243                         
00244                         #$iEnd = $iPage + 1;
00245                         #$iEnd = $iPage + ($iWindow - 2);
00246                         $iEnd = $iPage + ($iWindow - 1);
00247 
00248                         if($iEnd > $iPageMax) {
00249                                 $iEnd = $iPageMax;
00250                         }
00251 
00252                         if($iEnd == $iPageMax) {
00253                                 $sLinkLast = "";
00254                         }
00255 
00256                         for($k = $iStart; $k <= $iEnd; $k++) {
00257                                 $aWindow[$k] = $this->_buildLink(array(
00258                                         "page" => $k
00259                                 ));
00260                         }
00261 
00262                         //debug($aWindow);
00263                 }
00264 
00265                 $this->aPager = array(
00266                         "display"       =>      $bDisplay,
00267                         "numrows"       =>      $iNumRows,
00268                         "offset"        =>      $this->aLimitAndSort["limitoffset"],
00269                         "page"          =>      $iPage,
00270                         "pagemax"       =>      $iPageMax,
00271                         "links"         =>      array(
00272                                 "first"         =>      $sLinkFirst,
00273                                 "prev"          =>      $sLinkPrev,
00274                                 "next"          =>      $sLinkNext,
00275                                 "last"          =>      $sLinkLast,
00276                         ),
00277                         "window"        =>      $aWindow,
00278                 );
00279         }
00280 
00281         function _buildLink($aParams) {
00282 
00283                 $aRdtParams = array(
00284                         $this->oForm->formid => array(
00285                                 $this->_getElementHtmlId() => $aParams
00286                         )
00287                 );
00288 
00289                 $sEnvMode = $this->oForm->__getEnvExecMode();
00290                 if($sEnvMode === "BE") {
00291                         $sBaseUrl = t3lib_div::getIndpEnv("TYPO3_REQUEST_URL");
00292                         $aQueryParts = parse_url($sBaseUrl);
00293                         $aParams = array();
00294                         if($aQueryParts['query']) {
00295                                 parse_str($aQueryParts['query'], $aParams);
00296                         }
00297                 } elseif($sEnvMode === "EID") {
00298                         $sBaseUrl = t3lib_div::getIndpEnv("HTTP_REFERER");
00299                         $aQueryParts = parse_url($sBaseUrl);
00300                         $aParams = array();
00301                         if($aQueryParts['query']) {
00302                                 parse_str($aQueryParts['query'], $aParams);
00303                         }
00304                 } elseif($sEnvMode === "FE") {
00305                         $aParams = t3lib_div::_GET();
00306                 }
00307 
00308 
00309                 $aFullParams = t3lib_div::array_merge_recursive_overrule(
00310                         $aParams,
00311                         $aRdtParams
00312                 );
00313 
00314                 if(array_key_exists("cHash", $aFullParams)) {
00315                         unset($aFullParams["cHash"]);
00316                 }
00317 
00318                 if($this->oForm->_defaultFalse("/cachehash", $this->aElement) === TRUE) {
00319                         $aFullParams["cHash"] = t3lib_div::shortMD5(
00320                                 serialize(
00321                                         t3lib_div::cHashParams(
00322                                                 t3lib_div::implodeArrayForUrl('',$aFullParams)
00323                                         )
00324                                 )
00325                         );
00326                 }
00327 
00328                 //debug($aFullParams, $sBaseUrl);
00329 
00330                 if($sEnvMode === "BE" || $sEnvMode === "EID") {
00331                         return $this->oForm->xhtmlUrl(
00332                                 t3lib_div::linkThisUrl(
00333                                         $sBaseUrl,
00334                                         $aFullParams
00335                                 )
00336                         );
00337                 } elseif($sEnvMode === "FE") {
00338                         return $this->oForm->cObj->typolink_URL(array(
00339                                 "parameter" => $GLOBALS["TSFE"]->id,
00340                                 "additionalParams" => t3lib_div::implodeArrayForUrl(
00341                                         "",
00342                                         $aFullParams
00343                                 )
00344                         ));
00345                 }
00346         }
00347 
00348         function &_fetchData($aConfig = FALSE) {
00349                 if($aConfig === FALSE) {
00350                         $this->_initDataStream();
00351                         $this->_initColumns();
00352                         $this->aLimitAndSort = FALSE;
00353                         $this->_initLimitAndSort();
00354 
00355                         return $this->_fetchData(
00356                                 $aConfig = array(
00357                                         "page" => ($this->aLimitAndSort["curpage"] - 1),
00358                                         "perpage" => $this->aLimitAndSort["rowsperpage"],
00359                                         "sortcolumn" => $this->aLimitAndSort["sortby"],
00360                                         "sortdirection" => $this->aLimitAndSort["sortdir"],
00361                                 )
00362                         );
00363                 } else {
00364                         return $this->oDataStream->_fetchData($aConfig);
00365                 }
00366         }
00367 
00368         function &_renderList(&$aRows) {
00369 
00370                 $aTemplate = $this->_getTemplate();
00371 
00372                 $this->_renderList_displayRows($aTemplate, $aRows);
00373                 $this->_renderList_displayPager($aTemplate);
00374                 $this->_renderList_displaySortHeaders($aTemplate);
00375 
00376                 reset($this->aOColumns);
00377                 while(list($sColumn, ) = each($this->aOColumns)) {
00378                         $aTemplate["html"] = str_replace(
00379                                 "{" . $sColumn . ".label}",
00380                                 $this->oForm->_getLLLabel(
00381                                         $this->aOColumns[$sColumn]->_navConf("/label")
00382                                 ),
00383                                 $aTemplate["html"]
00384                         );
00385                 }
00386 
00387                 $aTemplate["html"] = $this->oForm->_substLLLInHtml($aTemplate["html"]);
00388 
00389                 return $aTemplate["html"];
00390         }
00391 
00392         function _renderList_displayRows(&$aTemplate, &$aRows) {
00393                 
00394                 $aRowsHtml = array();
00395                 if($this->bNoTemplate !== TRUE) {
00396                         $aAltRows = array();
00397                         $aRowsHtml = array();
00398                         $sRowsPart = t3lib_parsehtml::getSubpart($aTemplate["html"], "###ROWS###");
00399 
00400                         if($aTemplate["default"] === TRUE) {
00401                                 $sAltList = "###ROW1###, ###ROW2###";
00402                         } elseif(($sAltList = $this->_navconf("/template/alternaterows")) === FALSE) {
00403                                 $this->oForm->mayday("RENDERLET LISTER <b>" . $this->_getName() . "</b> requires /template/alternaterows to be properly set. Please check your XML configuration");
00404                         }
00405 
00406                         $aAltList = t3lib_div::trimExplode(",", $sAltList);
00407                         if(sizeof($aAltList) > 0) {
00408                                 reset($aAltList);
00409                                 while(list(, $sAltSubpart) = each($aAltList)) {
00410                                         $aAltRows[] = t3lib_parsehtml::getSubpart($sRowsPart, $sAltSubpart);
00411                                 }
00412 
00413                                 $iNbAlt = sizeOf($aAltRows);
00414                         }
00415                 }
00416 
00417                 
00418                 $iRowNum = 0;
00419                 //$aBeforeListData = $this->oForm->oDataHandler->__aListData;
00420                 $this->oForm->oDataHandler->__aParentListData = $this->oForm->oDataHandler->__aListData;
00421                 $this->oForm->oDataHandler->__aListData = array();
00422 
00423                 reset($aRows);
00424                 while(list($iIndex, ) = each($aRows["results"])) {
00425 
00426                         $aCurRow = $aRows["results"][$iIndex];
00427                         $this->oForm->oDataHandler->__aListData = $aCurRow;
00428                         $aCurRow = $this->processBeforeRender($aCurRow);
00429                         $aCurRow = $this->_refineRow($aCurRow);
00430                         $aCurRow = $this->processBeforeDisplay($aCurRow);
00431 
00432                         if($this->bNoTemplate === TRUE) {
00433                                 reset($this->aOColumns);
00434                                 while(list($sCol,) = each($this->aOColumns)) {
00435                                         $sRowHtml = $aCurRow[$sCol]["__compiled"];
00436                                 }
00437                         } else {
00438                                 $sRowHtml = $this->oForm->_parseTemplateCode(
00439                                         $aAltRows[$iRowNum++ % $iNbAlt],                // current alternate subpart for row
00440                                         $aCurRow
00441                                 );
00442                         }
00443 
00444                         $aRowsHtml[] = $this->rowWrap($sRowHtml);
00445                 }
00446 
00447                 $this->oForm->oDataHandler->__aListData = $this->oForm->oDataHandler->__aParentListData;
00448                 $this->oForm->oDataHandler->__aParentListData = array();
00449 
00450                 if($this->bNoTemplate === FALSE) {
00451                         if($this->_defaultTrue("/template/allowincompletesequence") === FALSE) {
00452                                 $iNbResultsOnThisPage = count($aRows["results"]);
00453                                 if(($iNbResultsOnThisPage % $iNbAlt) !== 0) {
00454                                         for($k = $iRowNum % $iNbAlt; $k < $iNbAlt; $k++) {
00455 
00456                                                 $aRowsHtml[] = $this->oForm->_parseTemplateCode(
00457                                                         $aAltRows[$k],          // current alternate subpart for row
00458                                                         array(),
00459                                                         array(),
00460                                                         FALSE
00461                                                 );
00462                                         }
00463                                 }
00464                         }
00465 
00466                         $aTemplate["html"] = t3lib_parsehtml::substituteSubpart(
00467                                 $aTemplate["html"],
00468                                 "###ROWS###",
00469                                 implode("", $aRowsHtml),
00470                                 FALSE,
00471                                 FALSE
00472                         );
00473                 } else {
00474                         $aTemplate["html"] = implode($aRowsHtml);
00475                 }
00476         }
00477 
00478         function rowWrap($sHtmlRow) {
00479                 if(($sWrap = $this->_navConf("/columns/wrap")) !== FALSE) {
00480                         if($this->oForm->isUserObj($sWrap)) {
00481                                 $sWrap = $this->oForm->_callUserObj($sWrap);
00482                         }
00483 
00484                         if(is_string($sWrap)) {
00485                                 return str_replace("|", $sHtmlRow, $this->oForm->_substLLLInHtml($sWrap));
00486                         }
00487                 }
00488 
00489                 return $sHtmlRow;
00490         }
00491 
00492         function processBeforeRender($aRow) {
00493                 
00494                 if(($aBeforeRender = $this->_navConf("/beforerender")) !== FALSE && $this->oForm->isUserObj($aBeforeRender)) {
00495                         $aRow = $this->oForm->_callUserObj($aBeforeRender, $aRow);
00496                 }
00497 
00498                 return $aRow;
00499         }
00500 
00501         function processBeforeDisplay($aRow) {
00502                 
00503                 if(($aBeforeDisplay = $this->_navConf("/beforedisplay")) !== FALSE && $this->oForm->isUserObj($aBeforeDisplay)) {
00504                         $aRow = $this->oForm->_callUserObj($aBeforeDisplay, $aRow);
00505                 }
00506 
00507                 return $aRow;
00508         }
00509 
00510         function _renderList_displayPager(&$aTemplate) {
00511                 
00512                 if($this->aPager["display"] === TRUE) {
00513                         $sPager = $aTemplate["pager"];
00514                         $aLinks = array();
00515                         
00516                         $sPager = $this->oForm->_parseTemplateCode(
00517                                 $sPager,
00518                                 array(
00519                                         "page" => $this->aPager["page"],
00520                                         "pagemax" => $this->aPager["pagemax"]
00521                                 ),
00522                                 array(),
00523                                 FALSE
00524                         );
00525                         
00526                         
00527                         reset($this->aPager["links"]);
00528                         while(list($sWhich, $sLink) = each($this->aPager["links"])) {
00529 
00530                                 if($sLink !== "") {
00531                                         $aLinks[$sWhich] = $this->oForm->_parseTemplateCode(
00532                                                 t3lib_parsehtml::getSubpart($sPager, "###LINK" . strtoupper($sWhich) . "###"),
00533                                                 array(
00534                                                         "link" => $sLink
00535                                                 ),
00536                                                 array(),
00537                                                 FALSE
00538                                         );
00539                                 } else {
00540                                         $aLinks[$sWhich] = "";
00541                                 }
00542                         }
00543 
00544                         $sPager = t3lib_parsehtml::substituteSubpart($sPager, "###LINKFIRST###",$aLinks["first"], FALSE, FALSE);
00545                         $sPager = t3lib_parsehtml::substituteSubpart($sPager, "###LINKPREV###", $aLinks["prev"], FALSE, FALSE);
00546                         $sPager = t3lib_parsehtml::substituteSubpart($sPager, "###LINKNEXT###", $aLinks["next"], FALSE, FALSE);
00547                         $sPager = t3lib_parsehtml::substituteSubpart($sPager, "###LINKLAST###", $aLinks["last"], FALSE, FALSE);
00548 
00549                         // generating window
00550                         $sWindow = "";
00551                         if(!empty($this->aPager["window"])) {
00552 
00553                                 #$sWindow = t3lib_parsehtml::getSubpart($sPager, "###WINDOW###");
00554                                 $sWindow = t3lib_parsehtml::getSubpart($aTemplate["pager"], "###WINDOW###");
00555                                 $sLinkNo = t3lib_parsehtml::getSubpart($sWindow, "###NORMAL###");
00556                                 $sLinkAct = t3lib_parsehtml::getSubpart($sWindow, "###ACTIVE###");
00557                                 $sMoreBefore = t3lib_parsehtml::getSubpart($sWindow, "###MORE_BEFORE###");
00558                                 $sMoreAfter = t3lib_parsehtml::getSubpart($sWindow, "###MORE_AFTER###");
00559 
00560                                 $aLinks = array();
00561                                 
00562                                 reset($this->aPager["window"]);
00563                                 if(key($this->aPager["window"]) > 2 && trim($sMoreBefore) !== "") {
00564                                         $aLinks[] = $sMoreBefore;
00565                                 }
00566 
00567                                 reset($this->aPager["window"]);
00568                                 while(list($iPageNum, $sLink) = each($this->aPager["window"])) {
00569                                         
00570                                         #if($aPaging["page"] == $iPageNum) {
00571                                         if($this->aPager["page"] == $iPageNum) {
00572                                                 $aLinks[] = $this->oForm->_parseTemplateCode(
00573                                                         $sLinkAct,
00574                                                         array(
00575                                                                 "link" => $sLink,
00576                                                                 "page" => $iPageNum,
00577                                                         )
00578                                                 );
00579                                         } else {
00580                                                 $aLinks[] = $this->oForm->_parseTemplateCode(
00581                                                         $sLinkNo,
00582                                                         array(
00583                                                                 "link" => $sLink,
00584                                                                 "page" => $iPageNum,
00585                                                         )
00586                                                 );
00587                                         }
00588                                 }
00589                                 
00590                                 end($this->aPager["window"]);
00591                                 if((key($this->aPager["window"]) < ($this->aPager["pagemax"] - 1)) && trim($sMoreAfter) !== "") {
00592                                         $aLinks[] = $sMoreAfter;
00593                                 }
00594                                 
00595                                 $sLinks = implode(" ", $aLinks);
00596                                 
00597                                 $sWindow = t3lib_parsehtml::substituteSubpart($sWindow, "###WINDOWLINKS###", $sLinks, FALSE, FALSE);
00598                         }
00599 
00600                         $sPager = t3lib_parsehtml::substituteSubpart($sPager, "###WINDOW###", $sWindow, FALSE, FALSE);
00601                 } else {
00602                         $sPager = "";
00603                 }
00604 
00605                 $aTemplate["html"] = $this->oForm->_parseTemplateCode(
00606                         $aTemplate["html"],
00607                         array(
00608                                 "PAGER" => $sPager
00609                         ),
00610                         array(),
00611                         FALSE
00612                 );
00613         }
00614         
00615         function _renderList_displaySortHeaders(&$aTemplate) {
00616 
00617                 reset($this->aOColumns);
00618                 while(list($sColumn, ) = each($this->aOColumns)) {
00619 
00620                         $sSubpart = "###SORT_" . $sColumn . "###";
00621                         
00622                         if(($sSortHtml = trim(t3lib_parsehtml::getSubpart($aTemplate["html"], $sSubpart))) != "") {
00623 
00624                                 if($this->aOColumns[$sColumn]->_defaultTrue("/sort") === TRUE) {
00625 
00626                                         $sNewDir = "asc";
00627                                         $sLabelDir = "";
00628                                         $sCssClass = "sort-no";
00629 
00630                                         if(($this->aLimitAndSort["sortby"] === $sColumn)) {
00631                                                 
00632                                                 if($this->aLimitAndSort["sortdir"] === "desc") {
00633                                                         
00634                                                         $sNewDir = "asc";
00635                                                         $sLabelDir = (($this->aTemplate["default"] === TRUE) ? " [Z-a]" : "");
00636                                                         $sCssClass = "sort-act-desc";
00637 
00638                                                 } else {
00639                                                         
00640                                                         $sNewDir = "desc";
00641 
00642                                                         $sLabelDir = (($this->aTemplate["default"] === TRUE) ? " [a-Z]" : "");
00643                                                         $sCssClass = "sort-act-asc";
00644                                                 }
00645                                         }
00646 
00647                                         $sLink = $this->_buildLink(array(
00648                                                 "sort" => $sColumn . "-" . $sNewDir
00649                                         ));
00650 
00651                                         if(($sHeader = $this->aOColumns[$sColumn]->_navConf("/listheader")) === FALSE) {
00652                                                 $sHeader = "{" . $sColName . ".label}";
00653                                         }
00654 
00655                                         $sAccesTitle = "{LLL:EXT:ameos_formidable/api/base/rdt_lister/res/locallang/locallang.xml:sortby} &quot;" . $sHeader . "&quot; {LLL:EXT:ameos_formidable/api/base/rdt_lister/res/locallang/locallang.xml:sort." . $sNewDir . "}";
00656                                         $sTag = "<a href=\"" . $sLink . "\" title=\"" . $sAccesTitle . "\" class=\"" . $sColumn . "_sort " . $sCssClass . "\">" . $sSortHtml . $sLabelDir . "</a>";
00657                                 } else {
00658                                         $sTag = $sSortHtml;
00659                                 }
00660 
00661                                 $aTemplate["html"] = t3lib_parsehtml::substituteSubpart(
00662                                         $aTemplate["html"],
00663                                         $sSubpart,
00664                                         $sTag,
00665                                         FALSE,
00666                                         FALSE
00667                                 );
00668                         }
00669                 }
00670         }
00671         
00672         function &_getTemplate() {
00673 
00674                 $aRes = array(
00675                         "default" => FALSE,
00676                         "html" => "",
00677                         "styles" => "",
00678                         "cssfile" => "",
00679                         "pager" => "",
00680                 );
00681                 
00682                 if((($aTemplate = $this->_navConf("/template")) === FALSE) || (($this->bNoTemplate = $this->_defaultFalse("/template/notemplate")) === TRUE)) {
00683 
00684                         if($this->bNoTemplate === FALSE) {
00685                                 // no template defined, building default lister template
00686                                 $aRes = $this->__buildDefaultTemplate();
00687                                 $this->bDefaultTemplate = TRUE;
00688                                 $this->bNoTemplate = FALSE;
00689                         } else {
00690                                 $aRes = array(
00691                                         "default" => FALSE,
00692                                 );
00693 
00694                                 $this->bDefaultTemplate = FALSE;
00695                                 $this->bNoTemplate = TRUE;
00696                         }
00697                 } else {
00698 
00699                         if(is_array($aTemplate) && array_key_exists("path", $aTemplate)) {
00700                                 if($this->oForm->isUserObj($aTemplate["path"])) { 
00701                                         $aTemplate["path"] = $this->oForm->_callUserObj($aTemplate["path"]);
00702                                 }
00703                         } else {
00704                                 $this->oForm->mayday("RENDERLET LISTER <b>" . $this->_getName() . "</b> - Template defined, but <b>/template/path</b> is missing. Please check your XML configuration");
00705                         }
00706 
00707                         if(is_array($aTemplate) && array_key_exists("subpart", $aTemplate)) {
00708                                 if($this->oForm->isUserObj($aTemplate["subpart"])) {
00709                                         $aTemplate["subpart"] = $this->oForm->_callUserObj($aTemplate["subpart"]);
00710                                 }
00711                         } else {
00712                                 $this->oForm->mayday("RENDERLET LISTER <b>" . $this->_getName() . "</b> - Template defined, but <b>/template/subpart</b> is missing. Please check your XML configuration");
00713                         }
00714 
00715                         $aTemplate["path"] = $this->oForm->toServerPath($aTemplate["path"]);
00716 
00717 
00718                         if(file_exists($aTemplate["path"])) {
00719                                 if(is_readable($aTemplate["path"])) {
00720                                         $aRes["html"] = t3lib_parsehtml::getSubpart(
00721                                                 t3lib_div::getUrl($aTemplate["path"]),
00722                                                 $aTemplate["subpart"]
00723                                         );
00724 
00725                                         if(trim($aRes["html"]) === "") {
00726                                                 $this->_autoTemplateMayday($aTemplate, TRUE);
00727                                         }
00728                                 } else {
00729                                         $this->oForm->mayday("RENDERLET LISTER <b>" . $this->_getName() . "</b> - the given template file '<b>" . $aTemplate["path"] . "</b>' isn't readable. Please check permissions for this file.");
00730                                 }
00731                         } else {
00732                                 $this->_autoTemplateMayday($aTemplate);
00733                         }
00734 
00735                         /* managing styles and CSS file */
00736 
00737                         if(array_key_exists("cssfile", $aTemplate)) {
00738                                 if($this->oForm->isUserObj($aTemplate["cssfile"])) {
00739                                         $aTemplate["cssfile"] = $this->oForm->_callUserObj($aTemplate["cssfile"]);
00740                                 }
00741                                 
00742                                 $aRes["cssfile"] = $this->oForm->toWebPath($aTemplate["cssfile"]);
00743                         }
00744 
00745                         /* styles after css-file to eventually override css-file directives */
00746                         if(array_key_exists("styles", $aTemplate)) {
00747                                 if($this->oForm->isUserObj($aTemplate["styles"])) {
00748                                         $aTemplate["styles"] = $this->oForm->_callUserObj($aTemplate["styles"]);
00749                                 }
00750 
00751                                 $aRes["styles"] = $aTemplate["styles"];
00752                         }
00753 
00754 
00755                         /* get pager */
00756 
00757                         if(($aPagerTemplate = $this->_navConf("/pager/template")) !== FALSE) {
00758 
00759                                 if(is_array($aPagerTemplate) && array_key_exists("path", $aPagerTemplate)) {
00760                                         if($this->oForm->isUserObj($aPagerTemplate["path"])) { 
00761                                                 $aPagerTemplate["path"] = $this->oForm->_callUserObj($aPagerTemplate["path"]);
00762                                         }
00763                                 } else {
00764                                         $this->oForm->mayday("RENDERLET LISTER <b>" . $this->_getName() . "</b> - Template for PAGER is defined, but <b>/pager/template/path</b> is missing. Please check your XML configuration");
00765                                 }
00766 
00767                                 if(is_array($aPagerTemplate) && array_key_exists("subpart", $aPagerTemplate)) {
00768                                         if($this->oForm->isUserObj($aPagerTemplate["subpart"])) {
00769                                                 $aPagerTemplate["subpart"] = $this->oForm->_callUserObj($aPagerTemplate["subpart"]);
00770                                         }
00771                                 } else {
00772                                         $this->oForm->mayday("RENDERLET LISTER <b>" . $this->_getName() . "</b> - Template for PAGER defined, but <b>/pager/template/subpart</b> is missing. Please check your XML configuration");
00773                                 }
00774 
00775                                 $aPagerTemplate["path"] = $this->oForm->toServerPath($aPagerTemplate["path"]);
00776 
00777                                 if(file_exists($aPagerTemplate["path"])) {
00778                                         if(is_readable($aPagerTemplate["path"])) {
00779                                                 $aRes["pager"] = t3lib_parsehtml::getSubpart(
00780                                                         t3lib_div::getUrl($aPagerTemplate["path"]),
00781                                                         $aPagerTemplate["subpart"]
00782                                                 );
00783 
00784                                                 if(trim($aRes["pager"]) === "") {
00785                                                         $this->_autoPagerMayday($aPagerTemplate, TRUE);
00786                                                 }
00787 
00788                                         } else {
00789                                                 $this->oForm->mayday("RENDERLET LISTER <b>" . $this->_getName() . "</b> - the given template file for PAGER '<b>" . $aPagerTemplate["path"] . "</b>' isn't readable. Please check permissions for this file.");
00790                                         }
00791                                 } else {
00792                                         $this->_autoPagerMayday($aPagerTemplate);
00793                                 }
00794                         }
00795                 }
00796 
00797                 if($aRes["styles"] !== "") {
00798 
00799                         if($this->bDefaultTemplate === TRUE) {
00800                                 $sComment = "Stylesheet of DEFAULT TEMPLATE for renderlet:LISTER " . $this->_getName();
00801                                 $sKey = "tx_ameosformidable_renderletlister_defaultstyle";
00802                         } else {
00803                                 $sComment = "Dynamic stylesheet for renderlet:LISTER " . $this->_getName();
00804                                 $sKey = "tx_ameosformidable_renderletlister_dynamicstyle_" . $this->_getName();
00805                         }
00806 
00807                         $this->oForm->additionalHeaderData(
00808                                 $this->oForm->inline2TempFile($aRes["styles"], "css", $sComment),
00809                                 $sKey
00810                         );
00811                 }
00812 
00813                 if($aRes["cssfile"] !== "") {
00814                         $this->oForm->additionalHeaderData(
00815                                 "<!-- CSS file for renderlet:LISTER " . $this->_getName() . " -->\n<link rel=\"stylesheet\" type=\"text/css\" href=\"" . $aRes["cssfile"] . "\" />\n\n",
00816                                 "tx_ameosformidable_renderletlister_cssfile_" . $this->_getName()
00817                         );
00818                 }
00819 
00820                 reset($aRes);
00821                 return $aRes;
00822         }
00823 
00824         function _autoTemplateMayday($aTemplate, $bSubpartError = FALSE) {
00825 
00826                 /* ERROR message with automatic generated TEMPLATE and CSS */
00827                 $aDefaultTemplate = $this->__buildDefaultTemplate("#" . $this->_getElementHtmlId());
00828 
00829                 $sDefaultTemplate = htmlspecialchars($aDefaultTemplate["html"]);
00830                 $sDefaultStyles = htmlspecialchars($aDefaultTemplate["styles"]);
00831 
00832                 $sError = $bSubpartError ?
00833                         "RENDERLET LISTER <b>" . $this->_getName() . "</b> - the given SUBPART '<b>" . $aTemplate["subpart"] . "</b>' doesn't exists."
00834                         : "RENDERLET LISTER <b>" . $this->_getName() . "</b> - the given TEMPLATE FILE '<b>" . $aTemplate["path"] . "</b>' doesn't exists.";
00835 
00836                 $sMessage =<<<ERRORMESSAGE
00837 
00838         <div>{$sError}</div>
00839         <hr />
00840         <div>If you're going to create this template, these automatically generated html template and styles might be usefull</div>
00841         <h2>Automatic LIST template</h2>
00842         <div>Copy/paste this in <b>{$aTemplate["path"]}</b></div>
00843         <div style='color: black; background-color: #e6e6fa; border: 2px dashed #4682b4; font-family: Courier;'>
00844                 <br />
00845 <pre>
00846 &lt;!-- {$aTemplate["subpart"]} begin--&gt;
00847                 
00848 {$sDefaultTemplate}
00849                 
00850 &lt;!-- {$aTemplate["subpart"]} end--&gt;
00851 </pre>
00852                 <br /><br />
00853         </div>
00854         <h2>Automatic CSS</h2>
00855         <div style='color: black; background-color: #e6e6fa; border: 2px dashed #4682b4;'><pre>{$sDefaultStyles}</pre></div>
00856 
00857 ERRORMESSAGE;
00858                 
00859                 $this->oForm->mayday($sMessage);
00860         }
00861 
00862         function _autoPagerMayday($aTemplate, $bSubpartError = FALSE) {
00863 
00864                 /* ERROR message for PAGER with automatic generated TEMPLATE */
00865 
00866                 $sDefaultPager = htmlspecialchars($this->__getDefaultPager());
00867 
00868                 $sError = $bSubpartError ?
00869                         "RENDERLET LISTER <b>" . $this->_getName() . "</b> - the given SUBPART for PAGER '<b>" . $aTemplate["subpart"] . "</b>' doesn't exists."
00870                         : "RENDERLET LISTER <b>" . $this->_getName() . "</b> - the given TEMPLATE FILE for PAGER '<b>" . $aTemplate["path"] . "</b>' doesn't exists.";
00871 
00872                 $sMessage =<<<ERRORMESSAGE
00873 
00874         <div>{$sError}</div>
00875         <hr />
00876         <div>If you're going to create this template, these automatically generated html template might be usefull</div>
00877         <h2>Automatic PAGER template</h2>
00878         <div>Copy/paste this in <b>{$aTemplate["path"]}</b></div>
00879         <div style='color: black; background-color: #e6e6fa; border: 2px dashed #4682b4; font-family: Courier;'>
00880                 <br />
00881 <pre>
00882 &lt;!-- {$aTemplate["subpart"]} begin--&gt;
00883 {$sDefaultPager}
00884 &lt;!-- {$aTemplate["subpart"]} end--&gt;
00885 </pre>
00886 <br /><br />
00887         </div>
00888 
00889 ERRORMESSAGE;
00890                 
00891                 $this->oForm->mayday($sMessage);
00892         }
00893 
00894         function &__getDefaultPager() {
00895                 $sPath = $this->sExtPath . "res/html/default-template.html";
00896                 $sSubPart = "###LISTPAGER###";
00897 
00898                 return t3lib_parsehtml::getSubpart(
00899                         t3lib_div::getUrl($sPath),
00900                         $sSubPart
00901                 );
00902         }
00903 
00904         function &__buildDefaultTemplate($sCssPrefix = ".ameosformidable-rdtlister-defaultwrap") {
00905 
00906                 $aRes = array(
00907                         "default" => TRUE,
00908                         "html" => "",
00909                         "styles" => "",
00910                         "cssfile" => "",
00911                         "pager" => "",
00912                 );
00913 
00914                 $aHtml = array(
00915                         "TOP" => array(),
00916                         "DATA" => array(
00917                                 "ROW1" => array(),
00918                                 "ROW2" => array(),
00919                                 "ROWACT" => array(),
00920                         ),
00921                 );
00922 
00923                 $sPath          = $this->sExtPath . "res/html/default-template.html";
00924                 $sSubpart       = "###LIST###";
00925                 
00926                 $aRes["html"] = t3lib_parsehtml::getSubpart(
00927                         t3lib_div::getUrl($sPath),
00928                         $sSubpart
00929                 );
00930 
00931                 /* including default styles in external CSS */
00932                 
00933                 $aRes["styles"] = $this->oForm->_parseTemplateCode(
00934                         t3lib_parsehtml::getSubpart(
00935                                 t3lib_div::getUrl($sPath),
00936                                 "###STYLES###"
00937                         ),
00938                         array(
00939                                 "PREFIX" => $sCssPrefix,
00940                                 "EXTPATH" => "/" . $this->sExtRelPath
00941                         ),
00942                         array(),
00943                         FALSE
00944                 );
00945 
00946                 /*END of CSS */
00947 
00948 
00949 
00950                 $sTopColumn = t3lib_parsehtml::getSubpart($aRes["html"],                "###TOPCOLUMN###");
00951                 $sDataColumn1 = t3lib_parsehtml::getSubpart($aRes["html"],              "###DATACOLUMN1###");
00952                 $sDataColumn2 = t3lib_parsehtml::getSubpart($aRes["html"],              "###DATACOLUMN2###");
00953                 $sDataColumnAct = t3lib_parsehtml::getSubpart($aRes["html"],    "###DATACOLUMNACT###");
00954                 
00955                 reset($this->aOColumns);
00956                 while(list($sColName,) = each($this->aOColumns)) {
00957                         
00958                         if($this->_defaultTrue("/columns/listheaders") === TRUE) {
00959 
00960                                 // building sorting header for this column
00961 
00962                                 if(($sHeader = $this->aOColumns[$sColName]->_navConf("/listheader")) === FALSE) {
00963                                         $sHeader = "{" . $sColName . ".label}";
00964                                 }
00965 
00966                                 $aHtml["TOP"][] = $this->oForm->_parseTemplateCode(
00967                                         $sTopColumn,
00968                                         array(
00969                                                 "COLNAME"               => $sColName,
00970                                                 "COLCONTENT"    => "<!-- ###SORT_" . $sColName . "### begin-->" . $sHeader . "<!-- ###SORT_" . $sColName . "### end-->"
00971                                         ),
00972                                         array(),        // exclude
00973                                         FALSE           // bClearNotUsed
00974                                 );
00975                         }
00976 
00977                         // building data cells for this column
00978                         $aTemp = array(
00979                                 "COLNAME"               => $sColName,
00980                                 "COLCONTENT"    => "{" . $sColName . "}",
00981                         );
00982 
00983                         $aHtml["DATA"]["ROW1"][]        = $this->oForm->_parseTemplateCode(
00984                                 $sDataColumn1,
00985                                 $aTemp,
00986                                 array(),
00987                                 FALSE
00988                         );
00989 
00990                         $aHtml["DATA"]["ROW2"][]        = $this->oForm->_parseTemplateCode(
00991                                 $sDataColumn2,
00992                                 $aTemp,
00993                                 array(),
00994                                 FALSE
00995                         );
00996 
00997                         $aHtml["DATA"]["ROWACT"][]      = $this->oForm->_parseTemplateCode(
00998                                 $sDataColumnAct,
00999                                 $aTemp,
01000                                 array(),
01001                                 FALSE
01002                         );
01003                 }
01004 
01005                 $aRes["html"] = t3lib_parsehtml::substituteSubpart($aRes["html"], "###STYLES###", "", FALSE, FALSE);
01006                 $aRes["html"] = t3lib_parsehtml::substituteSubpart($aRes["html"], "###DATACOLUMN1###", implode("", $aHtml["DATA"]["ROW1"]), FALSE, FALSE);
01007                 $aRes["html"] = t3lib_parsehtml::substituteSubpart($aRes["html"], "###DATACOLUMN2###", implode("", $aHtml["DATA"]["ROW2"]), FALSE, FALSE);
01008                 $aRes["html"] = t3lib_parsehtml::substituteSubpart($aRes["html"], "###DATACOLUMNACT###", implode("", $aHtml["DATA"]["ROWACT"]), FALSE, FALSE);
01009                 $aRes["html"] = t3lib_parsehtml::substituteSubpart($aRes["html"], "###TOPCOLUMN###", implode("", $aHtml["TOP"]), FALSE, FALSE);
01010 
01011                 $aRes["html"] = $this->oForm->_parseTemplateCode(
01012                         $aRes["html"],
01013                         array(
01014                                 "NBCOLS" => sizeOf($this->aOColumns)
01015                         ),
01016                         array(),
01017                         FALSE
01018                 );
01019 
01020                 /* RETRIEVING pager */
01021                 
01022                 $aRes["pager"] = $this->__getDefaultPager();
01023 
01024                 return $aRes;
01025         }
01026 
01027         function _initColumns() {
01028                 
01029                 if($this->aOColumns === FALSE) {
01030 
01031                         $sNamePrefix = $this->_getName() . ":";
01032 
01033                         if(($aColumns = $this->_navConf("/columns/")) !== FALSE && is_array($aColumns)) {
01034 
01035                                 $this->aOColumns = array();
01036                                 reset($aColumns);
01037                                 while(list($sTagName, $aColumn) = each($aColumns)) {
01038                                         if(t3lib_div::isFirstPartOfStr(strtolower($aColumn["type"]), "renderlet:")) {
01039 
01040                                                 if($this->oForm->_defaultTrue("/process", $aColumn)) {
01041 
01042                                                         $sRdtName = $sNamePrefix . $aColumn["name"];
01043 
01044                                                         $aColumn["type"] = str_replace("renderlet:", "", $aColumn["type"]);
01045 
01046                                                         $this->oForm->aORenderlets[$sRdtName] = $this->oForm->_makeRenderlet(
01047                                                                 $aColumn,
01048                                                                 $this->sXPath . "columns/" . $sTagName . "/"
01049                                                         );
01050 
01051                                                         $this->oForm->aORenderlets[$sRdtName]->sNamePrefix = $sNamePrefix;
01052                                                         $this->aOColumns[$aColumn["name"]] =& $this->oForm->aORenderlets[$sRdtName];
01053 
01054                                                         /*$this->aOColumns[$aColumn["name"]] = $this->oForm->_makeRenderlet(
01055                                                                 $aColumn,
01056                                                                 $this->sXPath . "columns/" . $sTagName . "/"
01057                                                         );*/
01058                                                 }
01059                                         }
01060                                 }
01061                         } else {
01062                                 $this->aOColumns = array();
01063                         }
01064                 }
01065         }
01066         
01067         function &_refineRow(&$aRow) {
01068 
01069                 if(is_array($aRow)) {
01070                         reset($this->aOColumns);
01071                         while(list($sName, ) = each($this->aOColumns)) {
01072 
01073                                 if(array_key_exists($sName, $aRow)) {
01074                                         if($this->aOColumns[$sName]->_activeListable()) {
01075                                                 $aRow[$sName] = $this->oForm->oRenderer->processHtmlBag(
01076                                                         $this->aOColumns[$sName]->renderWithForcedValue($aRow[$sName]),
01077                                                         $this->aOColumns[$sName]
01078                                                 );
01079                                         } else {
01080                                                 $aRow[$sName] = $this->oForm->oRenderer->processHtmlBag(
01081                                                         $this->aOColumns[$sName]->renderReadOnlyWithForcedValue($aRow[$sName]),
01082                                                         $this->aOColumns[$sName]
01083                                                 );
01084                                         }
01085                                 } else {
01086                                         // not in the data row
01087                                         // probably a virtual column
01088 
01089                                         // calling _getValue() here, as value has to be evaluated for each row
01090                                         $mValue = $this->aOColumns[$sName]->_getValue();
01091 
01092                                         if($this->aOColumns[$sName]->_activeListable()) {
01093                                                 $aRow[$sName] = $this->oForm->oRenderer->processHtmlBag(
01094                                                         $this->aOColumns[$sName]->renderWithForcedValue($mValue),
01095                                                         $this->aOColumns[$sName]
01096                                                 );
01097                                         } else {
01098 
01099                                                 // calling _getValue() here, as value has to be evaluated for each row
01100                                                 $mValue = $this->aOColumns[$sName]->_getValue();
01101 
01102                                                 $aRow[$sName] = $this->oForm->oRenderer->processHtmlBag(
01103                                                         $this->aOColumns[$sName]->renderReadOnlyWithForcedValue($mValue),
01104                                                         $this->aOColumns[$sName]
01105                                                 );
01106                                         }
01107                                 }
01108                         }
01109                 } else {
01110                         $aRow = array();
01111                 }
01112 
01113                 reset($aRow);
01114                 return $aRow;
01115         }
01116 
01117         function _getPage() {
01118                 
01119                 if($this->bResetPager !== TRUE) {
01120                         $aGet = $this->oForm->oDataHandler->_G();
01121                         $sName = $this->_getElementHtmlId();
01122 
01123                         if(array_key_exists($sName, $aGet) && array_key_exists("page", $aGet[$sName])) {
01124                                 return (($iPage = intval($aGet[$sName]["page"])) >= 1) ? $iPage : 1;
01125                         }
01126                 }
01127 
01128                 return 1;
01129         }
01130 
01131         function _getSortColAndDirection() {
01132 
01133                 $aRes = array(
01134                         "col" => "",
01135                         "dir" => "",
01136                 );
01137 
01138                 $aGet = $this->oForm->oDataHandler->_G();
01139                 $sName = $this->_getElementHtmlId();
01140                 
01141                 if(array_key_exists($sName, $aGet) && array_key_exists("sort", $aGet[$sName])) {
01142                         $sSort = $aGet[$sName]["sort"];
01143                         $aSort = explode("-", $sSort);
01144 
01145                         if(sizeOf($aSort) == 2) {
01146                                 $sCol = $aSort[0];
01147                                 if(!array_key_exists($sCol, $this->aOColumns)) {
01148                                         $sCol = array_shift(array_keys($this->aOColumns));
01149                                 }
01150 
01151                                 $sDir = $aSort[1];
01152                                 if(!in_array($sDir, array("asc", "desc"))) {
01153                                         $sDir = "asc";
01154                                 }
01155                         }
01156 
01157                         $aRes = array(
01158                                 "col" => $sCol,
01159                                 "dir" => $sDir
01160                         );
01161                 } elseif($this->_navConf("/pager/sort") !== FALSE) {
01162                         
01163                         if(($sSortCol = $this->_navConf("/pager/sort/column")) !== FALSE) {
01164                                 $aRes["col"] = $sSortCol;
01165                         }
01166 
01167                         if(($sSortDir = $this->_navConf("/pager/sort/direction")) !== FALSE) {
01168                                 $aRes["dir"] = $sSortDir;
01169                         }
01170                 }
01171 
01172                 return $aRes;
01173         }
01174 
01175         function mayHaveChilds() {
01176                 return TRUE;
01177         }
01178 
01179         function _activeListable() {
01180                 return $this->oForm->_defaultTrue("/activelistable/", $this->aElement);
01181         }
01182         
01183         function _renderOnly() {
01184                 return TRUE;
01185         }
01186 
01187         function cleanBeforeSession() {
01188                 unset($this->aOColumns);        // TODO: reconstruct ajax-side
01189                 parent::cleanBeforeSession();
01190         }
01191 }
01192 
01193 
01194         if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/ameos_formidable/api/base/rdt_lister/api/class.tx_rdtlister.php"])     {
01195                 include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/ameos_formidable/api/base/rdt_lister/api/class.tx_rdtlister.php"]);
01196         }
01197 ?>


Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6