1 | <?php |
---|
2 | /** |
---|
3 | * @copyright 2005-2008 OpenPNE Project |
---|
4 | * @license http://www.php.net/license/3_01.txt PHP License 3.01 |
---|
5 | */ |
---|
6 | |
---|
7 | class biz_page_fh_biz_schedule_calendar extends OpenPNE_Action |
---|
8 | { |
---|
9 | function execute($requests) |
---|
10 | { |
---|
11 | $u = $GLOBALS['AUTH']->uid(); |
---|
12 | |
---|
13 | // --- リクエスト変数 |
---|
14 | $year = $requests['year']; |
---|
15 | $month = $requests['month']; |
---|
16 | $pref_id = $requests['pref_id']; |
---|
17 | // ---------- |
---|
18 | |
---|
19 | if (empty($requests['target_id']) || ($requests['target_id'] == $u)) { |
---|
20 | //自分自身 |
---|
21 | $target_id = $u; |
---|
22 | $this->set('is_h', true); //判別フラグ |
---|
23 | $this->set('inc_navi',fetch_inc_navi('h')); |
---|
24 | } else { |
---|
25 | //他人 |
---|
26 | $target_id = $requests['target_id']; |
---|
27 | $this->set('is_f', true); //判別フラグ |
---|
28 | $this->set('inc_navi',fetch_inc_navi('f', $target_id)); |
---|
29 | } |
---|
30 | |
---|
31 | if (!$year) { |
---|
32 | $year = date('Y'); |
---|
33 | } |
---|
34 | if (!$month) { |
---|
35 | $month = date('n'); |
---|
36 | } |
---|
37 | |
---|
38 | if ($year == date('Y') && $month == date('n')) { |
---|
39 | $is_curr = true; |
---|
40 | $curr_day = date('d'); |
---|
41 | } |
---|
42 | |
---|
43 | // イベント |
---|
44 | $event_list = db_schedule_event4c_member_id($year, $month, $target_id); |
---|
45 | // 誕生日 |
---|
46 | $birth_list = db_schedule_birth4c_member_id($month, $target_id); |
---|
47 | // Todo |
---|
48 | $todo_list = biz_schedule_todo4c_member_id($u, $target_id, $year, $month); |
---|
49 | |
---|
50 | require_once 'Calendar/Month/Weekdays.php'; |
---|
51 | $Month = new Calendar_Month_Weekdays($year, $month, 0); |
---|
52 | $Month->build(); |
---|
53 | |
---|
54 | $calendar = array(); |
---|
55 | $schedule = array(); |
---|
56 | $i = 0; |
---|
57 | while ($Day = $Month->fetch()) { |
---|
58 | if ($Day->isFirst()) $i++; |
---|
59 | |
---|
60 | if ($Day->isEmpty()) { |
---|
61 | $calendar[$i][] = array(); |
---|
62 | } else { |
---|
63 | $day = $Day->thisDay(); |
---|
64 | |
---|
65 | $schedule = biz_getDateMemberSchedule($year, sprintf("%02d", $month), sprintf("%02d", $day), $target_id, $u); |
---|
66 | $banner = biz_isBannerSchedule($year, sprintf("%02d", $month), sprintf("%02d", $day), $target_id); |
---|
67 | |
---|
68 | if (!empty($banner)) { |
---|
69 | foreach($banner as $value) { |
---|
70 | array_push($schedule, $value); |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|
74 | $item = array( |
---|
75 | 'day' => $day, |
---|
76 | 'now' => false, |
---|
77 | 'birth' => $birth_list[$day], |
---|
78 | 'event' => $event_list[$day], |
---|
79 | 'schedule' => $schedule, |
---|
80 | 'todo' => $todo_list[$day], |
---|
81 | 'holiday' => db_c_holiday_list4date($month, $day), |
---|
82 | ); |
---|
83 | $item['day'] = $day; |
---|
84 | if ($is_curr && $item['day'] == $curr_day) { |
---|
85 | $item['now'] = true; |
---|
86 | } |
---|
87 | |
---|
88 | $calendar[$i][] = $item; |
---|
89 | } |
---|
90 | } |
---|
91 | |
---|
92 | $ym = array( |
---|
93 | 'year_disp' => $year, |
---|
94 | 'month_disp' => $month, |
---|
95 | 'year_prev' => date('Y', $Month->prevMonth(true)), |
---|
96 | 'month_prev' => date('n', $Month->prevMonth(true)), |
---|
97 | 'year_next' => date('Y', $Month->nextMonth(true)), |
---|
98 | 'month_next' => date('n', $Month->nextMonth(true)), |
---|
99 | ); |
---|
100 | $this->set("ym", $ym); |
---|
101 | |
---|
102 | $this->set("year", $year); |
---|
103 | $this->set("month", $month); |
---|
104 | $this->set("calendar", $calendar); |
---|
105 | |
---|
106 | $c_member = db_member_c_member4c_member_id($target_id); |
---|
107 | $this->set("pref_list", p_regist_prof_c_profile_pref_list4null()); |
---|
108 | $this->set("c_member", $c_member); |
---|
109 | |
---|
110 | return 'success'; |
---|
111 | } |
---|
112 | } |
---|
113 | |
---|
114 | ?> |
---|