Example #1
0
 public function CreateChannelsForWindows($screenId, $netId)
 {
     $Screen = Screen::model()->findByPk($screenId);
     $windows = $Screen->windows;
     NetChannel::model()->deleteAll("net_id = :net_id", array('net_id' => $netId));
     foreach ($windows as $window) {
         $channel = new NetChannel();
         $channel->attributes = array('net_id' => $netId, 'window_id' => $window->id);
         $channel->save();
     }
 }
Example #2
0
}
echo $form->dropDownList($model, 'screen_id', $dropDown, array('options' => $selectedItems, 'multiple' => false, 'class' => 'form-control', 'size' => '10'));
printf("<div id='windowsList'>");
if (!$model->isNewRecord) {
    $screenId = $model->screen_id;
    $screen = Screen::model()->findByPk($screenId);
    $windows = $screen->windows;
    foreach ($windows as $window) {
        $windowId = $window->id;
        $windowInst = Window::model()->findByPk($windowId);
        $windowName = $windowInst->name;
        $channels = $windowInst->netChannels;
        foreach ($channels as $channel) {
            if ($channel->net_id == $model->id) {
                printf("<div class='ChannelsContainer btn-toolbar' data-channelid='%s' role='toolbar' aria-label=''>", $channel['id']);
                $channelM = NetChannel::model()->findByPk($channel['id']);
                $pls = $channelM->playlists;
                printf("<div class='btn-group' role='group' aria-label=''>" . "<button type='button' class='btn btn-default ChannelButt' disabled='disabled'>Screen %s</button>" . "<button type='button' class='AddPlaylistsBut btn btn-info' data-channelid='%s'>" . "<span class='glyphicon glyphicon-plus'></span> Add playlists" . "</button></div>", $windowName, $channel['id']);
                foreach ($pls as $pl) {
                    echo "<div class='btn-group' role='group' aria-label=''>";
                    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'], $channel['id']);
                    echo "</div>";
                }
                echo "</div>";
            }
        }
    }
}
printf("</div>");
?>