1 |
<?php |
2 |
/** |
3 |
* Ce script permet d'afficher une vue gloable des workflows en fonction d'un |
4 |
* type de dossier d'instrcution. |
5 |
* |
6 |
* @package openfoncier |
7 |
* @version SVN : $Id: affichage_reglementaire_attestation.php 1468 2013-03-17 19:59:02Z fmichon $ |
8 |
*/ |
9 |
|
10 |
// |
11 |
require_once "../obj/utils.class.php"; |
12 |
$f = new utils(NULL, "workflows", |
13 |
_("parametrage")." -> "._("workflows")); |
14 |
|
15 |
|
16 |
/** |
17 |
* |
18 |
*/ |
19 |
// Ouverture de la balise - Conteneur d'onglets |
20 |
echo "<div id=\"formulaire\">\n\n"; |
21 |
// Affichage de la liste des onglets |
22 |
$f->layout->display_tab_lien_onglet1(_("par type de dossier d'instruction")); |
23 |
// Ouverture de la balise - Onglet 1 |
24 |
echo "\t<div id=\"tabs-1\">\n\n"; |
25 |
/** |
26 |
* Affichage du formulaire de sélection du type de dossier d'instruction |
27 |
*/ |
28 |
// Inclusion de la classe de gestion des formulaires |
29 |
require_once "../obj/om_formulaire.class.php"; |
30 |
// Ouverture du formulaire |
31 |
echo "\t<form"; |
32 |
echo " method=\"post\""; |
33 |
echo " id=\"workflows_form\""; |
34 |
echo " action=\"../app/workflows.php\""; |
35 |
echo ">\n"; |
36 |
// Paramétrage des champs du formulaire |
37 |
$champs = array("di_type"); |
38 |
// Création d'un nouvel objet de type formulaire |
39 |
$form = new formulaire(NULL, 0, 0, $champs); |
40 |
// Paramétrage des champs du formulaire |
41 |
$form->setLib("di_type", _("Type de dossier d'instruction")); |
42 |
$form->setType("di_type", "select"); |
43 |
$form->setTaille("di_type", 25); |
44 |
$form->setOnChange("di_type", "submit()"); |
45 |
$form->setMax("di_type", 25); |
46 |
$form->setVal("di_type", (isset($_POST["di_type"]) ? $_POST["di_type"] : "")); |
47 |
// |
48 |
$sql = " |
49 |
SELECT |
50 |
dossier_instruction_type.dossier_instruction_type, |
51 |
concat(dossier_autorisation_type_detaille.code, ' - ', dossier_instruction_type.code,' - ',dossier_instruction_type.libelle) as lib |
52 |
FROM ".DB_PREFIXE."dossier_instruction_type |
53 |
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
54 |
ON dossier_instruction_type.dossier_autorisation_type_detaille=dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
55 |
ORDER BY lib"; |
56 |
$res = $f->db->query($sql); |
57 |
$f->addToLog("app/workflows.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
58 |
$f->isDatabaseError($res); |
59 |
// |
60 |
$contenu = array(array(""), array(_("choisir le type de dossier d'instruction"))); |
61 |
while ($row =& $res->fetchrow()) { |
62 |
$contenu[0][] = $row[0]; |
63 |
$contenu[1][] = $row[1]; |
64 |
} |
65 |
$form->setSelect("di_type", $contenu); |
66 |
// Affichage du formulaire |
67 |
$form->entete(); |
68 |
$form->afficher($champs, 0, false, false); |
69 |
$form->enpied(); |
70 |
//// Affichage du bouton |
71 |
//echo "\t<div class=\"formControls\">\n"; |
72 |
//$f->layout->display_form_button(array("value" => _("Valider"))); |
73 |
//echo "\t</div>\n"; |
74 |
// Fermeture du fomulaire |
75 |
echo "\t</form>\n"; |
76 |
/** |
77 |
* |
78 |
*/ |
79 |
if (!isset($_POST["di_type"]) || $_POST["di_type"] == "") { |
80 |
// Fermeture de la balise - Onglet 1 |
81 |
echo "\n\t</div>\n"; |
82 |
// Fermeture de la balise - Conteneur d'onglets |
83 |
echo "</div>\n"; |
84 |
// |
85 |
die(); |
86 |
} |
87 |
|
88 |
/** |
89 |
* |
90 |
*/ |
91 |
// |
92 |
$sql = " |
93 |
SELECT |
94 |
concat(dossier_autorisation_type_detaille.code, ' - ', dossier_instruction_type.code,' - ',dossier_instruction_type.libelle) as lib |
95 |
FROM ".DB_PREFIXE."dossier_instruction_type |
96 |
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
97 |
ON dossier_instruction_type.dossier_autorisation_type_detaille=dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
98 |
WHERE dossier_instruction_type.dossier_instruction_type=".$_POST["di_type"]; |
99 |
$res = $f->db->getone($sql); |
100 |
$f->addToLog("app/workflows.php: db->getone(\"".$sql."\");", VERBOSE_MODE); |
101 |
$f->isDatabaseError($res); |
102 |
// |
103 |
echo "<h1>"; |
104 |
echo $res; |
105 |
echo "</h1>"; |
106 |
// |
107 |
|
108 |
// |
109 |
$sql = " |
110 |
SELECT |
111 |
etat.etat as etat, |
112 |
etat.libelle as etat_libelle, |
113 |
evenement.evenement as evenement, |
114 |
evenement.libelle as evenement_libelle |
115 |
FROM ".DB_PREFIXE."transition |
116 |
LEFT JOIN ".DB_PREFIXE."etat |
117 |
ON etat.etat=transition.etat |
118 |
LEFT JOIN ".DB_PREFIXE."evenement |
119 |
ON transition.evenement=evenement.evenement |
120 |
LEFT JOIN ".DB_PREFIXE."lien_dossier_instruction_type_evenement |
121 |
ON lien_dossier_instruction_type_evenement.evenement=transition.evenement |
122 |
WHERE lien_dossier_instruction_type_evenement.dossier_instruction_type=".$_POST["di_type"]." |
123 |
ORDER BY etat.etat, evenement.libelle"; |
124 |
$res = $f->db->query($sql); |
125 |
$f->addToLog("app/workflows.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
126 |
$f->isDatabaseError($res); |
127 |
// |
128 |
$transitions = array(); |
129 |
while ($row =& $res->fetchrow(DB_FETCHMODE_ASSOC)) { |
130 |
$transitions[] = $row; |
131 |
} |
132 |
|
133 |
// |
134 |
$etat = ""; |
135 |
foreach($transitions as $key => $transition) { |
136 |
// |
137 |
if ($transition["etat"] != $etat) { |
138 |
if ($etat != "") { |
139 |
echo "</ul>"; |
140 |
} |
141 |
// |
142 |
echo "<span class=\"label label-info\">"; |
143 |
echo "<h2>"; |
144 |
echo $transition["etat"]." - ".$transition["etat_libelle"]; |
145 |
echo "</h2>"; |
146 |
echo "</span>"; |
147 |
// |
148 |
echo "<ul>"; |
149 |
// |
150 |
$etat = $transition["etat"]; |
151 |
} |
152 |
// |
153 |
echo "<li>"; |
154 |
echo "<a href=\"../scr/form.php?obj=evenement&idx=".$transition["evenement"]."&action=3\">"; |
155 |
echo $transition["evenement_libelle"]; |
156 |
echo "</a>"; |
157 |
echo "</li>"; |
158 |
} |
159 |
|
160 |
// Fermeture de la balise - Onglet 1 |
161 |
echo "\n\t</div>\n"; |
162 |
// Fermeture de la balise - Conteneur d'onglets |
163 |
echo "</div>\n"; |
164 |
|
165 |
?> |