Esempio n. 1
0
<?php

include_once "../DebtStore.class.php";
include_once "../UserStore.class.php";
include_once "../utils.php";
$user1 = $_GET['user1'];
$user2 = $_GET['user2'];
$amount = $_GET['amount'];
$description = $_GET['desc'];
$app = getAPP();
$debtStore = new DebtStore($app->getDB());
$id = $debtStore->addDebt($user1, $user2, $amount, $description);
echo "<ul class='menu'>";
echo "<li id='" . $id . "' onClick=\"debtPayed(" . $id . ");\">" . $user1 . " ---> " . $user2 . " : " . $amount . "<br>Description: " . $description . "</li>";
echo "</ul>";
Esempio n. 2
0
<?php

include_once "../DebtStore.class.php";
include_once "../utils.php";
$debtId = $_GET['debtId'];
$app = getAPP();
$debtStore = new DebtStore($app->getDB());
$debtStore->debtPayed($debtId);
echo "selected";
Esempio n. 3
0
function fillTotalDebts($db, $globalUser)
{
    $userStore = new UserStore($db);
    $debtStore = new DebtStore($db);
    $users = $userStore->getUsers();
    foreach ($users as $user) {
        $debts = $debtStore->getTotalDebtsForUser($user);
        foreach ($debts as $debt) {
            $user1 = $debt->getUser1();
            $user2 = $debt->getUser2();
            echo "<div id='debt' class='debt'>";
            echo "<ul class='menu'>";
            echo "<li>" . $user1->getName() . " ---> " . $user2->getName() . " : " . $debt->getAmount() . "</li>";
            echo "</ul>";
            echo "</div>";
        }
    }
}