<?php $this->setLayout('account'); ?>

<h1><?=Language::getText('my_videos_header')?></h1>

<?php if ($message): ?>
    <div class="message <?=$message_type?>"><?=$message?></div>
<?php endif; ?>

<?php if (count($userVideos) > 0): ?>

    <div class="videos_list">
    <?php foreach($userVideos as $video): ?>

        <div class="video">
            <?php if (in_array($video->status, array(VideoMapper::PENDING_CONVERSION, 'processing', VideoMapper::PENDING_APPROVAL))): ?>
                <div><img width="165" height="92" src="<?=$this->options->themeUrl?>/images/video_construction.png" /></div>
                <p><strong><?=Language::getText($video->status)?></strong> - <?php echo htmlspecialchars($video->title); ?></p>
            <?php else: ?>
                <div class="thumbnail">
                    <a href="<?=$this->getService('Video')->getUrl($video)?>/" title="<?php echo htmlspecialchars($video->title); ?>">
                        <img width="165" height="92" src="<?=$config->thumbUrl?>/<?=$video->filename?>.jpg" />
                    </a>
                    <?php $playlistId = ($loggedInUser) ? $this->getService('Playlist')->getUserSpecialPlaylist($loggedInUser, \PlaylistMapper::TYPE_WATCH_LATER)->playlistId : ''; ?>
                    <span class="watchLater"><a data-video="<?=$video->videoId?>" data-playlist="<?=$playlistId?>" href="" title="<?=Language::GetText('watch_later')?>"><?=Language::GetText('watch_later')?></a></span>
                    <span class="duration"><?=$video->duration?></span>
                </div>
                <p><a href="<?=$this->getService('Video')->getUrl($video)?>/" title="<?php echo htmlspecialchars($video->title); ?>"><?php echo htmlspecialchars($video->title); ?></a></p>
            <?php endif; ?>
            <p class="actions small">
                <a href="<?=HOST?>/account/videos/edit/<?=$video->videoId?>/" title="<?=Language::getText('edit_video')?>"><span><?=Language::getText('edit_video')?></span></a>
                <a class="right confirm" data-node="confirm_delete_video" href="<?=HOST?>/account/videos/<?=$video->videoId?>/" title="<?=Language::getText('delete_video')?>"><span><?=Language::getText('delete_video')?></span></a>
            </p>
        </div>

    <?php endforeach; ?>
    </div>

    <?=$pagination->paginate()?>

<?php else: ?>
    <p><strong><?=Language::getText('no_user_videos')?></strong></p>
<?php endif; ?>