0
データベースと比較して現在の時間に基づいてイベントを表示しています。 例 現在時刻:時から16時 :16時 時間:現在時刻が存在する17時FullCalendarデータ受け渡しの構文
場合、それは、カレンダー上のデータを表示したりしません。 私はそれに問題があります。現在の時刻が一致しない場合、私のコードがelseセクションに入ると、false配列が作成されます。
$json = array();
$start=$_REQUEST['start'];
$end=$_REQUEST['end'];
if($start != '' && $end != '')
{
$where="(from_date BETWEEN '$start' and '$end') or (to_date BETWEEN '$start' and '$end')";
$finalArray=[];
//$json=$this->Rates_model->getAnyData($where,'','','','','');
$json=$this->Rates_model->getAnyData();
if(!empty($json))
{
foreach ($json as $key => $js) {
$finalArray[$key]['id']= $js->id;
$from= array('time'=>gmdate("h:i", strtotime($js->from_time)));
$to= array('time'=>gmdate("h:i", strtotime($js->to_time)));
$date1 = date("h:i a");
$date2 = date('h:i a', strtotime($js->from_time));
$date3 = date('h:i a', strtotime($js->to_time));
if ($date1 > $date2 && $date1 < $date3)
{
$finalArray[$key]['start']= date('Y-d-m',strtotime($js->from_date))."T".$js->from_time;
$finalArray[$key]['end']=date('Y-d-m',strtotime($js->to_date))."T".$js->to_time;
if(!empty($js->rate_per_hour) && !empty($js->rate_per_mile))
{
$fullTitle="Hour: ".$js->rate_per_hour.",Mile: ".$js->rate_per_mile;
}
elseif(!empty($js->rate_per_hour) && empty($js->rate_per_mile)){
$fullTitle="Hour: ".$js->rate_per_hour;
}
elseif(empty($js->rate_per_hour) && !empty($js->rate_per_mile)){
$fullTitle="Mile: ".$js->rate_per_mile;
}
$finalArray[$key]['title']=$fullTitle;
}
else
{
echo "No Event has been Set";
}
}
echo json_encode($finalArray);
私のJSON応答時間が存在する場合:
[{"id":"1","start":"2017-03-11T13:00:00","end":"2017-03-11T17:00:00","title":"Hour: 0.99,Mile: 0.99"},{"id":"14","start":"2017-03-11T15:00:00","end":"2017-03-11T17:30:00","title":"Hour: 11.00,Mile: 11.00"},{"id":"15","start":"2017-03-12T15:25:00","end":"-0001-30-11T17:30:00","title":"Hour: 22.00,Mile: 22.00"}]
をなしイベント
[{"id":"1","start":"2017-03-11T13:00:00","end":"2017-03-11T17:00:00","title":"Hour: 0.99,Mile: 0.99"},{"id":"14"},{"id":"15","start":"2017-03-12T15:25:00","end":"-0001-30-11T17:30:00","title":"Hour: 22.00,Mile: 22.00"}]
を設定されていない 現在の時刻が、その後一致していない場合、私はFullCalendarを使用しています。
false arrayはどういう意味ですか? – Zgr3doo