1 |
<?php |
2 |
/** |
3 |
* Ce script permet de mettre un texte de la bible dans un formulaire instruction |
4 |
* champs file d'un formulaire |
5 |
* |
6 |
* @package openfoncier |
7 |
* @version SVN : $Id$ |
8 |
*/ |
9 |
|
10 |
// |
11 |
require_once "../obj/utils.class.php"; |
12 |
$f = new utils("nohtml"); |
13 |
|
14 |
/** |
15 |
* Affichage de la structure HTML |
16 |
*/ |
17 |
// |
18 |
if ($f->isAjaxRequest()) { |
19 |
// |
20 |
header("Content-type: text/html; charset=".HTTPCHARSET.""); |
21 |
} else { |
22 |
// |
23 |
$f->setFlag("htmlonly"); |
24 |
$f->display(); |
25 |
} |
26 |
// |
27 |
$f->displayStartContent(); |
28 |
// |
29 |
$f->setTitle(_("Liste des éléments de la bible en lien avec un evenement")); |
30 |
$f->displayTitle(); |
31 |
|
32 |
/** |
33 |
* |
34 |
*/ |
35 |
// |
36 |
(isset($_GET["ev"]) ? $evenement = $_GET["ev"] : $evenement = ""); |
37 |
$evenement = intval($evenement); |
38 |
// |
39 |
(isset($_GET["idx"]) ? $idx = $_GET["idx"] : $idx = ""); |
40 |
$nature = substr($idx, 0, 2); |
41 |
// |
42 |
(isset($_GET["complement"]) ? $complement = $_GET["complement"] : $complement = "1"); |
43 |
|
44 |
/** |
45 |
* |
46 |
*/ |
47 |
// |
48 |
$sql = "SELECT *, bible.libelle as bible_lib |
49 |
FROM ".DB_PREFIXE."bible |
50 |
LEFT OUTER JOIN ".DB_PREFIXE."dossier_autorisation_type |
51 |
ON bible.dossier_autorisation_type=dossier_autorisation_type.dossier_autorisation_type |
52 |
WHERE evenement=".$evenement." |
53 |
AND complement=".$complement." |
54 |
AND (bible.dossier_autorisation_type IS NULL |
55 |
OR dossier_autorisation_type.code ='".$nature."') |
56 |
ORDER BY bible_lib ASC"; |
57 |
$res = $f->db->query($sql); |
58 |
$f->addToLog("app/bible.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
59 |
$f->isDatabaseError($res); |
60 |
// |
61 |
echo "<form method=\"post\" name=\"f3\" action=\"#\">\n"; |
62 |
// |
63 |
if ($res->numrows() > 0) { |
64 |
// |
65 |
echo "\t<table id='tab-bible' width='100%'>\n"; |
66 |
// |
67 |
echo "\t\t<tr class=\"ui-tabs-nav ui-accordion ui-state-default tab-title\">"; |
68 |
echo "<th>"._("Choisir")."</th>"; |
69 |
echo "<th>"._("Libelle")."</th>"; |
70 |
echo "</tr>\n"; |
71 |
// |
72 |
$i = 0; |
73 |
// |
74 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
75 |
// |
76 |
echo "\t\t<tr"; |
77 |
echo " class=\"".($i % 2 == 0 ? "odd" : "even")."\""; |
78 |
echo ">"; |
79 |
// |
80 |
echo "<td class=\"center\"><input type=\"checkbox\" name=\"choix[]\" value=\"".$i."\" id=\"checkbox".$i."\" /></td>"; |
81 |
// XXX utilisation de l'attribut titre pour afficher une infobulle |
82 |
echo "<td><span class=\"content\" title=\"".htmlentities($row['contenu'])."\" id=\"content".$i."\">".$row['bible_lib']."</span></td>"; |
83 |
// |
84 |
echo "</tr>\n"; |
85 |
// |
86 |
$i++; |
87 |
} |
88 |
echo "\t</table>\n"; |
89 |
// |
90 |
echo "<div class=\"formControls\">\n"; |
91 |
$f->layout->display_form_button(array( |
92 |
"value" => _("Valider"), |
93 |
"onclick" => "bible_return('f2', 'complement".($complement == "1" ? "" : $complement)."_om_html'); return false;", |
94 |
)); |
95 |
$f->displayLinkJsCloseWindow(); |
96 |
echo "</div>\n"; |
97 |
|
98 |
} else { |
99 |
// |
100 |
$message_class = "error"; |
101 |
$message = _("Aucun element dans la bible pour l'evenement")." : ".$evenement; |
102 |
$f->displayMessage($message_class, $message); |
103 |
// |
104 |
echo "<div class=\"formControls\">\n"; |
105 |
$f->displayLinkJsCloseWindow(); |
106 |
echo "</div>\n"; |
107 |
} |
108 |
// |
109 |
echo "</form>\n"; |
110 |
|
111 |
/** |
112 |
* Affichage de la structure HTML |
113 |
*/ |
114 |
// |
115 |
$f->displayEndContent(); |
116 |
|
117 |
?> |