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 * |
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 |
$res = $f->db->query($sql); |
57 |
$f->addToLog("app/bible.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
58 |
$f->isDatabaseError($res); |
59 |
// |
60 |
echo "<form method=\"post\" name=\"f3\" action=\"#\">\n"; |
61 |
// |
62 |
if ($res->numrows() > 0) { |
63 |
// |
64 |
echo "\t<table width='100%'>\n"; |
65 |
// |
66 |
echo "\t\t<tr class=\"ui-tabs-nav ui-accordion ui-state-default tab-title\">"; |
67 |
echo "<th>"._("Choisir")."</th>"; |
68 |
echo "<th>"._("Contenu")."</th>"; |
69 |
echo "</tr>\n"; |
70 |
// |
71 |
$i = 0; |
72 |
// |
73 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
74 |
// |
75 |
echo "\t\t<tr"; |
76 |
echo " class=\"".($i % 2 == 0 ? "odd" : "even")."\""; |
77 |
echo ">"; |
78 |
// |
79 |
echo "<td class=\"center\"><input type=\"checkbox\" name=\"choix[]\" value=\"".$i."\" id=\"checkbox".$i."\" /></td>"; |
80 |
echo "<td><span class=\"content\" id=\"content".$i."\">".$row['contenu']."</span></td>"; |
81 |
// |
82 |
echo "</tr>\n"; |
83 |
// |
84 |
$i++; |
85 |
} |
86 |
echo "\t</table>\n"; |
87 |
// |
88 |
echo "<div class=\"formControls\">\n"; |
89 |
$f->layout->display_form_button(array( |
90 |
"value" => _("Valider"), |
91 |
"onclick" => "bible_return('f2', 'complement".($complement == "1" ? "" : $complement)."'); return false;", |
92 |
)); |
93 |
$f->displayLinkJsCloseWindow(); |
94 |
echo "</div>\n"; |
95 |
|
96 |
} else { |
97 |
// |
98 |
$message_class = "error"; |
99 |
$message = _("Aucun element dans la bible pour l'evenement")." : ".$evenement; |
100 |
$f->displayMessage($message_class, $message); |
101 |
// |
102 |
echo "<div class=\"formControls\">\n"; |
103 |
$f->displayLinkJsCloseWindow(); |
104 |
echo "</div>\n"; |
105 |
} |
106 |
// |
107 |
echo "</form>\n"; |
108 |
|
109 |
/** |
110 |
* Affichage de la structure HTML |
111 |
*/ |
112 |
// |
113 |
$f->displayEndContent(); |
114 |
|
115 |
?> |