function intSetReport(&$smarty)
{
    $do_empty = TRUE;
    $smarty->assign("show_report", TRUE);
    $conds = collectConditions();
    $report_helper = new ReportHelper();
    $req = new GetCreditChanges($conds, $report_helper->getFrom(), $report_helper->getTo(), $report_helper->getOrderBy(), $report_helper->getDesc());
    $resp = $req->sendAndRecv();
    if ($resp->isSuccessful()) {
        $result = $resp->getResult();
        $report = $result["report"];
        $total_rows = $result["total_rows"];
        $total_per_user_credit = $result["total_per_user_credit"];
        $total_admin_credit = $result["total_admin_credit"];
        $do_empty = FALSE;
    } else {
        $resp->setErrorInSmarty($smarty);
    }
    if ($do_empty) {
        $report = array();
        $total_rows = 0;
        $total_per_user_credit = 0;
        $total_admin_credit = 0;
    }
    $smarty->assign_by_ref("report", $report);
    $smarty->assign("total_rows", $total_rows);
    $smarty->assign("total_per_user_credit", $total_per_user_credit);
    $smarty->assign("total_admin_credit", $total_admin_credit);
}
function intDoSearch(&$smarty)
{
    $user_search_helper = new ReportCollector();
    $report_helper = new ReportHelper();
    intSetConditions($smarty, $user_search_helper);
    list($count, $user_ids, $user_infos) = searchUser($smarty, $user_search_helper->getConds(), $report_helper->getFrom(), $report_helper->getTo(), $report_helper->getOrderBy(), $report_helper->getDesc());
    $smarty->assign_by_ref("user_infos", $user_infos);
    $smarty->assign_by_ref("user_ids", $user_ids);
    $smarty->assign("result_count", $count);
    $smarty->assign("show_results", TRUE);
    intShowUserSearch($smarty);
}
function intShowOnlineUsers(&$smarty)
{
    $report_helper = new ReportHelper();
    $req = new GetOnlineUsers($report_helper->getOrderBy(), $report_helper->getDesc());
    $resp = $req->sendAndRecv();
    if ($resp->isSuccessful()) {
        $onlines = $resp->getResult();
    } else {
        $resp->setErrorInSmarty($smarty);
        $onlines = array();
    }
    intShowOnlinesByType($smarty, $onlines);
}
function intSetReport(&$smarty)
{
    $do_empty = TRUE;
    if (isInRequest("show")) {
        $conds = collectConditions();
        $report_helper = new ReportHelper(0, 30, "add_date", TRUE);
        $req = new SearchAddUserSaves($conds, $report_helper->getFrom(), $report_helper->getTo(), $report_helper->getOrderBy(), $report_helper->getDesc());
        $resp = $req->sendAndRecv();
        if ($resp->isSuccessful()) {
            $result = $resp->getResult();
            $report = $result["result"];
            $total_rows = $result["total_rows"];
            $do_empty = FALSE;
        } else {
            $resp->setErrorInSmarty($smarty);
        }
    }
    if ($do_empty) {
        $report = array();
        $total_rows = 0;
    }
    $smarty->assign_by_ref("results", $report);
    $smarty->assign("total_rows", $total_rows);
}