ItemLang.php 9.39 KB
<?php

namespace common\modules\map\models;

use Yii;
use yii\helpers\ArrayHelper;
use thread\app\base\models\ActiveRecordLang;
use common\modules\map\Map as MainModule;

/**
 * Class ItemLang
 *
 * @property integer $rid
 * @property string $lang
 * @property string $description
 * @property string $title
 * @property string $initiator
 * @property string $kind_of_economic_activity
 * @property string $project_implementation_period
 * @property string $investment_schedule
 * @property string $financing_sources
 * @property string $estimated_return_on_investment
 * @property string $achieved_effect
 * @property string $forms_cooperation_with_investor
 * @property string $technical_parameters
 * @property string $licenses
 * @property string $project_documentation
 * @property string $infrastructure
 * @property string $talks
 * @author Alla Kuzmenko
 * @package common\modules\map\models
 * @copyright (c), Thread
 */
class ItemLang extends ActiveRecordLang
{
    const moduleName = 'map';


    /**
     * @return null|object|string
     */
    public static function getDb()
    {
        return MainModule::getDb();
    }

    /**
     * @return string
     */
    public static function tableName()
    {
        return '{{%map_item_lang}}';
    }

    /**
     * @return array
     */
    public function rules()
    {
        return ArrayHelper::merge(parent::rules(), [
            [['title', 'licenses'], 'required'],
            ['rid', 'exist', 'targetClass' => Item::class, 'targetAttribute' => 'id'],
            [['title', 'address', 'project_implementation_period'], 'string', 'max' => 255],
            [[
                'project_documentation', 'financing_sources', 'financing_debt',
                'annual_power_production', 'annual_heat_production', 'power_price', 'heat_price',
                'expected_financial_return'
            ], 'string', 'max' => 1024],
            [['description',
                'investment_schedule',
                'total_investment',
                'investment_schedule',
                'licenses_other',
                'estimated_return_on_investment',
                'achieved_effect', 'technical_parameters',
                'contact_details_of_project_promoter',
                'forms_cooperation_with_investor'], 'string', 'max' => 65535],
            [['description', 'contact_details_of_project_promoter', 'total_investment'], 'default', 'value' => ' '],

        ]);
    }


    /**
     * @return array
     */
    public function scenarios()
    {
        return [
            'backend' => [
                'title', 'description', 'kind_of_economic_activity', 'initiator', 'project_implementation_period',
                'investment_schedule', 'financing_sources', 'estimated_return_on_investment',
                'achieved_effect', 'forms_cooperation_with_investor', 'technical_parameters', 'licenses',
                'project_documentation', 'infrastructure', 'talks', 'expenditure_additional_infrastructure', 'address',
                'contact_details_of_project_promoter', 'total_investment', 'financing_debt',
                'annual_power_production', 'annual_heat_production', 'power_price', 'heat_price',
                'expected_financial_return', 'licenses_other', 'investment_schedule',
            ],
        ];
    }


