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 |
|
|
* @package openmairie_foncier |
7 |
|
|
* @version SVN : $Id: voir.php 336 2010-12-15 17:26:37Z fraynaud $ |
8 |
|
|
*/ |
9 |
|
|
require_once "../obj/utils.class.php"; |
10 |
|
|
$f = new utils("nohtml"); |
11 |
|
|
/** |
12 |
|
|
* Affichage de la structure HTML |
13 |
|
|
*/ |
14 |
|
|
// |
15 |
|
|
$f->setFlag("htmlonly"); |
16 |
|
|
$f->display(); |
17 |
|
|
$f->displayStartContent(); |
18 |
|
|
// *** get |
19 |
|
|
(isset($_GET['ev']) ? $evenement = $_GET['ev'] : $evenement = ""); |
20 |
|
|
$evenement=intval($evenement); |
21 |
|
|
$nature=substr($_GET['idx'],0,2); |
22 |
|
|
$DEBUG=0; |
23 |
|
|
// *** sql |
24 |
fraynaud |
253 |
$sql="select * from ".DB_PREFIXE."bible where evenement =".$evenement. |
25 |
fraynaud |
88 |
" and complement=1 and (nature = 'T' or nature ='".$nature."')"; |
26 |
|
|
$res = $f->db->query($sql); |
27 |
|
|
$f->isDatabaseError($res); |
28 |
|
|
$nbligne=$res->numrows(); |
29 |
fraynaud |
343 |
if ($DEBUG==1) |
30 |
|
|
echo $sql."<br>"; |
31 |
fraynaud |
88 |
if($nbligne>0){ |
32 |
|
|
echo "<form name='f3'>"; |
33 |
fraynaud |
343 |
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">\n"; |
34 |
|
|
echo "\t<legend class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
35 |
|
|
echo _("Liste de la bible en lien avec cette arrete municipal")."</legend>"; |
36 |
|
|
echo "<table width='100%'>"; |
37 |
|
|
echo "<tr class=\"ui-tabs-nav ui-accordion ui-state-default tab-title\">"; |
38 |
|
|
echo "<td>"._("Choisir")."</td>"; |
39 |
|
|
echo "<td>"._("Contenu")."</td>"; |
40 |
|
|
echo "</tr>"; |
41 |
|
|
$i = 0 ; |
42 |
fraynaud |
88 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
43 |
fraynaud |
343 |
echo "<tr>"; |
44 |
|
|
echo '<td><input type="checkbox" name="choix[]" value="'.$i.'" id="'.$i.'"></td>'; |
45 |
|
|
echo "<td><span id='contenu[".$i."]'>".$row['contenu']."</span></td>"; |
46 |
|
|
echo "<td>"; |
47 |
|
|
echo "</td>"; |
48 |
|
|
echo "</tr>"; |
49 |
|
|
$i++; |
50 |
fraynaud |
88 |
} |
51 |
fraynaud |
343 |
echo "\t\t\t</table>\n"; |
52 |
|
|
echo "</fieldset>"; |
53 |
fraynaud |
265 |
echo "<br><br><input type='submit' tabindex=70 value='V a l i d e r' onclick='javascript:recup();'></center>"; |
54 |
fraynaud |
88 |
echo "</form>"; |
55 |
|
|
}else{ |
56 |
|
|
echo "aucun element dans la bible pour l'evenement = ".$evenement; |
57 |
|
|
echo "<br><center><a href=# onclick='window.close();'>"; |
58 |
fraynaud |
254 |
echo "<img src='img/fermer.png' border='0' alt='Fermer cette fenetre' align='middle'>"; |
59 |
fraynaud |
88 |
echo "</a></center>"; |
60 |
|
|
} |
61 |
|
|
?> |
62 |
|
|
<script language="javascript"> |
63 |
fraynaud |
343 |
var listeElement=''; |
64 |
|
|
function getListeElement(){ |
65 |
|
|
for(var i = 0; i < <?php echo $i;?>; i++){ |
66 |
|
|
if (document.getElementById(i).checked == true ){ |
67 |
|
|
listeElement += document.getElementById('contenu['+i+']').firstChild.nodeValue + '\r'; |
68 |
|
|
listeElement += '\n\r'; |
69 |
|
|
} |
70 |
|
|
} |
71 |
|
|
} |
72 |
|
|
function recup(){ |
73 |
|
|
getListeElement(); |
74 |
|
|
opener.document.f2.complement.value = opener.document.f2.complement.value+listeElement+"\r"; |
75 |
|
|
window.close(); |
76 |
|
|
} |
77 |
fraynaud |
88 |
</script> |
78 |
|
|
</body> |
79 |
|
|
</html> |