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