first commit

This commit is contained in:
2023-04-12 11:55:10 +07:00
commit e0dc21312f
17 changed files with 256 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
<?php
require_once __DIR__ . "/../Model/TodoList.php";
require_once __DIR__ . "/../Helper/Input.php";
require_once __DIR__ . "/../BusinessLogic/AddTodoList.php";
function viewAddTodoList()
{
echo "MENAMBAH TODO" . PHP_EOL;
$todo = input("Todo (x untuk batal)");
if ($todo == "x") {
echo "Batal menambah todo" . PHP_EOL;
} else {
addTodoList($todo);
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
require_once __DIR__ . "/../Helper/Input.php";
require_once __DIR__ . "/../BusinessLogic/RemoveTodoList.php";
function viewRemoveTodoList()
{
echo "MENGHAPUS TODO" . PHP_EOL;
$pilihan = input("Nomor (x untuk batalkan)");
if ($pilihan == "x") {
echo "Batal menghapus todo" . PHP_EOL;
} else {
$success = removeTodoList($pilihan);
if ($success) {
echo "Sukses menghapus todo nomor $pilihan" . PHP_EOL;
} else {
echo "Gagal menghapus todo nomor $pilihan" . PHP_EOL;
}
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
require_once __DIR__ . "/../Model/TodoList.php";
require_once __DIR__ . "/../BusinessLogic/ShowTodoList.php";
require_once __DIR__ . "/../View/ViewAddTodoList.php";
require_once __DIR__ . "/../View/ViewRemoveTodoList.php";
require_once __DIR__ . "/../Helper/Input.php";
function viewShowTodoList()
{
while (true) {
showTodoList();
echo "MENU" . PHP_EOL;
echo "1. Tambah Todo" . PHP_EOL;
echo "2. Hapus Todo" . PHP_EOL;
echo "x. Keluar" . PHP_EOL;
$pilihan = input("Pilih");
if ($pilihan == "1") {
viewAddTodoList();
} else if ($pilihan == "2") {
viewRemoveTodoList();
} else if ($pilihan == "x") {
break;
} else {
echo "Pilihan tidak dimengerti" . PHP_EOL;
}
}
echo "Sampai Jumpa Lagi" . PHP_EOL;
}