Exemple #1
0
 function generateOptions(&$xml)
 {
     $this->values = array();
     $html = '';
     foreach ($xml->option as $option) {
         $v = N2XmlHelper::getAttribute($option, 'value');
         $image = N2Uri::pathToUri($v);
         $selected = $this->isSelected($v);
         if ($v != -1) {
             $value = $this->parseValue($image);
             $this->values[] = $value;
             $html .= N2Html::openTag("div", array("class" => "n2-radio-option n2-imagelist-option" . ($selected ? ' n2-active' : '')));
             $ext = pathinfo($image, PATHINFO_EXTENSION);
             if ($ext == 'svg') {
                 $image = 'data:image/svg+xml;base64,' . base64_encode(N2Filesystem::readFile(N2Filesystem::getBasePath() . $v));
             }
             $html .= N2Html::image($image, (string) $option, array('data-image' => $value));
             $html .= N2Html::closeTag("div");
         } else {
             $this->values[] = -1;
             $html .= N2Html::tag("div", array("class" => "n2-radio-option" . ($selected ? ' n2-active' : '')), (string) $option);
         }
     }
     return $html;
 }
Exemple #2
0
 static function render($slider, $id, $params)
 {
     $shadow = $params->get(self::$key . 'shadow-image');
     if (empty($shadow)) {
         $shadow = $params->get(self::$key . 'shadow');
         if ($shadow == -1) {
             $shadow = null;
         }
     }
     if (!$shadow) {
         return '';
     }
     N2JS::addFile(N2Filesystem::translate(dirname(__FILE__) . '/shadow/shadow.js'), $id);
     list($displayClass, $displayAttributes) = self::getDisplayAttributes($params, self::$key);
     list($style, $attributes) = self::getPosition($params, self::$key);
     $width = $params->get(self::$key . 'width');
     if (is_numeric($width) || substr($width, -1) == '%' || substr($width, -2) == 'px') {
         $style .= 'width:' . $width . ';';
     } else {
         $attributes['data-sswidth'] = $width;
     }
     $parameters = array('overlay' => $params->get(self::$key . 'position-mode') != 'simple' || 0, 'area' => intval($params->get(self::$key . 'position-area')));
     N2JS::addInline('new NextendSmartSliderWidgetShadow("' . $id . '", ' . json_encode($parameters) . ');');
     return N2Html::tag('div', $displayAttributes + $attributes + array('class' => $displayClass . "nextend-shadow", 'style' => $style), N2Html::image(N2ImageHelper::fixed($shadow), 'Shadow', array('style' => 'display: block; width:100%;max-width:none;', 'class' => 'n2-ow nextend-shadow-image')));
 }
Exemple #3
0
 private function makeImage($sizes)
 {
     $html = N2Html::image("data:image/svg+xml;base64," . $this->transparentImage($sizes['width'] + $sizes['marginHorizontal'], $sizes['height']), '', array('style' => 'width: 100%; max-width:' . ($this->slider->features->responsive->maximumSlideWidth + $sizes['marginHorizontal']) . 'px;', 'class' => 'n2-ow'));
     if ($sizes['marginVertical'] > 0) {
         $html .= N2Html::image("data:image/svg+xml;base64," . $this->transparentImage($sizes['width'] + $sizes['marginHorizontal'], $sizes['marginVertical']), '', array('style' => 'width: 100%;', 'class' => 'n2-ow'));
     }
     return $html;
 }
