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 |
fmichon |
1184 |
* @version SVN : $Id$ |
8 |
fraynaud |
88 |
*/ |
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 |
nhaye |
1175 |
$sql="SELECT * FROM ".DB_PREFIXE."bible |
25 |
|
|
LEFT OUTER JOIN ".DB_PREFIXE."dossier_autorisation_type |
26 |
|
|
ON bible.dossier_autorisation_type=dossier_autorisation_type.dossier_autorisation_type |
27 |
|
|
WHERE evenement =".$evenement. |
28 |
|
|
" and complement=1 and (bible.dossier_autorisation_type IS NULL or dossier_autorisation_type.code ='".$nature."')"; |
29 |
fraynaud |
88 |
$res = $f->db->query($sql); |
30 |
|
|
$f->isDatabaseError($res); |
31 |
|
|
$nbligne=$res->numrows(); |
32 |
fraynaud |
343 |
if ($DEBUG==1) |
33 |
|
|
echo $sql."<br>"; |
34 |
fraynaud |
88 |
if($nbligne>0){ |
35 |
|
|
echo "<form name='f3'>"; |
36 |
fraynaud |
343 |
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">\n"; |
37 |
|
|
echo "\t<legend class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
38 |
|
|
echo _("Liste de la bible en lien avec cette arrete municipal")."</legend>"; |
39 |
|
|
echo "<table width='100%'>"; |
40 |
|
|
echo "<tr class=\"ui-tabs-nav ui-accordion ui-state-default tab-title\">"; |
41 |
|
|
echo "<td>"._("Choisir")."</td>"; |
42 |
|
|
echo "<td>"._("Contenu")."</td>"; |
43 |
|
|
echo "</tr>"; |
44 |
|
|
$i = 0 ; |
45 |
fraynaud |
88 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
46 |
fraynaud |
343 |
echo "<tr>"; |
47 |
|
|
echo '<td><input type="checkbox" name="choix[]" value="'.$i.'" id="'.$i.'"></td>'; |
48 |
|
|
echo "<td><span id='contenu[".$i."]'>".$row['contenu']."</span></td>"; |
49 |
|
|
echo "<td>"; |
50 |
|
|
echo "</td>"; |
51 |
|
|
echo "</tr>"; |
52 |
|
|
$i++; |
53 |
fraynaud |
88 |
} |
54 |
fraynaud |
343 |
echo "\t\t\t</table>\n"; |
55 |
|
|
echo "</fieldset>"; |
56 |
fraynaud |
265 |
echo "<br><br><input type='submit' tabindex=70 value='V a l i d e r' onclick='javascript:recup();'></center>"; |
57 |
fraynaud |
88 |
echo "</form>"; |
58 |
|
|
}else{ |
59 |
|
|
echo "aucun element dans la bible pour l'evenement = ".$evenement; |
60 |
|
|
echo "<br><center><a href=# onclick='window.close();'>"; |
61 |
fraynaud |
254 |
echo "<img src='img/fermer.png' border='0' alt='Fermer cette fenetre' align='middle'>"; |
62 |
fraynaud |
88 |
echo "</a></center>"; |
63 |
|
|
} |
64 |
|
|
?> |
65 |
|
|
<script language="javascript"> |
66 |
fraynaud |
343 |
var listeElement=''; |
67 |
|
|
function getListeElement(){ |
68 |
|
|
for(var i = 0; i < <?php echo $i;?>; i++){ |
69 |
|
|
if (document.getElementById(i).checked == true ){ |
70 |
|
|
listeElement += document.getElementById('contenu['+i+']').firstChild.nodeValue + '\r'; |
71 |
|
|
listeElement += '\n\r'; |
72 |
|
|
} |
73 |
|
|
} |
74 |
|
|
} |
75 |
|
|
function recup(){ |
76 |
|
|
getListeElement(); |
77 |
|
|
opener.document.f2.complement.value = opener.document.f2.complement.value+listeElement+"\r"; |
78 |
|
|
window.close(); |
79 |
|
|
} |
80 |
fraynaud |
88 |
</script> |
81 |
|
|
</body> |
82 |
|
|
</html> |