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 addSimple() { $simple = $this->_xml->addChild('param'); $simple->addAttribute('type', 'group'); $area = $simple->addChild('param'); $area->addAttribute('type', 'sliderwidgetarea'); $area->addAttribute('name', $this->_name . '-area'); $area->addAttribute('default', N2XmlHelper::getAttribute($this->_xml, 'area')); $priority = $simple->addChild('param'); $priority->addAttribute('type', 'list'); $priority->addAttribute('name', $this->_name . '-stack'); $priority->addAttribute('label', n2_('Stack')); $priority->addAttribute('default', N2XmlHelper::getAttribute($this->_xml, 'stack', '1')); $priority->addAttribute('class', 'n2-expert'); for ($i = 1; $i < 5; $i++) { $pri = $priority->addChild('option', $i); $pri->addAttribute('value', $i); } $offset = $simple->addChild('param'); $offset->addAttribute('type', 'text'); $offset->addAttribute('name', $this->_name . '-offset'); $offset->addAttribute('label', 'Offset'); $offset->addAttribute('style', 'width:30px;'); $offset->addAttribute('default', N2XmlHelper::getAttribute($this->_xml, 'offset', '0')); $offset->addChild('unit', 'px')->addAttribute('value', 'px'); }
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))); }
private function getGroup() { if (empty($this->group)) { $this->group = N2XmlHelper::getAttribute($this->_xml, 'method'); } return $this->group; }
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 decorateTitle() { $id = N2XmlHelper::getAttribute($this->_xml, 'id'); echo "<div id='" . $id . "' class='nextend-tab " . N2XmlHelper::getAttribute($this->_xml, 'class') . "'>"; if (isset($GLOBALS[$id])) { echo $GLOBALS[$id]; } }
function generateOptions(&$xml) { $html = ''; foreach ($xml->option as $option) { $v = N2XmlHelper::getAttribute($option, 'value'); $html .= '<option value="' . $v . '" ' . $this->isSelected($v) . '>' . ($this->_translateable ? n2_((string) $option) : (string) $option) . '</option>'; } 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; }
function getOptions() { if ($this->_list == null) { $this->_list = array(); N2Plugin::callPlugin(N2XmlHelper::getAttribute($this->_xml, 'group'), N2XmlHelper::getAttribute($this->_xml, 'method'), array(&$this->_list)); } uasort($this->_list, array($this, 'sort')); return $this->_list; }
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 setFolder() { $folder = N2XmlHelper::getAttribute($this->_xml, 'folder'); if (!empty($folder) && $folder[0] != '$') { $folder = dirname($this->_form->_xmlfile) . '/' . $folder . '/'; } else { $folder = N2ImageHelper::fixed($folder, true); } $this->_folder = N2Filesystem::translate($folder); }
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 render($control_name = 'params', $tooltip = true) { $this->control_name = $control_name; $this->_default = N2XmlHelper::getAttribute($this->_xml, 'default'); $this->_id = $this->generateId($control_name . $this->_name); $this->_inputname = N2XmlHelper::getAttribute($this->_xml, 'hidename') ? '' : $control_name . '[' . $this->_name . ']'; $this->_label = N2XmlHelper::getAttribute($this->_xml, 'label'); if ($this->_label == '') { $this->_label = $this->_name; } return array($tooltip ? $this->fetchTooltip() : '', $this->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; }
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 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) { $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 loadList() { if ($this->_list == null) { $this->_group = array(); $this->_list = array(); N2Plugin::callPlugin(N2XmlHelper::getAttribute($this->_xml, 'plugingroup'), N2XmlHelper::getAttribute($this->_xml, 'method'), array(&$this->_group, &$this->_list)); $v = explode('_', $this->getValue()); if (!isset($this->_list[$v[0]][$this->getValue()])) { $keys = array_keys($this->_list); $ks = array_keys($this->_list[$keys[0]]); $this->setValue($this->_list[$keys[0]][$ks[0]]); } } }
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); }
function generateOptions(&$xml) { $html = ''; if (!$this->fixedMode) { $html .= '<option value="0" selected="selected">' . n2_('Choose') . '</option>'; } $this->skins = array(); foreach ($this->_xml->children() as $skin) { $v = $skin->getName(); $html .= '<option ' . $this->isSelected($v) . ' value="' . $v . '">' . n2_(N2XmlHelper::getAttribute($skin, 'label')) . '</option>'; $this->skins[$v] = array(); foreach ($skin as $param) { $this->skins[$v][$param->getName()] = (string) $param; } } return $html; }
function fetchElement() { $dir = N2Platform::getPublicDir(); $extension = N2XmlHelper::getAttribute($this->_xml, 'extension'); $files = scandir($dir); $validated_files = array(); foreach ($files as $file) { if (strtolower(pathinfo($file, PATHINFO_EXTENSION)) == $extension) { $validated_files[] = $file; } } $this->_xml->addChild('option', n2_('Choose a file to import'))->addAttribute('value', ''); foreach ($validated_files as $f) { $this->_xml->addChild('option', $f)->addAttribute('value', $f); } return parent::fetchElement(); }
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; }
function fetchElement() { $attributes = array('class' => 'n2-form-element-single-button n2-button n2-button-big n2-uc n2-button-grey', 'href' => '#', 'onclick' => 'return false;', 'id' => $this->_id); $url = N2XmlHelper::getAttribute($this->_xml, 'url'); if (!empty($url)) { $attributes['href'] = $url; $attributes['target'] = N2XmlHelper::getAttribute($this->_xml, 'target'); } else { $app = (string) $this->_xml->app; if ($app) { $queries = (array) $this->_xml->queries; $route = $queries['controller'] . '/' . $queries['action']; unset($queries['controller']); unset($queries['action']); $attributes['href'] = N2Base::getApplication($app)->router->createUrl(array($route, $queries), true); unset($attributes['onclick']); } } return N2Html::tag('a', $attributes, n2_($this->getValue())); }
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; }
function fetchElement() { $fixed = N2XmlHelper::getAttribute($this->_xml, 'fixed'); if ($fixed == '1') { $this->fixed = true; } N2ImageAviary::init(); $html = parent::fetchElement(); $params = array(); N2ImageHelper::initLightbox(); N2JS::addInline("new NextendElementImage('" . $this->_id . "', " . json_encode($params) . " );"); if ($this->fixed) { $aviary = ''; $html .= '<div id="' . $this->_id . '_preview" class="n2-form-element-preview n2-form-element-preview-fixed n2-border-radius" style="' . $this->getImageStyle() . '"> ' . $aviary . ' </div>'; } else { $aviary = ''; $html .= $aviary; } return $html; }
function fetchElement() { $this->_translateable = N2XmlHelper::getAttribute($this->_xml, 'translateable'); $this->_translateable = $this->_translateable === '0' ? false : true; $default = explode($this->_separator, $this->_default); $value = explode($this->_separator, $this->getValue()); $value = $value + $default; $html = "<div class='n2-form-element-mixed' style='" . N2XmlHelper::getAttribute($this->_xml, 'style') . "'>"; $this->_elements = array(); $i = 0; foreach ($this->_xml->param as $element) { $html .= "<div class='n2-mixed-group " . N2XmlHelper::getAttribute($element, 'class') . "' style='" . N2XmlHelper::getAttribute($element, 'mixedstyle') . "'>"; $class = N2Form::importElement(N2XmlHelper::getAttribute($element, 'type')); $element->addAttribute('name', $this->_name . '_' . $i); $element->addAttribute('hidename', 1); if (isset($value[$i])) { $element->addAttribute('default', $value[$i]); } $el = new $class($this->_form, $this, $element); $el->parent =& $this; $elementHtml = $el->render($this->_name . $this->control_name, $this->_translateable); $html .= "<div class='n2-mixed-label'>"; $html .= $elementHtml[0]; $html .= "</div>"; $html .= "<div class='n2-mixed-element'>"; $html .= $elementHtml[1]; $html .= "</div>"; $this->_elements[$i] = $el->_id; $i++; $html .= "</div>"; } $hidden = new N2ElementHidden($this->_form, $this->_tab, $this->_xml); $hiddenhtml = $hidden->render($this->control_name, false); $html .= $hiddenhtml[1]; $html .= "</div>"; N2JS::addInline('new NextendElementMixed("' . $this->_id . '", ' . json_encode($this->_elements) . ', "' . $this->_separator . '");'); return $html; }
function fetchElement() { return N2Html::tag('div', array('class' => 'n2-form-element-decoration', 'style' => N2XmlHelper::getAttribute($this->_xml, 'style')), parent::fetchElement()); }
function fetchElement() { N2Localization::addJS(array('Disabled', 'Multiple animations', 'Single animation')); N2JS::addInline('new NextendElementAnimationManager("' . $this->_id . '", "backgroundanimationManager");'); 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_('Animations'))); }
protected function getStyle() { return N2XmlHelper::getAttribute($this->_xml, 'style') . '; text-align:center;'; }