<?php
$user_id = $this->session->userdata('user_id');
$offset = $this->session->userdata('time_offset');
?>
<div class="media-bottom" style="margin-left: 55px" >
    <p class="text-justify">   

        <?php
        if ($comment_reply_value->comment_like_by != '') {
            $post_comment_reply_like_array = explode(",", $comment_reply_value->comment_like_by);
            if (in_array($user_id, $post_comment_reply_like_array)) {
                ?>
                <a href="javascript:void(0)" style="color:red"
                   onclick="getReplyLikeValue('<?php echo base_url() . 'post/add_comment_reply_like/' . $comment_reply_value->comment_id . '/' . $user_id . '/' . 'dislike'; ?>', '<?php echo $comment_reply_value->comment_id; ?>')" >
                    <img src="<?php echo base_url() ?>image/home/red_like_icon.png" width="15" height="20" style="margin-top: -7px;" title="Unread">
                </a> -
            <?php } else { ?>
                <a href="javascript:void(0)"
                   onclick="getReplyLikeValue('<?php echo base_url() . 'post/add_comment_reply_like/' . $comment_reply_value->comment_id . '/' . $user_id . '/' . 'like'; ?>', '<?php echo $comment_reply_value->comment_id; ?>')" >
                    <img src="<?php echo base_url() ?>image/home/like-icon.png" width="15" height="20" style="margin-top: -7px;" title="Read">
                </a> -
                <?php
            }
        } else {
            ?>
            <a href="javascript:void(0)"
               onclick="getReplyLikeValue('<?php echo base_url() . 'post/add_comment_reply_like/' . $comment_reply_value->comment_id . '/' . $user_id . '/' . 'like'; ?>', '<?php echo $comment_reply_value->comment_id; ?>')" >
                <img src="<?php echo base_url() ?>image/home/like-icon.png" width="15" height="20" style="margin-top: -7px;" title="Read">
            </a> -
            <?php
        }
        ?>
        <a href="javascript:void(0)"
           onclick="addNestedReplyForm('<?php echo base_url() . 'post/add_comment_nested_reply_form/' . $comment_reply_value->comment_id . '/' . $user_id; ?>', '<?php echo $comment_reply_value->comment_id; ?>')" >
            <i class="fa fa-share" style=" -ms-transform: rotate(90deg); -webkit-transform: rotate(90deg); transform: rotate(90deg);" aria-hidden="true" title="Reply"></i>
        </a>


        <?php
        if ($post_value->posted_by == $user_id || $comment_reply_value->comment_reply_by == $user_id) {
            ?>
            - <a href="javascript:void(0)"
                 onclick="deleteComment('<?php echo base_url() . 'post/delete_post_comment' ?>', '<?php echo $comment_reply_value->comment_id; ?>', '<?php echo $post_value->post_id ?>', 'reply')" >
                <i class="fa fa-trash"  aria-hidden="true" title="Delete"></i>
            </a> -
        <?php } ?>

        <span>
            <?php
            $this->utility_model->time_format_for_read_write($comment_reply_value->comment_date_time);
            ?>
        </span> 
    </p>
</div>
<div class="text-justify padding-top-zero" style="margin-left: 55px;">
    <?php
    if ($comment_reply_value->comment_like_by != '') {
        $reply_like_value = $comment_reply_value->comment_like_by;
        $this->cf->read_write_status($user_id, $comment_reply_value->comment_like_by, 'reply' . $comment_reply_value->comment_id);
        $reply_like_id_array = explode(',', $reply_like_value);
        ?>
        <div id="viewLikeModal_reply<?php echo $comment_reply_value->comment_id ?>" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
            <div class="modal-dialog modal-md">
                <div class="modal-content white_ttc" >

                    <div class="modal-header  text-left" style="padding: 20px 20px 0 20px;">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close" style=" opacity: 1"><span aria-hidden="true"><strong  style="color: #80c12c;">&times;</strong></span></button>
                        <span class="modal-title" id="gridSystemModalLabel">
                            <img class="pull-left" style="width: 30px" src="<?php echo base_url() ?>image/home/like-icon.png">
                            <div class="form-group"></div> <strong><?php echo '&nbsp;&nbsp;&nbsp;' . count($reply_like_id_array); ?></strong>
                        </span>
                    </div>
                    <div class="modal-body padding-top-zero">
                        <div class="row">
                            <div class="col-sm-12 padding-zero"  style="border-top: 2px solid #80c12c;height: 320px;overflow-y: scroll">
                                <div class="col-sm-12 form-group"></div>
                                <div class="col-sm-12">
                                    <?php
                                    foreach ($reply_liked_person as $reply_person_value) {
                                        ?>
                                        <div class="media">
                                            <div class="media-left">
                                                <?php if ($reply_person_value->person_image != '') {
                                                    ?>
                                                    <img class="media-object" src="<?php echo base_url() . 'content-library/' . $reply_person_value->url . '/' . $reply_person_value->person_image; ?>" 
                                                         alt="<?php echo $reply_person_value->person_first_name . ' ' . $reply_person_value->person_last_name ?>" style="width: 50px;height: 50px">
                                                         <?php
                                                     } else {
                                                         ?>
                                                    <img class="media-object" src="<?php echo base_url() . 'image/home/no_profile_picture.png'; ?>" 
                                                         alt="<?php echo $reply_person_value->person_first_name . ' ' . $reply_person_value->person_last_name ?>" style="width: 50px;height: 50px">
                                                         <?php
                                                     }
                                                     ?>
                                            </div>
                                            <div class="media-body">
                                                <h2 class="media-heading" style="margin-top: 15px">
                                                    <a href="<?php echo $reply_person_value->url ?>" target="_blank">
                                                        <?php echo $reply_person_value->person_first_name . ' ' . $reply_person_value->person_last_name ?>
                                                    </a>
                                                    <?php
                                                    if ($reply_person_value->person_id != $user_id) {
                                                        if (!in_array($reply_person_value->person_id, $all_link)) {
                                                            ?>
                                                            <span style="color: #80c12c" class="pull-right" title="Add to your link"> 
                                                                <sub style="font-weight: bold"> + </sub> <i class="fa fa-link"></i>
                                                            </span>
                                                            <?php
                                                        }
                                                    }
                                                    ?>
                                                </h2>
                                            </div>
                                            <hr>
                                        </div>
                                        <?php
                                    }
                                    ?>
                                </div>
                            </div> 
                        </div>
                    </div>
                </div><!-- /.modal-content -->
            </div>
        </div>
        <?php
    } else {
        $this->cf->read_write_status($user_id, '', '');
    }
    ?>
</div>

<!------------------------------------(4-d-iii-1) Start Comment Nested Reply Form----------------------------- -->
<div class="col-sm-12" style="margin-left: -30px;"
     id="add_nested_reply_form<?php echo $comment_reply_value->comment_id; ?>" style="margin-left: 40px; display: none">
</div>
<!------------------------------------(4-d-iii-1) END Comment Nested Reply Form----------------------------- -->