/**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Playlists the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Playlists::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #2
0
?>
    </div>

    <div class="row">
    <?php 
if (!$model->isNewRecord) {
    echo $form->labelEx($model, 'channels');
    printf("<div id='channelsList'>");
    $playlistsToPoint = $model->playlistToPoint;
    for ($ii = 1; $ii <= 3; $ii++) {
        printf("<div class='ChannelsContainer btn-toolbar' data-channelid='%s' role='toolbar' aria-label=''>", $ii);
        printf("<div class='btn-group' role='group' aria-label=''>" . "<button type='button' class='btn btn-default ChannelButt'>" . "Channel %s </button>" . "<button type='button' class='AddPlaylistsBut btn btn-info' data-channelid='%s'>" . "<span class='glyphicon glyphicon-plus'></span> Add playlists" . "</button></div>", $ii, $ii);
        $channelPlaylists = [];
        foreach ($playlistsToPoint as $pl) {
            if ($pl->channel_type == $ii) {
                $channelPlaylists[] = Playlists::model()->findByPk($pl->id_playlist);
            }
        }
        if (count($playlistsToPoint) > 0) {
            echo "<div class='btn-group' role='group' aria-label=''>";
        }
        foreach ($channelPlaylists as $pl) {
            printf("<button type='button' class='PlaylistLinks btn btn-default' " . "data-plid='%s'>%s</button>", $pl['id'], CHtml::link($pl['name'], array('playlists/' . $pl['id'])));
            printf("<button type='button' class='RemovePlaylist btn btn-danger' " . "data-plidtoremove='%s' " . "data-channelidpltoremove='%s' " . ">x</button>", $pl['id'], $ii);
        }
        if (count($playlistsToPoint) > 0) {
            echo "</div>";
        }
        echo "</div>";
    }
    printf("</div>");
<!-- Modal -->
<div id="dialog" title="Add playlist on channel">
  <p>
  <?php 
$userName = Yii::app()->user->name;
$pls = Playlists::model()->findAll(array("condition" => "author = '{$userName}'", "order" => "id"));
$attributeLabels = Playlists::model()->attributeLabels();
if (count($pls) > 0) {
    echo '<table class="table table-hover">';
    echo '<tr>';
    echo '<td></td>';
    echo '<td>' . $attributeLabels['name'] . '</td>';
    echo '<td>' . $attributeLabels['fromDatetime'] . '</td>';
    echo '<td>' . $attributeLabels['toDatetime'] . '</td>';
    echo '<td>' . $attributeLabels['fromTime'] . '</td>';
    echo '<td>' . $attributeLabels['toTime'] . '</td>';
    echo '<td>' . $attributeLabels['weekDays'] . '</td>';
    echo '</tr>';
    foreach ($pls as $pl) {
        $weedDays = "";
        if ($pl['sun']) {
            $weedDays .= 'Sun ';
        }
        if ($pl['mon']) {
            $weedDays .= 'Mon ';
        }
        if ($pl['tue']) {
            $weedDays .= 'Tue ';
        }
        if ($pl['wed']) {
            $weedDays .= 'Wed ';