コード例 #1
0
 /**
  * Returns the selectorn name or an empty string, if the source is not a selector
  * // TODO This has to be checked at another place
  * @return string The selector name
  */
 protected function getSelectorName()
 {
     if ($this->getSource() instanceof Tx_Extbase_Persistence_QOM_SelectorInterface) {
         return $this->source->getSelectorName();
     } else {
         return '';
     }
 }
コード例 #2
0
 /**
  * Performs workspace and language overlay on the given row array. The language and workspace id is automatically
  * detected (depending on FE or BE context). You can also explicitly set the language/workspace id.
  *
  * @param Tx_Extbase_Persistence_QOM_SourceInterface $source The source (selector od join)
  * @param array $row The row array (as reference)
  * @param string $languageUid The language id
  * @param string $workspaceUidUid The workspace id
  * @return void
  */
 protected function doLanguageAndWorkspaceOverlay(Tx_Extbase_Persistence_QOM_SourceInterface $source, array $rows, $languageUid = NULL, $workspaceUid = NULL)
 {
     $overlayedRows = array();
     foreach ($rows as $row) {
         if (!$this->pageSelectObject instanceof t3lib_pageSelect) {
             if (TYPO3_MODE == 'FE') {
                 if (is_object($GLOBALS['TSFE'])) {
                     $this->pageSelectObject = $GLOBALS['TSFE']->sys_page;
                 } else {
                     require_once PATH_t3lib . 'class.t3lib_page.php';
                     $this->pageSelectObject = t3lib_div::makeInstance('t3lib_pageSelect');
                 }
             } else {
                 require_once PATH_t3lib . 'class.t3lib_page.php';
                 $this->pageSelectObject = t3lib_div::makeInstance('t3lib_pageSelect');
             }
         }
         if (is_object($GLOBALS['TSFE'])) {
             if ($languageUid === NULL) {
                 $languageUid = $GLOBALS['TSFE']->sys_language_uid;
                 $languageMode = $GLOBALS['TSFE']->sys_language_mode;
             }
             if ($workspaceUid !== NULL) {
                 $this->pageSelectObject->versioningWorkspaceId = $workspaceUid;
             }
         } else {
             if ($languageUid === NULL) {
                 $languageUid = intval(t3lib_div::_GP('L'));
             }
             if ($workspaceUid === NULL) {
                 $workspaceUid = $GLOBALS['BE_USER']->workspace;
             }
             $this->pageSelectObject->versioningWorkspaceId = $workspaceUid;
         }
         if ($source instanceof Tx_Extbase_Persistence_QOM_SelectorInterface) {
             $tableName = $source->getSelectorName();
         } elseif ($source instanceof Tx_Extbase_Persistence_QOM_JoinInterface) {
             $tableName = $source->getLeft()->getSelectorName();
         }
         $this->pageSelectObject->versionOL($tableName, $row, TRUE);
         if (isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField']) && $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] !== '') {
             if (in_array($row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']], array(-1, 0))) {
                 $overlayMode = $languageMode === 'strict' ? 'hideNonTranslated' : '';
                 $row = $this->pageSelectObject->getRecordOverlay($tableName, $row, $languageUid, $overlayMode);
             }
         }
         if ($row !== NULL) {
             $overlayedRows[] = $row;
         }
     }
     return $overlayedRows;
 }