Просмотр файла vkclone-0.0.1/protected/modules/users/views/user/index.php

Размер файла: 4.57Kb
<?php
$this->pageHeader = $this->pageTitle = CHtml::encode($user->name);
?>

<?php if (!Yii::app()->user->isGuest && Yii::app()->user->record->id != $user->id): ?>
<div class="blue_block">
	<strong><?= CHtml::image(Yii::app()->baseUrl.'/images/chat.png', 'write a message to', array('class' => 'favicon_image')) ?> <?= CHtml::link(Yii::t('Users', 'Send message'), array('/talks/default/dialog', 'id' => $user->id)) ?></strong><br />

	<?php if ($friendshipStatus === null): ?>
		<strong><?= CHtml::image(Yii::app()->baseUrl.'/images/friends.png', 'friends with', array('class' => 'favicon_image')) ?> <?= CHtml::link(Yii::t('Users', 'Add user in friends'), array('friends/addToFriends', 'user' => $user->id)) ?></strong><br />
	<?php else: ?>
		<strong><?= CHtml::image(Yii::app()->baseUrl.'/images/friends.png', 'unfriends', array('class' => 'favicon_image')) ?> <?= CHtml::link(Yii::t('Users', $friendshipStatus->approved == 1 ? 'Delete user from friends' : 'Cancel friendship request'), array('friends/deleteFromFriends', 'user' => $user->id)) ?></strong><br />
	<?php endif; ?>

	<?php if ($friendshipStatus !== null): ?>
		<?= Yii::t('Users', $friendshipStatus->approved == 1
			? '{user} is your friend'
			: '{user} can become your friend', array('{user}' => CHtml::tag('i', array(), $user->name))
			) ?>
	<?php endif; ?>

</div>
<?php endif; ?>

<div class="text">
	<?php if ($user->profile->avatar_id === null): ?>
		<?= CHtml::image(Yii::app()->baseUrl.'/images/'.$user->gender.'.72.png', $user->gender) ?><br />
	<?php else: ?>
		<?= CHtml::link(CHtml::image($user->profile->avatar->isReady(72) ? $user->profile->avatar->getWebPath(72) : Yii::app()->baseUrl.'/images/'.$user->gender.'.72.png', $user->gender), array('/gallery/photo/index', 'id' => $user->profile->avatar_id)) ?><br />
	<?php endif; ?>
	<table class="userinfo">
		<tr>
			<th><?= Yii::t('Users', 'Last activity') ?></th>
			<td><?= $user->isOnline()
				? CHtml::tag('span', array('title' => Yii::app()->dateFormatter->formatDateTimeInterval($user->visited_at)), CHtml::image(Yii::app()->baseUrl.'/images/'.($user->isOnline() ? 'online' : 'offline').'.gif', $user->isOnline() ? 'online' : 'offline').' '.Yii::t('Users', 'Online'))
				: Yii::app()->dateFormatter->formatDateTime($user->visited_at) ?></td>
		</tr>
		<tr>
			<th><?= Yii::t('Users', 'Date of birth') ?></th>
			<td><?= $user->birth_date === null
				? Yii::t('Users', 'unknow')
				: Yii::t('Users', '{birth_date} ({n} year old)|{birth_date} ({n} years old)', array(
						date('Y', time() - strtotime($user->birth_date)) - 1970,
						'{birth_date}' => Yii::app()->dateFormatter->formatDateTime(strtotime($user->birth_date), 'long', null)
				)) ?></td>
		</tr>
	</table>
</div>

<?php if ($user->totalPhotos > 0): ?>
	<div class="blue_block">
		<?= CHtml::image(Yii::app()->baseUrl.'/images/photos.png', 'photos', array('class' => 'favicon_image')) ?>
		<strong><?= CHtml::link(Yii::t('Users', 'Photos'), array('/gallery/default/userPhotos', 'user' => $user->id)) ?> (<?= Yii::app()->format->formatNumber($user->totalPhotos) ?>)</strong>
	</div>
<?php endif; ?>

<?php if ($user->totalForumTopics > 0): ?>
	<div class="blue_block">
		<?= CHtml::image(Yii::app()->baseUrl.'/images/forum.png', 'forum topics', array('class' => 'favicon_image')) ?>
		<strong><?= CHtml::link(Yii::t('Users', 'Forum topics'), array('/forums/default/userTopics', 'user' => $user->id)) ?> (<?= Yii::app()->format->formatNumber($user->totalForumTopics) ?>)</strong>
	</div>
<?php endif; ?>

<?php if ($user->totalFriends > 0): ?>
	<div class="blue_block">
		<?= CHtml::image(Yii::app()->baseUrl.'/images/friends.png', 'friends', array('class' => 'favicon_image')) ?>
		<strong><?= CHtml::link(Yii::t('Users', 'Friends'), array('/users/friends/userFriends', 'user' => $user->id)) ?> (<?= Yii::app()->format->formatNumber($user->totalFriends) ?>)</strong>
	</div>
<?php endif; ?>

<?php if ($user->totalGroups > 0): ?>
	<div class="blue_block">
		<?= CHtml::image(Yii::app()->baseUrl.'/images/group.png', 'readers', array('class' => 'favicon_image')) ?>
		<strong><?= CHtml::link(Yii::t('Users', 'Groups'), array('/groups/default/userGroups', 'user' => $user->id)) ?> (<?= Yii::app()->format->formatNumber($user->totalGroups) ?>)</strong>
	</div>
<?php endif; ?>

<?php if ($user->totalPublics > 0): ?>
	<div class="blue_block">
		<?= CHtml::image(Yii::app()->baseUrl.'/images/public.png', 'subscriptions', array('class' => 'favicon_image')) ?>
		<strong><?= CHtml::link(Yii::t('Users', 'Publics'), array('/publics/default/userGroups', 'user' => $user->id)) ?> (<?= Yii::app()->format->formatNumber($user->totalPublics) ?>)</strong>
	</div>
<?php endif; ?>