
<div class="container-fluid">
    <div class="row">



        <div class="col-md-5">

            <ul class="nav nav-pills nav-stacked">
                <?php
                $ta_website = $this->config->item('tripadvisor_website');
                foreach ($ta_website as $key => $item) {
                    strcasecmp($city, $key) == 0 ? $active = ' class="active" ' : $active = '';
                    ?>
                    <li <?php echo $active; ?>><a href="<?php echo site_url('apps/tripadvisor_spider/index/index/' . $key); ?>"><?php echo $key; ?></a></li>
                <?php } ?>
            </ul>


        </div>
        <div class="col-md-19">
            <div class="well well-sm text-right">
                <a href="<?php echo site_url('apps/tripadvisor_spider/index/auto_update/' . $city); ?>" target="_blank" class="btn btn-info">抓取新帖</a>
                <a href="<?php echo site_url('apps/tripadvisor_spider/index/auto_update_content/'); ?>" target="_blank" class="btn btn-info">抓取内容</a> 
            </div>
            <?php foreach ($ta_review_list as $key => $item) { 
                //TA原帖链接
                $ta_url='';
                if(!empty($ta_website[$item->tr_city])){
                    $ta_url=$ta_website[$item->tr_city].'#REVIEWS';
                    $ta_url=str_ireplace('Attraction_Review','ShowUserReviews',$ta_url);
                    $ta_url=str_ireplace('Reviews{PAGENUM}','r'.$item->tr_review_id.'-',$ta_url);
                }
                ?>

                <div class="panel panel-default">
                    <div class="panel-heading"><a href="<?php echo $ta_url; ?>" target="_blank" ><?php echo $item->tr_review_title; ?></a> <a class="pull-right" onclick="find_group_modal(<?php echo $item->tr_id; ?>);" >分析</a></div>
                    <div class="panel-body" >

                        <p><?php echo $item->tr_member_name; ?>:</p>
                        <div id="tr_content_<?php echo $item->tr_id; ?>"><?php echo $item->tr_content; ?></div>
                        <p class="pull-right">-Visited <?php echo $item->tr_visited_date; ?> , Reviewed <?php echo $item->tr_review_date; ?></p>
                    </div>
                    <div id="find_group_result_<?php echo $item->tr_id; ?>"></div>


                </div>

            <?php } ?>

        </div>
    </div>


    <script type="text/javascript">

        function find_group_modal(tr_id) {
            if ($('#find_group_result_' + tr_id).html() !== '') {
                $('#find_group_result_' + tr_id).html('');
            } else {

                $.ajax({
                    type: "get",
                    dataType: "json",
                    url: '<?php echo site_url('apps/tripadvisor_spider/index/analysis_ta_review'); ?>' + '/' + tr_id,
                    success: function(data, textStatus) {
                        $('#find_group_result_' + tr_id).html(data.group_result);
                        $('#tr_content_' + tr_id).html(data.tr_content);
                    },
                    error: function(msg) {
                        alert('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYCC...');
                    }
                });
            }
        }

    </script>