19,7 → 19,7 |
// | License along with this library; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: inscription.class.php,v 1.19 2007-04-20 08:40:22 alexandre_tb Exp $ |
// CVS : $Id: inscription.class.php,v 1.20 2007-05-25 13:54:23 alexandre_tb Exp $ |
/** |
* Inscription |
* |
31,7 → 31,7 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org> |
//Autres auteurs : |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.19 $ $Date: 2007-04-20 08:40:22 $ |
*@version $Revision: 1.20 $ $Date: 2007-05-25 13:54:23 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
178,14 → 178,14 |
$this->addRule('nom', INS_NOM_REQUIS, 'required', '', 'client') ; |
$this->addElement('text', 'prenom', INS_PRENOM) ; |
$this->addRule('prenom', INS_PRENOM_REQUIS, 'required', '', 'client') ; |
$this->addElement('text', 'adresse_1', INS_ADRESSE_1) ; |
$this->addElement('text', 'adresse_2', INS_ADRESSE_2) ; |
$this->addElement('text', 'cp', INS_CODE_POSTAL) ; |
$this->addElement('text', 'adresse_1', INS_ADRESSE_1, array('id' => 'adresse_1')) ; |
$this->addElement('text', 'adresse_2', INS_ADRESSE_2, array('id' => 'adresse_2')) ; |
$this->addElement('text', 'cp', INS_CODE_POSTAL, array('id' => 'cp')) ; |
$this->addRule('cp', INS_CODE_POSTAL_REQUIS, 'required', '', 'client') ; |
$this->addElement('text', 'ville', INS_VILLE) ; |
$this->addElement('text', 'ville', INS_VILLE, array('id' => 'ville')) ; |
// L'élément pays est construit à partir du tableau liste_pays |
$liste_pays = new ListeDePays($GLOBALS['ins_db']) ; |
$this->addElement('select', 'pays', INS_PAYS, $liste_pays->getListePays(INS_LANGUE_DEFAUT)) ; |
$this->addElement('select', 'pays', INS_PAYS, $liste_pays->getListePays(INS_LANGUE_DEFAUT), array('id' => 'pays')) ; |
$this->addElement('text', 'telephone', INS_TELEPHONE, array('size' => '12')) ; |
$this->addElement('text', 'fax', INS_FAX, array('size' => '12')) ; |
$this->addElement('text', 'site', INS_SITE_INTERNET) ; |
193,8 → 193,15 |
$this->setMaxFileSize(150000); //logo de 15ko maximum |
if (INS_CHAMPS_LETTRE != '') $this->addElement('checkbox', 'lettre',INS_LETTRE, '<br />') ; |
$this->addElement('checkbox', 'visible',INS_VISIBLE, '<br />') ; |
|
$this->addElement('hidden', 'est_structure', 0) ; |
$defauts=array ('lettre'=>1,'pays'=>'FR'); |
$defauts=array ('lettre'=>1,'pays'=>'FR'); |
if (isset ($GLOBALS['ins_config']['ic_google_key']) && $GLOBALS['ins_config']['ic_google_key'] != '') { |
$this->addElement('button', 'chercher_sur_carte', 'Vérifier mon adresse avec la carte', array("onclick" => "showAddress();")); |
$this->addElement('text', 'latitude', 'Latitude', array('id' => 'latitude', 'size' => 6, 'readonly' => 'readonly')); |
$this->addElement('text', 'longitude', 'longitude', array('id' => 'longitude', 'size' => 6, 'readonly' => 'readonly')); |
$this->addElement('html', '<tr><td colspan="2" ><div id="map" style="width: 600px; height: 450px"></div></td></tr>'); |
} |
$this->setDefaults($defauts); |
// on fait un groupe avec les boutons pour les mettres sur la même ligne |
$boutons[] = &HTML_QuickForm::createElement('button', 'annuler', INS_ANNULER, array ("onclick" => "javascript:document.location.href='".$url."'", |
201,6 → 208,104 |
'id' => 'annuler', 'class' => 'bouton')); |
$boutons[] = &HTML_QuickForm::createElement('submit', 'valider', INS_VALIDER, array ('id' => 'valider', 'class' =>'bouton')); |
$this->addGroup($boutons, 'groupe_bouton', '', "\n"); |
|
if (isset ($GLOBALS['ins_config']['ic_google_key']) && $GLOBALS['ins_config']['ic_google_key'] != '') { |
GEN_stockerFichierScript('googleMapScript', $GLOBALS['ins_config']['ic_google_key']); |
|
|
$script = ' |
// Variables globales |
var map = null; |
var geocoder = null; |
var lat = document.getElementById("latitude"); |
var lon = document.getElementById("longitude"); |
|
function load() { |
if (GBrowserIsCompatible()) { |
map = new GMap2(document.getElementById("map")); |
map.addControl(new GSmallMapControl()); |
map.addControl(new GMapTypeControl()); |
map.addControl(new GScaleControl()); |
map.enableContinuousZoom(); |
|
// On centre la carte sur le languedoc roussillon |
center = new GLatLng(43.84245116699036, 3.768310546875); |
map.setCenter(center, 7); |
//marker = new GMarker(center, {draggable: true}) ; |
GEvent.addListener(map, "click", function(marker, point) { |
if (marker) { |
map.removeOverlay(marker); |
var lat = document.getElementById("latitude"); |
var lon = document.getElementById("longitude"); |
lat.value = ""; |
lon.value = ""; |
} else { |
// On ajoute un marqueur a l endroit du clic et on place les coordonnees dans les champs latitude et longitude |
marker = new GMarker(point, {draggable: true}) ; |
GEvent.addListener(marker, "dragend", function () { |
coordMarker = marker.getPoint() ; |
var lat = document.getElementById("latitude"); |
var lon = document.getElementById("longitude"); |
lat.value = coordMarker.lat(); |
lon.value = coordMarker.lng(); |
}); |
map.addOverlay(marker); |
setLatLonForm(marker); |
} |
});' ; |
if ($this->getElementValue ('latitude') != '' && $this->getElementValue('longitude') != '') { |
$script .= ' |
point = new GLatLng('.$this->getElementValue('latitude').', '.$this->getElementValue('longitude').'); |
marker = new GMarker(point, {draggable: true}); |
map.addOverlay(marker);' ; |
} |
$script .= 'geocoder = new GClientGeocoder(); |
} |
}; |
function showAddress() { |
var adress_1 = document.getElementById("adresse_1").value ; |
var adress_2 = document.getElementById("adresse_2").value ; |
var ville = document.getElementById("ville").value ; |
var cp = document.getElementById("cp").value ; |
var selectIndex = document.getElementById("pays").selectedIndex; |
var pays = document.getElementById("pays").options[selectIndex].text ; |
|
var address = adress_1 + \' \' + adress_2 + \' \' + \' \' + cp + \' \' + ville + \' \' +pays ; |
if (geocoder) { |
geocoder.getLatLng( |
address, |
function(point) { |
if (!point) { |
alert(address + " not found"); |
} else { |
map.setCenter(point, 13); |
var marker = new GMarker(point, {draggable: true}); |
GEvent.addListener(marker, "dragend", function () { |
coordMarker = marker.getPoint() ; |
var lat = document.getElementById("latitude"); |
var lon = document.getElementById("longitude"); |
lat.value = coordMarker.lat(); |
lon.value = coordMarker.lng(); |
}); |
|
map.addOverlay(marker); |
setLatLonForm(marker) |
marker.openInfoWindowHtml(address+ "'.INS_GOOGLE_MSG.'"); |
} |
} |
); |
} |
} |
function setLatLonForm(marker) { |
coordMarker = marker.getPoint() ; |
var lat = document.getElementById("latitude"); |
var lon = document.getElementById("longitude"); |
lat.value = coordMarker.lat(); |
lon.value = coordMarker.lng(); |
} |
'; |
GEN_stockerCodeScript($script); |
} |
} // end of member function construitFormulaire |
|
/** Modifie le formulaire pour l'adapter au cas des structures |