Exemplo n.º 1
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $this->set("list", biz_getShisetsuList());
     //カレンダー表示用
     require_once 'Calendar/Week.php';
     $w = intval($_REQUEST['w']);
     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;
     $schedule = array();
     while ($Day = $Week->fetch()) {
         $y = sprintf("%02d", $Day->thisYear());
         $m = sprintf("%02d", $Day->thisMonth());
         $d = sprintf("%02d", $Day->thisDay());
         $schedule = biz_getShisetsuSchedule($y, $m, $d);
         $item = array('year' => $y, 'month' => $m, 'day' => $d, 'dayofweek' => $dayofweek[$i++], 'now' => false, 'schedule' => $schedule);
         if ($w == 0 && $d == date('d')) {
             $item['now'] = true;
         }
         $calendar[] = $item;
     }
     $list = biz_getShisetsuList();
     $calendar = '';
     foreach ($list as $key => $value) {
         $calendar .= biz_getScheduleWeek($u, $value['biz_shisetsu_id'], $requests['w'], 's_list', true, true, true);
     }
     $this->set('calendar', $calendar);
     $hours = biz_makeSerialArray(23);
     //時
     $this->set("hours", $hours);
     $config = biz_getConfig();
     $this->set('inc_navi', fetch_inc_navi('h'));
     $this->set('is_closed_shisetsu', $config['IS_CLOSED_SHISETSU']);
     return 'success';
 }
