/[openfoncier]/trunk/obj/architecte.class.php
ViewVC logotype

Diff of /trunk/obj/architecte.class.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3473 by nhaye, Tue May 12 09:57:20 2015 UTC revision 3475 by nhaye, Wed May 13 07:42:20 2015 UTC
# Line 6  require_once ("../gen/obj/architecte.cla Line 6  require_once ("../gen/obj/architecte.cla
6  class architecte extends architecte_gen {  class architecte extends architecte_gen {
7    
8      function architecte($id,&$db,$debug) {      function architecte($id,&$db,$debug) {
         //On active les nouvelles actions  
         $this->activate_class_action = true;  
9          $this->constructeur($id,$db,$debug);          $this->constructeur($id,$db,$debug);
10      }// fin constructeur      }// fin constructeur
11    
12      // {{{ Gestion de la confidentialité des données spécifiques      function checkAccessibility() {
13                //
14      /**          parent::checkAccessibility();
15       * Définition des actions disponibles sur la classe.          
16       *          //Affiche le bouton dans le portail d'action pour rendre un architecte non
17       * @return void          //fréquent si on est dans le contexte d'un objet architecte_frequent
18       */          if ( $this->getParameter('aff') == 'architecte' ||
19      function init_class_actions() {              $this->getVal('frequent') != 't'){
20                $this->actions_sup['frequent'] = NULL;
21          parent::init_class_actions();          }
   
         // ACTION - 001 - modifier  
         // Modifie la condition et le libellé du bouton modifier  
         $this->class_actions[1]["condition"] = array("is_not_frequent");  
   
         // ACTION - 100 - non_frequent  
         // Finalise l'enregistrement  
         $this->class_actions[100] = array(  
             "identifier" => "non_frequent",  
             "portlet" => array(  
                 "type" => "action-direct",  
                 "libelle" => _("Marquer non frequent"),  
                 "order" => 100,  
                 "class" => "radiation-16",  
             ),  
             "view" => "formulaire",  
             "method" => "set_non_frequent",  
             "permission_suffix" => "modifier_frequent",  
             "condition" => array("is_frequent"),  
         );  
     }  
   
     //}}}  
       
     /**  
      * Retourne true si pétitionnaire frequent false sinon.  
      *  
      * @return boolean retourne true si frequent false sinon.  
      */  
     function is_frequent() {  
         if($this->getVal("frequent") == 't') {  
             return true;  
         }  
         return false;  
     }  
   
     /**  
      * Retourne false si pétitionnaire frequent true sinon.  
      *  
      * @return boolean retourne false si frequent true sinon.  
      */  
     function is_not_frequent() {  
         return !$this->is_frequent();  
     }  
   
     /**  
      * TREATMENT - set_non_frequent.  
      *  
      * Cette methode permet de passer le pétitionnaire en non fréquent.  
      *  
      * @return boolean true si maj effectué false sinon  
      */  
     function set_non_frequent($val) {  
         // Cette méthode permet d'exécuter une routine en début des méthodes  
         // dites de TREATMENT.  
         $this->begin_treatment(__METHOD__);  
   
         if($this->getVal("frequent") == 't') {  
             $this->correct = true;  
             $this->valF["frequent"] = false;  
           
             $res = $this->f->db->autoExecute(  
                         DB_PREFIXE.$this->table,  
                         $this->valF,  
                         DB_AUTOQUERY_UPDATE,  
                         $this->clePrimaire."=".$this->getVal($this->clePrimaire)  
                     );  
             if ($this->f->isDatabaseError($res, true)) {  
                 // Appel de la methode de recuperation des erreurs  
                 $this->erreur_db($res->getDebugInfo(), $res->getMessage(), '');  
                 $this->correct = false;  
                 // Termine le traitement  
                 return $this->end_treatment(__METHOD__, false);  
             } else {  
                 $this->addToMessage(_("Mise a jour effectue avec succes"));  
                 return $this->end_treatment(__METHOD__, true);  
             }  
   
         } else {  
             $this->addToMessage(_("Element deja marque comme lu"));  
         }  
   
         // Termine le traitement  
         return $this->end_treatment(__METHOD__, false);  
22      }      }
23            
24      /**          /**
25       * Ajout des blocs pour la gestion des architectes fréquents           * Ajout des blocs pour la gestion des architectes fréquents
26       */           */
27      function setType(&$form, $maj) {      function setType(&$form,$maj) {
28          parent::setType($form, $maj);          parent::setType($form,$maj);
29          if ($maj < 2) { //ajouter et modifier [add and modify]          if ($maj < 2) { //ajouter et modifier [add and modify]
30            $form->setType('email', 'mail');            $form->setType('email', 'mail');
31          }          }
32                    
33            // XXX solution temporaire (pas l'endroit adéquat pour afficher un message)
34            if($this->getVal('frequent') == 't' AND $maj == 1 ) {
35                
36                //Affichage d'un message d'information
37                $this->addToMessage(_("Architecte frequent non modifiable"));
38                
39                $form->setType('nom','static');
40                $form->setType('prenom','static');
41                $form->setType('adresse1','static');
42                $form->setType('adresse2','static');
43                $form->setType('cp','static');
44                $form->setType('ville','static');
45                $form->setType('pays','static');
46                $form->setType('inscription','static');
47                $form->setType('conseil_regional','static');
48                $form->setType('telephone','static');
49                $form->setType('fax','static');
50                $form->setType('email','static');
51                $form->setType('note','static');
52                $form->setType('frequent','checkboxstatic');
53                $form->setType('nom_cabinet','static');
54            }
55      }      }
56            
57      function setLayout(&$form, $maj){      function setLayout(&$form, $maj){
# Line 195  class architecte extends architecte_gen Line 131  class architecte extends architecte_gen
131          $prenom = $this->getVal('prenom');          $prenom = $this->getVal('prenom');
132                    
133          //Affichage du bouton pour ajout si dans un objet qui n'est pas en BDD          //Affichage du bouton pour ajout si dans un objet qui n'est pas en BDD
134          if ( $nom == "" ){          if ( $this->getParameter("maj") === 0 ){
135              printf ("<span class=\"om-form-button add-16 add_architecte\"              printf ("<span class=\"om-form-button add-16 add_architecte\"
136                  onclick=\"popupIt('architecte',                  onclick=\"popupIt('architecte',
137                  '../scr/sousform.php?obj=architecte&action=0'+                  '../scr/sousform.php?obj=architecte&action=0'+

Legend:
Removed from v.3473  
changed lines
  Added in v.3475

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26