noalyss  Version-6.9.1.8
 All Data Structures Namespaces Files Functions Variables Pages
class_idate.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of NOALYSS.
5  *
6  * NOALYSS is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * NOALYSS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with NOALYSS; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 // Copyright Author Dany De Bontridder danydb@aevalys.eu
22 
23 ///!\file
24 //\brief Html Input
25 
26 
27 /// Html Input : Input a date format dd.mm.yyyy
28 /// The property title should be set to indicate what it is expected
29 require_once NOALYSS_INCLUDE.'/lib/class_html_input.php';
30 
31 class IDate extends HtmlInput
32 {
33 
35  var $title;
37 
38  function __construct($name='', $value='', $p_id="")
39  {
40  parent::__construct($name, $value, $p_id);
41  $this->title="";
42  $this->placeholder="dd.mm.yyyy";
43  $this->extra="";
44  $this->style=' class="input_text" ';
45  $this->autofocus=false;
46  }
47 
48  /* !\brief show the html input of the widget */
49 
50  public function input($p_name=null, $p_value=null)
51  {
52  $this->name=($p_name==null)?$this->name:$p_name;
53  $this->value=($p_value==null)?$this->value:$p_value;
54  if ($this->readOnly==true)
55  return $this->display();
56  if ($this->id=="") $this->id=self::generate_id($this->name);
57  $t= 'title="'.$this->title.'" ';
58  $autofocus=($this->autofocus)?" autofocus ":"";
59 
60  $r=sprintf('
61  <input type="text" name="%s" id="%s"
62  class="input_text"
63  size="10" style="width:6em"
64  value ="%s"
65  placeholder="%s"
66  title="%s"
67  %s
68  pattern="[0-9]{1,2}.[0-9]{1,2}.[0-9]{4}"
69  />
70  <img src="image/x-office-calendar.png" id="%s_trigger"
71  style="cursor: pointer"
72  onmouseover="this.style.background=\'red\';" onmouseout="this.style.background=\'\'"/>
73  ',$this->name,$this->id,$this->value,$this->placeholder,$this->title,$t,$this->id
74  );
75 
76  $r.=sprintf('<script type="text/javascript">
77  Calendar.setup({'.
78  'inputField : "%s", // id of the input field
79  ifFormat : "%%d.%%m.%%Y", // format of the input field
80  button : "%s_trigger", // trigger for the calendar (button ID)
81  align : "Bl", // alignment (defaults to "Bl")
82  singleClick : true
83  });
84  </script>'
85  ,$this->id,$this->id);
86  return $r;
87  }
88 
89  /* !\brief print in html the readonly value of the widget */
90 
91  public function display()
92  {
93  $r="<span> : ".$this->value;
94  $r.='<input type="hidden" name="'.$this->name.'"'.
95  'id="'.$this->name.'"'.
96  ' value = "'.$this->value.'"></span>';
97  return $r;
98  }
99 
100  static public function test_me()
101  {
102 
103  }
104 
105 }
$opd_description style
static test_me()
$placeholder
Definition: class_idate.php:34
for($e=0;$e< count($array);$e++) $desc readOnly
display()
Definition: class_idate.php:91
input($p_name=null, $p_value=null)
Definition: class_idate.php:50
$poste extra
$from_poste name
__construct($name='', $value='', $p_id="")
Definition: class_idate.php:38
class widget This class is used to create all the HTML INPUT TYPE and some specials which works with ...
Html Input : Input a date format dd.mm.yyyy The property title should be set to indicate what it is e...
Definition: class_idate.php:31