Exemplo n.º 2
0
function biz_getScheduleWeek($u, $member_id, $w, $cmd, $head = true, $value = true, $foot = true, $member_info = false, $start_day = 0)
{
    $inc_smarty = new OpenPNE_Smarty($GLOBALS['SMARTY']);
    $inc_smarty->assign("PHPSESSID", md5(session_id()));
    $inc_smarty->templates_dir = 'biz/templates';
    $inc_smarty->assign("cmd", $cmd);
    //操作の対象ページ
    $inc_smarty->assign("target_id", $member_id);
    //予定参加者
    require_once 'Calendar/Week.php';
    $w = intval($w);
    if (empty($w)) {
        $w = 0;
    }
    $inc_smarty->assign('w', $w);
    $time = strtotime($w . " week");
    $Week = new Calendar_Week(date('Y', $time), date('m', $time), date('d', $time), $start_day);
    $Week->build();
    $calendar = array();
    $dayofweek = array('日', '月', '火', '水', '木', '金', '土');
    $i = $start_day;
    $dayofweek = array_merge($dayofweek, array_slice($dayofweek, 0, $start_day + 1));
    $schedule = array();
    while ($Day = $Week->fetch()) {
        $y = sprintf("%02d", $Day->thisYear());
        $m = sprintf("%02d", $Day->thisMonth());
        $d = sprintf("%02d", $Day->thisDay());
        $m_disp = sprintf("%2d", $Day->thisMonth());
        $d_disp = sprintf("%2d", $Day->thisDay());
        if ($cmd != 's_list') {
            $schedule = biz_getDateMemberSchedule($y, $m, $d, $member_id, $u);
            $banner = biz_isBannerSchedule($y, $m, $d, $member_id);
            if (!empty($banner)) {
                foreach ($banner as $value) {
                    array_push($schedule, $value);
                }
            }
        } else {
            $schedule = biz_getShisetsuSchedule($y, $m, $d, $member_id);
        }
        $item = array('year' => $y, 'month' => $m, 'day' => $d, 'month_disp' => $m_disp, 'day_disp' => $d_disp, 'dayofweek' => $dayofweek[$i++], 'now' => false, 'birth' => db_member_birth4c_member_id($m, $d, $member_id), 'event' => db_commu_event4c_member_id($y, $m, $d, $member_id), 'schedule' => $schedule, 'todo' => biz_schedule_todo4c_member_id($u, $member_id, $y, $m, $d), 'holiday' => db_c_holiday_list4date($m, $d));
        if ($w == 0 && $d == date('d')) {
            $item['now'] = true;
        }
        $calendar[] = $item;
    }
    $daylist = $calendar;
    //コピー
    for ($i = 1; $i <= 2; $i++) {
        $j = $start_day;
        //曜日ポインタを示す
        $time = strtotime($w + $i . " week");
        $Week = new Calendar_Week(date('Y', $time), date('m', $time), date('d', $time), $start_day);
        $Week->build();
        while ($Day = $Week->fetch()) {
            $y = sprintf("%02d", $Day->thisYear());
            $m = sprintf("%02d", $Day->thisMonth());
            $d = sprintf("%02d", $Day->thisDay());
            $item = array('year' => $y, 'month' => $m, 'day' => $d, 'dayofweek' => $dayofweek[$j++]);
            $daylist[] = $item;
        }
    }
    $inc_smarty->assign("daylist", $daylist);
    if ($cmd == 's_list') {
        $hours = biz_makeSerialArray(23);
        //時
        $inc_smarty->assign("hours", $hours);
        $mins = biz_makeSerialArray(300, 30, 30);
        //分
        $inc_smarty->assign("mins", $mins);
        $inc_smarty->assign("list", biz_getShisetsuData($member_id));
        $config = biz_getConfig();
        $inc_smarty->assign('is_closed_shisetsu', $config['IS_CLOSED_SHISETSU']);
    }
    $inc_smarty->assign('calendar', $calendar);
    $inc_smarty->assign('head', $head);
    $inc_smarty->assign('value', $value);
    $inc_smarty->assign('foot', $foot);
    if ($member_info) {
        $inc_smarty->assign('member_info', $member_info);
    }
    if ($cmd == 'h') {
        if (OPENPNE_USE_POINT_RANK) {
            // ポイント
            $point = db_point_get_point($member_id);
            $inc_smarty->assign("point", $point);
            // ランク
            $inc_smarty->assign("rank", db_point_get_rank4point($point));
        }
    }
    $content = $inc_smarty->fetch('file:' . OPENPNE_MODULES_BIZ_DIR . '/biz/templates/inc_biz_schedule_week.tpl');
    return $content;
}
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     if (!biz_isPermissionSchedule($u, $requests['schedule_id'])) {
         handle_kengen_error();
     }
     $form_val['subject'] = $requests['subject'];
     $form_val['body'] = $requests['body'];
     $this->set('banner', $requests['sc_bn']);
     if ($requests['sc_title']) {
         $requests['title'] = $requests['sc_title'];
     }
     if ($requests['sc_memo']) {
         $requests['value'] = $requests['sc_memo'];
     }
     if ($requests['sc_b_year'] && $requests['sc_b_month'] && $requests['sc_b_date']) {
         $requests['begin_date'] = $requests['sc_b_year'] . '-' . $requests['sc_b_month'] . '-' . $requests['sc_b_date'];
     }
     if ($requests['sc_b_hour'] && $requests['sc_b_minute']) {
         $requests['begin_time'] = $requests['sc_b_hour'] . ':' . $requests['sc_b_minute'];
     }
     if ($requests['sc_f_hour'] && $requests['sc_f_minute']) {
         $requests['finish_time'] = $requests['sc_f_hour'] . ':' . $requests['sc_f_minute'];
     }
     $sessid = session_id();
     $schedule = biz_getScheduleInfo($requests['schedule_id']);
     if ($schedule['c_member_id'] == $u) {
         //自分自身
         $target_id = $u;
         $this->set('is_h', true);
         //判別フラグ
         $this->set('inc_navi', fetch_inc_navi('h'));
     } else {
         //他人
         $target_id = $requests['target_id'];
         $this->set('is_f', true);
         //判別フラグ
         $this->set('inc_navi', fetch_inc_navi('f'));
     }
     //プロフィール
     $this->set("target_member", db_member_c_member4c_member_id($u));
     $this->set("form_val", $form_val);
     //カレンダー関係
     //カレンダー開始用変数
     $year = date("Y");
     $month = date("n");
     //カレンダー用変数
     $date_val = array('year' => $year, 'month' => $month, 'day' => null);
     $this->set("date_val", $date_val);
     //日記のカレンダー
     $calendar = db_common_diary_monthly_calendar($year, $month, $u);
     $this->set("calendar", $calendar['days']);
     $this->set("ym", $calendar['ym']);
     //日付関連
     if ($requests['rep_type']) {
         $begin_date = biz_getRepeatBegin($requests['schedule_id']);
     } else {
         $begin_date = $requests['begin_date'];
     }
     $nowyear = date("Y", strtotime($begin_date));
     $nowmonth = date("m", strtotime($begin_date));
     $nowday = date("d", strtotime($begin_date));
     for ($i = $nowyear; $i <= $nowyear + 10; $i++) {
         if ($i == $nowyear) {
             $years = '<option value="' . $i . '" selected="selected">';
         } else {
             $years .= '<option value="' . $i . '">';
         }
         $years .= $i . '年';
         $years .= '</option>';
     }
     for ($i = 1; $i <= 12; $i++) {
         $i_f = sprintf("%02d", $i);
         //月は常に二桁
         if ($i == $nowmonth) {
             $monthes .= '<option value="' . $i_f . '" selected="selected">';
         } else {
             $monthes .= '<option value="' . $i_f . '">';
         }
         $monthes .= $i . '月';
         $monthes .= '</option>';
     }
     for ($i = 1; $i <= 31; $i++) {
         $i_f = sprintf("%02d", $i);
         //日は常に二桁
         if ($i == $nowday) {
             $days .= '<option value="' . $i_f . '" selected="selected">';
         } else {
             $days .= '<option value="' . $i_f . '">';
         }
         $days .= $i . '日';
         $days .= '</option>';
     }
     $hours = biz_makeSerialArray(23);
     //時
     $mins = biz_makeSerialArray(55, 0, 5);
     //分
     $wk = array('日', '月', '火', '水', '木', '金', '土');
     //週
     $rp_count = biz_makeSerialArray(12, 1);
     //繰り返し回数
     $bn_num = biz_makeSerialArray(31, 1);
     //日数
     $this->set('years', $years);
     $this->set('monthes', $monthes);
     $this->set('days', $days);
     $this->set('hours', $hours);
     $this->set('mins', $mins);
     $this->set('wk', $wk);
     $this->set('rp_count', $rp_count);
     $this->set('bn_num', $bn_num);
     $this->set('title', $requests['title']);
     $this->set('value', $requests['value']);
     if (!is_null($requests['begin_time'])) {
         $this->set('begin_hour', date("G", strtotime($requests['begin_time'])));
     }
     if (!is_null($requests['begin_time'])) {
         $begin_min = date("i", strtotime($requests['begin_time']));
         if (substr($begin_min, 0, 1) == '0') {
             $begin_min = substr($begin_min, 1, 1);
         }
     }
     if (!is_null($requests['begin_time'])) {
         $this->set('begin_min', $begin_min);
     }
     if (!is_null($requests['finish_time'])) {
         $this->set('finish_hour', date("G", strtotime($requests['finish_time'])));
     } else {
         $this->set('finish_hour', null);
     }
     if (!is_null($requests['finish_time'])) {
         $finish_min = date("i", strtotime($requests['finish_time']));
     }
     if (substr($finish_min, 0, 1) == '0') {
         $finish_min = substr($finish_min, 1, 1);
     }
     if (!is_null($requests['begin_time'])) {
         $this->set('finish_min', $finish_min);
     } else {
         $this->set('finish_min', null);
     }
     if ($requests['rep_type']) {
         $is_rep = true;
     } else {
         if ($requests['sc_rp']) {
             $is_rep = true;
         } else {
             $is_rep = false;
         }
     }
     $dayofweek = array();
     if (empty($requests['rep_type'])) {
         foreach ($requests['sc_rwk'] as $value) {
             $rp_rule += 1 << $value;
         }
         $requests['rep_type'] = $rp_rule;
     }
     for ($i = 0; $i <= 6; $i++) {
         if ($requests['rep_type'] & 1 << $i) {
             array_push($dayofweek, 1);
         } else {
             array_push($dayofweek, 0);
         }
     }
     $this->set('rep_type', $dayofweek);
     $this->set('is_rep', $is_rep);
     $this->set('schedule_id', $requests['schedule_id']);
     $repeat_begin = biz_getRepeatBegin($requests['schedule_id']);
     $repeat_finish = biz_getRepeatFinish($requests['schedule_id']);
     $repeat_term = strtotime($repeat_finish) - strtotime($repeat_begin);
     $daycount = $repeat_term / (24 * 60 * 60) / 6;
     $this->set('repeat_begin_date', $repeat_begin);
     if (isset($requests["sc_rcount"])) {
         $daycount = $requests["sc_rcount"];
     }
     $this->set('repeat_term', ceil($daycount));
     $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]);
     $this->set('target_biz_group_id', $schedule['biz_group_id']);
     if ($requests['public_flag']) {
         $this->set('public_flag', $requests['public_flag']);
     } else {
         $this->set('public_flag', $schedule['public_flag']);
     }
     //追加
     if ($requests['members']) {
         $j_members = array_keys(unserialize($requests['members']));
         sort($j_members);
     } elseif ($requests['sc_j_mem']) {
         $j_members = $requests['sc_j_mem'];
     } else {
         $j_members = biz_getJoinMemberSchedule($requests['schedule_id']);
     }
     $this->set('j_members', $j_members);
     $members = array();
     $sql = 'SELECT c_member_id, nickname FROM c_member';
     $members = db_get_all($sql, $params);
     $i = 0;
     foreach ($members as $key => $value) {
         if (in_array($value['c_member_id'], $j_members)) {
             $members[$key]['checkflag'] = 1;
             $i++;
         }
         if (count($j_members) < $i) {
             break;
         }
     }
     $this->set('members', $members);
     return 'success';
 }
