私の質問を確認する時間をとってくれてありがとう。私は専門のPHP開発者ではないと言って前置きするべきですが、私は危険なほど十分に知っています!PHPカレンダーForeachループが期待通りに機能しない
私は現在、特定の日に「イベント」を表示するPHPカレンダーを設定しています。私は次のコードを変更した
:現在http://www.codesend.com/view/84dba4acad5998d6fd4119c0c758dc52/
を、私は日を経ると、データが存在することを日ごとにブートストラップモーダルボックスのボタンを表示するには、foreachループを取得することができますよ。 print_r &タグを使用してデバッグすると、値が正しく表示されていることがわかりますが、何らかの理由で、各日のデータを正しい日に配置するのではなく、すべての日にデータを複製しています。
私は現在のforeachループ内で追加のforeachループを実行しようとしましたが、動作していないように見えるか正しく動作しません。
スクリーンショットでは、2日で "いいえ" & "保留中"と表示されます。しかし、私はビューのリクエストをクリックすると、KellyのPendingレコードしか表示されません。以下のように(注、非常に上部の3つのレコードが私のテストの記録であり、それは彼らが割り当てられるべきであるの日付を示して)
は、問題があるコードの私のブロックは、次のとおりです。
foreach($events[$event_day] as $event => $value) {
$calendar.= '<div class="event">';
//Debugging
$calendar.= '<pre>'. $value['status'] .'</pre>';
$status = trim($value['status']);
//if ($inc < 1){
$calendar.= '<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal">
View Requests
</button>';
//}
$calendar.='<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel" style="text-align:center;">Agent Requests for - </h4>
</div>
<div class="modal-body"><div class="row"><div class="col-md-4" style="border-right:1px solid gainsboro;min-height:250px;text-align:center;"><span class="label label-success" style="font-size:14px;">Approved</span><hr/>';
if ($status == 'Yes') {
$calendar.= '<li>'.$value['title'] .' ' .$value['title2'].'</li>';
}
$calendar.='</div><div class="col-md-4" style="border-right:1px solid gainsboro;min-height:250px;text-align:center;"><span class="label label-danger" style="font-size:14px;">Denied</span><hr/>';
if ($status == 'No') {
$calendar.= '<li>'.$value['title'] .' ' .$value['title2'].'</li>';
}
$calendar.='</div><div class="col-md-4" style="text-align:center;"><span class="label label-warning" style="font-size:14px;">Pending</span><hr/>';
if ($status == 'Pending') {
$calendar.= '<li>'.$value['title'] .' ' .$value['title2'].'</li>';
}
$calendar.='</div></div></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>';
//End Event Div
$calendar.= '</div>';
}
これを見るために時間を割いてくれてありがとうございます!
申し訳ありませんが、私は正確に私は私の答えを削除しますあなたの質問を読んでいないだろう –