View method

@param string|null $id User id.
@return void
@throws \Cake\Network\Exception\NotFoundException Exception if the user couldn't be found.
518350
public function view($id = null)
    {
        $user = $this->Users->get($id);
        $this->set('user', $user);

        $this->render(Configure::read('CM.AdminUserViews.view'));
    }
972663
public function findUserById($id)
    {
        if ($id instanceof UserInterface) {
            return $id;
        }

        $result =   $this->userProvider->findById($id);
        if ($result) {
            return $result;
        }

        $exceptionMessage   =   "A user with the ID '%(id)s' cannot be found.";

        throw new UserNotFound(isprintf($exceptionMessage, compact('id')));
    }
1322391
public function profile($id = null)
    {
        $this->loadModel('User.Users');
        $id = $id === null ? user()->id : $id;
        $conditions = [];

        if ($id != user()->id) {
            $conditions = ['status' => 1, 'public_profile' => true];
        }

        $user = $this->Users->get(intval($id), ['conditions' => $conditions]);

        $this->title(__d('user', 'User’s Profile'));
        $this->viewMode('full');
        $this->set(compact('user'));
    }
1139844
public function view($id = null) {
		$this->layout = 'Printers.factura';
		if (!$this->AfipFactura->exists($id)) {
			throw new NotFoundException(__('Factura inexistente'));
		}		
		$options = array(
			'conditions' => array(
				'AfipFactura.' . $this->AfipFactura->primaryKey => $id
				),
			'contain' => array(
				'Mesa' => array('Cliente' => array('TipoDocumento', 'IvaResponsabilidad'), 'Mozo')
				)
			);
		$factura = $this->AfipFactura->find('first', $options);		
		$this->set('factura', $factura);		
	}
1352414
public function findById($id)
	{
		$model = $this->createModel();

		$user = $model->where('id', '=', $id)->find();

		if ( ! $user->loaded() )
		{
			throw new UserNotFoundException("A user could not be found with ID [$id].");
		}

		return $user;
	}
1321061
public function actionView($id)
    {
        $this->layout = static::MAIN_LAYOUT;
        return $this->render('view', [
            'model' => $this->findModel($id),
        ]);
    }
503975
public function run($id)
    {
        /** @var ActiveRecord $model */
        $model = new $this->modelClass;

        /*
         * Locate the supplied model, left, right and parent models
         */
        $pkAttribute = $model->getTableSchema()->primaryKey[0];

        /** @var ActiveRecord|NestedSetsBehavior $model */
        $model = $model::find()->where([$pkAttribute => $id])->one();

        if ($model == null) {
            throw new NotFoundHttpException('Node not found');
        }

        $model->deleteWithChildren();

        return null;
    }
1224147
public function actionShow($id)
    {
        $profile = $this->finder->findProfileById($id);

        if ($profile === null) {
            throw new NotFoundHttpException();
        }

        return $this->render('show', [
            'profile' => $profile,
        ]);
    }
4502
public function actionView(int $id)
    {
        $model = $this->findModel($id);

        return $this->render('view', [
            'model' => $model,
            'usernameField' => $this->usernameField,
        ]);
    }
446278
public function show($id)
    {
        try
        {
            $throttle = $this->users->getUserThrottle($id);
            $user = $throttle->getUser();
            $permissions = $user->getMergedPermissions();

            return View::make(Config::get('cpanel::views.users_show'))
                ->with('user',$user)
                ->with('groups',$user->getGroups())
                ->with('permissions',$permissions)
                ->with('throttle',$throttle);
        }
        catch ( UserNotFoundException $e)
        {
            return Redirect::route('cpanel.users.index')
                ->with('error', $e->getMessage());
        }
    }
