1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
| <?php
// No direct access
defined('_JEXEC') or die;
//print_r($params);
?>
<script>
var displaytext = "<?php echo preg_replace("/[\n\r]/", '\n', htmlspecialchars($params->get('displaytext', ''), ENT_QUOTES)); ?>";
$(function () {
/*
$('#requeteur-commune').autocomplete({
source : function(requete, reponse){
$.ajax({
url : '<?php echo JURI::base(); ?>index.php?option=com_ajax&module=requeteur&method=getCommune&format=json',
dataType : 'json',
data : {
name_startsWith : $('#recherche').val(),
maxRows : 15
},
success : function(donnee){
reponse($.map(donnee.NOM, function(objet){
//return objet.name + ', ' + objet.countryName; // on retourne cette forme de suggestion
return "111111";
}));
}
});
}
});
/*
$('#requeteur-commune').autocomplete({
source : '<?php echo JURI::base(); ?>index.php?option=com_ajax&module=requeteur&method=getCommune&format=json',
});
*/
$("#requeteur-commune").autocomplete({
minLength: 1,
scrollHeight: 220,
source: function(req, add){
$.ajax({
url : '<?php echo JURI::base(); ?>index.php?option=com_ajax&module=requeteur&method=getCommune&format=json',
type:"get",
dataType: 'jsonp',
data: 'term='+req.term,
async: true,
cache: true,
success: function(data){
var suggestions = [];
$.each(data, function(i, val){
var reqfield = "<?php echo htmlspecialchars($params->get('reqfield', 'NOM'), ENT_QUOTES); ?>";
val.id = val[reqfield];
val.value = val[reqfield];
suggestions.push(val);
});
add(suggestions);
}
});
},
select : communeSelect
});
});
function communeSelect(event, ui){
$("#requeteur-commune").val(ui.item.NOM);
/*
$.each(ui.item, function(idx, item) {
if(typeof item == "string") {
var exp = new RegExp("\{"+idx+"\}","g");
displaytext = displaytext.replace(exp, item);
}
});
displaytext = displaytext.replace(/[\n\r]{1,2}/g, "<br />");
*/
setHTMLText(ui.item.NOM, ui.item.ZONE, ui.item["ACTEUR DU DEPLOIEMENT"], ui.item.phase_1, ui.item.Annee_deb_p1, ui.item.Annee_fin_p1, ui.item.MeD, ui.item.Annee_MeD);
return false;
}
function findCommune(){
$("#requeteur-commune").val();
$.ajax({
url : '<?php echo JURI::base(); ?>index.php?option=com_ajax&module=requeteur&method=getCommune&format=json',
type:"get",
dataType: 'jsonp',
data: 'term='+$("#requeteur-commune").val()+"&req=equal",
async: true,
cache: true,
success: function(data){
if(data[0].ZONE){
setHTMLText(data[0].NOM, data[0].ZONE, data[0]["ACTEUR DU DEPLOIEMENT"]);
}
}
});
}
function setHTMLText(nom, zone, acteur,phase_1,Annee_deb_p1,Annee_fin_p1,MeD,Annee_MeD,Phase_2,Annee_deb_p2,Annee_fin_p2){
//zone publique
//uniquement phase 1 ok -- sur une annee
if (zone =="Zone publique" && phase_1 =="OUI" && Annee_deb_p1!="" && Annee_fin_p1=="" && MeD =="")
{
var displaytext = nom+"<br />";
displaytext +=zone+" - "+acteur+"<br />";
displaytext +=Annee_deb_p1+" : Déploiement Fibre"+"<br />";
$("#response-container").html(displaytext);
}
//uniquement phase 1 ok deb et fin p1
if (zone =="Zone publique" && phase_1 =="OUI" && Annee_deb_p1!=""&& Annee_fin_p1!="" && MeD =="")
{
var displaytext = nom+"<br />";
displaytext +=zone+" - "+acteur+"<br />";
displaytext +=Annee_deb_p1+"-"+Annee_fin_p1+" : Déploiement Fibre"+"<br />";
$("#response-container").html(displaytext);
}
// MeD puis Phase 1 sans fin fibre
if (zone =="Zone publique" && phase_1=="OUI" && MeD =="OUI" && Annee_deb_p1 !="" && Annee_fin_p1=="" && Annee_MeD !="")
{
var displaytext = nom+"<br />";
displaytext +=zone+" -- "+acteur+"<br />";
displaytext +=Annee_MeD+" : Montée en Débit"+"<br />";
displaytext +=Annee_deb_p1+ ": Déploiement Fibre"+"<br />";
$("#response-container").html(displaytext);
}
// MeD puis Phase 1 avec fin phase 1
if (zone =="Zone publique" && phase_1=="OUI" && MeD =="OUI" && Annee_deb_p1 !="" && Annee_fin_p1!="" && Annee_MeD !="")
{
var displaytext = nom+"<br />";
displaytext +=zone+" -- "+acteur+"<br />";
displaytext +=Annee_MeD+" : Montée en Débit"+"<br />";
displaytext +=Annee_deb_p1+"-"+Annee_fin_p1+": Déploiement Fibre"+"<br />";
$("#response-container").html(displaytext);
}
//Zone privée
if (zone =="Zone privee")
{
var displaytext = nom+"<br />";
displaytext +=zone+" -- "+acteur+"<br />";
displaytext +=Annee_deb_p1+" : Déploiement Fibre"+"<br />";
$("#response-container").html(displaytext);
}
//Zone coax SFR
if (nom =="HONDSCHOOTE" || nom=="BREBIERES" )
{
var displaytext = nom+"<br />";
displaytext +=zone+" -- modernisation coaxial - SFR "+"<br />";
$("#response-container").html(displaytext);
}
}
</script>
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
$divHeight = 200;
$divWidth = 80;
$divMarginLeft = 143;
if( $menu->getActive()->route == 'home' ){
$divHeight = 250;
$divWidth = 100;
$divMarginLeft = 0;
$divMarginTop = 75;
}
?>
<div align="center" style="background-color: #CED8F6; color: black; border-radius: 10px; height: <?php echo $divHeight ?>px;width:<?php echo $divWidth ?>%; margin-left:<?php echo $divMarginLeft ?>px;margin-top:<?php echo $divMarginTop ?>px">
<?php
//echo $menu->getActive()->route;
if( $menu->getActive()->route == 'home' ){
?>
<p style="padding-top:10px; text-align:center; color:blue">Quand ma commune sera-t-elle raccordée ?</p>
<?php
}else{
?>
<h3 style="font-size:22px;line-height:15px">ZONE PUBLIQUE / ZONE PRIVÉE ? : un outil pour savoir</h3>
<div style="height:8px;background:#FFFFFF"></div>
<?php
}
?>
<form action="post" onsubmit="return false;">
<h4>Nom de votre commune</h4>
<input type="text" class="inputbox" placeholder="<?php echo htmlspecialchars($params->get('placeholder', ''), ENT_QUOTES); ?>" id="requeteur-commune">
<button id="search-commune" onclick="findCommune()" style="display: none;"></button>
<!--br />
<br />
<input type="button" value="Je recherche" class="btn btn-primary btn"-->
</form>
<div style="padding-top: 15px; color: red" id="response-container"></div>
</div> |
Partager