59 $this->
input=$p_input;
60 $x[
"input"]=base64_encode(serialize($p_input));
61 $this->json=json_encode($x, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP |JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
62 $this->message=_(
"Cliquez pour éditer");
66 static function build($p_serialize)
68 $input= unserialize(base64_decode($p_serialize));
74 echo $this->
input->value;
81 echo $this->
input->input();
89 $(
'{$this->input->id}edit').addClassName(
'inplace_edit_input');
90 {$this->
input->id}edit.onclick=
null;
91 inplace_edit_ok{$this->
input->id}.onclick=
function () {
92 var json={$this->json};
93 json[
'ieaction']=
'ok';
94 json[
'value']=$(
'{$this->input->id}').value;
95 new Ajax.Updater(
'{$this->input->id}edit'
97 {parameters: json ,evalScripts:
true});}
98 inplace_edit_cancel{$this->
input->id}.onclick=
function () {
99 var json={$this->json};
100 json[
'ieaction']=
'cancel';
101 new Ajax.Updater(
'{$this->input->id}edit'
102 ,
'{$this->callback}',
103 {parameters: json ,evalScripts:
true});}
107 $ret= ob_get_contents();
117 $v=$this->
input->get_value();
118 $v=html_entity_decode($v??
"");
121 echo
'<pre class="field_follow_up">';
122 $v=(trim($v)==
"")?$this->message:$v;
125 echo
'<span class="smallbutton" style="margin-left:5px">Cliquer pour changer</span> ';
127 $v=(trim($v)==
"")?$this->message:$v;
129 '<span class="smallicon icon" style="margin-left:5px"></span> ';
134 $('{$this->input->id}edit').removeClassName('inplace_edit_input');
135 {$this->input->id}edit.onclick=function() {
136 new Ajax.Updater('{$this->input->id}edit'
137 ,'{$this->callback}',
138 {parameters: {$this->json} ,evalScripts:true});}
147 $v=$this->
input->get_value();
148 $v=html_entity_decode($v??
"");
150 echo
'<span class="" id="'.$this->input->id.
'edit" >';
151 echo
'<pre class="field_follow_up">';
152 $v=(trim($v)==
"")?$this->message:$v;
155 echo
'<span class="smallbutton" style="margin-left:5px">Cliquer pour changer</span> ';
157 $v=(trim($v)==
"")?$this->message:$v;
159 <
span class=
"inplace_edit" id=
"{$this->input->id}edit" >
163 echo
'<span class="smallicon icon" style="margin-left:5px"></span> ';
169 {$this->input->id}edit.onclick=function() {
170 new Ajax.Updater('{$this->input->id}edit'
171 ,'{$this->callback}',
172 {parameters: {$this->json} ,evalScripts:true});
176 $ret= ob_get_contents();
199 $x=json_decode($this->json,TRUE);
200 $x[$p_attribute]=$p_value;
201 $this->json=json_encode($x, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP |JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
216 $this->
input = $p_input;
217 $x=json_decode($this->json,TRUE);
218 $x[
"input"]=base64_encode(serialize($p_input));
219 $this->json=json_encode($x, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP |JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
227 $this->
input->set_value($p_value);
235 $this->message=$p_str;
span($p_string, $p_extra='')
Manage the TEXTAREA html element.
static validate($p_id, $p_javascript)
Display the icon to modify a idem.
static cancel($p_id, $p_javascript)
Display the icon to modify a idem.
Inplace_edit class for ajax update of HtmlInput object.
$json
Json object to pass to JavaScript.
get_input()
return the HtmlObject , var input
__construct(HtmlInput $p_input)
Create a Inplace_Edit, initialise JSON and fullfill the default json value: input which is the HtmlIn...
$callback
Php file which answered the ajax.
set_message($p_str)
Message to display if the value is empty.
add_json_param($p_attribute, $p_value)
Add json parameter to the current one, if there attribute already exists it will be overwritten.
set_input(HtmlInput $p_input)
set the var input (HtmlObject) and update the json attribute input
$message
Message to display if value is empty.
ajax_input()
response in ajax to be edited
set_callback($callback)
the php callback file to call for ajax
set_value($p_value)
Set the value of the HtmlInput object $input.
value()
display only the value , if the action after saving or cancelling
static build($p_serialize)
build a Inplace_Edit object from a serialized string (ajax json parameter = input)