Example #1
0
<?php

/*
 * Copyright (C) 2010 Ryan Kavanagh <*****@*****.**>
 *
 * See file COPYING for details
 *
 */
include '../config.php';
include '../db.php';
$empty_check = implode('', $_POST);
if (empty($empty_check)) {
    echo header('Location: view.php');
} else {
    // $_POST['row'] is in the format: delrowX
    // where X is the row we want to delete.
    $row = (int) substr($_POST['row'], 6);
    $fdb = new FlatFileDB($db_filename, $table_sep, $cell_sep);
    $fdb->deleteRow($objects_table, $row);
}
Example #2
0
/*
 * Copyright (C) 2010 Ryan Kavanagh <*****@*****.**>
 *
 * See file COPYING for details
 *
 */
// Open the database
include '../config.php';
include '../db.php';
$i_name = $_POST['item_name'];
$b_name = $_POST['borrower_name'];
$b_netid = $_POST['borrower_netid'];
$b_time = new DateTime('@' . strtotime($_POST['pickup_datetime']));
// See below for setting repetition
$d_time = new DateTime('@' . strtotime($_POST['due_datetime']));
$erow = substr($_POST['editrow'], 7);
$empty_check = implode('', $_POST);
if (empty($empty_check)) {
    die('ERROR: Submitted an empty form!');
} else {
    $fdb = new FlatFileDB($db_filename, $table_sep, $cell_sep);
    $entry = array($i_name, $b_name, $b_netid, $b_time->format($dt_fmt), $d_time->format($dt_fmt));
    foreach ($entry as $key => $val) {
        $entry[$key] = htmlspecialchars($val);
    }
    $fdb->editRow($loans_table, $erow, $entry);
    echo header('Location: view-out.html');
}
?>

Example #3
0
  <thead>
    <tr>
      <th>Item Name</th>
      <th>Borrower Name</th>
      <th>Borrower NetID</th>
      <th>Pickup Time</th>
      <th>Due Time</th>
    </tr>
  </thead>
  <tbody>
<?php 
include '../config.php';
include '../db.php';
$fdb = new FlatFileDB($db_filename, $table_sep, $cell_sep);
foreach ($fdb->getTable($loans_table) as $rownum => $row) {
    $class = '';
    if (date($row[4]) < date($dt_fmt)) {
        $class = ' class="late"';
    } elseif ($rownum % 2 == 0) {
        $class = ' class="alt"';
    }
    echo '<tr' . $class . '>';
    echo '<td class="item_name">' . $row[0] . '</td>';
    echo '<td class="borrower_name">' . $row[1] . '</td>';
    echo '<td class="borrower_netid">' . $row[2] . '</td>';
    echo '<td class="pickup_datetime">' . $row[3] . '</td>';
    echo '<td class="due_datetime">' . $row[4] . '</td>';
    echo '</tr>';
    $row++;
}
?>
Example #4
0
<?php

/*
 * Copyright (C) 2010 Ryan Kavanagh <*****@*****.**>
 *
 * See file COPYING for details
 *
 */
// Open the database
include '../config.php';
include '../db.php';
$fdb = new FlatFileDB($db_filename, $table_sep, $cell_sep);
$i_name = $_POST['item_name'];
$b_name = $_POST['borrower_name'];
$b_netid = $_POST['borrower_netid'];
$b_time = new DateTime('@' . strtotime($_POST['pickup_datetime']));
// See below for setting repetition
$d_time = new DateTime('@' . strtotime($_POST['due_datetime']));
$empty_check = implode('', $_POST);
if (empty($empty_check)) {
    die('ERROR: Submitted an empty form!');
} else {
    // Set $b_rep to 1 if not null;
    $b_rep = isset($_POST['repetition']) && !empty($_POST['repetition']) ? $_POST['repetition'] : 1;
    for ($rep = 0; $rep < $b_rep; $rep++) {
        $entry = array($i_name, $b_name, $b_netid, $b_time->format($dt_fmt), $d_time->format($dt_fmt));
        foreach ($entry as $key => $val) {
            $entry[$key] = htmlspecialchars($val);
        }
        $fdb->newRow($loans_table, $entry);
        // Increment time by one week for next pass/repetition. P1W -> Period of
Example #5
0
File: add.php Project: ryanakca/ET
<?php

/*
 * Copyright (C) 2010 Ryan Kavanagh <*****@*****.**>
 *
 * See file COPYING for details
 *
 */
// Open the database
include '../config.php';
include '../db.php';
$fdb = new FlatFileDB($db_filename, $table_sep, $cell_sep);
$empty_check = implode('', $_POST);
if (empty($empty_check)) {
    die('ERROR: Submitted an empty form!');
} else {
    $i_name = $_POST['item_name'];
    $entry = array(htmlspecialchars($i_name));
    $fdb->newRow($objects_table, $entry);
    echo header('Location: view.html');
}
Example #6
0
<?php

/*
 * Copyright (C) 2010 Ryan Kavanagh <*****@*****.**>
 *
 * See file COPYING for details
 *
 */
// Open the database
include '../config.php';
include '../db.php';
$i_name = $_POST['item_name'];
$empty_check = implode('', $_POST);
if (empty($empty_check)) {
    die('ERROR: Submitted an empty form!');
} else {
    $fdb = new FlatFileDB($db_filename, $table_sep, $cell_sep);
    $entry = array(htmlspecialchars($i_name));
    $erow = substr($_POST['editrow'], 7);
    $fdb->editRow($objects_table, $erow, $entry);
    echo header('Location: view.html');
}
?>

Example #7
0
<?php

/*
 * Copyright (C) 2010 Ryan Kavanagh <*****@*****.**>
 *
 * See file COPYING for details
 *
 */
include '../config.php';
include '../db.php';
$empty_check = implode('', $_POST);
if (empty($empty_check)) {
    echo header('Location: et-lo.php');
} else {
    // $_POST['row'] is in the format: delrowX
    // where X is the row we want to delete.
    $row = (int) substr($_POST['row'], 6);
    $fdb = new FlatFileDB($db_filename, $table_sep, $cell_sep);
    $fdb->deleteRow($loans_table, $row);
}