public function actionArtist()
 {
     $singer_id = 1;
     //сюди передати id виконавця
     $exist = false;
     if ($singer_id) {
         $exist = Singer::model()->selectBySingerId($singer_id);
         //error_log(var_export($exist,1));
     }
     $model = new Image();
     //$user_id = Yii::app()->user->getId();
     echo CJSON::encode($this->renderPartial('artist', array('poster' => $model, 'singer_id' => $singer_id, 'exist' => $exist), true, true));
     Yii::app()->end();
 }
Exemple #2
0
 public function selectBySingerId($singer_id)
 {
     $criteria = new CDbCriteria();
     $criteria->select = '*';
     $criteria->condition = 'id=:singer_id';
     $criteria->params = array(':singer_id' => $singer_id);
     $result = Singer::model()->find($criteria);
     $image = Image::model()->selectByRow('singer', $singer_id);
     $style = Style::model()->selectBySingerId($singer_id);
     $result = $result['attributes'];
     if ($image) {
         $result['path'] = $image->path;
     }
     if ($style) {
         $result['style'] = $style;
     }
     return $result;
 }