forked from leftypol/leftypol
Add staff application theme, calendar theme and ukko4 theme
This commit is contained in:
parent
f0d73f9952
commit
22bbc4147e
19 changed files with 899 additions and 0 deletions
53
templates/themes/calendar/calendarpost.php
Normal file
53
templates/themes/calendar/calendarpost.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
require '/var/www/html/inc/functions.php';
|
||||
|
||||
$method = $_SERVER['REQUEST_METHOD'];
|
||||
if ($method == 'POST') {
|
||||
// Method is POST
|
||||
$type = $_POST['type'];
|
||||
switch ($type) {
|
||||
case "add":
|
||||
$title = $_POST['title'];
|
||||
$description = $_POST['description'];
|
||||
$start = $_POST['start'];
|
||||
$end = $_POST['end'];
|
||||
$url = $_POST['url'];
|
||||
$color = $_POST['color'];
|
||||
$query = prepare("INSERT INTO calendar_events (title, description, start, end,url,color) VALUES (:title,:description, :start, :end,:url, :color )");
|
||||
$query->bindValue(':title', $title);
|
||||
$query->bindValue(':description', $description);
|
||||
$query->bindValue(':start', $start);
|
||||
$query->bindValue(':end', $end);
|
||||
$query->bindValue(':url', $url);
|
||||
$query->bindValue(':color', $color);
|
||||
$query->execute() or error(db_error($query));
|
||||
break;
|
||||
case "delete":
|
||||
$id = $_POST['id'];
|
||||
$query = query("DELETE from calendar_events WHERE id = :id") or error(db_error());
|
||||
break;
|
||||
case "update":
|
||||
$id = $_POST['id'];
|
||||
$title = $_POST['title'];
|
||||
$description = $_POST['description'];
|
||||
$start = $_POST['start'];
|
||||
$end = $_POST['end'];
|
||||
$query = prepare(" UPDATE calendar_events SET title = :title, description = :description, start = :start, end = :end, url = :url, color =:color WHERE id = :id");
|
||||
$query->bindValue(':id', $id);
|
||||
$query->bindValue(':title', $title);
|
||||
$query->bindValue(':description', $description);
|
||||
$query->bindValue(':start', $start);
|
||||
$query->bindValue(':end', $end);
|
||||
$query->bindValue(':url', $url);
|
||||
$query->bindValue(':color', $color);
|
||||
$query->execute() or error(db_error($query));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
} elseif ($method == 'GET') {
|
||||
// Method is GET
|
||||
$query = query("SELECT * FROM calendar_events ORDER BY id") or error(db_error());
|
||||
echo json_encode($query->fetchAll(PDO::FETCH_ASSOC));
|
||||
}
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue