Пример #1
0
}
$drink = new Drink(SpoonFilter::getGetValue('id', null, ''));
if ($drink->drink_id === null) {
    SpoonHTTP::redirect('index.php');
}
$recent = $drink->getRecent();
for ($i = 0; $i < sizeof($recent); $i++) {
    $recent[$i]['timestamp'] = SpoonDate::getTimeAgo(strtotime($recent[$i]['timestamp']));
    //check if the user has a fb account authenticated
    if (!$recent[$i]['fb_uid']) {
        //else, use standard fb icon
        $recent[$i]['fb_uid'] = 1;
    }
}
if ($recent !== null) {
    $tpl->assign('oRecent', true);
    $tpl->assign('iRecent', $recent);
} else {
    $tpl->assign('oNoRecent', true);
}
if ($drink->getTop() !== null) {
    $tpl->assign('oTopDrinkers', true);
    $tpl->assign('iTopDrinkers', $drink->getTop());
} else {
    $tpl->assign('oNoTopDrinkers', true);
}
$tpl->assign('name', $drink->name);
$tpl->assign('abv', $drink->abv);
// show the output
$tpl->assign('content', $tpl->getContent('templates/drinkDetail.tpl'));
$tpl->display('templates/layout.tpl');