Example #1
0
 function getObjectStructure()
 {
     return Obituary::getObjectStructure();
 }
Example #2
0
<?php

if (!defined('__ROOT__')) {
    define('__ROOT__', dirname(dirname(__FILE__)));
}
if (!isset($_SESSION)) {
    session_start();
}
?>

<body>
	<?php 
$obituaryId = $_GET['obituaryid'];
require_once __ROOT__ . '/class/Obituary.php';
$obituary = new Obituary($obituaryId);
$obituary->read_one();
$name = $obituary->getObituaryName();
$lastname = $obituary->getObituaryLastName();
$dateOfBirth = date("d.m.Y", strtotime($obituary->getObituaryDateOfBirth()));
$dateOfDeath = date("d.m.Y", strtotime($obituary->getObituaryDateOfDeath()));
$datePublished = $obituary->getObituaryDatePublished();
$religion = $obituary->getObituaryReligion();
$location = $obituary->getObituaryLocation();
$text = $obituary->getObituaryText();
$image = $obituary->getObituaryImage();
$music = $obituary->getMusic();
echo "<div class='single'>";
echo "<img src='images/" . $religion . ".png' height=150/><br />";
echo "<h2>" . $name . " " . $lastname . " from " . $location . "</h2><h3>" . $dateOfBirth . " - " . $dateOfDeath . "</h3>";
if ($image != 0) {
    echo "<img src='http://localhost/obituaries2/images/" . $image . "' height=300 />";
Example #3
0
 function saveObituaries()
 {
     if (isset($this->personId)) {
         $obit = new Obituary();
         $obit->query("DELETE FROM obituary WHERE personId = {$this->personId}");
         if (is_array($this->obituaries)) {
             foreach ($this->obituaries as $obitData) {
                 $obitData->personId = $this->personId;
                 $obitData->insert();
             }
         }
     }
 }
Example #4
0
if (isset($_POST['post'])) {
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $dateOfBirth = $_POST['dateOfBirth'];
    $dateOfDeath = $_POST['dateOfDeath'];
    $religion = $_POST['religion'];
    $location = $_POST['location'];
    $text = $_POST['text'];
    $url = $_POST['music'];
    if ($url != '') {
        $music = substr(strstr($url, 'v='), 2, 11);
    } else {
        $music = 0;
    }
    require_once __ROOT__ . '/class/Obituary.php';
    $newObituary = new Obituary(null, $firstname, $lastname, $location, $dateOfDeath, $dateOfBirth, $religion, $text, $music);
    $newObituary->create();
    echo "<p>New obituary was published successfully!</p>";
}
?>

<body>

<form method="post" enctype="multipart/form-data" accept-charset="latin2_general_ci" >
	<h2>Post a new obituary</h2>
	First name: <br /><input type="text" name="firstname" maxlength="25" pattern="[a-zA-Z ]+" oninvalid="this.setCustomValidity('Please enter valid first name')"
		oninput="setCustomValidity('')" required><br />
	Last name: <br /><input type="text" name="lastname" maxlength="35" pattern="[a-zA-Z ]+" oninvalid="this.setCustomValidity('Please enter valid last name')"
		oninput="setCustomValidity('')" required><br />
	Photo: <br /><input type="hidden" name="MAX_FILE_SIZE" value="1024000" /><input type="file" name="photo" accept="image/x-png, image/gif, image/jpeg"><br />
	Date of birth: <br /><input type="date" name="dateOfBirth" max="<?php 
<?php

include 'includes/header.php';
$db = new Database();
$pi = new Picture();
$ca = new Category();
$ob = new Obituary();
$us = new User();
$st = new Story();
$stories = $db->select($st->getStoriesAndCategories());
$users = $db->select($us->getAllUsers());
$categories = $db->select($ca->getAllCategories());
$obituaries = $db->select($ob->getAllObituaries());
$images = $db->select($pi->getAllPictures('DESC'));
?>

  <div class="col-md-12">
    <h3>Stories</h3>
    <table class="table table-striped">
      <tr>
        <th>Story ID#</th>
        <th>Title</th>
        <th>Category</th>
        <th>Submitter</th>
        <th>Date</th>
      </tr>    
      <?php 
while ($row = $stories->fetch_assoc()) {
    ?>
        <tr>
          <td><?php 
<?php

include 'includes/header.php';
$db = new Database();
$ob = new Obituary();
$obit = $db->select($ob->getObituaryById())->fetch_assoc();
?>

<div class="container">
  <div class="header">
    <h1 class="title">Obituaries</h1>
    <p class="lead description">The memories of those who have passed</p>
  </div>

  <ol class="breadcrumb">
    <li><a href="index.php">Home</a></li>
    <li><a href="obits.php">Obituaries</a></li>
    <li class="active"><?php 
echo $obit['Name'];
?>
</li>
  </ol>

  <div class="row">
    <div class="story-main col-md-12">
      <div class="page-header">
        <h1><?php 
echo $obit['Name'];
?>
</h1>
        <h4><?php 
<?php

include 'includes/header.php';
$db = new Database();
$ob = new Obituary();
$obit = $db->select($ob->getObituaryById())->fetch_assoc();
$id = $_GET['id'];
// if submit button is pressed
if (isset($_POST['submit'])) {
    //assign variables
    $name = mysqli_real_escape_string($db->link, $_POST['name']);
    $obituary = mysqli_real_escape_string($db->link, $_POST['obituary']);
    $birthdate = mysqli_real_escape_string($db->link, $_POST['dob']);
    $deathdate = mysqli_real_escape_string($db->link, $_POST['dod']);
    // simple validation
    if ($name == '' || $obituary == '' || $birthdate == '' || $deathdate == '') {
        // set error
        $error = 'Please fill out all required fields.';
    } else {
        $update_row = $db->update($ob->updateObituary($imagepath, $name, $obituary, $birthdate, $deathdate, $id));
    }
}
if (isset($_POST['delete'])) {
    $delete_row = $db->delete($ob->deleteObituary($id));
    $filename = "../images/obits/" . $obit['ImagePath'];
    unlink($filename);
}
?>

<h2 class="page-header">Edit <?php 
echo $obit['Name'];