Example #1
0
function map_full($uid, $limit, $mapexist = 0)
{
    if ($mapexist == 1) {
        // 重新產生
        $t = map_get_ok($uid);
    } else {
        $t = map_list_get($uid);
    }
    if (count($t) >= $limit) {
        return true;
    }
    return false;
}
Example #2
0
if (empty($_SESSION['loggedin'])) {
    header("Location: login.php");
    exit(0);
}
require_once "config.inc.php";
// 輸出基本表格
if (!isset($_REQUEST['iDisplayStart'])) {
    $count = map_list_count($_SESSION['uid']);
    $user = fetch_user($_SESSION['mylogin']);
    $ps = $count / $user['limit'] * 100;
    $psinfo = sprintf("已產生地圖 %d / %d", $count, $user['limit']);
    $smarty->assign("ps", $ps);
    $smarty->assign("psinfo", $psinfo);
    echo $smarty->fetch("list.html");
} else {
    $maps = map_list_get($_SESSION['uid']);
    $start = $_REQUEST['iDisplayStart'];
    $limit = $_REQUEST['iDisplayLength'];
    for ($i = $start; $i < $start + $limit; $i++) {
        if (isset($maps[$i])) {
            $result_map[] = $maps[$i];
        }
    }
    $response['sEcho'] = $_REQUEST['sEcho'];
    $response['iTotalRecords'] = count($maps);
    $response['iTotalDisplayRecords'] = count($maps);
    $response['aaData'] = create_rows($result_map, $start);
    //print_r($_REQUEST);
    exit(json_encode($response));
}
function create_rows($maps, $startsn = 0)