1 |
nhaye |
580 |
<?php |
2 |
|
|
// $Id: dossier_modificatif.php,v 1.21 2010-11-08 15:30:15 fraynaud Exp $ |
3 |
|
|
/** |
4 |
|
|
* Fichiers requis |
5 |
|
|
*/ |
6 |
|
|
|
7 |
|
|
require_once "../obj/utils.class.php"; |
8 |
|
|
/** |
9 |
|
|
* Classe utils () |
10 |
|
|
*/ |
11 |
|
|
$f = new utils("nohtml", "dossier_document", _("Document")); |
12 |
|
|
// Paramétrage =============================================================== |
13 |
|
|
echo "\n<div id=\"sformulaire\">\n"; |
14 |
|
|
echo "\n<!-- ########## START FORMULAIRE ########## -->\n"; |
15 |
|
|
echo "<div class=\"formEntete ui-corner-all\">\n"; |
16 |
|
|
// *** get |
17 |
|
|
(isset($_GET['idxformulaire']) ? $idxformulaire = $_GET['idxformulaire'] : $idxformulaire = ""); |
18 |
|
|
(isset($_GET['retourformulaire']) ? $retourformulaire = $_GET['retourformulaire'] : $retourformulaire = ""); |
19 |
|
|
|
20 |
|
|
$DEBUG=0; |
21 |
nhaye |
700 |
// Récupération du dossier en fonction du numéro de consultation |
22 |
nhaye |
580 |
$sql = "SELECT dossier FROM consultation WHERE consultation=$idxformulaire"; |
23 |
|
|
$dossier = $f->db->getone($sql); |
24 |
|
|
$f->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
25 |
|
|
if (database::isError($dossier, true)) { |
26 |
|
|
if (DEBUG >= DEBUG_MODE) { |
27 |
|
|
echo "erreur"; |
28 |
|
|
} |
29 |
|
|
} else { |
30 |
nhaye |
701 |
$liste=$f->getFolderFileList($dossier); |
31 |
nhaye |
700 |
// Tri du tableau par date de création des fichiers |
32 |
|
|
usort($liste, "cmp"); |
33 |
nhaye |
580 |
|
34 |
|
|
$i=0; |
35 |
|
|
echo "<ul class=\"document_list\">"; |
36 |
nhaye |
700 |
// Affichage des fichiers du dossier |
37 |
nhaye |
580 |
while($i<count($liste)){ |
38 |
nhaye |
700 |
$date=date('Ymd', $liste[$i][1]); |
39 |
|
|
|
40 |
nhaye |
580 |
if(($i+1)<count($liste)) { |
41 |
nhaye |
700 |
$date_next=date('Ymd', $liste[$i+1][1]); |
42 |
nhaye |
580 |
} else { |
43 |
|
|
$date_next=""; |
44 |
|
|
} |
45 |
nhaye |
700 |
// Affichage de la 1ere date |
46 |
nhaye |
580 |
if($i==0) { |
47 |
nhaye |
700 |
echo "<li class=\"document_list_date\">".date("d/m/Y", strtotime($date))."</li>"; |
48 |
nhaye |
580 |
} |
49 |
nhaye |
700 |
// Affichage des informations du tableau |
50 |
|
|
echo "<li class=\"document_list_name\">".$liste[$i][0]."</li>"; |
51 |
|
|
echo "<li class=\"document_list_file\"><a href=\"javascript:file('".$liste[$i][0]."');\"><span class=\"om-icon om-icon-16 om-icon-fix pdf-16\" title=\""._('Telecharger')."\">"._('Telecharger')."</span> ".$liste[$i][0]."</a></li>"; |
52 |
|
|
// Teste si le fichier suivant à la même date de création que l'actuel |
53 |
nhaye |
580 |
if(($i+1)<count($liste) AND |
54 |
nhaye |
700 |
$date_next!=$date) { |
55 |
nhaye |
580 |
echo "</ul>"; |
56 |
|
|
echo "<ul class=\"document_list\">"; |
57 |
nhaye |
700 |
echo "<li class=\"document_list_date\">".date("d/m/Y", strtotime($date_next))."</li>"; |
58 |
nhaye |
580 |
} |
59 |
|
|
$i++; |
60 |
|
|
} |
61 |
|
|
echo "</ul>"; |
62 |
|
|
} |
63 |
|
|
echo "</div>"; |
64 |
|
|
echo "</div>"; |
65 |
nhaye |
700 |
|
66 |
|
|
/** |
67 |
|
|
* Function de tri appellée par usort() |
68 |
|
|
**/ |
69 |
|
|
function cmp($a, $b) |
70 |
|
|
{ |
71 |
|
|
if ($a == $b) { |
72 |
|
|
return 0; |
73 |
|
|
} |
74 |
|
|
return ($a < $b) ? -1 : 1; |
75 |
|
|
} |
76 |
nhaye |
580 |
?> |