/** * render * * @return string rendered form element */ public function render() { static $included = false; $xoops = \Xoops::getInstance(); $ele_value = (string) $this->getValue(false); $display_value = $ele_value; if (0 < (int) $ele_value) { $display_value = date(\XoopsLocale::getFormatShortDate(), $ele_value); } if ($this->getSize() > $this->getMaxcols()) { $maxcols = $this->getMaxcols(); } else { $maxcols = $this->getSize(); } $this->addAttribute('class', 'span' . $maxcols); $dlist = $this->isDatalist(); if (!empty($dlist)) { $this->addAttribute('list', 'list_' . $this->getName()); } $attributes = $this->renderAttributeString(); $xoops->theme()->addBaseStylesheetAssets('@jqueryuicss'); $xoops->theme()->addBaseScriptAssets('@jqueryui'); // TODO - select and apply script by locale, example: // $i18nScript = 'media/jquery/ui/i18n/datepicker-es.js'; // $xoops->theme()->addBaseScriptAssets($i18nScript); $xoops->theme()->addScript('', '', ' $(function() { $( "#' . $this->getAttribute('id') . '" ).datepicker({' . 'showOn: "button", buttonImageOnly: false, ' . 'buttonImage: "' . $xoops->url('media/xoops/images/icons/calendar.png') . '", ' . 'buttonImageOnly: false, buttonText: "' . \XoopsLocale::A_SELECT . '" }); }); '); return '<input ' . $attributes . 'value="' . $display_value . '" ' . $this->getExtra() . ' >'; }
/** * init - called by parent::_construct * * @return void */ protected function init() { $this->setTemplate('module:xmf/xmf_feed.tpl'); //$this->disableLogger(); global $xoopsConfig; $this->_title = $xoopsConfig['sitename']; $this->_url = \XoopsBaseConfig::get('url'); $this->_description = $xoopsConfig['slogan']; $this->_language = \XoopsLocale::getLangCode(); $this->_charset = \XoopsLocale::getCharset(); $this->_pubdate = date(\XoopsLocale::getFormatShortDate(), time()); $this->_lastbuild = \XoopsLocale::formatTimestamp(time(), 'D, d M Y H:i:s'); $this->_webmaster = $xoopsConfig['adminmail']; $this->_editor = $xoopsConfig['adminmail']; $this->_generator = \Xoops::VERSION; $this->_copyright = 'Copyright ' . \XoopsLocale::formatTimestamp(time(), 'Y') . ' ' . $xoopsConfig['sitename']; $this->_image_title = $this->_title; $this->_image_url = \XoopsBaseConfig::get('url') . '/images/logo.gif'; $this->_image_link = $this->_url; }