function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $page = $requests['page'];
     // ----------
     $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id);
     $c_commu_id = $c_topic['c_commu_id'];
     //--- 権限チェック
     if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) {
         handle_kengen_error();
     }
     //---
     $this->set('c_commu', db_commu_c_commu4c_commu_id($c_commu_id));
     $this->set('c_topic', $c_topic);
     $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id));
     $this->set('page', $page);
     $page_size = 50;
     $c_event_member_list = db_commu_c_event_member_list4c_commu_topic_id($c_commu_topic_id, $page, $page_size);
     $total_c_event_member = db_commu_count_c_event_member_list4c_commu_topic_id($c_commu_topic_id);
     $start_num = ($page - 1) * $page_size + 1;
     $end_num = $page * $page_size;
     if ($end_num > $total_c_event_member) {
         $end_num = $total_c_event_member;
     }
     $end_page = ceil($total_c_event_member / $page_size);
     for ($i = 1; $i <= $end_page; $i++) {
         $page_num[] = $i;
     }
     $this->set("page_num", $page_num);
     $this->set('c_event_member_list', $c_event_member_list);
     $this->set('total_c_event_member', $total_c_event_member);
     $this->set('is_prev', $start_num != 1);
     $this->set('is_next', $end_num != $total_c_event_member);
     $this->set('start_num', $start_num);
     $this->set('end_num', $end_num);
     return 'success';
 }
Example #2
0
function count_c_event_member_list4c_commu_topic_id($c_commu_topic_id)
{
    return db_commu_count_c_event_member_list4c_commu_topic_id($c_commu_topic_id);
}
 function execute($requests)
 {
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $body = $requests['body'];
     // ----------
     //--- 権限チェック
     //コミュニティ参加者
     $c_commu_topic = db_commu_c_commu_topic4c_commu_topic_id($target_c_commu_topic_id);
     if ($c_commu_topic['event_flag']) {
         $c_event_member_count = db_commu_count_c_event_member_list4c_commu_topic_id($target_c_commu_topic_id);
     }
     $c_commu_id = $c_commu_topic['c_commu_id'];
     $c_commu = db_commu_c_commu4c_commu_id($c_commu_topic['c_commu_id']);
     switch ($c_commu['is_comment']) {
         case 'public':
             //誰でもコメント可能
             break;
         case 'member':
             $status = db_common_commu_status($u, $c_commu_id);
             if (!$status['is_commu_member']) {
                 handle_kengen_error();
             }
             break;
     }
     //---
     if (is_null($body) || $body === '') {
         //bodyが無い時のエラー処理
         $p = array('target_c_commu_topic_id' => $target_c_commu_topic_id, 'msg' => 1);
         openpne_redirect('ktai', 'page_c_bbs', $p);
     }
     if ($requests['join_event'] || $requests['cancel_event']) {
         if (!db_commu_is_event_join_date($target_c_commu_topic_id)) {
             handle_kengen_error();
         }
     }
     $insert_id = db_commu_insert_c_commu_topic_comment_2($u, $target_c_commu_topic_id, $body);
     //イベントのメンバーに追加
     if ($requests['join_event']) {
         if ($c_commu_topic['capacity'] && $c_commu_topic['capacity'] <= $c_event_member_count) {
             $p = array('target_c_commu_topic_id' => $target_c_commu_topic_id, 'msg' => 45);
             openpne_redirect('ktai', 'page_c_bbs', $p);
         } else {
             db_commu_insert_c_event_member($target_c_commu_topic_id, $u);
         }
     } elseif ($requests['cancel_event']) {
         db_commu_delete_c_event_member($target_c_commu_topic_id, $u);
     }
     //お知らせメール送信(携帯へ)
     send_bbs_info_mail($insert_id, $u);
     //お知らせメール送信(PCへ)
     send_bbs_info_mail_pc($insert_id, $u);
     if (OPENPNE_USE_POINT_RANK) {
         //トピック・イベントにコメントした人にポイント付与
         $point = db_action_get_point4c_action_id(11);
         db_point_add_point($u, $point);
     }
     $p = array('target_c_commu_topic_id' => $target_c_commu_topic_id);
     openpne_redirect('ktai', 'page_c_bbs', $p);
 }
Example #4
0
function monitor_topic_list4target_c_commu_topic_id($c_commu_topic_id, $page_size, $page)
{
    $page = intval($page);
    $page_size = intval($page_size);
    $where = " where ct.c_commu_topic_id = ? ";
    $params[] = intval($c_commu_topic_id);
    if ($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['phptype'] == 'pgsql') {
        $select = "SELECT ct.*," . " ct.name AS topic_name,c.name AS commu_name," . " m.nickname,ctc.body AS body," . " ctc.image_filename1 AS image_filename1,ctc.image_filename2 AS image_filename2,ctc.image_filename3 AS image_filename3," . " ctc.filename AS filename,f.original_filename AS original_filename," . " CASE WHEN ct.invite_period = '0001-01-01 BC' THEN '0000-00-00' ELSE to_char(ct.invite_period,'YYYY-MM-DD') END AS invite_period";
    } else {
        $select = "SELECT ct.*," . " ct.name AS topic_name,c.name AS commu_name," . " m.nickname,ctc.body AS body," . " ctc.image_filename1 AS image_filename1,ctc.image_filename2 AS image_filename2,ctc.image_filename3 AS image_filename3," . " ctc.filename AS filename,f.original_filename AS original_filename";
    }
    $from = " FROM c_commu_topic AS ct" . " LEFT JOIN c_member AS m ON ct.c_member_id = m.c_member_id " . " LEFT JOIN c_commu AS c ON c.c_commu_id = ct.c_commu_id " . " LEFT JOIN c_commu_topic_comment AS ctc ON (ctc.c_commu_topic_id = ct.c_commu_topic_id AND ctc.number = 0)" . " LEFT JOIN c_file AS f ON f.filename = ctc.filename ";
    $order = " ORDER BY r_datetime desc";
    $sql = $select . $from . $where . $order;
    $list = db_get_all_limit($sql, ($page - 1) * $page_size, $page_size, $params);
    foreach ($list as $key => $value) {
        $list[$key]['count_comments'] = _db_count_c_commu_topic_comments4c_commu_topic_id($value['c_commu_topic_id']);
        if ($value['event_flag']) {
            $list[$key]['member_num'] = db_commu_count_c_event_member_list4c_commu_topic_id($value['c_commu_topic_id']);
        }
    }
    $sql = "SELECT count(*) " . $from . $where;
    $total_num = db_get_one($sql, $params);
    $total_page_num = ceil($total_num / $page_size);
    $next = $page < $total_page_num;
    $prev = $page > 1;
    return array($list, $prev, $next, $total_num, $total_page_num);
}