Exemple #4
0
 function fetchElement()
 {
     $html = N2Html::tag('div', array('class' => 'n2-form-element-text n2-form-element-icon n2-border-radius'), N2Html::image(N2Image::base64Transparent(), '', array('class' => 'n2-form-element-preview')) . '<a id="' . $this->_id . '_edit" class="n2-form-element-button n2-h5 n2-uc" href="#">' . n2_('Choose') . '</a>' . parent::fetchElement());
     N2JS::addInline('
         new NextendElementIconManager("' . $this->_id . '");
     ');
     return $html;
 }
Exemple #5
0
 static function render($slider, $id, $params)
 {
     $html = '';
     $play = $params->get(self::$key . 'play-image');
     $playColor = $params->get(self::$key . 'play-color');
     if (empty($play)) {
         $play = $params->get(self::$key . 'play');
         if ($play == -1) {
             $play = null;
         } elseif ($play[0] != '$') {
             $play = N2Uri::pathToUri(dirname(__FILE__) . '/image/play/' . $play);
         }
     }
     if ($params->get(self::$key . 'mirror')) {
         $pause = str_replace('image/play/', 'image/pause/', $play);
         $pauseColor = $playColor;
     } else {
         $pause = $params->get(self::$key . 'pause-image');
         $pauseColor = $params->get(self::$key . 'pause-color');
         if (empty($pause)) {
             $pause = $params->get(self::$key . 'pause');
             if ($pause == -1) {
                 $pause = null;
             } elseif ($pause[0] != '$') {
                 $pause = N2Uri::pathToUri(dirname(__FILE__) . '/image/pause/' . $pause);
             }
         }
     }
     $ext = pathinfo($play, PATHINFO_EXTENSION);
     if (substr($play, 0, 1) == '$' && $ext == 'svg') {
         list($color, $opacity) = N2Color::colorToSVG($playColor);
         $play = 'data:image/svg+xml;base64,' . base64_encode(str_replace(array('fill="#FFF"', 'opacity="1"'), array('fill="#' . $color . '"', 'opacity="' . $opacity . '"'), N2Filesystem::readFile(N2ImageHelper::fixed($play, true))));
     } else {
         $play = N2ImageHelper::fixed($play);
     }
     $ext = pathinfo($pause, PATHINFO_EXTENSION);
     if (substr($pause, 0, 1) == '$' && $ext == 'svg') {
         list($color, $opacity) = N2Color::colorToSVG($pauseColor);
         $pause = 'data:image/svg+xml;base64,' . base64_encode(str_replace(array('fill="#FFF"', 'opacity="1"'), array('fill="#' . $color . '"', 'opacity="' . $opacity . '"'), N2Filesystem::readFile(N2ImageHelper::fixed($pause, true))));
     } else {
         $pause = N2ImageHelper::fixed($pause);
     }
     if ($play && $pause) {
         N2CSS::addFile(N2Filesystem::translate(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'image' . DIRECTORY_SEPARATOR . 'style.css'), $id);
         N2JS::addFile(N2Filesystem::translate(dirname(__FILE__) . '/image/autoplay.js'), $id);
         list($displayClass, $displayAttributes) = self::getDisplayAttributes($params, self::$key);
         $styleClass = N2StyleRenderer::render($params->get(self::$key . 'style'), 'heading', $slider->elementId, 'div#' . $slider->elementId . ' ');
         list($style, $attributes) = self::getPosition($params, self::$key);
         N2JS::addInline('new NextendSmartSliderWidgetAutoplayImage("' . $id . '", ' . floatval($params->get(self::$key . 'responsive-desktop')) . ', ' . floatval($params->get(self::$key . 'responsive-tablet')) . ', ' . floatval($params->get(self::$key . 'responsive-mobile')) . ');');
         $html = N2Html::tag('div', $displayAttributes + $attributes + array('class' => $displayClass . $styleClass . 'nextend-autoplay nextend-autoplay-image', 'style' => $style), N2Html::image($play, '', array('class' => 'nextend-autoplay-play n2-ow')) . N2Html::image($pause, '', array('class' => 'nextend-autoplay-pause n2-ow')));
     }
     return $html;
 }
 function generateOptions(&$xml)
 {
     $this->values = array();
     $html = '';
     foreach ($xml->option as $option) {
         $v = N2XmlHelper::getAttribute($option, 'value');
         $image = N2Uri::pathToUri($v);
         $selected = $this->isSelected($this->parseValue($v));
         if ($v != -1) {
             $this->values[] = $this->parseValue($image);
             $html .= N2Html::openTag("div", array("class" => "n2-radio-option n2-imagelist-option" . ($selected ? ' n2-active' : '')));
             $html .= N2Html::image($image, (string) $option);
             $html .= N2Html::closeTag("div");
         } else {
             $this->values[] = -1;
             $html .= N2Html::tag("div", array("class" => "n2-radio-option" . ($selected ? ' n2-active' : '')), (string) $option);
         }
     }
     return $html;
 }
Exemple #7
0
function n2GetBox($class, $image, $html, $hasBorder = true)
{
    echo N2Html::tag('div', array('class' => 'n2-box n2-box-title ' . $class . ($hasBorder ? ' n2-box-border' : '')), N2Html::image(N2ImageHelper::fixed('$ss$/admin/images/' . $image)) . N2Html::tag("div", array('class' => 'n2-box-placeholder'), N2Html::tag("table", array(), N2Html::tag("tr", array(), N2Html::tag("td", array('class' => 'n2-box-button'), $html)))));
}
 /**
  * @param $slider N2SmartSliderAbstract
  * @param $id
  * @param $params
  *
  * @return string
  */
 static function render($slider, $id, $params)
 {
     $showImage = intval($params->get(self::$key . 'show-image'));
     $showTitle = intval($params->get(self::$key . 'title'));
     $showDescription = intval($params->get(self::$key . 'description'));
     if (!$showImage && !$showTitle && !$showDescription) {
         // Nothing to show
         return '';
     }
     N2JS::addFile(N2Filesystem::translate(dirname(__FILE__) . '/default/thumbnail.js'), $id);
     N2LESS::addFile(N2Filesystem::translate(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . 'style.less'), $slider->cacheId, array("sliderid" => $slider->elementId), NEXTEND_SMARTSLIDER_ASSETS . '/less' . NDS);
     list($displayClass, $displayAttributes) = self::getDisplayAttributes($params, self::$key);
     list($style, $attributes) = self::getPosition($params, self::$key);
     $attributes['data-offset'] = $params->get(self::$key . 'position-offset', 0);
     $barStyle = N2StyleRenderer::render($params->get(self::$key . 'style-bar'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ');
     $slideStyle = N2StyleRenderer::render($params->get(self::$key . 'style-slides'), 'dot', $slider->elementId, 'div#' . $slider->elementId . ' ');
     $width = intval($slider->params->get(self::$key . 'width', 160));
     $height = intval($slider->params->get(self::$key . 'height', 100));
     $captionPlacement = $slider->params->get(self::$key . 'caption-placement', 'overlay');
     if (!$showImage) {
         $captionPlacement = 'before';
     }
     if (!$showTitle && !$showDescription) {
         $captionPlacement = 'overlay';
     }
     $captionSize = intval($slider->params->get(self::$key . 'caption-size', 100));
     $showCaption = $showTitle || $showDescription;
     if ($showCaption) {
         $captionStyle = N2StyleRenderer::render($params->get(self::$key . 'title-style'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ');
         if ($showTitle) {
             $titleFont = N2FontRenderer::render($params->get(self::$key . 'title-font'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ');
         }
         if ($showDescription) {
             $descriptionFont = N2FontRenderer::render($params->get(self::$key . 'description-font'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ');
         }
     }
     $group = max(1, intval($params->get(self::$key . 'group')));
     $orientation = self::getOrientationByPosition($params->get(self::$key . 'position-mode'), $params->get(self::$key . 'position-area'), $params->get(self::$key . 'orientation'));
     if ($orientation == 'auto') {
         $orientation = 'vertical';
     }
     $slides = N2Html::openTag('table');
     $containerStyle = '';
     $captionClass = 'n2-caption-' . $captionPlacement;
     $captionExtraStyle = '';
     switch ($captionPlacement) {
         case 'before':
         case 'after':
             switch ($orientation) {
                 case 'vertical':
                     if (!$showImage) {
                         $width = 0;
                     }
                     $containerStyle = "width: " . ($width + $captionSize) . "px; height: {$height}px;";
                     $captionExtraStyle .= "width: {$captionSize}px";
                     break;
                 default:
                     if (!$showImage) {
                         $height = 0;
                     }
                     $containerStyle = "width: {$width}px; height: " . ($height + $captionSize) . "px;";
                     $captionExtraStyle .= "height: {$captionSize}px";
             }
             break;
         default:
             $containerStyle = "width: {$width}px; height: {$height}px;";
     }
     $image = '';
     $rows = array();
     $i = 0;
     foreach ($slider->slides as $slide) {
         $active = '';
         if ($slider->_activeSlide == $i) {
             $active = 'n2-active ';
         }
         if ($orientation == 'horizontal') {
             $row = $i % $group;
         } else {
             $row = intval($i / $group);
         }
         if (!isset($rows[$row])) {
             $rows[$row] = array();
         }
         if ($showImage) {
             $image = N2Html::tag('div', array('class' => 'n2-ss-thumb-image', 'style' => "background-image: URL('" . $slide->getThumbnail() . "'); width: {$width}px; height: {$height}px;"), '');
         }
         $inner = '';
         if ($showCaption) {
             $html = '';
             if ($showTitle) {
                 $html .= N2Html::tag('div', array('class' => $titleFont), $slide->getTitle());
             }
             $description = $slide->getDescription();
             if ($showDescription && !empty($description)) {
                 $html .= N2Html::tag('div', array('class' => $descriptionFont), $description);
             }
             $inner = N2Html::tag('div', array('class' => $captionStyle . 'n2-ss-caption ' . $captionClass, 'style' => $captionExtraStyle), $html);
         }
         switch ($captionPlacement) {
             case 'before':
                 $inner .= $image;
                 break;
             case 'after':
             default:
                 $inner = $image . $inner;
         }
         $rows[$row][] = N2Html::tag('td', array(), N2Html::tag('div', array('class' => $slideStyle . $active, 'style' => $containerStyle), $inner));
         $i++;
     }
     foreach ($rows as $row) {
         $slides .= N2Html::tag('tr', array(), implode('', $row));
     }
     $slides .= N2Html::closeTag('table');
     $parameters = array('overlay' => $params->get(self::$key . 'position-mode') != 'simple' || $params->get(self::$key . 'overlay'), 'area' => intval($params->get(self::$key . 'position-area')), 'orientation' => $orientation, 'group' => $group, 'action' => $params->get(self::$key . 'action'));
     N2JS::addInline('new NextendSmartSliderWidgetThumbnailDefault("' . $id . '", ' . json_encode($parameters) . ');');
     $size = $params->get(self::$key . 'size');
     if ($orientation == 'horizontal') {
         if (is_numeric($size) || substr($size, -1) == '%' || substr($size, -2) == 'px') {
             $style .= 'width:' . $size . ';';
         } else {
             $attributes['data-sswidth'] = $size;
         }
     } else {
         if (is_numeric($size) || substr($size, -1) == '%' || substr($size, -2) == 'px') {
             $style .= 'height:' . $size . ';';
         } else {
             $attributes['data-ssheight'] = $size;
         }
     }
     $previous = $next = '';
     $showArrow = intval($slider->params->get(self::$key . 'arrow', 1));
     if ($showArrow) {
         $previous = N2Html::image('data:image/svg+xml;base64,' . base64_encode(N2Filesystem::readFile(N2ImageHelper::fixed('$ss$/plugins/widgetthumbnail/default/default/thumbnail-up-arrow.svg', true))), '', array('class' => 'nextend-thumbnail-button nextend-thumbnail-previous'));
         $next = N2Html::image('data:image/svg+xml;base64,' . base64_encode(N2Filesystem::readFile(N2ImageHelper::fixed('$ss$/plugins/widgetthumbnail/default/default/thumbnail-down-arrow.svg', true))), '', array('class' => 'nextend-thumbnail-button nextend-thumbnail-next n2-active'));
     }
     if ($params->get(self::$key . 'position-mode') == 'simple' && $orientation == 'vertical') {
         $area = $params->get(self::$key . 'position-area');
         switch ($area) {
             case '5':
             case '6':
             case '7':
             case '8':
                 $attributes['data-sstop'] = '0';
                 break;
         }
     }
     return N2Html::tag('div', $displayAttributes + $attributes + array('class' => $displayClass . 'nextend-thumbnail nextend-thumbnail-default nextend-thumbnail-' . $orientation, 'style' => $style), $previous . $next . N2Html::tag('div', array('class' => 'nextend-thumbnail-inner'), N2Html::tag('div', array('class' => $barStyle . 'nextend-thumbnail-scroller'), $slides)));
 }
 private static function getHTML($id, &$params, $animation, $side, $image, $displayClass, $displayAttributes, $styleClass, $color = 'ffffffcc', $hover = 0, $hoverColor = 'ffffffcc')
 {
     list($style, $attributes) = self::getPosition($params, self::$key . $side . '-');
     $imageHover = null;
     $ext = pathinfo($image, PATHINFO_EXTENSION);
     if (substr($image, 0, 1) == '$' && $ext == 'svg') {
         list($color, $opacity) = N2Color::colorToSVG($color);
         $content = N2Filesystem::readFile(N2ImageHelper::fixed($image, true));
         $image = 'data:image/svg+xml;base64,' . base64_encode(str_replace(array('fill="#FFF"', 'opacity="1"'), array('fill="#' . $color . '"', 'opacity="' . $opacity . '"'), $content));
         if ($hover) {
             list($color, $opacity) = N2Color::colorToSVG($hoverColor);
             $imageHover = 'data:image/svg+xml;base64,' . base64_encode(str_replace(array('fill="#FFF"', 'opacity="1"'), array('fill="#' . $color . '"', 'opacity="' . $opacity . '"'), $content));
         }
     } else {
         $image = N2ImageHelper::fixed($image);
     }
     if ($imageHover === null) {
         $image = N2Html::image($image, 'arrow');
     } else {
         $image = N2Html::image($image, 'arrow', array('class' => 'n2-arrow-normal-img')) . N2Html::image($imageHover, 'arrow', array('class' => 'n2-arrow-hover-img'));
     }
     if ($animation == 'none' || $animation == 'fade') {
         return N2Html::tag('div', $displayAttributes + $attributes + array('id' => $id . '-arrow-' . $side, 'class' => $displayClass . $styleClass . 'nextend-arrow n2-ib nextend-arrow-' . $side . '  nextend-arrow-animated-' . $animation, 'style' => $style), $image);
     }
     return N2Html::tag('div', $displayAttributes + $attributes + array('id' => $id . '-arrow-' . $side, 'class' => $displayClass . 'nextend-arrow n2-ib nextend-arrow-animated nextend-arrow-animated-' . $animation . ' nextend-arrow-' . $side, 'style' => $style), N2Html::tag('div', array('class' => $styleClass . ' n2-resize'), $image) . N2Html::tag('div', array('class' => $styleClass . ' n2-active n2-resize'), $image));
 }
 private function stretch($backgroundColor, $backgroundImageOpacity, $src, $imageData, $alt, $title)
 {
     $deviceAttributes = $this->getDeviceAttributes($src, $imageData);
     return N2Html::tag('div', $deviceAttributes + array("style" => $backgroundColor, "class" => "n2-ss-slide-background", "data-opacity" => $backgroundImageOpacity), N2Html::image($this->getDefaultImage($src, $deviceAttributes), $alt, array("title" => $title, "style" => 'opacity:' . $backgroundImageOpacity . ';', "class" => "n2-ss-slide-background-image n2-ss-slide-stretch")));
 }
Exemple #11
0
 public function _renderGroupOption($group, $sources)
 {
     $options = array();
     foreach ($sources as $type => $info) {
         /**
          * @var $info N2GeneratorInfo
          */
         $options[$type] = $info->title;
         if ($info->hasConfiguration) {
             $button = N2Html::link("Next", $this->appType->router->createUrl(array("generator/checkConfiguration", array("sliderid" => N2Request::getInt('sliderid'), "group" => $group))), array("onclick" => "var el = n2(this); el.attr('href', el.attr('href') + '&type='+el.parents('.n2-box-placeholder').find('select').val());", "class" => "n2-button n2-button-small n2-button-blue"));
         } elseif (!$info->installed) {
             $button = N2Html::link("Check extension", $info->readMore, array("target" => "_blank", "class" => "n2-button n2-button-small n2-button-grey"));
         } else {
             $button = N2Html::link("Next", $this->appType->router->createUrl(array("generator/createSettings", array("sliderid" => N2Request::getInt('sliderid'), "group" => $group))), array("onclick" => "var el = n2(this); el.attr('href', el.attr('href') + '&type='+el.parents('.n2-box-placeholder').find('select').val());", "class" => "n2-button n2-button-small n2-button-blue"));
         }
     }
     $optionsHTML = '';
     foreach ($options as $k => $v) {
         $optionsHTML .= N2Html::tag('option', array('value' => $k), $v);
     }
     echo N2Html::tag('div', array('class' => 'n2-box'), N2Html::image(N2Uri::pathToUri(N2Filesystem::translate($info->path . '/../dynamic.png'))) . N2Html::tag("div", array('class' => 'n2-box-placeholder'), N2Html::tag("table", array(), N2Html::tag("tr", array(), N2Html::tag("td", array('class' => 'n2-box-label'), N2Html::tag('select', array('name' => 'generator-type'), $optionsHTML)) . N2Html::tag("td", array('class' => 'n2-box-button'), $button)))));
 }
Exemple #12
0
                        if (n2.hasClass('n2-sidebar-hidden')) {
                            n2.removeClass('n2-sidebar-hidden');
                        } else {
                            n2.addClass('n2-sidebar-hidden');
                        }
                        $(window).trigger('resize');
                    });
        }
    );
</script>

<?php 
echo N2Html::openTag('div', array('class' => 'n2-table n2-table-fixed'));
echo N2Html::openTag('div', array('class' => 'n2-tr'));
if (!empty($logoUrl)) {
    echo N2Html::tag('div', array('class' => 'n2-td n2-blue-logo-bg n2-logo n2-border-radius-tl'), N2Html::tag('a', array('href' => $logoUrl), N2Html::image($logoImageUrl)));
}
?>
<div class="n2-td n2-blue-bg n2-header n2-border-radius-tr">
    <?php 
if (isset($actions) && count($actions)) {
    ?>
        <div class="n2-header-action n2-left">
            <?php 
    foreach ($actions as $action) {
        echo $action;
    }
    ?>
        </div>
    <?php 
}