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 - 090 - rendre_avis |
18 |
// Pour qu'un service rende l'avis |
19 |
$this->class_actions[90] = array( |
20 |
"identifier" => "rendre_avis", |
21 |
"portlet" => array( |
22 |
"type" => "action-self", |
23 |
"libelle" => _("Rendre un avis"), |
24 |
"order" => 40, |
25 |
"class" => "edit-16", |
26 |
), |
27 |
"view" => "formulaire", |
28 |
"method" => "modifier", |
29 |
"permission_suffix" => "modifier", |
30 |
"condition" => array("is_consultation_retour_avis_service"), |
31 |
"button" => _("Modifier"), |
32 |
); |
33 |
|
34 |
// ACTION - 120 - marquer |
35 |
// |
36 |
$this->class_actions[120] = array( |
37 |
"identifier" => "marquer", |
38 |
"portlet" => array( |
39 |
"type" => "action-direct", |
40 |
"libelle" => _("Marquer le dossier"), |
41 |
"order" => 80, |
42 |
"class" => "marque-16", |
43 |
), |
44 |
"method" => "marquer", |
45 |
"permission_suffix" => "marquer", |
46 |
"condition" => array("is_markable"), |
47 |
); |
48 |
|
49 |
// ACTION - 130 - démarquer |
50 |
// |
51 |
$this->class_actions[130] = array( |
52 |
"identifier" => "demarquer", |
53 |
"portlet" => array( |
54 |
"type" => "action-direct", |
55 |
"libelle" => _("Dé-marquer le dossier"), |
56 |
"order" => 80, |
57 |
"class" => "demarque-16", |
58 |
), |
59 |
"method" => "demarquer", |
60 |
"permission_suffix" => "demarquer", |
61 |
"condition" => array("is_unmarkable"), |
62 |
); |
63 |
} |
64 |
|
65 |
function setType(&$form, $maj) { |
66 |
parent::setType($form, $maj); |
67 |
|
68 |
if($this->getParameter("maj") == 3) { |
69 |
// Cache le fieldset avis rendu |
70 |
$form->setType('fichier', 'hidden'); |
71 |
$form->setType('avis_consultation', 'hidden'); |
72 |
$form->setType("motivation", "hidden"); |
73 |
} |
74 |
|
75 |
// On définit le type des champs pour les actions direct |
76 |
// utilisant la vue formulaire |
77 |
if ($maj == 120 || $maj == 130) { |
78 |
foreach ($this->champs as $key => $value) { |
79 |
$form->setType($value, 'hidden'); |
80 |
} |
81 |
} |
82 |
} |
83 |
|
84 |
function is_markable() { |
85 |
if ($this->getVal("marque") == 'f') { |
86 |
return true; |
87 |
} |
88 |
return false; |
89 |
} |
90 |
|
91 |
function is_unmarkable() { |
92 |
return !$this->is_markable(); |
93 |
} |
94 |
|
95 |
function marquer($val = array(), &$dnu1 = null, $dnu2 = null) { |
96 |
return $this->manage_marque(true); |
97 |
} |
98 |
|
99 |
function demarquer($val = array(), &$dnu1 = null, $dnu2 = null) { |
100 |
return $this->manage_marque(false); |
101 |
} |
102 |
|
103 |
function manage_marque($bool) { |
104 |
// Begin |
105 |
$this->begin_treatment(__METHOD__); |
106 |
// Mise à jour |
107 |
$val = array("marque"=>$bool); |
108 |
$ret = $this->f->db->autoExecute( |
109 |
DB_PREFIXE."consultation", |
110 |
$val, |
111 |
DB_AUTOQUERY_UPDATE, |
112 |
"consultation = ".$this->getVal('consultation')); |
113 |
if (database::isError($ret, true)) { |
114 |
$this->erreur_db($ret->getDebugInfo(), $ret->getMessage(), 'consultation'); |
115 |
$this->correct = false; |
116 |
$this->addToMessage(_("Erreur de base de donnees. Contactez votre administrateur.")); |
117 |
return $this->end_treatment(__METHOD__, false); |
118 |
} |
119 |
$state = ($bool) ? _("marqué") : _("dé-marqué"); |
120 |
$this->addToMessage(_("Dossier").' '.$state.' '._("avec succès.")); |
121 |
$this->correct = true; |
122 |
return $this->end_treatment(__METHOD__, true); |
123 |
} |
124 |
|
125 |
|
126 |
/** |
127 |
* CONDITION - Défini si l'utilisateur est de service interne. |
128 |
* |
129 |
* @return boolean true si correspond false sinon |
130 |
*/ |
131 |
public function is_consultation_retour_avis_service() { |
132 |
|
133 |
return $this->f->isAccredited("consultation_retour_avis_service"); |
134 |
} |
135 |
|
136 |
|
137 |
}// fin classe |
138 |
|
139 |
?> |