<?php
$this->pageHeader = $this->pageTitle = CHtml::encode($model->name);
var_dump($model->checkAccess('administrator'));
?>
<?php if ($model->hasSubscriber($this->webUser)): ?>
<div class="text">
<?= Yii::t('Publics', 'You are a subscriber of {public}', array('{public}' => CHtml::encode($model->name))) ?><br />
</div>
<?php endif; ?>
<?php if ($model->checkAccess('writer')): ?>
<div class="blue_block">
<strong><?= Theme::icon(Theme::ICON_ADD) ?> <?= CHtml::link(Yii::t('Publics', 'Create new post'), array('writePost', 'id' => $model->id)) ?></strong>
<?php if ($model->checkAccess('administrator')): ?>
<strong><?= Theme::icon(Theme::ICON_IEDIT) ?> <?= CHtml::link(Yii::t('Publics', 'Update public'), array('update', 'id' => $model->id)) ?></strong>
<strong><?= Theme::icon(Theme::ICON_IDELETE) ?> <?= CHtml::link(Yii::t('Publics', 'Delete public'), array('confirm', 'id' => $model->id)) ?></strong>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="blue_block">
<?php if ($model->hasSubscriber($this->webUser)): ?>
<strong><?= Theme::icon(Theme::ICON_SUBSCRIPTIONS, 'unsubscribe') ?> <?= CHtml::link(Yii::t('Publics', 'Unsubscribe [x]'), array('unsubscribe', 'id' => $model->id)) ?></strong><br />
<?php else: ?>
<strong><?= Theme::icon(Theme::ICON_SUBSCRIPTIONS, 'subscribe') ?> <?= CHtml::link(Yii::t('Publics', 'Subscribe'), array('subscribe', 'id' => $model->id)) ?></strong><br />
<?php endif; ?>
<strong><?= Theme::icon(Theme::ICON_FRIENDS, 'readers') ?> <?= CHtml::link(Yii::t('Publics', 'Readers'), array('readers', 'id' => $model->id)) ?></strong><br />
</div>
<?php $this->widget('zii.widgets.CListView', array(
'dataProvider' => $posts,
'itemView' => '../post/_post',
'template' => '{items}'.PHP_EOL.'{pager}',
'pager' => array('class' => 'CPager'),
'emptyText' => CHtml::tag('div', array('class' => 'text'), Yii::t('Publics', 'No posts found')),
)) ?>