3 |
* Ce script permet de mettre un texte de la bible dans un formulaire instruction |
* Ce script permet de mettre un texte de la bible dans un formulaire instruction |
4 |
* champs file d'un formulaire |
* champs file d'un formulaire |
5 |
* |
* |
6 |
* @package openmairie_foncier |
* @package openfoncier |
7 |
* @version SVN : $Id: voir.php 336 2010-12-15 17:26:37Z fraynaud $ |
* @version SVN : $Id$ |
8 |
*/ |
*/ |
9 |
|
|
10 |
|
// |
11 |
require_once "../obj/utils.class.php"; |
require_once "../obj/utils.class.php"; |
12 |
$f = new utils("nohtml"); |
$f = new utils("nohtml"); |
13 |
|
|
14 |
/** |
/** |
15 |
* Affichage de la structure HTML |
* Affichage de la structure HTML |
16 |
*/ |
*/ |
17 |
// |
// |
18 |
$f->setFlag("htmlonly"); |
if ($f->isAjaxRequest()) { |
19 |
$f->display(); |
// |
20 |
|
header("Content-type: text/html; charset=".HTTPCHARSET.""); |
21 |
|
} else { |
22 |
|
// |
23 |
|
$f->setFlag("htmlonly"); |
24 |
|
$f->display(); |
25 |
|
} |
26 |
|
// |
27 |
$f->displayStartContent(); |
$f->displayStartContent(); |
28 |
// *** get |
// |
29 |
(isset($_GET['ev']) ? $evenement = $_GET['ev'] : $evenement = ""); |
$f->setTitle(_("Liste des éléments de la bible en lien avec un evenement")); |
30 |
$evenement=intval($evenement); |
$f->displayTitle(); |
31 |
$nature=substr($_GET['idx'],0,2); |
|
32 |
$DEBUG=0; |
/** |
33 |
// *** sql |
* |
34 |
$sql="select * from ".DB_PREFIXE."bible where evenement =".$evenement. |
*/ |
35 |
" and complement=1 and (nature = 'T' or nature ='".$nature."')"; |
// |
36 |
if ($DEBUG==1) |
($f->get_submitted_get_value("ev") ? $evenement = $f->get_submitted_get_value("ev") : $evenement = ""); |
37 |
echo $sql."<br>"; |
$evenement = intval($evenement); |
38 |
|
// |
39 |
|
($f->get_submitted_get_value("idx") ? $idx = $f->get_submitted_get_value("idx") : $idx = ""); |
40 |
|
$nature = substr($idx, 0, 2); |
41 |
|
// |
42 |
|
($f->get_submitted_get_value("complement") ? $complement = $f->get_submitted_get_value("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); |
$res = $f->db->query($sql); |
58 |
|
$f->addToLog("app/bible.php: db->query(\"".$sql."\");", VERBOSE_MODE); |
59 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
60 |
$nbligne=$res->numrows(); |
// |
61 |
if($nbligne>0){ |
echo "<form method=\"post\" name=\"f3\" action=\"#\">\n"; |
62 |
echo "<form name='f3'>"; |
// |
63 |
echo "<select size=\"1\" name=\"bible\" class=\"champFormulaire\">"; |
if ($res->numrows() > 0) { |
64 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
// |
65 |
$temp=$row['contenu']; |
echo "\t<table id='tab-bible' width='100%'>\n"; |
66 |
$opt= "<option value=\"".$temp."\">".$row['libelle']."</option>"; |
// |
67 |
echo $opt; |
echo "\t\t<tr class=\"ui-tabs-nav ui-accordion ui-state-default tab-title\">"; |
68 |
} |
echo "<th>"._("Choisir")."</th>"; |
69 |
echo "</select>"; |
echo "<th>"._("Libelle")."</th>"; |
70 |
echo "<br><br><input type='submit' tabindex=70 value='V a l i d e r' onclick='javascript:recup();' style='".$styleBouton."'></center>"; |
echo "</tr>\n"; |
71 |
echo "</form>"; |
// |
72 |
}else{ |
$i = 0; |
73 |
echo "aucun element dans la bible pour l'evenement = ".$evenement; |
// |
74 |
echo "<br><center><a href=# onclick='window.close();'>"; |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
75 |
echo "<img src='..\img\fermer.png' border='0' alt='Fermer cette fenetre' align='middle'>"; |
// |
76 |
echo "</a></center>"; |
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 |
<script language="javascript"> |
// |
90 |
function recup() |
echo "<div class=\"formControls\">\n"; |
91 |
{ |
$f->layout->display_form_button(array( |
92 |
opener.document.f2.complement.value = opener.document.f2.complement.value+document.f3.bible.value+"\r"; |
"value" => _("Valider"), |
93 |
this.close(); |
"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 |
} |
} |
|
</script> |
|
|
</body> |
|
|
</html> |
|
108 |
|
// |
109 |
|
echo "</form>\n"; |
110 |
|
|
111 |
|
/** |
112 |
|
* Affichage de la structure HTML |
113 |
|
*/ |
114 |
|
// |
115 |
|
$f->displayEndContent(); |
116 |
|
|
117 |
|
?> |