Beispiel #1
0
<?php

require_once "./include/usercontrol.php";
require_once "./include/entries.php";
require_once "./include/static.php";
$u = new UserControl();
$dry = new DRYHelper();
if (!$u->CheckLogin()) {
    // Not logged-in, redirect to index
    header("Location: index.php");
    die;
}
$sess_user = $_SESSION[$u->GetLoginSessionVar()];
$e = new EntriesController($sess_user);
$dry->build_header("My Journal");
?>
<h1>My Journal</h1>
<div id="site-info">
  <p>This is your journal, it contains all the data you've logged in MedLog.</p>
</div>
<div id="content">
  <?php 
$res = $e->FindEntries();
if ($res != false) {
    $dry->build_table_header();
    //$rows = [];
    while ($row = $res->fetch_assoc()) {
        //array_push($rows, $row);
        $dry->build_table_row($row);
    }
    echo "</table>";
Beispiel #2
0
   This file displays all the entries belonging to a date, waits for input on which entries to 
   include to the report and then generates it. */
require_once "./include/entries.php";
require_once "./include/usercontrol.php";
require_once "./include/static.php";
require_once "./include/tripify.php";
$u = new UserControl();
$dry = new DRYHelper();
if (!$u->CheckLogin()) {
    // Not logged in.
    header("Location: index.php");
    die;
}
// Get the username and generate its entries controller
$sess_user = $_SESSION[$u->GetLoginSessionVar()];
$e = new EntriesController($sess_user);
// Are we done yet?
$done = $_POST["done"];
if ($done == "no") {
    // No, so let's display all the entries belonging to this date.
    $date = $_POST["date"];
    $dry->build_header("Generate Trip Report");
    ?>
  <h1>Generate Trip Report</h1>
  <div id="content">
    <p class="warning">Please select the entries you want to include in this trip report</p>
  <?php 
    $res = $e->FindEntries(null, $date);
    if ($res != false) {
        $dry->build_trg_table_header();
        while ($row = $res->fetch_assoc()) {
Beispiel #3
0
  </div>
  <?php 
} else {
    $sess_user = $_SESSION[$u->GetLoginSessionVar()];
    /* Content to be displayed if the user is logged in */
    ?>
  <!-- START LOGGED IN HTML -->

  <p id="welcome-user">Welcome <?php 
    echo $sess_user;
    ?>
, you've been successfully logged in!
    Your last 5 entries are shown below.</p>
    <?php 
    /* Get all the FIRST FIVE entries by this user */
    $ent = new EntriesController($sess_user);
    $res = $ent->FindEntries();
    if ($res != false) {
        $dry->build_table_header();
        //$rows = []; Holds the 5 last rows of the user
        $count = 0;
        while (($row = $res->fetch_assoc()) && $count < 5) {
            //array_push($rows, $row);
            $dry->build_table_row($row);
            $count++;
        }
        echo "</table>";
        // Reverse the rows from newer to older
        // $rows = array_reverse($rows);
        // Iterate over those rows
        // $dry->build_table_rows($rows);