Example #1
0
 function fetchElement()
 {
     $this->value = $this->getValue();
     $html = N2Html::tag('div', array('class' => 'n2-form-element-checkbox', 'style' => N2XmlHelper::getAttribute($this->_xml, 'style')), $this->generateOptions($this->_xml) . parent::fetchElement());
     N2JS::addInline('new NextendElementCheckbox("' . $this->_id . '", ' . json_encode($this->values) . ');');
     return $html;
 }
Example #2
0
 function renderSelector()
 {
     $html = '<div style="display: none;">';
     $html .= parent::renderSelector();
     $html .= '</div>';
     foreach ($this->_list as $k => $path) {
         $html .= $this->getOptionHtml($path, $k);
     }
     N2JS::addInline('
     new NextendElementSubform(
            "' . $this->_id . '",
            "nextend-' . $this->_name . '-panel",
            "' . $this->_tab->_name . '",
            "' . $this->getValue() . '"
         );
     ');
     N2JS::addInline('
     new NextendElementSubformImage(
           "' . $this->_id . '",
           "' . $this->_id . '_options"
         );
     ');
     $GLOBALS['nextend-' . $this->_name . '-panel'] = $this->renderForm();
     if (count($this->_list) <= 1) {
         $this->_xml->addAttribute('class', 'n2-hidden');
         $this->_tab->_hide = true;
     }
     return N2Html::tag('div', array('class' => 'n2-subform-image ' . $this->getClass(), 'id' => $this->_id . '_options'), $html);
 }
Example #3
0
 function _render($data, $itemId, $slider, $slide)
 {
     /**
      * @var $data N2Data
      */
     $data->fillDefault(array('image' => '', 'start' => 0, 'volume' => -1, 'autoplay' => 0, 'controls' => 1, 'center' => 0, 'loop' => 0, 'theme' => 'dark', 'related' => 0, 'vq' => 'default'));
     $rawYTUrl = $slide->fill($data->get('youtubeurl', ''));
     $url_parts = parse_url($rawYTUrl);
     if (!empty($url_parts['query'])) {
         parse_str($url_parts['query'], $query);
         if (isset($query['v'])) {
             unset($query['v']);
         }
         $data->set("query", $query);
     }
     $youTubeUrl = $this->parseYoutubeUrl($rawYTUrl);
     $start = $slide->fill($data->get('start', ''));
     $data->set("youtubecode", $youTubeUrl);
     $data->set("start", $start);
     $style = '';
     $hasImage = 0;
     $image = $data->get('image');
     $playImage = '';
     if (!empty($image)) {
         $style = 'cursor:pointer; background: url(' . N2ImageHelper::fixed($data->get('image')) . ') no-repeat 50% 50%; background-size: cover';
         $hasImage = 1;
         $playImage = '<img class="n2-video-play n2-ow" src="' . N2ImageHelperAbstract::SVGToBase64('$ss$/images/play.svg') . '"/>';
     }
     N2JS::addInline('window["' . $slider->elementId . '"].ready(function(){
         new NextendSmartSliderYouTubeItem(this, "' . $itemId . '", ' . $data->toJSON() . ', ' . $hasImage . ');
     });');
     return N2Html::tag('div', array('id' => $itemId, 'style' => 'position: absolute; top: 0; left: 0; width: 100%; height: 100%;' . $style), $playImage);
 }
Example #4
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')));
 }
Example #5
0
 function fetchElement()
 {
     $min = N2XmlHelper::getAttribute($this->_xml, 'min');
     if ($min == '') {
         $min = '-Number.MAX_VALUE';
     }
     $max = N2XmlHelper::getAttribute($this->_xml, 'max');
     if ($max == '') {
         $max = 'Number.MAX_VALUE';
     }
     N2JS::addInline('new NextendElementNumber("' . $this->_id . '", ' . $min . ', ' . $max . ');');
     $html = N2Html::openTag('div', array('class' => 'n2-form-element-text ' . $this->getClass() . ($this->_xml->unit ? 'n2-text-has-unit ' : '') . 'n2-border-radius', 'style' => $this->fieldType == 'hidden' ? 'display: none;' : ''));
     $subLabel = N2XmlHelper::getAttribute($this->_xml, 'sublabel');
     if ($subLabel) {
         $html .= N2Html::tag('div', array('class' => 'n2-text-sub-label n2-h5 n2-uc'), n2_($subLabel));
     }
     $html .= $this->pre();
     $html .= N2Html::tag('input', array('type' => $this->fieldType, 'id' => $this->_id, 'name' => $this->_inputname, 'value' => $this->_form->get($this->_name, $this->_default), 'class' => 'n2-h5', 'style' => $this->getStyle(), 'autocomplete' => 'off'), false);
     $html .= $this->post();
     if ($this->_xml->unit) {
         $html .= N2Html::tag('div', array('class' => 'n2-text-unit n2-h5 n2-uc'), n2_((string) $this->_xml->unit));
     }
     $html .= "</div>";
     return $html;
 }