    /**
     * @return array
     */
    public function attributeLabels()
    {
        return [
            'rid' => Yii::t('app', 'RID'),
            'lang' => Yii::t('app', 'Lang'),
            'title' => Yii::t('app', 'Title'),
            'description' => Yii::t('map', 'Description'),
            'kind_of_economic_activity' => Yii::t('map', 'Kind of economic activity'),
            'initiator' => Yii::t('map', 'Initiator'),
            'project_implementation_period' => Yii::t('map', 'Project implementation period'),
            'investment_schedule' => Yii::t('map', 'investment_schedule'),
            'financing_sources' => Yii::t('map', 'financing_sources'),
            'financing_debt' => Yii::t('map', 'financing_debt'),
            'estimated_return_on_investment' => Yii::t('map', 'estimated_return_on_investment'),
            'achieved_effect' => Yii::t('map', 'achieved_effect'),
            'forms_cooperation_with_investor' => Yii::t('map', 'forms_cooperation_with_investor'),
            'technical_parameters' => Yii::t('map', 'technical_parameters'),
            'licenses' => Yii::t('map', 'licenses'),
            'project_documentation' => Yii::t('map', 'project_documentation'),
            'infrastructure' => Yii::t('map', 'infrastructure'),
            'talks' => Yii::t('map', 'talks'),
            'address' => Yii::t('map', 'address'),
            'expenditure_additional_infrastructure' => Yii::t('map', 'Expenditure on construction of additional infrastructure'),
            'contact_details_of_project_promoter' => Yii::t('map', 'Contact details of project promoter'),
            'total_investment' => Yii::t('map', 'total_investment'),
            'annual_power_production' => Yii::t('map', 'annual_power_production'),
            'annual_heat_production' => Yii::t('map', 'annual_heat_production'),
            'power_price' => Yii::t('map', 'power_price'),
            'heat_price' => Yii::t('map', 'heat_price'),
            'expected_financial_return' => Yii::t('map', 'expected_financial_return'),
            'investment' => Yii::t('map', 'Investment'),
            'alias' => Yii::t('app', 'Alias'),
            'type_id' => Yii::t('map', 'type'),
            'area_id' => Yii::t('map', 'area'),
            'user_id' => Yii::t('map', 'User'),
            'gallery_image' => Yii::t('map', 'Gallery image'),
            'gallery_file' => Yii::t('map', 'Gallery file'),
            'youtube_link' => Yii::t('map', 'Video link'),
            'web_site' => Yii::t('map', 'web_site'),
            'type' => Yii::t('map', 'Type'),
            'coordinates' => Yii::t('map', 'Coordinates'),
            'electric_power' => Yii::t('map', 'Electric power'),
            'region_id' => Yii::t('map', 'Region'),
            'web_site_investor' => Yii::t('map', 'web site investor'),
            'position' => Yii::t('app', 'Position'),
            'created_at' => Yii::t('app', 'Create time'),
            'updated_at' => Yii::t('app', 'Update time'),
            'published' => Yii::t('app', 'Published'),
            'deleted' => Yii::t('app', 'Deleted'),
            'heat_capacity' => Yii::t('map', 'heat_capacity'),
            'type_of_promoter' => Yii::t('map', 'type_of_promoter'),
            'date_of_entry' => Yii::t('map', 'date_of_entry'),
            'share_of_project_equity_offered' => Yii::t('map', 'Share of project equity offered'),
            'current_stage_of_project_development' => Yii::t('map', 'Current stage of project development'),
            'licenses_other' => Yii::t('map', 'licenses_other'),
            'investment_schedule' => Yii::t('map', 'Investment schedule (monthly or quarterly)'),
        ];
    }

    /**
     * @return array
     */
    public static function licensesRangeListUA()
    {
        return [
            'Оренда землі для будівництва' => 'Оренда землі для будівництва',
            'Право власності на землю' => 'Право власності на землю',
            'Договір про приєднання до електричних мереж' => 'Договір про приєднання до електричних мереж',
            'Договір про приєднання до теплових мереж' => 'Договір про приєднання до теплових мереж',
            'Дозвіл на будівництво' => 'Дозвіл на будівництво',
            'Ліцензія на виробництво електроенергії' => 'Ліцензія на виробництво електроенергії',
            'Ліцензія на виробництво теплової енергії' => 'Ліцензія на виробництво теплової енергії',
            'Ліцензія на комбіноване виробництво електричної та теплової енергії' => 'Ліцензія на комбіноване виробництво електричної та теплової енергії',
            'Заява на отримання "зеленого" тарифу' => 'Заява на отримання "зеленого" тарифу',
            'Інші' => 'Інші',
        ];
    }

    /**
     * @return array
     */
    public static function licensesRangeListEN()
    {
        return [
            'Lease for land for construction' => 'Lease for land for construction',
            'Ownership for land' => 'Ownership for land',
            'Agreement on connection to the electricity grid' => 'Agreement on connection to the electricity grid',
            'Agreement on connection to heat off-taker (if relevant)' => 'Agreement on connection to heat off-taker (if relevant)',
            'Construction permit' => 'Construction permit',
            'License to produce electric energy' => 'License to produce electric energy',
            'License to produce heat energy' => 'License to produce heat energy',
            'License to produce combined heat and electricity' => 'License to produce combined heat and electricity',
            'Application for Green tariff' => 'Application for Green tariff',
            'Others' => 'Others',
        ];
    }
}