public function render($xmlpath, $data) { N2Loader::import('libraries.form.form'); $form = new N2Form(N2Base::getApplication('smartslider')->getApplicationType('backend')); $form->loadArray($data); $form->loadXMLFile($xmlpath); echo $form->render('settings'); N2JS::addFirstCode(' new NextendForm("smartslider-form", ' . json_encode($form->_data) . ', null, "' . N2Filesystem::toLinux(N2Filesystem::pathToRelativePath($xmlpath)) . '", "settings", "' . N2Uri::ajaxUri('nextend', 'smartslider') . '"); '); }
function fetchElement() { $this->setfolder(); $files = N2Filesystem::files($this->_folder); if (N2XmlHelper::getAttribute($this->_xml, 'required') == '') { $this->_xml->addChild('option', n2_('No image'))->addAttribute('value', -1); } for ($i = 0; $i < count($files); $i++) { $ext = pathinfo($files[$i], PATHINFO_EXTENSION); if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'svg' || $ext == 'gif') { $this->_xml->addChild('option', htmlspecialchars(ucfirst($files[$i])))->addAttribute('value', N2Filesystem::toLinux(N2Filesystem::pathToRelativePath($this->_folder . $files[$i]))); } } $html = N2Html::openTag("div", array('class' => 'n2-imagelist', 'style' => N2XmlHelper::getAttribute($this->_xml, 'style'))); $html .= parent::fetchElement(); $html .= N2Html::closeTag('div'); return $html; }