style=' class="itextarea" '; $this->enrichText="plain"; $this->heigh=500; } /** * @brief return if enrichText is set to true or false * @return mixed */ public function get_enrichText() { return $this->enrichText; } /** * @brief set enrichText to plain or enrich , enrich for WYSIWYG function, plain, plain textarea and choose * to display a button to switch to a WYSIWYG * @param mixed $enrich plain , enrich (full option) , min (minimum options) */ public function set_enrichText($enrich) { if ( ! in_array($enrich,['enrich','plain','full',"minimal","no-toolbar"])) { throw new \Exception("IT57.Invalid option [$enrich]"); } if ( $enrich == 'enrich') $enrich='full'; $this->enrichText = $enrich; return $this; } /*!\brief show the html input of the widget * // style example style="height:15em;width: 80vw */ public function input($p_name=null,$p_value=null) { $this->name=($p_name==null)?$this->name:$p_name; $this->value=($p_value==null)?$this->value:$p_value; $this->id=($this->id=="")?$this->name:$this->id; if ( $this->readOnly==true) return $this->display(); if ( empty($this->id)) $this->id=$this->name; if ( $this->enrichText == "plain" ) { $r=""; $r.='"; } else { $r=<<style}>{$this->value} EOF; } return $r; } /*!\brief print in html the readonly value of the widget*/ public function display() { if ( $this->enrichText=="plain") { $r='

'; $r.=h($this->value); $r.=sprintf('', $this->name,h($this->value)); $r.='

'; } elseif ($this->enrichText=='enrich' ) { $r=$this->value; } return $r; } }