From 5bdc3b9a1eda932ab62c429e70bf12ee474ff0d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 20 Mar 2016 14:02:38 +0100 Subject: [PATCH] NEW Converted Form::selectyesno, Form::showrefnav, Form::select_date, Form::showbarcode, Form::showfilterAndCheckAddButtons, Form::editfieldkey, Form::editfieldnav, Form::editInPlace, Form::selectMassActions to static functions --- htdocs/core/class/html.form.class.php | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c589e01d561..73efb5bcdd9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -64,7 +64,7 @@ class Form * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; } @@ -81,7 +81,7 @@ class Form * @param string $moreparam More param to add on a href URL * @return string HTML edit field */ - function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata='string', $moreparam='') + public static function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata='string', $moreparam='') { global $conf,$langs; @@ -129,7 +129,7 @@ class Form * @param string $moreparam More param to add on a href URL * @return string HTML edit field */ - function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata='string', $editvalue='', $extObject=null, $custommsg=null, $moreparam='') + public static function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata='string', $editvalue='', $extObject=null, $custommsg=null, $moreparam='') { global $conf,$langs,$db; @@ -141,7 +141,7 @@ class Form // When option to edit inline is activated if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;|datehourpicker/',$typeofdata)) // TODO add jquery timepicker { - $ret.=$this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg); + $ret.= self::editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg); } else { @@ -171,11 +171,11 @@ class Form } else if ($typeofdata == 'day' || $typeofdata == 'datepicker') { - $ret.=$this->select_date($value,$htmlname,0,0,1,'form'.$htmlname,1,0,1); + $ret.=self::select_date($value,$htmlname,0,0,1,'form'.$htmlname,1,0,1); } else if ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { - $ret.=$this->select_date($value,$htmlname,1,1,1,'form'.$htmlname,1,0,1); + $ret.=self::select_date($value,$htmlname,1,1,1,'form'.$htmlname,1,0,1); } else if (preg_match('/^select;/',$typeofdata)) { @@ -253,7 +253,7 @@ class Form * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') * @return string HTML edit in place */ - private function editInPlace($object, $value, $htmlname, $condition, $inputType='textarea', $editvalue=null, $extObject=null, $custommsg=null) + private static function editInPlace($object, $value, $htmlname, $condition, $inputType='textarea', $editvalue=null, $extObject=null, $custommsg=null) { global $conf; @@ -486,10 +486,10 @@ class Form * Generate select HTML to choose massaction * * @param string $selected Selected value - * @param int $arrayofaction array('code'=>'label', ...). The code is the key stored into the GETPOST('massaction') when submitting action. + * @param array $arrayofaction array('code'=>'label', ...). The code is the key stored into the GETPOST('massaction') when submitting action. * @return string Select list */ - function selectMassAction($selected, $arrayofaction) + public static function selectMassAction($selected, array $arrayofaction) { global $conf,$langs,$hookmanager; @@ -3285,7 +3285,7 @@ class Form { $more.=''.$input['label'].''; $more.=''; - $more.=$this->select_date($input['value'],$input['name'],0,0,0,'',1,0,1); + $more.=self::select_date($input['value'],$input['name'],0,0,0,'',1,0,1); $more.=''."\n"; $formquestion[] = array('name'=>$input['name'].'day'); $formquestion[] = array('name'=>$input['name'].'month'); @@ -3637,7 +3637,7 @@ class Form * @return void * @see select_date */ - function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0, $nooutput=0) + public static function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0, $nooutput=0) { global $langs; @@ -3650,7 +3650,7 @@ class Form $ret.=''; $ret.=''; $ret.=''; $ret.=''; $ret.='
'; - $ret.=$this->select_date($selected,$htmlname,$displayhour,$displaymin,1,'form'.$htmlname,1,0,1); + $ret.=self::select_date($selected,$htmlname,$displayhour,$displaymin,1,'form'.$htmlname,1,0,1); $ret.='
'; @@ -4277,7 +4277,7 @@ class Form * @return mixed Nothing or string if nooutput is 1 * @see form_date */ - function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') + public static function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') { global $conf,$langs; @@ -5479,7 +5479,7 @@ class Form * @param string $morehtmlright More html code to show before navigation arrows * @return string Portion HTML avec ref + boutons nav */ - function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlright='') + public static function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlright='') { global $langs,$conf; @@ -5545,11 +5545,11 @@ class Form /** * Return HTML code to output a barcode * - * @param Object $object Object containing data to retrieve file name + * @param object $object Object containing data to retrieve file name * @param int $width Width of photo * @return string HTML code to output barcode */ - function showbarcode(&$object,$width=100) + public static function showbarcode($object, $width = 100) { global $conf; @@ -5824,7 +5824,7 @@ class Form * @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes * @return string */ - function showFilterAndCheckAddButtons($addcheckuncheckall=0, $cssclass='checkforaction', $calljsfunction=0) + public static function showFilterAndCheckAddButtons($addcheckuncheckall=0, $cssclass='checkforaction', $calljsfunction=0) { global $conf, $langs;