<?php
/* @var $this UserController */
/* @var $model Users */

$this->pageTitle = 'Снаряжение';
?>

<?php if ($model->id_user == Yii::app()->user->id): ?>
    <?php if (UserItems::countSummaryHardness()): ?>
        <?php echo CHtml::link('Починить все вещи за <img src="/images/icons/iron.png" alt="*">' . UserItems::countSummaryHardness(), array('/item/repairAll/'), array('class' => 'block')) ?>
    <?php endif; ?>
    <?php echo CHtml::link('<img src="/images/icons/bag.png" alt="*"> Рюкзак <span class="percent">(' . $count['backpack'] . '/' . $model->backpack . ')</span>', array('/user/backpack/', 'id' => $model->id_user), array('class' => 'block')) ?>
<?php else: ?>
    <?php echo CHtml::link('<img src="/images/icons/arrow.png" alt="*"> Персонаж', array('/user/', 'id' => $model->id_user), array('class' => 'block')) ?>
<?php endif; ?>

<?php foreach ($items as $item): ?>
    <div class="item-view">
        <div class="item-view_img">
            <?php if ($item['better']): ?>
                <div class="item-view_better">
                    +<?php echo $item['better']; ?>
                </div>
            <?php endif; ?>
            <img src="/images/items/<?php echo ($item['img'] ? $item['img'] : 0); ?>.jpg">
        </div>
        <div class="item-view_info">
            <?php if ($item['id']): ?>
                <?php echo $item['name']; ?><br /> 
                <span class="small">
                    <?php echo $item['level']; ?> ур. <span class="green"><?php echo UserItems::enchantInfo($item['id']); ?></span>
                </span><br />
                <?php if ($item['status'] == ITEM_ON_BODY && $item['id_user'] == Yii::app()->user->id): ?>
                    <?php echo CHtml::link('[в рюкзак]', array('/item/backpack', 'id' => $item['id'])); ?>
                    <?php echo CHtml::link('[в сундук]', array('/item/store', 'id' => $item['id'])); ?>
                <?php endif; ?>
            <?php else: ?>
                <?php echo $item['type']; ?><br />
                пусто<br />
                &nbsp;<br />
            <?php endif; ?>
        </div>
    </div>
    <hr />
<?php endforeach; ?>