Exemplo n.º 1
0
 public function actionPhotos($id, $url)
 {
     $post = Yii::$app->request->post();
     $request = Yii::$app->request;
     //потрібно буде переписати
     if ($post['offset']) {
         if ($url == 'new_photos') {
             $photos = User::getPhoto($id, $post['offset'], 1, 'date');
         } elseif ($url == 'best_photos') {
             $photos = User::getPhoto($id, $post['offset'], 1, 'rating_all');
         } else {
             $photos = User::getPhoto($id, $post['offset'], 1, $url);
         }
         foreach ($photos as $p) {
             $photo[] = $p;
         }
         echo json_encode(['photo' => $photo]);
         return;
     }
     User::getUserInfoOrRedirect($this, $id, $user, $isMyProfile);
     if ($request->isAjax) {
         $contentId = $request->post('contentId');
     }
     if ($url == 'new_photos') {
         $heading = Yii::t('yii', 'Новые фотографии');
         $photos = User::getPhotoTmp($id, 20, 'date', $contentId);
     } elseif ($url == 'best_photos') {
         $heading = Yii::t('yii', 'Популярные фотографии');
         $photos = User::getPhotoTmp($id, 20, 'rating_all', $contentId);
     } else {
         $photos = User::getPhotoTmp($id, 20, $url, $contentId);
         $heading = end($photos)['category_name'];
     }
     if ($request->isAjax) {
         echo json_encode(['content' => $photos]);
         return;
     }
     if (!$request->isAjax) {
         $categories = Category::getAllUserCategory($id);
     }
     return $this->render('photos', ['user' => $user, 'categories' => $categories, 'isMyProfile' => $isMyProfile, 'photos' => $photos, 'heading' => $heading, 'url' => $url]);
 }
Exemplo n.º 2
0
<?php

use yii\helpers\Html;
use app\models\User;
?>
<div class="col-md-2 left-menu">
	<div class="col-md-12 left-menu-div">
		<p class="col-md-12 left-menu-title">个人中心</p>
		<div class="col-md-12">
    		<img src="<?php 
echo User::getPhoto($id);
?>
" style="width:80px;" />
    		<span><?php 
echo User::getUsername($id);
?>
</span>
		</div>
		
		
		<p class="col-md-12 left-menu-small-title">个人参与</p>
		<ul class="col-md-12 left-menu-ul">
			<li <?php 
echo getCss('user/index');
?>
><?php 
echo html::a('参与的问答', ['/user/index', 'id' => $id]);
?>
</li>
			<li <?php 
echo getCss('user/art');