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; }
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'))); }
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; }
protected function post() { if (!N2Platform::$hasPosts && !N2PRO) { return ''; } return 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'), '')) . '<a id="' . $this->_id . '_button" class="n2-form-element-button n2-h5 n2-uc" href="#">' . n2_('Link') . '</a>'; }
/** * @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($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 }
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; }
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; }
public function renderSlider($sliderHTML) { if (!N2Platform::$isAdmin && count($this->margin) >= 4) { array_splice($this->margin, 4); if ($this->margin[0] != 0 || $this->margin[1] != 0 || $this->margin[2] != 0 || $this->margin[3] != 0) { $sliderHTML = N2Html::tag("div", array("class" => "n2-ss-margin", "encode" => false, "style" => "margin: " . implode('px ', $this->margin) . "px;"), $sliderHTML); } } return $sliderHTML; }
function fetchTooltip() { if ($this->_label == '-') { $this->_label = ''; } else { $this->_label = n2_($this->_label); } $html = N2Html::tag('label', array('for' => $this->_id), $this->_label); return $html; }
public function actionRecordsTable() { $this->validateToken(); $this->validatePermission('smartslider_edit'); $generatorId = N2Request::getInt('generator_id'); $generatorModel = new N2SmartsliderGeneratorModel(); if ($generatorId > 0) { $generator = $generatorModel->get($generatorId); $this->validateDatabase($generator); } else { $info = new N2Data(N2Request::getVar('generator')); $generator = array('group' => $info->get('group'), 'type' => $info->get('type'), 'params' => '{}'); } $info = $generatorModel->getGeneratorInfo($generator['group'], $generator['type']); $generator['params'] = new N2Data($generator['params'], true); $generator['params']->loadArray(N2Request::getVar('generator')); require_once $info->path . '/generator.php'; $class = 'N2Generator' . $generator['group'] . $generator['type']; /** @var N2GeneratorAbstract $dataSource */ $dataSource = new $class($info, $generator['params']); $request = new N2Data(N2Request::getVar('generator')); $group = max(intval($request->get('record-group', 1)), 1); $result = $dataSource->getData(max($request->get('record-slides', 1), 1), max($request->get('record-start', 1), 1), $group); if (count($result)) { ob_start(); $headings = array(); for ($i = 1; $i <= $group; $i++) { $headings[] = '#'; foreach ($result[0][0] as $k => $v) { $headings[] = '{' . $k . '/' . $i . '}'; } } $headingHTML = N2Html::tag('thead', array(), N2Html::tag('tr', array(), '<th>' . implode('</th><th>', $headings) . '</th>')); $rows = array(); $i = 0; foreach ($result as $records) { foreach ($records as $g => $record) { $rows[$i][] = $i + 1; foreach ($record as $k => $v) { $rows[$i][] = N2Html::tag('div', array(), htmlentities($v)); } } $i++; } for ($i = 0; $i < count($rows); $i++) { $rows[$i] = '<td>' . implode('</td><td>', $rows[$i]) . '</td>'; } $recordHTML = N2Html::tag('tbody', array(), '<tr>' . implode('</tr><tr>', $rows) . '</tr>'); echo N2Html::tag('div', array('style' => 'width: 100%; height: 100%; overflow: auto;'), N2Html::tag('table', array('class' => 'n2-generator-records n2-table n2-table-fancy', 'style' => 'margin: 10px; width: auto; table-layout: fixed;'), $headingHTML . $recordHTML)); $this->response->respond(array('html' => ob_get_clean())); } else { N2Message::notice('No records found for the filter'); $this->response->error(); } }
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; }
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'))); }
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 generateOptions(&$xml) { $this->values = array(); $html = ''; foreach ($xml->option as $option) { $value = N2XmlHelper::getAttribute($option, 'value'); $selected = $this->isSelected($value); $this->values[] = $value; $html .= N2Html::tag("div", array("class" => "n2-radio-option n2-imagelist-option" . ($selected ? ' n2-active' : ''), "style" => "background-image:url(" . N2ImageHelper::fixed(N2XmlHelper::getAttribute($option, 'image')) . ");"), N2Html::tag('span', array(), (string) $option)); } return $html; }
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) { $options = array('bold' => 'n2-i n2-it n2-i-bold', 'italic' => 'n2-i n2-it n2-i-italic', 'underline' => 'n2-i n2-it n2-i-underline'); $length = count($options) - 1; $html = ''; $i = 0; foreach ($options as $value => $class) { $this->values[] = $value; $html .= N2Html::tag('div', array('class' => 'n2-checkbox-option n2-decoration-' . $value . ($this->isSelected($value) ? ' n2-active' : '') . ($i == 0 ? ' n2-first' : '') . ($i == $length ? ' n2-last' : '')), N2Html::tag('i', array('class' => $class))); $i++; } return $html; }
private function getHtml($data, $id, $slider, $slide) { $size = (array) N2Parse::parse($data->get('size', '')); if (!isset($size[0])) { $size[0] = 'auto'; } if (!isset($size[1])) { $size[1] = 'auto'; } $html = N2Html::tag('img', self::optimizeImage($slide->fill($data->get('image', '')), $data, $slider) + array("id" => $id, "alt" => htmlspecialchars($slide->fill($data->get('alt', ''))), "style" => "display: inline-block; max-width: 100%; width: {$size[0]};height: {$size[1]};", "class" => $data->get('cssclass', '') . ' n2-ow', "title" => htmlspecialchars($slide->fill($data->get('title', '')))), false); $style = N2StyleRenderer::render($data->get('style'), 'heading', $slider->elementId, 'div#' . $slider->elementId . ' '); return N2Html::tag("div", array("class" => $style, 'style' => 'overflow:hidden;'), $this->getLink($slide, $data, $html, array('class' => 'n2-ow'))); }
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 generateOptions(&$xml) { $length = count($xml->option) - 1; $html = ''; $i = 0; foreach ($xml->option as $option) { $value = N2XmlHelper::getAttribute($option, 'value'); $this->values[] = $value; $html .= N2Html::tag('div', array('class' => 'n2-radio-option n2-h4' . ($this->isSelected($value) ? ' n2-active' : '') . ($i == 0 ? ' n2-first' : '') . ($i == $length ? ' n2-last' : '')), n2_((string) $option)); $i++; } return $html; }
function generateOptions(&$xml) { $length = count($xml->option) - 1; $html = ''; $i = 0; foreach ($xml->option as $option) { $v = N2XmlHelper::getAttribute($option, 'value'); $this->values[] = $v; $html .= N2Html::tag('div', array('class' => 'n2-radio-option n2-h4' . ($this->isSelected($v) ? ' n2-active' : '') . ($i == 0 ? ' n2-first' : '') . ($i == $length ? ' n2-last' : '')), N2Html::tag('div', array('class' => 'n2-radio-option-marker'), '<i class="n2-i n2-it n2-i-tick"></i>') . '<span>' . n2_((string) $option) . '</span>'); $i++; } return $html; }
function generateOptions(&$xml) { $options = array('left' => 'n2-i n2-it n2-i-left', 'center' => 'n2-i n2-it n2-i-center', 'right' => 'n2-i n2-it n2-i-right', 'justify' => 'n2-i n2-it n2-i-justify'); $length = count($options) - 1; $this->values = array(); $html = ''; $i = 0; foreach ($options as $value => $class) { $this->values[] = $value; $html .= N2Html::tag('div', array('class' => 'n2-radio-option' . ($this->isSelected($value) ? ' n2-active' : '') . ($i == 0 ? ' n2-first' : '') . ($i == $length ? ' n2-last' : '')), N2Html::tag('i', array('class' => $class))); $i++; } return $html; }
function generateOptions(&$xml) { $html = ''; foreach ($xml->option as $option) { $v = N2XmlHelper::getAttribute($option, 'value'); $this->values[] = $v; $attributes = array('class' => 'nextend-checkbox-option'); if ($this->isSelected($v)) { $attributes['selected'] = 'selected'; } $html .= N2Html::tag('div', $attributes, (string) $option); } return $html; }
function generateOptions(&$xml) { $options = array('top' => 'n2-i n2-it n2-i-vertical-top', 'middle' => 'n2-i n2-it n2-i-vertical-middle', 'bottom' => 'n2-i n2-it n2-i-vertical-bottom'); $length = count($options) - 1; $this->values = array(); $html = ''; $i = 0; foreach ($options as $value => $class) { $this->values[] = $value; $html .= N2Html::tag('div', array('class' => 'n2-radio-option' . ($this->isSelected($value) ? ' n2-active' : '') . ($i == 0 ? ' n2-first' : '') . ($i == $length ? ' n2-last' : '')), N2Html::tag('i', array('class' => $class))); $i++; } return $html; }
function fetchElement() { $options = $this->getOptions(); if (count($options) === 0) { return 'No sub form exists...'; } if (!in_array($this->getValue(), $options)) { $this->setValue($options[0]); } $this->setOptions($options); $html = $this->renderSelector(); $html .= $this->renderButton(); $html .= $this->renderContainer(); return N2Html::tag("div", array("class" => "n2-subform " . N2XmlHelper::getAttribute($this->_xml, 'class'), "style" => N2XmlHelper::getAttribute($this->_xml, 'style')), $html); }
function fetchElement() { $this->_translateable = N2XmlHelper::getAttribute($this->_xml, 'translateable'); $this->_translateable = $this->_translateable === '0' ? false : true; $html = ''; foreach ($this->_xml->param as $element) { $class = N2Form::importElement(N2XmlHelper::getAttribute($element, 'type')); $el = new $class($this->_form, $this, $element); list($label, $field) = $el->render($this->control_name, $this->_translateable); $html .= N2Html::tag('div', array('class' => 'n2-mixed-group ' . N2XmlHelper::getAttribute($element, 'class')), N2Html::tag('div', array('class' => 'n2-mixed-label'), $label) . N2Html::tag('div', array('class' => 'n2-mixed-element'), $field)); if (N2XmlHelper::getAttribute($element, 'post') == 'break') { $html .= '<br class="' . N2XmlHelper::getAttribute($element, 'class') . '" />'; } } return N2Html::tag('div', array('class' => 'n2-form-element-mixed', 'style' => N2XmlHelper::getAttribute($this->_xml, 'style')), $html); }
public function renderPlaceholder($sizes) { if (!$this->slider->isAdmin && $this->fadeOnLoad && ($this->slider->features->responsive->scaleDown || $this->slider->features->responsive->scaleUp)) { if (N2SystemHelper::testMemoryLimit()) { if ($sizes['width'] + $sizes['marginHorizontal'] > 0 && $sizes['height'] > 0 && function_exists('imagecreatetruecolor')) { return N2Html::tag("div", array("id" => $this->slider->elementId . "-placeholder", "encode" => false, "style" => 'position: relative;z-index:2;'), $this->makeImage($sizes)); } else { N2CSS::addCode("#{$this->slider->elementId} .n2-ss-load-fade{position: relative !important;}", $this->slider->cacheId); } } else { N2Message::error(n2_("It seems like the <a href='http://php.net/manual/en/ini.core.php#ini.memory-limit'>memory_limit</a> on the server is too low for the fade on load feature. Please set it minimum 60M and reload the page! You can disable this message in <a href='" . N2Form::$documentation . "#Troubleshooting-G-Server'>global configuration</a> 'Frontend debug message' option.")); } } else { N2CSS::addCode("#{$this->slider->elementId}.n2-ss-load-fade{position: relative !important;}", $this->slider->cacheId); } return ''; }
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 getDashboardButtons($slider) { $sliderid = $slider['id']; $app = N2Base::getApplication('smartslider'); $accessEdit = N2Acl::canDo('smartslider_edit', $app->info); $accessDelete = N2Acl::canDo('smartslider_delete', $app->info); $buttons = ''; if ($accessEdit) { $buttons .= N2Html::tag('a', array('data-label' => n2_('Quick Edit - Slides'), 'href' => '#', 'id' => 'n2-quick-slides-edit'), N2Html::tag('i', array('class' => 'n2-i n2-i-slideedit'))); $buttons .= N2Html::tag('a', array('data-label' => n2_('Clear slider cache'), 'href' => $this->appType->router->createUrl(array('slider/clearcache', array('sliderid' => $sliderid) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-i-a-refresh'))); $buttons .= N2Html::tag('a', array('data-label' => n2_('Export slider as HTML'), 'href' => $this->appType->router->createUrl(array('slider/exporthtml', array('sliderid' => $sliderid) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-i-a-html'))); $buttons .= N2Html::tag('a', array('data-label' => n2_('Export'), 'href' => $this->appType->router->createUrl(array('slider/export', array('sliderid' => $sliderid) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-i-a-export'))); $buttons .= N2Html::tag('a', array('data-label' => n2_('Duplicate slider'), 'href' => $this->appType->router->createUrl(array('slider/duplicate', array('sliderid' => $sliderid) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-i-a-duplicate'))); } if ($accessDelete) { $buttons .= N2Html::tag('a', array('data-label' => n2_('Delete slider'), "onclick" => "return NextendDeleteModalLink(this, 'slider-delete', " . json_encode($slider['title']) . ");", 'href' => $this->appType->router->createUrl(array('slider/delete', array('sliderid' => $sliderid) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-i-a-delete'))); } return $buttons; }