Ejemplo n.º 1
0
<?php

// Expansion logic...
require_once '../database/ConnectionDB/dbConnection.php';
require_once '../database/Model/Material.php';
require_once '../database/Model/User.php';
require_once '../utilities/helpers.php';
$material_id = intval($_POST['materialID']);
$username = $_POST['username'];
$flag = 0;
$material = new Material();
// determine what is the material, book ,article etc
$genre = $material->materialBelongsToTable($material_id);
if ($genre == "books") {
    $flag = 1;
}
// fetch the material details
$stmt = $material->fetch_material_details($material_id);
if ($stmt->rowCount() == 0) {
    $message = "Πρόβλημα με τις λεπτομέρειες του Υλικού";
    echo "<script>error_messages('{$message}');</script>";
}
$library = $material->get_material_library($material_id);
$lib_name = '';
if ($library != -1) {
    $lib_name = $library['Name'];
}
$result = $stmt->fetch(PDO::FETCH_ASSOC);
// fetch the endDate for the material
$user = new User();
$endDate = $user->get_endDate($username, $material_id)->fetch(PDO::FETCH_ASSOC);