1 |
vpihour |
1146 |
<?php |
2 |
|
|
/** |
3 |
|
|
* Widget - |
4 |
|
|
* |
5 |
|
|
* @package openmairie_exemple |
6 |
|
|
* @version SVN : $Id: widget_recherche_dossier.php 850 2011-11-23 22:11:30Z vpihour $ |
7 |
|
|
*/ |
8 |
|
|
|
9 |
|
|
require_once "../obj/utils.class.php"; |
10 |
|
|
if (!isset($f)) { |
11 |
|
|
$f = new utils(NULL, "recherche_dossiers", _("Widget - Recherche Acces Direct")); |
12 |
|
|
} |
13 |
|
|
|
14 |
|
|
// Message à afficher |
15 |
|
|
$msg = ''; |
16 |
|
|
$erreur = ''; |
17 |
|
|
|
18 |
|
|
// Si le formulaire a été validé |
19 |
|
|
if ( isset($_POST['validation']) && isset($_POST['dossier']) && $_POST['dossier'] != "" ){ |
20 |
|
|
|
21 |
|
|
//Création de la requête |
22 |
|
|
// Création de la requête de récupération des dossiers |
23 |
|
|
$sql = |
24 |
|
|
"SELECT |
25 |
|
|
dossier |
26 |
|
|
FROM |
27 |
|
|
".DB_PREFIXE."dossier |
28 |
|
|
WHERE |
29 |
|
|
LOWER(dossier.dossier) LIKE '%".strtolower(htmlspecialchars($_POST['dossier']))."%' "; |
30 |
|
|
|
31 |
|
|
$f->addToLog("app/widget_recherche_dossier.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
32 |
|
|
|
33 |
|
|
$res = $f->db->query($sql); |
34 |
|
|
$f->isDatabaseError($res); |
35 |
|
|
|
36 |
|
|
// Redirection vers la page adéquate ou affichage d'un message d'erreur |
37 |
|
|
//Si aucun dossier trouve |
38 |
|
|
if( $res->numrows() == 0 ) { |
39 |
|
|
|
40 |
|
|
//Affiche un message d'erreur |
41 |
|
|
$erreur = _("Aucun dossier trouve"); |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
// S'il ya plus d'un résultat |
45 |
|
|
elseif ( $res->numrows() > 1 ){ |
46 |
|
|
|
47 |
|
|
// Redirection |
48 |
|
|
echo ' |
49 |
|
|
<script type="text/javascript" > |
50 |
|
|
widget_recherche_dossier(\''.$_POST['dossier'].'\', '.$res->numrows().'); |
51 |
|
|
</script> |
52 |
|
|
'; |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
// S'il y a qu'un seul résultat |
56 |
|
|
elseif ( $res->numrows() == 1 ){ |
57 |
|
|
|
58 |
|
|
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
59 |
|
|
|
60 |
|
|
// Redirection |
61 |
|
|
echo ' |
62 |
|
|
<script type="text/javascript" > |
63 |
|
|
widget_recherche_dossier(\''.$row['dossier'].'\', 1); |
64 |
|
|
</script> |
65 |
|
|
'; |
66 |
|
|
} |
67 |
|
|
} |
68 |
|
|
// Si rien n'a été saisie dans le champ mais que le formulaire a été validé |
69 |
|
|
elseif( isset($_POST['validation']) && isset($_POST['dossier']) && $_POST['dossier'] == "") { |
70 |
|
|
|
71 |
|
|
$erreur = _("Veuiller saisir un No de dossier."); |
72 |
|
|
|
73 |
|
|
} |
74 |
|
|
|
75 |
|
|
//Affichage du formulaire |
76 |
|
|
require_once '../obj/om_formulaire.class.php'; |
77 |
|
|
// Message d'information |
78 |
|
|
echo _("Formulaire d'acces direct au dossier recherche."); |
79 |
|
|
|
80 |
|
|
echo "<div id=\"tabs-1\" class=\"ui-tabs-panel ui-widget-content ui-corner-bottom\">"; |
81 |
|
|
echo '<div class="formulaire">'; |
82 |
|
|
echo "\t<form method=\"post\" id=\"attestation_affichage_form\" action=\"../scr/dashboard.php\" class=\"formEntete ui-corner-all\">\n"; |
83 |
|
|
|
84 |
|
|
echo "<div id='msg'></div>"; |
85 |
|
|
|
86 |
|
|
/* Affichage du lien de téléchargement */ |
87 |
|
|
if( $msg != "" ) { |
88 |
|
|
|
89 |
|
|
$class = "valid"; |
90 |
|
|
$f->displayMessage($class, $msg); |
91 |
|
|
} |
92 |
|
|
|
93 |
|
|
/* Affichage de l'erreur */ |
94 |
|
|
if($erreur != "") { |
95 |
|
|
$class = "error"; |
96 |
|
|
$f->displayMessage($class, $erreur); |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
/*Le formualaire n'a pas été validé*/ |
100 |
|
|
$validation = 0; |
101 |
|
|
/*Le formualaire est en mode ajout*/ |
102 |
|
|
$maj = 0; |
103 |
|
|
/*Le formualaire a un seul champ : dossier*/ |
104 |
|
|
$champs = array("dossier"); |
105 |
|
|
|
106 |
|
|
/*Création d'un nouvel objet de type formulaire*/ |
107 |
|
|
$form = new formulaire(NULL, $validation, $maj, $champs); |
108 |
|
|
|
109 |
|
|
|
110 |
|
|
/*Caractéristique du champ*/ |
111 |
|
|
$form->setLib("dossier", _("No de dossier")." :"); |
112 |
|
|
$form->setType("dossier", "text"); |
113 |
|
|
$form->setTaille("dossier", 25); |
114 |
|
|
$form->setMax("dossier", 25); |
115 |
|
|
|
116 |
|
|
/*Affichage du formulaire*/ |
117 |
|
|
$form->entete(); |
118 |
|
|
$form->afficher($champs, $validation, false, false); |
119 |
|
|
$form->enpied(); |
120 |
|
|
|
121 |
|
|
echo "\t<div class=\"formControls\">\n"; |
122 |
|
|
echo "\t\t<input type=\"submit\" class=\"om-button ui-button ui-widget ui-state-default ui-corner-all\" |
123 |
|
|
value=\""._("Valider")."\" name=\"validation\" />\n"; |
124 |
|
|
echo "\t</div>\n"; |
125 |
|
|
|
126 |
|
|
echo "\t</form>\n"; |
127 |
|
|
echo "</div>"; |
128 |
|
|
echo "</div>"; |
129 |
|
|
|
130 |
|
|
// Message informatif |
131 |
|
|
echo _("Utilisation de * pour zones de saisie: A*D peut correspondre a 'ABCD'. |
132 |
|
|
Par defaut * est ajoute au debut et a la fin des recherches."); |
133 |
|
|
/* |
134 |
|
|
|
135 |
|
|
|
136 |
|
|
// Exécution de la requête |
137 |
|
|
$res = $f->db->query($sql); |
138 |
|
|
$f->addToLog("app/widget_dossiers_limites.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
139 |
|
|
$f->isDatabaseError($res); |
140 |
|
|
|
141 |
|
|
// Affiche des données résultats |
142 |
|
|
if ( $res->numrows() > 0 ){ |
143 |
|
|
|
144 |
|
|
$message = _("Voici la liste de vos dossiers limites : "); |
145 |
|
|
$f->displayMessage("transparent", $message); |
146 |
|
|
|
147 |
|
|
echo '<table class="tab-tab">'; |
148 |
|
|
|
149 |
|
|
// Entête de tableau |
150 |
|
|
echo '<thead>'; |
151 |
|
|
echo '<tr class="ui-tabs-nav ui-accordion ui-state-default tab-title">'; |
152 |
|
|
echo '<th class="title col-0 firstcol">'; |
153 |
|
|
echo '<span class="name">'; |
154 |
|
|
echo '</span>'; |
155 |
|
|
echo '</th>'; |
156 |
|
|
echo '<th class="title col-0 firstcol">'; |
157 |
|
|
echo '<span class="name">'; |
158 |
|
|
echo '<span class="ui-icon ui-icon-triangle-1-e"></span>'; |
159 |
|
|
echo _('dossier'); |
160 |
|
|
echo '</span>'; |
161 |
|
|
echo '</th>'; |
162 |
|
|
echo '<th class="title col-0 firstcol">'; |
163 |
|
|
echo '<span class="name">'; |
164 |
|
|
echo '<span class="ui-icon ui-icon-triangle-1-e"></span>'; |
165 |
|
|
echo _('Nom'); |
166 |
|
|
echo '</span>'; |
167 |
|
|
echo '</th>'; |
168 |
|
|
echo '<th class="title col-0 firstcol">'; |
169 |
|
|
echo '<span class="name">'; |
170 |
|
|
echo '<span class="ui-icon ui-icon-triangle-1-e"></span>'; |
171 |
|
|
echo _('date_limite'); |
172 |
|
|
echo '</span>'; |
173 |
|
|
echo '</th>'; |
174 |
|
|
echo '</tr>'; |
175 |
|
|
echo '</thead>'; |
176 |
|
|
|
177 |
|
|
echo '<tbody>'; |
178 |
|
|
|
179 |
|
|
// Données dans le tableau |
180 |
|
|
while ( $row =& $res->fetchRow() ) { |
181 |
|
|
|
182 |
|
|
echo '<tr class="tab-data odd">'; |
183 |
|
|
|
184 |
|
|
// Icône de visualisation |
185 |
|
|
// Numéro de dossier |
186 |
|
|
echo '<td class="icons">'; |
187 |
|
|
echo '<a class="lienTable" |
188 |
|
|
href="form.php?obj=dossiers_limites&action=3&idx='.$row[0].'&premier=0&advs_id=&recherche=&tricol=&selectioncol=&valide=&retour=tab">'; |
189 |
|
|
echo '<span class="om-icon om-icon-16 om-icon-fix consult-16" title="'._('Consulter').'">'; |
190 |
|
|
echo _('Consulter'); |
191 |
|
|
echo '</span>'; |
192 |
|
|
echo '</a>'; |
193 |
|
|
echo '</td>'; |
194 |
|
|
|
195 |
|
|
// Numéro de dossier |
196 |
|
|
echo '<td class="col-1 firstcol">'; |
197 |
|
|
echo '<a class="lienTable" |
198 |
|
|
href="form.php?obj=dossiers_limites&action=3&idx='.$row[0].'&premier=0&advs_id=&recherche=&tricol=&selectioncol=&valide=&retour=tab">' |
199 |
|
|
.$row[0] |
200 |
|
|
.'</a>'; |
201 |
|
|
echo '</td>'; |
202 |
|
|
|
203 |
|
|
// Nom du pétitionnaire |
204 |
|
|
echo '<td class="col-1">'; |
205 |
|
|
echo '<a class="lienTable" |
206 |
|
|
href="form.php?obj=dossiers_limites&action=3&idx='.$row[0].'&premier=0&advs_id=&recherche=&tricol=&selectioncol=&valide=&retour=tab">' |
207 |
|
|
.$row[2] |
208 |
|
|
.'</a>'; |
209 |
|
|
echo '</td>'; |
210 |
|
|
|
211 |
|
|
// Date limite |
212 |
|
|
echo '<td class="col-2 lastcol">'; |
213 |
|
|
echo '<a class="lienTable" |
214 |
|
|
href="form.php?obj=dossiers_limites&action=3&idx='.$row[0].'&premier=0&advs_id=&recherche=&tricol=&selectioncol=&valide=&retour=tab">' |
215 |
|
|
.$row[1] |
216 |
|
|
.'</a>'; |
217 |
|
|
echo '</td>'; |
218 |
|
|
|
219 |
|
|
echo "</tr>"; |
220 |
|
|
} |
221 |
|
|
|
222 |
|
|
echo '</tbody>'; |
223 |
|
|
|
224 |
|
|
echo '</table>'; |
225 |
|
|
|
226 |
|
|
$footer = "../scr/tab.php?obj=dossiers_limites"; |
227 |
|
|
$footer_title = _("Voir tous mes dossiers limites"); |
228 |
|
|
} |
229 |
|
|
else{ |
230 |
|
|
|
231 |
|
|
echo "Vous n'avez pas de dossiers limites pour le moment."; |
232 |
|
|
}*/ |
233 |
|
|
?> |