<?php

/* ========================================================================
 *
 */

/**
 *
 */

class pc_page_fh_good_user_list extends OpenPNE_Action
{
    function execute($requests)
    {
        $u = $GLOBALS['AUTH']->uid();

        // --- リクエスト変数
        $target_c_diary_id = $requests['target_c_diary_id'];
        $good_type = $requests['good_type'];
        // ----------

        //  一覧画面の表示件数
        $page_size = 100;

        // target が指定されていない
        if (!$target_c_diary_id) {
            openpne_redirect('pc', 'page_h_err_fh_diary');
        }
        // target の日記が存在しない
        if (!p_common_is_active_c_diary_id($target_c_diary_id)) {
            openpne_redirect('pc', 'page_h_err_fh_diary');
        }

        $target_c_diary = db_diary_get_c_diary4id($target_c_diary_id);
        $target_c_member_id = $target_c_diary['c_member_id'];

        if ($target_c_member_id == $u) {
            $type = 'h';

        } else {
            $type = 'f';

            // check public_flag
            if (!pne_check_diary_public_flag($target_c_diary_id, $u)) {
                openpne_redirect('pc', 'page_h_err_diary_access');
            }
            // アクセスブロック
            if (p_common_is_access_block($u, $target_c_member_id)) {
                openpne_redirect('pc', 'page_h_access_block');
            }

        }
        $this->set("type", $type);

        $this->set('inc_navi', fetch_inc_navi($type, $target_c_member_id));


        $this->set("page_size", $page_size );
        $this->set("target_diary", $target_c_diary);

       //いいね!
        $good_count = good_count($target_c_diary_id, $good_type);
        $good_user_list = good_user($target_c_diary_id, $good_type, $page_size);
        $good_constant = good_constant() ;

        $this->set("good_count", $good_count);
        $this->set("good_user_list", $good_user_list);
        $this->set("good_type", $good_type);
        $this->set("good_const",$good_constant[$good_type]);

        return 'success';
    }

}

?>
