正確には、ical ファイル出力であるイベントを含む配列を出力しようとしています。配列自体は次のようになります。
Array (
[0] => Array (
[UID] => 4C2DDB6E-5B5B-4B97-BEBE-FF424BB154F8
[DTEND] => 20131116 [SUMMARY] => test1_ONS
[LAST-MODIFIED] => 20131111T210530Z
[DTSTAMP] => 20131111T213437Z
[DTSTART] => 20131112
[LOCATION] => City
[SEQUENCE] => 1
[DESCRIPTION] => description here_http://www.test.com/test1
[SUMMARY] => some text here
) )
次の foreach ループを使用して、そのレコードをループし、すべてのイベントを出力できます。
foreach ($events_sorted as $event) {
$client = current(explode("_", $event['SUMMARY']));
} and so on...
トリッキーな部分は、イベントのテーブル レイアウトが月に基づいており、次のようになっていることです。
CLIENT EXHIBITION CITY
_________________________________________
OCT 2013 client exhibition city
client exhibition city
client exhibition city
________________________________________
NOV 2013 client exhibition city
client exhibition city
________________________________________
DEC 2013 client exhibition city
私ができないことは、すべてのイベントをループし、対応する月の名前をレイアウトごとに 1回出力し、対応するイベントのデータを出力して、次の月に進むことです。
ただし、私のテーブル レイアウトは、最初の行に月名データが含まれ、イベントを含む他のすべての行と何らかの方法で区別する必要があるように構築されています。
<table id="table_events">
<tbody><tr id="header_row">
<th id="date_header"></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr class="month_start">
<td>
<div class="month_rect">
<div class="month_rect_text month_long">SEPT</div>
<div class="month_rect_year">2013</div>
</div>
</td>
<td>eee</td>
<td>eee</td>
<td>Oslo</td>
</tr>
<tr>
<td>
</td>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
<tr>
<td></td>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
<tr id="oct" class="month_start">
<td>
<div class="month_rect">
<div class="month_rect_text month_short">OCT</div>
<div class="month_rect_year">2013</div>
</div>
</td>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
<tr>
<td>
</td>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
<tr class="month_start">
<td>
<div class="month_rect">
<div class="month_rect_text month_short">NOV</div>
<div class="month_rect_year">2013</div>
</div>
</td>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
<tr>
<td>
</td>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
</tbody></table>
今まで、月に基づいて新しい配列を作成しようとしましたが、運もありませんでした:
foreach($events_sorted as $test) {
$month_number = gmdate("m", $ical->iCalDateToUnixTimestamp($test['DTSTART']));
$r = array("month" => $month_number);
}
私の最後のアイデアは、すべてのイベントを出力し、月名の存在の配列チェックをリセットすることでした。存在する場合は、再度出力せずに別のテーブル行レイアウトを使用することでしたが、このソリューションを実装する方法がわかりません。説明された効果を達成するためのより簡単な方法があることを願っています