ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 3690


Ignore:
Timestamp:
Aug 10, 2007, 4:59:28 PM (12 years ago)
Author:
ogawa
Message:

#1020:トピック検索機能追加
trunkの変更をマージ

Location:
OpenPNE/branches/stable-2.8.x
Files:
10 edited
13 copied

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/stable-2.8.x/public_html/css/main/inc_search_box.css

    r2 r3690  
    1515
    1616td.inc_search_box table.search_bar img ,
    17 td.inc_search_box table.search_bar input {
     17td.inc_search_box table.search_bar input ,
     18td.inc_c_com_topic_find table.search_bar img ,
     19td.inc_c_com_topic_find table.search_bar input ,
     20td.inc_c_com_topic_find table.search_bar select {
    1821        vertical-align: middle;
    1922}
  • OpenPNE/branches/stable-2.8.x/webapp/lib/db/commu.php

    r3057 r3690  
    27822782}
    27832783
     2784/**
     2785 * トピック検索
     2786 */
     2787function db_commu_search_c_commu_topic(
     2788            $search_word,
     2789            $page_size,
     2790            $page,
     2791            $type = 'all',
     2792            $c_commu_id = 0)
     2793{
     2794    $select = 'SELECT c.name AS commu_name, c.image_filename AS commu_image'
     2795            . ', ct.*, ctc.r_datetime';
     2796    $from = ' FROM c_commu AS c, c_commu_topic AS ct, c_commu_topic_comment AS ctc';
     2797
     2798    $params = array();
     2799    $where = ' WHERE ct.c_commu_topic_id = ctc.c_commu_topic_id'
     2800           . ' AND c.c_commu_id = ct.c_commu_id';
     2801    if ($c_commu_id) {
     2802        $where .= ' AND ct.c_commu_id = ?';
     2803        $params[] = $c_commu_id;
     2804    } else {
     2805        $where .= " AND c.public_flag IN ('public', 'auth_sns')";
     2806    }
     2807    if ($search_word) {
     2808        $words = explode(' ', $search_word);
     2809        foreach ($words as $word) {
     2810            $word = check_search_word($word);
     2811
     2812            $where .= ' AND ((ct.name LIKE ?) OR (ctc.body LIKE ?))';
     2813            $params[] = '%'.$word.'%';
     2814            $params[] = '%'.$word.'%';
     2815        }
     2816    }
     2817    switch ($type) {
     2818    case 'topic':
     2819        $where .= ' AND event_flag = 0';
     2820        break;
     2821    case 'event':
     2822        $where .= ' AND event_flag = 1';
     2823        break;
     2824    case 'all':
     2825    default:
     2826        break;
     2827    }
     2828    $group = ' GROUP BY ct.c_commu_topic_id';
     2829    $order = ' ORDER BY ctc.r_datetime DESC';
     2830
     2831    $sql = $select . $from . $where . $group . $order;
     2832    $list = db_get_all_page($sql, $page, $page_size, $params);
     2833
     2834    foreach ($list as $key => $value) {
     2835        $p = array((int)$value['c_commu_topic_id']);
     2836        $sql = 'SELECT body FROM c_commu_topic_comment WHERE number = 0 AND c_commu_topic_id = ?';
     2837        $list[$key]['body'] = db_get_one($sql, $p);
     2838        $sql = 'SELECT MAX(number) FROM c_commu_topic_comment WHERE c_commu_topic_id = ?';
     2839        $list[$key]['max_number'] = db_get_one($sql, $p);
     2840        $sql = 'SELECT MAX(r_datetime) FROM c_commu_topic_comment WHERE c_commu_topic_id = ?';
     2841        $list[$key]['last_datetime'] = db_get_one($sql, $p);
     2842    }
     2843
     2844    $sql = 'SELECT COUNT(DISTINCT ct.c_commu_topic_id)' . $from . $where;
     2845    $total_num = db_get_one($sql, $params);
     2846
     2847    if ($total_num != 0) {
     2848        $total_page_num =  ceil($total_num / $page_size);
     2849        $next = ($page < $total_page_num);
     2850        $prev = ($page > 1);
     2851    }
     2852
     2853    $start_num = ($page - 1) * $page_size + 1;
     2854    $end_num   = $start_num + $page_size - 1 >= $total_num ? $total_num : $start_num + $page_size - 1;
     2855
     2856    return array($list, $prev, $next, $total_num, $start_num, $end_num);
     2857}
     2858
    27842859?>
  • OpenPNE/branches/stable-2.8.x/webapp/modules/ktai/templates/c_home.tpl

    r3530 r3690  
    4343({/if})
    4444◆<a href="({t_url m=ktai a=page_c_invite})&amp;target_c_commu_id=({$c_commu.c_commu_id})&amp;({$tail})">({$WORD_MY_FRIEND_HALF})に紹介</a><br>
     45<hr>
     46トピック検索
     47({t_form _method=get m=ktai a=page_c_com_topic_find})
     48<input type="hidden" name="ksid" value="({$PHPSESSID})">
     49<input type="text" name="keyword" value="({$search_word})">
     50<br>
     51<select name="target_commu">
     52<option value="in_commu">コミュニティ内</option>
     53<option value="all">全てのコミュニティ</option>
     54</select>
     55<input type="hidden" name="c_commu_id" value="({$c_commu.c_commu_id})">
     56<br>
     57<input type="submit" value="検索">
     58</form>
    4559<hr>
    4660<a name="news">新着リスト</a>
  • OpenPNE/branches/stable-2.8.x/webapp/modules/ktai/templates/h_com_find_all.tpl

    r2292 r3690  
    4242
    4343<hr>
    44 <a href="({t_url m=ktai a=page_h_com_add})&amp;({$tail})">コミュニティ作成</a>
     44<a href="({t_url m=ktai a=page_h_com_add})&amp;({$tail})">コミュニティ作成</a><br>
     45<a href="({t_url m=ktai a=page_h_com_topic_find_all})&amp;({$tail})">トピック検索</a>
    4546
    4647<hr>
  • OpenPNE/branches/stable-2.8.x/webapp/modules/pc/templates/c_event_detail.tpl

    r2918 r3690  
    11({ext_include file="inc_header.tpl"})
     2({ext_include file="inc_c_com_topic_find.tpl"})
    23({ext_include file="inc_layoutcolumn_top_720px.tpl"})
    34
  • OpenPNE/branches/stable-2.8.x/webapp/modules/pc/templates/c_event_list.tpl

    r1408 r3690  
    11({ext_include file="inc_header.tpl"})
     2({ext_include file="inc_c_com_topic_find.tpl"})
    23({ext_include file="inc_layoutcolumn_top_720px.tpl"})
    34
  • OpenPNE/branches/stable-2.8.x/webapp/modules/pc/templates/c_home.tpl

    r2662 r3690  
    11({ext_include file="inc_header.tpl"})
     2({ext_include file="inc_c_com_topic_find.tpl"})
    23({if !$is_c_commu_member})
    34<tr>
    4 <td class="container c_join_commu_box" align="center">
     5<td class="container inc_c_join_commu_box" align="center">
    56
    67<img src="./skin/dummy.gif" class="v_spacer_s">
  • OpenPNE/branches/stable-2.8.x/webapp/modules/pc/templates/c_topic_detail.tpl

    r2935 r3690  
    11({ext_include file="inc_header.tpl"})
     2({ext_include file="inc_c_com_topic_find.tpl"})
    23({ext_include file="inc_layoutcolumn_top_720px.tpl"})
    34({***************************})
  • OpenPNE/branches/stable-2.8.x/webapp/modules/pc/templates/c_topic_list.tpl

    r1408 r3690  
    11({ext_include file="inc_header.tpl"})
     2({ext_include file="inc_c_com_topic_find.tpl"})
    23({ext_include file="inc_layoutcolumn_top_720px.tpl"})
    34
  • OpenPNE/branches/stable-2.8.x/webapp/modules/pc/templates/h_com_find_all.tpl

    r2850 r3690  
    7777<!-- ここまで:主内容>>並び替え・カテゴリ・検索 -->
    7878
    79 <div style="text-align:right;padding:3px;">
     79<div style="text-align:left;padding:3px;padding-left:160px;">
    8080<img src="./skin/dummy.gif" class="icon arrow_1"><a href="({t_url m=pc a=page_h_com_add})">新規作成</a>&nbsp;(作成の前に、似たコミュニティがないかご確認ください)&nbsp;&nbsp;
     81</div>
     82
     83<div style="text-align:left;padding:3px;padding-left:160px;">
     84<img src="./skin/dummy.gif" class="icon arrow_1"><a href="({t_url m=pc a=page_h_com_topic_find_all})">トピック検索</a>
    8185</div>
    8286
Note: See TracChangeset for help on using the changeset viewer.