예제 #1
0
    /**
     * 
     * output the slides
     */
    private function putSlides()
    {
        $sliderParams = $this->params;
        if (empty($this->arrSlides)) {
            ?>
				<div class="no-slides-text">
					No slides found, please add some slides
				</div>
				<?php 
        }
        $thumbWidth = $sliderParams->get("thumb_width", 100);
        $thumbHeight = $sliderParams->get("thumb_height", 50);
        $slideWidth = $sliderParams->get("slider_width", 900);
        $slideHeight = $sliderParams->get("slider_height", 350);
        $navigationType = $sliderParams->get("navigaion_type", "none");
        $isThumbsActive = $navigationType == "thumb" ? true : false;
        $flagReize = $sliderParams->get("php_resize", "none");
        $flagReize = $flagReize == "on" ? true : false;
        //for one slide preview
        if ($this->oneSlideMode == true) {
            $this->filterOneSlide();
        }
        ?>
				<ul>
			<?php 
        foreach ($this->arrSlides as $slide) {
            $slideParams = $slide["params"];
            $transition = $slideParams->get("slide_transition", "random");
            $slotAmount = $slideParams->get("slot_amount", "7");
            //get slide image url
            $urlSlideImage = UniteFunctionsRev::getVal($slide, "image");
            if (empty($urlSlideImage)) {
                $urlSlideImage = GlobalsUniteRev::$urlDefaultSlideImage;
            }
            $urlSlideImage = UniteFunctionJoomlaRev::getImageUrl($urlSlideImage);
            $filenameSlideImage = UniteFunctionJoomlaRev::getImageFilename($urlSlideImage);
            $filepathSlideImage = UniteFunctionJoomlaRev::getImageFilepath($filenameSlideImage);
            //resize the image file with php resize if needed.
            if ($flagReize == true) {
                if (!empty($filenameSlideImage) && file_exists($filepathSlideImage)) {
                    $urlSlideImage = UniteFunctionJoomlaRev::getImageOutputUrl($filenameSlideImage, $slideWidth, $slideHeight, true);
                }
            }
            //get thumb url
            $htmlThumb = "";
            if ($isThumbsActive == true) {
                $urlThumb = $slideParams->get("slide_thumb", "");
                if (empty($urlThumb)) {
                    //try to get resized thumb
                    if (!empty($filenameSlideImage) && file_exists($filepathSlideImage)) {
                        $urlThumb = UniteFunctionJoomlaRev::getImageOutputUrl($filenameSlideImage, $thumbWidth, $thumbHeight, true);
                    }
                }
                //if not - put regular image:
                if (empty($urlThumb)) {
                    $urlThumb = $urlSlideImage;
                }
                $urlThumb = UniteFunctionJoomlaRev::getImageUrl($urlThumb);
                $htmlThumb = 'data-thumb="' . $urlThumb . '" ';
            }
            //get link
            //get link
            $htmlLink = "";
            $enableLink = $slideParams->get("enable_link", "false");
            if ($enableLink == "true") {
                $linkType = $slideParams->get("link_type", "regular");
                switch ($linkType) {
                    //---- normal link
                    default:
                    case "regular":
                        $link = $slideParams->get("link", "");
                        if (!empty($link)) {
                            $linkOpenIn = $slideParams->get("link_open_in", "same");
                            $htmlTarget = "";
                            if ($linkOpenIn == "new") {
                                $htmlTarget = ' data-target="_blank"';
                            }
                            $htmlLink = "data-link=\"{$link}\" {$htmlTarget} ";
                        }
                        break;
                        //---- link to slide
                    //---- link to slide
                    case "slide":
                        $slideLink = $slideParams->get("slide_link");
                        if (!empty($slideLink) && $slideLink != "nothing") {
                            //get slide index from id
                            if (is_numeric($slideLink)) {
                                $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink);
                            }
                            if (!empty($slideLink)) {
                                $htmlLink = "data-link=\"slide\" data-linktoslide=\"{$slideLink}\" ";
                            }
                        }
                        break;
                }
            }
            //set link position:
            $linkPos = $slideParams->get("link_pos", "front");
            if ($linkPos == "back") {
                $htmlLink .= ' data-slideindex="back"';
            }
            //set delay
            $htmlDelay = "";
            $delay = $slideParams->get("delay", "");
            if (!empty($delay) && is_numeric($delay)) {
                $htmlDelay = "data-delay=\"{$delay}\" ";
            }
            //get duration
            $htmlDuration = "";
            $duration = $slideParams->get("transition_duration", "");
            if (!empty($duration) && is_numeric($duration)) {
                $htmlDuration = "data-masterspeed=\"{$duration}\" ";
            }
            //get rotation
            $htmlRotation = "";
            $rotation = $slideParams->get("transition_rotation", "");
            if (!empty($rotation)) {
                $rotation = (int) $rotation;
                if ($rotation != 0) {
                    if ($rotation > 720 && $rotation != 999) {
                        $rotation = 720;
                    }
                    if ($rotation < -720) {
                        $rotation = -720;
                    }
                }
                $htmlRotation = "data-rotate=\"{$rotation}\" ";
            }
            $videoData = $this->getSlideFullWidthVideoData($slideParams);
            $htmlParams = $htmlDuration . $htmlLink . $htmlThumb . $htmlDelay . $htmlRotation;
            //get the alt text
            $altText = $slideParams->get("alt_text");
            if (!empty($altText)) {
                $altText = stripslashes($altText);
                $altText = htmlspecialchars($altText);
            }
            //Html
            ?>
					
					<li data-transition="<?php 
            echo $transition;
            ?>
" data-slotamount="<?php 
            echo $slotAmount;
            ?>
" <?php 
            echo $htmlParams;
            ?>
> 
					    
						<img src="<?php 
            echo $urlSlideImage;
            ?>
" alt="<?php 
            echo $altText;
            ?>
" />
						
						<?php 
            //put video:
            if ($videoData["found"] == true) {
                $this->putFullWidthVideoLayer($videoData);
            }
            $this->putCreativeLayer($slide);
            ?>
					</li>
				<?php 
        }
        //get foreach
        ?>
				</ul>
			<?php 
    }