<div class="box hot_block">
    <?php
    if(HUser::isAdminOrModerator()){
        $editUrl = Yii::app()->createUrl('/themes/backend/widgethot/edit', ['id' => Themes::getParam('id')]);
        echo CHtml::link('<i class="fa fa-edit or-edit-page" title="'.tc('Edit').'"></i>', $editUrl);
    }
    ?>

    <div class="h3 h_line"><?php echo tc('Best listings') ?></div>
    <div class="box-content">

        <div class="tab_header">
            <ul class="nav nav-tabs" id="hot_tabs_link">
                <?php
                $i = 0;
                foreach ($tabsData as $id => $data) {
                    if ($i == 0) {
                        echo '<li class="active"><a href="#Tab' . $id . '" class="slow"><span>' . $data['name'] . '</span></a></li>';
                    } else {
                        echo '<li><a href="#Tab' . $id . '" class="slow"><span>' . $data['name'] . '</span></a></li>';
                    }
                    $i++;
                }

                ?>
            </ul>
        </div>

        <div class="hot_block_content tab-content">
            <?php
            $i = 0;
            ?>
            <?php foreach ($tabsData as $key => $data) : ?>

                <div class="tab-pane row fade <?= (($i == 0) ? 'active in' : '') ?>" id="Tab<?php echo $key ?>">

                    <?php
                    $findIds = $countImagesArr = array();
                    foreach ($data['ads'] as $item) {
                        $findIds[] = $item->id;
                    }

                    if (count($findIds) > 0) {
                        $countImagesArr = Images::getApartmentsCountImages($findIds);
                    }

                    $i++;
                    foreach ($data['ads'] as $item) {
                        $this->render('webroot.themes.' . Yii::app()->theme->name . '.views.modules.apartments.views.widgetApartments_list_block_item', array(
                            'item' => $item,
                            'useWrapper' => true
                        ));
                    }
                    ?>

                </div>
            <?php endforeach; ?>
            <div class="clear"></div>
        </div>

    </div>
</div>
