Beispiel #1
0
function displayComments($video, $parent, $i)
{
    $comments = $video->getComments($parent);
    if (empty($comments)) {
        ?>
					<p>Aucun commentaire à propos de cette video</p>
				<?php 
    }
    foreach ($comments as $comment) {
        $comment->comment = Utils::makeLinks(Utils::secure($comment->comment));
        $margin = $i * 8;
        ?>
					<div style="width: <?php 
        echo 100 - $margin;
        ?>
%; margin-left:<?php 
        echo $margin;
        ?>
%" class="comment" id="c-<?php 
        echo $comment->id;
        ?>
">
						<div class="comment-head">
							<div class="user">
								<img src="<?php 
        echo UserChannel::find($comment->poster_id)->getAvatar();
        ?>
" alt="[Avatar]">
								<a href="<?php 
        echo WEBROOT . 'channel/' . UserChannel::find($comment->poster_id)->name;
        ?>
"><?php 
        echo UserChannel::getNameById($comment->poster_id);
        ?>
</a>
							</div>
							<div class="date">
								<p><?php 
        echo Utils::relative_time($comment->timestamp);
        echo $comment->last_updated_timestamp ? ' (Edité ' . Utils::relative_time($comment->last_updated_timestamp) . ')' : '';
        ?>
</p>
							</div>
						</div>
						<div class="comment-text">
							<p style="word-wrap:break-word"><?php 
        echo $comment->comment;
        ?>
</p>
						</div>
						<div class="comment-notation">
							<ul>
								<li class="plus" id="plus-<?php 
        echo $comment->id;
        ?>
" onclick="likeComment('<?php 
        echo $comment->id;
        ?>
')">+<?php 
        echo $comment->likes;
        ?>
</li>
								<li class="moins" id="moins-<?php 
        echo $comment->id;
        ?>
" onclick="dislikeComment('<?php 
        echo $comment->id;
        ?>
')">-<?php 
        echo $comment->dislikes;
        ?>
</li>
								<li onclick="reportComment('<?php 
        echo $comment->id;
        ?>
', this)" style="cursor:pointer">Signaler</li>
								<li onclick="document.location.href='#comments';document.getElementById('response').innerHTML='<b>Répondre à <?php 
        echo UserChannel::getNameById($comment->poster_id);
        ?>
 :</b>';document.getElementById('textarea-comment').focus();document.getElementById('parent-comment').value='<?php 
        echo $comment->id;
        ?>
';" style="cursor:pointer">Répondre</li>
								<?php 
        if (Session::isActive() && (Session::get()->isModerator() || Session::get()->isAdmin() || $comment->getAuthor()->belongToUser(Session::get()->id))) {
            ?>
								
								<li onclick="editComment('<?php 
            echo $comment->id;
            ?>
', this)" style="cursor:pointer">Editer</li>
								<?php 
        }
        ?>
								<?php 
        if (Session::isActive() && (Session::get()->isModerator() || Session::get()->isAdmin() || $video->getAuthor()->belongToUser(Session::get()->id) || $comment->getAuthor()->belongToUser(Session::get()->id))) {
            ?>
								<li onclick="deleteComment('<?php 
            echo $comment->id;
            ?>
', this)" style="cursor:pointer">Supprimer</li>
								<?php 
        }
        ?>
							</ul>
						</div>
					</div>
			<?php 
        if (Comment::count(array('conditions' => array('parent = ?', $comment->id))) >= 1) {
            displayComments($video, $comment->id, $i + 1);
        }
    }
}
Beispiel #2
0
					<br><br>
				</div>
			<?php 
    }
    ?>

			<?php 
    if ($action->type == 'comment' && Utils::relative_time($action->timestamp)) {
        ?>
				<div>
					<p>
						<a href="<?php 
        echo WEBROOT . 'channel/' . $action->channel_id;
        ?>
"><?php 
        echo UserChannel::getNameById($action->channel_id);
        ?>
</a>
						a commenté votre vidéo <a href="<?php 
        echo WEBROOT . 'watch/' . $action->target;
        ?>
"><?php 
        echo Video::find($action->target)->title;
        ?>
:</a>
						<p>"<?php 
        echo Comment::getByChannelAction($action)->comment;
        ?>
"</p>

					</p>
Beispiel #3
0
    public static function getVideoCardHTML($vid, $card_new = "")
    {
        return '<div class="card video' . $card_new . '">
				<div class="thumbnail bg-loader" data-background-load-in-view data-background="' . $vid->getThumbnail() . '">
					<div class="time">' . self::sec2ms($vid->duration) . '</div>
					<a href="' . WEBROOT . 'watch/' . $vid->id . '" class="overlay"></a>
				</div>
				<div class="description">
					<a href="' . WEBROOT . 'watch/' . $vid->id . '"><h4>' . $vid->title . '</h4></a>
					<div>
						<span class="view">' . number_format($vid->views) . '</span>
						<a class="channel" href="' . WEBROOT . 'channel/' . UserChannel::find($vid->poster_id)->name . '">' . UserChannel::getNameById($vid->poster_id) . '</a>
					</div>
				</div>
			</div>';
    }