/**
  * Renders the TypoScript object in the given TypoScript setup path.
  *
  * @param string $typoscriptObjectPath the TypoScript setup path of the TypoScript object to render
  * @param mixed $data the data to be used for rendering the cObject. Can be an object, array or string. If this argument is not set, child nodes will be used
  * @param string $currentValueKey
  * @return string the content of the rendered TypoScript object
  * @author Bastian Waidelich <*****@*****.**>
  * @author Niels Pardon <*****@*****.**>
  */
 public function render($typoscriptObjectPath, $data = NULL, $currentValueKey = NULL)
 {
     if ($data === NULL) {
         $data = $this->renderChildren();
     }
     $currentValue = NULL;
     if (is_object($data)) {
         $data = Tx_Extbase_Reflection_ObjectAccess::getAccessibleProperties($data);
     } elseif (is_string($data)) {
         $currentValue = $data;
         $data = array($data);
     }
     $this->contentObject->start($data);
     if ($currentValue !== NULL) {
         $this->contentObject->setCurrentVal($currentValue);
     } elseif ($currentValueKey !== NULL && isset($data[$currentValueKey])) {
         $this->contentObject->setCurrentVal($data[$currentValueKey]);
     }
     $pathSegments = t3lib_div::trimExplode('.', $typoscriptObjectPath);
     $lastSegment = array_pop($pathSegments);
     $setup = $this->typoScriptSetup;
     foreach ($pathSegments as $segment) {
         if (!array_key_exists($segment . '.', $setup)) {
             throw new Tx_Fluid_Core_ViewHelper_Exception('TypoScript object path "' . htmlspecialchars($typoscriptObjectPath) . '" does not exist', 1253191023);
         }
         $setup = $setup[$segment . '.'];
     }
     return $this->contentObject->cObjGetSingle($setup[$lastSegment], $setup[$lastSegment . '.']);
 }
Exemplo n.º 2
0
 /**
  * Render a page browser using the Universal Page Browser (EXT:pagebrowse)
  * made by Dmitry Dulepov.
  * 
  * @see   http://dmitry-dulepov.com/article/do-you-need-a-page-browser-for-your-typo3-extension.html
  * @param integer $numberOfPages The number of pages to show.
  * @param array $settings The settings which override the default one.
  * @return string The HTML page browser.
  * @author Romain Ruetschi <*****@*****.**>
  */
 public function render($numberOfPages, array $settings = array())
 {
     // Add the number of pages to show in the configuration.
     $settings['numberOfPages'] = intval($numberOfPages);
     // Recursively merge the predefined settings with the
     // supplied ones.
     $settings = t3lib_div::array_merge_recursive_overrule($this->settings, $settings);
     // Return the resulting code.
     return $this->cObj->cObjGetSingle('USER', $settings);
 }
 /**
  * Renders a single facet option link according to the rendering
  * instructions that may have been configured.
  *
  * @param	string	$option The facet option's raw string value.
  * @return	string	The facet option rendered according to rendering instructions if available
  */
 protected function renderOption($option)
 {
     $renderedFacetOption = $option;
     if (isset($this->facetConfiguration['renderingInstruction'])) {
         // TODO provide a data field with information about whether a facet option is selected, and pssibly all information from the renderOptions method so that one can use that with TS
         $this->contentObject->start(array('optionValue' => $option));
         $renderedFacetOption = $this->contentObject->cObjGetSingle($this->facetConfiguration['renderingInstruction'], $this->facetConfiguration['renderingInstruction.']);
     }
     return $renderedFacetOption;
 }
