public function toHtml() { if ($this->cfg->mode == 'view') { return $this->getValue(); } $options = $this->tinyMce; if (is_array($this->cfg->tinyBrowser) && $this->cfg->getInArray('tinyBrowser', 'active')) { $tinyBrowser = $this->cfg->tinyBrowser; $options['file_browser_callback'] = 'function(field_name, url, type, win) { tinyMCE.activeEditor.windowManager.open({ file : "' . $tinyBrowser['url'] . '?' . session::getInstance()->getSessIdForce() . '=' . urlencode(session_id()) . '&type=" + type' . ($tinyBrowser['subdir'] ? '+"&subdir=' . $tinyBrowser['subdir'] . '"' : '') . ', title : "' . $tinyBrowser['title'] . '", width : ' . $tinyBrowser['width'] . ', height : ' . $tinyBrowser['height'] . ', resizable : "yes", scrollbars : "yes", inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin! close_previous : "no" }, { window : win, input : field_name }); return false; }'; } else { if (is_array($this->cfg->nyroBrowser) && $this->cfg->getInArray('nyroBrowser', 'active')) { $nyroBrowser = $this->cfg->nyroBrowser; $options['file_browser_callback'] = 'function(field_name, url, type, win) { tinyMCE.activeEditor.windowManager.open({ file : "' . $nyroBrowser['url'] . '?' . session::getInstance()->getSessIdForce() . '=' . urlencode(session_id()) . '&type="+type+"&config=' . $nyroBrowser['config'] . '&", title : "' . $nyroBrowser['title'] . '", width : ' . $nyroBrowser['width'] . ', height : ' . $nyroBrowser['height'] . ', resizable : "yes", scrollbars : "yes", inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin! close_previous : "no" }, { window : win, input : field_name }); return false; }'; } } if (array_key_exists('content_css', $options) && $options['content_css']) { $contentCss = $options['content_css']; $options['setup'] = 'function(ed) {ed.onInit.add(function(ed) {setTimeout(function() {ed.dom.add(ed.dom.select("head"), "link", {rel : "stylesheet", href : "' . $contentCss . '"});}, 5);});}'; } unset($options['content_css']); $resp = response::getInstance()->getProxy(); $resp->addJs('jquery.tinymce'); $resp->blockjQuery('$("#' . $this->id . '").tinymce(' . utils::jsEncode($options) . ');'); return utils::htmlTag($this->htmlTagName, array_merge($this->html, array('name' => $this->name, 'id' => $this->id)), utils::htmlOut($this->getValue())); }
public function toHtml() { if ($this->cfg->mode == 'view') { return $this->date->format('date', 'short2'); } if ($this->cfg->useJs) { $resp = response::getInstance(); $resp->addJs('jqueryui'); $resp->blockJquery('$("#' . $this->id . '").datepicker(' . utils::jsEncode($this->jsPrm) . ');'); } return utils::htmlTag($this->htmlTagName, array_merge($this->html, array('name' => $this->name, 'id' => $this->id, 'value' => $this->date->format('date', 'short2')))); }
public function toHtml() { if ($this->cfg->useJs) { $this->cfg->setInArray('html', 'class', $this->cfg->getInArray('html', 'class') . ' date'); $resp = response::getInstance(); $resp->addJs('jqueryui'); if (($lang = request::get('lang')) != 'en') { $resp->addJs('i18n_ui.datepicker-' . $lang); } $jsPrmMin = $this->cfg->jsPrm; $jsPrmMax = $this->cfg->jsPrm; $minId = $this->makeId($this->name . '[0]'); $maxId = $this->makeId($this->name . '[1]'); $minDate = $this->dates['min']->getJs(null); $maxDate = $this->dates['max']->getJs(null); $jsPrmMin['onSelect'] = 'function(dateText) {$("#' . $maxId . '").datepicker("option", "minDate", $("#' . $minId . '").datepicker("getDate"));}'; if ($maxDate) { $jsPrmMin['maxDate'] = $maxDate; } $jsPrmMax['onSelect'] = 'function(dateText) {$("#' . $minId . '").datepicker("option", "maxDate", $("#' . $maxId . '").datepicker("getDate"));}'; if ($minDate) { $jsPrmMax['minDate'] = $minDate; } $resp->blockJquery(' $("#' . $minId . '").datepicker(' . utils::jsEncode($jsPrmMin) . '); $("#' . $maxId . '").datepicker(' . utils::jsEncode($jsPrmMax) . '); '); } return parent::toHtml(); }
/** * Make the field plupload for asynchronous upload. * * @param array $opts Plupload options * @param boolean $hideSubmit Indicate if the submit button should be hide by JavaScript */ public function plupload(array $opts = array(), $hideSubmit = true) { $resp = response::getInstance(); $resp->addJs('jquery'); $resp->addJs('plupload'); $resp->addJs('nyroPlupload'); $resp->addCss('plupload'); $pluploadOpts = $this->cfg->plupload; if (count($opts)) { factory::mergeCfg($pluploadOpts, $opts); } $pluploadOpts['file_data_name'] = $this->name; $resp->blockjQuery('$("#' . $this->id . '").nyroPlupload(' . utils::jsEncode($pluploadOpts) . ');'); if ($hideSubmit) { $resp->blockjQuery('$("#' . $this->id . '").closest("form").find("fieldset.submit").hide();'); } }
<?php unset($this->vars['response']); echo utils::jsEncode($this->vars); ?>
<?php echo utils::jsEncode(array('content'=>$content)); ?>