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

Changeset 6411


Ignore:
Timestamp:
Apr 8, 2008, 1:36:34 PM (13 years ago)
Author:
cybaron
Message:

h_homeに表示される最新アルバム一覧取得用関数追加
p_h_home_c_album_friend_list4c_member_id()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/work/asano/pne_album/webapp/lib/db/album.php

    r6362 r6411  
    223223}
    224224
    225 /*
    226 function p_fh_album_list_album_image_list4c_album_id($c_album_id, $page_size, $page)
    227 {
    228     $sql = 'SELECT * FROM c_album_image WHERE c_album_id = ?';
    229     $params = array(intval($c_album_id));
    230     $list = db_get_all_page($sql, $page, $page_size, $params);
    231 
    232    
    233     $sql = 'SELECT COUNT(*) FROM c_album_image WHERE c_album_id = ?';
    234     $total_num = db_get_one($sql, $params);
    235 
    236     if ($total_num != 0) {
    237         $total_page_num =  ceil($total_num / $page_size);
    238         if ($page >= $total_page_num) {
    239             $next = false;
    240         } else {
    241             $next = true;
    242         }
    243 
    244         if ($page <= 1) {
    245             $prev = false;
    246         } else {
    247             $prev = true;
    248         }
    249     }
    250     return array($list, $prev, $next, $total_num);
    251 }
    252 */
    253 
    254 //取得相册列表
    255 /*
    256 function p_fh_album_list_fh_album_list4c_member_id($c_member_id, $page_size, $page,$u = null)
    257 {
    258     $pf_cond = db_album_public_flag_condition($c_member_id, $u);
    259     $sql = 'SELECT * FROM c_album WHERE c_member_id = ?'.$pf_cond.
    260            ' ORDER BY r_datetime DESC';
    261     $params = array(intval($c_member_id));
    262     $list = db_get_row($sql,$params);
    263    
    264 //    print "<pre>";
    265 //    echo "IN DATABASE<br><br>";
    266 //    print_r ($list);
    267 //    echo "IN DATABASE<br><br>";
    268 //    print "</pre>";
    269    
    270     $sql = 'SELECT COUNT(*) FROM c_album WHERE c_member_id = ?' . $pf_cond;
    271     $params1 = array();
    272     $total_num = db_get_one($sql, $params);
    273    
    274     if ($total_num != 0) {
    275         $total_page_num =  ceil($total_num / $page_size);
    276         if ($page >= $total_page_num) {
    277             $next = false;
    278         } else {
    279             $next = true;
    280         }
    281 
    282         if ($page <= 1) {
    283             $prev = false;
    284         } else {
    285             $prev = true;
    286         }
    287     }
    288    
    289     $temp = array($list, $prev, $next, $total_num);
    290    
    291 
    292     return $temp;
    293 }
    294 */
    295 
    296 /*
    297 function db_album_category_c_album_category4c_album_id($c_album_id)
    298 {
    299     $sql = 'SELECT category_name FROM c_album_category AS cac,c_album_category_album AS caca WHERE cac.c_album_category_id = caca.c_album_category_id AND caca.c_album_id = ?';
    300     $params = array(intval($c_album_id));
    301     return db_get_one($sql, $params);
    302 }
    303 */
    304 
    305225/**
    306226 * 特定ユーザーのアルバムリスト取得
     
    418338
    419339    foreach ($lst as $key=>$value) {
    420         //$lst[$key]['count_comments'] = db_album_count_c_album_comment4c_album_id($value['c_album_id']);
    421340        $lst[$key]['c_member'] = db_common_c_member4c_member_id($value['c_member_id']);
    422341    }
     
    442361    return array($lst, $prev, $next, $total_num);
    443362}
     363
     364/**
     365 * フレンド最新アルバムリスト取得[h_home用]
     366 * 日記公開範囲を考慮
     367 *
     368 * @param   int $c_member_id
     369 * @param   int $limit
     370 * @return  array_of_array  (c_album.*, nickname)
     371 */
     372function p_h_home_c_album_friend_list4c_member_id($c_member_id, $limit)
     373{
     374    $friends = db_friend_c_member_id_list($c_member_id, true);
     375    if (!$friends) {
     376        return array();
     377    }
     378    $ids = implode(',', array_map('intval', $friends));
     379
     380    $sql = 'SELECT * FROM c_album' .
     381            ' WHERE c_member_id IN (' . $ids . ')' .
     382            ' AND public_flag <> \'private\'' .
     383            ' ORDER BY r_datetime DESC';
     384
     385    $c_album_friend_list = db_get_all_limit($sql, 0, $limit);
     386
     387    foreach ($c_album_friend_list as $key => $value) {
     388        $c_member = db_common_c_member4c_member_id_LIGHT($value['c_member_id']);
     389        $c_diary_friend_list[$key]['nickname'] = $c_member['nickname'];
     390    }
     391
     392    return $c_album_friend_list;
     393}
     394
    444395
    445396/**
Note: See TracChangeset for help on using the changeset viewer.