Exemplo n.º 4
0
 /**
  * Get content records based on column and pid
  *
  * @return array
  */
 protected function getContentRecords()
 {
     $loadRegister = FALSE;
     if (empty($this->arguments['loadRegister']) === FALSE) {
         $this->contentObject->cObjGetSingle('LOAD_REGISTER', $this->arguments['loadRegister']);
         $loadRegister = TRUE;
     }
     $pid = $this->arguments['pageUid'] ? $this->arguments['pageUid'] : $GLOBALS['TSFE']->id;
     $order = $this->arguments['order'] . ' ' . $this->arguments['sortDirection'];
     $colPos = $this->arguments['column'];
     $contentUids = $this->arguments['contentUids'];
     $slide = $this->arguments['slide'] ? $this->arguments['slide'] : FALSE;
     $slideCollect = $this->arguments['slideCollect'] ? $this->arguments['slideCollect'] : FALSE;
     if ($slideCollect !== FALSE) {
         $slide = min($slide, $slideCollect);
     }
     $slideCollectReverse = $this->arguments['slideCollectReverse'];
     $rootLine = NULL;
     if ($slide) {
         $pageSelect = new t3lib_pageSelect();
         $rootLine = $pageSelect->getRootLine($pid);
         if ($slideCollectReverse) {
             $rootLine = array_reverse($rootLine);
         }
     }
     $content = array();
     do {
         if ($slide) {
             $page = array_shift($rootLine);
             if (!$page) {
                 break;
             }
             $pid = $page['uid'];
         }
         if (is_array($contentUids)) {
             $conditions = 'uid IN (' . implode(',', $contentUids) . ')';
         } else {
             $conditions = "pid = '" . $pid . "' AND colPos = '" . $colPos . "' AND (tx_flux_column = '' OR tx_flux_column IS NULL) " . $GLOBALS['TSFE']->cObj->enableFields('tt_content') . " AND (sys_language_uid IN (-1,0) OR (sys_language_uid = '" . $GLOBALS['TSFE']->sys_language_uid . "' AND l18n_parent = '0'))";
         }
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tt_content', $conditions, 'uid', $order, $this->arguments['limit']);
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $conf = array('tables' => 'tt_content', 'source' => $row['uid'], 'dontCheckPid' => 0);
             array_push($content, $GLOBALS['TSFE']->cObj->RECORDS($conf));
         }
         $GLOBALS['TYPO3_DB']->sql_free_result($res);
         if (count($content) && !$slideCollect) {
             break;
         }
     } while ($slide !== FALSE && --$slide !== -1);
     if ($loadRegister) {
         $this->contentObject->cObjGetSingle('RESTORE_REGISTER', '');
     }
     return $content;
 }
Exemplo n.º 5
0
 /**
  * Render the sp_socialsharing plug-in.
  *
  * @param string $pageTitle The value of ###TITLE###.
  * @param string $services The list of services.
  * @param array $settings The settings which override the default one.
  * @return string The SocialSharing plugin-in.
  * @author Romain Ruetschi <*****@*****.**>
  */
 public function render($pageTitle = '', $services = '', array $settings = array())
 {
     // Recursively merge the predefined settings with the
     // supplied ones.
     $settings = t3lib_div::array_merge_recursive_overrule($this->settings, $settings);
     if (trim($pageTitle)) {
         $settings['pageTitle.'] = array('value' => trim($pageTitle));
     }
     if (trim($services)) {
         $settings['serviceList'] = trim($services);
     }
     // Return the resulting code.
     return $this->cObj->cObjGetSingle('USER', $settings);
 }
Exemplo n.º 6
0
 /**
  * Parse TypoScript configuration
  *
  * @param array $configuration TypoScript configuration
  * @return array Parsed configuration
  */
 protected static function parseTypoScriptArray(array $configuration)
 {
     $typoScriptArray = array();
     foreach ($configuration as $key => $value) {
         $ident = rtrim($key, '.');
         if (is_array($value)) {
             if (!empty($configuration[$ident])) {
                 $typoScriptArray[$ident] = self::$contentObject->cObjGetSingle($configuration[$ident], $value);
                 unset($configuration[$key]);
             } else {
                 $typoScriptArray[$key] = self::parseTypoScriptArray($value);
             }
         } else {
             if (is_string($value) && $key == $ident) {
                 $typoScriptArray[$key] = $value;
             }
         }
     }
     return $typoScriptArray;
 }
Exemplo n.º 7
0
 function getGenericMarkers(&$markerArray, $row)
 {
     $lConf = $this->genericMarkerConf;
     if (!is_array($lConf)) {
         return;
     } else {
         while (list($mName) = each($lConf)) {
             if (is_array($lConf[$mName . '.'])) {
                 $markerArray['###GENERIC_' . strtoupper($mName) . '###'] = $this->local_cObj->cObjGetSingle($lConf[$mName], $lConf[$mName . '.'], 'tt_news generic marker: ' . $mName);
             }
         }
     }
 }
 /**
  * Creates a shortcut ("Insert Records")
  *
  * @return	string		Plain Content without HTML comments
  */
 function getShortcut()
 {
     $str = $this->cObj->cObjGetSingle($this->conf['shortcut'], $this->conf['shortcut.']);
     //Remove html comment reporting shortcut inclusion
     return preg_replace('/<![ \\r\\n\\t]*(--([^\\-]|[\\r\\n]|-[^\\-])*--[ \\r\\n\\t]*)\\>/', '', $str);
 }