コミュニティにコミュニティカレンダーを追加
c_home.tpl,c_home.phpをいじくり
h_home.tpl,h_home.phpを参考にカレンダーを追加しようとする。
c_home.phpに
// 今日の日付、曜日 $this->set('r_datetime', date('m/d')); $date = array('日','月','火','水','木','金','土'); $this->set('r_datetime_date', $date[date('w')]); /// 週間カレンダー if (DISPLAY_SCHEDULE_HOME) { $this->set('calendar', $this->get_calendar($u, $requests['w'])); } function get_calendar($u, $week) { require_once 'Calendar/Week.php'; $w = intval($week); if (empty($w)) { $w = 0; } $this->set('w', $w); $time = strtotime($w . ' week'); $Week = new Calendar_Week(date('Y', $time), date('m', $time), date('d', $time), 0); $Week->build(); $calendar = array(); $dayofweek = array('日','月','火','水','木','金','土'); $i = 0; while ($Day = $Week->fetch()) { $y = $Day->thisYear(); $m = $Day->thisMonth(); $d = $Day->thisDay(); $item = array( 'year'=> $y, 'month'=>$m, 'day' => $d, 'dayofweek'=>$dayofweek[$i++], 'now' => false, 'birth' => p_h_home_birth4c_member_id($m, $d, $u), 'event' => p_h_home_event4c_member_id($y, $m, $d, $u), 'schedule' => p_h_calendar_c_schedule_list4date($y, $m, $d, $u), ); if ($w == 0 && $d == date('d')) { $item['now'] = true; } $calendar[] = $item; } return $calendar; }
を追加
c_home.tplに
({if $inc_entry_point[6]}) ({$inc_entry_point[6]|smarty:nodefaults}) ({/if}) ({if $calendar}) <!-- ***************************** --> <!-- ******ここから:週間予定****** --> <form action="./" method="post"> <input type="hidden" name="m" value="pc"> <input type="hidden" name="sessid" value="({$PHPSESSID})"> <input type="hidden" name="a" value="do_c_home_insert_c_schedule"> <input type="hidden" name="w" value="({$w})"> <table border="0" cellspacing="0" cellpadding="0" style="width:440px;margin:0px auto;" class="border_07"> <tr> <td style="width:7px;" class="bg_00"><img src="./skin/dummy.gif" style="width:7px;height:7px;" class="dummy"></td> <td style="width:424px;" class="bg_00"><img src="./skin/dummy.gif" style="width:424px;height:7px;" class="dummy"></td> <td style="width:7px;" class="bg_00"><img src="./skin/dummy.gif" style="width:7px;height:7px;" class="dummy"></td> </tr> <tr> <td class="bg_00"><img src="./skin/dummy.gif" style="width:7px;height:7px;" class="dummy"></td> <td class="bg_01" style="width:424px;"> <!-- ここから:主内容>>カレンダー --> ({if $msg}) <div class="border_01 bg_02"> <div class="padding_s" align="left"> <span class="caution">({$msg})</span> </div> </div> ({/if}) <div class="border_01"> <table border="0" cellspacing="0" cellpadding="0" style="width:422px;"> <tr> <td style="width:36px;" class="bg_06"><img src="./skin/content_header_1.gif" style="width:30px;height:20px;" class="dummy"></td> <td style="width:300px;padding:2px 0px;" class="bg_06"><span class="b_b c_00">コミュニティカレンダー</span></td> <td style="width:86px;" align="right" class="bg_06"> <a href="?m=pc&a=page_c_home&w=({$w-1})&target_c_commu_id=({$c_commu.c_commu_id})" title="前の週"><</a> <a href="?m=pc&a=page_c_home" title="今週">■</a> <a href="?m=pc&a=page_h_home&w=({$w+1})" title="次の週">></a></td> </tr> </table> </div> <table border="0" cellspacing="0" cellpadding="0" style="width:424px;"> <tr> ({foreach from=$calendar item=item name=calendar}) <td style="width:({if $smarty.foreach.calendar.last})64({else})60({/if})px;({if !$smarty.foreach.calendar.last})border-right:none;({/if})" align="left" valign="top" class="border_01 bg_0({if $item.now})9({else})2({/if})({if $item.dayofweek == "日"}) c_02({elseif $item.dayofweek == "土"}) c_03({/if}) padding_s"> ({if $item.now})<span class="b_b">({/if}) ({if $smarty.foreach.calendar.first || $item.day == 1}) ({$item.month})/({/if}) ({$item.day})<br> (({$item.dayofweek}))<br> ({if $item.now})</span>({/if}) <div> ({* 誕生日 *}) ({foreach from=$item.birth item=item_birth}) <img src="./skin/icon_birthday.gif" class="icon"><a href="?m=pc&a=page_f_home&target_c_member_id=({$item_birth.c_member_id})">({$item_birth.nickname})さん</a><br> ({/foreach}) ({* イベント *}) ({foreach from=$item.event item=item_event}) <img src="./skin/icon_event_({if $item_event.is_join})R({else})B({/if}).gif" class="icon"><a href="?m=pc&a=page_c_event_detail&target_c_commu_topic_id=({$item_event.c_commu_topic_id})">({$item_event.name|t_truncate:20:".."})</a><br> ({/foreach}) ({* スケジュール *}) ({foreach from=$item.schedule item=item_schedule}) <img src="./skin/icon_pen.gif" class="icon"><a href="?m=pc&a=page_h_schedule&target_c_schedule_id=({$item_schedule.c_schedule_id})">({$item_schedule.title})</a><br> ({/foreach}) </div> </td> ({/foreach}) </tr> </table> </div> <div style="text-align:right;padding-right:20px;" class="border_01 bg_02 padding_s"> <img src="./skin/dummy.gif" class="icon arrow_1"> <a href="?m=pc&a=page_h_calendar">月別カレンダー</a> </div> <!-- ここまで:主内容>>カレンダー --> </td> <td class="bg_00"><img src="./skin/dummy.gif"></td> </tr> <tr> <td class="bg_00"><img src="./skin/dummy.gif" style="width:7px;height:7px;" class="dummy"></td> <td class="bg_00"><img src="./skin/dummy.gif" style="width:424px;height:7px;" class="dummy"></td> <td class="bg_00"><img src="./skin/dummy.gif" style="width:7px;height:7px;" class="dummy"></td> </tr> </table> </form> <!-- ******ここまで:週間予定****** --> <!-- ***************************** --> <img src="./skin/dummy.gif" class="v_spacer_m"> ({/if})
を追加、このあとのentry_pointは数字全部をずらした。
どっかにあったentry_pointの部分のforを8に変更。
webapp\modules\pc\do\h_home_insert_c_schedule.phpをコピって
webapp\modules\pc\do\c_home_insert_c_schedule.php中をc_home用にざっと変更
このままだと、前の週に行こうとしたらtarget_c_commu_idをクレロと怒られたので
<td style="width:86px;" align="right" class="bg_06"> <a href="?m=pc&a=page_c_home&w=({$w-1})&target_c_commu_id=({$c_commu.c_commu_id})" title="前の週"><</a>
なんかにしてみる。
マイホームみたく前の週に行かずに、今週しか表示されねぇ
hidden辺りと、db/read/のcommu.phpとschedule.phpが怪しい気がする。