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

Changeset 2692


Ignore:
Timestamp:
May 7, 2007, 8:09:35 PM (12 years ago)
Author:
ebihara
Message:

#690:日記一覧でカテゴリ指定すると、ページャが使われず全件表示されてしまっていたのを修正

Location:
OpenPNE/branches/2.8.x/webapp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/2.8.x/webapp/lib/db/diary.php

    r2641 r2692  
    6464 * カテゴリIDから日記を得る
    6565 *
     66 * @param int $c_member_id
    6667 * @param int $c_diary_category_id
     68 * @param int $u
     69 * @param int $page_size
     70 * @param int $page
    6771 * @return array
    6872 */
    69 function db_diary_list4c_diary_category_id($c_member_id, $c_diary_category_id, $u = null)
     73function db_diary_list4c_diary_category_id($c_member_id, $c_diary_category_id, $u = null, $page_size = 20, $page = 0)
    7074{
    7175    $sql = 'SELECT c_diary_id FROM c_diary_category_diary WHERE c_diary_category_id = ?';
     
    7478
    7579    $pf_cond = db_diary_public_flag_condition($c_member_id, $u);
    76     $sql = 'SELECT * FROM c_diary' .
    77         ' WHERE c_diary_id IN ('.$ids.') AND c_member_id = ? ' . $pf_cond . ' ORDER BY r_datetime DESC';
    78     $list = db_get_all($sql, array($c_member_id));
     80    $where = ' WHERE c_diary_id IN ('.$ids.') AND c_member_id = ? ' . $pf_cond . ' ORDER BY r_datetime DESC';
     81    $sql = 'SELECT * FROM c_diary' . $where;
     82    $params = array($c_member_id);
     83    $list = db_get_all_limit($sql, $page_size * ($page - 1), $page_size, $params);
    7984
    8085    foreach ($list as $key => $c_diary) {
     
    8287    }
    8388
    84     return array($list, false, false);
     89    $sql = 'SELECT COUNT(*) FROM c_diary' . $where;
     90    $total_num = db_get_one($sql, $params);
     91
     92    if ($total_num != 0) {
     93        $total_page_num =  ceil($total_num / $page_size);
     94        if ($page >= $total_page_num) {
     95            $next = false;
     96        } else {
     97            $next = true;
     98        }
     99        if ($page <= 1) {
     100            $prev = false;
     101        } else {
     102            $prev = true;
     103        }
     104    }
     105
     106    return array($list, $prev, $next, $total_num);
    85107}
    86108
  • OpenPNE/branches/2.8.x/webapp/modules/pc/page/fh_diary_list.php

    r1856 r2692  
    5858            $year = date('Y');
    5959            $month = date('n');
    60             $list_set = db_diary_list4c_diary_category_id($target_c_member_id, $category_id, $u);
     60            $list_set = db_diary_list4c_diary_category_id($target_c_member_id, $category_id, $u, $page_size, $page);
    6161            $this->set('category_name', db_diary_get_category_name4category_id($category_id));
     62            $this->set('category_id', $category_id);
    6263        } else {
    6364            $year = date('Y');
  • OpenPNE/branches/2.8.x/webapp/modules/pc/templates/fh_diary_list.tpl

    r2536 r2692  
    413413
    414414({if $is_prev})
    415 <a href="({t_url m=pc a=page_fh_diary_list})&amp;target_c_member_id=({$target_member.c_member_id})&amp;direc=-1&amp;page=({$page})({if $url_keyword})&amp;keyword=({$url_keyword})({/if})({if !$all})({if $date_val.year})&amp;year=({$date_val.year})({/if})({if $date_val.month})&amp;month=({$date_val.month})({/if})({if $date_val.day})&amp;day=({$date_val.day})({/if})({/if})">前を表示</a>
     415<a href="({t_url m=pc a=page_fh_diary_list})&amp;target_c_member_id=({$target_member.c_member_id})&amp;direc=-1&amp;page=({$page})({if $url_keyword})&amp;keyword=({$url_keyword})({/if})({if $category_id})&amp;category_id=({$category_id})({elseif !$all})({if $date_val.year})&amp;year=({$date_val.year})({/if})({if $date_val.month})&amp;month=({$date_val.month})({/if})({if $date_val.day})&amp;day=({$date_val.day})({/if})({/if})">前を表示</a>
    416416({/if})
    417417({$total_num})件中
     
    424424件を表示
    425425({if $is_next})
    426 <a href="({t_url m=pc a=page_fh_diary_list})&amp;target_c_member_id=({$target_member.c_member_id})&amp;direc=1&amp;page=({$page})({if $url_keyword})&amp;keyword=({$url_keyword})({/if})({if !$all})({if $date_val.year})&amp;year=({$date_val.year})({/if})({if $date_val.month})&amp;month=({$date_val.month})({/if})({if $date_val.day})&amp;day=({$date_val.day})({/if})({/if})">次を表示</a>
     426<a href="({t_url m=pc a=page_fh_diary_list})&amp;target_c_member_id=({$target_member.c_member_id})&amp;direc=1&amp;page=({$page})({if $url_keyword})&amp;keyword=({$url_keyword})({/if})({if $category_id})&amp;category_id=({$category_id})({elseif !$all})({if $date_val.year})&amp;year=({$date_val.year})({/if})({if $date_val.month})&amp;month=({$date_val.month})({/if})({if $date_val.day})&amp;day=({$date_val.day})({/if})({/if})">次を表示</a>
    427427({/if})
    428428
     
    566566
    567567({if $is_prev})
    568 <a href="({t_url m=pc a=page_fh_diary_list})&amp;target_c_member_id=({$target_member.c_member_id})&amp;direc=-1&amp;page=({$page})({if $url_keyword})&amp;keyword=({$url_keyword})({/if})({if !$all})({if $date_val.year})&amp;year=({$date_val.year})({/if})({if $date_val.month})&amp;month=({$date_val.month})({/if})({if $date_val.day})&amp;day=({$date_val.day})({/if})({/if})">前を表示</a>
     568<a href="({t_url m=pc a=page_fh_diary_list})&amp;target_c_member_id=({$target_member.c_member_id})&amp;direc=-1&amp;page=({$page})({if $url_keyword})&amp;keyword=({$url_keyword})({/if})({if $category_id})&amp;category_id=({$category_id})({elseif !$all})({if $date_val.year})&amp;year=({$date_val.year})({/if})({if $date_val.month})&amp;month=({$date_val.month})({/if})({if $date_val.day})&amp;day=({$date_val.day})({/if})({/if})">前を表示</a>
    569569({/if})
    570570({$total_num})件中
     
    577577件を表示
    578578({if $is_next})
    579 <a href="({t_url m=pc a=page_fh_diary_list})&amp;target_c_member_id=({$target_member.c_member_id})&amp;direc=1&amp;page=({$page})({if $url_keyword})&amp;keyword=({$url_keyword})({/if})({if !$all})({if $date_val.year})&amp;year=({$date_val.year})({/if})({if $date_val.month})&amp;month=({$date_val.month})({/if})({if $date_val.day})&amp;day=({$date_val.day})({/if})({/if})">次を表示</a>
     579<a href="({t_url m=pc a=page_fh_diary_list})&amp;target_c_member_id=({$target_member.c_member_id})&amp;direc=1&amp;page=({$page})({if $url_keyword})&amp;keyword=({$url_keyword})({/if})({if $category_id})&amp;category_id=({$category_id})({elseif !$all})({if $date_val.year})&amp;year=({$date_val.year})({/if})({if $date_val.month})&amp;month=({$date_val.month})({/if})({if $date_val.day})&amp;day=({$date_val.day})({/if})({/if})">次を表示</a>
    580580({/if})
    581581
Note: See TracChangeset for help on using the changeset viewer.