コード例 #1
0
 public function user_rgsg($content, $conf)
 {
     $sysPageObj = t3lib_div::makeInstance('t3lib_pageSelect');
     $rootLine = $sysPageObj->getRootLine($GLOBALS['TSFE']->id);
     $TSObj = t3lib_div::makeInstance('t3lib_tsparser_ext');
     $TSObj->tt_track = 0;
     $TSObj->init();
     $TSObj->runThroughTemplates($rootLine);
     $TSObj->generateConfig();
     $this->conf = $TSObj->setup['plugin.']['tx_rgsmoothgallery_pi1.'];
     $split = strpos($GLOBALS['TSFE']->currentRecord, ':');
     $id = substr($GLOBALS['TSFE']->currentRecord, $split + 1);
     $where = 'uid =' . $id;
     $table = 'tt_content';
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('imagewidth,imageheight', $table, $where, $groupBy = '', $orderBy, $limit = '');
     $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
     $css .= $row['imagewidth'] ? 'width:' . $row['imagewidth'] . 'px;' : '';
     $css .= $row['imageheight'] ? 'height:' . $row['imageheight'] . 'px;' : '';
     $GLOBALS['TSFE']->additionalCSS['rgsmoothgallery' . $id] = '#myGallery' . $id . ' {' . $css . '}';
     if (t3lib_extMgm::isLoaded('t3mootools')) {
         require_once t3lib_extMgm::extPath('t3mootools') . 'class.tx_t3mootools.php';
     }
     if (defined('T3MOOTOOLS')) {
         tx_t3mootools::addMooJS();
     } else {
         $header .= $this->getPath($this->conf['pathToMootools']) ? '<script src="' . $this->getPath($this->conf['pathToMootools']) . '" type="text/javascript"></script>' : '';
         $header .= $this->getPath($this->conf['pathToMootoolsMore']) ? '<script src="' . $this->getPath($this->conf['pathToMootoolsMore']) . '" type="text/javascript"></script>' : '';
     }
     // path to js + css
     $GLOBALS['TSFE']->additionalHeaderData['rgsmoothgallery'] = $header . '
     <script src="' . $this->getPath($this->conf['pathToJdgalleryJS']) . '" type="text/javascript"></script>
     <link rel="stylesheet" href="' . $this->getPath($this->conf['pathToJdgalleryCSS']) . '" type="text/css" media="screen" />
   ';
     return $content;
 }
コード例 #2
0
 /**
  * Load the necessary JS into the header. Just called if there are images
  *
  * @param	array		$conf: The PlugIn configuration
  * @return	void
  */
 function loadJS($conf)
 {
     // necessary to load function from everywhere else
     $this->conf = $conf;
     // include mootools library if available or do it yourself if not
     if (t3lib_extMgm::isLoaded('t3mootools')) {
         require_once t3lib_extMgm::extPath('t3mootools') . 'class.tx_t3mootools.php';
     }
     if (defined('T3MOOTOOLS')) {
         tx_t3mootools::addMooJS();
     } else {
         $header = '<script src="' . $this->getPath($this->conf['pathToMootools']) . '" type="text/javascript"></script>';
     }
     $header .= isset($this->conf['pathToScript']) ? '<script src="' . $this->getPath($this->conf['pathToScript']) . '" type="text/javascript"></script>' : '';
     $header .= isset($this->conf['pathToCSS']) ? '<link rel="stylesheet" href="' . $this->getPath($this->conf['pathToCSS']) . '" type="text/css" />' : '';
     // add the whole js & css for the header
     $GLOBALS['TSFE']->additionalHeaderData['rgslideshow'] = $header;
 }
