function execute($requests) { $u = $GLOBALS['AUTH']->uid(); $start = $requests['start_date']; $text = $requests['title']; //書式チェック 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); if ($matches) { //クイック入力に対応した書式 $begin = $matches[1]; $delim = $matches[2]; $finish = $matches[3]; $title = $matches[4]; $begin_date = $finish_date = $start; //書式パターンは以下の通り // [開始時刻][時刻デリミタ][終了時刻][予定内容] // [開始時刻][終了時刻][予定内容] // [開始時刻][時刻デリミタ][予定内容] // [時刻デリミタ][終了時刻][予定内容] // [予定内容] if (!empty($begin) && !empty($finish)) { //開始時刻と終了時刻が存在する $begin_time = date("H:i", strtotime($begin)); $finish_time = date("H:i", strtotime($finish)); } elseif (!empty($begin) && !empty($delim)) { $begin_time = date("H:i", strtotime($begin)); $finish_time = null; } elseif (!empty($finish) && !empty($delim)) { $begin_time = null; $finish_time = date("H:i", strtotime($finish)); } else { $title = $text; $begin_date = $finish_date = $start; $begin_time = $finish_time = null; } } else { //通常の予定入力 $title = $text; $begin_date = $finish_date = $start; $begin_time = $finish_time = null; } if (empty($title)) { $p = array('msg' => 'タイトルを入力してください。'); openpne_redirect('pc', 'page_h_home', $p); } $join_members = array($u); biz_insertSchedule($title, $u, $begin_date, $finish_date, $begin_time, $finish_time, '', 0, 0, 0, 'public', $join_members); //予定の登録 biz_readSchedule($u, biz_getScheduleMax()); //既読に $p = array(); openpne_redirect('pc', 'page_h_home', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); $start = $requests['start_date']; $target_id = $requests['target_id']; $text = $requests['title']; //書式チェック preg_match("/([0-2][0-9].*?[0-5][0-9]).*?([0-2][0-9].*?[0-5][0-9])\\s*(.*)/", $text, $matches); if ($matches) { //クイック入力に対応した書式 $title = $matches[3]; $begin_date = $finish_date = $start; $begin_time = date("H:i", strtotime($matches[1])); if (empty($matches[2])) { $finish_time = null; } else { $finish_time = date("H:i", strtotime($matches[2])); } } else { //通常の予定入力 $title = $text; $begin_date = $finish_date = $start; $begin_time = $finish_time = null; } $members = biz_getGroupMember($target_id); $members_id = array(); foreach ($members as $key => $values) { array_push($members_id, $values['c_member_id']); } if (empty($text)) { $p = array('target_c_commu_id' => $target_id, 'msg' => 'タイトルを入力してください。'); openpne_redirect('biz', 'page_g_home', $p); exit; //強制的にスクリプトを終了しなければいけない } biz_insertSchedule($title, $u, $begin_date, $finish_date, $begin_time, $finish_time, '', 0, 0, $target_id, 'group', $members_id); //予定の登録 biz_readSchedule($u, biz_getScheduleMax()); //既読済みに $p = array('target_c_commu_id' => $target_id); openpne_redirect('biz', 'page_g_home', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); $sessid = session_id(); if ($requests['sc_b_hour'] && !$requests['sc_b_minute']) { $requests['sc_b_minute'] = '00'; } if ($requests['sc_f_hour'] && !$requests['sc_f_minute']) { $requests['sc_f_minute'] = '00'; } //日付のフォーマットを設定 $begin_date = $requests['sc_b_year'] . '-' . $requests['sc_b_month'] . '-' . $requests['sc_b_date']; // 入力された時刻のチェック if (!($requests['sc_b_hour'] || $requests['sc_b_minute'] || $requests['sc_f_hour'] || $requests['sc_f_minute'])) { // 時刻が未入力 $begin_time = $finish_time = null; } elseif (!($requests['sc_f_hour'] || $requests['sc_f_minute'])) { // 終了時刻が未入力 $begin_time = $requests['sc_b_hour'] . ':' . $requests['sc_b_minute']; $finish_time = null; } else { // 開始時刻と終了時刻が両方とも入力されている $begin_time = $requests['sc_b_hour'] . ':' . $requests['sc_b_minute']; $finish_time = $requests['sc_f_hour'] . ':' . $requests['sc_f_minute']; } //ERROR---------------- //存在しない日付 if (!checkdate($requests['sc_b_month'], $requests['sc_b_date'], $requests['sc_b_year'])) { $msg = '存在しない日付が指定されました。'; $p = array('msg' => $msg, 'sc_title' => $requests['sc_title'], 'sc_rp' => $requests['sc_rp'], 'sc_memo' => $requests['sc_memo'], 'sc_j_mem_enc' => serialize($requests['sc_j_mem']), 'sc_rwk_enc' => serialize($requests['sc_rwk']), 'sc_rcount' => $requests['sc_rcount'], 'sc_bn' => $requests['sc_bn']); openpne_redirect('biz', 'page_fh_biz_schedule_add', $p); exit; //強制的にスクリプトを終了しなければいけない } //--------------------- //ERROR---------------- //タイトル未入力 if (empty($requests['sc_title'])) { $msg = 'タイトルを入力してください。'; $url = $redirect_script . '&msg=' . $msg . '&begin_date=' . $begin_date . '&begin_time=' . $begin_time . '&finish_time=' . $finish_time . '&sc_rp=' . $requests['sc_rp'] . '&sc_memo=' . $requests['sc_memo'] . '&sc_j_mem_enc=' . serialize($requests['sc_j_mem']) . '&sc_rwk_enc=' . serialize($requests['sc_rwk']) . '&sc_rcount=' . $requests['sc_rcount'] . '&sc_bn=' . $requests['sc_bn']; $p = array('msg' => $msg, 'begin_date' => $begin_date, 'begin_time' => $begin_time, 'finish_time' => $finish_time, 'sc_rp' => $requests['sc_rp'], 'sc_memo' => $requests['sc_memo'], 'sc_j_mem_enc' => serialize($requests['sc_j_mem']), 'sc_rwk_enc' => serialize($requests['sc_rwk']), 'sc_rcount' => $requests['sc_rcount'], 'sc_bn' => $requests['sc_bn']); openpne_redirect('biz', 'page_fh_biz_schedule_add', $p); exit; //強制的にスクリプトを終了しなければいけない } //--------------------- //ERROR---------------- //繰り返し予定::曜日指定なし if ($requests['sc_rp'] && empty($requests['sc_rwk'])) { $msg = '繰り返し予定を登録する場合は、曜日を指定してください。'; $p = array('msg' => $msg, 'begin_date' => $begin_date, 'begin_time' => $begin_time, 'sc_title' => $requests['sc_title'], 'finish_time' => $finish_time, 'sc_rp' => $requests['sc_rp'], 'sc_memo' => $requests['sc_memo'], 'sc_j_mem_enc' => serialize($requests['sc_j_mem']), 'sc_rwk_enc' => serialize($requests['sc_rwk']), 'sc_rcount' => $requests['sc_rcount'], 'sc_bn' => $requests['sc_bn']); openpne_redirect('biz', 'page_fh_biz_schedule_add', $p); exit; //強制的にスクリプトを終了しなければいけない } //-------------------- //ERROR--------------- if (strtotime($finish_time) < strtotime($begin_time) && isset($finish_time)) { //終了時間と開始時間が変 $msg = '終了時刻が開始時刻より先です。'; $url = $redirect_script . '&msg=' . $msg . '&begin_date=' . $begin_date . '&sc_title=' . $requests['sc_title'] . '&sc_rp=' . $requests['sc_rp'] . '&sc_memo=' . $requests['sc_memo'] . '&sc_j_mem_enc=' . serialize($requests['sc_j_mem']) . '&sc_rwk_enc=' . serialize($requests['sc_rwk']) . '&sc_rcount=' . $requests['sc_rcount'] . '&sc_bn=' . $requests['sc_bn']; $p = array('msg' => $msg, 'begin_date' => $begin_date, 'sc_rp' => $requests['sc_rp'], 'sc_title' => $requests['sc_title'], 'sc_memo' => $requests['sc_memo'], 'sc_j_mem_enc' => serialize($requests['sc_j_mem']), 'sc_rwk_enc' => serialize($requests['sc_rwk']), 'sc_rcount' => $requests['sc_rcount'], 'sc_bn' => $requests['sc_bn']); openpne_redirect('biz', 'page_fh_biz_schedule_add', $p); exit; //強制的にスクリプトを終了しなければいけない } //-------------------- //ERROR--------------- //グループまで公開の予定なのにグループが指定されていない //-------------------- if ($requests['public_flag'] == 'group' && empty($requests['biz_group_id'])) { $msg = '「グループまで公開」予定の場合はグループを指定してください'; $url = $redirect_script . '&msg=' . $msg . '&begin_date=' . $begin_date . '&sc_title=' . $requests['sc_title'] . '&sc_rp=' . $requests['sc_rp'] . '&sc_memo=' . $requests['sc_memo'] . '&sc_j_mem_enc=' . serialize($requests['sc_j_mem']) . '&sc_rwk_enc=' . serialize($requests['sc_rwk']) . '&sc_rcount=' . $requests['sc_rcount'] . '&sc_bn=' . $requests['sc_bn']; $p = array('msg' => $msg, 'begin_date' => $begin_date, 'sc_rp' => $requests['sc_rp'], 'sc_memo' => $requests['sc_memo'], 'sc_j_mem_enc' => serialize($requests['sc_j_mem']), 'sc_rwk_enc' => serialize($requests['sc_rwk']), 'sc_rcount' => $requests['sc_rcount'], 'sc_bn' => $requests['sc_bn']); openpne_redirect('biz', 'page_fh_biz_schedule_add', $p); exit; //強制的にスクリプトを終了しなければいけない } //参加者のチェック if (in_array('0', $requests['sc_j_mem'])) { //「全員」が含まれている場合は、配列を空に $requests['sc_j_mem'] = array(); } if (!$requests['sc_rp'] && $requests['sc_bn'] == 1) { //当日中に終わる予定は、開始日と終了日は同一でなければならない $finish_date = $begin_date; } //繰り返し予定 if ($requests['sc_rp']) { //終了日の決定 if (in_array(date('w', strtotime($begin_date)), $requests['sc_rwk'])) { $finish_date = date("Y-m-d", strtotime($begin_date . ' + ' . ($requests['sc_rcount'] - 1) * 7 . 'days')); } else { $finish_date = date("Y-m-d", strtotime($begin_date . ' + ' . $requests['sc_rcount'] * 7 . 'days')); } //first_idの決定 $first_id = biz_getScheduleMax() + 1; if (!$first_id) { $first_id = 1; } //繰り返しルールの決定 foreach ($requests['sc_rwk'] as $value) { $rp_rule += 1 << $value; } } else { //繰り返しなし $finish_date = date("Y-m-d", strtotime($requests['sc_b_year'] . '-' . $requests['sc_b_month'] . '-' . ($requests['sc_b_date'] + ($requests['sc_bn'] - 1)))); } if (!$requests['sc_rp']) { //繰り返しをしない予定登録 biz_insertSchedule($requests['sc_title'], $u, $begin_date, $finish_date, $begin_time, $finish_time, $requests['sc_memo'], $rp_rule, 0, $requests['biz_group_id'], $requests['public_flag'], $requests['sc_j_mem']); } else { //繰り返し予定 $tmp = $begin_date; //処理中の日付 for ($i = 0; strtotime($tmp) < strtotime($finish_date); $i++) { $nowday = strtotime($begin_date . ' + ' . $i . 'days'); $tmp = date("Y-m-d", $nowday); if ($rp_rule & 1 << date("w", $nowday)) { biz_insertSchedule($requests['sc_title'], $u, $tmp, $tmp, $begin_time, $finish_time, $requests['sc_memo'], $rp_rule, $first_id, $requests['biz_group_id'], $requests['public_flag'], $requests['sc_j_mem']); } } } $week = date("W", abs(strtotime($begin_date) - strtotime(date("Y-m-d")))) - 1; $p = array('w' => $week, 'msg' => '予定を追加しました。', 'id' => biz_getScheduleMax(), 'target_id' => $requests['target_c_member_id']); openpne_redirect('biz', 'page_fh_biz_schedule_view', $p); }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; $tail = $GLOBALS['KTAI_URL_TAIL']; if (!biz_isPermissionSchedule($u, $requests['schedule_id'])) { handle_kengen_error(); } $schedule = biz_getScheduleInfo($requests['schedule_id']); $requests['sc_b_year'] = $requests['sc_b_year'] + 2000; //ERROR---------------- //存在しない日付 if (!checkdate($requests['sc_b_month'], $requests['sc_b_date'], $requests['sc_b_year'])) { $redirect_script = '?m=ktai_biz&a=page_fh_biz_schedule_edit&' . $tail; $msg = urlencode('存在しない日付が指定されました。'); $schedule = biz_getScheduleInfo($requests['schedule_id']); $begin_date = $schedule['begin_date']; //日付関連の引数は返さなくてもよい $url = $redirect_script . '&msg=' . $msg . '&begin_date=' . $begin_date . '&title=' . $requests['sc_title'] . '&sc_rp=' . $requests['sc_rp'] . '&value=' . $requests['sc_memo'] . '&members=' . $requests['sc_j_mem'] . '&writer=' . $requests['writer'] . '&schedule_id=' . $requests['schedule_id']; $_REQUEST['schedule_id'] = $requests['schedule_id']; $_REQUEST['msg'] = '存在しない日付が指定されました。'; openpne_forward('ktai_biz', 'page', "fh_biz_schedule_edit"); exit; } //--------------------- //ERROR---------------- //タイトル未入力 if (empty($requests['sc_title'])) { $redirect_script = '?m=ktai_biz&a=page_fh_biz_schedule_edit&id=' . $requests['schedule_id'] . '&' . $tail; $msg = urlencode('タイトルを入力してください。'); $begin_date = $requests['sc_b_year'] . '-' . $requests['sc_b_month'] . '-' . $requests['sc_b_date']; $url = $redirect_script . '&msg=' . $msg . '&begin_date=' . $begin_date . '&sc_rp=' . $requests['sc_rp'] . '&sc_memo=' . $requests['sc_memo'] . '&members=' . $requests['sc_j_mem'] . '&writer=' . $requests['writer'] . '&sc_rwk_enc=' . serialize($requests['sc_rwk_enc']) . '&sc_rcount=' . $requests['sc_rcount'] . '&schedule_id=' . $requests['schedule_id']; $_REQUEST['schedule_id'] = $requests['schedule_id']; $_REQUEST['msg'] = 'タイトルを入力してください。'; openpne_forward('ktai_biz', 'page', "fh_biz_schedule_edit"); exit; } //--------------------- if ($requests['sc_b_hour'] && !$requests['sc_b_minute']) { $requests['sc_b_minute'] = '00'; } if ($requests['sc_f_hour'] && !$requests['sc_f_minute']) { $requests['sc_f_minute'] = '00'; } //日付のフォーマットを設定 $begin_date = $requests['sc_b_year'] . '-' . $requests['sc_b_month'] . '-' . $requests['sc_b_date']; $begin_time = $requests['sc_b_hour'] . ':' . $requests['sc_b_minute']; $finish_time = $requests['sc_f_hour'] . ':' . $requests['sc_f_minute']; //ERROR--------------- if (strtotime($finish_time) < strtotime($begin_time) && $finish_time != ':') { //終了時間と開始時間が変 $redirect_script = '?m=ktai_biz&a=page_fh_biz_schedule_edit&id=' . $requests['schedule_id'] . '&' . $tail; $msg = urlencode('終了時刻が開始時刻より先です。'); $begin_date = $requests['sc_b_year'] . '-' . $requests['sc_b_month'] . '-' . $requests['sc_b_date']; $url = $redirect_script . '&msg=' . $msg . '&begin_date=' . $begin_date . '&sc_title=' . $requests['sc_title'] . '&sc_rp=' . $requests['sc_rp'] . '&sc_memo=' . $requests['sc_memo'] . '&members=' . $requests['sc_j_mem'] . '&writer=' . $requests['writer'] . '&sc_rwk_enc=' . serialize($requests['sc_rwk_enc']) . '&sc_rcount=' . $requests['sc_rcount'] . '&schedule_id=' . $requests['schedule_id']; $_REQUEST['schedule_id'] = $requests['schedule_id']; $_REQUEST['msg'] = '終了時刻が開始時刻より先です。'; openpne_forward('ktai_biz', 'page', "fh_biz_schedule_edit"); exit; } //-------------------- $mem = unserialize($requests['sc_j_mem']); $requests['sc_j_mem'] = array(); $i = 0; if ($mem) { foreach ($mem as $key => $value) { $requests['sc_j_mem'][$i] = $key; $i++; } } if (!($requests['sc_b_hour'] || $requests['sc_b_minute'] || $requests['sc_f_hour'] || $requests['sc_f_minute'])) { //時刻指定なし $begin_time = $finish_time = null; } elseif (!($requests['sc_f_hour'] || $requests['sc_f_minute'])) { $finish_time = null; } $finish_date = $begin_date; //当日中に終わる予定は、開始日と終了日は同一でなければならない $schedule_id = ''; $biz_schedule_member = biz_getJoinIdSchedule($requests['schedule_id']); biz_editSchedule($requests['sc_title'], $schedule['c_member_id'], $begin_date, $finish_date, $begin_time, $finish_time, $requests['sc_memo'], $rp_rule, 0, $requests['sc_j_mem'], $requests['public_flag'], $requests['schedule_id'], $biz_schedule_member); $schedule_id = $requests['schedule_id']; $first_id = biz_getScheduleMax() + 1; //登録される予定のプライマリキー $week = date("W", abs(strtotime($begin_date) - strtotime(date("Y-m-d")))) - 1; if (strtotime($begin_date) - strtotime(date('Y-m-d')) < 0) { $week = $week - $week * 2; } $_REQUEST['msg'] = '予定を編集しました。'; $_REQUEST['w'] = $week; $_REQUEST['target_id'] = $requests['target_id']; $_REQUEST['id'] = biz_getScheduleMax(); openpne_forward('ktai_biz', 'page', "fh_calendar_week"); exit; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); $sessid = session_id(); if (!biz_isPermissionSchedule($u, $requests['schedule_id'])) { handle_kengen_error(); } $schedule = biz_getScheduleInfo($requests['schedule_id']); if ($requests['sc_b_hour'] && !$requests['sc_b_minute']) { $requests['sc_b_minute'] = '00'; } if ($requests['sc_f_hour'] && !$requests['sc_f_minute']) { $requests['sc_f_minute'] = '00'; } //日付のフォーマットを設定 $begin_date = $requests['sc_b_year'] . '-' . $requests['sc_b_month'] . '-' . $requests['sc_b_date']; if ($requests['sc_b_hour'] && $requests['sc_b_minute']) { $begin_time = $requests['sc_b_hour'] . ':' . $requests['sc_b_minute']; } if ($requests['sc_f_hour'] && $requests['sc_f_minute']) { $finish_time = $requests['sc_f_hour'] . ':' . $requests['sc_f_minute']; } // エラー遷移用 $_REQUEST['begin_date'] = $begin_date; $_REQUEST['begin_time'] = $begin_time; $_REQUEST['finish_time'] = $finish_time; if (!checkdate($requests['sc_b_month'], $requests['sc_b_date'], $requests['sc_b_year'])) { $_REQUEST['msg'] = '存在しない日付が指定されました。'; openpne_forward('biz', 'page', 'fh_biz_schedule_edit'); exit; } if ($requests['sc_rp'] && empty($requests['sc_rwk'])) { $_REQUEST['msg'] = '繰り返し予定を登録する場合は、曜日を指定してください。'; openpne_forward('biz', 'page', 'fh_biz_schedule_edit'); exit; } if (strtotime($finish_time) < strtotime($begin_time) && isset($finish_time)) { $_REQUEST['msg'] = '終了時刻が開始時刻より先です。'; openpne_forward('biz', 'page', 'fh_biz_schedule_edit'); exit; } if ($requests['public_flag'] == 'group' && empty($requests['biz_group_id'])) { $_REQUEST['msg'] = '「グループまで公開」予定の場合はグループを指定してください'; openpne_forward('biz', 'page', 'fh_biz_schedule_edit'); exit; } //施設、参加者のチェック if (in_array('0', $requests['sc_j_mem'])) { //「全員」が含まれている場合は、配列を空に $requests['sc_j_mem'] = array(); } if (!($requests['sc_b_hour'] || $requests['sc_b_minute'] || $requests['sc_f_hour'] || $requests['sc_f_minute'])) { //時刻指定なし $begin_time = $finish_time = null; } elseif (!($requests['sc_f_hour'] || $requests['sc_f_minute'])) { $finish_time = null; } if (!$requests['sc_rp'] && $requests['sc_bn'] == 1) { //当日中に終わる予定は、開始日と終了日は同一でなければならない $finish_date = $begin_date; } $schedule_id = ''; if (!$requests['sc_rp']) { //繰り返しなし $finish_date = date("Y-m-d", strtotime($requests['sc_b_year'] . '-' . $requests['sc_b_month'] . '-' . ($requests['sc_b_date'] + ($requests['sc_bn'] - 1)))); //繰り返しをしない予定登録 biz_editSchedule($requests['sc_title'], $schedule['c_member_id'], $begin_date, $finish_date, $begin_time, $finish_time, $requests['sc_memo'], $rp_rule, 0, $requests['biz_group_id'], $requests['public_flag'], $requests['schedule_id'], $requests['sc_j_mem']); $schedule_id = $requests['schedule_id']; } else { //終了日の決定 if (in_array(date('w', strtotime($begin_date)), $requests['sc_rwk'])) { $finish_date = date("Y-m-d", strtotime($begin_date . ' + ' . ($requests['sc_rcount'] - 1) * 7 . 'days')); } else { $finish_date = date("Y-m-d", strtotime($begin_date . ' + ' . $requests['sc_rcount'] * 7 . 'days')); } //繰り返しルールの決定 foreach ($requests['sc_rwk'] as $value) { $rp_rule += 1 << $value; } //繰り返し予定 $tmp = strtotime($begin_date); //処理中の日付 if ($requests['iskeep']) { //繰り返し予定グループの維持(同予定から派生した繰り返し予定を一斉に編集) $replist = biz_getRepeatScheduleID($requests['schedule_id']); foreach ($replist as $value) { biz_deleteSchedule($value); //既存の繰り返し予定をすべて削除(予定日数の追加、削除のケースがありうるため) } } $first_id = biz_getScheduleMax() + 1; //登録される予定のプライマリキー for ($i = 0; $tmp < strtotime($finish_date); $i++) { //終了日に達するまで新規予定追加を繰り返す $nowday = strtotime($begin_date . ' +' . $i . 'days'); $tmp = $nowday; if ($rp_rule & 1 << date("w", $nowday)) { biz_insertSchedule($requests['sc_title'], $schedule['c_member_id'], date("Y-m-d", $tmp), date("Y-m-d", $tmp), $begin_time, $finish_time, $requests['sc_memo'], $rp_rule, $first_id, $requests['biz_group_id'], $requests['public_flag'], $requests['sc_j_mem']); } } $schedule_id = biz_getScheduleMax(); } $week = date("W", abs(strtotime($begin_date) - strtotime(date("Y-m-d")))) - 1; $p = array('w' => $week, 'msg' => '予定を編集しました。', 'id' => $schedule_id, 'target_id' => $target_id); openpne_redirect('biz', 'page_fh_biz_schedule_view', $p); }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; $tail = $GLOBALS['KTAI_URL_TAIL']; if (!$requests['target_id']) { $requests['target_id'] = $u; } $requests['sc_b_year'] = $requests['sc_b_year'] + 2000; $biz_schedule_member = array(); if ($requests['sc_j_mem'] == 'my') { $biz_schedule_member = array($requests['target_id']); } if (!checkdate($requests['sc_b_month'], $requests['sc_b_date'], $requests['sc_b_year'])) { $redirect_script = '?m=ktai_biz&a=page_fh_biz_schedule_add&' . $tail; $msg = '存在しない予定が入力されました。'; $url = $redirect_script . '&msg=' . $msg . '&title=' . $requests['sc_title'] . '&sc_rp=' . $requests['sc_rp'] . '&sc_memo=' . $requests['sc_memo'] . '&biz_group_id=' . serialize($requests['biz_group_id']) . '&sc_rwk_enc=' . serialize($requests['sc_rwk_enc']) . '&sc_rcount=' . $requests['sc_rcount'] . '&target_id=' . $requests['target_id']; $_REQUEST['sc_title'] = $requests['sc_title']; $_REQUEST['sc_rp'] = $requests['sc_rp']; $_REQUEST['sc_memo'] = $requests['sc_memo']; $_REQUEST['biz_group_id'] = serialize($requests['biz_group_id']); $_REQUEST['sc_rwk_enc'] = serialize($requests['sc_rwk_enc']); $_REQUEST['sc_rcount'] = $requests['sc_rcount']; $_REQUEST['target_id'] = $requests['target_id']; $_REQUEST['msg'] = '存在しない予定が入力されました。'; openpne_forward('ktai_biz', 'page', "fh_biz_schedule_add"); exit; } //--------------------- //ERROR---------------- if (empty($requests['sc_title'])) { $redirect_script = '?m=ktai_biz&a=page_fh_biz_schedule_add&' . $tail; $msg = 'タイトルを入力してください。'; $begin_date = $requests['sc_b_year'] . '-' . $requests['sc_b_month'] . '-' . $requests['sc_b_date']; $begin_time = $requests['sc_b_hour'] . ':' . $requests['sc_b_minute']; $finish_time = $requests['sc_f_hour'] . ':' . $requests['sc_f_minute']; $url = $redirect_script . '&msg=' . $msg . '&begin_date=' . $begin_date . '&begin_time=' . $begin_time . '&finish_time=' . $finish_time . '&sc_rp=' . $requests['sc_rp'] . '&sc_memo=' . $requests['sc_memo'] . '&biz_group_id=' . serialize($requests['biz_group_id']) . '&sc_rwk_enc=' . serialize($requests['sc_rwk_enc']) . '&sc_rcount=' . $requests['sc_rcount'] . '&target_id=' . $requests['target_id']; $_REQUEST['begin_date'] = $begin_date; $_REQUEST['begin_time'] = $begin_time; $_REQUEST['finish_time'] = $finish_time; $_REQUEST['sc_rp'] = $requests['sc_rp']; $_REQUEST['sc_memo'] = $requests['sc_memo']; $_REQUEST['biz_group_id'] = serialize($requests['biz_group_id']); $_REQUEST['sc_rwk_enc'] = serialize($requests['sc_rwk_enc']); $_REQUEST['sc_rcount'] = $requests['sc_rcount']; $_REQUEST['target_id'] = $requests['target_id']; $_REQUEST['msg'] = 'タイトルを入力してください。'; openpne_forward('ktai_biz', 'page', "fh_biz_schedule_add"); exit; } //--------------------- $begin_date = $requests['sc_b_year'] . '-' . $requests['sc_b_month'] . '-' . $requests['sc_b_date']; $begin_time = $requests['sc_b_hour'] . ':' . $requests['sc_b_minute']; $finish_time = $requests['sc_f_hour'] . ':' . $requests['sc_f_minute']; //ERROR--------------- if (strtotime($finish_time) < strtotime($begin_time) && $finish_time != ':') { $redirect_script = '?m=ktai_biz&a=page_fh_biz_schedule_add&' . $tail; $msg = '終了時刻が開始時刻より先です。'; $begin_date = $requests['sc_b_year'] . '-' . $requests['sc_b_month'] . '-' . $requests['sc_b_date']; $begin_time = $requests['sc_b_hour'] . ':' . $requests['sc_b_minute']; $finish_time = $requests['sc_f_hour'] . ':' . $requests['sc_f_minute']; $url = $redirect_script . '&msg=' . $msg . '&begin_date=' . $begin_date . '&sc_title=' . $requests['sc_title'] . '&sc_rp=' . $requests['sc_rp'] . '&sc_memo=' . $requests['sc_memo'] . '&biz_group_id=' . serialize($requests['biz_group_id']) . '&sc_rwk_enc=' . serialize($requests['sc_rwk_enc']) . '&sc_rcount=' . $requests['sc_rcount'] . '&target_id=' . $requests['target_id']; $_REQUEST['begin_date'] = $begin_date; $_REQUEST['sc_title'] = $requests['sc_title']; $_REQUEST['sc_rp'] = $requests['sc_rp']; $_REQUEST['sc_memo'] = $requests['sc_memo']; $_REQUEST['biz_group_id'] = serialize($requests['biz_group_id']); $_REQUEST['sc_rwk_enc'] = serialize($requests['sc_rwk_enc']); $_REQUEST['sc_rcount'] = $requests['sc_rcount']; $_REQUEST['target_id'] = $requests['target_id']; $_REQUEST['msg'] = '終了時刻が開始時刻より先です。'; openpne_forward('ktai_biz', 'page', "fh_biz_schedule_add"); exit; } //-------------------- $finish_date = $begin_date; if (!($requests['sc_b_hour'] || $requests['sc_b_minute'] || $requests['sc_f_hour'] || $requests['sc_f_minute'])) { $begin_time = $finish_time = null; } elseif (!($requests['sc_f_hour'] || $requests['sc_f_minute'])) { $finish_time = null; } if (!$requests['sc_rp']) { biz_insertSchedule($requests['sc_title'], $u, $begin_date, $finish_date, $begin_time, $finish_time, $requests['sc_memo'], $rp_rule, 0, $requests['biz_group_id'], $requests['public_flag'], $biz_schedule_member); } else { $tmp = $begin_date; for ($i = 0; date("Ymd", strtotime($tmp)) < date("Ymd", strtotime($finish_date)); $i++) { $nowday = strtotime($requests['sc_b_year'] . '-' . $requests['sc_b_month'] . '-' . ($requests['sc_b_date'] + $i)); $tmp = date("Ymd", $nowday); if ($rp_rule & 1 << date("w", $nowday)) { biz_insertSchedule($requests['sc_title'], $u, $tmp, $tmp, $begin_time, $finish_time, $requests['sc_memo'], $rp_rule, $first_id, $requests['biz_group_id'], $requests['public_flag'], $biz_schedule_member); } } } $week = date("W", abs(strtotime($begin_date) - strtotime(date("Y-m-d")))) - 1; $target_id = $requests['target_id']; $_REQUEST['msg'] = '予定を追加しました。'; $_REQUEST['w'] = $week; $_REQUEST['target_id'] = $target_id; $_REQUEST['id'] = biz_getScheduleMax(); openpne_forward('ktai_biz', 'page', "fh_calendar_week"); exit; }