<?php

include_once '../da_access.php';
include_once 'rest_validate.php';
include_once '../lib/log4php/Logger.php';
Logger::configure('../conf/log4php.xml');
$logger = Logger::getLogger("rest_get_newly_create.php");
if ($isValidReq == true) {
    $items = getAccountItemByPage(0, $_POST['itemCount']);
    while ($row = mysql_fetch_array($items)) {
        $accountId = $row['id'];
        $itemName = $row['name'];
        $accountTimestamp = $row['account_date'];
        $accountYearMonth = date('Y-m-d', $accountTimestamp);
        $accountArray[$accountId] = $accountYearMonth . ' ' . $itemName;
    }
    $logger->info('Got last 5 create items: ');
    $logger->info($accountArray);
    echo "{\"error\":\"0\",\"msg\":" . json_encode($accountArray) . "}";
} else {
    echo "{\"error\":\"1\",\"msg\":\"This request has failed to pass the validation!\"}";
}
示例#2
0
} else {
    if ($type == 2) {
        $titleType = "收入";
    } else {
        $titleType = "收支";
    }
}
// get account items and statistic summaries according to the statistic period
$items;
$pageCount;
$itemCount = $ITEMS_EVERY_PAGE;
if ($year == 0) {
    // whole period
    $pageCount = getPageCount();
    $statisticByCat = getAllYearStatistic($type);
    $accountItems = getAccountItemByPage($pageNum, $itemCount);
} else {
    if ($month == 0) {
        // whole year
        $timeStart = mktime(0, 0, 0, 1, 1, $year);
        $timeEnd = mktime(23, 59, 59, 12, 31, $year);
    } else {
        // whole month
        $timeStart = mktime(0, 0, 0, $month, 1, $year);
        $timeEnd = mktime(0, 0, 0, $month + 1, 1, $year);
    }
    $statisticByCat = getStatisticByTimePeriod($type, $timeStart, $timeEnd);
    $pageCount = getPageCountByTimePeriod($timeStart, $timeEnd);
    $accountItems = getAccountItemByTimePeriod($pageNum, $itemCount, $type, $categoryId, $timeStart, $timeEnd);
}
$idx = 0;