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

Changeset 6247


Ignore:
Timestamp:
Apr 2, 2008, 4:31:25 PM (12 years ago)
Author:
cybaron
Message:

画像の修整画面 fh_album_image_show
・画面遷移まで暫定作成

Location:
OpenPNE/branches/work/asano/pne_album/webapp
Files:
4 edited

Legend:

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

    r6198 r6247  
    303303    return db_get_row($sql,$params);
    304304}
     305
     306/**
     307 * c_album_idをキーとしてc_albumデータが存在するか判定
     308 * @param int $c_album_id
     309 * @return bool true,false
     310 */
     311function p_common_is_active_c_album_id($c_album_id)
     312{
     313    $sql = 'SELECT c_album_id FROM c_album WHERE c_album_id = ?';
     314    return (bool)db_get_one($sql, array(intval($c_album_id)));
     315}
     316
     317/**
     318 * c_album_image_idをキーとしてc_album_imageデータが存在するか判定
     319 * @param int $c_album_image_id
     320 * @return bool true,false
     321 */
     322function p_common_is_active_c_album_image_id($c_album_image_id)
     323{
     324    $sql = 'SELECT c_album_image_id FROM c_album_image WHERE c_album_image_id = ?';
     325    $params = array(intval($c_album_image_id));
     326   
     327    return (bool)db_get_one($sql,$params);
     328}
     329
    305330
    306331/**
     
    372397}
    373398
     399/**
     400 * 指定したアルバム画像の前の画像IDを取得する
     401 * @param int $c_member_id
     402 * @param int $c_album_id
     403 * @param int $c_album_image_id
     404 * @param int $u
     405 */
     406function db_album_image_c_album_image_id_prev4c_album_id($c_member_id, $c_album_id, $c_album_image_id, $u = null)
     407{
     408    $public_flag_condition = db_album_public_flag_condition($c_member_id, $u);
     409   
     410    //todo:public_flagを判定するためにc_albumテーブルをfromに追加
     411    //$sql = 'SELECT c_album_image_id FROM c_album_image WHERE c_member_id = ? AND c_album_id < ?'
     412    //     . $public_flag_condition . ' ORDER BY c_album_image_id DESC';
     413    $select  = 'SELECT c_album_image.c_album_image_id ';
     414    $from    = ' FROM c_album_image, c_album';
     415    $where   = ' WHERE c_album.c_album_id = c_album_image.c_album_id' .
     416                ' AND c_album.c_member_id = ?' .
     417                ' AND c_album.c_album_id = ?' .
     418                ' AND c_album_image.c_album_image_id < ?'
     419                . $public_flag_condition;
     420    $orderby = ' ORDER BY c_album_image.c_album_image_id DESC';
     421    $sql = $select . $from . $where . $orderby;
     422    $params = array(intval($c_member_id),intval($c_album_id),intval($c_album_image_id));
     423       
     424    return db_get_one($sql, $params);
     425}
     426
     427/**
     428 * 指定したアルバム画像の次の画像IDを取得する
     429 * @param int $c_member_id
     430 * @param int $c_album_id
     431 * @param int $c_album_image_id
     432 * @param int $u
     433 */
     434function db_album_image_c_album_image_id_next4c_album_id($c_member_id, $c_album_id, $c_album_image_id, $u = null)
     435{
     436    $public_flag_condition = db_album_public_flag_condition($c_member_id, $u);
     437   
     438    $select  = 'SELECT c_album_image.c_album_image_id ';
     439    $from    = ' FROM c_album_image, c_album';
     440    $where   = ' WHERE c_album.c_album_id = c_album_image.c_album_id' .
     441                ' AND c_album.c_member_id = ?' .
     442                ' AND c_album.c_album_id = ?' .
     443                ' AND c_album_image.c_album_image_id > ?'
     444                . $public_flag_condition;
     445    $orderby = ' ORDER BY c_album_image.c_album_image_id ASC';
     446    $sql = $select . $from . $where . $orderby;
     447    $params = array(intval($c_member_id),intval($c_album_id),intval($c_album_image_id));
     448       
     449    return db_get_one($sql, $params);
     450}
     451
     452
     453
     454/**
     455 * c_albumの閲覧権限チェック
     456 * @param int $c_album_id
     457 * @param int $c_member_id
     458 */
    374459function pne_check_album_public_flag($c_album_id, $c_member_id)
    375460{
     
    456541}
    457542
    458 function p_common_is_active_c_album_id($c_album_id)
    459 {
    460     $sql = 'SELECT c_album_id FROM c_album WHERE c_album_id = ?';
    461     return (bool)db_get_one($sql, array(intval($c_album_id)));
    462 }
    463543
    464544//// c_album_comment
     
    16311711
    16321712/**
    1633  * 指定した番号の日記画像を削除
     1713 * c_album_image_idをキーとしてc_album_imageテーブルからデータを削除
    16341714 */
    16351715function db_album_delete_c_album_image($c_album_image_id)
  • OpenPNE/branches/work/asano/pne_album/webapp/modules/pc/page/fh_album_image_show.php

    r6245 r6247  
    1313        $u = $GLOBALS['AUTH']->uid();
    1414       
    15         $target_c_member_id = $requests['target_c_member_id'];
     15        // --- リクエスト変数
     16        $target_c_album_id       = $requests['target_c_album_id'];
     17        $target_c_album_image_id = $requests['target_c_album_image_id'];
     18        //$target_c_member_id = $requests['target_c_member_id'];
     19        //$pass_num = $requests['pass_num'];
     20        //$image_key = $requests['image_key'];
     21        //$direc = $requests['direc'];
     22        //$page = $requests['page'];
     23        // ----------
    1624       
     25        //targetが指定されていない
     26        if(!$target_c_album_id || !$target_c_album_image_id){
     27                openpne_redirect('pc', 'page_h_err_fh_album');
     28        }
     29       
     30        //targetのアルバムが存在しない
     31        if(!p_common_is_active_c_album_id($target_c_album_id)) {
     32            openpne_redirect('pc', 'page_h_err_fh_album');
     33        }
     34       
     35        //targetのアルバム画像が存在しない
     36        if(!p_common_is_active_c_album_image_id($target_c_album_image_id)) {
     37                openpne_redirect('pc', 'page_h_err_fh_album');
     38        }
     39       
     40        $target_c_album = db_album_get_c_album4c_album_id($target_c_album_id);
     41        $target_c_member_id = $target_c_album['c_member_id'];
    1742       
    1843        if ($target_c_member_id == $u) {
    1944            $type = 'h';
    20 
    2145        } else {
    2246            $type = 'f';
    23             $target_c_member = db_member_c_member4c_member_id($target_c_member_id);
    24             $is_friend = db_friend_is_friend($u, $target_c_member_id);
     47            //$target_c_member = db_member_c_member4c_member_id($target_c_member_id);
     48            //$is_friend = db_friend_is_friend($u, $target_c_member_id);
     49
     50            //check public flag
     51            if (!pne_check_album_public_flag($target_c_album_id, $u)) {
     52                openpne_redirect('pc', 'page_h_err_fh_album');
     53            }
     54            // アクセスブロック
     55            if (db_member_is_access_block($u, $target_c_member_id)) {
     56                openpne_redirect('pc', 'page_h_access_block');
     57            }
     58
     59            // あしあとをつける
     60            db_ashiato_insert_c_ashiato($target_c_member_id, $u);
    2561        }
    2662       
     63        $this->set("type", $type);
    2764        $this->set('inc_navi', fetch_inc_navi($type, $target_c_member_id));
    28 //        $this->set('inc_navi', fetch_inc_navi('h'));
     65       
     66        $target_c_album_image = db_album_image_get_c_album_image4id($target_c_album_image_id);
     67        $this->set('c_album_image',$target_c_album_image);
     68       
     69        $this->set('c_album_iamge_id_prev', db_album_image_c_album_image_id_prev4c_album_id($target_c_member_id, $target_c_album_id, $target_c_album_image_id, $u));
     70        $this->set('c_album_iamge_id_next', db_album_image_c_album_image_id_next4c_album_id($target_c_member_id, $target_c_album_id, $target_c_album_image_id, $u));
    2971
    30         // --- リクエスト変数
    31         $target_c_album_image_id = $requests['target_c_album_image_id'];
    32         $target_c_member_id = $requests['target_c_member_id'];
    33         $target_c_album_id = $requests['target_c_album_id'];
    34         $pass_num = $requests['pass_num'];
    35         $image_key = $requests['image_key'];
    36         $direc = $requests['direc'];
    37         $page = $requests['page'];
    38         // ----------
     72        return 'success';
     73       
     74        /*
     75        $target_c_album_images = db_get_c_album_image_list4c_album_id($target_c_album_id);
     76        $c_album_image_ids = db_album_image_get_c_album_image_ids4c_album_image_id($target_c_album_id);
     77        $count = count($c_album_image_ids);
    3978
    40 
    41         $sessid = session_id();
    42        
    43         $target_c_album_images = db_get_c_album_image_list4c_album_id($target_c_album_id);
    44        
    45        
    46        
    47        
    48         $c_album_image_ids = db_album_image_get_c_album_image_ids4c_album_image_id($target_c_album_id);
    49 
    50 
    51        
    52        
    53         $count = count($c_album_image_ids);
     79        //$this->set('inc_navi', fetch_inc_navi($type, $target_c_member_id));
    5480        $this->set('count',$count);
    5581        $this->set('fore',-1);
     
    76102        }
    77103
    78        
    79        
    80        
    81104        $member = db_member_c_member4c_member_id($target_c_member_id);
    82105        $this->set("member", $member);
     
    88111                {$t = $key;
    89112                }
    90                
    91113        }
    92114        $t+=$pass_num;
     
    100122        $this->set('total_num',$total_num);
    101123       
    102        
    103        
    104 
    105         return 'success';
     124        */       
    106125    }
    107126}
  • OpenPNE/branches/work/asano/pne_album/webapp/modules/pc/templates/fh_album_image_show.tpl

    r6245 r6247  
     1
     2<div id="LayoutC">
     3<div id="Center">
     4
     5<div class="dparts formTable">
     6<div class="parts">
     7<div class="partsHeading"><h3>画像の表示</h3></div>
     8
     9({if $c_album_iamge_id_prev || $c_album_iamge_id_next})
     10<div class="pagerRelative">
     11({if $c_album_iamge_id_prev})<p class="prev"><a href="({t_url m=pc a=page_fh_album_image_show})&amp;target_c_album_id=({$c_album_image.c_album_id})&amp;target_c_album_image_id=({$c_album_iamge_id_prev})">«前の画像</a></p>({/if})
     12({if $c_album_iamge_id_next})<p class="next"><a href="({t_url m=pc a=page_fh_album_image_show})&amp;target_c_album_id=({$c_album_image.c_album_id})&amp;target_c_album_image_id=({$c_album_iamge_id_next})">次の画像»</a></p>({/if})
     13</div>
     14({/if})
     15
     16<table>
     17<tr>
     18<td colspan="2">
     19<img src="({t_img_album_url filename=$c_album_image.image_filename w=600 h=600})" alt="photo" vspace="4">
     20</td>
     21</tr>
     22<tr>
     23<td>写真説明</td>
     24<td>({$c_album_image.image_description})</td>
     25</tr>
     26</table>
     27
     28
     29({if $c_album_iamge_id_prev || $c_album_iamge_id_next})
     30<div class="pagerRelative">
     31({if $c_album_iamge_id_prev})<p class="prev"><a href="({t_url m=pc a=page_fh_album_image_show})&amp;target_c_album_id=({$c_album_image.c_album_id})&amp;target_c_album_image_id=({$c_album_iamge_id_prev})">«前の画像</a></p>({/if})
     32({if $c_album_iamge_id_next})<p class="next"><a href="({t_url m=pc a=page_fh_album_image_show})&amp;target_c_album_id=({$c_album_image.c_album_id})&amp;target_c_album_image_id=({$c_album_iamge_id_next})">次の画像»</a></p>({/if})
     33</div>
     34({/if})
     35
     36<a href="({t_url m=pc a=page_fh_album})&amp;target_c_album_id=({$c_album_image.c_album_id})">アルバムに戻る</a>
     37
     38</div> <!-- parts -->
     39</div> <!-- dparts formTable -->
     40
     41</div><!-- Center -->
     42</div><!-- LayoutC -->
     43
     44({*************************
    145({ext_include file="inc_header.tpl"})
    246({ext_include file="inc_layoutcolumn_top_720px.tpl"})
     
    73117({ext_include file="inc_layoutcolumn_bottom_270px_165px_175px_720px.tpl"})
    74118({ext_include file="inc_footer.tpl"}) </p>
     119**************************})
  • OpenPNE/branches/work/asano/pne_album/webapp/modules/pc/validate/page/fh_album_image_show.ini

    r6245 r6247  
    1 [target_c_album_image_id]
    2 type = "int"
    3 
    4 [target_c_member_id]
    5 type = "int"
    6 
    71[target_c_album_id]
    82type = "int"
    93
    10 [image_key]
     4[target_c_album_image_id]
    115type = "int"
    12 
    13 [page]
    14 type = "int"
Note: See TracChangeset for help on using the changeset viewer.