nyroFwk  0.2
richtext.class.php
Go to the documentation of this file.
1 <?php
11 
12  public function getValue() {
13  return $this->cfg->value;
14  }
15 
16  public function setValue($value, $refill=false) {
17  $this->cfg->set('value', $value);
18  }
19 
20  public function toHtml() {
21  if ($this->cfg->mode == 'view')
22  return $this->getValue();
23 
24  $options = $this->tinyMce;
25 
26  if (is_array($this->cfg->tinyBrowser) && $this->cfg->getInArray('tinyBrowser', 'active')) {
27  $tinyBrowser = $this->cfg->tinyBrowser;
28  $options['file_browser_callback'] = 'function(field_name, url, type, win) {
29  tinyMCE.activeEditor.windowManager.open({
30  file : "'.$tinyBrowser['url'].'?'.session::getInstance()->getSessIdForce().'='.urlencode(session_id()).'&type=" + type'.($tinyBrowser['subdir'] ? '+"&subdir='.$tinyBrowser['subdir'].'"' : '').',
31  title : "'.$tinyBrowser['title'].'",
32  width : '.$tinyBrowser['width'].',
33  height : '.$tinyBrowser['height'].',
34  resizable : "yes",
35  scrollbars : "yes",
36  inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
37  close_previous : "no"
38  }, {
39  window : win,
40  input : field_name
41  });
42  return false;
43  }';
44  } else if (is_array($this->cfg->nyroBrowser) && $this->cfg->getInArray('nyroBrowser', 'active')) {
45  $nyroBrowser = $this->cfg->nyroBrowser;
46  $options['file_browser_callback'] = 'function(field_name, url, type, win) {
47  tinyMCE.activeEditor.windowManager.open({
48  file : "'.$nyroBrowser['url'].'?'.session::getInstance()->getSessIdForce().'='.urlencode(session_id()).'&type="+type+"&config='.$nyroBrowser['config'].'&",
49  title : "'.$nyroBrowser['title'].'",
50  width : '.$nyroBrowser['width'].',
51  height : '.$nyroBrowser['height'].',
52  resizable : "yes",
53  scrollbars : "yes",
54  inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
55  close_previous : "no"
56  }, {
57  window : win,
58  input : field_name
59  });
60  return false;
61  }';
62  }
63 
64  if (array_key_exists('content_css', $options) && $options['content_css']) {
65  $contentCss = $options['content_css'];
66  $options['setup'] = 'function(ed) {ed.onInit.add(function(ed) {setTimeout(function() {ed.dom.add(ed.dom.select("head"), "link", {rel : "stylesheet", href : "'.$contentCss.'"});}, 5);});}';
67  }
68  unset($options['content_css']);
69 
70  $resp = response::getInstance()->getProxy();
71  $resp->addJs('jquery.tinymce');
72  $resp->blockjQuery('$("#'.$this->id.'").tinymce('.utils::jsEncode($options).');');
73 
74  return utils::htmlTag($this->htmlTagName,
75  array_merge($this->html, array(
76  'name'=>$this->name,
77  'id'=>$this->id,
78  )), utils::htmlOut($this->getValue()));
79  }
80 
81 }
static htmlOut($val, $key=false)
static htmlTag($tag, array $attributes, $content=null)
Definition: utils.class.php:46
static jsEncode($vars)
static getInstance(array $cfg=array())
static getInstance()
setValue($value, $refill=false)
Generated on Sun Oct 15 2017 22:25:20 for nyroFwk by doxygen 1.8.13