<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<?php $this->load->view('network/user/profile_page_header', ['active' => 'profile']) ?>
<section id="profile-content" data-type="foreground" data-speed="10">
    <div class="container">
        <div class="row">
            <?php $this->load->view('network/user/user_profile_card') ?>
            <div class="col-xs-12 col-sm-12 col-md-8 col-lg-8" id="profile-content-container">
                <?php if (!empty($posts)): ?>
                    <a href="<?= base_url('user/' . $data['username'] . '/posts') ?>">
                        <h1 class="section-title"><?= lang('profile_posts') ?></h1>
                    </a>
                    <ul class="comment-list">
                        <?php foreach ($posts as $post) {
                            $this->load->view('network/posts/post_item', $post);
                        } ?>
                    </ul>
                    <a href="<?= base_url('user/' . $data['username'] . '/posts') ?>"
                       class="btn btn-primary round outline read-all-btn">
                        <?= lang('profile_view_posts') ?>
                    </a>
                <?php endif;
                if (!empty($comments)): ?>
                    <hr>
                    <a href="<?= base_url('user/' . $data['username'] . '/comments') ?>">
                        <h1 class="section-title"><?= lang('profile_blog_comments') ?></h1>
                    </a>
                    <ul class="comment-list">
                        <?php foreach ($comments as $c) {
                            $this->load->view('network/blog/comment_item', ['data' => $data, 'c' => $c]);
                        } ?>
                    </ul>
                    <a href="<?= base_url('user/' . $data['username'] . '/comments') ?>"
                       class="btn btn-primary round outline read-all-btn">
                        <?= lang('profile_view_blog_comments') ?>
                    </a>
                <?php endif;
                if (!empty($blog_posts)): ?>
                    <hr>
                    <a href="<?= base_url('user/' . $data['username'] . '/blogposts') ?>">
                        <h1 class="section-title"><?= lang('profile_blog_posts') ?></h1>
                    </a>
                    <ul class="comment-list">
                        <?php foreach ($blog_posts as $post) {
                            $this->load->view('network/blog/blog_post_item', ['data' => $data, 'post' => $post]);
                        } ?>
                    </ul>
                    <a href="<?= base_url('user/' . $data['username'] . '/blogposts') ?>"
                       class="btn btn-primary round outline read-all-btn">
                        <?= lang('profile_view_blog_posts') ?>
                    </a>
                <?php endif; ?>
            </div>
        </div>
    </div>
</section>