function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     $this->set('tail', $GLOBALS['KTAI_URL_TAIL']);
     $target_biz_todo_id = $requests['target_biz_todo_id'];
     if (!biz_isPermissionTodo($u, $target_biz_todo_id)) {
         handle_kengen_error();
     }
     $this->set("target_biz_todo_id", $requests['target_biz_todo_id']);
     $todo = biz_getTodo($requests['target_biz_todo_id']);
     if (!strncmp($todo['due_datetime'], '0000', 4)) {
         $todo['due_datetime'] = null;
     }
     $this->set("todo", $todo);
     if (empty($requests['target_c_member_id']) || $requests['target_c_member_id'] == $u) {
         //自分
         $target_c_member_id = $u;
         $this->set('is_h', true);
         //判別フラグ
     } else {
         //他人
         $target_c_member_id = $requests['target_c_member_id'];
         $this->set('is_f', true);
         //判別フラグ
     }
     $this->set('target_c_member_id', $target_c_member_id);
     return 'success';
 }
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     $sessid = session_id();
     $this->set("id", $requests['id']);
     $this->set("todo", biz_getTodo($requests['id']));
     $this->set("cmd", 'h');
     $this->set('inc_navi', fetch_inc_navi('h'));
     return 'success';
 }
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $delid = $requests['delid'];
     $id = $requests['target_id'];
     // ----------
     if (!biz_isPermissionTodo($u, $delid)) {
         handle_kengen_error();
     }
     biz_deleteTodo($delid);
     $todo = biz_getTodo($delid);
     $p = array('target_c_member_id' => $id);
     openpne_redirect('pc', 'page_f_home', $p);
 }
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     $sessid = session_id();
     if (!biz_isPermissionTodo($u, $requests['id'])) {
         handle_kengen_error();
     }
     $this->set("id", $requests['id']);
     $todo = biz_getTodo($requests['id']);
     $this->set("todo", $todo);
     if (empty($requests['target_id']) || $requests['target_id'] == $u) {
         //自分自身
         $target_id = $u;
         $this->set('is_h', true);
         //判別フラグ
         $this->set("cmd", 'h');
         $this->set('inc_navi', fetch_inc_navi('h'));
     } else {
         //他人
         $target_id = $requests['target_id'];
         $this->set('is_f', true);
         //判別フラグ
         $this->set("cmd", 'f');
         $this->set('inc_navi', fetch_inc_navi('f'));
     }
     $year_list = array();
     $curr_year = date('Y');
     $year_list[$curr_year] = $curr_year;
     $year_list[$curr_year + 1] = $curr_year + 1;
     $this->set('year_list', $year_list);
     $month_list = array();
     for ($i = 1; $i <= 12; $i++) {
         $month_list[$i] = $i;
     }
     $this->set('month_list', $month_list);
     $day_list = array();
     for ($i = 1; $i <= 31; $i++) {
         $day_list[$i] = $i;
     }
     $this->set('day_list', $day_list);
     $this->set("target_id", $target_id);
     $biz_group_count = biz_getGroupCount($target_id);
     $biz_group_list = biz_getJoinGroupList($target_id, 1, $biz_group_count);
     $this->set('biz_group_list', $biz_group_list[0]);
     $todo_date = explode('-', substr($todo['due_datetime'], 0, 10));
     $this->set('todo_date', $todo_date);
     return 'success';
 }
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $id = $requests['id'];
     $is_check = $requests['is_check'];
     $writer_name = $requests['writer_name'];
     $sort_order = $requests['sort_order'];
     $writer_id = $requests['writer_id'];
     $memo = $requests['memo'];
     $is_done = $requests['is_done'];
     $due_year = $requests['due_year'];
     $due_month = $requests['due_month'];
     $due_day = $requests['due_day'];
     $priority = $requests['priority'];
     $biz_group_id = $requests['biz_group_id'];
     $public_flag = $requests['public_flag'];
     // ----------
     if (!biz_isPermissionTodo($u, $id)) {
         handle_kengen_error();
     }
     if (empty($memo)) {
         $_REQUEST['msg'] = 'Todoの内容を入力してください';
         openpne_forward('biz', 'page', 'fh_home_edit_biz_todo');
         exit;
     }
     if (!$biz_group_id && $public_flag == 'group') {
         $_REQUEST['msg'] = '「グループまで公開」Todoの場合はグループを指定してください';
         openpne_forward('biz', 'page', 'fh_home_edit_biz_todo');
         exit;
     }
     if ($is_check && $public_flag == 'private') {
         $_REQUEST['msg'] = '公開範囲が「公開しない」のTodoは共有できません';
         openpne_forward('biz', 'page', 'fh_home_edit_biz_todo');
         exit;
     }
     $member_info = db_member_c_member4c_member_id_LIGHT($writer_id);
     $todo_info = biz_getTodo($id);
     $due_datetime = $due_year . '-' . $due_month . '-' . $due_day . ' 00:00:00';
     if (!$todo_info['c_member_id'] && !$is_check) {
         $todo_info['c_member_id'] = $writer_id;
     }
     biz_editTodo($todo_info['c_member_id'], $memo, $writer_id, $sort_order, $is_check, $id, $is_done, $due_datetime, $priority, $biz_group_id, $public_flag);
     openpne_redirect('pc', 'page_h_home');
 }
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     // --- リクエスト変数
     $target_biz_todo_id = $requests['target_biz_todo_id'];
     $target_c_member_id = $requests['target_c_member_id'];
     $value = $requests['value'];
     $due_datetime_y = $requests['due_datetime_y'];
     $due_datetime_m = $requests['due_datetime_m'];
     $due_datetime_d = $requests['due_datetime_d'];
     // ----------
     if (!biz_isPermissionTodo($u, $target_biz_todo_id)) {
         handle_kengen_error();
     }
     if (empty($value)) {
         $p = array('target_biz_todo_id' => $target_biz_todo_id, 'msg' => 1);
         ktai_biz_openpne_redirect('ktai_biz', 'page_fh_biz_todo_edit', $p);
     }
     if ($due_datetime_y && $due_datetime_m && $due_datetime_d) {
         $due_datetime = $due_datetime_y . '-' . $due_datetime_m . '-' . $due_datetime_d . ' 00:00:00';
     } else {
         $due_datetime = '0000-00-00 00:00:00';
     }
     if (is_null($target_c_member_id)) {
         $target_c_member_id = $u;
     }
     $todo = biz_getTodo($target_biz_todo_id);
     $is_all = $todo['is_all'];
     $is_done = $todo['is_check'];
     $priority = $todo['priority'];
     $biz_group_id = $todo['biz_group_id'];
     $public_flag = $todo['public_flag'];
     biz_editTodo($target_c_member_id, $value, $u, 0, $is_all, $target_biz_todo_id, $is_done, $due_datetime, $priority, $biz_group_id, $public_flag);
     $p = array('target_c_member_id' => $target_c_member_id);
     ktai_biz_openpne_redirect('ktai_biz', 'page_fh_biz_todo_list', $p);
 }
function biz_editTodo($member_id, $memo, $writer_id, $sort_order, $is_all, $biz_todo_id, $is_done, $due_datetime, $priority, $biz_group_id, $public_flag)
{
    $todo = biz_getTodo($biz_todo_id);
    if ($is_all) {
        //共有Todo
        $member_id = 0;
    } elseif ($member_id == $writer_id) {
        $writer_name = '';
    }
    if ($is_done != $todo['is_check']) {
        biz_checkTodo($biz_todo_id, $todo['is_check']);
    }
    $sql = 'UPDATE biz_todo SET c_member_id = ?, memo = ?, writer_id = ?,' . 'r_datetime = ?, due_datetime = ?, priority = ?, biz_group_id = ?,' . 'public_flag = ? WHERE biz_todo_id = ?';
    $params = array(intval($member_id), db_ktai_delete_url_session_parameter($memo), intval($writer_id), date("Y-m-d H:i"), $due_datetime, intval($priority), intval($biz_group_id), $public_flag, intval($biz_todo_id));
    $result = db_query($sql, $params);
    return $result;
}