Php 5 classe calendrier qui renvoie la date clique dans 1 lment html choisi -------------------------------------------------------------------------------
Url     : http://codes-sources.commentcamarche.net/source/42717-php-5-classe-calendrier-qui-renvoie-la-date-cliquee-dans-1-element-html-choisiAuteur  : guill76Date    : 23/08/2013
Licence :
=========

Ce document intitul  Php 5 classe calendrier qui renvoie la date clique dans 1 lment html choisi   issu de CommentCaMarche
(codes-sources.commentcamarche.net) est mis  disposition sous les termes de
la licence Creative Commons. Vous pouvez copier, modifier des copies de cette
source, dans les conditions fixes par la licence, tant que cette note
apparat clairement.

Description :
=============

1 nouvelle classe de calendrier:
<br />
<br />Fonctionnalit&eacute;s : 
<br /
>- alimente par GET la date selectionn&eacute;e dans le text box ou n'importe qu
el autre &eacute;l&eacute;ment de votre choix .
<br />- possibilit&eacute; d'af
ficher le calendrier:
<br />     soit dans la page courante :la page ne se refe
rme pas apr&egrave;s selection de la date
<br />     soit dans dans 1 popup ouv
rante: la popup se referme apr&egrave;s slection de la date 
<br />     sur 1 m
ois navigable, sur un nombre de mois pr&eacute;cis &agrave; partir d'une mois pr
&eacute;cis ou du mois en cours.
<br />
<br />- possibilit&eacute; d'utiliser 
ses apparences favorites avec les styles css d&eacute;finis par l'utilisateur
<
br />
<br />Fonctionnalit&eacute;s suppl&eacute;mentaires:
<br />Mise &agrave;
 jour:
<br />Ajout des it&eacute;rateurs et des accesseurs de tableaux.
<br />

<br />La version &agrave; jour est dans le ZIP
<br /><a name='source-exemple'
></a><h2> Source / Exemple : </h2>

<br /><pre class='code' data-mode='basic'>


&lt;?php

define ('MSG_WRONG_STYLE_TYPE','Style non paramtrable');

