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

Changeset 6511


Ignore:
Timestamp:
Apr 10, 2008, 6:46:20 PM (12 years ago)
Author:
cybaron
Message:

・c_albumテーブルにu_datetimeカラム追加に伴う処理追加
・c_album_imageテーブルにfilesizeカラム追加に伴う追加処理

Location:
OpenPNE/branches/work/asano/pne_album
Files:
1 added
3 edited

Legend:

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

    r6415 r6511  
    3737    return $pf_cond;
    3838}
    39 
    40 //// c_album
    4139
    4240/**
     
    365363 * フレンド最新アルバムリスト取得[h_home用]
    366364 * 日記公開範囲を考慮
    367  *
     365 * todo:画像追加の順番にしたほうがよい
    368366 * @param   int $c_member_id
    369367 * @param   int $limit
     
    404402        'description' => $description,
    405403        'public_flag' => $public_flag,
     404        'u_datetime' => db_now(),
    406405        'r_datetime' => db_now(),
    407406    );
     
    417416        'description' => $description,
    418417        'public_flag' => $public_flag,
     418        'u_datetime' => db_now(),
    419419    );
    420420    if ($image_filename) $data['album_cover_image'] = $image_filename;
     
    427427}
    428428
    429 function db_album_update_c_album_image($c_album_image_id,$image_filename,$image_description)
     429function db_album_update_c_album_image($c_album_image_id,$image_filename,$image_description,$filesize)
    430430{
    431431    $data = array(
    432432        'image_description' => $image_description,
    433433    );
    434     if ($image_filename) $data['image_filename'] = $image_filename;
     434
     435     if ($image_filename) {
     436        $data['image_filename'] = $image_filename;
     437        $data['filesize'] = $filesize;
     438     }
    435439
    436440    $where = array(
     
    439443   
    440444    return db_update('c_album_image', $data, $where);
     445
    441446}
    442447
     
    450455        'description' => $description,
    451456        'public_flag' => $public_flag,
     457        'u_datetime' => db_now(),
    452458    );
    453459    if ($album_cover_image) $data['album_cover_image'] = $album_cover_image;
     
    467473    $data = array(
    468474        'album_cover_image' => $album_cover_image,
     475        'u_datetime' => db_now(),
    469476    );
    470477
     
    476483
    477484/**
    478  * アルバムを編集
    479  */
    480 /*
    481 function db_album_insert_c_album_image($c_album_image_id,$image_filename_1 = '',$image_description)
    482 {
    483     $data = array(
    484             'c_album_image_id'=>$c_album_image_id,
    485             'image_description'=>$image_description,
    486             'r_datetime' => db_now(),
    487     );
    488     if ($image_filename_1) $data['image_filename'] = $image_filename_1;
    489 
    490     $where = array(
    491         'c_album_image_id' => intval($c_album_image_id),
    492     );
    493 
    494     return db_insert('c_album_image', $data, $where);
    495 }
    496 */
     485 * アルバムの更新日時を更新
     486 * @param int $album_id
     487 */
     488function db_album_update_c_album_u_datetime($album_id)
     489{
     490        $data = array(
     491        'u_datetime' => db_now(),
     492    );
     493   
     494    $where =array(
     495        'c_album_id' => $album_id,
     496    );
     497    return db_update('c_album',$data,$where);
     498}
    497499
    498500/**
     
    502504 * @param string $image_description
    503505 */
    504 function db_insert_c_album_image($c_album_id, $image_filename, $image_description)
     506function db_insert_c_album_image($c_album_id, $image_filename, $image_description,$image_size=0)
    505507{
    506508    $data = array(
     
    509511            'r_datetime' => db_now(),
    510512    );
    511     if ($image_filename) $data['image_filename'] = $image_filename;
    512        
     513
     514     if ($image_filename) {
     515        $data['image_filename'] = $image_filename;
     516        $data['filesize'] = $image_size;
     517     }
     518   
    513519    return db_insert('c_album_image', $data);
    514520}
     
    613619
    614620    //TODO:typeフィールドを使う
    615     return db_image_insert_c_image_album($filename, $image_data);
     621    return db_image_insert_c_image_album($filename, $image_data,$size);
    616622}
    617623
     
    651657}
    652658
    653 /*
    654 function db_image_c_album_image4c_image_id($c_image_id)
    655 {
    656     $db =& db_get_instance('image');
    657 
    658     $sql = 'SELECT * FROM c_image_album WHERE c_image_id = ?';
    659     $params = array(intval($c_image_id));
    660     return $db->get_row($sql, $params);
    661 }
    662 */
    663 
    664659function db_album_image_data_delete($image_filename)
    665660{
     
    694689}
    695690
    696 /*
    697 function admin_insert_c_image_album($upfile_obj, $filename)
    698 {
    699     if ($upfile_obj &&
    700         is_uploaded_file($upfile_obj['tmp_name']) &&
    701         db_image_insert_c_image_album2($filename, $upfile_obj['tmp_name']) > 0)
    702     {
    703         return $filename;
    704     }
    705 
    706     return false;
    707 }
    708 */
    709 
    710691?>
  • OpenPNE/branches/work/asano/pne_album/webapp/modules/pc/do/h_album_image_add_insert_c_album_image.php

    r6309 r6511  
    3535        // ----------
    3636
     37        $img_tmp_dir_path = OPENPNE_VAR_DIR . '/tmp/';
    3738        if($tmpfile_1){
    3839            $filename_1 = image_insert_c_image_album4tmp("a_{$c_album_id}_1", $tmpfile_1);
     40            $filesize_1 = filesize($img_tmp_dir_path . basename($tmpfile_1));
    3941        }
    4042        if($tmpfile_2){
    4143            $filename_2 = image_insert_c_image_album4tmp("a_{$c_album_id}_2", $tmpfile_2);
     44            $filesize_2 = filesize($img_tmp_dir_path . basename($tmpfile_2));
    4245        }
    4346        if($tmpfile_3){
    4447            $filename_3 = image_insert_c_image_album4tmp("a_{$c_album_id}_3", $tmpfile_3);
     48            $filesize_3 = filesize($img_tmp_dir_path . basename($tmpfile_3));
    4549        }
    4650        if($tmpfile_4){
    4751            $filename_4 = image_insert_c_image_album4tmp("a_{$c_album_id}_4", $tmpfile_4);
     52            $filesize_4 = filesize($img_tmp_dir_path . basename($tmpfile_4));
    4853        }
    4954        if($tmpfile_5){
    5055            $filename_5 = image_insert_c_image_album4tmp("a_{$c_album_id}_5", $tmpfile_5);
     56            $filesize_5 = filesize($img_tmp_dir_path . basename($tmpfile_5));
    5157        }
     58
    5259        $sessid = session_id();
    5360        t_image_clear_tmp($sessid);
    5461       
     62        // 説明がなければ画像の名前を設定
    5563        if(!$image_description1){
    5664            $image_description1 = $filename_1;
     
    6876            $image_description5 = $filename_5;
    6977        }
     78       
    7079        $insert_data = array(
    71                             0=>array('image_description'=>$image_description1,'image_filename'=>$filename_1),
    72                             1=>array('image_description'=>$image_description2,'image_filename'=>$filename_2),
    73                             2=>array('image_description'=>$image_description3,'image_filename'=>$filename_3),
    74                             3=>array('image_description'=>$image_description4,'image_filename'=>$filename_4),
    75                             4=>array('image_description'=>$image_description5,'image_filename'=>$filename_5),
    76                             );
     80                            0=>array('image_description'=>$image_description1,'image_filename'=>$filename_1,'image_size'=>$filesize_1),
     81                            1=>array('image_description'=>$image_description2,'image_filename'=>$filename_2,'image_size'=>$filesize_2),
     82                            2=>array('image_description'=>$image_description3,'image_filename'=>$filename_3,'image_size'=>$filesize_3),
     83                            3=>array('image_description'=>$image_description4,'image_filename'=>$filename_4,'image_size'=>$filesize_4),
     84                            4=>array('image_description'=>$image_description5,'image_filename'=>$filename_5,'image_size'=>$filesize_5),
     85        );
    7786       
    7887        foreach($insert_data as $value){
    79             db_insert_c_album_image($target_c_album_id,$value[image_filename],$value[image_description]);
     88            db_insert_c_album_image($target_c_album_id,$value[image_filename],$value[image_description],$value[image_size]);
    8089        }
     90       
     91        //c_albumの更新日時UPDATE
     92        db_album_update_c_album_u_datetime($target_c_album_id);
    8193       
    8294        $p = array('target_c_album_id' => $target_c_album_id);
  • OpenPNE/branches/work/asano/pne_album/webapp/modules/pc/do/h_album_image_edit_insert_c_album_image.php

    r6309 r6511  
    3939        $filename = '';
    4040        $c_album_image = db_album_image_get_c_album_image4id($target_c_album_image_id);
     41        $img_tmp_dir_path = OPENPNE_VAR_DIR . '/tmp/';
    4142        if($tmpfile_1){
    4243            db_album_image_data_delete($c_album_image['image_filename']);
    4344            $filename = image_insert_c_image_album4tmp("a_{$target_c_album_id}_1", $tmpfile_1);
     45            $filesize_1 = filesize($img_tmp_dir_path . basename($tmpfile_1));
    4446        }
    4547       
     
    4850        t_image_clear_tmp($sessid);
    4951
    50         db_album_update_c_album_image($target_c_album_image_id,  $filename, $image_description);
     52        db_album_update_c_album_image($target_c_album_image_id,  $filename, $image_description,$filesize_1);
    5153
     54        //c_albumの更新時間UPDATE
     55        db_album_update_c_album_u_datetime($target_c_album_id);
     56       
    5257        $p = array('target_c_album_id' => $target_c_album_id);
    5358        openpne_redirect('pc', 'page_fh_album', $p);
Note: See TracChangeset for help on using the changeset viewer.