info-table.php 1.75 KB
<?php

use yii\helpers\Html;
use frontend\modules\map\models\Item;
use frontend\modules\map\models\ItemLang;

/**
 * @param $attribute
 * @param $model
 */
function trTableShowModel($attribute, $model)
{
    if (isset($model[$attribute]) && !empty($model[$attribute])):
        $labels = (new ItemLang())->getAttributeLabel($attribute) ?? (new Item())->getAttributeLabel($attribute);
        ?>
        <tr>
            <td>
                <?= $labels ?>
            </td>
            <td>
                <?= $model[$attribute] ?>
            </td>
        </tr>
        <?php
    endif;
}

/**
 *
 * @author FilamentV <vortex.filament@gmail.com>
 * @copyright (c), Thread
 *
 * @var $model \frontend\modules\map\models\Item
 */
?>
<table>
    <thead></thead>
    <tfoot></tfoot>
    <tbody>
    <?php
    trTableShowModel('investment', $model);
    trTableShowModel('address', $model['lang']);
    trTableShowModel('initiator', $model['lang']);
    trTableShowModel('project_implementation_period', $model['lang']);
    trTableShowModel('web_site_investor', $model);
    trTableShowModel('web_site', $model);
    trTableShowModel('financing_sources', $model['lang']);
    trTableShowModel('financing_debt', $model['lang']);
    trTableShowModel('licenses', $model['lang']);
    trTableShowModel('licenses_other', $model['lang']);
    trTableShowModel('project_documentation', $model['lang']);
    trTableShowModel('electric_power', $model);
    trTableShowModel('heat_capacity', $model);
    if ($archive) {
        ?>
        <tr>
            <td>
                <?= Yii::t('front', 'Additional files') ?>
            </td>
            <td>
                <?= Html::a(Yii::t('front', 'Download'), $archive) ?>
            </td>
        </tr>
        <?php
    } ?>
    </tbody>
</table>