670208
public function actionView($id)
    {
        $model = Article::findOne(['id' => $id, 'type' => Article::ARTICLE, 'status' => Article::ARTICLE_PUBLISHED]);
        if( $model === null ) throw new NotFoundHttpException(yii::t("frontend", "Article id {id} is not exists", ['id' => $id]));
        $prev = Article::find()
            ->where(['cid' => $model->cid])
            ->andWhere(['>', 'id', $id])
            ->orderBy("sort asc,created_at desc,id desc")
            ->limit(1)
            ->one();
        $next = Article::find()
            ->where(['cid' => $model->cid])
            ->andWhere(['<', 'id', $id])
            ->orderBy("sort desc,created_at desc,id asc")
            ->limit(1)
            ->one();//->createCommand()->getRawSql();
        $commentModel = new Comment();
        $commentList = $commentModel->getCommentByAid($id);
        $recommends = Article::find()
            ->where(['type' => Article::ARTICLE, 'status' => Article::ARTICLE_PUBLISHED])
            ->andWhere(['<>', 'thumb', ''])
            ->orderBy("rand()")
            ->limit(8)
            ->all();
        switch ($model->visibility){
            case Constants::ARTICLE_VISIBILITY_COMMENT://评论可见
                if( yii::$app->getUser()->getIsGuest() ){
                    $result = Comment::find()->where(['aid'=>$model->id, 'ip'=>yii::$app->getRequest()->getUserIP()])->one();
                }else{
                    $result = Comment::find()->where(['aid'=>$model->id, 'uid'=>yii::$app->getUser()->getId()])->one();
                }
                if( $result === null ) {
                    $model->articleContent->content = "<p style='color: red'>" . yii::t('cms', "Only commented user can visit this article") . "</p>";
                }
                break;
            case Constants::ARTICLE_VISIBILITY_SECRET://加密文章
                $authorized = yii::$app->getSession()->get("article_password_" . $model->id, null);
                if( $authorized === null ) $this->redirect(Url::toRoute(['password', 'id'=>$id]));
                break;
            case Constants::ARTICLE_VISIBILITY_LOGIN://登陆可见
                if( yii::$app->getUser()->getIsGuest() ) {
                    $model->articleContent->content = "<p style='color: red'>" . yii::t('cms', "Only login user can visit this article") . "</p>";
                }
                break;
        }
        return $this->render('view', [
            'model' => $model,
            'prev' => $prev,
            'next' => $next,
            'recommends' => $recommends,
            'commentModel' => $commentModel,
            'commentList' => $commentList,
        ]);
    }
314538
private function load($id = null)
    {

        $this->initialize();
        $this->id = $id;
        $dataConnector = $this->getDataConnector();
        if (!is_null($dataConnector)) {
            return $dataConnector->loadUser($this);
        }

        return false;
    }
207720
public function showAction($id = null)
    {
        /** @var Request $request */
        $request = $this->get('request_stack')->getCurrentRequest();

        $id = $request->get($this->admin->getIdParameter());

        /** @var PageInterface $object */
        $object = $this->admin->getObject($id);

        if (!$object) {
            throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
        }

        if (false === $this->admin->isGranted('VIEW', $object)) {
            throw new AccessDeniedException();
        }

        $this->admin->setSubject($object);

        return $this->renderWithExtraParams(
            $this->admin->getTemplate('show'),
            [
                'action' => 'show',
                'object' => $object,
                'elements' => $this->admin->getShow(),
            ]
        );
    }
929689
public function edit($id = null) {
        if (!$this->Config->exists($id)) {
            throw new NotFoundException(__('Invalid config'));
        }
        if ($this->request->is(array('post', 'put'))) {
            if ($this->Config->save($this->request->data)) {
                $this->Flash->success(__('The config has been saved.'));
                return $this->redirect(array('action' => 'index'));
            } else {
                $this->Flash->error(__('The config could not be saved. Please, try again.'));
            }
        } else {
            $options = array('conditions' => array('Config.' . $this->Config->primaryKey => $id));
            $this->request->data = $this->Config->find('first', $options);
        }
        $configCategoryes = $this->Config->ConfigCategory->find('list');
        $this->set(compact('configCategoryes'));
    }
1108081
public function actionShow($id) {
    $profile = Profile::find()->byId($id)->one();

    if ($profile === null) {
      throw new NotFoundHttpException();
    }

    return $this->render('show', [
      'profile' => $profile,
    ]);
  }
895424
public function view(string $id = null)
    {
        $translation = $this->Translations->get($id, [
            'contain' => ['Languages']
        ]);

        $this->set('translation', $translation);
        $this->set('_serialize', ['translation']);
    }
1208207
public function iHaveUserWithId( $id )
    {
        $name = $this->findNonExistingUserName();
        $user = $this->getUserManager()->ensureUserExists( $name );
        $this->addValuesToKeyMap( $id, $user->id );
    }