1 |
fraynaud |
88 |
<?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 |
fmichon |
1515 |
* @package openfoncier |
7 |
fmichon |
1184 |
* @version SVN : $Id$ |
8 |
fraynaud |
88 |
*/ |
9 |
fmichon |
1515 |
|
10 |
|
|
// |
11 |
fraynaud |
88 |
require_once "../obj/utils.class.php"; |
12 |
|
|
$f = new utils("nohtml"); |
13 |
fmichon |
1515 |
|
14 |
fraynaud |
88 |
/** |
15 |
|
|
* Affichage de la structure HTML |
16 |
|
|
*/ |
17 |
|
|
// |
18 |
fmichon |
1524 |
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 |
fraynaud |
88 |
$f->displayStartContent(); |
28 |
fmichon |
1524 |
// |
29 |
|
|
$f->setTitle(_("Liste des éléments de la bible en lien avec un evenement")); |
30 |
|
|
$f->displayTitle(); |
31 |
fmichon |
1523 |
|
32 |
fmichon |
1524 |
/** |
33 |
|
|
* |
34 |
|
|
*/ |
35 |
fmichon |
1523 |
// |
36 |
fmichon |
1524 |
(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 |
fmichon |
1523 |
(isset($_GET["complement"]) ? $complement = $_GET["complement"] : $complement = "1"); |
43 |
|
|
|
44 |
fmichon |
1524 |
/** |
45 |
|
|
* |
46 |
|
|
*/ |
47 |
|
|
// |
48 |
softime |
2408 |
$sql = "SELECT *, bible.libelle as bible_lib |
49 |
fmichon |
1524 |
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 |
softime |
2774 |
OR dossier_autorisation_type.code ='".$nature."') |
56 |
|
|
ORDER BY bible_lib ASC"; |
57 |
fraynaud |
88 |
$res = $f->db->query($sql); |
58 |
fmichon |
1524 |
$f->addToLog("app/bible.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
59 |
fraynaud |
88 |
$f->isDatabaseError($res); |
60 |
fmichon |
1524 |
// |
61 |
|
|
echo "<form method=\"post\" name=\"f3\" action=\"#\">\n"; |
62 |
|
|
// |
63 |
|
|
if ($res->numrows() > 0) { |
64 |
|
|
// |
65 |
softime |
2408 |
echo "\t<table id='tab-bible' width='100%'>\n"; |
66 |
fmichon |
1524 |
// |
67 |
|
|
echo "\t\t<tr class=\"ui-tabs-nav ui-accordion ui-state-default tab-title\">"; |
68 |
|
|
echo "<th>"._("Choisir")."</th>"; |
69 |
softime |
2408 |
echo "<th>"._("Libelle")."</th>"; |
70 |
fmichon |
1524 |
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 |
softime |
2408 |
// XXX utilisation de l'attribut titre pour afficher une infobulle |
82 |
nhaye |
2868 |
echo "<td><span class=\"content\" title=\"".htmlentities($row['contenu'])."\" id=\"content".$i."\">".$row['bible_lib']."</span></td>"; |
83 |
fmichon |
1524 |
// |
84 |
|
|
echo "</tr>\n"; |
85 |
|
|
// |
86 |
fraynaud |
343 |
$i++; |
87 |
fraynaud |
88 |
} |
88 |
fmichon |
1524 |
echo "\t</table>\n"; |
89 |
|
|
// |
90 |
|
|
echo "<div class=\"formControls\">\n"; |
91 |
|
|
$f->layout->display_form_button(array( |
92 |
|
|
"value" => _("Valider"), |
93 |
nhaye |
2651 |
"onclick" => "bible_return('f2', 'complement".($complement == "1" ? "" : $complement)."_om_html'); return false;", |
94 |
fmichon |
1524 |
)); |
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 |
fraynaud |
88 |
?> |