コード例 #3
0
 /**
  * Loads all the needed javascript stuff and
  * does the configuration of the gallery
  *
  * @param	boolean  $thumbsVal: Thumbnail preview activated?
  * @param	boolean  $arrowsVal: Arrows to neighbour images activated?
  * @param	string   $durationVal: If automatic slideshow the value of the delay
  * @param	string   $advancedSettings: Advanced configuration
  * @param	string/int   $uniqueId: A unique ID to have more than 1 galleries on 1 page
  * $param array    $conf: $configuration-array
  * @return	The gallery
  */
 public function getJs($thumbsVal, $arrowsVal, $durationVal, $widthGallery, $heightGallery, $advancedSettings, $uniqueId, $conf, $overrideJS = '')
 {
     $this->conf = $conf;
     if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('t3mootools')) {
         require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3mootools') . 'class.tx_t3mootools.php';
     }
     if (defined('T3MOOTOOLS')) {
         tx_t3mootools::addMooJS();
     } else {
         $header .= $this->getPath($this->conf['pathToMootools']) ? '<script src="' . $this->getPath($this->conf['pathToMootools']) . '" type="text/javascript"></script>' : '';
         $header .= $this->getPath($this->conf['pathToMootoolsMore']) ? '<script src="' . $this->getPath($this->conf['pathToMootoolsMore']) . '" type="text/javascript"></script>' : '';
     }
     // path to js + css
     $GLOBALS['TSFE']->additionalHeaderData['rgsmoothgallery'] = $header . '
     <script src="' . $this->getPath($this->conf['pathToJdgalleryJS']) . '" type="text/javascript"></script>
     <link rel="stylesheet" href="' . $this->getPath($this->conf['pathToJdgalleryCSS']) . '" type="text/css" media="screen" />
   ';
     if ($this->config['externalControl'] == 1) {
         $externalControl1 = 'var myGallery' . $uniqueId . ';';
     } else {
         $externalControl2 = 'var';
     }
     // inline CSS for different size of gallery
     $widthGallery = $widthGallery ? 'width:' . $widthGallery . 'px;' : '';
     $heightGallery = $heightGallery ? 'height:' . $heightGallery . 'px;' : '';
     if ($heightGallery != '' || $widthGallery != '') {
         $GLOBALS['TSFE']->additionalCSS['rgsmoothgallery' . $uniqueId] = '#myGallery' . $uniqueId . ' {' . $widthGallery . $heightGallery . '}';
     }
     // inline CSS for the loading bar if plugin not loaded and for the given height of the gallery
     $GLOBALS['TSFE']->additionalCSS['rgsmoothgallery' . $uniqueId] .= ' .rgsgnest' . $uniqueId . ' { ' . $widthGallery . $heightGallery . ' }';
     if ($this->conf['rgsmoothgallerylinks'] == 1) {
         $GLOBALS['TSFE']->additionalCSS['rgsmoothgallery' . $uniqueId] .= ' .rgsglinks' . $uniqueId . ' { ' . $widthGallery . ' }';
     }
     // configuration of gallery
     $duration = $durationVal ? 'timed:true,delay: ' . $durationVal : 'timed:false';
     $thumbs = $thumbsVal == 1 ? 'true' : 'false';
     $arrows = $arrowsVal == 1 ? 'true' : 'false';
     // advanced settings (from TS + tab flexform configuration)
     $advancedSettings .= $this->config['hideInfoPane'] ? 'showInfopane: false,' : '';
     if ($this->config['thumbOpacity'] && $this->config['thumbOpacity'] > 0 && $this->config['thumbOpacity'] <= 1) {
         $advancedSettings .= 'thumbOpacity: ' . $this->config['thumbOpacity'] . ',';
     }
     if (!$this->config['hideInfoPane'] && $this->config['slideInfoZoneOpacity'] && $this->config['slideInfoZoneOpacity'] > 0 && $this->config['slideInfoZoneOpacity'] <= 1) {
         $advancedSettings .= 'slideInfoZoneOpacity: ' . $this->config['slideInfoZoneOpacity'] . ',';
     }
     $advancedSettings .= $this->config['thumbSpacing'] ? 'thumbSpacing: ' . $this->config['thumbSpacing'] . ',' : '';
     $advancedSettings .= $this->config['showPlay'] ? 'showPlay: true,' : '';
     // external thumbs
     $advancedSettings .= $this->config['externalThumbs'] ? 'useExternalCarousel:true,carouselElement:$("' . $this->config['externalThumbs'] . '"),' : '';
     #
     // js needed to load the gallery and to get it started
     if ($overrideJS != '') {
         $js = $overrideJS;
     } else {
         $js .= '
 		<script type="text/javascript">' . $externalControl1 . '
 			function startGallery' . $uniqueId . '() {
                 if(window.gallery' . $uniqueId . ') {
                     ' . $externalControl2 . ' myGallery' . $uniqueId . ' = new gallery($(\'myGallery' . $uniqueId . '\'), {
                     ' . $duration . ',
                     showArrows: ' . $arrows . ',
                     showCarousel: ' . $thumbs . ',
                     textShowCarousel: \'' . $this->pi_getLL('textShowCarousel') . '\',
                     embedLinks: false,
                     ' . $advancedSettings . '
                     });
                 } else {
                     window.gallery' . $uniqueId . '=true;
                     if(this.ie)
                     {
                         window.setTimeout("startGallery' . $uniqueId . '();",3000);
                     } else {
                         window.setTimeout("startGallery' . $uniqueId . '();",100);
                     }
                 }
             }
             window.addEvent("domready", startGallery' . $uniqueId . ');
 		</script>';
         if ($this->conf['noscript'] == 1) {
             $js .= '<noscript>
 		' . $this->getImageDifferentPlaces(1) . '
 		</noscript>';
         }
     }
     return $js;
 }
コード例 #4
0
 /**
  * Check if mootools is anywhere on the website. 
  * Check is based on if t3mootools is configured or if $check is true    
  *
  * @param   boolean     $check: Just an additional value
  * @return   void
  */
 function checkForMootools($check = false)
 {
     // predefined empty
     $this->mootools['begin'] = '';
     $this->mootools['end'] = '';
     // if t3mootools is loaded, include it
     if (t3lib_extMgm::isLoaded('t3mootools')) {
         require_once t3lib_extMgm::extPath('t3mootools') . 'class.tx_t3mootools.php';
     }
     // if t3mootools is configured or mootools is included manually
     if (defined('T3MOOTOOLS') || $check) {
         // let t3mootools know that it should be included
         if (defined('T3MOOTOOLS')) {
             tx_t3mootools::addMooJS();
         }
         // set the addEvent
         $this->mootools['begin'] = 'window.addEvent("load", function(){';
         $this->mootools['end'] = ' });';
     }
 }