<?php
$user_id = $this->session->userdata('user_id');
$offset = $this->session->userdata('time_offset');

$you_tube_regExp = '/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/';
$vimo_regExp = '/(?:vimeo)\.com.*(?:videos|video|channels|)\/([\d]+)/i';
?>
<div class="col-sm-8 mobile_padding_zero">
    <!--<div class="row gray_ttc">-->
    <div class="col-sm-12 gray_ttc">
        <div class="col-sm-12"><br></div>
        <div class="col-sm-12 padding-zero">
            <div class="col-sm-12"><hr><br></div>
            <div class="col-sm-12 row">
                <div class="col-sm-12 form-group  white" style="margin-bottom: 20px;">

                    <!----------------- (1) Start post User Image  -------------------->
                    <div class="media-left">
                        <a href="<?php echo base_url() . $post_value->url . '/profile'; ?>">
                            <img class="media-object post_image" src="<?php
                            if ($post_value->person_image) {
                                echo base_url() . 'content-library/' . $post_value->url . '/' . $post_value->person_image;
                            } else {
                                echo base_url() . 'image/no_profile_picture.png';
                            }
                            ?>" alt="logo">
                        </a>
                    </div>
                    <!---------------- (1)End post User Image  ------------------------------------>



                    <!------------------------- (2)Start post User Name and Comments  ---------------------->
                    <div class="media-body">
                        <h5 class="media-heading green text-justify" style="font-size: 16px;">
                            <a href="<?php echo base_url() . $post_value->url . '/profile'; ?>">
                                <?php
                                //echo $post_value->person_first_name . ' ' . $post_value->person_last_name; 
                                if (strlen($post_value->person_first_name) && strlen($post_value->person_last_name) < 20) {
                                    echo $post_value->person_first_name . ' ' . $post_value->person_last_name;
                                } else {
                                    echo substr($post_value->person_first_name, 0, 30) . ' ' . substr($post_value->person_last_name, 0, 20) . '...';
                                }
                                ?>
                            </a>
                        </h5>



                        <?php
                        switch ($post_value->post_type) {
                            case 1:
                                ?>
                                <!----------------------For Note--------------------------->
                                <p class="text-justify" id="post_detail<?php echo $post_value->post_id ?>">
                                    <?php
                                    $function_name = 'viewDetails(&quot;' . base_url('post/view_post_details/' . $post_value->post_id . '/post') . '&quot;,&quot;post_detail&quot;,&quot;' . $post_value->post_id . '&quot;)';
                                    echo $this->tt_post->get_post_data($post_value->post_details, 200, $function_name);
                                    ?>
                                </p>
                                <?php
                                break;
                            case 2:
                                ?>
                                <!----------------------------For Alert----------------------------->  
                                <p class="text-justify" id="post_detail<?php echo $post_value->post_id ?>" style="color: #a70b0c;">
                                    <?php
                                    $post_details = $this->tt_post->get_post_details($post_value->post_details);
                                    if (strlen($post_details) > 200) {
                                        $limited_string = mb_substr($post_details, 0, 200, 'utf-8');
                                        echo $this->cf->view_emoticons($limited_string);
                                        ?>
                                        <a href="javascript:void(0)" style="padding-left: 10px;"
                                           onclick="viewDetails('<?php echo base_url() . 'post/view_post_details/' . $post_value->post_id . '/post' ?>', 'post_detail', '<?php echo $post_value->post_id ?>')" >
                                            more...
                                        </a>
                                        <?php
                                    } else {
                                        echo $this->cf->view_emoticons($post_details);
                                    }
                                    ?>
                                </p>
                                <?php
                                break;
                            case 3:

//                                            <!--------------------for assignment---------------------->

                                $file_name = explode(".", $post_value->post_details);
                                switch (strtolower($file_name[1])) {
                                    case 'pdf':
                                        ?>
                                        <span style="padding-left: 30px;" class="form-group col-sm-12 text-left">
                                            <a href="javascript:void(0)" 
                                               onclick="downloadAssignment('<?php echo base_url() . 'download-assignment-file' ?>', '<?php echo $post_value->post_id; ?>')" >
                                                <img src="<?php echo base_url() . 'image/assignment/pdf.png' ?>">
                                            </a>&nbsp;&nbsp;&nbsp; <?php echo $post_value->post_file_original_name; ?> 
                                        </span>
                                        <?php
                                        break;
                                    case $file_name[1] == 'zip' || $file_name[1] == 'rar':
                                        ?>
                                        <span style="padding-left: 30px;" class="form-group col-sm-12 text-left">
                                            <a href="javascript:void(0)" 
                                               onclick="downloadAssignment('<?php echo base_url() . 'download-assignment-file' ?>', '<?php echo $post_value->post_id; ?>')" >
                                                <img src="<?php echo base_url() . 'image/assignment/rar.png' ?>">
                                            </a>&nbsp;&nbsp;&nbsp; <?php echo $post_value->post_file_original_name; ?> 
                                        </span>
                                        <?php
                                        break;
                                    case $file_name[1] == 'doc' || $file_name[1] == 'docx':
                                        ?>
                                        <span style="padding-left: 30px;" class="form-group col-sm-12 text-left">
                                            <a href="javascript:void(0)" 
                                               onclick="downloadAssignment('<?php echo base_url() . 'download-assignment-file' ?>', '<?php echo $post_value->post_id; ?>')" >
                                                <img src="<?php echo base_url() . 'image/assignment/word.png' ?>">
                                            </a>&nbsp;&nbsp;&nbsp; <?php echo $post_value->post_file_original_name; ?> 
                                        </span>
                                        <?php
                                        break;
                                    case $file_name[1] == 'xls' || $file_name[1] == 'xlsx':
                                        ?>
                                        <span style="padding-left: 30px;" class="form-group col-sm-12 text-left">
                                            <a href="javascript:void(0)" 
                                               onclick="downloadAssignment('<?php echo base_url() . 'download-assignment-file' ?>', '<?php echo $post_value->post_id; ?>')" >
                                                <img src="<?php echo base_url() . 'image/assignment/excel.png' ?>">
                                            </a>&nbsp;&nbsp;&nbsp; <?php echo $post_value->post_file_original_name; ?> 
                                        </span>
                                        <?php
                                        break;
                                    case $file_name[1] == 'ppt' || $file_name[1] == 'pptx':
                                        ?>
                                        <span style="padding-left: 30px;" class="form-group col-sm-12 text-left">
                                            <a href="javascript:void(0)" 
                                               onclick="downloadAssignment('<?php echo base_url() . 'download-assignment-file' ?>', '<?php echo $post_value->post_id; ?>')" >
                                                <img src="<?php echo base_url() . 'image/assignment/powerpoint.png' ?>">
                                            </a>&nbsp;&nbsp;&nbsp; <?php echo $post_value->post_file_original_name; ?> 
                                        </span>
                                        <?php
                                        break;
                                    default :
                                        ?>
                                        <span style="padding-left: 30px;" class="form-group col-sm-12 text-left">
                                            <a href="javascript:void(0)" 
                                               onclick="downloadAssignment('<?php echo base_url() . 'download-assignment-file' ?>', '<?php echo $post_value->post_id; ?>')" >
                                                <img src="<?php echo base_url() . 'image/assignment/unknown.png'; ?>">
                                            </a>&nbsp;&nbsp;&nbsp; <?php echo $post_value->post_file_original_name; ?>
                                        </span>
                                        <?php
                                        break;
                                }
                                break;
                            case 4:
                                ?>
                                <!--------------------for Image---------------------->
                                <span style="padding: 1px;">
                                    <img class="img-responsive media-object btn-block" 
                                         style="margin: 0 auto; 
                                         max-height: 350px;
                                         max-width: 400px;
                                         cursor: pointer;" 
                                         src="<?php echo base_url() . 'content-library/' . $post_value->url . '/' . $post_value->post_details; ?>" 
                                         alt="image File" >
                                </span>
                                <?php
                                break;
                            case 5:
                                ?>
                                <!--------------------for Video---------------------->
                                <div class="col-sm-12">
                                    <div class="row">
                                        <video controls>
                                            <source src="<?php echo base_url() . 'content-library/' . $post_value->url . '/' . $post_value->post_details; ?>" type="video/mp4">                                                              
                                        </video>
                                    </div>
                                </div>



                                <?php
                                break;
                        }
                        ?>


                    </div>
                    <!------------------------ (2)END post User Name and Comments ------------------------ -->


                    <!-----------------Start View URL Details (if user post URL)------------------------>
                    <?php
                    if ($post_url) {
                        $url_value = explode("URL: ", $post_url->post_comment_url_info);

                        if (preg_match($you_tube_regExp, $url_value[1])) {
                            ?>
                            <div class="embed-responsive embed-responsive-16by9" >
                                <iframe class="embed-responsive-item"  width="420" height="345"
                                        src="<?php echo $url_value[1]; ?>">
                                </iframe>
                            </div>
                            <?php
                        } else if (preg_match($vimo_regExp, $url_value[1])) {
                            ?>
                            <div class="embed-responsive embed-responsive-16by9" >
                                <iframe class="embed-responsive-item"   src="<?php echo $url_value[1]; ?>" 
                                        width="420" height="345" 
                                        frameborder="0" 
                                        webkitallowfullscreen mozallowfullscreen allowfullscreen>
                                </iframe>
                            </div>     
                            <?php
                        } else {
                            ?>
                            <div class="col-sm-12 text-left">
                                <div class="col-sm-12">
                                    <h5>
                                        <a href="<?php echo $url_value[1]; ?>" target="_blank" style="color: #545457">
                                            <?php echo $url_value[2]; ?>
                                        </a>
                                    </h5>
                                </div>
                                <div class="col-sm-12" style="margin-top: -10px;">
                                    <p style="font-size: 12px;">
                                        <a href="<?php echo $url_value[1]; ?>" target="_blank" style="color: #545457">
                                            <?php echo $url_value[3]; ?>
                                        </a>
                                    </p>
                                </div>
                                <div class="col-sm-12" style="margin-top: -10px;">
                                    <h6>
                                        <?php
                                        if ($url_value[1]) {
                                            ?>
                                            <a href="<?php echo $url_value[1]; ?>" target="_blank" style="color: #545457">
                                                <?php echo $url_value[1]; ?>
                                            </a>
                                            <?php
                                        }
                                        if ($url_value[4] == '') {
                                            echo '';
                                        } else {
                                            echo 'BY | ';
                                            ?>
                                            <a href="<?php echo $url_value[1]; ?>" target="_blank" style="color: #545457"><?php echo $url_value[4]; ?></a>
                                            <?php
                                        }
                                        ?>
                                    </h6>
                                </div>
                            </div>
                            <?php
                        }
                    }
                    ?>
                    <!-----------------END View URL Details (if user post URL)------------------------>



                    <!-------------------(3) Start post User Like, Comment, library and Time Action  -------------->
                    <div id="action<?php echo $post_value->post_id; ?>">
                        <div class="media-bottom" style="margin-left: 75px" ><hr>
                            <p class="text-justify" style="font-size: 14px;">
                                <?php
                                if (isset($post_function[$post_value->post_id]->post_like_by)) {
                                    $liked_person_id = explode(",", $post_function[$post_value->post_id]->post_like_by);
                                    if (in_array($user_id, $liked_person_id)) {
                                        ?>
                                        <a href="javascript:void(0)"
                                           onclick="getLikeValue('<?php echo base_url() . 'post/add_like/' . $post_value->post_id . '/' . $user_id . '/' . 'dislike'; ?>', '<?php echo $post_value->post_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="getLikeValue('<?php echo base_url() . 'post/add_like/' . $post_value->post_id . '/' . $user_id . '/' . 'like'; ?>', '<?php echo $post_value->post_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="getLikeValue('<?php echo base_url() . 'post/add_like/' . $post_value->post_id . '/' . $user_id . '/' . 'like'; ?>', '<?php echo $post_value->post_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="addWriteForm('<?php echo base_url() . 'post/add_write_form/' . $post_value->post_id . '/' . $user_id; ?>', '<?php echo $post_value->post_id; ?>')" >
                                       <?php
                                       if ($post_value->post_comment_count == NULL) {
                                           echo '<i class="fa fa-pencil-square" aria-hidden="true" title="Write"></i>';
                                       } else {
                                           echo '<i class="fa fa-pencil-square" aria-hidden="true" title="Write"></i> (' . $post_value->post_comment_count . ')';
                                       }
                                       ?>
                                </a>

                                <?php
                                if ($post_value->posted_by != $user_id) {
                                    if ($post_value->post_type == 1 || $post_value->post_type == 2) {
                                        if (isset($post_function[$post_value->post_id]->post_add_to_my_library_by)) {
                                            if ($post_function[$post_value->post_id]->post_add_to_my_library_by == NULL) {
                                                ?>
                                                -<a href="javascript:void(0)"
                                                    onclick="libraryAction('<?php echo base_url() . 'post/add_to_my_library/' . $post_value->post_id . '/' . $user_id . '/' . 'add'; ?>', '<?php echo $post_value->post_id; ?>')" >
                                                    <i class="fa fa-hdd-o" aria-hidden="true" title="Add to my Note Alert"></i>
                                                </a>
                                                <?php
                                            } else {
                                                $added_library_person_id = explode(",", $post_function[$post_value->post_id]->post_add_to_my_library_by);
                                                if (in_array($user_id, $added_library_person_id)) {
                                                    ?>
                                                    -<a href="javascript:void(0)"
                                                        onclick="libraryAction('<?php echo base_url() . 'post/add_to_my_library/' . $post_value->post_id . '/' . $user_id . '/' . 'remove'; ?>', '<?php echo $post_value->post_id; ?>')" >
                                                        <i class="fa fa-hdd-o red" aria-hidden="true" title="Remove to my Note Alert"></i> (<?php echo count($added_library_person_id); ?>)
                                                    </a>
                                                    <?php
                                                } else {
                                                    ?>
                                                    -<a href="javascript:void(0)"
                                                        onclick="libraryAction('<?php echo base_url() . 'post/add_to_my_library/' . $post_value->post_id . '/' . $user_id . '/' . 'add'; ?>', '<?php echo $post_value->post_id; ?>')" >
                                                        <i class="fa fa-hdd-o" aria-hidden="true" title="Add to my Note Alert"></i> (<?php echo count($added_library_person_id); ?>)
                                                    </a>
                                                    <?php
                                                }
                                            }
                                        } else {
                                            ?>
                                            -<a href="javascript:void(0)"
                                                onclick="libraryAction('<?php echo base_url() . 'post/add_to_my_library/' . $post_value->post_id . '/' . $user_id . '/' . 'add'; ?>', '<?php echo $post_value->post_id; ?>')" >
                                                <i class="fa fa-hdd-o" aria-hidden="true" title="Add to my Note Alert"></i>
                                            </a>
                                            <?php
                                        }
                                    } else if ($post_value->post_type == 3 || $post_value->post_type == 4 || $post_value->post_type == 5) {
                                        if (isset($post_function[$post_value->post_id]->post_add_to_my_library_by)) {
                                            if ($post_function[$post_value->post_id]->post_add_to_my_library_by == NULL) {
                                                ?>
                                                -<a href="javascript:void(0)"
                                                    onclick="libraryAction('<?php echo base_url() . 'post/add_to_my_library/' . $post_value->post_id . '/' . $user_id . '/' . 'add'; ?>', '<?php echo $post_value->post_id; ?>')" >
                                                    <i class="fa fa-hdd-o" aria-hidden="true" title="Add to my Content Library"></i>
                                                </a>
                                                <?php
                                            } else {
                                                $added_library_person_id = explode(",", $post_function[$post_value->post_id]->post_add_to_my_library_by);
                                                if (in_array($user_id, $added_library_person_id)) {
                                                    ?>
                                                    -<a href="javascript:void(0)"
                                                        onclick="libraryAction('<?php echo base_url() . 'post/add_to_my_library/' . $post_value->post_id . '/' . $user_id . '/' . 'remove'; ?>', '<?php echo $post_value->post_id; ?>')" >
                                                        <i class="fa fa-hdd-o red" aria-hidden="true" title="Remove to my Content Library"></i>(<?php echo count($added_library_person_id); ?>)
                                                    </a>
                                                    <?php
                                                } else {
                                                    ?>
                                                    -<a href="javascript:void(0)"
                                                        onclick="libraryAction('<?php echo base_url() . 'post/add_to_my_library/' . $post_value->post_id . '/' . $user_id . '/' . 'add'; ?>', '<?php echo $post_value->post_id; ?>')" >
                                                        <i class="fa fa-hdd-o" aria-hidden="true" title="Add to my Content Library"></i> (<?php echo count($added_library_person_id); ?>)
                                                    </a>
                                                    <?php
                                                }
                                            }
                                        } else {
                                            ?>
                                            -<a href="javascript:void(0)"
                                                onclick="libraryAction('<?php echo base_url() . 'post/add_to_my_library/' . $post_value->post_id . '/' . $user_id . '/' . 'add'; ?>', '<?php echo $post_value->post_id; ?>')" >
                                                <i class="fa fa-hdd-o" aria-hidden="true" title="Add to my Content Library"></i>
                                            </a>
                                            <?php
                                        }
                                    }
                                }
                                ?>



                                <!-------------------For Publication Status part -------------->
                                -<a href="javascript:void(0)">
                                    <?php
                                    switch ($post_value->post_publication_status) {
                                        case 1:
                                            echo '<i class="fa fa-globe" aria-hidden="true" title="Public"></i>';
                                            break;
                                        case 2:
                                            echo '<img src="' . base_url() . 'image/dashboard-tt-icon.png" title="TT User" alt="TT User">';
                                            break;
                                        case 3:
                                            echo '<i class="fa fa-link" aria-hidden="true" title="My Link"></i>';
                                            break;
                                        case 4:
                                            echo '<i class="fa fa-users" aria-hidden="true" title="Public"></i>';
                                            break;
                                    }
                                    ?>
                                </a>
                                <!-------------------For Publication Status part -------------->


                                <!-------------------For edit post part -------------->
                                <?php
                                if ($post_value->posted_by == $user_id) {
                                    ?>
                                    -<a href="<?php echo base_url() . 'user/edit-post/' . $this->utility_model->encode_id($post_value->post_id, '/', 'Tt'); ?>" target="_blank">
                                        <i class="fa fa-edit" aria-hidden="true" title="edit"></i>
                                    </a>
                                <?php } ?>
                                <!-------------------For edit post part -------------->

                                <!-------------------For Delete post part -------------->
                                <?php
                                if ($post_value->posted_by == $user_id) {
                                    ?>
                                    -<a href="javascript:void(0)" data-toggle="modal" data-target="#deletePost<?php echo $post_value->post_id; ?>">
                                        <i class="fa fa-trash-o" title="Delete"></i>
                                    </a>
                                <?php }
                                ?>
                                <!-------------------For Delete post part -------------->


                                <!-------------------For view time format part -------------->
                                -<span>
                                    <?php
                                    $this->utility_model->time_format_for_read_write($post_value->post_date_time, $offset);
                                    ?>
                                </span>
                                <!-------------------For view time format part -------------->


                            </p><hr>
                        </div>
                        <div class="col-sm-12 text-left like_margin">
                            <?php
                            if (isset($post_function[$post_value->post_id]->post_like_by)) {
                                $post_like_id = $post_function[$post_value->post_id]->post_like_by;
                                $this->cf->read_write_status($user_id, $post_like_id, 'post' . $post_value->post_id);
                                $post_like_id_array = explode(',', $post_like_id);
                                ?>
                                <div id="viewLikeModal_post<?php echo $post_value->post_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($post_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 ($post_liked_person[$post_value->post_id] as $post_person_value) {
                                                                ?>
                                                                <div class="media">
                                                                    <div class="media-left">
                                                                        <?php if ($post_person_value->person_image != '') {
                                                                            ?>
                                                                            <img class="media-object" src="<?php echo base_url() . 'content-library/' . $post_person_value->url . '/' . $post_person_value->person_image_thumb; ?>" 
                                                                                 alt="<?php echo $post_person_value->person_first_name . ' ' . $post_person_value->person_last_name ?>" style="width: 50px;height: 50px">
                                                                                 <?php
                                                                             } else {
                                                                                 ?>
                                                                            <img class="media-object" src="<?php echo base_url() . 'image/no_profile_picture.png'; ?>" 
                                                                                 alt="<?php echo $post_person_value->person_first_name . ' ' . $post_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 base_url() . $post_person_value->url ?>" target="_blank">
                                                                                <?php echo $post_person_value->person_first_name . ' ' . $post_person_value->person_last_name ?>
                                                                            </a>
                                                                            <?php
                                                                            if ($post_person_value->person_id != $user_id) {
                                                                                if (!in_array($post_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>



                        <!------------- (3-a) Start Comments FORM----------------- -->
                        <div class="col-sm-12" 
                             id="add_write_form<?php echo $post_value->post_id; ?>" style="margin-left: 40px; display: none">
                        </div>
                        <!------------- (3-a) End Comments FORM----------------- -->


                    </div>
                    <!-------------------(3) END post User Like, Comment, library and Time Action  -------------->




                    <!------------------- (4) Start User Post all Comment action -------------------------->
                    <div id="view_comment<?php echo $post_value->post_id; ?>">
                        <?php
                        $count_comments = 0;
                        foreach ($post_comment[$post_value->post_id] as $comment_value) {
                            ?>
                            <div class="like_margin">
                                <div class="col-sm-12"><hr></div>


                                <!-----------------(4-a) Start Comment User Image --------------------->
                                <div class="media-left">
                                    <a href="<?php echo base_url() . $comment_value->url . '/profile'; ?>">
                                        <img class="media-object post_comment_image" src="<?php
                                        if ($comment_value->person_image) {
                                            echo base_url() . 'content-library/' . $comment_value->url . '/' . $comment_value->person_image;
                                        } else {
                                            echo base_url() . 'image/no_profile_picture.png';
                                        }
                                        ?>" alt="logo">
                                    </a>
                                </div>
                                <!-----------------(4-a) END Comment User Image --------------------->


                                <!-----------------(4-b) Start Comment User Comments and Name --------------------->
                                <div class="media-body">
                                    <h5 class="media-heading green text-justify" style="font-size: 16px;">
                                        <a href="<?php echo base_url() . $comment_value->url . '/profile'; ?>">
                                            <?php
                                            //echo $comment_value->person_first_name . ' ' . $comment_value->person_last_name;
                                            if (strlen($comment_value->person_first_name) && strlen($comment_value->person_last_name) < 20) {
                                                echo $comment_value->person_first_name . ' ' . $comment_value->person_last_name;
                                            } else {
                                                echo substr($comment_value->person_first_name, 0, 30) . ' ' . substr($comment_value->person_last_name, 0, 20) . '...';
                                            }
                                            ?>
                                        </a>
                                    </h5>
                                    <p class="text-justify" id="comment_detail<?php echo $comment_value->comment_id ?>">
                                        <?php
                                        $function_name = 'viewDetails(&quot;' . base_url('post/view_post_details/' . $comment_value->comment_id . '/comment') . '&quot;,&quot;comment_detail&quot;,&quot;' . $comment_value->comment_id . '&quot;)';
                                        echo $this->tt_post->get_post_data($comment_value->comment_details, 100, $function_name);
                                        ?>
                                    </p>
                                </div>
                                <!-----------------(4-b) END Comment User Comments and Name --------------------->


                                <!-----------------Start View URL Details (if user Comment URL)------------------------>
                                <?php
                                if ($comment_url[$comment_value->comment_id]) {
                                    $url_value = explode("URL: ", $comment_url[$comment_value->comment_id]->post_comment_url_info);

                                    if (preg_match($you_tube_regExp, $url_value[1])) {
                                        ?>
                                        <div class="col-sm-4 col-xs-12 text-left">
                                            <div class="embed-responsive embed-responsive-16by9" >
                                                <iframe class="embed-responsive-item"  width="200" height="150" webkitallowfullscreen mozallowfullscreen allowfullscreen
                                                        src="<?php echo $url_value[1]; ?>">
                                                </iframe>
                                            </div>
                                        </div>
                                        <?php
                                    } else if (preg_match($vimo_regExp, $url_value[1])) {
                                        ?>
                                        <div class="col-sm-4 col-xs-12 text-left">
                                            <div class="embed-responsive embed-responsive-16by9" >
                                                <iframe class="embed-responsive-item" src="<?php echo $url_value[1]; ?>" 
                                                        width="200" height="150" 
                                                        frameborder="0" 
                                                        webkitallowfullscreen mozallowfullscreen allowfullscreen>
                                                </iframe>
                                            </div>       
                                        </div>       
                                        <?php
                                    } else {
                                        ?>
                                        <div class="col-sm-12 text-left" style="margin: -10px 0 0 40px; ">
                                            <div class="col-sm-12">
                                                <h5>
                                                    <a href="<?php echo $url_value[1]; ?>" target="_blank" style="color: #545457">
                                                        <?php echo $url_value[2]; ?>
                                                    </a>
                                                </h5>
                                            </div>
                                            <div class="col-sm-12" style="margin-top: -10px;">
                                                <p style="font-size: 12px;">
                                                    <a href="<?php echo $url_value[1]; ?>" target="_blank" style="color: #545457">
                                                        <?php echo $url_value[3]; ?>
                                                    </a>
                                                </p>
                                            </div>
                                            <div class="col-sm-12" style="margin-top: -10px;">
                                                <h6>
                                                    <?php
                                                    if ($url_value[1]) {
                                                        ?>
                                                        <a href="<?php echo $url_value[1]; ?>" target="_blank" style="color: #545457">
                                                            <?php echo $url_value[1]; ?>
                                                        </a>
                                                        <?php
                                                    }
                                                    if ($url_value[4] == '') {
                                                        echo '';
                                                    } else {
                                                        echo 'BY | ';
                                                        ?>
                                                        <a href="<?php echo $url_value[1]; ?>" target="_blank" style="color: #545457"><?php echo $url_value[4]; ?></a>
                                                        <?php
                                                    }
                                                    ?>
                                                </h6>
                                            </div>
                                        </div>
                                        <?php
                                    }
                                }
                                ?>
                                <!-----------------END View URL Details (if user Comment URL)------------------------>



                                <!-----------------(4-c) Start Comments action --------------------->
                                <div id="comment_like<?php echo $comment_value->comment_id; ?>">
                                    <div class="media-bottom mobile_dashboard_commentLike_margin_left_ten" style="margin-left: 75px" >
                                        <p class="text-justify" style="font-size: 14px;">

                                            <?php
                                            $post_comment_like_array = explode(",", $comment_value->comment_like_by);
                                            if (in_array($user_id, $post_comment_like_array)) {
                                                ?>
                                                <a href="javascript:void(0)" style="color:red"
                                                   onclick="getCommentLikeValue('<?php echo base_url() . 'post/add_comment_like/' . $comment_value->comment_id . '/' . $user_id . '/' . 'dislike'; ?>', '<?php echo $comment_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="getCommentLikeValue('<?php echo base_url() . 'post/add_comment_like/' . $comment_value->comment_id . '/' . $user_id . '/' . 'like'; ?>', '<?php echo $comment_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="replayWriteForm('<?php echo base_url() . 'post/add_replay_write_form/' . $comment_value->comment_id . '/' . $user_id; ?>', '<?php echo $comment_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_value->comment_reply_by == $user_id) {
                                                ?>
                                                - <a href="javascript:void(0)"
                                                     onclick="deleteComment('<?php echo base_url() . 'post/delete_post_comment' ?>', '<?php echo $comment_value->comment_id; ?>', '<?php echo $post_value->post_id ?>', 'comment')" >
                                                    <i class="fa fa-trash"  aria-hidden="true" title="Delete"></i>
                                                </a>
                                            <?php } ?>

                                            -<span>
                                                <?php
                                                $this->utility_model->time_format_for_read_write($comment_value->comment_date_time, $offset);
                                                ?>
                                            </span>
                                        </p>
                                    </div>
                                    <div class="text-left mobile_dashboard_commentLike_margin_left_ten" style="margin-left: 75px;">
                                        <?php
                                        if ($comment_value->comment_like_by != '') {
                                            $comment_like_value = $comment_value->comment_like_by;
                                            $this->cf->read_write_status($user_id, $comment_like_value, 'comment' . $comment_value->comment_id);
                                            $comment_like_id_array = explode(',', $comment_like_value);
                                            ?>
                                            <div id="viewLikeModal_comment<?php echo $comment_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($comment_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 ($comment_liked_person[$comment_value->comment_id] as $comment_person_value) {
                                                                            ?>
                                                                            <div class="media">
                                                                                <div class="media-left">
                                                                                    <?php if ($comment_person_value->person_image != '') {
                                                                                        ?>
                                                                                        <img class="media-object" src="<?php echo base_url() . 'content-library/' . $comment_person_value->url . '/' . $comment_person_value->person_image_thumb; ?>" 
                                                                                             alt="<?php echo $comment_person_value->person_first_name . ' ' . $comment_person_value->person_last_name ?>" style="width: 50px;height: 50px">
                                                                                             <?php
                                                                                         } else {
                                                                                             ?>
                                                                                        <img class="media-object" src="<?php echo base_url() . 'image/no_profile_picture.png'; ?>" 
                                                                                             alt="<?php echo $comment_person_value->person_first_name . ' ' . $comment_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 $comment_person_value->url ?>" target="_blank">
                                                                                            <?php echo $comment_person_value->person_first_name . ' ' . $comment_person_value->person_last_name ?>
                                                                                        </a>
                                                                                        <?php
                                                                                        if ($comment_person_value->person_id != $user_id) {
                                                                                            if (in_array($comment_person_value->person_id, $all_link)) {
                                                                                                
                                                                                            } else {
                                                                                                ?>
                                                                                                <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-c-i) Start Comments action --------------------->
                                    <div class="col-sm-12" 
                                         id="add_replay_write_form<?php echo $comment_value->comment_id; ?>" style="margin-left: 40px; display: none">
                                    </div>
                                    <!-----------------(4-c-i) Start Comments action --------------------->


                                </div>
                                <!-----------------(4-c) END Comments action --------------------->



                                <!------------------------------------(4-d) Start Comment Replay view----------------------------- -->
                                <div id="comment_replay<?php echo $comment_value->comment_id; ?>" class="padding-zero col-sm-12" >
                                    <?php
                                    $replay_comment_counter = 0;
                                    foreach ($comment_reply[$comment_value->comment_id] as $comment_replay_value) {
                                        ?>
                                        <div  class="col-sm-12"><hr></div>
                                        <div class="media col-sm-10 col-sm-offset-2" style="font-size: 14px">


                                            <!------------------------------------(4-d-i) Start Comment Replay User Image view----------------------------- -->

                                            <div class="media-left">
                                                <a href="<?php echo base_url() . $comment_replay_value->url . '/profile'; ?>">
                                                    <img class="media-object post_comment_image" 
                                                         src="<?php
                                                         if ($comment_replay_value->person_image) {
                                                             echo base_url() . 'content-library/' . $comment_replay_value->url . '/' . $comment_replay_value->person_image;
                                                         } else {
                                                             echo base_url() . 'image/no_profile_picture.png';
                                                         }
                                                         ?>" 
                                                         alt="logo">
                                                </a>
                                            </div>
                                            <!------------------------------------(4-d-i) END Comment Replay User Image view----------------------------- -->


                                            <!------------------------------------(4-d-ii) Start Comment Reply User Name and Reply view----------------------------- -->
                                            <div class="media-body">
                                                <h5 class="media-heading green text-justify" style="font-size: 16px;">
                                                    <a href="<?php echo base_url() . $comment_replay_value->url . '/profile'; ?>">
                                                        <?php
                                                        //echo $comment_replay_value->person_first_name . ' ' . $comment_replay_value->person_last_name; 
                                                        if (strlen($comment_replay_value->person_first_name) && strlen($comment_replay_value->person_last_name) < 20) {
                                                            echo $comment_replay_value->person_first_name . ' ' . $comment_replay_value->person_last_name;
                                                        } else {
                                                            echo substr($comment_replay_value->person_first_name, 0, 30) . ' ' . substr($comment_replay_value->person_last_name, 0, 20) . '...';
                                                        }
                                                        ?>
                                                    </a>
                                                </h5>
                                                <p class="text-justify" id="reply_comment_detail<?php echo $comment_replay_value->comment_id; ?>">
                                                    <?php
                                                    $function_name = 'viewDetails(&quot;' . base_url('post/view_post_details/' . $comment_replay_value->comment_id . '/reply') . '&quot;,&quot;reply_comment_detail&quot;,&quot;' . $comment_replay_value->comment_id . '&quot;)';
                                                    echo $this->tt_post->get_post_data($comment_replay_value->comment_details, 80, $function_name);
                                                    ?>
                                                </p>
                                            </div>
                                            <!------------------------------------(4-d-ii) END Comment Reply User Name and Reply view----------------------------- -->


                                            <!-----------------Start View URL Details (if user Comment Reply URL)------------------------>
                                            <?php
                                            if ($reply_comment_url[$comment_replay_value->comment_id]) {
                                                $url_value = explode("URL: ", $reply_comment_url[$comment_replay_value->comment_id]->post_comment_url_info);

                                                if (preg_match($you_tube_regExp, $url_value[1])) {
                                                    ?>
                                                    <div class="col-sm-4 col-xs-12 text-left">
                                                        <div class="embed-responsive embed-responsive-16by9"> 
                                                            <iframe class="embed-responsive-item" width="200" height="150" webkitallowfullscreen mozallowfullscreen allowfullscreen
                                                                    src="<?php echo $url_value[1]; ?>">
                                                            </iframe>
                                                        </div>
                                                    </div>
                                                    <?php
                                                } else if (preg_match($vimo_regExp, $url_value[1])) {
                                                    ?>
                                                    <div class="col-sm-4 col-xs-12 text-left">
                                                        <div class="embed-responsive embed-responsive-16by9">
                                                            <iframe class="embed-responsive-item" src="<?php echo $url_value[1]; ?>" 
                                                                    width="200" height="150" 
                                                                    frameborder="0" 
                                                                    webkitallowfullscreen mozallowfullscreen allowfullscreen>
                                                            </iframe>
                                                        </div>
                                                    </div>
                                                    <?php
                                                } else {
                                                    ?>
                                                    <div class="col-sm-12 text-left" style="margin: -10px 0 0 40px; ">
                                                        <div class="col-sm-12">
                                                            <h5>
                                                                <a href="<?php echo $url_value[1]; ?>" target="_blank" style="color: #545457">
                                                                    <?php echo $url_value[2]; ?>
                                                                </a>
                                                            </h5>
                                                        </div>
                                                        <div class="col-sm-12" style="margin-top: -10px;">
                                                            <p style="font-size: 12px; text-align: justify;">
                                                                <a href="<?php echo $url_value[1]; ?>" target="_blank" style="color: #545457">
                                                                    <?php echo $url_value[3]; ?>
                                                                </a>
                                                            </p>
                                                        </div>
                                                        <div class="col-sm-12" style="margin-top: -10px;">
                                                            <h6>
                                                                <?php
                                                                if ($url_value[1]) {
                                                                    ?>
                                                                    <a href="<?php echo $url_value[1]; ?>" target="_blank" style="color: #545457">
                                                                        <?php echo $url_value[1]; ?>
                                                                    </a>
                                                                    <?php
                                                                }
                                                                if ($url_value[4] == '') {
                                                                    echo '';
                                                                } else {
                                                                    echo 'BY | ';
                                                                    ?>
                                                                    <a href="<?php echo $url_value[1]; ?>" target="_blank" style="color: #545457"><?php echo $url_value[4]; ?></a>
                                                                    <?php
                                                                }
                                                                ?>
                                                            </h6>
                                                        </div>
                                                    </div>
                                                    <?php
                                                }
                                            }
                                            ?>
                                            <!-----------------END View URL Details (if user Comment Reply URL)------------------------>



                                            <!------------------------------------(4-d-iii) Start Comment Reply User Name and Reply view----------------------------- -->
                                            <div id="reply_comment_like<?php echo $comment_replay_value->comment_id ?>" class="padding-zero">
                                                <div class="media-bottom mobile_dashboard_commentLike_margin_left_ten" style="margin-left: 55px" >
                                                    <p class="text-justify">   

                                                        <?php
                                                        $comment_reply_like_array = explode(",", $comment_replay_value->comment_like_by);
                                                        if (in_array($user_id, $comment_reply_like_array)) {
                                                            ?>
                                                            <a href="javascript:void(0)" style="color:red"
                                                               onclick="getReplyLikeValue('<?php echo base_url() . 'post/add_comment_reply_like/' . $comment_replay_value->comment_id . '/' . $user_id . '/' . 'dislike'; ?>', '<?php echo $comment_replay_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_replay_value->comment_id . '/' . $user_id . '/' . 'like'; ?>', '<?php echo $comment_replay_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_replay_value->comment_id . '/' . $user_id; ?>', '<?php echo $comment_replay_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_value->comment_reply_by == $user_id || $comment_replay_value->comment_reply_by == $user_id) {
                                                            ?>
                                                            - <a href="javascript:void(0)"
                                                                 onclick="deleteComment('<?php echo base_url() . 'post/delete_comment_reply' ?>', '<?php echo $comment_replay_value->comment_id; ?>', '<?php echo $comment_value->comment_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_replay_value->comment_date_time, $offset);
                                                            ?>
                                                        </span> 
                                                    </p>
                                                </div>
                                                <div class="text-justify padding-top-zero mobile_dashboard_commentLike_margin_left_ten" style="margin-left: 55px;">
                                                    <?php
                                                    if ($comment_replay_value->comment_like_by != '') {
                                                        $reply_like_value = $comment_replay_value->comment_like_by;
                                                        $this->cf->read_write_status($user_id, $comment_replay_value->comment_like_by, 'reply' . $comment_replay_value->comment_id);
                                                        $reply_like_id_array = explode(',', $reply_like_value);
                                                        ?>
                                                        <div id="viewLikeModal_reply<?php echo $comment_replay_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[$comment_replay_value->comment_id] 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_thumb; ?>" 
                                                                                                         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/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; display: none"
                                                     id="add_nested_reply_form<?php echo $comment_replay_value->comment_id; ?>" >
                                                </div>
                                                <div style="display: none"
                                                     id="view_saaved_nested_replies<?php echo $comment_replay_value->comment_id; ?>" >
                                                </div>
                                                <!------------------------------------(4-d-iii-1) END Comment Nested Reply Form----------------------------- -->



                                            </div>
                                            <!------------------------------------(4-d-iii) END Comment Reply User Name and Reply view----------------------------- -->


                                            <!------------------------------------(4-d-iv) Start view replies----------------------------- -->
                                            <div id="view_nested_replies<?php echo $comment_replay_value->comment_id; ?>">

                                                <?php
                                                $nested_comment_counter = 0;
                                                if ($total_nested_reply[$comment_replay_value->comment_id]->total_comment > 0 && $total_nested_reply[$comment_replay_value->comment_id]->total_comment != $nested_comment_counter) {
                                                    ?>
                                                    <div class="col-sm-12 text-left" style="margin-left: 40px;">
                                                        <a href="javascript:void(0)"
                                                           onclick="viewNestedReplies('<?php echo base_url() . 'post/view_nested_replies/' . $comment_replay_value->comment_id . '/' . $nested_comment_counter; ?>', '<?php echo $comment_replay_value->comment_id; ?>')" >
                                                            view replies
                                                        </a>
                                                    </div>
                                                <?php } ?>
                                            </div>
                                            <!------------------------------------(4-d-iv) End view replies----------------------------- -->


                                        </div>

                                        <?php
                                        $replay_comment_counter++;
                                    }
                                    if ($total_comment_reply[$comment_value->comment_id]->total_comment > $replay_comment_counter) {
                                        ?>
                                        <div class="col-sm-12 text-left" style="margin-left: 120px;">
                                            <br>
                                            <a href="javascript:void(0)"
                                               onclick="viewMoreReply('<?php echo base_url() . 'post/view_more_reply/' . $comment_value->comment_id . '/' . $replay_comment_counter; ?>', '<?php echo $comment_value->comment_id; ?>')" >
                                                view more reply
                                            </a>
                                        </div>
                                    <?php } ?>
                                </div>
                                <!---------------------------------------(4-d)END Comment Replay view----------------------------- -->


                            </div>
                            <?php
                            $count_comments++;
                        }
                        ?>



                        <!------------------------(4-e)View Writes Counter-------------------------------->
                        <?php
//                                        echo $total_comment[$post_value->post_id]->total_comment .'---'. $count_comments;
                        if ($total_comment[$post_value->post_id]->total_comment > $count_comments) {
                            ?>
                            <div class="col-sm-12 text-left" style="margin-left: 120px;">
                                <br>
                                <a href="javascript:void(0)"
                                   onclick="viewWrites('<?php echo base_url() . 'post/view_writes/' . $post_value->post_id . '/' . $count_comments; ?>', '<?php echo $post_value->post_id; ?>')" >
                                    view writes
                                </a>
                            </div>
                        <?php } ?>
                        <!------------------------(4-e)View Writes Counter-------------------------------->
                    </div>
                    <!------------------- (4) END User Post all Comment action -------------------------->
                </div>
            </div>
        </div>
        <!------------------- Delete post model-------------------------->
        <div class="modal" style="" id="deletePost<?php echo $post_value->post_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
            <?php
            $function_name2 = 'deletePost(&quot;' . base_url('post/delete_post') . '&quot;,&quot;' . $post_value->post_id . '&quot;,&quot;1&quot;)';
            $message2 = '<span style="text-align:left !important;">Are you sure you want to delete this post?</span>';
            $this->cf->get_status_modal($function_name2, $message2);
            ?>
        </div>
        <!------------------- Delete post model-------------------------->

        <!--</div> /.row gray -->
    </div>
</div>
<script>
    showCommentViewUrl = '<?php echo base_url(); ?>post/show_view_url/comment';
</script>

<script src="<?php echo base_url('resource_library/js-video-player/plyr.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url() ?>front_end_resource/dashboard/home.js"></script>