<?php
/* $Id: PC.class.php,v 1.19 2010-08-22 21:40:11 fraynaud Exp $
*/
require_once ("dossier.class.php");

class PC extends dossier{
    
    var $nature="PC";
    // variables affichages de regroupe
    var $aff_depot = "collapsible";
    var $aff_travaux = "collapsible";
    var $aff_instruction = "collapsible";
    var $aff_demandeur = "collapsible";
    var $aff_delegataire = "startClosed";
    var $aff_terrain = "startClosed";
    var $aff_localisation = "collapsible";
    var $aff_description = "startClosed";
    var $aff_amenagement = "collapsible";
    
    // specific objet_dossier
    
    
    function PC($id,&$db,$DEBUG) {
        $this->constructeur($id,$db,$DEBUG);
    } // fin constructeur

    function setVal(&$form,$maj,$validation){
        parent::setVal($form,$maj,$validation);
        $form->setVal('nature', 'PC');
    }

    function setvalF($val){
        parent::setvalF($val);
        // compatibilite pgsql
    }
    function setType(&$form,$maj) {
        parent::setType($form,$maj);
        if($maj<2){
            $form->setType('objet_dossier','select');
            $form->setType('amenagement','select');
            //$form->setType('parcelle_lot_lotissement','comboD');
            $form->setType('parcelle_lot','text');
            $form->setType('parcelle_lot_lotissement','comboG');
        }
        $form->setType('nature', 'hidden');

    }


    function setSelect(&$form, $maj,$db,$debug) {
        parent::setSelect($form, $maj,$db,$debug);
        if($maj<2){
            $contenu=array();
            $contenu[0]=array('A','B');
            $contenu[1]=array(_('maison_individuelle'),
                      _('autre_construction'));
            $form->setSelect("objet_dossier",$contenu);
            // amenagement
            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_amenagement);
            if (database::isError($res))
                die($res->getMessage());
            if ($debug == 1)
              echo " la requete ".$sql_amenagement." est executee<br>";
            $contenu[0][0]="";
            $contenu[1][0]=_('choisir')." "._('amenagement');
            $k=1;
            while ($row=& $res->fetchRow()){
                $contenu[0][$k]=$row[0];
                $contenu[1][$k]=$row[1];
                $k++;
            }
            $form->setSelect("amenagement",$contenu);
        }
    }


    function setGroupe(&$form,$maj){
        parent::setGroupe($form,$maj);       
        $form->setGroupe('objet_dossier','DF');
        $form->setGroupe('architecte','D');
        $form->setGroupe('architecte_nom','F');
        $form->setGroupe('travaux','D');
        $form->setGroupe('travaux_complement','F');
    }

    function setRegroupe(&$form,$maj){
        parent::setRegroupe($form,$maj);
        $form->setRegroupe('objet_dossier','D',_('Architecte')." / "._("Travaux"), "collapsible");
        $form->setRegroupe('architecte','G','');
        $form->setRegroupe('architecte_nom','G','');
        $form->setRegroupe('travaux','G','');
        $form->setRegroupe('travaux_complement','F','');
    }

}// fin de classe
?>