37 parent::__construct($p_name, $p_value,
$p_id);
38 $this->alert_on_size=
false;
39 $this->multiple=
false;
71 public function input($p_name=
null,$p_value=
null)
73 $this->
name=($p_name==
null)?$this->
name:$p_name;
74 $this->
value=($p_value==
null)?$this->
value:$p_value;
76 if ($this->
id==
"") $this->
id=uniqid(
"file_");
78 if ( $this->multiple)
$multiple=
" multiple ";
80 $r=sprintf(
'<INPUT class="inp" %s TYPE="file" name="%s" id="%s" value="%s">',
85 if ( $this->alert_on_size)
87 $max_size=MAX_FILE_SIZE;
88 $max_size_mb=round($max_size / 1024 /1024,2);
89 $too_large=
h(_(
"Fichier trop grand(max = $max_size_mb MB)"));
91 $js_check_size=sprintf(
'
92 document.getElementById("%s").addEventListener("change",function ()
94 var fFile=document.getElementById("%s");
95 if (fFile.files[0] && fFile.files[0].size>%s) { smoke.alert("%s");fFile.value="";}
96 });',$this->
id,$this->
id,$max_size,$too_large);
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
h( $row[ 'oa_description'])
Html Input for uploading file, must be in a form with enctype="multipart/form-data".
set_multiple(bool $multiple)
input($p_name=null, $p_value=null)
show the html input of the widget
__construct($p_name="", $p_value="", $p_id="")
display()
print in html the readonly value of the widget
setAlertOnSize(bool $alert_on_size)
if true , the size is tested and a box is displaid
create_script($p_string)
create the HTML for adding the script tags around of the script