<?php
//$Id$
//gen openMairie le 10/02/2011 20:33
require_once ("../gen/obj/evenement.class.php");

class evenement extends evenement_gen {

    function evenement($id,&$db,$debug) {
        $this->constructeur($id,$db,$debug);
    }// fin constructeur

    function setType(&$form,$maj) {
        parent::setType($form,$maj);
        if ($maj < 2) {
            //$form->setType('fin_instruction', 'select');
            $form->setType('accord_tacite', 'select');
            $form->setType('delai_notification', 'select');
            $form->setType('delai', 'select');
            $form->setType('lettretype', 'select');
            $form->setType('consultation', 'checkbox');
        }
    }

    function setSelect(&$form, $maj,$db,$debug) {
        parent::setSelect($form, $maj,$db,$debug);

        if($maj<2){
            // lettretype
            if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php"))
                include ("../sql/".$db->phptype."/".$this->table.".form.inc.php");
            $contenu=array();
            $res = $db->query($sql_om_lettretype);
            if (database::isError($res))
                die($res->getMessage().$sql_om_lettretype);
            else{
                if ($debug == 1)
                    echo " la requete ".$sql_om_lettretype." est executee<br>";
                $contenu[0][0]='';
                $contenu[1][0]=_('choisir')."&nbsp;"._('lettretype');
                $k=1;
                while ($row=& $res->fetchRow()){
                    $contenu[0][$k]=$row[0];
                    $contenu[1][$k]=$row[1];
                    $k++;
                }
                $form->setSelect('lettretype',$contenu);
            }// fin error db
        }
        // accord_tacite
        $contenu=array();
        $contenu[0]=array('Non','Oui');
        $contenu[1]=array($this->lang('Non'),$this->lang('Oui'));
        $form->setSelect("accord_tacite",$contenu);
        // delai_notification
        $contenu=array();
        $contenu[0]=array('0','1');
        $contenu[1]=array('sans','1 '.$this->lang("mois"));
        $form->setSelect("delai_notification",$contenu);
        // delai
        $contenu=array();
        $contenu[0]=array('0','1','2','3','4','5','6','7','8','9','10','11','12','18','24');
        $contenu[1]=array('sans',
                          '1 '._("mois"),
                          '2 '._("mois"),
                          '3 '._("mois"),
                          '4 '._("mois"),
                          '5 '._("mois"),
                          '6 '._("mois"),
                          '7 '._("mois"),
                          '8 '._("mois"),
                          '9 '._("mois"),
                          '10 '._("mois"),
                          '11 '._("mois"),
                          '12 '._("mois"),
                          '18 '._("mois"),
                          '24 '._("mois")
                          );
        $form->setSelect("delai",$contenu);
    }



}// fin classe
?>