本文整理汇总了PHP中N2XmlHelper类的典型用法代码示例。如果您正苦于以下问题:PHP N2XmlHelper类的具体用法?PHP N2XmlHelper怎么用?PHP N2XmlHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了N2XmlHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: addSimple
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');
}
示例3: 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)));
}
示例4: getGroup
private function getGroup()
{
if (empty($this->group)) {
$this->group = N2XmlHelper::getAttribute($this->_xml, 'method');
}
return $this->group;
}
示例5: 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
}
示例6: decorateTitle
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];
}
}
示例7: generateOptions
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;
}
示例8: 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;
}
示例9: getOptions
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;
}
示例10: fetchElement
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;
}
示例11: setFolder
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);
}
示例12: 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')));
}
示例13: render
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());
}
示例14: generateOptions
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;
}
示例15: generateOptions
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;
}