示例#1
0
function do_export()
{
    global $vars;
    global $db;
    if ($vars['date_check'] == "on") {
        $dt = get_input_vars();
        $start_date = set_date_from_smarty('range_start', $dt);
        $end_date = set_date_from_smarty('range_end', $dt);
    } else {
        $start_date = '0000-00-00';
        $end_date = '2099-12-31';
    }
    $members = array();
    if ($vars['send_file']) {
        header('Cache-Control: maxage=3600');
        header('Pragma: public');
        header("Content-type: application/csv");
        $dat = date('Ymd');
        header("Content-Disposition: attachment; filename=amember-{$dat}.csv");
    } else {
        header("Content-type: text/plain");
    }
    define('REC_LIMIT', 1024);
    if (count($vars['product_name']) > 0) {
        $prod = join(",", $vars['product_name']);
    } else {
        $prod = '';
    }
    foreach ($vars['subscr_type'] as $subscr_type) {
        switch ($subscr_type) {
            case 'any':
                if ($subscr_type == 'any') {
                    $cmpl = 0;
                }
            case 'completed':
                if ($subscr_type == 'completed') {
                    $cmpl = 1;
                }
            case 'not_completed':
                if ($subscr_type == 'not_completed') {
                    $cmpl = -1;
                }
                list($count, $sumx) = $db->get_payments_c($start_date, $end_date, $cmpl, 'add', $prod);
                $used_member_id = array();
                for ($i = 0; $i < $count; $i += REC_LIMIT) {
                    $list1 = $db->get_payments($start_date, $end_date, $cmpl, $i, REC_LIMIT, 'add', $prod);
                    foreach ($list1 as $l) {
                        if ($vars['multi_type'] == 'discard' && $used_member_id[$l['member_id']]++) {
                            continue;
                        }
                        if (!isset($members[$l['member_id']])) {
                            $members[$l['member_id']] = $db->get_user($l['member_id']);
                        }
                        $members[$l['member_id']]['PAYMENTS'][$l['payment_id']] = $l;
                    }
                    print_rows($members);
                    $members = array();
                }
                break;
            case 'active':
                $yesterday = date('Y-m-d', time() - 3600 * 24);
                $count = $db->users_find_by_date_c($yesterday, 'date_range', $start_date, $end_date, $prod);
                for ($i = 0; $i < $count; $i += REC_LIMIT) {
                    $members1 = $db->users_find_by_date($yesterday, 'date_range', $i, REC_LIMIT, $start_date, $end_date, $prod);
                    $dat = date('Y-m-d');
                    foreach ($members1 as $u) {
                        $members[$u['member_id']] = $u;
                        $list = $db->get_user_payments($u['member_id'], 1);
                        foreach ($list as $l) {
                            $tmadd = explode(' ', $l['tm_added']);
                            if ($l['begin_date'] > $dat || $l['expire_date'] < $dat || $tmadd[0] < $start_date || $tmadd[0] > $end_date) {
                                continue;
                            }
                            if (count($vars['product_name']) > 0 && !in_array($l['product_id'], $vars['product_name'])) {
                                continue;
                            }
                            $members[$u['member_id']]['PAYMENTS'][$l['payment_id']] = $l;
                        }
                    }
                    print_rows($members);
                    $members = array();
                }
                break;
            case 'expired':
                $today = date('Y-m-d', time());
                $count = $db->users_find_by_date_c($today, 'expire_date_range', $start_date, $end_date, $prod);
                for ($i = 0; $i < $count; $i += REC_LIMIT) {
                    $members1 = $db->users_find_by_date($today, 'expire_date_range', $i, REC_LIMIT, $start_date, $end_date, $prod);
                    $dat = date('Y-m-d');
                    foreach ($members1 as $u) {
                        $members[$u['member_id']] = $u;
                        $list = $db->get_user_payments($u['member_id'], 1);
                        foreach ($list as $l) {
                            $tmadd = explode(' ', $l['tm_added']);
                            if ($l['begin_date'] > $dat || $l['expire_date'] > $dat || $tmadd[0] < $start_date || $tmadd[0] > $end_date) {
                                continue;
                            }
                            if (count($vars['product_name']) > 0 && !in_array($l['product_id'], $vars['product_name'])) {
                                continue;
                            }
                            $members[$u['member_id']]['PAYMENTS'][$l['payment_id']] = $l;
                        }
                    }
                    print_rows($members);
                    $members = array();
                }
                break;
            case 'expired_users':
                $count = $db->get_users_list_c("%", 2);
                for ($i = 0; $i < $count; $i += REC_LIMIT) {
                    $members1 = $db->get_users_list("%", 2, $i, $REC_LIMIT);
                    foreach ($members1 as $u) {
                        $members[$u['member_id']] = $u;
                    }
                    print_rows($members);
                    $members = array();
                }
                break;
            default:
                fatal_error("Unknown Subscription Type: Please select one", 0);
        }
        if ($subscr_type == 'all') {
            break;
        }
    }
}
示例#2
0
{
    foreach ($rows as $row) {
        echo "<tr>";
        foreach (array_keys($row) as $key) {
            echo "<td class='ed-stats'>" . $row[$key] . "</td>";
        }
        echo "</tr>";
    }
}
echo '<h2>List of Approval Editor Stats</h2>';
echo '<table id="approvalstats" class="tablesorter">';
echo '<thead><tr>';
echo '<th>Editor</th><th>Number of puzzles</th><th>Comments (total)</th><th>Comments (in last week)</th>';
echo '</tr></thead>';
print_rows(getApprovalEditorStats());
echo '</table><br><br>';
echo '<h2>List of Discussion Editor Stats</h2>';
echo '<table id="discussionstats" class="tablesorter">';
echo '<thead><tr>';
echo '<th>Editor</th><th>Number of puzzles</th><th>Comments (total)</th><th>Comments (in last week)</th>';
echo '</tr></thead>';
print_rows(getDiscussionEditorStats());
echo '</table><br><br>';
echo '<h2>List of Author Stats</h2>';
echo '<table id="authorstats" class="tablesorter">';
echo '<thead><tr>';
echo '<th>Author</th><th>Number of puzzles</th><th>Comments (total)</th><th>Comments (in last week)</th>';
echo '</tr></thead>';
print_rows(getAuthorStats());
echo '</table><br><br>';
foot();
示例#3
0
print_headers($this_table_obj);
?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php 
print_headers($this_table_obj);
?>
	</tr>
	</tfoot>

	<tbody>
<?php 
print_rows($this_table_obj);
?>
	</tbody>
</table>

<?php 
/**
* {@internal Missing Short Description}}
*
1329   * @since unknown
1330   *
1331   * @param unknown_type $posts
1332   */
function print_rows($this_table_obj)
{
    add_filter('the_title', 'esc_html');