style=' class="itextarea" '; $this->enrichText="plain"; } /** * @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 */ public function set_enrichText($enrich) { if ( ! in_array($enrich,['plain','enrich'])) { throw new \Exception("IT57.Invalid option"); } $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 ( $this->enrichText == "plain" ) { $r=""; $r.='"; } elseif ($this->enrichText=='enrich') { if ( empty($this->id)) $this->id=$this->name; $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; } }