Example #1
0
 /**
  * Displays a single Photo model.
  * @param integer $id
  * @return mixed
  */
 public function actionView($id)
 {
     $model = $this->findModel($id);
     $albumModel = Album::findOne($model->album_id);
     $photoCount = Photo::find()->andWhere(['album_id' => $model->album_id])->count('*');
     $currentPage = Photo::find()->andWhere(['album_id' => $model->album_id])->andWhere('id >= ' . $id)->count('*');
     return $this->render('photoView', ['model' => $model, 'photoCount' => $photoCount, 'currentPage' => $currentPage, 'albumModel' => $albumModel, 'userCreadedBy' => User::find()->andWhere(['id' => $model->created_by])->asArray()->one(), 'userExtendCreadedBy' => UserExtend::find()->andWhere(['user_id' => $model->created_by])->asArray()->one(), 'user' => User::find()->andWhere(['id' => Yii::$app->getUser()->getId()])->asArray()->one(), 'userExtend' => UserExtend::find()->andWhere(['user_id' => Yii::$app->getUser()->getId()])->asArray()->one()]);
 }
Example #2
0
 /**
  * 个人歌单
  * @param $userId
  * @return array
  */
 public function personalSongKingdomByUserId($userId)
 {
     $query = SongKingdom::find()->andWhere(['created_by' => $userId]);
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count()]);
     $pages->setPageSize(10);
     $models = $query->offset($pages->offset)->limit($pages->limit)->all();
     return ['models' => $models, 'pages' => $pages, 'userCreadedBy' => User::find()->andWhere(['id' => $userId])->asArray()->one(), 'userExtendCreadedBy' => UserExtend::find()->andWhere(['user_id' => $userId])->asArray()->one()];
 }
Example #3
0
 * Date: 2015/12/16
 * Time: 10:00
 */
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\Menu;
use yii\widgets\Breadcrumbs;
use frontend\assets\FrontendAsset;
yii::beginProfile('mainAsset', 'gx');
FrontendAsset::register($this);
yii::endProfile('mainAsset', 'gx');
$this->title = 'admin';
$baseUrl = Yii::getAlias('@web');
$imgDomain = Yii::$app->params['imgDomain'];
if (!Yii::$app->getUser()->isGuest) {
    $userExtendModel = \common\models\user\UserExtend::find()->andWhere(['user_id' => Yii::$app->getUser()->getId()])->one();
    $userModel = \common\models\user\User::findOne(Yii::$app->getUser()->getId());
}
?>

<?php 
$this->beginPage();
?>

<!DOCTYPE html>
<html lang="<?php 
echo Yii::$app->language;
?>
" xmlns="http://www.w3.org/1999/html">

<head>
Example #4
0
 /**
  * Displays a single Diary model.
  * @param integer $id
  * @return mixed
  */
 public function actionView($id)
 {
     $model = $this->findModel($id);
     return $this->render('diaryView', ['model' => $model, 'userCreadedBy' => User::find()->andWhere(['id' => $model->created_by])->asArray()->one(), 'userExtendCreadedBy' => UserExtend::find()->andWhere(['user_id' => $model->created_by])->asArray()->one(), 'user' => User::find()->andWhere(['id' => Yii::$app->getUser()->getId()])->asArray()->one(), 'userExtend' => UserExtend::find()->andWhere(['user_id' => Yii::$app->getUser()->getId()])->asArray()->one()]);
 }