Ejemplo n.º 1
0
 public function actionViewType()
 {
     $artistId = Yii::app()->request->getParam('id');
     $artist = ArtistModel::model()->findByPk($artistId);
     $this->artist = $artist->name;
     $this->thumb = ArtistModel::model()->getAvatarUrl($artist->id, 150);
     $this->url = URLHelper::buildFriendlyURL("artist", $artist->id, $artist->url_key);
     if (!$artist) {
         $this->forward("/site/error", true);
     }
     $listType = Yii::app()->request->getParam('list', 'song');
     $countSongsOfArtist = $artist->song_count;
     $countClipsOfArtist = $artist->video_count;
     $countAlbumsOfArtist = $artist->album_count;
     $pageSize = Yii::app()->params['numberSongsPerPage'];
     if ($listType == 'song') {
         // in case that list songs of artist
         $songPages = new CPagination($countSongsOfArtist);
         $songPages->setPageSize($pageSize);
         $currentPage = $songPages->getCurrentPage();
         $songsOfArtist = WapSongModel::model()->getSongsSameSinger(0, $artist->id, $currentPage * $pageSize, $pageSize);
         $this->render('viewtype', array('artist' => $artist, 'listType' => $listType, 'countSongsOfArtist' => $countSongsOfArtist, 'countClipsOfArtist' => $countClipsOfArtist, 'countAlbumsOfArtist' => $countAlbumsOfArtist, 'songsOfArtist' => $songsOfArtist, 'songPages' => $songPages));
     } elseif ($listType == 'clip') {
         // in case that list clips of artist
         $clipPages = new CPagination($countClipsOfArtist);
         $clipPages->setPageSize($pageSize);
         $currentPage = $clipPages->getCurrentPage();
         $clipsOfArtist = WapVideoModel::model()->getVideosSameArtist(0, $artist->id, $currentPage * $pageSize, $pageSize);
         $this->render('viewtype', array('artist' => $artist, 'listType' => $listType, 'countSongsOfArtist' => $countSongsOfArtist, 'countClipsOfArtist' => $countClipsOfArtist, 'countAlbumsOfArtist' => $countAlbumsOfArtist, 'clipsOfArtist' => $clipsOfArtist, 'clipPages' => $clipPages));
     } else {
         // in case that list albums of artist
         $albumPages = new CPagination($countAlbumsOfArtist);
         $albumPages->setPageSize($pageSize);
         $currentPage = $albumPages->getCurrentPage();
         $albumsOfArtist = WapAlbumModel::model()->getAlbumsSameArtist(0, $artist->id, $currentPage * $pageSize, $pageSize);
         $this->render('viewtype', array('artist' => $artist, 'listType' => $listType, 'countSongsOfArtist' => $countSongsOfArtist, 'countClipsOfArtist' => $countClipsOfArtist, 'countAlbumsOfArtist' => $countAlbumsOfArtist, 'albumsOfArtist' => $albumsOfArtist, 'albumPages' => $albumPages));
     }
 }
Ejemplo n.º 2
0
 /**
  * Video yeu thich
  */
 public function actionFavVideo()
 {
     $phone = yii::app()->user->getState('msisdn');
     $cri = new CDbCriteria();
     $cri->condition = " phone = {$phone}";
     $user = UserModel::model()->find($cri);
     $uid = $user->id;
     $limit = Yii::app()->params['pageSize'];
     $pageSize = Yii::app()->params['pageSize'];
     $page = Yii::app()->request->getParam('page', 1);
     $offset = ($page - 1) * $limit;
     $countVideo = WapVideoModel::model()->countFavVideo($uid);
     $videoPages = new CPagination($countVideo);
     $videoPages->setPageSize($pageSize);
     $favvideo = WapVideoModel::model()->getFavVideo($phone, $limit, $offset);
     $headerText = Yii::t('chachawap', 'Video yêu thích');
     $link = $link = Yii::app()->createUrl("/account/favvideo");
     $this->render('videolist', array('videos' => $favvideo, 'link' => $link, 'type' => "list", 'headerText' => $headerText, 'videoPages' => $videoPages));
 }
