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; }
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); }
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; }
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(); }
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; }
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))); }
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'))); }
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; }
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 }
/** * @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 _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); }
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')); }
private static function initOnce() { static $init; if (!$init) { N2JS::addInline('$(".n2-button-menu-open").n2opener();'); $init = true; } }
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; }
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; }
function renderSelector() { N2JS::addInline(' new NextendElementSliderType( "' . $this->_id . '" ); '); return parent::renderSelector(); }
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; }
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; }
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 . ');'); } }
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; }
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; } }
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'))); }
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 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; }
function fetchElement() { $widgetTypes = $this->getOptions(); $id = 'n2-form-matrix-' . $this->_id; $html = N2Html::openTag("div", array('id' => $id, "class" => "n2-form-matrix")); $value = $this->getValue(); $test = false; foreach ($widgetTypes as $type => $v) { if ($value == $type) { $test = true; break; } } if (!$test) { $value = 'arrow'; } $html .= N2Html::openTag('div', array('class' => 'n2-h2 n2-content-box-title-bg n2-form-matrix-views')); $class = 'n2-underline n2-h4 n2-uc n2-has-underline n2-form-matrix-menu'; foreach ($widgetTypes as $type => $v) { $html .= N2Html::tag("div", array("onclick" => "n2('#{$this->_id}').val('{$type}');", "class" => $class . ($value == $type ? ' n2-active' : '')), N2Html::tag("span", array("class" => "n2-underline"), $v[0])); } $html .= N2Html::closeTag("div"); $html .= N2Html::openTag("div", array("class" => "n2-tabs")); foreach ($widgetTypes as $type => $v) { $html .= N2Html::openTag('div', array('class' => 'n2-form-matrix-pane' . ($value == $type ? ' n2-active' : ''))); $GLOBALS['nextendbuffer'] = ''; $form = new N2Form($this->_form->appType); $form->_data =& $this->_form->_data; $form->loadXMLFile($v[1] . 'config.xml'); ob_start(); $form->render($this->control_name); $html .= ob_get_clean(); $html .= $GLOBALS['nextendbuffer']; $html .= N2Html::closeTag("div"); } $html .= N2Html::closeTag("div"); $html .= N2Html::closeTag("div"); 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"); }); })() '); return $html . parent::fetchElement(); }
function fetchElement() { $preview = preg_replace_callback('/url\\(\'(.*?)\'\\)/', 'N2ElementStyle::fixPreviewImages', (string) $this->_xml); N2JS::addInline('new NextendElementStyle("' . $this->_id . '", { previewmode: "' . N2XmlHelper::getAttribute($this->_xml, 'previewmode') . '", font: "' . N2XmlHelper::getAttribute($this->_xml, 'font') . '", font2: "' . N2XmlHelper::getAttribute($this->_xml, 'font2') . '", style2: "' . N2XmlHelper::getAttribute($this->_xml, 'style2') . '", preview: ' . json_encode($preview) . ', 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_('Style'))); }
function _render($data, $itemId, $slider, $slide) { $data->set("vimeocode", preg_replace('/\\D/', '', $slide->fill($data->get("vimeourl")))); $style = ''; $hasImage = 0; $image = $data->get('image'); if (!empty($image)) { $style = 'cursor:pointer; background: url(' . N2ImageHelper::fixed($data->get('image')) . ') no-repeat 50% 50%; background-size: cover'; $hasImage = 1; } N2JS::addInline('window["' . $slider->elementId . '"].ready(function() { var vimeo = new NextendSmartSliderVimeoItem(this, "' . $itemId . '", "' . $slider->elementId . '", ' . $data->toJSON() . ', ' . $hasImage . '); }); '); return N2Html::tag('div', array('id' => $itemId, 'style' => 'position: absolute; top: 0; left: 0; width: 100%; height: 100%;' . $style)); }
function fetchElement() { $values = array(); $html = "<div class='n2-form-element-switcher' style='" . N2XmlHelper::getAttribute($this->_xml, 'style') . "'>"; $i = 0; $units = count($this->_xml->unit) - 1; $currentValue = $this->getValue(); foreach ($this->_xml->unit as $unit) { $value = (string) $unit->attributes()->value; $values[] = $value; $html .= N2Html::tag('div', array('class' => 'n2-switcher-unit n2-h5 n2-uc ' . ($value == $currentValue ? 'n2-active ' : '') . ($i == 0 ? 'n2-first ' : '') . ($i == $units ? 'n2-last ' : '')), n2_((string) $unit)); $i++; } $html .= parent::fetchElement(); $html .= "</div>"; N2JS::addInline('new NextendElementSwitcher("' . $this->_id . '", ' . json_encode($values) . ');'); return $html; }
public function loadFonts() { $familyQuery = array(); if (count($this->files)) { foreach ($this->files as $family => $styles) { if (count($styles)) { $familyQuery[] = $family . ':' . implode(',', $styles); } } } if (empty($familyQuery)) { return false; } $subsets = array_unique($this->inline); $familyQuery[count($familyQuery) - 1] .= ':' . implode(',', $subsets); N2JS::addFiles(N2LIBRARYASSETS . "/js", array('webfontloader.js'), 'nextend-webfontloader'); N2JS::addInline("\r\n nextend.fontsLoaded = false;\r\n nextend.fontsLoadedActive = function () {nextend.fontsLoaded = true;};\r\n var fontData = {\r\n google: {\r\n families: " . json_encode($familyQuery) . "\r\n },\r\n active: function(){nextend.fontsLoadedActive()},\r\n inactive: function(){nextend.fontsLoadedActive()}\r\n };\r\n if(typeof WebFont === 'undefined'){\r\n window.WebFontConfig = fontData;\r\n }else{\r\n WebFont.load(fontData);\r\n }", true); N2JS::addFirstCode("\r\n nextend.fontsDeferred = n2.Deferred();\r\n if(nextend.fontsLoaded){\r\n nextend.fontsDeferred.resolve();\r\n }else{\r\n nextend.fontsLoadedActive = function () {\r\n nextend.fontsLoaded = true;\r\n nextend.fontsDeferred.resolve();\r\n };\r\n }", true); }