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

<?php
$i = 0;
if ($person_link) {
    foreach ($person_link as $v_person_link) {
        if ($link_person_info[$v_person_link->person_link_id]->person_id == $person_id) {
            
        } else {
            if ($link_person_info[$v_person_link->person_link_id]) {
                ?>
                <div id="sActions<?php echo $v_person_link->person_link_id; ?>">
                    <div class="col-sm-6  white form-group " style="height: 170px">
                        <div class="col-sm-12 padding-zero text-right">
                            <?php if ($v_person_link->add_link_request_status == 1) { ?>
                                <a href="javascript:void(0)" 
                                   onclick="return checkForLinkAction('<?php echo base_url() . 'remove-link/' . $link_person_info[$v_person_link->person_link_id]->person_id; ?>', 'Remove Link', ' Do you want to Remove Link', '<?php echo $v_person_link->person_link_id; ?>')">
                                    <i class="fa fa-unlink" title="Remove From Link"></i>
                                </a>&nbsp;&nbsp;&nbsp;

                                <a href="javascript:void(0)"
                                   onclick="return checkForLinkAction('<?php echo base_url() . 'block-link/' . $link_person_info[$v_person_link->person_link_id]->person_id; ?>', 'Block Person', ' Do you want to Block Person', '<?php echo $v_person_link->person_link_id; ?>')"> 
                                    <i class="fa fa-ban" title="Block Person"></i>
                                </a>&nbsp;&nbsp;&nbsp;

                                <?php
                            } else if ($v_person_link->add_link_request_status == 3) {
                                if ($v_person_link->person_id == $person_id) {
                                    ?>  

                                    <a href="javascript:void(0)"
                                       onclick="return checkForLinkAction('<?php echo base_url() . 'accept-link/' . $link_person_info[$v_person_link->person_link_id]->person_id; ?>', 'Accept Request', ' Do you want to Accept Request', '<?php echo $v_person_link->person_link_id; ?>')"> 
                                        <i class="fa fa-check-circle" title="Accept Request"></i>
                                    </a>&nbsp;&nbsp;&nbsp;

                                    <a href="javascript:void(0)"
                                       onclick="return checkForLinkAction('<?php echo base_url() . 'cancel-link/' . $link_person_info[$v_person_link->person_link_id]->person_id; ?>', 'Cancel Request', ' Do you want to Cancel Request', '<?php echo $v_person_link->person_link_id; ?>')"> 
                                        <i class="fa fa-user-times" title="Cancel Request"></i>
                                    </a>&nbsp;&nbsp;&nbsp;

                                    <a href="javascript:void(0)"
                                       onclick="return checkForLinkAction('<?php echo base_url() . 'block-link/' . $link_person_info[$v_person_link->person_link_id]->person_id; ?>', 'Block Person', ' Do you want to Block Person', '<?php echo $v_person_link->person_link_id; ?>')"> 
                                        <i class="fa fa-ban" title="Block Person"></i>
                                    </a>&nbsp;&nbsp;&nbsp;

                                <?php } else { ?>

                                    <a href="javascript:void(0)"
                                       onclick="return checkForLinkAction('<?php echo base_url() . 'cancel-link/' . $link_person_info[$v_person_link->person_link_id]->person_id; ?>', 'Cancel Request', ' Do you want to Cancel Request', '<?php echo $v_person_link->person_link_id; ?>')">
                                        <i class="fa fa-user-times" title="Cancel Request"></i>
                                        <!--<span class="span-text">Cancel Request</span>-->
                                    </a>&nbsp;&nbsp;

                                    <a href="javascript:void(0)"
                                       onclick="return checkForLinkAction('<?php echo base_url() . 'block-link/' . $link_person_info[$v_person_link->person_link_id]->person_id; ?>', 'Block Person', ' Do you want to Block Person', '<?php echo $v_person_link->person_link_id; ?>')"> 
                                        <i class="fa fa-ban" title="Block Person"></i>
                                    </a>&nbsp;&nbsp;&nbsp;

                                    <?php
                                }
                            }
                            ?>

                        </div>


                        <div class="col-sm-4 padding-zero">
                            <a href="<?php echo base_url() . $link_person_info[$v_person_link->person_id]->url . '/profile'; ?>">
                                <?php if ($link_person_info[$v_person_link->person_link_id]->person_image_thumb) { ?>
                                    <img src="<?php echo base_url() . 'content-library/' . $link_person_info[$v_person_link->person_link_id]->url . '/' . $link_person_info[$v_person_link->person_link_id]->person_image_thumb; ?>" 
                                         style="width:100px; height:100px;"  class="img-responsive">
                                     <?php } else { ?>
                                    <img src="<?php echo base_url() . 'image/no_profile_picture.png' ?>" style="width:100px; height:100px;" class="img-responsive">
                                <?php } ?>
                            </a>
                        </div>
                        <div class="col-sm-8 padding-zero text-left">
                            <address class="margin-zero">
                                <div class="col-sm-12">
                                    <?php
                                    if ($person_work_experience[$v_person_link->person_link_id]) {
                                        echo $person_work_experience[$v_person_link->person_link_id]->designation;
                                    } else if ($person_education[$v_person_link->person_link_id]) {
                                        echo 'Student';
                                    }
                                    ?>
                                </div>
                                <div class="col-sm-12">
                                    <?php
                                    if ($person_work_experience[$v_person_link->person_link_id]) {
                                        echo $person_work_experience[$v_person_link->person_link_id]->company_name;
                                    } else if ($person_education[$v_person_link->person_link_id]) {
                                        echo $person_education[$v_person_link->person_link_id]->education_institute_name;
                                    }
                                    ?>
                                </div>
                            </address>
                        </div>
                        <div class="col-sm-12 padding-zero text-left">
                            <div class="col-sm-12">
                                <a href="<?php echo base_url() . $link_person_info[$v_person_link->person_link_id]->url . '/profile'; ?>"> 
                                    <?php echo $link_person_info[$v_person_link->person_link_id]->person_first_name . ' ' . $link_person_info[$v_person_link->person_link_id]->person_last_name; ?>
                                </a>
                            </div>
                        </div> 
                    </div>
                </div>

                <?php
            }
        }
    }
} else {
    echo "There is not any link in your network";
}
?>

