<?php /** * Created by PhpStorm. * User: mithun.alinkil * Date: 07-11-2015 * Time: 13:35 */ require_once 'SQLiteNotesRepository.php'; require_once 'Notes.php'; session_start(); if (!isset($_SESSION['user'])) { header("Location: login.php"); exit; } $noteRepo = new \malinkil\AS3\SQLiteNotesRepository(); $noteId = isset($_GET['id']) ? $_GET['id'] : ''; $notes = $noteRepo->getNoteById($noteId); if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['id'])) { ?> <?php // Came from show page based on id parameter $notes = $noteRepo->getNoteById($_POST['id']); ?> <!doctype html> <html lang="en"> <head>
<?php /** * Created by PhpStorm. * User: mithun.alinkil * Date: 07-11-2015 * Time: 13:37 */ require_once 'Notes.php'; require_once 'SQLiteNotesRepository.php'; session_start(); if (!isset($_SESSION['user'])) { header("Location: login.php"); exit; } $notesRepo = new \malinkil\AS3\SQLiteNotesRepository(); if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['id'])) { $notesRepo->deleteNote($_POST['id']); ?> <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Delete Note</title> </head> <body> <h1>Note Deleted</h1> <p><a href="index.php">Back to Note List</a></p> </body> </html> <?php
?> "></label><br></div> <input type="submit" class="btn btn-primary" value="Save Note"> <strong><a href="index.php">Back to Note List</a></strong> </form> <?php } elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['noteId'])) { ?> <?php if ($formIsValid) { ?> <?php //Process valid data and save note update $notesRepo = new \malinkil\AS3\SQLiteNotesRepository(); $notes = $notesRepo->getNoteById($_POST['noteId']); $notes->setNotes($mynotes); $notes->setSubject($subject); $notes->setAuthor($author); $createdDate = date('d M Y -g:i:s A'); $notes->setDatecr($createdDate); $notesRepo->saveNote($notes); ?> <title>Update Note</title> <h1>Note Updated</h1> <p><a href="index.php">Back to Note List</a></p> </body> </html> <?php } else {
<meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <br> <br> </head> <body> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { ?> <?php if ($formIsValid) { ?> <?php $notesRepo = new \malinkil\AS3\SQLiteNotesRepository(); $notes = new \malinkil\AS3\Notes(); $notes->setNotes($mynotes); $notes->setSubject($subject); $notes->setAuthor($author); $createdDate = date('d M Y -g:i:s A'); $notes->setDatecr($createdDate); $notesRepo->saveNote($notes); ?> <h1>Notes Added to the profile</h1> <p>Subject Line : <?php print $subject; ?> </p>
<?php /** * Created by PhpStorm. * User: mithun.alinkil * Date: 07-11-2015 * Time: 13:45 */ require_once 'SQLiteNotesRepository.php'; require_once 'Notes.php'; session_start(); if (!isset($_SESSION['user'])) { header("Location: login.php"); exit; } $noteData = new \malinkil\AS3\SQLiteNotesRepository(); $noteList = $noteData->getAllNotes(); ?> <!Doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="css/style.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> </head> <body data-spy="scroll" data-target=".navbar" data-offset="50"> <h1 align = 'center'>Notes Created see Below</h1>