Exemplo n.º 4
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     $form_val['subject'] = $requests['subject'];
     $form_val['body'] = $requests['body'];
     $form_val['biz_group_id'] = $requests['target_biz_group_id'];
     if (empty($requests['target_id']) || $requests['target_id'] == $u) {
         //自分自身
         $target_id = $u;
         $this->set('is_h', true);
         //判別フラグ
         $this->set('inc_navi', fetch_inc_navi('h'));
     } else {
         //他人
         $target_id = $requests['target_id'];
         $this->set('is_f', true);
         //判別フラグ
         $this->set('inc_navi', fetch_inc_navi('f'));
     }
     $sessid = session_id();
     $target_member = db_member_c_member4c_member_id($u);
     //プロフィール
     $this->set("target_member", $target_member);
     $this->set("form_val", $form_val);
     //カレンダー関係
     //カレンダー開始用変数
     $year = date("Y");
     $month = date("n");
     //カレンダー用変数
     $date_val = array('year' => $year, 'month' => $month, 'day' => null);
     $this->set("date_val", $date_val);
     //日記のカレンダー
     $calendar = db_common_diary_monthly_calendar($year, $month, $u);
     $this->set("calendar", $calendar['days']);
     $this->set("ym", $calendar['ym']);
     $this->set("begin_date", $begin_date);
     $this->set("finish_date", $finish_date);
     $this->set("sc_title", $requests['sc_title']);
     $this->set("sc_memo", $requests['sc_memo']);
     //日付関連
     if ($requests['begin_date']) {
         $nowyear = date("Y", strtotime($requests['begin_date']));
         $nowmonth = date("m", strtotime($requests['begin_date']));
         $nowday = date("d", strtotime($requests['begin_date']));
         if ($requests['begin_time']) {
             $this->set('begin_hour', date("H", strtotime($requests['begin_time'])));
             $this->set('begin_min', date("i", strtotime($requests['begin_time'])));
         }
         if ($requests['finish_time']) {
             $this->set('finish_hour', date("H", strtotime($requests['finish_time'])));
             $this->set('finish_min', date("i", strtotime($requests['finish_time'])));
         }
     } else {
         $nowyear = date("Y");
         $nowmonth = date("m");
         $nowday = date("d");
     }
     for ($i = $nowyear; $i <= $nowyear + 10; $i++) {
         if ($i == $nowyear) {
             //現在年をデフォルトに
             $years = '<option value="' . $i . '" selected="selected">';
         } else {
             $years .= '<option value="' . $i . '">';
         }
         $years .= $i . '年';
         $years .= '</option>';
     }
     for ($i = 1; $i <= 12; $i++) {
         $i_f = sprintf("%02d", $i);
         //月は常に二桁
         if ($i == $nowmonth) {
             //現在月をデフォルトに
             $monthes .= '<option value="' . $i_f . '" selected="selected">';
         } else {
             $monthes .= '<option value="' . $i_f . '">';
         }
         $monthes .= $i . '月';
         $monthes .= '</option>';
     }
     for ($i = 1; $i <= 31; $i++) {
         $i_f = sprintf("%02d", $i);
         //日は常に二桁
         if ($i == $nowday) {
             $days .= '<option value="' . $i_f . '" selected="selected">';
         } else {
             $days .= '<option value="' . $i_f . '">';
         }
         $days .= $i . '日';
         $days .= '</option>';
     }
     $hours = biz_makeSerialArray(23);
     //時
     $mins = biz_makeSerialArray(55, 0, 5);
     //分
     $wk = array('日', '月', '火', '水', '木', '金', '土');
     //週
     $rp_count = biz_makeSerialArray(12, 1);
     //繰り返し回数
     $bn_num = biz_makeSerialArray(31, 1);
     //日数
     $this->set('years', $years);
     $this->set('monthes', $monthes);
     $this->set('days', $days);
     $this->set('hours', $hours);
     $this->set('mins', $mins);
     $this->set('wk', $wk);
     $this->set('rp_count', $rp_count);
     $this->set('bn_num', $bn_num);
     $this->set('my_id', $u);
     $this->set('is_h', true);
     $this->set('sc_rcount', $requests["sc_rcount"]);
     $this->set('sc_bn', $requests["sc_bn"]);
     $this->set('sc_rp', $requests["sc_rp"]);
     $sc_rwk_enc = array();
     if (isset($requests['sc_rwk_enc'])) {
         $sc_rwk_enc = unserialize($requests['sc_rwk_enc']);
     }
     foreach ($wk as $key => $value) {
         if (in_array($key, $sc_rwk_enc)) {
             $sc_rwk_chk[$key]['checkflag'] = 1;
         } else {
             $sc_rwk_chk[$key]['chekflag'] = 0;
         }
     }
     $this->set('sc_rwk_chk', $sc_rwk_chk);
     $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]);
     $this->set('target_c_member_id', $target_id);
     // グループのメンバーリストを取得
     $biz_group_member_list = biz_getGroupMember($form_val['biz_group_id']);
     $biz_group_member_id_list = array();
     foreach ($biz_group_member_list as $biz_group_member) {
         $biz_group_member_id_list[] = $biz_group_member['c_member_id'];
     }
     //追加
     $members = array();
     $sql = 'SELECT c_member_id, nickname FROM c_member WHERE c_member_id != ' . $target_id;
     $members = db_get_all($sql);
     $sql = 'SELECT c_member_id, nickname FROM c_member WHERE c_member_id = ' . $target_id;
     $my_info = db_get_row($sql);
     array_unshift($members, $my_info);
     $members[0]['checkflag'] = 1;
     $jmembers = unserialize($requests['sc_j_mem_enc']);
     $i = 0;
     if (empty($jmembers)) {
         foreach ($members as $key => $value) {
             if (in_array($value['c_member_id'], $biz_group_member_id_list)) {
                 $members[$key]['checkflag'] = 1;
             }
         }
     } else {
         foreach ($members as $key => $value) {
             if ($jmembers[$i] == $value['c_member_id']) {
                 $members[$key]['checkflag'] = 1;
                 $i++;
             }
             if (count($jmembers) < $i) {
                 break;
             }
         }
     }
     $this->set('members', $members);
     return 'success';
 }