本文整理汇总了PHP中N2JS类的典型用法代码示例。如果您正苦于以下问题:PHP N2JS类的具体用法?PHP N2JS怎么用?PHP N2JS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了N2JS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchElement
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;
}
示例2: renderSelector
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);
}
示例3: _render
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);
}
示例4: render
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')));
}
示例5: fetchElement
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;
}
示例6: render
/**
* @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]));
}
示例7: fetchElement
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();
}
示例8: show
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;
}
示例9: init
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() . ');');
}
示例10: 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;
}
示例11: render
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
}
示例12: fetchElement
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)));
}
示例13: initOnce
private static function initOnce()
{
static $init;
if (!$init) {
N2JS::addInline('$(".n2-button-menu-open").n2opener();');
$init = true;
}
}
示例14: fetchElement
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;
}
示例15: initialize
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'));
}