public function actionView() { $radioId = Yii::app()->request->getParam("id", 0); $radioName = WapRadioModel::model()->findByPk($radioId)->name; $albumId = WapRadioModel::model()->getAlbumByRadio($radioId, "c2.id"); $radioAvatar = RadioModel::model()->getAvatarUrl($radioId, 's1'); $album = WapAlbumModel::model()->published()->findByPk($albumId); if (!$album) { $this->forward("/site/error", true); } $songsOfAlbum = WapSongModel::model()->getSongsOfAlbum($albumId); $artists = AlbumArtistModel::model()->getArtistsByAlbum($albumId); $phone = yii::app()->user->getState('msisdn'); $errorCode = 'success'; $errorDescription = ''; $registerText = WapAlbumModel::model()->getCustomMetaData('REG_TEXT'); ///meta tag $AlbumDetail = AlbumModel::model()->findByPk($albumId); $artistId = !empty($artists) ? $artists[0]->artist_id : $AlbumDetail->artist_id; $ArtistInfo = ArtistModel::model()->findByPk($artistId); $this->itemName = $AlbumDetail->name; $this->artist = $ArtistInfo->name; $this->thumb = AlbumModel::model()->getAvatarUrl($albumId, 's1'); $this->url = URLHelper::buildFriendlyURL("album", $albumId, Common::makeFriendlyUrl($ArtistInfo->name)); $this->description = strip_tags($AlbumDetail->description); //get other radio $parent_id = Yii::app()->params['horoscope']['parent_id']; $radioListOther = WapRadioModel::model()->getHoroscopes($parent_id); $this->render('detail', array('album' => $album, 'songsOfAlbum' => $songsOfAlbum, 'errorCode' => $errorCode, 'errorDescription' => $errorDescription, 'registerText' => $registerText, 'radioListOther' => $radioListOther, 'radioAvatar' => $radioAvatar)); }
<h3><?php echo Yii::app()->params['horoscope']['title']; ?> </h3> <?php echo Yii::app()->params['horoscope']['full']; ?> </div> </div> <div class="h_body"> <div class="wr2"> <?php if ($radioList) { $i = 0; foreach ($radioList as $value) { $avatar = RadioModel::model()->getAvatarUrl($value['id'], 's1'); $link = Yii::app()->createUrl('/horoscopes/view', array('id' => $value['id'], 'url_key' => Common::url_friendly($value['name']))); $albumName = WapRadioModel::model()->getAlbumByRadio($value['id']); if ($i % 4 == 0) { ?> <div class="h_row"><?php } ?> <div class="h_item"> <a href="<?php echo $link; ?> "> <div class="wrr-item-detail"> <img width="100%" src="<?php echo $avatar;
//if(!$model->isNewRecord): ?> <div class="row"> <label>Icon cho Kênh</label> <div id="files-x"> <?php /*$avatarPath = RadioModel::model()->getAvatarPath($model->id); if(!file_exists($avatarPath)){ $fileSource = Yii::app()->params['storage']['radioDir'].DS.$model->id.".png"; $pathUpload = _APP_PATH_.DS."data".DS."tmp".DS; $filePath = $pathUpload.$model->id.".png"; $fileSystem = new Filesystem(); $fileSystem->copy($fileSource, $filePath); AvatarHelper::processAvatar($model, $filePath); }*/ $avatarUrl = RadioModel::model()->getAvatarUrl($model->id, 's2'); ?> <img width="150" id="image_uploaded" src="<?php echo $avatarUrl; //echo Common::getLinkIconsRadio($model->id, 'channel'); ?> ?v=<?php echo time(); ?> " /> </div> <?php $this->widget('ext.EAjaxUpload.EAjaxUpload', array('id' => 'uploadFile', 'config' => array('action' => Yii::app()->createUrl('/upload/uploadFile', array('allowedExtensions' => 'jpg,jpeg,png')), 'allowedExtensions' => array("png", "jpg", "jpeg"), 'sizeLimit' => 100 * 1024 * 1024, 'minSizeLimit' => 1, 'onComplete' => "js:function(id, fileName, responseJSON){\n\t\t\t\t\t \t\t\tif(responseJSON.success){\n\t\t\t\t\t\t \t\t\t\t\t\$('#image_uploaded').attr('src','/data/tmp/'+responseJSON.filename);\n\t\t\t\t\t \t\t\t\t\$('#tmp_file_path').attr('value',responseJSON.filename);\t\n\t\t\t\t\t \t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\talert(responseJSON.data);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}"))); //echo CHtml::hiddenField("tmp_mp3_path", $mp3Tmp); ?> <input type="hidden" name="tmp_file_path" id="tmp_file_path" value="" />
<?php if ($radios) { ?> <table class="tablelist"> <?php foreach ($radios as $radio) { $avatar = RadioModel::model()->getAvatarUrl($radio['id'], 's2'); $link = Yii::app()->createUrl('/horoscopes/view', array('id' => $radio['id'], 'url_key' => Common::url_friendly($radio['name']))); ?> <tr> <td width="65px"> <a href="<?php echo $link; ?> "> <img alt="avatar" src="<?php echo $avatar; ?> " class="avatar"> </a> </td> <td class="itemwrap" > <p class="m0 fontB"> <a href="<?php echo $link; ?> "><?php echo WapCommonFunctions::substring($radio['name'], ' ', 6); ?> </a>
public function beforeSave() { $this->updated_time = new CDbExpression('NOW()'); return parent::beforeSave(); }
echo Yii::app()->createUrl('/horoscopes/index'); ?> "> <h2 class="name" title=''><?php echo Yii::t('web', 'Âm nhạc 12 cá tính'); ?> </h2> </a> </div> <div class="box_content"> <ul class="radio_list"> <?php $i = 0; foreach ($radioList as $value) { $avatarUrl = RadioModel::model()->getAvatarUrl($value->id, 640); $link = Yii::app()->createUrl('/horoscopes/view', array('id' => $value->id, 'title' => Common::url_friendly(CHtml::encode($value->name)))); ?> <li <?php echo $i % 2 == 1 ? 'style="margin-left: 20px;"' : ''; ?> > <a href="<?php echo $link; ?> " title="<?php echo CHtml::encode($value->name); ?> "> <img src="<?php echo $avatarUrl;
function Herocopes() { $id = Yii::app()->params['horoscope']['parent_id']; $limit = 4; $criteria = new CDbCriteria(); $criteria->condition = "parent_id=" . $id . " AND status = " . RadioModel::_ACTIVE; $criteria->order = "RAND()"; $criteria->limit = $limit; $radioList = RadioModel::model()->findAll($criteria); $this->renderPartial("_herocopes", compact('radioList')); }