Exemplo n.º 1
0
function browseItems($query, $params, $query_feat, $params_feat, $total, $current_page, $extravar = '')
{
    global $system, $MSG, $ERR_114, $db, $dt;
    global $template, $PAGES, $PAGE;
    $feat_items = false;
    if ($query_feat != '') {
        $db->query($query_feat, $params_feat);
        $k = 0;
        while ($row = $db->fetch()) {
            // get the data we need
            $row = build_items($row);
            // time left till the end of this auction
            $current_time = new DateTime('now', $dt->UTCtimezone);
            $end_time = new DateTime($row['ends'], $dt->UTCtimezone);
            $difference = $current_time->diff($end_time);
            $template->assign_block_vars('featured_items', array('ID' => $row['id'], 'IMAGE' => $row['pict_url'], 'TITLE' => htmlspecialchars($row['title']), 'SUBTITLE' => htmlspecialchars($row['subtitle']), 'BUY_NOW' => $difference->invert == 1 ? '' : $row['buy_now'], 'BID' => $row['current_bid'], 'BIDFORM' => $system->print_money($row['current_bid']), 'CLOSES' => $difference->format('%d') < 20 ? $dt->formatTimeLeft($difference) : $dt->printDateTz($row['ends']), 'NUMBIDS' => sprintf($MSG['950'], $row['num_bids']), 'B_BOLD' => $row['bold'], 'B_HIGHLIGHTED' => $row['highlighted']));
            $k++;
            $feat_items = true;
        }
    }
    $db->query($query, $params);
    $k = 0;
    while ($row = $db->fetch()) {
        // get the data we need
        $row = build_items($row);
        // time left till the end of this auction
        $current_time = new DateTime('now', $dt->UTCtimezone);
        $end_time = new DateTime($row['ends'], $dt->UTCtimezone);
        $difference = $current_time->diff($end_time);
        $template->assign_block_vars('items', array('ID' => $row['id'], 'IMAGE' => $row['pict_url'], 'TITLE' => htmlspecialchars($row['title']), 'SUBTITLE' => htmlspecialchars($row['subtitle']), 'BUY_NOW' => $difference->invert == 1 ? '' : $row['buy_now'], 'BID' => $row['current_bid'], 'BIDFORM' => $system->print_money($row['current_bid']), 'CLOSES' => $difference->format('%d') < 20 ? $dt->formatTimeLeft($difference) : $dt->printDateTz($row['ends']), 'NUMBIDS' => sprintf($MSG['950'], $row['num_bids']), 'B_BOLD' => $row['bold'], 'B_HIGHLIGHTED' => $row['highlighted']));
        $k++;
    }
    $extravar = empty($extravar) ? '' : '&' . $extravar;
    $PREV = intval($PAGE - 1);
    $NEXT = intval($PAGE + 1);
    if ($PAGES > 1) {
        $LOW = $PAGE - 5;
        if ($LOW <= 0) {
            $LOW = 1;
        }
        $COUNTER = $LOW;
        while ($COUNTER <= $PAGES && $COUNTER < $PAGE + 6) {
            $template->assign_block_vars('pages', array('PAGE' => $PAGE == $COUNTER ? '<b>' . $COUNTER . '</b>' : '<a href="' . $system->SETTINGS['siteurl'] . $current_page . '?PAGE=' . $COUNTER . $extravar . '"><u>' . $COUNTER . '</u></a>'));
            $COUNTER++;
        }
    }
    $template->assign_vars(array('B_FEATURED_ITEMS' => $feat_items, 'B_SUBTITLE' => $system->SETTINGS['subtitle'] == 'y', 'NUM_AUCTIONS' => $total == 0 ? $ERR_114 : $total, 'PREV' => $PAGES > 1 && $PAGE > 1 ? '<a href="' . $system->SETTINGS['siteurl'] . $current_page . '?PAGE=' . $PREV . $extravar . '"><u>' . $MSG['5119'] . '</u></a>&nbsp;&nbsp;' : '', 'NEXT' => $PAGE < $PAGES ? '<a href="' . $system->SETTINGS['siteurl'] . $current_page . '?PAGE=' . $NEXT . $extravar . '"><u>' . $MSG['5120'] . '</u></a>' : '', 'PAGE' => $PAGE, 'PAGES' => $PAGES));
}
Exemplo n.º 2
0
function browseItems($query, $params, $query_feat, $params_feat, $total, $current_page, $extravar = '')
{
    global $system, $uploaded_path, $MSG, $ERR_114, $db;
    global $template, $PAGES, $PAGE;
    $feat_items = false;
    if ($query_feat != '') {
        $db->query($query_feat, $params_feat);
        $k = 0;
        while ($row = $db->fetch()) {
            // get the data we need
            $row = build_items($row);
            // time left till the end of this auction
            $difference = $row['ends'] - time();
            $bgcolour = $k % 2 ? 'bgcolor="#FFFEEE"' : '';
            $template->assign_block_vars('featured_items', array('ID' => $row['id'], 'ROWCOLOUR' => $row['highlighted'] == 'y' ? 'bgcolor="#fea100"' : $bgcolour, 'IMAGE' => $row['pict_url'], 'TITLE' => $system->uncleanvars($row['title']), 'SUBTITLE' => $system->uncleanvars($row['subtitle']), 'BUY_NOW' => $difference < 0 ? '' : $row['buy_now'], 'BID' => $row['current_bid'], 'BIDFORM' => $system->print_money($row['current_bid']), 'CLOSES' => ArrangeDateNoCorrection($row['ends'] + $system->tdiff), 'NUMBIDS' => sprintf($MSG['950'], $row['num_bids']), 'B_BOLD' => $row['bold'] == 'y'));
            $k++;
            $feat_items = true;
        }
    }
    $db->query($query, $params);
    $k = 0;
    while ($row = $db->fetch()) {
        // get the data we need
        $row = build_items($row);
        // time left till the end of this auction
        $difference = $row['ends'] - time();
        $bgcolour = $k % 2 ? 'bgcolor="#FFFEEE"' : '';
        $template->assign_block_vars('items', array('ID' => $row['id'], 'ROWCOLOUR' => $row['highlighted'] == 'y' ? 'bgcolor="#fea100"' : $bgcolour, 'IMAGE' => $row['pict_url'], 'TITLE' => $system->uncleanvars($row['title']), 'SUBTITLE' => $system->uncleanvars($row['subtitle']), 'BUY_NOW' => $difference < 0 ? '' : $row['buy_now'], 'BID' => $row['current_bid'], 'BIDFORM' => $system->print_money($row['current_bid']), 'CLOSES' => ArrangeDateNoCorrection($row['ends'] + $system->tdiff), 'NUMBIDS' => sprintf($MSG['950'], $row['num_bids']), 'B_BOLD' => $row['bold'] == 'y'));
        $k++;
    }
    $extravar = empty($extravar) ? '' : '&' . $extravar;
    $PREV = intval($PAGE - 1);
    $NEXT = intval($PAGE + 1);
    if ($PAGES > 1) {
        $LOW = $PAGE - 5;
        if ($LOW <= 0) {
            $LOW = 1;
        }
        $COUNTER = $LOW;
        while ($COUNTER <= $PAGES && $COUNTER < $PAGE + 6) {
            $template->assign_block_vars('pages', array('PAGE' => $PAGE == $COUNTER ? '<b>' . $COUNTER . '</b>' : '<a href="' . $system->SETTINGS['siteurl'] . $current_page . '?PAGE=' . $COUNTER . $extravar . '"><u>' . $COUNTER . '</u></a>'));
            $COUNTER++;
        }
    }
    $template->assign_vars(array('B_FEATURED_ITEMS' => $feat_items, 'B_SUBTITLE' => $system->SETTINGS['subtitle'] == 'y', 'NUM_AUCTIONS' => $total == 0 ? $ERR_114 : $total, 'PREV' => $PAGES > 1 && $PAGE > 1 ? '<a href="' . $system->SETTINGS['siteurl'] . $current_page . '?PAGE=' . $PREV . $extravar . '"><u>' . $MSG['5119'] . '</u></a>&nbsp;&nbsp;' : '', 'NEXT' => $PAGE < $PAGES ? '<a href="' . $system->SETTINGS['siteurl'] . $current_page . '?PAGE=' . $NEXT . $extravar . '"><u>' . $MSG['5120'] . '</u></a>' : '', 'PAGE' => $PAGE, 'PAGES' => $PAGES));
}