Пример #1
0
\t\t\t\t<th>Date
\t\t\t\t<th>Traveler
\t\t\t\t<th>Status
\t\t\t</tr>
\t\t</thead>
\t\t<tbody>
EOF;
$i = 0;
foreach ($requests->find(array("user" => $_SESSION['user']))->sort(array("date" => -1)) as $k => $v) {
    $travels = $db->travel_plans;
    $travel = $travels->findOne(array("_id" => new MongoId($v['travel'])));
    if (!isset($travel['requester'])) {
        continue;
    }
    $i++;
    $v['date'] = convertDate($travel['date'], false) . "<br>" . relativeTime(convertDateToTime($travel['date'], false));
    $traveler = generateUserLink($travel['user']);
    if ($v['status'] == 0) {
        $status = "pending";
    } else {
        if ($v['status'] == 1) {
            $status = "accepted";
        } else {
            $status = "rejected";
        }
    }
    $HTML[] = <<<EOF
\t\t<tr>
\t\t\t<td>{$i}
\t\t\t<td><a href="?travel_plan/view/{$v['travel']}">{$travel['from']}</a> 
\t\t\t<td>{$travel['to']}
Пример #2
0
function dateToRelative($date)
{
    $date = explode(" ", $date)[0];
    return relativeTime(convertDateToTime($date, false));
}