Exemple #1
0
function GetCalendarsByRange()
{
    $ret = array();
    $view_Type = getPref('viewtype');
    // week,month,day
    $str_show_day = getPref('showdate');
    // 当前是那一天
    $clientzone = getPref('timezone');
    $serverzone = TIMEZONE_INDEX;
    $zonediff = $serverzone - $clientzone;
    $showday = strtodate($str_show_day);
    if (($timestamp = date_timestamp_get($showday)) === false) {
        echo 1;
        $ret["error"] = array("ErrorCode" => "NotVolidDateTimeFormat", "ErrorMsg" => msg("notvoliddatetimeformat"));
        //替换成
    } else {
        $dataformat = GetCalendarViewFormat($view_Type, $timestamp);
        $qstart = $dataformat['start_date'] + $zonediff * 3600;
        $qend = $dataformat['end_date'] + $zonediff * 3600;
        //查询数据库 GetClientIP();
        // {"start":start,"end":end,"error":error,"issort":issort,"events":jsonlist}
        $ret["start"] = TimestampToJsonTime($dataformat['start_date']);
        $ret["end"] = TimestampToJsonTime($dataformat['end_date']);
        $ret["error"] = NUll;
        $ret["issort"] = TRUE;
        //print_r($ret);
        $ret["events"] = DbQueryCalendars(date("Y-m-d H:i:s", $qstart), date("Y-m-d H:i:s", $qend), GetClientIP(), $zonediff);
    }
    echo json_encode($ret);
}
Exemple #2
0
function TimeToJsonTime($time)
{
    $datetime = new DateTime($time);
    return TimestampToJsonTime($datetime->getTimestamp());
}