Пример #1
0
<?php

    use Moood\helpers\Utils;
    use Moood\DBLayer;
    use Moood\User\Playlist;

    $ROOT_PATH = $_SERVER['DOCUMENT_ROOT'];
    include_once $ROOT_PATH . '/src/bootstrap.php';

    // Execute action if any
    $actions = new Playlist();
    $actions->processRequest();

    /**
     * This file will print out the playlist songs so user can choose from the list
     */
    if (!isset($_REQUEST['songs'])) {
        return;
    }

    echo '<h1><span class="skew">' . Utils::getParam('name') . '</span></h1>';

    // Get the playlist content
    $songs = $_REQUEST['songs'];

    // Get the playlist HTML code

    // Print out the playlist
    foreach ($songs as $song) {
        ?>
    <div class="spacer"></div>
/**
 * This view will display the user playlist.
 * The code in this file is not mapped to any class since this file is
 * user to display the playlist data.     *
 */
use Moood\helpers\Utils;
use Moood\DBLayer;
use Moood\User\Playlist;
$ROOT_PATH = $_SERVER['DOCUMENT_ROOT'];
include_once $ROOT_PATH . '/src/bootstrap.php';
// Check if we have errors or not
$error = isset($_REQUEST['error']) ? $_REQUEST['error'] : null;
$errorClass = isset($error) ? '' : 'hidden';
// The playlist is the handler class for this view
$playlist = new Playlist();
// Process any request action if any.
$playlist->processRequest();
//Load the playlist for the current user
$user = $_SESSION['user'];
$dbLayer = DBLayer::getInstance();
// Load the playlist data
$records = $dbLayer->executeQuery('users.playlist.summary', array(':user_id' => $_SESSION['userId']));
// Verify that the user has data.
// If no data found we display a message telling the user to create new playlist.
if (!isset($records) || count($records) == 0) {
    echo '<div class="empty">You did not created any playlist yet.<br/>Use the above button to do so.</div>';
    return;
}
?>
<div class="spacer"></div>