Tache #0001875: Demande amélioration calendrier

Code cleaning
This commit is contained in:
sparkyx 2021-01-16 12:58:08 +01:00
parent a9eb8388bf
commit a7b8d81250
4 changed files with 9 additions and 11 deletions

View file

@ -28,6 +28,7 @@ $cn=Dossier::connect();
$g_parameter=new Noalyss_Parameter_Folder($cn);
$g_user=new User($cn);
$g_user->check(true);
IDate::set_firstDate($g_user->get_first_week_day());
set_language();
/* if a code has been asked */
if (isset($_REQUEST['plugin_code']) )

View file

@ -94,6 +94,8 @@ else
$g_user->check(true);
}
IDate::set_firstDate($g_user->get_first_week_day());
// For progress bar, for saving time , we check and answer directly
if ($op == "progressBar") {
$task_id=$http->request("task_id");

View file

@ -56,9 +56,7 @@ $cn = Dossier::connect();
global $g_user, $cn,$g_parameter,$http;
$g_user = new User($cn);
$http=new HttpInput();
if ( ! defined("FIRST_WEEK_DAY")) {
define ("FIRST_WEEK_DAY",$g_user->get_first_week_day());
}
IDate::set_firstDate($g_user->get_first_week_day());
/*
* check that the database is not empty
*/

View file

@ -37,7 +37,7 @@ class IDate extends HtmlInput
var $placeholder;
var $title;
var $autofocus;
var $firstDate; //<! first day in the calendar : 0 for sunday
static $firstDate=0; //<! first day in the calendar : 0 for sunday
function __construct($name='', $value='', $p_id="")
{
@ -47,7 +47,6 @@ class IDate extends HtmlInput
$this->extra="";
$this->style=' class="input_text" ';
$this->autofocus=false;
$this->firstDate=(defined("FIRST_WEEK_DAY"))?FIRST_WEEK_DAY:0;
}
/**
* @return string
@ -108,20 +107,18 @@ class IDate extends HtmlInput
*/
public function get_firstDate()
{
return $this->firstDate;
return $this;
return self::$firstDate;
}
/**
* @param mixed $firstDate
*/
public function set_firstDate($firstDate)
static function set_firstDate($firstDate)
{
if (isNumber($firstDate)==0){
throw new Exception("IDATE1: invalide data");
}
$this->firstDate = $firstDate;
return $this;
self::$firstDate= $firstDate;
}
@ -165,7 +162,7 @@ class IDate extends HtmlInput
</script>'
,$this->id,
$this->id,
$this->firstDate);
self::$firstDate);
return $r;
}