<?php
$this->addMeta('videoCount', $videoCount);
$this->addMeta('playlistCount', $playlistCount);
$this->addMeta('thumbUrl', $config->thumbUrl);
if (!empty($watchLaterPlaylistId)) $this->addMeta('watchLaterPlaylistId', $watchLaterPlaylistId);
?>

<h1><?=$member->username?></h1>

<div class="message"></div>

<!-- BEGIN Member Avatar/Profile Information -->
<div id="profile_avatar">
    <?php $avatar = $this->getService('User')->getAvatarUrl($member); ?>
    <img src="<?=($avatar) ? $avatar : $this->options->themeUrl . '/images/avatar.gif'?>" alt="<?=$member->username?>" />
    <p><a class="button_small subscribe" data-user="<?=$member->userId?>" data-type="<?=$subscribe_text?>" href=""><?=Language::GetText($subscribe_text)?></a></p>
</div>
<div id="profile_info">
    <p>
        <a href="<?=HOST?>/account/message/send/<?=$member->username?>/" title="<?=Language::GetText('send_message')?>"><?=Language::GetText('send_message')?></a>&nbsp;&nbsp;&nbsp;
        <a class="flag" data-type="user" data-id="<?=$member->userId?>" href="" title="<?=Language::GetText('report_abuse')?>"><?=Language::GetText('report_abuse')?></a>&nbsp;&nbsp;&nbsp;
    </p>
    <p><strong><?=Language::GetText('joined')?>:</strong>&nbsp; <?=date('m/d/Y', strtotime($member->dateCreated))?></p>
    <p><strong><?=Language::GetText('profile_views')?>:</strong>&nbsp; <?=$member->views?></p>
    <p><strong><?=Language::GetText('subscribers')?>:</strong>&nbsp; <?php echo $sub_count[0]; ?></p>
    <?php if (!empty ($member->website)): ?>
        <p><strong><?=Language::GetText('website')?>:</strong>&nbsp;
        <a href="<?=$member->website?>" target="_blank" rel="nofollow"><?=Functions::CutOff ($member->website, 40);?></a></p>
    <?php endif; ?>
    <p><?php echo nl2br(htmlspecialchars($member->aboutMe)); ?></p>
</div>
<!-- END Member Avatar/Profile Information -->

<div class="tabs keepOne">
    <a href="" data-block="member-videos" title="<?=Language::GetText('videos')?>"><?=Language::GetText('videos')?></a>
    <a href="" data-block="member-playlists" title="<?=Language::GetText('playlists')?>"><?=Language::GetText('playlists')?></a>
</div>

<!-- BEGIN Member's Videos -->
<div id="member-videos" class="tab_block" style="display:block;">
    <p class="large"><?=Language::GetText('videos')?></p>
    <?php if ($videoCount > 0): ?>
        <div class="videos_list">
            <?php $this->RepeatingBlock('video.phtml', $videoList) ?>
        </div>
        <?php if ($videoCount > 9): ?>
            <p><a href="" data-user="<?=$member->userId?>" data-limit="9" class="button_small loadMore"><?=Language::GetText('load_more')?></a></p>
        <?php endif ?>
    <?php else: ?>
        <p><strong><?=Language::GetText('no_member_videos')?></strong></p>
    <?php endif; ?>
</div>
<!-- END Member's Videos -->

<!-- BEGIN Member's Playlists -->
<div id="member-playlists" class="tab_block">
    <p class="large"><?=Language::GetText('playlists')?></p>
    <?php if ($playlistCount > 0): ?>
        <div class="playlist-list">
            <?php $playlistService = new PlaylistService(); ?>
            <?php foreach ($playlist_list as $playlist): ?>
                <div class="playlist <?=(empty($playlist->entries)) ? 'playlist-empty' : ''?>">
                    <?php if (!empty($playlist->entries)): ?>
                        <a href="<?=$playlistService->getUrl($playlist)?>" title="<?php echo htmlspecialchars($playlist->name); ?>">
                            <img width="165" height="92" src="<?=getPlaylistThumbnail($playlist)?>" />
                            <span class="video-count"><?=count($playlist->entries)?><br><?=Language::GetText('videos')?></span>
                            <span class="watch-all">Watch<br>All</span>
                        </a>
                        <p class="title"><a href="<?=$playlistService->getUrl($playlist)?>" title="<?php echo htmlspecialchars($playlist->name); ?>"><?php echo htmlspecialchars($playlist->name); ?></a></p>
                    <?php else: ?>
                        <img src="<?=$this->options->themeUrl?>/images/playlist_placeholder.png" />
                        <span class="video-count"><?=count($playlist->entries)?><br><?=Language::GetText('videos')?></span>
                        <p class="title"><?=$playlist->name?></p>
                    <?php endif; ?>
                </div>
            <?php endforeach; ?>
        </div>
        <?php if ($playlistCount > 9): ?>
            <p><a href="" data-user="<?=$member->userId?>" data-limit="9" class="button_small loadMore"><?=Language::GetText('load_more')?></a></p>
        <?php endif ?>
    <?php else: ?>
        <p><strong><?=Language::GetText('no_member_playlists')?></strong></p>
    <?php endif; ?>
</div>
<!-- END Member's Playlists -->