Example #6
0
 /**
  * @param $slider N2SmartSliderAbstract
  * @param $id
  * @param $params
  *
  * @return string
  */
 static function render($slider, $id, $params)
 {
     N2CSS::addFile(N2Filesystem::translate(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'horizontal' . DIRECTORY_SEPARATOR . 'style.css'), $id);
     N2JS::addFile(N2Filesystem::translate(dirname(__FILE__) . '/horizontal/bar.js'), $id);
     list($displayClass, $displayAttributes) = self::getDisplayAttributes($params, self::$key);
     $styleClass = N2StyleRenderer::render($params->get(self::$key . 'style'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ');
     $fontTitle = N2FontRenderer::render($params->get(self::$key . 'font-title'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ', $slider->fontSize);
     $fontDescription = N2FontRenderer::render($params->get(self::$key . 'font-description'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ', $slider->fontSize);
     list($style, $attributes) = self::getPosition($params, self::$key);
     $attributes['data-offset'] = $params->get(self::$key . 'position-offset');
     $style .= 'text-align: ' . $params->get(self::$key . 'align') . ';';
     $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;
     }
     $innerStyle = '';
     if (!$params->get(self::$key . 'full-width')) {
         $innerStyle = 'display: inline-block;';
     }
     $separator = $params->get(self::$key . 'separator');
     $showDescription = intval($params->get(self::$key . 'show-description'));
     $slides = array();
     for ($i = 0; $i < count($slider->slides); $i++) {
         $slides[$i] = N2Html::tag('span', array('class' => $fontTitle), $slider->slides[$i]->getTitle());
         $description = $slider->slides[$i]->getDescription();
         if ($showDescription && !empty($description)) {
             $slides[$i] .= N2Html::tag('span', array('class' => $fontDescription), $separator . $description);
         }
     }
     $parameters = array('overlay' => $params->get(self::$key . 'position-mode') != 'simple' || $params->get(self::$key . 'overlay'), 'area' => intval($params->get(self::$key . 'position-area')), 'animate' => intval($params->get(self::$key . 'animate')));
     N2JS::addInline('new NextendSmartSliderWidgetBarHorizontal("' . $id . '", ' . json_encode($slides) . ', ' . json_encode($parameters) . ');');
     return N2Html::tag("div", $displayAttributes + $attributes + array("class" => $displayClass . "nextend-bar nextend-bar-horizontal", "style" => $style), N2Html::tag("div", array("class" => $styleClass, "style" => $innerStyle), $slides[$slider->_activeSlide]));
 }
 function fetchElement()
 {
     $values = explode('|*|', $this->getValue());
     if (!isset($values[6]) || $values[6] == '') {
         $values[6] = 1;
     }
     $values[6] = intval($values[6]);
     $this->_form->set($this->_name, implode('|*|', $values));
     $mode = $this->_xml->addChild('param');
     $mode->addAttribute('name', $this->_name . '-mode');
     $mode->addAttribute('type', 'switcher');
     $mode->addAttribute('label', 'Mode');
     $mode->addAttribute('default', 'simple');
     $mode->addAttribute('translateable', '1');
     $mode->addAttribute('class', 'n2-expert');
     $mode->addAttribute('post', 'break');
     $simple = $mode->addChild('unit', 'Simple');
     $simple->addAttribute('value', 'simple');
     $advanced = $mode->addChild('unit', 'Advanced');
     $advanced->addAttribute('value', 'advanced');
     $this->addSimple();
     $this->addAdvanced();
     N2JS::addInline('new NextendElementWidgetPosition("' . $this->_id . '");');
     return parent::fetchElement();
 }
Example #8
0
 public static function show()
 {
     N2Localization::addJS(array('Show only errors', 'There are no messages to display.', 'Got it!', 'error', 'success', 'notice'));
     self::loadSessionError();
     if (is_array(self::$error) && count(self::$error)) {
         foreach (self::$error as $error) {
             N2JS::addInline("nextend.notificationCenter.error(" . json_encode($error[0]) . ", " . json_encode($error[1]) . ");");
         }
         self::$error = array();
     }
     self::loadSessionSuccess();
     if (is_array(self::$success) && count(self::$success)) {
         foreach (self::$success as $success) {
             N2JS::addInline("nextend.notificationCenter.success(" . json_encode($success[0]) . ", " . json_encode($success[1]) . ");");
         }
         self::$success = array();
     }
     self::loadSessionNotice();
     if (is_array(self::$notice) && count(self::$notice)) {
         foreach (self::$notice as $notice) {
             N2JS::addInline("nextend.notificationCenter.notice(" . json_encode($notice[0]) . ", " . json_encode($notice[1]) . ");");
         }
         self::$notice = array();
     }
     self::$flushed = true;
 }
Example #9
0
 public static function init()
 {
     $parameters = array('siteKeywords' => self::$siteKeywords, 'imageUrls' => self::$imageUrls, 'protocolRelative' => self::$protocolRelative);
     $parameters['placeholderImage'] = '$system$/images/placeholder/image.png';
     $parameters['placeholderRepeatedImage'] = '$system$/images/placeholder/image.png';
     N2JS::addFirstCode('new NextendImageHelper(' . json_encode($parameters) . ', ' . N2ImageHelper::getLightboxFunction() . ',' . N2ImageHelper::getLightboxMultipleFunction() . ', ' . N2ImageHelper::getLightboxFoldersFunction() . ');');
 }
Example #10
0
 function fetchElement()
 {
     $html = parent::fetchElement();
     $html .= '<a id="' . $this->_id . '_manage" class="n2-button n2-button-medium n2-button-grey n2-h5 n2-uc n2-expert" href="#">' . n2_('Manage') . '</a>';
     N2JS::addInline('new NextendElementImageManager("' . $this->_id . '", {});');
     return $html;
 }
Example #11
0
    function render($control_name)
    {
        $this->initTabs();
        $id = 'n2-form-matrix-' . $this->_name;
        $active = intval(N2XmlHelper::getAttribute($this->_xml, 'active'));
        $active = $active > 0 ? $active - 1 : 0;
        $underlined = N2XmlHelper::getAttribute($this->_xml, 'underlined');
        $classes = N2XmlHelper::getAttribute($this->_xml, 'classes');
        ?>

        <div id="<?php 
        echo $id;
        ?>
" class="n2-form-tab n2-form-matrix">
            <div
                class="n2-h2 n2-content-box-title-bg n2-form-matrix-views <?php 
        echo $classes;
        ?>
">
                <?php 
        $i = 0;
        $class = ($underlined ? 'n2-underline' : '') . ' n2-h4 n2-uc n2-has-underline n2-form-matrix-menu';
        foreach ($this->_tabs as $tabName => $tab) {
            echo N2Html::tag("div", array("class" => $class . ($i == $active ? ' n2-active' : '') . ' n2-fm-' . $tabName), N2Html::tag("span", array("class" => "n2-underline"), n2_(N2XmlHelper::getAttribute($tab->_xml, 'label'))));
            $i++;
        }
        ?>
            </div>

            <div class="n2-tabs">
                <?php 
        $i = 0;
        foreach ($this->_tabs as $tabName => $tab) {
            echo N2Html::openTag('div', array('class' => 'n2-form-matrix-pane' . ($i == $active ? ' n2-active' : '') . ' n2-fm-' . $tabName));
            $tab->render($control_name);
            echo N2Html::closeTag('div');
            $i++;
        }
        ?>
            </div>
        </div>

        <?php 
        N2JS::addInline('
            (function(){
                var matrix = $("#' . $id . '"),
                    views = matrix.find("> .n2-form-matrix-views > div"),
                    panes = matrix.find("> .n2-tabs > div");
                views.on("click", function(){
                    views.removeClass("n2-active");
                    panes.removeClass("n2-active");
                    var i = views.index(this);
                    views.eq(i).addClass("n2-active");
                    panes.eq(i).addClass("n2-active");
                });
            })()
        ');
        ?>
    <?php 
    }
Example #12
0
 function fetchElement()
 {
     N2JS::addInline('new NextendElementRichText("' . $this->_id . '");');
     $tools = array(N2Html::tag('div', array('class' => 'n2-textarea-rich-bold'), N2Html::tag('I', array('class' => 'n2-i n2-it n2-i-bold'))), N2Html::tag('div', array('class' => 'n2-textarea-rich-italic'), N2Html::tag('I', array('class' => 'n2-i n2-it n2-i-italic'))), N2Html::tag('div', array('class' => 'n2-textarea-rich-link'), N2Html::tag('I', array('class' => 'n2-i n2-it n2-i-link'))));
     $rich = N2Html::tag('div', array('class' => 'n2-textarea-rich'), implode('', $tools));
     return N2Html::tag('div', array('class' => 'n2-form-element-textarea n2-form-element-rich-textarea n2-border-radius', 'style' => N2XmlHelper::getAttribute($this->_xml, 'style')), $rich . N2Html::tag('textarea', array('id' => $this->_id, 'name' => $this->_inputname, 'class' => 'n2 - h5', 'autocomplete' => 'off', 'style' => N2XmlHelper::getAttribute($this->_xml, 'style2')), $this->_form->get($this->_name, $this->_default)));
 }
Example #13
0
 private static function initOnce()
 {
     static $init;
     if (!$init) {
         N2JS::addInline('$(".n2-button-menu-open").n2opener();');
         $init = true;
     }
 }
Example #14
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;
 }
 public function initialize()
 {
     parent::initialize();
     N2JS::addFirstCode('window.ss2lang = {};');
     N2Loader::import(array('models.GroupStorage', 'models.License', 'models.Update'), 'smartslider');
     N2JS::addInline("new NextendSmartSliderCreateSlider('" . $this->appType->router->createUrl(array('slider/create')) . "');");
     N2Localization::addJS(array('Create Slider', 'Slider name', 'Slider', 'Width', 'Height', 'Create', 'Preset', 'Default', 'Full width', 'Full page', 'Block', 'Thumbnail - horizontal', 'Thumbnail - vertical', 'Caption', 'Horizontal accordion', 'Vertical accordion', 'Showcase', 'Saved slide'));
 }
Example #16
0
 function fetchElement()
 {
     $html = "<div class='n2-form-element-onoff " . $this->isOn() . "' style='" . N2XmlHelper::getAttribute($this->_xml, 'style') . "'>";
     $html .= N2Html::tag('div', array('class' => 'n2-onoff-slider'), N2Html::tag('div', array('class' => 'n2-onoff-no'), '<i class="n2-i n2-i-close"></i>') . N2Html::tag('div', array('class' => 'n2-onoff-round')) . N2Html::tag('div', array('class' => 'n2-onoff-yes'), '<i class="n2-i n2-i-tick"></i>'));
     $html .= parent::fetchElement();
     $html .= "</div>";
     N2JS::addInline('new NextendElementOnoff("' . $this->_id . '");');
     return $html;
 }
Example #17
0
 function fetchElement()
 {
     $html = parent::fetchElement();
     $fontSettings = N2Fonts::loadSettings();
     $families = explode("\n", $fontSettings['preset-families']);
     sort($families);
     N2JS::addInline('new NextendElementAutocompleteSimple("' . $this->_id . '", ' . json_encode($families) . ');');
     return $html;
 }
Example #18
0
    protected function renderType()
    {
        $params = $this->slider->params;
        N2JS::addFiles(N2Filesystem::translate(dirname(__FILE__) . "/gsap"), array("MainAnimationSimple.js", "TypeSimple.js", "ResponsiveSimple.js"), "smartslider-simple-type-frontend");
        N2JS::addFiles(N2Filesystem::translate(dirname(__FILE__) . "/gsap"), array("BackgroundAnimation.js"), "smartslider-simple-type-frontend");
        N2JS::addFiles(NEXTEND_SMARTSLIDER_ASSETS . "/js/animation", array("BackgroundAnimationAbstract.js", 'Flux.js'), "smartslider-simple-type-frontend");
        $background = $params->get('background');
        $css = $params->get('slider-css');
        $slidecss = $params->get('slide-css');
        if (!empty($background)) {
            $css = 'background-image: url(' . N2ImageHelper::fixed($background) . ');';
        }
        $this->initBackgroundAnimation();
        echo $this->openSliderElement();
        ?>

        <div class="n2-ss-slider-1" style="<?php 
        echo $css;
        ?>
">
            <?php 
        echo $this->getBackgroundVideo($params);
        ?>
            <div class="n2-ss-slider-2">
                <?php 
        if ($this->backgroundAnimation) {
            ?>
                    <div class="n2-ss-background-animation"></div>
                <?php 
        }
        ?>
                <div class="n2-ss-slider-3" style="<?php 
        echo $slidecss;
        ?>
">

                    <?php 
        echo $this->slider->staticHtml;
        foreach ($this->slider->slides as $i => $slide) {
            echo N2Html::tag('div', $slide->attributes + array('class' => 'n2-ss-slide n2-ss-canvas ' . $slide->classes, 'style' => $slide->style), $slide->background . $slide->getHTML());
        }
        ?>
                </div>
            </div>
        </div>
        <?php 
        $this->widgets->echoRemainder();
        echo N2Html::closeTag('div');
        $this->javaScriptProperties['mainanimation'] = array('type' => $params->get('animation'), 'duration' => intval($params->get('animation-duration')), 'delay' => intval($params->get('animation-delay')), 'ease' => $params->get('animation-easing'), 'parallax' => floatval($params->get('animation-parallax')), 'shiftedBackgroundAnimation' => $params->get('animation-shifted-background-animation'));
        $this->javaScriptProperties['mainanimation']['shiftedBackgroundAnimation'] = 0;
        $this->javaScriptProperties['carousel'] = intval($params->get('carousel'));
        $this->javaScriptProperties['dynamicHeight'] = intval($params->get('dynamic-height', '0'));
        $this->javaScriptProperties['dynamicHeight'] = 0;
        N2Plugin::callPlugin('nextendslider', 'onNextendSliderProperties', array(&$this->javaScriptProperties));
        N2JS::addFirstCode("new NextendSmartSliderSimple('#{$this->slider->elementId}', " . json_encode($this->javaScriptProperties) . ");");
        echo N2Html::clear();
    }
Example #19
0
 function renderSelector()
 {
     N2JS::addInline('
     new NextendElementSliderType(
           "' . $this->_id . '"
         );
     ');
     return parent::renderSelector();
 }
Example #20
0
 function fetchElement()
 {
     if (N2XmlHelper::getAttribute($this->_xml, 'alpha') == 1) {
         $this->alpha = 1;
     }
     $html = parent::fetchElement();
     N2JS::addInline('new NextendElementColor("' . $this->_id . '", ' . $this->alpha . ');');
     return $html;
 }
Example #21
0
 function fetchElement()
 {
     N2Localization::addJS('Done');
     if (N2XmlHelper::getAttribute($this->_xml, 'fixed')) {
         $this->fixedMode = true;
     }
     $html = parent::fetchElement();
     N2JS::addInline('new NextendElementSkin("' . $this->_id . '", "' . str_replace($this->_name, '', $this->_id) . '", ' . json_encode($this->skins) . ', ' . json_encode($this->fixedMode) . ');');
     return $html;
 }
Example #22
0
 function fetchElement()
 {
     N2JS::addInline('new NextendElementFont("' . $this->_id . '", {
         previewmode: "' . N2XmlHelper::getAttribute($this->_xml, 'previewmode') . '",
         style: "' . N2XmlHelper::getAttribute($this->_xml, 'style') . '",
         style2: "' . N2XmlHelper::getAttribute($this->_xml, 'style2') . '",
         preview: ' . json_encode((string) $this->_xml) . ',
         set: "' . N2XmlHelper::getAttribute($this->_xml, 'set') . '"
     });');
     return N2Html::tag('div', array('class' => 'n2-form-element-option-chooser n2-border-radius'), parent::fetchElement() . N2Html::tag('input', array('type' => 'text', 'class' => 'n2-h5', 'style' => 'width: 130px;' . N2XmlHelper::getAttribute($this->_xml, 'css'), 'disabled' => 'disabled'), false) . N2Html::tag('a', array('href' => '#', 'class' => 'n2-form-element-clear'), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-empty n2-i-grey-opacity'), '')) . N2Html::tag('a', array('href' => '#', 'class' => 'n2-form-element-button n2-h5 n2-uc'), n2_('Font')));
 }
Example #23
0
 public function render($xmlpath, $data)
 {
     N2Loader::import('libraries.form.form');
     $form = new N2Form(N2Base::getApplication('smartslider')->getApplicationType('backend'));
     $form->loadArray($data);
     $form->loadXMLFile($xmlpath);
     echo $form->render('settings');
     N2JS::addFirstCode('
         new NextendForm("smartslider-form", ' . json_encode($form->_data) . ', null, "' . N2Filesystem::toLinux(N2Filesystem::pathToRelativePath($xmlpath)) . '", "settings", "' . N2Uri::ajaxUri('nextend', 'smartslider') . '");
     ');
 }
 public function assetsBackend()
 {
     $path = $this->getAssetsPath();
     N2JS::addFiles($path . "/admin/js", array("visual.js", "modals.js", "sets.js", "visualeditor.js"), 'system-backend');
     foreach (glob($path . "/admin/js/*.js") as $file) {
         N2JS::addFile($file, 'system-backend');
     }
     foreach (glob($path . "/admin/js/fontservices/*.js") as $file) {
         N2JS::addFile($file, 'system-backend');
     }
 }
Example #25
0
 public function renderGlobalConfigurationForm()
 {
     $values = N2Settings::getAll();
     $form = new N2Form($this->appType);
     $form->loadArray($values);
     $form->loadXMLFile(N2Loader::getPath('models', 'system') . '/forms/globalconfig.xml');
     echo N2Html::openTag("form", array("id" => "nextend-config", "method" => "post", "action" => N2Request::getRequestUri()));
     $form->render('global');
     echo N2Html::closeTag("form");
     N2JS::addFirstCode("\n            new NextendForm(\n                'nextend-config',\n                '" . $this->appType->router->createAjaxUrl(array('settings/index')) . "',\n                " . json_encode($values) . "\n            );\n        ");
 }
Example #26
0
function N2JoomlaExit()
{
    if (N2Platform::$isAdmin) {
        $lifetime = JFactory::getConfig()->get('lifetime');
        if (empty($lifetime)) {
            $lifetime = 60;
        }
        $lifetime = min(max(intval($lifetime) - 1, 9), 60 * 24);
        N2JS::addInline('setInterval(function(){$.ajax({url: "' . JURI::current() . '", cache: false});}, ' . $lifetime * 60 * 1000 . ');');
    }
}
Example #27
0
 private static function init()
 {
     static $inited = false;
     if (!$inited) {
         N2JS::addInline('
         window.n2Scroll = {
             to: function(top){
                 n2("html, body").animate({ scrollTop: top }, 400);
             },
             top: function(){
                 n2Scroll.to(0);
             },
             bottom: function(){
                 n2Scroll.to(n2(document).height() - n2(window).height());
             },
             before: function(el){
                 n2Scroll.to(el.offset().top - n2(window).height());
             },
             after: function(el){
                 n2Scroll.to(el.offset().top + el.height());
             },
             next: function(el, selector){
                 var els = n2(selector),
                     nextI = -1;
                 els.each(function(i, slider){
                     if(n2(el).is(slider) || n2.contains(slider, el)){
                         nextI = i + 1;
                         return false;
                     }
                 });
                 if(nextI != -1 && nextI <= els.length){
                     n2Scroll.element(els.eq(nextI));
                 }
             },
             previous: function(el, selector){
                 var els = n2(selector),
                     prevI = -1;
                 els.each(function(i, slider){
                     if(n2(el).is(slider) || n2.contains(slider, el)){
                         prevI = i - 1;
                         return false;
                     }
                 });
                 if(prevI >= 0){
                     n2Scroll.element(els.eq(prevI));
                 }
             },
             element: function(selector){
                 n2Scroll.to(n2(selector).offset().top);
             }
         };');
         $inited = true;
     }
 }
Example #28
0
 function fetchElement()
 {
     $areas = '';
     for ($i = 1; $i <= 12; $i++) {
         $areas .= N2Html::tag('div', array('class' => 'n2-area n2-area-' . $i . $this->isSelected($i), 'data-area' => $i));
     }
     $html = N2Html::tag('div', array('id' => $this->_id . '_area', 'class' => 'n2-widget-area'), N2Html::tag('div', array('class' => 'n2-widget-area-inner')) . $areas);
     $html .= parent::fetchElement();
     N2JS::addInline('new NextendElementSliderWidgetArea("' . $this->_id . '");');
     return $html;
 }
Example #29
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;
 }
Example #30
0
 function fetchElement()
 {
     $html = parent::fetchElement();
     $options = array();
     if (count($this->_xml->option)) {
         foreach ($this->_xml->option as $option) {
             $options[] = (string) $option;
         }
     }
     N2JS::addInline('new NextendElementAutocomplete("' . $this->_id . '", ' . json_encode($options) . ');');
     return $html;
 }