<?php echo CHtml::link('<img src="/images/icons/quality/'.$type.'.png"> Купить всё за '.$all, array('buy', 'type' => $type, 'id'=> 'all', 'id_set'=>$id_set), array('class' => 'block')); ?>
Скидка: <?php echo $sale;?><hr />

<?php if ($items == null): ?>
    Магазин пуст
<?php else: ?>
    <?php foreach ($items as $item): ?>
        <?php 
        $user_item = UserItems::findUserItem($item);
        //$sum = $item->health+$item->armor+$item->strength+$item->regeneration+$item->energy;
        if ($user_item)
            $better = ($item->sum > $user_item->sum ? $item->sum-$user_item->sum : false);
        else 
            $better = $item->sum;
        ?>
        <div class="item-view">
            <div class="item-view_img">
                <?php if ($better): ?>
                    <div class="item-view_better">
                        +<?php echo $better; ?>
                    </div>
                <?php endif; ?>
                <img src="/images/items/<?php echo $item->id_set;?>/<?php echo $item->type;?>.jpg">
            </div>
            <div class="item-view_info">
                <img src="/images/icons/quality/<?php echo $type;?>.png"> 
                <?php echo CHtml::link($item['name'], array('view', 'type' => $type, 'item'=> $item->id_item, 'id_set'=> $item->id_set), array('class' => 'quality-'.$type)); ?><br />
                <b><?php echo $item->level;?></b> ур.
                <br /> 
                [<?php echo CHtml::link('Купить за '.$item->price, array('buy', 'type' => $type, 'id'=> $item->id_item, 'id_set'=> $item->id_set)); ?>]
            </div>
        </div>
        <hr />
    <?php endforeach; ?>
<?php endif; ?>