1 | <?php |
---|
2 | /** |
---|
3 | * @copyright 2005-2006 OpenPNE Project |
---|
4 | * @license http://www.php.net/license/3_01.txt PHP License 3.01 |
---|
5 | */ |
---|
6 | |
---|
7 | class biz_do_f_home_add_biz_schedule extends OpenPNE_Action |
---|
8 | { |
---|
9 | function execute($requests) |
---|
10 | { |
---|
11 | $u = $GLOBALS['AUTH']->uid(); |
---|
12 | $target_id = $requests['target_id']; |
---|
13 | |
---|
14 | $start = $requests['start_date']; |
---|
15 | $text = $requests['title']; |
---|
16 | |
---|
17 | //書式チェック |
---|
18 | preg_match("/([0-2][0-9]:{0,1}[0-5][0-9]){0,1}(-{0,1})([0-2][0-9]:{0,1}[0-5][0-9]){0,1}\s*(.*)/", $text, $matches); |
---|
19 | |
---|
20 | if ($matches) { |
---|
21 | //クイック入力に対応した書式 |
---|
22 | $begin = $matches[1]; |
---|
23 | $delim = $matches[2]; |
---|
24 | $finish = $matches[3]; |
---|
25 | $title = $matches[4]; |
---|
26 | |
---|
27 | $begin_date = $finish_date = $start; |
---|
28 | |
---|
29 | //書式パターンは以下の通り |
---|
30 | // [開始時刻][時刻デリミタ][終了時刻][予定内容] |
---|
31 | // [開始時刻][終了時刻][予定内容] |
---|
32 | // [開始時刻][時刻デリミタ][予定内容] |
---|
33 | // [時刻デリミタ][終了時刻][予定内容] |
---|
34 | // [予定内容] |
---|
35 | |
---|
36 | if (!empty($begin) && !empty($finish)) { |
---|
37 | //開始時刻と終了時刻が存在する |
---|
38 | $begin_time = date("H:i", strtotime($begin)); |
---|
39 | $finish_time = date("H:i", strtotime($finish)); |
---|
40 | } elseif (!empty($begin) && !empty($delim)) { |
---|
41 | $begin_time = date("H:i", strtotime($begin)); |
---|
42 | $finish_time = null; |
---|
43 | } elseif (!empty($finish) && !empty($delim)) { |
---|
44 | $begin_time = null; |
---|
45 | $finish_time = date("H:i", strtotime($finish)); |
---|
46 | } else { |
---|
47 | $title = $text; |
---|
48 | $begin_date = $finish_date = $start; |
---|
49 | $begin_time = $finish_time = null; |
---|
50 | } |
---|
51 | } else { |
---|
52 | //通常の予定入力 |
---|
53 | $title = $text; |
---|
54 | $begin_date = $finish_date = $start; |
---|
55 | $begin_time = $finish_time = null; |
---|
56 | } |
---|
57 | |
---|
58 | if (empty($title)) { |
---|
59 | $p = array('target_c_member_id' => $target_id, 'msg' => 'タイトルを入力してください。'); |
---|
60 | openpne_redirect('pc', 'page_f_home', $p); |
---|
61 | exit(); |
---|
62 | } |
---|
63 | |
---|
64 | if (empty($target_id)) { |
---|
65 | $p = array('target_c_member_id' => $target_id, 'msg' => '不正な登録です。'); |
---|
66 | openpne_redirect('pc', 'page_f_home', $p); |
---|
67 | exit(); |
---|
68 | } |
---|
69 | |
---|
70 | biz_insertSchedule($title, $u, $begin_date, $finish_date, $begin_time, $finish_time, '', 0, 0, array($target_id)); //予定の登録 |
---|
71 | $p = array('target_c_member_id' => $target_id); |
---|
72 | openpne_redirect('pc', 'page_f_home', $p); |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | ?> |
---|