shopping-list/php/edit-list.php

45 lines
947 B
PHP
Raw Normal View History

2018-10-24 15:00:27 +02:00
<?php
include $_SESSION["docroot"].'/php/classes.list.php';
$shopping = new shopping;
2018-11-20 09:59:59 +01:00
switch ($_GET["function"]) {
2018-10-24 15:00:27 +02:00
case 'new':
2019-05-22 21:17:53 +02:00
$newID = $shopping->newItem($_POST["anzahl"], $_POST["einheit"], $_POST["name"]);
setcookie("newItem", "$newID", 0, "/", "");
2018-10-24 15:00:27 +02:00
header("Location: /list");
break;
case 'multiple':
$shopping->newItems($_POST["list"]);
break;
2019-05-28 15:55:00 +02:00
case 'change':
$shopping->changeSingleItem($_POST["id"], $_POST["anzahl"], $_POST["einheit"], $_POST["name"]);
break;
2018-10-24 15:00:27 +02:00
case 'del':
2019-05-28 09:12:47 +02:00
$shopping->removeSingleItem($_POST["id"]);
break;
case 'clear':
2018-10-24 15:00:27 +02:00
$shopping->removeChecked();
break;
case 'check':
$shopping->check($_POST["id"], $_POST["status"]);
2018-10-29 22:23:51 +01:00
break;
case 'export':
echo json_encode($shopping);
break;
2018-10-24 15:00:27 +02:00
2018-11-14 16:25:50 +01:00
case 'import':
$shopping->import();
break;
2018-10-24 15:00:27 +02:00
default:
// code...
break;
}
?>