本文整理汇总了PHP中N2Html::tag方法的典型用法代码示例。如果您正苦于以下问题:PHP N2Html::tag方法的具体用法?PHP N2Html::tag怎么用?PHP N2Html::tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类N2Html
的用法示例。
在下文中一共展示了N2Html::tag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateOptions
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;
}
示例2: 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)));
}
示例3: 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')));
}
示例4: 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;
}
示例5: post
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>';
}
示例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: 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
}
示例8: 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;
}
示例9: fetchElement
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;
}
示例10: renderSlider
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;
}
示例11: fetchTooltip
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;
}
示例12: actionRecordsTable
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();
}
}
示例13: fetchElement
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;
}
示例14: fetchElement
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')));
}
示例15: fetchElement
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();
}