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

Contents of /trunk/obj/demande_avis_encours.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3985 - (show annotations)
Mon Apr 18 08:27:22 2016 UTC (8 years, 9 months ago) by nmeucci
File size: 3402 byte(s)
* Évolution - Ajout des actions marquer/démarquer le dossier sur les demandes
  d'avis en cours afin de signifier que le service consulté l'a pris en charge.

1 <?php
2 //$Id: demande_avis_encours.class.php 4589 2015-04-17 16:04:48Z nhaye $
3 //gen openMairie le 17/10/2012 18:01
4
5 require_once ("../obj/demande_avis.class.php");
6
7 class demande_avis_encours extends demande_avis {
8
9 /**
10 * Définition des actions disponibles sur la classe.
11 *
12 * @return void
13 */
14 function init_class_actions() {
15 parent::init_class_actions();
16
17 // ACTION - 120 - marquer
18 //
19 $this->class_actions[120] = array(
20 "identifier" => "marquer",
21 "portlet" => array(
22 "type" => "action-direct",
23 "libelle" => _("Marquer le dossier"),
24 "order" => 80,
25 "class" => "marque-16",
26 ),
27 "method" => "marquer",
28 "permission_suffix" => "marquer",
29 "condition" => array("is_markable"),
30 );
31
32 // ACTION - 130 - démarquer
33 //
34 $this->class_actions[130] = array(
35 "identifier" => "demarquer",
36 "portlet" => array(
37 "type" => "action-direct",
38 "libelle" => _("Dé-marquer le dossier"),
39 "order" => 80,
40 "class" => "demarque-16",
41 ),
42 "method" => "demarquer",
43 "permission_suffix" => "demarquer",
44 "condition" => array("is_unmarkable"),
45 );
46 }
47
48 function setType(&$form, $maj) {
49 parent::setType($form, $maj);
50
51 if($this->getParameter("maj") == 3) {
52 // Cache le fieldset avis rendu
53 $form->setType('fichier', 'hidden');
54 $form->setType('avis_consultation', 'hidden');
55 $form->setType("motivation", "hidden");
56 }
57
58 // On définit le type des champs pour les actions direct
59 // utilisant la vue formulaire
60 if ($maj == 120 || $maj == 130) {
61 foreach ($this->champs as $key => $value) {
62 $form->setType($value, 'hidden');
63 }
64 }
65 }
66
67 function is_markable() {
68 if ($this->getVal("marque") == 'f') {
69 return true;
70 }
71 return false;
72 }
73
74 function is_unmarkable() {
75 return !$this->is_markable();
76 }
77
78 function marquer($val = array(), &$dnu1 = null, $dnu2 = null) {
79 return $this->manage_marque(true);
80 }
81
82 function demarquer($val = array(), &$dnu1 = null, $dnu2 = null) {
83 return $this->manage_marque(false);
84 }
85
86 function manage_marque($bool) {
87 // Begin
88 $this->begin_treatment(__METHOD__);
89 // Mise à jour
90 $val = array("marque"=>$bool);
91 $ret = $this->f->db->autoExecute(
92 DB_PREFIXE."consultation",
93 $val,
94 DB_AUTOQUERY_UPDATE,
95 "consultation = ".$this->getVal('consultation'));
96 if (database::isError($ret, true)) {
97 $this->erreur_db($ret->getDebugInfo(), $ret->getMessage(), 'consultation');
98 $this->correct = false;
99 $this->addToMessage(_("Erreur de base de donnees. Contactez votre administrateur."));
100 return $this->end_treatment(__METHOD__, false);
101 }
102 $state = ($bool) ? _("marqué") : _("dé-marqué");
103 $this->addToMessage(_("Dossier").' '.$state.' '._("avec succès."));
104 $this->correct = true;
105 return $this->end_treatment(__METHOD__, true);
106 }
107
108 }// fin classe
109
110 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26