par
piaffou » 06 sept. 2018, 14:00
J 'ai le même soucis sur ce fichier sauf que cette fois ça me déconnecte automatiquement quand je lance éditer .
<?php
include '../lib/init.php';
/**
* Initialisation
*/
use Lib\Utilisateur;
use Lib\Tool;
use Lib\Action;
use Lib\BreadCrumb;
use Lib\Upload;
use Imagine\Gd\Imagine;
use Imagine\Image\Box;
$agdaId = Tool::getId($_GET['agendabis'],BASEADMIN);
Utilisateur::ifConnect();
Action::ifIsset($agdaId,'agendabis',BASEADMIN.'agenda/managerAgenda.php',$bdd);
$succes = array();
$erreur = array();
/**
* Récéption du formulaire
*/
if(isset($_POST['edit'])){
/**
* Variables de formulaire
*/
$agendaTitre = $_POST['agendaTitre'];
$agendaDescription = $_POST['agendaDescription'];
$monradioagenda = $_POST['monradioagenda'];
$entiteId= $_POST['entiteId'];
$place_Lat = $_POST['place_Lat'];
$place_Lng = $_POST['place_Lng'];
$place_Location = $_POST['place_Location'];
$dateevent = $_POST['dateevent'];
$timeevent = $_POST['timeevent'];
/* Récupération de la fiche de poste */
if($_FILES['agendaPreview']['tmp_name'])
{
if ($_FILES['agendaPreview']['error'] === UPLOAD_ERR_OK){
$agendaPreview = Upload::postFichier($_FILES['agendaPreview'],'miniature',5000000,array('jpg','jpeg','png','svg','pdf'),array());
}else
if($_FILES['agendaPreview']['error'] != UPLOAD_ERR_NO_FILE)
array_push($erreur, 'Impossible d\'uploader la miniature.');
}
/**********
* Erreurs*
**********/
if(empty($agendaTitre)) array_push($erreur, 'le nom du poste est obligatoire');
/*if(count($_FILES['imgevent']['name']) > 0){
for($i=0; $i<count($_FILES['imgevent']['name']); $i++) {
//Get the temp file path
$tmpFilePath = $_FILES['imgevent']['tmp_name'][$i];
//Make sure we have a filepath
if($tmpFilePath != ""){
$shortname = $_FILES['imgevent']['name'][$i];
//save the url and the file
$filePath = "../../img/agenda/" .$_FILES['imgevent']['name'][$i];
//Upload the file into the temp dir
if(move_uploaded_file($tmpFilePath, $filePath)) {
//insert into db
//use $shortname for the filename
//use $filePath for the relative url to the file
}}}} */
/**
* Si aucune erreur alors
*/
if(empty($erreur)){
/**
* MISE A JOUR DE LA BASE DE DONNEES
*/
$sql = $bdd->prepare("UPDATE `agendabis` SET agendaTitre = :agendaTitre,
agendaTitreSlug = :agendaTitreSlug,
agendaDescription = :agendaDescription,
agendaentiteId = :entiteId,
monradioagenda = :monradioagenda,
place_Lat = :place_Lat,
place_Lng = :place_Lng,
place_Location = :place_Location,
dateevent = :dateevent,
timeevent = :timeevent
WHERE agdaId = :agdaId");
$sql->execute(array(
'agendaTitre' => addslashes($agendaTitre),
'agendaTitreSlug' => Tool::Slug($agendaTitre),
'agendaDescription' => addslashes($agendaDescription),
'entiteId' => addslashes($entiteId),
'agdaId' => addslashes($agdaId),
'monradioagenda' => addslashes($monradioagenda),
'place_Lat'=> addslashes($place_Lat),
'place_Lng' => addslashes($place_Lng),
'place_Location' => addslashes($place_Location),
'dateevent' => addslashes($dateevent),
'timeevent' => addslashes($timeevent)
))
or die(print_r($sql->errorInfo()));
/* $agendaId = $bdd->lastInsertId();
$sql_images = $bdd->prepare('INSERT INTO `img_agenda` (`name`, `url`, `agenda_id`) VALUES (:name, :url, :agendaId)');
for ($i=0; $i<count($imgevent['name']); $i++) {
$sql_images->execute(array(
'name' => $imgevent['name'][$i],
'url' => 'img/agenda/'.$imgevent['name'][$i],
'agendaId' => $agendaId
)) or die(print_r($sql_images->errorInfo()));
}
*/
if($_FILES['agendaPreview']['tmp_name'])
{
/* Upload du logo */
move_uploaded_file($_FILES['agendaPreview']['tmp_name'], '../../img/agenda/'.$agendaPreview);
$requete_postefiche = "UPDATE agendabis SET agendaPreview = '".$agendaPreview."' WHERE agdaId = '".$agdaId."' ;";
$bdd->query($requete_postefiche);
}
/* Message de succès */
array_push($succes, 'Évenement modifié avec succès !');
/**
* Reset des variables
$agendaTitre = '';
$entiteId = '';
$agendaDescription = '';
$agendaPreview = '';
$monradioagenda = '' ;
$place_lat = '' ;
$place_lng = '' ;
$place_location = '' ;
$imgevent = '' ;
$dateevent = '' ;
$timeevent = ''; */
Tool::setFlash('Evenement modifié avec succès');
header('location:'.BASEADMIN.'agenda/managerAgenda.php');
}
}
/**
* Informations sur le l'événement
*/
$sqlbis = $bdd->query("SELECT * FROM agendabis WHERE agdaId = $agdaId ");
$data = $sqlbis->fetchObject();
$agendaTitre = stripslashes($data->agendaTitre);
$entiteId = stripslashes($data->agendaentiteId);
$agendaDescription = stripslashes($data->agendaDescription);
$agendaPreview = $data->agendaPreview;
$monradioagenda = stripslashes($data->monradioagenda);
$place_Lat = stripslashes($data->place_Lat);
$place_Lng = stripslashes($data->place_Lng);
$place_Location = stripslashes($data->place_Location);
$dateevent = stripslashes($data->dateevent);
$timeevent = stripslashes($data->timeevent);
?>
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width; initial-scale=1;">
<title><?= TITLEBACK ?></title>
<link rel="icon" type="image/png" href="<?= BASEADMIN ?>img/layout/favicon.png">
<link href="<?= BASEFRONT ?>js/scroll/scroll.css" rel="stylesheet" type="text/css">
<link href="<?= BASEADMIN ?>css/css_bo_perso.css" rel="stylesheet" type="text/css">
<link href="<?= BASEADMIN ?>css/app.css" rel="stylesheet" type="text/css">
<!--[if lt IE 9]>
<script src="<?= BASEFRONT ?>js/html5.js"></script>
<![endif]-->
</head>
<body>
<main id="main">
<?php
include '../include/menu.php';
?>
<div id="container">
<?php
include '../include/header.php';
?>
<div id="contentTitre">
<h1>Voir l'évenement : <?php echo $agendaTitre ?></h1>
</div>
<?php
BreadCrumb::add(BASEADMIN,array(
'Accueil' => 'dashboard/dashboard.php',
'Liste des offres' => 'agenda/managerAgenda.php',
'Voir un evenement' => ''
)
);
?>
<div id="content">
<?php
if(!empty($erreur)){ Tool::getMessage($erreur, 'erreur'); }
if(!empty($succes)){ Tool::getMessage($succes, 'succes'); }
?>
<form action="#" method="post" enctype="multipart/form-data" >
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 parti1_form_agenda">
<label>Titre de l'évenement</label>
<input type="text" name="agendaTitre" value="<?= $agendaTitre ?>" class="form-elem big"> <br>
<div class="extint">
<input type='radio' name='monradioagenda' value='Evenement Interne'> Evenement Interne
<input type='radio' name='monradioagenda' value='Evenement Externe'> Evenement Externe
</div>
<label>Entité *</label>
<select name="entiteId" class="form-elem big">
<option value="">Aucune entité</option>
<?php
$requete = "SELECT entiteNom, entiteId FROM entite WHERE entiteEtat = 1";
$sql = $bdd->query($requete);
/**
* Si aucun utilisateur
*/
if (!$sql || $sql->rowCount() == 0) {
} else {
while($data = $sql->fetchObject()) {
echo'<option value="'.$data->entiteId.'">'.$data->entiteNom.' </option>';
}
}
?>
</select>
<div class="date">
<label> Date </label><input type="text" id="datepicker" name='dateevent' /><span style="margin-right :10px;"><label>Heure</label></span><input type='time' name='timeevent' /></div>
<!-- champ pour autocomplement google map -->
<div class="lieu_event">
<label>Lieu : </label>
<input type="hidden" name="lat" id="lat">
<input type="hidden" name="lng" id="lng">
<input type="hidden" name="location" id="location">
<input id="pac-input" name="location" class="controls" type="text" placeholder="Enter a location">
<div id="type-selector" class="controls">
<input type="radio" name="type" id="changetype-all" checked="checked">
<label for="changetype-all">All</label>
</div>
<div id="map" style="height:400px;width:400px;"></div>
</div>
</div>
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12 parti2_form_agenda">
<label>Description</label>
<textarea name="agendaDescription" id="wysiwyg" cols="30" rows="10" class="form-elem big" ><?= stripslashes($agendaDescription) ?></textarea>
<div class="miniature">
<label>Miniature de l'évenement</label>
<input type="file" name="agendaPreview" class="form-elem big">
<div class="form-legende">
Poid maximum : 5Mo<br>
Format : jpg, jpeg, png, pdf
</div>
</div>
<div class
<div class="galerie_event">
<label>PHOTOS GALERIE</label>
<!-- champ multiple pour img galerie --->
<input type="file" name="imgevent[]" multiple />
</div>
</div>
</div>
<button name="edit" type="submit" class="form-submit turquoise medium">Enregistrer</button>
</form>
</div>
</div>
</main>
<!-- DEBUTS SCRIPT A RANGER -->
<script>
/* FONCTION MAP AUTOCOMPLEMENT*/
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -33.8688, lng: 151.2195},
zoom: 17
});
var input = /** @type {!HTMLInputElement} */(
document.getElementById('pac-input'));
var types = document.getElementById('type-selector');
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
map.controls[google.maps.ControlPosition.TOP_LEFT].push(types);
var autocomplete = new google.maps.places.Autocomplete(input);
autocomplete.bindTo('bounds', map);
var infowindow = new google.maps.InfoWindow();
var marker = new google.maps.Marker({
map: map,
anchorPoint: new google.maps.Point(0, -29)
});
autocomplete.addListener('place_changed', function() {
infowindow.close();
marker.setVisible(false);
var place = autocomplete.getPlace();
if (!place.geometry) {
// User entered the name of a Place that was not suggested and
// pressed the Enter key, or the Place Details request failed.
window.alert("No details available for input: '" + place.name + "'");
return;
}
// If the place has a geometry, then present it on a map.
if (place.geometry.viewport) {
map.fitBounds(place.geometry.viewport);
} else {
map.setCenter(place.geometry.location);
map.setZoom(17); // Why 17? Because it looks good.
}
marker.setIcon(/** @type {google.maps.Icon} */({
url: place.icon,
size: new google.maps.Size(71, 71),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(17, 34),
scaledSize: new google.maps.Size(35, 35)
}));
marker.setPosition(place.geometry.location);
marker.setVisible(true);
var item_Lat=place.geometry.location.lat();
var item_Lng=place.geometry.location.lng();
var item_Location = place.formatted_adress;
$("#lat").val(item_Lat);
$("#lng").val(item_Lng);
$("#location").val(item_Location);
var address = '';
if (place.address_components) {
address = [
(place.address_components[0] && place.address_components[0].short_name || ''),
(place.address_components[1] && place.address_components[1].short_name || ''),
(place.address_components[2] && place.address_components[2].short_name || '')
].join(' ');
}
infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + address);
infowindow.open(map, marker);
});
// Sets a listener on a radio button to change the filter type on Places
// Autocomplete.
function setupClickListener(id, types) {
var radioButton = document.getElementById(id);
radioButton.addEventListener('click', function() {
autocomplete.setTypes(types);
});
}
setupClickListener('changetype-all', []);
setupClickListener('changetype-address', ['address']);
setupClickListener('changetype-establishment', ['establishment']);
setupClickListener('changetype-geocode', ['geocode']);
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAXhsQpcp1vsMMnHwLn0IdQX_k8yT8h9xg&libraries=places&callback=initMap" async defer></script>
<!-- SCRIPT POUR DATEPICKER -->
<script>
$( function() {
$( "#datepicker" ).datepicker();
} );
</script>
<script type="text/javascript" src="<?= BASEFRONT ?>js/jquery/jquery.js"></script>
<script type="text/javascript" src="<?= BASEFRONT ?>js/jquery/jquery-ui.js"></script>
<script type="text/javascript" src="<?= BASEFRONT ?>js/tinymce/tinymce.min.js"></script>
<script type="text/javascript" src="<?= BASEFRONT ?>js/scroll/scroll.js"></script>
<script type="text/javascript" src="<?= BASEADMIN ?>js/app.js"></script>
<script>
tinymce.init({
selector: "#wysiwyg",
entity_encoding : "raw",
encoding: "UTF-8",
browser_spellcheck : true,
plugins: "link, paste, table, textcolor, code, media, image, responsivefilemanager",
height:"250px",
menubar : false,
paste_as_text: true,
content_css : '../../js/tinymce/tinymce.css',
style_formats: [
{title: 'Title h2', block: 'h2'},
{title: 'Title h3', block: 'h3'},
{title: 'Title h4', block: 'h4'}
],
relative_urls: false,
external_filemanager_path:"<?= BASEFRONT ?>js/filemanager/",
filemanager_title:"Mes images",
external_plugins: { "filemanager" : "<?= BASEFRONT ?>js/filemanager/plugin.min.js"},
toolbar: "undo redo | bold italic underline link | alignleft aligncenter alignright alignjustify | bullist numlist | styleselect forecolor | table | code | media image",
language: 'fr_FR'
});
// si clique sur entité, on fadeOut tout les service. et on fadeIn les services avec la class ayant l'id de lentité
$( "select[name='entiteId']").change(function() {
$( "select[name='serviceId'] option").fadeOut();
$( "select[name='serviceId'] option.aucun_service").fadeIn();
$( "select[name='serviceId'] option.entite_"+$(this).val()).fadeIn();
$( "select[name='serviceId']").val('');
});
</script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "../widgets/datepicker" ], factory );
} else {
// Browser globals
factory( jQuery.datepicker );
}
}( function( datepicker ) {
datepicker.regional.fr = {
closeText: "Fermer",
prevText: "Précédent",
nextText: "Suivant",
currentText: "Aujourd'hui",
monthNames: [ "janvier", "février", "mars", "avril", "mai", "juin",
"juillet", "août", "septembre", "octobre", "novembre", "décembre" ],
monthNamesShort: [ "janv.", "févr.", "mars", "avr.", "mai", "juin",
"juil.", "août", "sept.", "oct.", "nov.", "déc." ],
dayNames: [ "dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi" ],
dayNamesShort: [ "dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam." ],
dayNamesMin: [ "D","L","M","M","J","V","S" ],
weekHeader: "Sem.",
dateFormat: "dd/mm/yy",
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: "" };
datepicker.setDefaults( datepicker.regional.fr );
return datepicker.regional.fr;
} ) );
</script>
<script>
$(function() {
$( "#datepicker" ).datepicker({
dateFormat: 'dd-mm-yy'
});
});
</script>
</body>
</html>
J 'ai le même soucis sur ce fichier sauf que cette fois ça me déconnecte automatiquement quand je lance éditer .
[PHP]
<?php
include '../lib/init.php';
/**
* Initialisation
*/
use Lib\Utilisateur;
use Lib\Tool;
use Lib\Action;
use Lib\BreadCrumb;
use Lib\Upload;
use Imagine\Gd\Imagine;
use Imagine\Image\Box;
$agdaId = Tool::getId($_GET['agendabis'],BASEADMIN);
Utilisateur::ifConnect();
Action::ifIsset($agdaId,'agendabis',BASEADMIN.'agenda/managerAgenda.php',$bdd);
$succes = array();
$erreur = array();
/**
* Récéption du formulaire
*/
if(isset($_POST['edit'])){
/**
* Variables de formulaire
*/
$agendaTitre = $_POST['agendaTitre'];
$agendaDescription = $_POST['agendaDescription'];
$monradioagenda = $_POST['monradioagenda'];
$entiteId= $_POST['entiteId'];
$place_Lat = $_POST['place_Lat'];
$place_Lng = $_POST['place_Lng'];
$place_Location = $_POST['place_Location'];
$dateevent = $_POST['dateevent'];
$timeevent = $_POST['timeevent'];
/* Récupération de la fiche de poste */
if($_FILES['agendaPreview']['tmp_name'])
{
if ($_FILES['agendaPreview']['error'] === UPLOAD_ERR_OK){
$agendaPreview = Upload::postFichier($_FILES['agendaPreview'],'miniature',5000000,array('jpg','jpeg','png','svg','pdf'),array());
}else
if($_FILES['agendaPreview']['error'] != UPLOAD_ERR_NO_FILE)
array_push($erreur, 'Impossible d\'uploader la miniature.');
}
/**********
* Erreurs*
**********/
if(empty($agendaTitre)) array_push($erreur, 'le nom du poste est obligatoire');
/*if(count($_FILES['imgevent']['name']) > 0){
for($i=0; $i<count($_FILES['imgevent']['name']); $i++) {
//Get the temp file path
$tmpFilePath = $_FILES['imgevent']['tmp_name'][$i];
//Make sure we have a filepath
if($tmpFilePath != ""){
$shortname = $_FILES['imgevent']['name'][$i];
//save the url and the file
$filePath = "../../img/agenda/" .$_FILES['imgevent']['name'][$i];
//Upload the file into the temp dir
if(move_uploaded_file($tmpFilePath, $filePath)) {
//insert into db
//use $shortname for the filename
//use $filePath for the relative url to the file
}}}} */
/**
* Si aucune erreur alors
*/
if(empty($erreur)){
/**
* MISE A JOUR DE LA BASE DE DONNEES
*/
$sql = $bdd->prepare("UPDATE `agendabis` SET agendaTitre = :agendaTitre,
agendaTitreSlug = :agendaTitreSlug,
agendaDescription = :agendaDescription,
agendaentiteId = :entiteId,
monradioagenda = :monradioagenda,
place_Lat = :place_Lat,
place_Lng = :place_Lng,
place_Location = :place_Location,
dateevent = :dateevent,
timeevent = :timeevent
WHERE agdaId = :agdaId");
$sql->execute(array(
'agendaTitre' => addslashes($agendaTitre),
'agendaTitreSlug' => Tool::Slug($agendaTitre),
'agendaDescription' => addslashes($agendaDescription),
'entiteId' => addslashes($entiteId),
'agdaId' => addslashes($agdaId),
'monradioagenda' => addslashes($monradioagenda),
'place_Lat'=> addslashes($place_Lat),
'place_Lng' => addslashes($place_Lng),
'place_Location' => addslashes($place_Location),
'dateevent' => addslashes($dateevent),
'timeevent' => addslashes($timeevent)
))
or die(print_r($sql->errorInfo()));
/* $agendaId = $bdd->lastInsertId();
$sql_images = $bdd->prepare('INSERT INTO `img_agenda` (`name`, `url`, `agenda_id`) VALUES (:name, :url, :agendaId)');
for ($i=0; $i<count($imgevent['name']); $i++) {
$sql_images->execute(array(
'name' => $imgevent['name'][$i],
'url' => 'img/agenda/'.$imgevent['name'][$i],
'agendaId' => $agendaId
)) or die(print_r($sql_images->errorInfo()));
}
*/
if($_FILES['agendaPreview']['tmp_name'])
{
/* Upload du logo */
move_uploaded_file($_FILES['agendaPreview']['tmp_name'], '../../img/agenda/'.$agendaPreview);
$requete_postefiche = "UPDATE agendabis SET agendaPreview = '".$agendaPreview."' WHERE agdaId = '".$agdaId."' ;";
$bdd->query($requete_postefiche);
}
/* Message de succès */
array_push($succes, 'Évenement modifié avec succès !');
/**
* Reset des variables
$agendaTitre = '';
$entiteId = '';
$agendaDescription = '';
$agendaPreview = '';
$monradioagenda = '' ;
$place_lat = '' ;
$place_lng = '' ;
$place_location = '' ;
$imgevent = '' ;
$dateevent = '' ;
$timeevent = ''; */
Tool::setFlash('Evenement modifié avec succès');
header('location:'.BASEADMIN.'agenda/managerAgenda.php');
}
}
/**
* Informations sur le l'événement
*/
$sqlbis = $bdd->query("SELECT * FROM agendabis WHERE agdaId = $agdaId ");
$data = $sqlbis->fetchObject();
$agendaTitre = stripslashes($data->agendaTitre);
$entiteId = stripslashes($data->agendaentiteId);
$agendaDescription = stripslashes($data->agendaDescription);
$agendaPreview = $data->agendaPreview;
$monradioagenda = stripslashes($data->monradioagenda);
$place_Lat = stripslashes($data->place_Lat);
$place_Lng = stripslashes($data->place_Lng);
$place_Location = stripslashes($data->place_Location);
$dateevent = stripslashes($data->dateevent);
$timeevent = stripslashes($data->timeevent);
?>
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width; initial-scale=1;">
<title><?= TITLEBACK ?></title>
<link rel="icon" type="image/png" href="<?= BASEADMIN ?>img/layout/favicon.png">
<link href="<?= BASEFRONT ?>js/scroll/scroll.css" rel="stylesheet" type="text/css">
<link href="<?= BASEADMIN ?>css/css_bo_perso.css" rel="stylesheet" type="text/css">
<link href="<?= BASEADMIN ?>css/app.css" rel="stylesheet" type="text/css">
<!--[if lt IE 9]>
<script src="<?= BASEFRONT ?>js/html5.js"></script>
<![endif]-->
</head>
<body>
<main id="main">
<?php
include '../include/menu.php';
?>
<div id="container">
<?php
include '../include/header.php';
?>
<div id="contentTitre">
<h1>Voir l'évenement : <?php echo $agendaTitre ?></h1>
</div>
<?php
BreadCrumb::add(BASEADMIN,array(
'Accueil' => 'dashboard/dashboard.php',
'Liste des offres' => 'agenda/managerAgenda.php',
'Voir un evenement' => ''
)
);
?>
<div id="content">
<?php
if(!empty($erreur)){ Tool::getMessage($erreur, 'erreur'); }
if(!empty($succes)){ Tool::getMessage($succes, 'succes'); }
?>
<form action="#" method="post" enctype="multipart/form-data" >
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 parti1_form_agenda">
<label>Titre de l'évenement</label>
<input type="text" name="agendaTitre" value="<?= $agendaTitre ?>" class="form-elem big"> <br>
<div class="extint">
<input type='radio' name='monradioagenda' value='Evenement Interne'> Evenement Interne
<input type='radio' name='monradioagenda' value='Evenement Externe'> Evenement Externe
</div>
<label>Entité *</label>
<select name="entiteId" class="form-elem big">
<option value="">Aucune entité</option>
<?php
$requete = "SELECT entiteNom, entiteId FROM entite WHERE entiteEtat = 1";
$sql = $bdd->query($requete);
/**
* Si aucun utilisateur
*/
if (!$sql || $sql->rowCount() == 0) {
} else {
while($data = $sql->fetchObject()) {
echo'<option value="'.$data->entiteId.'">'.$data->entiteNom.' </option>';
}
}
?>
</select>
<div class="date">
<label> Date </label><input type="text" id="datepicker" name='dateevent' /><span style="margin-right :10px;"><label>Heure</label></span><input type='time' name='timeevent' /></div>
<!-- champ pour autocomplement google map -->
<div class="lieu_event">
<label>Lieu : </label>
<input type="hidden" name="lat" id="lat">
<input type="hidden" name="lng" id="lng">
<input type="hidden" name="location" id="location">
<input id="pac-input" name="location" class="controls" type="text" placeholder="Enter a location">
<div id="type-selector" class="controls">
<input type="radio" name="type" id="changetype-all" checked="checked">
<label for="changetype-all">All</label>
</div>
<div id="map" style="height:400px;width:400px;"></div>
</div>
</div>
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12 parti2_form_agenda">
<label>Description</label>
<textarea name="agendaDescription" id="wysiwyg" cols="30" rows="10" class="form-elem big" ><?= stripslashes($agendaDescription) ?></textarea>
<div class="miniature">
<label>Miniature de l'évenement</label>
<input type="file" name="agendaPreview" class="form-elem big">
<div class="form-legende">
Poid maximum : 5Mo<br>
Format : jpg, jpeg, png, pdf
</div>
</div>
<div class
<div class="galerie_event">
<label>PHOTOS GALERIE</label>
<!-- champ multiple pour img galerie --->
<input type="file" name="imgevent[]" multiple />
</div>
</div>
</div>
<button name="edit" type="submit" class="form-submit turquoise medium">Enregistrer</button>
</form>
</div>
</div>
</main>
<!-- DEBUTS SCRIPT A RANGER -->
<script>
/* FONCTION MAP AUTOCOMPLEMENT*/
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -33.8688, lng: 151.2195},
zoom: 17
});
var input = /** @type {!HTMLInputElement} */(
document.getElementById('pac-input'));
var types = document.getElementById('type-selector');
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
map.controls[google.maps.ControlPosition.TOP_LEFT].push(types);
var autocomplete = new google.maps.places.Autocomplete(input);
autocomplete.bindTo('bounds', map);
var infowindow = new google.maps.InfoWindow();
var marker = new google.maps.Marker({
map: map,
anchorPoint: new google.maps.Point(0, -29)
});
autocomplete.addListener('place_changed', function() {
infowindow.close();
marker.setVisible(false);
var place = autocomplete.getPlace();
if (!place.geometry) {
// User entered the name of a Place that was not suggested and
// pressed the Enter key, or the Place Details request failed.
window.alert("No details available for input: '" + place.name + "'");
return;
}
// If the place has a geometry, then present it on a map.
if (place.geometry.viewport) {
map.fitBounds(place.geometry.viewport);
} else {
map.setCenter(place.geometry.location);
map.setZoom(17); // Why 17? Because it looks good.
}
marker.setIcon(/** @type {google.maps.Icon} */({
url: place.icon,
size: new google.maps.Size(71, 71),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(17, 34),
scaledSize: new google.maps.Size(35, 35)
}));
marker.setPosition(place.geometry.location);
marker.setVisible(true);
var item_Lat=place.geometry.location.lat();
var item_Lng=place.geometry.location.lng();
var item_Location = place.formatted_adress;
$("#lat").val(item_Lat);
$("#lng").val(item_Lng);
$("#location").val(item_Location);
var address = '';
if (place.address_components) {
address = [
(place.address_components[0] && place.address_components[0].short_name || ''),
(place.address_components[1] && place.address_components[1].short_name || ''),
(place.address_components[2] && place.address_components[2].short_name || '')
].join(' ');
}
infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + address);
infowindow.open(map, marker);
});
// Sets a listener on a radio button to change the filter type on Places
// Autocomplete.
function setupClickListener(id, types) {
var radioButton = document.getElementById(id);
radioButton.addEventListener('click', function() {
autocomplete.setTypes(types);
});
}
setupClickListener('changetype-all', []);
setupClickListener('changetype-address', ['address']);
setupClickListener('changetype-establishment', ['establishment']);
setupClickListener('changetype-geocode', ['geocode']);
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAXhsQpcp1vsMMnHwLn0IdQX_k8yT8h9xg&libraries=places&callback=initMap" async defer></script>
<!-- SCRIPT POUR DATEPICKER -->
<script>
$( function() {
$( "#datepicker" ).datepicker();
} );
</script>
<script type="text/javascript" src="<?= BASEFRONT ?>js/jquery/jquery.js"></script>
<script type="text/javascript" src="<?= BASEFRONT ?>js/jquery/jquery-ui.js"></script>
<script type="text/javascript" src="<?= BASEFRONT ?>js/tinymce/tinymce.min.js"></script>
<script type="text/javascript" src="<?= BASEFRONT ?>js/scroll/scroll.js"></script>
<script type="text/javascript" src="<?= BASEADMIN ?>js/app.js"></script>
<script>
tinymce.init({
selector: "#wysiwyg",
entity_encoding : "raw",
encoding: "UTF-8",
browser_spellcheck : true,
plugins: "link, paste, table, textcolor, code, media, image, responsivefilemanager",
height:"250px",
menubar : false,
paste_as_text: true,
content_css : '../../js/tinymce/tinymce.css',
style_formats: [
{title: 'Title h2', block: 'h2'},
{title: 'Title h3', block: 'h3'},
{title: 'Title h4', block: 'h4'}
],
relative_urls: false,
external_filemanager_path:"<?= BASEFRONT ?>js/filemanager/",
filemanager_title:"Mes images",
external_plugins: { "filemanager" : "<?= BASEFRONT ?>js/filemanager/plugin.min.js"},
toolbar: "undo redo | bold italic underline link | alignleft aligncenter alignright alignjustify | bullist numlist | styleselect forecolor | table | code | media image",
language: 'fr_FR'
});
// si clique sur entité, on fadeOut tout les service. et on fadeIn les services avec la class ayant l'id de lentité
$( "select[name='entiteId']").change(function() {
$( "select[name='serviceId'] option").fadeOut();
$( "select[name='serviceId'] option.aucun_service").fadeIn();
$( "select[name='serviceId'] option.entite_"+$(this).val()).fadeIn();
$( "select[name='serviceId']").val('');
});
</script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "../widgets/datepicker" ], factory );
} else {
// Browser globals
factory( jQuery.datepicker );
}
}( function( datepicker ) {
datepicker.regional.fr = {
closeText: "Fermer",
prevText: "Précédent",
nextText: "Suivant",
currentText: "Aujourd'hui",
monthNames: [ "janvier", "février", "mars", "avril", "mai", "juin",
"juillet", "août", "septembre", "octobre", "novembre", "décembre" ],
monthNamesShort: [ "janv.", "févr.", "mars", "avr.", "mai", "juin",
"juil.", "août", "sept.", "oct.", "nov.", "déc." ],
dayNames: [ "dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi" ],
dayNamesShort: [ "dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam." ],
dayNamesMin: [ "D","L","M","M","J","V","S" ],
weekHeader: "Sem.",
dateFormat: "dd/mm/yy",
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: "" };
datepicker.setDefaults( datepicker.regional.fr );
return datepicker.regional.fr;
} ) );
</script>
<script>
$(function() {
$( "#datepicker" ).datepicker({
dateFormat: 'dd-mm-yy'
});
});
</script>
</body>
</html>
[/PHP]