Exemple #1
0
    }
    Page::goAlbum($album_id);
}
# Process grade comment
/**
 *
 * @author Antoine De Gieter
 *
 */
if (isset($_SESSION['online']) && (isset($_POST['agree']) || isset($_POST['disagree'])) && isset($_POST['userComment']) && isset($_POST['songComment'])) {
    $agreement = isset($_POST['agree']) ? 1 : 0;
    $user = $_SESSION['user']->getId();
    $userComment = $_POST['userComment'];
    $songComment = $_POST['songComment'];
    if ($user != $userComment) {
        GradeComment::create($user, $userComment, $songComment, $agreement);
    }
}
# Process notarize artist
/**
 *
 * @author Antoine De Gieter
 *
 */
if (isset($_SESSION['online']) && (isset($_POST['agree']) || isset($_POST['disagree'])) && isset($_POST['cause']) && isset($_POST['artist'])) {
    $agreement = isset($_POST['disagree']) ? 0 : 1;
    $user = $_SESSION['user']->getId();
    $artist = $_GET['id'];
    $cause = $_POST['cause'];
    $cause = $agreement == 1 ? 7 : $cause;
    NotarizeArtist::create($user, $artist, $agreement, $cause);
			<p>
				<small class="text-clouds"><?php 
    print $comment->getDate()->format("d/m/Y H:i");
    ?>
</small>
			</p>
			<p>
				<?php 
    print nl2br($comment);
    ?>
			</p>
		</blockquote>

		<?php 
    $totalGradeComment = GradeComment::countAgreeByComment($comment->getUser()->getId(), $comment->getSong()->getId()) + GradeComment::countDisagreeByComment($comment->getUser()->getId(), $comment->getSong()->getId());
    $agreePercent = $totalGradeComment !== 0 ? 100 * GradeComment::countAgreeByComment($comment->getUser()->getId(), $comment->getSong()->getId()) / $totalGradeComment : 50;
    $disagreePercent = 100 - $agreePercent;
    ?>

		<div class="progress" style="height:6px;margin-bottom :10px;">
			<div class="progress-bar progress-bar-success" style="width: <?php 
    print $agreePercent;
    ?>
%"></div>
			<div class="progress-bar progress-bar-danger" style="width: <?php 
    print $disagreePercent;
    ?>
%"></div>
		</div>
	</div>