35 public function getImg($sSrc,$sAlt=null,$tOption=null){
36 if($sAlt==null){ $sAlt=$sSrc; }
37 $sOptions=$this->getOptionFromTab($tOption);
38 return '<img src="'._root::getConfigVar(
'path.img').$sSrc.
'" title="'.$sAlt.
'" '.$sOptions.
'/>';
48 public function getDiv($sContenu,$tOption=null){
49 return '<div'.$this->getOptionFromTab($tOption).
'>'.$sContenu.
'</div>';
60 public function getInput($sName,$sValue=null,$tOption=null){
61 if(!isset($tOption[
'class'])){ $tOption[
'class']=
'input'; }
62 return '<input type="input" name="'.$sName.
'" value="'.$sValue.
'"'.$this->getOptionFromTab($tOption).
'/>';
74 public function getInputRadio($sName,$sValue=null,$bChecked=
false,$tOption=null){
75 if(!isset($tOption[
'class'])){ $tOption[
'class']=
'input'; }
77 if($bChecked){ $sOptions.=
'checked="checked" ';}
78 $sOptions.=$this->getOptionFromTab($tOption);
79 return '<input type="radio" name="'.$sName.
'" value="'.$sValue.
'" '.$sOptions.
'/>';
92 if(!isset($tOption[
'class'])){ $tOption[
'class']=
'input'; }
94 if($bChecked){ $sOptions.=
'checked="checked" ';}
95 $sOptions.=$this->getOptionFromTab($tOption);
96 return '<input type="checkbox" name="'.$sName.
'" value="'.$sValue.
'" '.$sOptions.
'/>';
108 public function getSelect($sName,$tSelect,$sValue=null,$tOption=null){
109 if(!isset($tOption[
'class'])){ $tOption[
'class']=
'select'; }
110 $sHtml=
'<select name="'.$sName.
'"'.$this->getOptionFromTab($tOption).
'>';
112 foreach($tSelect as $sKey => $sVal){
115 $sHtml.=
'selected="selected"';
117 $sHtml.=
' value="'.$sKey.
'">'.$sVal.
'</option>';
134 if(!isset($tOption[
'class'])){ $tOption[
'class']=
'select'; }
135 $sHtml=
'<select multiple="multiple" name="'.$sName.
'[]"'.$this->getOptionFromTab($tOption).
'>';
137 foreach($tSelect as $sKey => $sVal){
139 if(is_array($tValue) and in_array($sKey,$tValue)){
140 $sHtml.=
'selected="selected"';
142 $sHtml.=
' value="'.$sKey.
'">'.$sVal.
'</option>';
158 if(!isset($tOption[
'class'])){ $tOption[
'class']=
'textarea'; }
159 return '<textarea name="'.$sName.
'"'.$this->getOptionFromTab($tOption).
'>'.$sValue.
'</textarea>';
171 $sValueAnnee=$sValueMois=$sValueJour=
'';
172 if($sValue!=null and preg_match(
'/-/',$sValue)){
173 list($sValueAnnee,$sValueMois,$sValueJour)=preg_split(
'/-/',$sValue);
174 $sValueAnnee=sprintf(
'%04d',$sValueAnnee);
175 $sValueMois=sprintf(
'%02d',$sValueMois);
176 $sValueJour=sprintf(
'%02d',$sValueJour);
179 $tOption2[
'class']=
'inputDateJour';
180 $sOptions=$this->getOptionFromTab($tOption2);
181 $sHtml.=
'<input type="input" name="'.$sName.
'_jour" value="'.$sValueJour.
'"'.$sOptions.
'/>';
183 $tOption2[
'class']=
'inputDateMois';
184 $sOptions=$this->getOptionFromTab($tOption2);
185 $sHtml.=
'<input type="input" name="'.$sName.
'_mois" value="'.$sValueMois.
'"'.$sOptions.
'/>';
187 $tOption2[
'class']=
'inputDateAnnee';
188 $sOptions=$this->getOptionFromTab($tOption2);
189 $sHtml.=
'<input type="input" name="'.$sName.
'_annee" value="'.$sValueAnnee.
'"'.$sOptions.
'/>';
190 if(!isset($tOption[
'class'])){ $tOption[
'class']=
'inputDate'; }
191 return $this->
getDiv($sHtml,$tOption);
201 if(!isset($tPost[$sName.
'_annee']) or !isset($tPost[$sName.
'_mois']) or !isset($tPost[$sName.
'_jour'])
202 or $tPost[$sName.
'_annee']==
'' or $tPost[$sName.
'_mois']==
'' or $tPost[$sName.
'_jour']==
''
206 return (
int)$tPost[$sName.
'_annee'].
'-'.(int)$tPost[$sName.
'_mois'].
'-'.(
int)$tPost[$sName.
'_jour'];
209 private function getOptionFromTab($tOption){
210 if($tOption==null){
return null;}
212 foreach($tOption as $sVar => $sVal){
213 $sOption.=
' '.$sVar.
'="'.preg_replace(
"/'/",
'\'',$sVal).
'"';
getInputRadio($sName, $sValue=null, $bChecked=false, $tOption=null)
getImg($sSrc, $sAlt=null, $tOption=null)
getInputCheckbox($sName, $sValue=null, $bChecked=false, $tOption=null)
getSelectMultiple($sName, $tSelect, $tValue=null, $tOption=null)
getInput($sName, $sValue=null, $tOption=null)
getDateFromInput($tPost, $sName)
getDiv($sContenu, $tOption=null)
getInputDate($sName, $sValue=null, $tOption=null)
getSelect($sName, $tSelect, $sValue=null, $tOption=null)
getTextarea($sName, $sValue=null, $tOption=null)