<?php
$this->css($this->assetModule('front/front.css'));
$this->headMeta('noindex', 'robots');

$userSection = $this->isUserSection(Pi::service('module')->current());

?>

<div class="row user-section-wrapper">
    <?php if ($userSection) : ?>
        <div class="col-md-3">
            <?php include $this->template('./profile-sidebar.phtml'); ?>
        </div>
    <?php endif; ?>
    <div class="<?php echo $userSection ? 'col-md-9' : 'col-md-12' ?>">
        <?php include $this->template('flash-messenger'); ?>

        <?php if (!$view) { ?>
            <div class="page-header">
                <h1><?php _e('My profile'); ?></h1>
            </div>
        <?php } ?>

        <?php include $this->template('./profile-topbar.phtml'); ?>
        <div class="user-min-body">
            <p>&nbsp;</p>
            <?php if ($timeline) { ?>
                <?php foreach ($timeline as $item) { ?>
                    <div class="timeline user-underline-list">
                        <div class="float-left">
                            <?php
                            echo !empty($item['icon']) ? '<i class="fa ' . $item['icon'] . ' fa-4x"></i>' : '<i class="fas fa-comment fa-4x"></i>';
                            ?>
                        </div>
                        <div class="media-body">
                            <div class="media-heading">
                                <strong class="user-media-name"><?php echo _escape($user['name']); ?></strong>
                                <span class="text-muted"><?php echo _date($item['time']); ?></span>
                            </div>
                            <div class="media-heading">
                                <?php echo _escape($item['message']); ?>
                            </div>
                            <?php
                            if ($item['link']) {
                                echo sprintf('<a href="%s" target="_blank">%s</a>',
                                    $item['link'],
                                    $item['link']);
                            }
                            ?>
                        </div>
                    </div>
                <?php } ?>
                <?php
                if ($paginator) {
                    echo $this->paginationControl($paginator, 'Sliding', 'paginator.phtml', ['class' => 'pagination-left']);
                }
            } else { ?>
                <div class="card bg-light mb-3">
                    <?php _e('No data available.'); ?>
                </div>
            <?php } ?>
        </div>
    </div>
</div>