Ejemplo n.º 3
0
 public function actionDownload()
 {
     $this->layout = false;
     $contentId = (int) Yii::app()->request->getParam('id');
     $type = Yii::app()->request->getParam('type', 'downloadSong');
     $deviceId = yii::app()->session['deviceId'];
     $downloadUrl = '';
     if ($type == 'downloadVideo') {
         $video = WapVideoModel::model()->findByPk($contentId);
         $downloadUrl = VideoModel::model()->getDownloadUrl($contentId, $deviceId, 'http', true);
         $contentType = 'video/mp4';
         $fileName = $video->name;
         $fileName = Common::makeFriendlyUrl($fileName) . ".mp4";
     } elseif ($type == 'downloadSong') {
         $song = WapSongModel::model()->findByPk($contentId);
         //$downloadUrl = WapSongModel::model()->getNiceDownloadUrl($song->id, $deviceId, 'http', $song->profile_ids, $song->url_key, $song->artist_name);
         //$downloadUrl = WapSongModel::model()->getAudioFileUrl($song->id, $deviceId, 'http', $song->profile_ids);
         $downloadUrl = WapSongModel::model()->getNiceDownloadUrl($song->id, $deviceId, 'http', $song->profile_ids, $song->url_key, $song->artist_name);
         echo '<meta http-equiv="refresh" content="0;url=' . $downloadUrl . '" />';
         exit;
         $contentType = 'audio/mpeg';
         $fileName = $song->name;
         $fileName = Common::makeFriendlyUrl($fileName) . ".mp3";
     }
     echo '<meta http-equiv="refresh" content="0;url=' . $downloadUrl . '" />';
     exit;
     //$this->redirect($downloadUrl);
     //Yii::app()->end();
     //echo '<meta http-equiv="refresh" content="0;url='.$downloadUrl.'" />';
     header("Cache-Control: public");
     header("Content-Description: File Transfer");
     header("Content-Disposition: attachment; filename=" . $fileName);
     header("Content-Type: {$contentType}");
     header("Content-Transfer-Encoding: binary");
     readfile($downloadUrl);
     //Yii::app()->end();
     //Common::DownloadWithName($this->userPhone, $contentId, $type);
     exit;
 }
Ejemplo n.º 4
0
        <?php 
