Browse Source

begin editPage

master
AmarOk 10 years ago
parent
commit
bd2bdd3033
5 changed files with 183 additions and 46 deletions
  1. +1
    -1
      databaseOperations.php
  2. +129
    -0
      editEvent.php
  3. +6
    -0
      event.css
  4. +47
    -45
      event.php
  5. BIN
      images/edit.png

+ 1
- 1
databaseOperations.php View File

@ -166,7 +166,7 @@ function getCategoriesForOneEvent($db, $eventId)
{
try
{
$request = $db->prepare('SELECT * FROM eventCategorie NATURAL JOIN categorie NATURAL JOIN sous_categorie ORDER BY sous_cat_tab ASC, sous_cat_id ASC WHERE event_id = ?');
$request = $db->prepare('SELECT * FROM eventCategorie NATURAL JOIN categorie NATURAL JOIN sous_categorie WHERE event_id=?');
$request->execute(array($id));
$result = $request->fetch();
$request->closeCursor();


+ 129
- 0
editEvent.php View File

@ -0,0 +1,129 @@
<?php
/** /
require_once('./CAS-1.3.4/CAS.php');
phpCAS::client(CAS_VERSION_2_0, 'sso-cas.univ-rennes1.fr', 443, '', false);
phpCAS::setNoCasServerValidation();
phpCAS::forceAuthentication();
$uid = phpCAS::getUser();
/**/
include_once('databaseOperations.php');
include('datetimeOperations.php');
$db = connect();
if(!isset($_GET['id']) || !is_numeric($_GET['id']))
header('Location:./');
$id = htmlspecialchars($_GET['id']);
$event = getOneEvent($db, $id);
?>
<!DOCTYPE html>
<html>
<head>
<title>Kiwi Calendar : Ajouter un évènement</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="./main.css" />
<link rel="stylesheet" href="./event.css" />
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen"
href="http://tarruda.github.com/bootstrap-datetimepicker/assets/css/bootstrap-datetimepicker.min.css">
<link rel="icon" type="image/png" href="favicon.png" />
<link rel="stylesheet" href="./addEvent.css" />
<!--[if IE]><link rel="shortcut icon" type="image/x-icon" href="favicon.ico" /><![endif]-->
</head>
<body>
<?php include('header.php'); ?>
<div id="descEvent">
<h1>Modifier un Évènement</h1>
<form id="eventForm" name="eventForm" method="post" action="eventAdded.php" onsubmit="return verifyCheckbox();">
<div id="left">Titre :</div>
<input type="text" name="title" value="<?php echo $event["event_title"]; ?>" required>
<br>
<div id="left">Catégories :</div>
<div id="checkboxGrp">
<?php
$cats = getCategoriesNames($db);
echo 'TODO!!!'.getCategoriesForOneEvent($db, $id)['cat_title'];
for ($i=0; $i<count($cats); $i++) {
echo "<input type=\"checkbox\" class=\"checkboxRequired\" name=\"chk_group[]\" value=\"".$cats[$i][0]."\" />".$cats[$i][1]." ";
}
?>
</div>
<br>
<div id="left">Adresse :</div>
<input type="text" name="address" value="<?php echo $event["event_localisation"];?>" required>
<br>
<div id="left">Date de début :</div>
<div id="datetimepicker" class="input-append date">
<input type="text" name="dtstart" value="<?php echo $event["event_dtstart"]; ?>" required></input>
<span class="add-on">
<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
</span>
</div>
<br>
<div id="left">Date de fin :</div>
<div id="datetimepicker2" class="input-append date">
<input type="text" name="dtend" value="<?php echo $event["event_dtend"];?>" required></input>
<span class="add-on">
<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
</span>
</div>
<br>
<div id="left">Description de l'évènement :</div>
<textarea name="description" rows="4" cols="50" form="eventForm">
<?php echo $event["event_description"];?>
</textarea>
<br>
<div id="left">Site de l'évènement :</div>
<input type="url" value="<?php echo $event["event_site"];?>" name="site">
<br>
<div id="left">Image de l'évènement :</div>
<input type="url" value="<?php echo $event["event_urlImage"];?>" name="urlImage">
<br>
<div id="left">Contact :</div>
<input type="text" value="<?php echo $event["event_contact"];?>" name="contact">
<br>
<div id="buttonDiv"><button id="submit">Modifier l'évènement !</button></div>
</form>
<script type="text/javascript"
src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script type="text/javascript"
src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js">
</script>
<script type="text/javascript"
src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js">
</script>
<script type="text/javascript"
src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.pt-BR.js">
</script>
<script type="text/javascript">
$('#datetimepicker').datetimepicker({
format: 'dd/MM/yyyy hh:mm:ss',
language: 'fr_FR'
});
$('#datetimepicker2').datetimepicker({
format: 'dd/MM/yyyy hh:mm:ss',
language: 'fr_FR'
});
var verifyCheckbox = function () {
var checkboxes = $('#checkboxGrp');
var inputs = checkboxes.find('input');
for(var i = 0; i < inputs.length; i++)
if(inputs[i].checked)
return true;
return false;
}
</script>
</div>
</body>
</html>

+ 6
- 0
event.css View File

@ -3,6 +3,12 @@ body
padding:0px;
}
h1 img
{
width:18px;
height:18px;
}
#descEvent
{
margin-top: 150px;


+ 47
- 45
event.php View File

@ -4,7 +4,7 @@ include('datetimeOperations.php');
$db = connect();
if(!isset($_GET['id']) || !is_numeric($_GET['id']))
header('Location:./');
header('Location:./');
$id = htmlspecialchars($_GET['id']);
@ -15,52 +15,54 @@ $dtend = strtotime($event['event_dtend']);
<!DOCTYPE html>
<html>
<head>
<title>KiWi calendar : <?php echo $event["event_title"]; ?></title>
<meta charset="utf-8" />
<link rel="stylesheet" href="./main.css" />
<link rel="stylesheet" href="./event.css" />
<link rel="icon" type="image/png" href="favicon.png" />
<!--[if IE]><link rel="shortcut icon" type="image/x-icon" href="favicon.ico" /><![endif]-->
</head>
<body>
<?php include('header.php'); ?>
<div id="descEvent">
<h1><?php echo $event["event_title"]; ?></h1>
<head>
<title>KiWi calendar : <?php echo $event["event_title"]; ?></title>
<meta charset="utf-8" />
<link rel="stylesheet" href="./main.css" />
<link rel="stylesheet" href="./event.css" />
<link rel="icon" type="image/png" href="favicon.png" />
<!--[if IE]><link rel="shortcut icon" type="image/x-icon" href="favicon.ico" /><![endif]-->
</head>
<body>
<?php include('header.php'); ?>
<div id="descEvent">
<h1><?php echo $event["event_title"]; ?>
<a href="<?php echo 'editEvent.php?id='.$_GET['id']; ?>"><img src="images/edit.png"/></a></h1>
<h2>Date et lieu</h2>
<div id="dateheure">
<?php echo htmlentities(printableDateTime($dtstart, $dtend)); ?>
</div>
<?php
echo '<div id="lieu">'.$event["event_localisation"].'</div>';
$url = 'https://nominatim.openstreetmap.org/search?format=json&q='.urlencode($event["event_localisation"]);
$obj = json_decode(file_get_contents($url), true);
$lat = $obj[0]["lat"];
$lng = $obj[0]["lon"];
$urlFrame = 'http://www.openstreetmap.org/export/embed.html?bbox='.$lng.','.$lat.','.$lng.','.$lat.'&layer=mapnik&floor';
echo '<iframe frameborder="0" scrolling="no"
marginheight="0" marginwidth="0"
src="'.$urlFrame.'" style="width:100%;height:500px;margin-bottom:-30px;"></iframe>';
if(isset($event["event_urlImage"]) || isset($event["event_description"]))
echo '<div id="descDiv" style="margin-top:30px;"><h2>Description</h2></div>';
if(isset($event["event_urlImage"]))
echo '<div id="image"><img src="'.$event["event_urlImage"].'" width="100%"></div>';
if(isset($event["event_description"]))
echo '<div id="description">'.$event["event_description"].'</div>';
<h2>Date et lieu</h2>
<div id="dateheure">
<?php echo htmlentities(printableDateTime($dtstart, $dtend)); ?>
</div>
<?php
echo '<div id="lieu">'.$event["event_localisation"].'</div>';
$url = 'https://nominatim.openstreetmap.org/search?format=json&q='.urlencode($event["event_localisation"]);
$obj = json_decode(file_get_contents($url), true);
$lat = $obj[0]["lat"];
$lng = $obj[0]["lon"];
$urlFrame = 'http://www.openstreetmap.org/export/embed.html?bbox='.$lng.','.$lat.','.$lng.','.$lat.'&layer=mapnik&floor';
echo '<iframe frameborder="0" scrolling="no"
marginheight="0" marginwidth="0"
src="'.$urlFrame.'" style="width:100%;height:500px;margin-bottom:-30px;"></iframe>';
if(isset($event["event_site"]) || isset($event["event_contact"]))
echo '<h2>Informations</h2>';
if(isset($event["event_site"]))
echo '<div id="URL">URL : <a href="'.$event["event_site"].'">'.$event["event_site"].'</a></div>';
if(isset($event["event_contact"]))
echo '<div id="Contact">Contact : <a href="mailto:'.$event["event_contact"].'">'.$event["event_contact"].'</a></div>';
?>
</div>
if(isset($event["event_urlImage"]) || isset($event["event_description"]))
echo '<div id="descDiv" style="margin-top:30px;"><h2>Description</h2></div>';
if(isset($event["event_urlImage"]))
echo '<div id="image"><img src="'.$event["event_urlImage"].'" width="100%"></div>';
if(isset($event["event_description"]))
echo '<div id="description">'.$event["event_description"].'</div>';
<!-- bring in the google maps library -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
if(isset($event["event_site"]) || isset($event["event_contact"]))
echo '<h2>Informations</h2>';
if(isset($event["event_site"]))
echo '<div id="URL">URL : <a href="'.$event["event_site"].'">'.$event["event_site"].'</a></div>';
if(isset($event["event_contact"]))
echo '<div id="Contact">Contact : <a href="mailto:'.$event["event_contact"].'">'.$event["event_contact"].'</a></div>';
?>
</div>
</body>
</html>
<!-- bring in the google maps library -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
</body>
</html>

BIN
images/edit.png View File

Before After
Width: 24  |  Height: 24  |  Size: 160 B

Loading…
Cancel
Save