示例#1
0
function display_content()
{
    global $date_label, $filters, $has_filters, $ss, $loaded_data, $is_archive, $field_names;
    echo '<div id="main">';
    $date_label = htmlspecialchars(date_label($filters));
    echo "<h1>{$date_label}</h1>";
    if ($has_filters) {
        echo '<div id="filter-notice" class="wide center">';
        foreach ($field_names as $field => $name) {
            if (isset($filters[$field])) {
                $label = htmlspecialchars(get_value_label($field, $filters[$field]));
                echo "<span class='active-filter'><a class='clear-filter hide-if-no-js' data-filter='filter_{$field}'>&#215;</a> {$name}: <var>{$label}</var></span> ";
            }
        }
        echo '</div>';
    }
    if (!$ss->options['stats_enabled']) {
        echo '<div id="disabled"><p class="center">' . __('Simple Stats is currently disabled.') . '</p></div>';
    }
    table_summary();
    if (!empty($loaded_data['pages'])) {
        echo '<h2>' . __('Content') . '</h2>';
        chart(isset($filters['dy']) ? 'hours' : 'days');
        table_total('resource', 'wide');
        echo '<h2>Visitors</h2>';
        table_total('remote_ip');
        table_percent('browser');
        table_percent('platform');
        table_percent('country');
        table_percent('language');
        echo '<h2>Referrers</h2>';
        table_total('search_terms');
        table_total('domain');
        table_total('referrer', 'wide');
        visit_source();
    } else {
        echo '<p class="center">' . __('There is no data available for the date/filters you have selected.');
    }
    echo '</div>';
}
function table_closed_interface_pos()
{
    global $tpl;
    date_default_timezone_set(get_conf(__FILE__, __LINE__, "default_timezone"));
    if (bill_orders_to_print($_SESSION['sourceid'])) {
        $_SESSION['select_all'] = 1;
        $err = bill_select_pos();
        if ($err) {
            error_display($err);
        }
        return 0;
    }
    $tpl->set_waiter_template_file('closed_table_pos');
    $paid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', "paid", $_SESSION['sourceid']);
    $total = table_total($_SESSION['sourceid']);
    $discount = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', 'discount', $_SESSION['sourceid']);
    if ($total == 0 && $paid == 0) {
        $err = table_pay(1);
        status_report('PAYMENT', $err);
        $paid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', "paid", $_SESSION['sourceid']);
    }
    $tmp = navbar_tables_only_pos();
    $user = new user($_SESSION['userid']);
    if ($user->level[USER_BIT_CASHIER]) {
        $tmp = navbar_empty_pos();
    }
    $tpl->assign('navbar', $tmp);
    $tmp = '
		' . ucfirst(phr('TABLE_TOTAL_DISCOUNTED')) . ': <b>' . country_conf_currency(true) . ' ' . $total . '</b>
	';
    if ($discount != 0) {
        $discount = sprintf("%01.2f", abs($discount));
        $tmp .= '
		 (' . ucfirst(phr('DISCOUNT')) . ': ' . country_conf_currency(true) . ' ' . $discount . ')';
    }
    $tmp .= '<br />' . "\n";
    $tpl->assign('total', $tmp);
    if ($paid) {
        $tmp = '
		<FORM ACTION="orders.php" METHOD=POST>
		<INPUT TYPE="HIDDEN" NAME="command" VALUE="clear">
		' . ucfirst(phr('PAID_ALREADY')) . '<br/>
		' . ucfirst(phr('EMPTY_TABLE_EXPLAIN')) . '
		<INPUT TYPE="submit" value="' . ucfirst(phr('EMPTY_TABLE_BUTTON')) . '">
		</FORM>
		';
        $tmp .= '<br />' . "\n";
        $tpl->assign('clear', $tmp);
    }
    // user is not allowed to pay, so don't display the button
    if (!access_allowed(USER_BIT_MONEY)) {
        return 0;
    }
    $tmp = '
		<FORM ACTION="orders.php" METHOD=POST>
		<INPUT TYPE="HIDDEN" NAME="command" VALUE="pay">
		' . ucfirst(phr('PAID_ASK')) . '<br/>
		';
    if ($paid) {
        $tmp .= '
		<INPUT TYPE="hidden" name="data[paid]" value="0">
		<INPUT TYPE="submit" value="' . ucfirst(phr('NOT_PAID_BUTTON')) . '">
		<br/><br/>';
    } else {
        $tmp .= '
		<INPUT TYPE="hidden" name="data[paid]" value="1">
		<INPUT TYPE="submit" value="' . ucfirst(phr('PAID_BUTTON')) . '">
		<br/><br/>';
    }
    $tmp .= '
		</FORM>';
    $tmp .= '<br />' . "\n";
    $tpl->assign('pay', $tmp);
    return 0;
}