if ($videos) {
    $i = 0;
    ?>
            <?php 
    foreach ($videos as $value) {
        ?>
                <?php 
        if ($i % 2 == 0) {
            ?>
<div class="item_row"><?php 
        }
        ?>
                <?php 
        $videoLink = Yii::app()->createUrl('video/view', array('id' => $value['id'], 'url_key' => Common::makeFriendlyUrl($value['name']), "artist" => Common::makeFriendlyUrl(trim($value['artist_name']))));
        $avatarImage = WapVideoModel::model()->getThumbnailUrl('s1', $value['id']);
        ?>
                    <div class="item">
                        <a href="<?php 
        echo $videoLink;
        ?>
">
                            <div class="wrr-item-detail">
                                <img src="<?php 
        echo $avatarImage;
        ?>
" />
                                <div class="info-nav">
                                    <p class="title subtext"><?php 
        echo CHtml::encode($value['name']);
        ?>
Ejemplo n.º 5
0
            id:<?php 
echo $videoPlaylist->id;
?>
,
            name:"<?php 
echo CHtml::encode($videoPlaylist->name);
?>
",
            listSong:{}
        };
        listSong = Array();
        <?php 
foreach ($list_video as $key => $song) {
    $playUrl = WapVideoModel::model()->getVideoFileUrl($song->id, $deviceId, 'rtsp', true);
    $playHD = 'http://video.chacha.vn:8282/videos/output/11/95154/9.mp4';
    $img = WapVideoModel::model()->getThumbnailUrl(320, $song->id);
    ?>
        var item = {
            title: "<?php 
    echo Formatter::smartCut($song->name, 20);
    ?>
",
            url_normal: "<?php 
    echo $playUrl;
    ?>
",
            url_hd: "<?php 
    echo $playHD;
    ?>
",
            img: "<?php 
Ejemplo n.º 6
0
    }
    $userSub = Yii::app()->user->getState('userSub');
    $packageCode = Yii::app()->user->getState('packageCode');
    if ($userSub) {
        $userType = "SUB_" . $packageCode;
    }
    $perLimit = ContentLimitModel::getPermision($topContent->content_id, "album", $userType, "WAP");
    $songsOfAlbum = WapSongModel::model()->getSongsOfAlbum($topContent->content_id);
    $like = null;
    if ($phone) {
        $userId = WapUserModel::model()->findByAttributes(array('phone' => $phone))->id;
        $like = FavouriteAlbumModel::model()->findByAttributes(array('album_id' => $albumId, 'msisdn' => $phone));
    }
    $this->renderPartial('_albumView', compact('content', 'perLimit', 'songsOfAlbum', 'like'));
} elseif ($topContent->type == 'video_playlist') {
    $list_video_playlist = WapVideoModel::model()->getVideosOfVideoPlaylist($topContent->content_id);
    //check noi dung doc quyen
    $userType = "GUEST";
    $phone = Yii::app()->user->getState('phone');
    if ($phone) {
        $userType = "MEMBER";
    }
    $userSub = Yii::app()->user->getState('userSub');
    $packageCode = Yii::app()->user->getState('packageCode');
    if ($userSub) {
        $userType = "SUB_" . $packageCode;
    }
    $content_limit = ContentLimitModel::model()->getIdByType('video', 'WAP', $userType);
    $list_video = array();
    for ($i = 0; $i < count($list_video_playlist); $i++) {
        if (!in_array($list_video_playlist[$i]->id, $content_limit)) {
Ejemplo n.º 7
0
    $link = Yii::app()->createUrl('video/view', array('id' => $video->id, 'url_key' => Common::makeFriendlyUrl($video->name), "artist" => Common::makeFriendlyUrl(trim($video->artist_name))));
    $name = explode("-", $video['name']);
    ?>

<li data-corners="false" data-shadow="false" data-iconshadow="true"
	data-wrapperels="div" data-icon="arrow-r" data-iconpos="right"
	data-theme="d"
	class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-btn-up-d"><div
		class="ui-btn-inner ui-li">
		<div class="ui-btn-text">
		<span class="xbh-count-album index"><?php 
    echo $i;
    ?>
</span>
			<?php 
    $avatarImage = CHtml::image(WapVideoModel::model()->getThumbnailUrl(100, $video->id), 'avatar', array('class' => 'video-avatar-bxh', 'align' => 'left'));
    echo $avatarImage;
    ?>

				<a href="<?php 
    echo $link;
    ?>
"
				class="ui-link-inherit subtext"> <?php 
    echo CHtml::encode($video->name);
    ?>
 </a> <span
				class="artist-name subtext"><?php 
    echo CHtml::encode($video->artist_name);
    ?>
</span>
<table class="videolist tablelist">
    <?php 
$currentPage = Yii::app()->request->getParam('pv', 1);
$number = ($currentPage - 1) * yii::app()->params['pageSize'] + 1;
foreach ($videos as $video) {
    if ($video->id != $excludeId) {
        $videoLink = yii::app()->createUrl('video/view', array('id' => $video->id, 'url_key' => Common::makeFriendlyUrl($video->name), 'src' => $src, 'playlist' => $playlist ? $playlist : 0));
        if ($video->id) {
            $avatarImage = CHtml::image(WapVideoModel::model()->getThumbnailUrl(100, $video->id), 'avatar', array('class' => 'avatar'));
        } else {
            $avatarImage = CHtml::image('/css/wap/images/icon/clip-50.png', 'avatar', array('class' => 'avatar'));
        }
        ?>
			<tr><td width="100px" onclick="document.location = '<?php 
        echo $videoLink;
        ?>
'">              
					<?php 
        echo $avatarImage;
        ?>
				</td>
		        
		        <td class="itemwrap" onclick="document.location = '<?php 
        echo $videoLink;
        ?>
'">
		            <p class="m0 fontB">
		                <a href="<?php 
        echo $videoLink;
        ?>
"><?php 
Ejemplo n.º 9
0
', '<?php 
    echo $video->code;
    ?>
')"><img
                    src="<?php 
    echo Yii::app()->request->baseUrl;
    ?>
/touch/images/play.png"/></span>
        </div>
        <?php 
}
?>
        <div class="video-tag" id="video-tag" style="display: none;">
            <video id="video-player-obj" width="320" height="240" controls
                   poster="<?php 
echo WapVideoModel::model()->getThumbnailUrl(320, $video->id);
?>
">
                <source src="<?php 
echo $playUrl;
?>
" type="video/mp4">
                Your browser does not support the video tag.
            </video>
        </div>
    </div>

    <div class="action">
        <?php 
$is_download = 0;
if ($video->allow_download && (strpos($deviceId, 'apple_iphone') === false && strpos($deviceId, 'apple_ipod') === false && strpos($deviceId, 'apple_ipad') === false)) {
 /**
  * function actionView
  * call to render detail VideoPlaylist page
  */
 public function actionView()
 {
     $id = (int) Yii::app()->request->getParam('id');
     $video_id = Yii::app()->request->getParam('video_id', null);
     $videoPlaylist = WapVideoPlaylistModel::model()->published()->with('video_playlist_artist')->findByPk($id);
     $playPrice = $videoPlaylist->price;
     if (!$videoPlaylist) {
         $this->forward("/site/error", true);
     }
     $list_video_playlist = WapVideoModel::model()->getVideosOfVideoPlaylist($id);
     //check noi dung doc quyen
     $userType = "GUEST";
     $phone = Yii::app()->user->getState('phone');
     if ($phone) {
         $userType = "MEMBER";
     }
     $userSub = Yii::app()->user->getState('userSub');
     $packageCode = Yii::app()->user->getState('packageCode');
     if ($userSub) {
         $userType = "SUB_" . $packageCode;
     }
     $content_limit = ContentLimitModel::model()->getIdByType('video', 'WAP', $userType);
     $list_video = array();
     for ($i = 0; $i < count($list_video_playlist); $i++) {
         if (!in_array($list_video_playlist[$i]->id, $content_limit)) {
             $list_video[] = $list_video_playlist[$i];
         }
     }
     $phone = Yii::app()->user->getState('msisdn');
     $like = null;
     if ($phone) {
         $like = FavouriteVideoPlaylistModel::model()->findByAttributes(array('video_playlist_id' => $id, 'msisdn' => $phone));
     }
     $video = WapVideoModel::model()->with("video_extra")->findByPk($video_id);
     $video = isset($video) ? $video : $list_video[0];
     $artist_id = $videoPlaylist->video_playlist_artist[0]->artist_id;
     $count = VideoPlaylistArtistModel::model()->countVideoPlaylistByArtist($artist_id);
     $pager = new CPagination($count);
     $pager->setPageSize(Yii::app()->params['numberPerPage']);
     $videoPlaylistSameArtist = WapVideoPlaylistModel::model()->getVideoPlaylistsSameArtists($artist_id, $pager->getOffset(), $pager->getLimit());
     $callBackLink = Yii::app()->createUrl("videoPlaylist/loadAjax", array('s' => 'artist', 'artist_id' => $artist_id));
     $this->render('view', compact('video', 'list_video', 'videoPlaylist', 'pager', 'videoPlaylistSameArtist', 'callBackLink', 'like', 'artist_id'));
 }
Ejemplo n.º 11
0
 public function actionLoadAjax()
 {
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $s = CHtml::encode(Yii::app()->request->getParam('s'));
     $videoId = (int) Yii::app()->request->getParam('id', 0);
     $artist_id = (int) Yii::app()->request->getParam('artist_id', 0);
     $genre_id = (int) Yii::app()->request->getParam('genre_id', 0);
     if ($s == 'genre') {
         $callBackLink = Yii::app()->createUrl("video/loadAjax", array('s' => 'genre', 'genre_id' => $genre_id));
         $count = WapVideoModel::model()->countVideosByGenre($genre_id);
         $pager = new CPagination($count);
         $pageSize = Yii::app()->params['pageSize'];
         $pager->setPageSize($pageSize);
         $currentPage = $pager->getCurrentPage();
         $videos = WapVideoModel::model()->getVideosByGenre($genre_id, $pager->getOffset() + 1, $pager->getLimit());
     } else {
         $callBackLink = Yii::app()->createUrl("video/loadAjax", array('s' => 'artist', 'artist_id' => $artist_id));
         $count = WapVideoModel::model()->countVideosSameArtist($videoId, $artist_id);
         $pager = new CPagination($count);
         $pageSize = Yii::app()->params['pageSize'];
         $pager->setPageSize($pageSize);
         $currentPage = $pager->getCurrentPage();
         $videos = WapVideoModel::model()->getVideosSameArtist($videoId, $artist_id, $pager->getOffset() + 1, $pager->getLimit());
     }
     if ($callBack) {
         $this->renderPartial("_ajaxList", compact('videos', 'pager'), false, true);
     } else {
         $this->renderPartial("_same", compact('videos', 'pager', 'callBackLink'), false, true);
     }
 }