/**



<ul><li> class myIterator  implements Iterator,Countable,Seekableiterator,Array
Access
</li><li>/</li></ul>
class myIterator  implements Iterator,Countable,Se
ekableiterator,ArrayAccess
{
  /**

<ul>  <li> property protected array $oIt
ems:</li></ul>
  *

<ul>  <li> desc: tableau d'lments .
</li>  <li>/</li><
/ul>
  protected $oItems=null;
  
  /**

<ul>  <li> property protected int 
$ipos</li></ul>
  *

<ul>  <li> desc: indice itrative de Position relative

</li>  <li>/</li></ul>
  protected $iPos=0;
  
  /**

<ul>  <li> property p
rotected int $iMin</li></ul>
  *

<ul>  <li> desc: indice minimale de bornage

</li>  <li>/</li></ul>
  protected $iMin=0;
  
  /**

<ul>  <li> property
 protected int $iLimit</li></ul>
  *

<ul>  <li> desc: nombre limite d'occure
nces bornes
</li>  <li>/</li></ul>
  protected $iLimit;
  
  /**

<ul>  <
li> property int  $iOffset</li></ul>
  *

<ul>  <li> desc: Indice itrative d
e Position absolue
</li>  <li>/</li></ul>
  protected $iOffset=0;
  
  /**


<ul>  <li> public function constructor
</li>  <li>  
</li>  <li> param int $
iMin
</li>  <li> param int $iLimit
</li>  <li>/  </li></ul>
  public function
 __construct($iMin,$iLimit)
  {
    $this-&gt;oItems=array();
    $this-&gt;i
Limit=$iLimit;
    $this-&gt;iMin=$iMin;
  }
  
  /**

<ul>  <li> public f
unction add</li></ul>
  *

<ul>  <li> desc: empile le tableau pass en param
tres sur la pile existante statique</li></ul>
  *

<ul>  <li> param int $iMin

</li>  <li> param int $iLimit
</li>  <li>/  </li></ul>
  public function add
($array)
  {
    $this-&gt;oItems[]=$array;
  }
  
  /**

<ul>  <li> publ
ic function setLimit</li></ul>
  *

<ul>  <li> desc: Dfinit un bornage $it =
&gt; indice de dpart , $l =&gt; longueur de la plage en occurences
</li>  <li>
 
</li>  <li> param int $it 
</li>  <li> param int $l 
</li>  <li>/  </li></u
l>
  public function setLimit($it,$l)
  {
    if (is_int($it)&amp;&amp;is_int
($l))
    {
      if ($l&gt;0)
      {
        $this-&gt;iMin=$it;
        
$this-&gt;iLimit=$l;
        $this-&gt;iOffset=$it;
      }
    }
  }
  
 
 /**

<ul>  <li> public function current 
</li>  <li> 
</li>  <li> desc: Met
hode itrative interface iterator 
</li>  <li>/</li></ul>
  public function cu
rrent()
  {
    if ($this-&gt;valid())
      return current($this-&gt;oItems)
;
  }
  
  /**

<ul>  <li> public function valid 
</li>  <li> 
</li>  <li
> desc: Methode itrative interface iterator 
</li>  <li>/</li></ul>
  public 
function valid()
  {
    return ( $this-&gt;iOffset &gt;= $this-&gt;iMin &amp;
&amp; $this-&gt;iPos &lt; ($this-&gt;iLimit) ) ;
    
  }
  
  /**

<ul>  
<li> public function next 
</li>  <li> 
</li>  <li> desc: Methode itrative in
terface iterator 
</li>  <li>/</li></ul>
  public function next()
  {
    $t
his-&gt;iPos++;
    $this-&gt;iOffset++;      
    return next($this-&gt;oItem
s);
    
  }
  
  /**

<ul>  <li> public function key 
</li>  <li> 
</li
>  <li> desc: Methode itrative interface iterator 
</li>  <li>/</li></ul>
  p
ublic function key()
  {
    if ($this-&gt;valid())
      return key($this-&g
t;oItems);
  }
  
  /**

<ul>  <li> public function rewind 
</li>  <li> 

</li>  <li> desc: Methode itrative interface iterator 
</li>  <li>/</li></ul>


  public function rewind()
  {
    reset ($this-&gt;oItems);
    $position =
 0;
    while($position &lt; $this-&gt;iMin) 
    {
      next($this-&gt;oIte
ms);
      $position++;
    }
    $this-&gt;iPos=0;
    $this-&gt;iOffset=$t
his-&gt;iMin;
    if (!$this-&gt;valid()) 
      throw new Exception('Invalid 
seek position');
    
  }
  
  /**

<ul>  <li> public function count 
</l
i>  <li> 
</li>  <li> desc: Methode de comptage interface countable 
</li>  <l
i>/</li></ul>
  public function count()
  {
    return count($this-&gt;oItems
);
  }
  
  /**

<ul>  <li> public function seek 
</li>  <li> 
</li>  <li
> desc: Methode itrative interface seekableIterator 
</li>  <li>/</li></ul>
 
 public function seek($index)
  {
    $this-&gt;rewind();
    $position = $th
is-&gt;iMin;
    while($position &lt; $index &amp;&amp; $this-&gt;valid()) 
  
  {
      $this-&gt;next();
      $position++;
    }
    if (!$this-&gt;vali
d()) 
    {
      throw new Exception('Invalid seek position');
    }
  }
 
 
  /**

<ul>  <li> public function OffsetExists </li></ul>
  *

<ul>  <li
> desc: Methode d' acces aux tableaux, interface arrayAccess </li></ul>
  *


<ul>  <li> param $iOffset int 
</li>  <li>/</li></ul>
  public function Offset
Exists($iOffset)
  {
    if ($iOffset &lt; $this-&gt;iLimit &amp;&amp; $iOffse
t &gt;= $this-&gt;iMin)
      return true;
    else return false;
  }
  
  
/**

<ul>  <li> public function OffsetGet 
</li>  <li> 
</li>  <li> desc: Me
thode itrative interface arrayAccess 
</li>  <li>/</li></ul>
  public functio
n OffsetGet($iOffset)
  {
    if ($this-&gt;OffsetExists($iOffset))
      ret
urn $this-&gt;oItems[$iOffset];
  }
  
  /**

<ul>  <li> public function Of
fsetSet 
</li>  <li> desc: Methode itrative interface arrayAccess 
</li>  <li
>/</li></ul>
  public function OffsetSet($iOffset,$val)
  {
    
  }
  
  
public function OffsetUnset($iOffset)
  {
    
  }
  
}

/**

<ul><li> 
class monthIterator extends myIterator
</li><li>/</li></ul>
class monthIterato
r extends myIterator
{
  /**

<ul>  <li> property int $startmonth 
</li>  <
li> indice minimale du bornage au mois 
</li>  <li>/</li></ul>
  private $star
tmonth;
  
  /**

<ul>  <li> property int $startyear 
</li>  <li> indice mi
nimale du bornage  l'anne 
</li>  <li>/</li></ul>
  private $startyear;
  


  /**

<ul>  <li> property int $iM 
</li>  <li> indice de position du mois 


</li>  <li>/</li></ul>
  private $iM;
  
  /**

<ul>  <li> property int $i
M 
</li>  <li> indice de position de l'anne 
</li>  <li>/</li></ul>
  privat
e $iY;
 
  /**

<ul>  <li> public function __construct
</li>  <li> Construc
teur.
</li>  <li> 
</li>  <li> @param string $start au format mm/yyyy  
</li>
  <li> @param int $period en mois
</li>  <li>/</li></ul>
  public function __c
onstruct($start,$period=100)
  {
    if (substr($start,2,1)!=='/')
      thro
w new Exception('Paramtre Invalide pour constructeur format mm/yyyy');
    
 
   $expl=explode('/',$start);
    
    if( ((int)$expl[0]) &lt;= 12 &amp;&amp;
 ((int)$expl[0]) &gt; 0 )
      $this-&gt;startmonth=(int)$expl[0];
    else t
hrow new Exception('Format du mois invalide') ;
    
    if ( ((int)$expl[1]) 
&gt;= 1000 &amp;&amp; ((int)$expl[1]) &lt; 9999 )
      $this-&gt;startyear=(in
t)$expl[1];
    else throw new Exception('Format anne invalide');
    
    p
arent::__construct(0,$period);
  }
  
  /**

<ul>  <li> public function 
<
/li>  <li> 
</li>  <li> desc: Getter
</li>  <li> param: mixed $prop 
</li>  <
li> return object
</li>  <li>/</li></ul>
  public function __get ($prop)
  {


    if (isset($this-&gt;$prop))
    return $this-&gt;$prop;
  }
  
  /**



<ul>  <li> public Function nextM </li></ul>
  *

<ul>  <li> desc: positionne
 les indices iM et iY (mois et anne) de l'iterateur.   
</li>  <li>/</li></ul>

  public function NextM()
  {
    if( $this-&gt;iM &lt; 12)
    {
      $t
his-&gt;iM++;
    }
    else
    {
      $this-&gt;iM = 1;
      $this-&gt;
iY++;
    }
  }
  
  /**

<ul>  <li> public Function next </li></ul>
  *



<ul>  <li> desc: methode iterative.   
</li>  <li>/</li></ul>
  public func
tion next()
  {
    parent::next();
    $this-&gt;NextM();
  }
  
  /**



<ul>  <li> public Function rewind </li></ul>
  *

<ul>  <li> desc: methode i
terative.   
</li>  <li>/</li></ul>
  public function rewind()
  {
    paren
t::rewind();
    $this-&gt;iM = $this-&gt;startmonth;
    $this-&gt;iY = $this
-&gt;startyear;
  }
}

/**

<ul><li> Class calendar
</li><li>/</li></ul>


class calendar 
{
  /**

<ul>  <li> property $monthIterator
</li>  <li> ob
ject monthIterator
</li>  <li>/</li></ul>
  private $monthIterator;
  
  /**


<ul>  <li> function Constructor
</li>  <li> 
</li>  <li> param string $sta
rt format 'mm/yyyy'
</li>  <li> param int $period  </li></ul>
  *

<ul>  <li
>/</li></ul>
  public function __construct ($start,$period)
  {
    $this-&gt
;monthIterator=new monthIterator($start,$period);
    $i=$this-&gt;monthIterato
r-&gt;iMin;
    $this-&gt;monthIterator-&gt;rewind();
    while ( $i &lt; $thi
s-&gt;monthIterator-&gt;iLimit)
    { 
      $this-&gt;monthIterator-&gt;add(s
elf::createmonth($this-&gt;monthIterator-&gt;iM,$this-&gt;monthIterator-&gt;iY))
;
      $this-&gt;monthIterator-&gt;NextM();
      $i++;
    }
  }
  
  /*
*

<ul>  <li> Function 
</li>  <li> desc: Getter
</li>  <li> param: mixed $p
rop
</li>  <li> return: property object 
</li>  <li>/</li></ul>
  public func
tion __get($prop)
  {
    if (isset($this-&gt;$prop))
      return $this-&gt;
$prop;
    else return false;
  }
  
  /**

<ul>  <li> function getCurrent
Month
</li>  <li> 
</li>  <li> desc:renvoit le mois et l'anne en cours
</li>
  <li> 
</li>  <li> return string format ('mm/yyyy') 
</li>  <li>/</li></ul>

  public function getCurrentMonth()
  {
    return (($this-&gt;monthIterator-&
gt;iM&lt;10)?'0'.$this-&gt;monthIterator-&gt;iM.'/'.$this-&gt;monthIterator-&gt;
iY:$this-&gt;monthIterator-&gt;iM.'/'.$this-&gt;monthIterator-&gt;iY);
  }
  


  public function getNextM($mode)
  {
    switch ($mode)
    { 
      case 
'M':
        return(date('m',mktime(0, 0, 0, $this-&gt;monthIterator-&gt;iM+1, 
1, $this-&gt;monthIterator-&gt;iY)));
        break;
      case 'Y':
        
return(date('Y',mktime(0, 0, 0, $this-&gt;monthIterator-&gt;iM+1, 1, $this-&gt;m
onthIterator-&gt;iY)));
        break;
    }
  }
  
  public function getPr
evM($mode)
  {
    switch ($mode)
    { 
      case 'M':
        return (da
te('m',mktime(0, 0, 0, $this-&gt;monthIterator-&gt;iM-1, 1, $this-&gt;monthItera
tor-&gt;iY)));
        break;
      case 'Y':
        return(date('Y',mktime(
0, 0, 0, $this-&gt;monthIterator-&gt;iM-1, 1, $this-&gt;monthIterator-&gt;iY)));

        break;
    }
  }
  /**

<ul>  <li> Static function
</li>  <li> 


</li>  <li> desc: Methode de fabrication de calendrier de type tableau au mois


</li>  <li> 
</li>  <li> param int $month
</li>  <li> param int $year
</li> 
 <li> return array
</li>  <li>/</li></ul>
  public static function createmonth
($month,$year)
  {
    // jour de la semaine du premier du mois
    $fom = da
te (&quot;w&quot;,mktime(0, 0, 0, $month, 1, $year));
    $day=1;
    $start=f
alse;
    //combien de jours dans le mois?
    $max=date('t',mktime(0, 0, 0, $
month, 1, $year));
    //formatage en chaine
    if ($month &lt; 10)
      $m
onth = '0'.$month;
    //init
    $d=0 ;
    //Le calendrier va occuper 6 lig
nes(semaines) de 7 colonnes(jours) pour le mois au maximum
    for ( $i=0 ; $i 
&lt; 6 ; $i++ ) 
    {
      for ( $j=0 ; $j &lt; 7 ;$j++ ) 
      {
       
 //dbut du comptage au 1er du mois pour la premiere semaine
        if ($i==0)
 
        {
          if ($fom == $d)
          {
            $start=true;

            $day=1;
          }
        }
        if ($day &lt; $max+1) 
   
     {
          if ($start ===true)
          {
            if ($day&lt;10)


              $cal[$j][]='0'.$day;
            else 
              $cal[$j][]
=$day;
            $day++;
          }
          else
            $cal[$j][]
='';
        }
        else 
          $cal[$j][]='';
        $d++;
      }

    }
    return $cal;    
  }
}

/**

<ul><li> class htmlCalendar exte
nds calendar
</li><li>/</li></ul>
class htmlCalendar extends calendar
{
  /*
*

<ul>  <li> private property string domTextBoxId
</li>  <li> 
</li>  <li> 
desc : l'id de la text box
</li>  <li>/</li></ul>
  private $domTextBoxId;
  

  /**

<ul>  <li> proprerty array settable
</li>  <li> 
</li>  <li> desc :
 les proprits modifiables
</li>  <li>/</li></ul>
  private $settable=array('
cssHeader',
                          'cssSunday',
                          '
cssWeekday',
                          'cssToday',
                          '
cssLink',
                          'cssFooter',
                          'Mo
nthByMonth',
                          'tdWidth',
                          't
dHeight',
                          'target');
  /**

<ul>  <li> proprerty a
rray style
</li>  <li> 
</li>  <li> desc: le tableau des proprits de style 


</li>  <li>/</li></ul>
  private $style=array();
  
  /**

<ul>  <li> prop
rerty string html
</li>  <li> 
</li>  <li> desc: la chaine html stockant le ca
lendrier au format html 
</li>  <li>/</li></ul>
  private $html;
  
  /**



<ul>  <li> public function __set 
</li>  <li> 
</li>  <li> desc: Setter
</li
>  <li> 
</li>  <li> param:string $type
</li>  <li> param string $strVal
</li
>  <li>/</li></ul>
  public function __set($type,$strVal)
  {
    if (in_arra
y($type,$this-&gt;settable))
    {
      $this-&gt;style[$type]=$strVal;
    
}
    else throw new Exception (MSG_WRONG_STYLE_TYPE);
  }
  
  /**

<ul> 
 <li> public function __construct
</li>  <li> 
</li>  <li> desc: Initialisatio
n et constrcution des objets parents
</li>  <li>/</li></ul>
  public function 
__construct($boxId=null,$month=null,$year=null,$period=1)
  {
    $this-&gt;do
mTextBoxId=$boxId;
    $this-&gt;MonthByMonth=false;
    $m=isset($month)?(int
)$month:(int)date('m');
    $y=isset($year)?(int)$year:(int)date('Y');
    if 
($m&lt;10)
      $m='0'.$m;
    parent::__construct($m.'/'.$y,$period);
   }


  
  /**

<ul>  <li> public function __get 
</li>  <li> 
</li>  <li> desc:
 Getter
</li>  <li> 
</li>  <li> param: mixed $prop
</li>  <li> return: mixed
 value 
</li>  <li>/</li></ul>
  public function __get($prop)
  {
    if (pa
rent::__get($prop))
      return parent::__get($prop);
    if (array_key_exist
s($prop,$this-&gt;style))
      return $this-&gt;style[$prop];
  }
  
  /**



<ul>  <li> public function getHtml 
</li>  <li> 
</li>  <li> desc: Construi
t et rcupre le tableau en chaine html
</li>  <li> 
</li>  <li> return: strin
g  
</li>  <li>/</li></ul>
  public function getHtml()
  {
    $tdW=$this-&g
t;tdWidth;
    $tdH=$this-&gt;tdHeight;
    $this-&gt;html='';
    
    
  
  //Le calendrier va occuper 5 lignes(semaines) de 7 colonnes(jours) pour le moi
s au maximum
    foreach ($this-&gt;monthIterator as $key=&gt;$month)
    { 

      $MONTH=date('M',mktime(0, 0, 0, $this-&gt;monthIterator-&gt;iM, 1, $this-&
gt;monthIterator-&gt;iY));
      if ($this-&gt;MonthByMonth!==false)
      {

        $prevm=$this-&gt;getPrevM('M');
        $prevy=$this-&gt;getPrevM('Y');

        $nextm=$this-&gt;getNextM('M');
        $nexty=$this-&gt;getNextM('Y'
);
        $chooseMonth='&lt;a class=&quot;'.$this-&gt;cssLink.'&quot; href=&qu
ot;?month='.$prevm.'&amp;year='.$prevy.'&quot;&gt;  &lt;&lt;  &lt;/a&gt; '.$MONT
H.'  '.$this-&gt;monthIterator-&gt;iY.' &lt;a class=&quot;'.$this-&gt;cssLink.'&
quot; href=&quot;?month='.$nextm.'&amp;year='.$nexty.'&amp;box='.$this-&gt;domTe
xtBoxId.'&quot;&gt;  &gt;&gt;  &lt;/a&gt;';
      }
      else $chooseMonth=' 
'.$MONTH.'  '.$this-&gt;monthIterator-&gt;iY.' ';
      $this-&gt;html.= '
   
   &lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&
quot; &gt;
      &lt;!--DWLayoutTable--&gt;
      &lt;tr&gt;
        &lt;td w
idth=&quot;'.$tdW.'&quot; height=&quot;'.$tdH.'&quot; valign=&quot;middle&quot; 
align=&quot;center&quot; class=&quot;'.$this-&gt;cssHeader.'&quot;&gt;D&lt;/td&g
t;
        &lt;td width=&quot;'.$tdW.'&quot; valign=&quot;middle&quot; align=&q
uot;center&quot; class=&quot;'.$this-&gt;cssHeader.'&quot;&gt;L&lt;/td&gt;
    
    &lt;td width=&quot;'.$tdW.'&quot; valign=&quot;middle&quot; align=&quot;cent
er&quot; class=&quot;'.$this-&gt;cssHeader.'&quot;&gt;M&lt;/td&gt;
        &lt;
td width=&quot;'.$tdW.'&quot; valign=&quot;middle&quot; align=&quot;center&quot;
 class=&quot;'.$this-&gt;cssHeader.'&quot;&gt;M&lt;/td&gt;
        &lt;td width
=&quot;'.$tdW.'&quot; valign=&quot;middle&quot; align=&quot;center&quot; class=&
quot;'.$this-&gt;cssHeader.'&quot;&gt;J&lt;/td&gt;
        &lt;td width=&quot;'
.$tdW.'&quot; valign=&quot;middle&quot; align=&quot;center&quot; class=&quot;'.$
this-&gt;cssHeader.'&quot;&gt;V&lt;/td&gt;
        &lt;td width=&quot;'.$tdW.'&
quot; valign=&quot;middle&quot; align=&quot;center&quot; class=&quot;'.$this-&gt
;cssHeader.'&quot;&gt;S&lt;/td&gt;
      &lt;/tr&gt;';
        for ($j=0;$j&lt
;6;$j++)
        {
          $this-&gt;html.='&lt;tr&gt;';
          for ($k=
0;$k&lt;7;$k++)  
          {
            $class=$this-&gt;cssWeekday;
      
      $title ='click to select in the box';
            if ($k==0)
           
   $class=$this-&gt;cssSunday;
      
            if ( ($month[$k][$j] == (int
)date('d')) and ($this-&gt;monthIterator-&gt;iM== (int)date('m')) and ($this-&gt
;monthIterator-&gt;iY == (int)date('Y')) )
            { 
              $class
 = $this-&gt;cssToday;
            }
            
            if ($this-&gt;t
arget=='opener')
              $close='self.close();';
            else $close
='';
            
            if ($this-&gt;monthIterator-&gt;iM &lt; 10)
   
           $mth='0'.$this-&gt;monthIterator-&gt;iM;
            else $mth=$this
-&gt;monthIterator-&gt;iM;
              
            if($month[$k][$j]!='')

              $this-&gt;html.= '&lt;td width=&quot;'.$tdW.'&quot; height=&quot;'
.$tdH.'&quot; valign=&quot;middle&quot; align=&quot;center&quot; class=&quot;'.$
class.'&quot;&gt;&lt;a href = &quot;#&quot; class=&quot;'.$this-&gt;cssLink.'&qu
ot; onclick=&quot;'.$this-&gt;target.'.document.getElementById(\''.$this-&gt;dom
TextBoxId.'\').value=\''.$month[$k][$j].'/'.$mth.'/'.$this-&gt;monthIterator-&gt
;iY.'\';'.$close.' &quot; '.$title.'&gt;'.(int)$month[$k][$j].'&lt;/td&gt;';
  
          else 
              $this-&gt;html.= '&lt;td width=&quot;'.$tdW.'&quo
t; height=&quot;'.$tdH.'&quot; valign=&quot;middle&quot; align=&quot;center&quot
; class=&quot;'.$class.'&quot;&gt;&lt;a href = &quot;#&quot; class=&quot;'.$this
-&gt;cssLink.'&quot; onclick=&quot;'.$this-&gt;target.'.document.getElementById(
\''.$this-&gt;domTextBoxId.'\').value=\''.$month[$k][$j].'/'.$mth.'/'.$this-&gt;
monthIterator-&gt;iY.'\';'.$close.' &quot; '.$title.'&gt;'.$month[$k][$j].'&lt;/
td&gt;';
          }
          $this-&gt;html.= '&lt;/tr&gt;';
        }
   
     $this-&gt;html.= '&lt;/tr&gt;&lt;/table&gt;&lt;table border=&quot;0&quot; c
ellpadding=&quot;0&quot; cellspacing=&quot;0&quot; &gt;&lt;tr&gt;&lt;td class=&q
uot;'.$this-&gt;cssFooter.'&quot;&gt;'.$chooseMonth.'&lt;/td&gt;&lt;/tr&gt;&lt;/
table&gt;';
      }
      return $this-&gt;html;
   }
}

?&gt;
&lt;!DOCTY
PE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;<a href=
'http://www.w3.org/' target='_blank'>http://www.w3.org/</a>    TR/xhtml1/DTD/xht
ml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;<a href='http://www.w3.org/
1999/xhtml' target='_blank'>http://www.w3.org/1999/xhtml</a>&quot;&gt;
&lt;head
&gt;
&lt;title&gt;calendrier&lt;/title&gt;
&lt;style&gt;
td.formtdcalendar {


  
  font-family: verdana;
  font-size: 11px;
  font-style:normal;
  font-w
eight:100;
  color: #330099;
  background-color: #FFFFFF;
}

td.cal_dimanch
e { 

    font-family: verdana; 
    font-size: 11px; 
    text-transform: l
owercase; 
    color: red; 
    text-decoration: none; 
    text-align: cente
r; 
    vertical-align: middle; 
    background: yellow; 
} 
td.formtdtoday 
{
  font-family:Geneva, Arial, Helvetica, sans-serif;
  font-size: 11px;
  fo
nt-style:normal;
  font-weight:bold;
  text-align:center;
  color: #FF0000;

  background-color: #A60001;
  background-image:url(./ricerca_box3.gif);
}
td
.footer {
  font-family: verdana; 
    font-size: 11px; 
    text-transform: 
lowercase; 
    color: #330099; 
    text-decoration: none; 
    text-align: 
center; 
    vertical-align: middle; 
    background: #FFFFFF; 
}
td.date_to
day { 
    font-family: verdana; 
    font-size: 11px; 
    text-transform: l
owercase; 
    color: #FFFFFF; 
    text-decoration: none; 
    text-align: c
enter; 
    vertical-align: middle; 
    background: #FF0000; 
} 
td.headert
d {
  font-family: Arial;
  font-size: 11px;
  font-weight: bold;
  color: #
F5F5F5;
  background-color: #003366;
  font-style: italic;
  text-decoration:
 blink;
  border-top-width: 1px;
  border-right-width: 1px;
  border-bottom-w
idth: 1px;
  border-left-width: 1px;
  border-top-style: solid;
  border-righ
t-style: solid;
  border-bottom-style: solid;
  border-left-style: solid;
  b
order-color:  #363636 #F5F5F5 #F5F5F5 #363636 ;
  background-image:url(header.g
if);
}
a.fld:hover {
  text-decoration:none;
  color:#633363;
  font-style:
 italic;
}
a.fld:link {
  text-decoration:none;
  color:#633363;
  font-sty
le: italic;
}
a.fld:visited {
  text-decoration:none;
  color:#633363;
  fo
nt-style: italic;
}
a.fld:active {
  text-decoration:none;
  color:#633363;


  font-style: italic;
} 
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;inp
ut type=&quot;text&quot; id=&quot;box&quot; value=&quot;&quot;/&gt;
&lt;?php
$
calendar = isset($_GET['month'])?new htmlCalendar('box',$_GET['month'],$_GET['ye
ar']):new htmlCalendar('box');
$calendar-&gt;cssHeader='headertd';
$calendar-&
gt;cssWeekday='formtdcalendar';
$calendar-&gt;cssSunday='cal_dimanche';
$calen
dar-&gt;cssToday='date_today';
$calendar-&gt;cssLink='fld';
$calendar-&gt;cssF
ooter='footer';
$calendar-&gt;tdWidth='20';
$calendar-&gt;target='window';
ec
ho $calendar-&gt;getHtml();
?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<br />
<a name='conclusion'></a><h2> Conclusion : </h2>

<br />Ajout de classe it&eacu
te;rateurs et arrayaccess.
<br />Refonte de la classe principale ajout de class
e sp&eacute;cialis&eacute;e Html.  
<br />Gestion des plages de p&eacute;riodes
.
<br />Plus plein d'autres possibilit&eacute;s.
