noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
itextarea.class.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20// Copyright Author Dany De Bontridder danydb@aevalys.eu
21
22/*!\file
23 * \brief Html Input
24 */
25
26/**
27 * @class ITextarea
28 * @brief Manage the TEXTAREA html element
29 */
30class ITextarea extends HtmlInput
31{
32 private $enrichText;
33 function __construct($p_name = "", $p_value = "", $p_id = "")
34 {
35 parent::__construct($p_name, $p_value, $p_id);
36 $this->style=' class="itextarea" ';
37 $this->enrichText="plain";
38 $this->heigh=500;
39 }
40
41 /**
42 * @brief return if enrichText is set to true or false
43 * @return mixed
44 */
45 public function get_enrichText()
46 {
47 return $this->enrichText;
48 }
49
50 /**
51 * @brief set enrichText to plain or enrich , enrich for WYSIWYG function, plain, plain textarea and choose
52 * to display a button to switch to a WYSIWYG
53 * @param mixed $enrich plain , enrich (full option) , min (minimum options)
54 */
55 public function set_enrichText($enrich)
56 {
57 if ( ! in_array($enrich,['enrich','plain','full',"minimal","no-toolbar"])) {
58 throw new \Exception("IT57.Invalid option [$enrich]");
59 }
60 if ( $enrich == 'enrich') $enrich='full';
61 $this->enrichText = $enrich;
62 return $this;
63 }
64
65 /*!\brief show the html input of the widget
66 * // style example style="height:15em;width: 80vw
67 */
68 public function input($p_name=null,$p_value=null)
69 {
70 $this->name=($p_name==null)?$this->name:$p_name;
71 $this->value=($p_value==null)?$this->value:$p_value;
72 $this->id=($this->id=="")?$this->name:$this->id;
73 if ( $this->readOnly==true) return $this->display();
74 if ( empty($this->id)) $this->id=$this->name;
75
76 if ( $this->enrichText == "plain" ) {
77 $r="";
78 $r.='<TEXTAREA '.$this->style.' name="'.$this->name.'" id="'.$this->id.'"';
79 $r.='>';
81 $r.="</TEXTAREA>";
82 } else {
83
84 $r=<<<EOF
85 <textarea name="{$this->name}" id="{$this->id}" {$this->style}>{$this->value}</textarea>
86<script type="text/javascript">
87 (function() {
88 noalyss.activate_tinymce('{$this->id}','{$this->enrichText}',{$this->heigh});
89 })();
90 </script>
91EOF;
92 }
93
94 return $r;
95 }
96
97
98 /*!\brief print in html the readonly value of the widget*/
99 public function display()
100 {
101 if ( $this->enrichText=="plain")
102 {
103 $r='<p>';
104 $r.=h($this->value);
105 $r.=sprintf('<input type="hidden" name="%s" value="%s">',
106 $this->name,h($this->value));
107 $r.='</p>';
108 } elseif ($this->enrichText=='enrich' ) {
110 }
111 return $r;
112
113 }
114}
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
h( $row[ 'oa_description'])
$opd_description style
$from_poste name
$input_from type
Manage the TEXTAREA html element.
get_enrichText()
return if enrichText is set to true or false
set_enrichText($enrich)
set enrichText to plain or enrich , enrich for WYSIWYG function, plain, plain textarea and choose to ...
__construct($p_name="", $p_value="", $p_id="")
display()
print in html the readonly value of the widget
input($p_name=null, $p_value=null)
show the html input of the widget // style example style="height:15em;width: 80vw
$icard readOnly
if( $delta< 0) elseif( $delta==0)
$desc heigh