public function init()
 {
     $assets = dirname(__FILE__) . '/assets';
     $this->assetsPath = Yii::app()->assetManager->publish($assets, false, 1, YII_DEBUG);
     if (empty($this->imageAds)) {
         $this->imageAds = '/web/images/bg_default.png';
     }
     if (empty($this->data)) {
         $data[] = array('file' => 'https://s3.amazonaws.com/jomedia-jwplayer/samples/tears-of-steel.mp4', 'label' => '128K');
         $data[] = array('file' => 'https://s3.amazonaws.com/jomedia-jwplayer/samples/tears-of-steel.mp4', 'label' => '320K VIP');
         $source = json_encode($data);
     }
     $video = VideoModel::model()->findByPk($this->videoId);
     //check xem co phai iphone 3G khong
     $device = Yii::app()->session['device'];
     /*if(!empty($device) && $device['os'] == 'iOS' && (int) Yii::app()->session['deviceOS'] <= 6 ){
           $source = VideoModel::model()->builDataPlayerVideo($this->videoId,null, Yii::app()->params['video.profile.default']['iphone'][0]);
       }else {
           $source = VideoModel::model()->builDataPlayerVideo($this->videoId);
       }*/
     $source = VideoModel::model()->builDataPlayerVideo($this->videoId);
     $image = AvatarHelper::getAvatar("video", $this->videoId, 640);
     $cs = Yii::app()->clientScript;
     $cs->registerScriptFile($this->assetsPath . '/jwplayer.js', CClientScript::POS_END);
     $cs->registerScript('play_video' . $this->id, "\n            jwplayer('" . $this->id . "').setup({\n                width: '" . $this->width . "',\n                height: " . $this->height . ",\n                image: '" . $image . "',\n                sources: {$source},\n                autostart: " . $this->autostart . ",\n                expand: '" . $this->expand . "',\n                primary: '" . $this->primary . "',\n                /*plugins: {\n                    '" . $this->assetsPath . "/vast.js': {\n                      client:'vast',\n                      schedule:{\n                        overlay: { offset: " . $this->offset . ", tag: '" . Yii::app()->createUrl('/player/banner') . "', type:'nonlinear' }\n                      }\n                    }\n                  }*/\n            });\n        ", CClientScript::POS_END);
     if ($this->expand) {
         $cs->registerScript('play_video_expand' . $this->id, "\n            function onPlayerExpandCollapse() {\n\n                if(jwplayer('" . $this->id . "').getFullscreen) {\n                    jwplayer('" . $this->id . "').setFullscreen(false);\n                }\n                if(\$('.video_player').width() <= 745){\n                    \$('.colum2').css({'margin-top':'20px'});\n                    \$('.video_player').css({'height':'540px'});\n                    \$('.video_player').css({'width':'960px'});\n                    \$('#player-holder').removeClass('watch-normal-mode');\n                    \$('#player-holder').addClass('watch-large-mode');\n                    \$('.video_player .colum2').css({'margin-top':'-370px'});\n                    onPlayerExpand();\n                }else{\n                    onPlayerCollapse();\n                    \$('.colum2').css({'margin-top':''});\n                    \$('.video_player').css({'height':'390px'});\n                    \$('.video_player').css({'width':'745px'});\n                    \$('#player-holder').removeClass('watch-large-mode');\n                    \$('#player-holder').addClass('watch-normal-mode');\n                }\n            }\n\n            function onPlayerExpand() {\n              jwplayer('" . $this->id . "').resize(960,540);\n            }\n\n            function onPlayerCollapse() {\n              jwplayer('" . $this->id . "').resize(745,390);\n            }\n            ;\n        ", CClientScript::POS_END);
     }
     //track and log
     $deviceType = 'mobile';
     $isUserLogin = Yii::app()->user->isGuest ? 'false' : 'true';
     $cs->registerScript('play_video_current' . $this->id, "\n        var device_type = '" . $deviceType . "';\n        var listPlayed =Array();\n        var playVideoFlag = true;\n        var logedin = " . $isUserLogin . ";\n        jwplayer().onPlay(function(){\n            console.log(JSON.stringify(check_video_quality()));\n            if(!check_video_quality()){\n             jwplayer('" . $this->id . "').pause();\n            }\n\n        });\n        jwplayer().onBeforePlay(function() {\n\n            playVideoFlag = false;\n        });\n        jwplayer().onTime(function(event) {\n            if(Math.round(event.position) >=5){\n                if(playVideoFlag) {\n                    playVideoFlag = false;\n                    var action = 'Play Video';\n                    if(in_array_item(listPlayed,'video_" . $video->id . "')){\n                        var action = 'Replay Video';\n                    }\n                    var item = 'video_" . $video->id . "';\n                    if(!in_array_item(listPlayed,item)){\n                        listPlayed.push(item);\n                    }\n                    console.log(device_type+'-'+action);\n                    ga('send', 'event', device_type, action,'" . CHtml::encode($video->name . "-" . $video->artist_name . "-" . $video->id) . "');\n                    ajax_load('/player/logVideo',{'id':" . $video->id . "});\n                }\n            }\n        });\n        ", CClientScript::POS_END);
     //check login 720p
     $obj = array("obj_type" => 'video', 'name' => $video->name, 'id' => $video->id, 'artist' => $video->artist_name);
     $urlDetail = URLHelper::makeUrl($obj);
     $lac = Yii::app()->user->getState('last_action');
     $lurl = Yii::app()->user->getState('last_url');
     Yii::app()->user->setState('last_url', null);
     $register_url = Yii::app()->createUrl("account/package");
     $login_url = Yii::app()->createUrl("account/login");
     $js = '';
     if ($lac == '720p' && $lurl == $urlDetail && !Yii::app()->user->isGuest) {
         $js = 'jwplayer().setCurrentQuality(0);';
     }
     $js = 'jwplayer().setCurrentQuality(0);';
     $cs->registerScript('play_video_current_changeQ' . $this->id, "\n\n                jwplayer().onQualityLevels(function(event){\n                    var currQIndex = jwplayer().getCurrentQuality();\n                    var currQL = jwplayer().getQualityLevels();\n                    var bitrate = currQL[currQIndex].label;\n                    if(logedin==false && bitrate=='720p'){\n                        jwplayer().setCurrentQuality(currQIndex+1);\n                    }\n                    jwplayer().setCurrentQuality(currQIndex+1);\n                });\n                jwplayer().onQualityChange(function(event){\n                    var logedin = false;\n\n                    \$.ajax({\n                        url: '/ajax/isAuthenticate',\n                        type: 'post',\n                        data: {fa:'720p',url_return:'" . $urlDetail . "'},\n                        async: false,\n                        dataType: 'json',\n                        success: function(data){\n                            if(data.errorCode==0){\n                                logedin = true;\n                            }\n                        }\n                    })\n                    var currEQIndex = jwplayer().getCurrentQuality();\n                    var currQL = jwplayer().getQualityLevels();\n                    var bitrate = currQL[currEQIndex].label;\n\n                    if(logedin==false && bitrate=='720p'){\n                         var html = 'Quý khách vui lòng đăng ký để nghe miễn phí nội dung chất lượng cao.';\n                            html += '<div class=\"clb ovh\">';\n                            html += '<div class=\"btn-popup btn-popup-green\" style=\"width: 45%; float: left;\">';\n                            html += '<a href=\"  {$register_url} \" class=\"show\" style=\"color: #FFF\">Đăng ký</a>';\n                            html += '</div>';\n                            html += '<div class=\"btn-popup btn-popup-green\" style=\"width: 45%; float: right;\">';\n                            html += '<a href=\"javascript::void();\" onclick=\"Popup.close()\" class=\"show\" style=\"color: #FFF\">Hủy</a>';\n                            html += '</div>';\n                            html += '</div>';\n                            html += '</div>';\n                         Popup.alert(html);\n\n\n                    }\n                });\n            ", CClientScript::POS_END);
     $cs->registerScript('check_current_video' . $this->id, "\n        function check_video_quality(){\n            var anable_play = true;\n            var currEQIndex = jwplayer().getCurrentQuality();\n            var currQL = jwplayer().getQualityLevels();\n            var bitrate = currQL[currEQIndex].label;\n            if(!userSubs){\n                console.log(JSON.stringify(bitrate));\n                if(userPhone && bitrate == '720p'){\n                   return false;\n                }else{\n                }\n            }\n        }\n            ", CClientScript::POS_END);
     parent::init();
 }
        ?>
	<?php 
        if ($i == 1) {
            ?>
		<li>
			<div class="chart-index chart-1st"><b>1</b></div>
			<div class="chart-content-1st">
				<a href="<?php 
            echo $link;
            ?>
" title="<?php 
            echo CHtml::encode($album->name) . ' - ' . CHtml::encode($album->artist_name);
            ?>
">
					<img width="50" src="<?php 
            echo AvatarHelper::getAvatar("album", $album->id, 150);
            ?>
" alt="<?php 
            echo CHtml::encode($album->name) . ' - ' . CHtml::encode($album->artist_name);
            ?>
" />
				</a>
				<h3>
					<a href="<?php 
            echo $link;
            ?>
" class="song_name"  title="<?php 
            echo CHtml::encode($album->name);
            ?>
">
		                    <?php 
Exemple #3
0
<div class="home_slide" style="margin-bottom: 10px;" >
    <?php 
$newsEvent = NewsEventModel::model()->getEventByChannel('web');
$data = array();
$i = 0;
foreach ($newsEvent as $value) {
    $data[$i]['avatar'] = AvatarHelper::getAvatar('newsEvent', $value->id, 's1');
    $data[$i]['link'] = NewsEventModel::model()->getEventLink($value);
    $data[$i]['title'] = $value->name;
    $data[$i]['desc'] = '';
    $i++;
}
$this->widget('application.widgets.touch.slideshow.SlideshowWidget', array('data' => $data));
?>
</div>

<div class="item-box">
    <a href='<?php 
echo Yii::app()->createUrl('/videoplaylist');
?>
' class='wrap-head mr-t-15' title='<?php 
echo Yii::t("wap", "Video Playlist");
?>
'>
        <div class='head-label clearfix'>
            <span class='text'><?php 
echo Yii::t("wap", "Video Playlist");
?>
</span>
            <span class='title'></span>
        </div><!-- End .head-label -->
echo CHtml::encode($album->artist_name);
?>
</a></p>
    </div>
</div>


<ul class="bxh_album_list song_detail_list mart20">
    <?php 
foreach ($songs as $song) {
    $urlKey = Common::makeFriendlyUrl(trim($song->song->name));
    $artist_name = Common::makeFriendlyUrl($song->artist_name);
    $link = Yii::app()->createUrl("song/view", array("id" => $song->song_id, "title" => $urlKey, 'artist' => $artist_name));
    $artistLink = Yii::app()->createUrl("/search") . "?" . http_build_query(array("q" => CHtml::encode($song->song->artist_name)));
    $artistId = SongArtistModel::model()->findByAttributes(array('song_id' => $song->song->id))->artist_id;
    $image = AvatarHelper::getAvatar("artist", $artistId, 640);
    ?>
        <li>
            <a href="<?php 
    echo $link;
    ?>
">
                <img src="<?php 
    echo $image;
    ?>
" alt="<?php 
    echo CHtml::encode($song->song->artist_name);
    ?>
">
            </a>
            <h3><a title="<?php 
        ?>
	<?php 
        if ($i == 1) {
            ?>
		<li>
			<div class="chart-index chart-1st"><b>1</b></div>
			<div class="chart-content-1st">
				<a href="<?php 
            echo $link;
            ?>
" title="<?php 
            echo CHtml::encode($song->name) . ' - ' . CHtml::encode($song->artist_name);
            ?>
">
					<img width="50" src="<?php 
            echo AvatarHelper::getAvatar("artist", $song->song_artist[0]->artist_id, 150);
            ?>
" alt="<?php 
            echo CHtml::encode($song->name) . ' - ' . CHtml::encode($song->artist_name);
            ?>
" />
				</a>
				<h3>
					<a href="<?php 
            echo $link;
            ?>
" class="song_name"  title="<?php 
            echo CHtml::encode($song->name);
            ?>
">
		                    <?php 
Exemple #6
0
<?php

foreach ($songs as $song) {
    $artist_name = Common::makeFriendlyUrl($song->artist_name);
    $link = Yii::app()->createUrl("song/view", array("id" => $song['id'], "title" => Common::makeFriendlyUrl(CHtml::encode($song['name'])), 'artist' => $artist_name));
    ?>
<li>
	<a href="<?php 
    echo $link;
    ?>
" title="<?php 
    echo CHtml::encode($song['name']) . ' - ' . CHtml::encode($song['artist_name']);
    ?>
"><img src="<?php 
    echo AvatarHelper::getAvatar("artist", $song['artist_id'], 50);
    ?>
" alt="<?php 
    echo $song['name'];
    ?>
" width="50" height="50" /></a>
	<h3><a href="<?php 
    echo $link;
    ?>
" class="song_name"><?php 
    echo Formatter::smartCut(CHtml::encode($song['name']), 24);
    ?>
</a></h3>
	<?php 
    $linkArtist = Yii::app()->createUrl("/search") . "?" . http_build_query(array("q" => CHtml::encode(CHtml::encode($song['artist_name']))));
    ?>
	<h4 class="song_aritis"><a href="<?php 
Exemple #7
0
    ?>
                <li><a rel="<?php 
    echo Yii::app()->createUrl("user/loginPopup", array('class' => 'top'));
    ?>
" class="has-ajax-pop">Đăng nhập</a></li>
                <li>|</li>
                <li><a rel="nofollow" href="<?php 
    echo Yii::app()->createUrl("user/register");
    ?>
">Đăng ký</a></li>
            <?php 
} else {
    ?>
            	<li class="sub_hover user-menu">
            	<img class="user-avatar" src="<?php 
    echo AvatarHelper::getAvatar("user", Yii::app()->user->id, 50);
    ?>
" width="25" height="25" />
            		<a href="<?php 
    echo Yii::app()->createUrl("/user/detail");
    ?>
">
            			<span><?php 
    echo Formatter::smartCut(Yii::app()->user->username, 12);
    ?>
</span>
            		</a>
            		<ul class="sub_nav">
	            		<li><a href="<?php 
    echo Yii::app()->createUrl("/user/detail", array('id' => $userId, 'tab' => 'playlist'));
    ?>
 public function getAvatarUrl($id = null, $size = "150", $cacheBrowser = false)
 {
     if (!isset($id)) {
         $id = $this->id;
     }
     $path = AvatarHelper::getAvatar("newsEvent", $id, $size);
     return $path . "?v=" . time();
 }
        $link = Yii::app()->createUrl("artist/view", array("id" => $artist->id));
        ?>
                <li class="<?php 
        if ($i % 2 == 1) {
            echo 'marr_0';
        } else {
            echo '';
        }
        ?>
">
                    <a href="<?php 
        echo $link;
        ?>
">
                        <img style="width: 120px;" src="<?php 
        echo AvatarHelper::getAvatar("artist", $artist->id, 120);
        ?>
" alt="<?php 
        echo $artist->name;
        ?>
" />
                    </a>
                    <p><a href="<?php 
        echo $link;
        ?>
" title="<?php 
        echo $artist->name;
        ?>
"><?php 
        echo Formatter::substring(CHtml::encode($artist->name), " ", 3, 12);
        ?>
  <div class="m-carousel-inner">			    
    <?php 
$i = 1;
foreach ($slideVideos as $video) {
    $link = Yii::app()->createUrl('video/view', array('id' => $video['object_id'], 'url_key' => Common::makeFriendlyUrl($video['name']), "artist" => Common::makeFriendlyUrl(trim($video['artist_name']))));
    ?>
		<a href="<?php 
    echo $link;
    ?>
">
		<div class="m-item <?php 
    echo $i == 1 ? 'm-active' : '';
    ?>
 ">
	      	<img src="<?php 
    echo AvatarHelper::getAvatar('newsEvent', $video['id'], 's1');
    ?>
" />
	    </div>
	    </a>
		<?php 
    $i++;
}
?>
								  
  </div>
  <!-- the controls -->
  <div class="m-carousel-controls m-carousel-bulleted">
  	<?php 
if (count($slideVideos) > 0) {
    ?>