/** * Import country translates from external source. * This command load and parse countryinfo csv data file. * * @throws Exception if the path argument is invalid. */ public function actionCountries($language) { if (!in_array($language, Module::getInstance()->translateLanguages)) { $this->stdout("Not supported language code, available codes: [" . implode(', ', Module::getInstance()->translateLanguages) . "].\n", Console::FG_RED); return self::EXIT_CODE_ERROR; } $this->module->importer->run('CountryTranslateRunner', ['language' => $language]); $this->stdout(Module::t('common', 'Country translates has been imported') . "!\n", Console::FG_YELLOW); }
<?php use filsh\geonames\Module; /** * @var yii\widgets\ActiveForm $form * @var filsh\geonames\models\Timezone $model */ ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]); ?> <?php foreach (Module::getInstance()->translateLanguages as $language) { echo $form->field($model->translate($language), "[{$language}]title")->textInput(['maxlength' => true]); } ?> <?php echo $form->field($model, 'country')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'timezone')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'offset_gmt')->textInput(['maxlength' => true]); ?>
/** * Deletes an existing Country model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $this->findModel($id)->delete(); Yii::$app->getSession()->setFlash('success', Module::t('geonames', 'Country has been deleted')); return $this->redirect(['index']); }
/** * @inheritdoc */ public function attributeLabels() { return ['country_id' => Module::t('geonames', 'Country ID'), 'language' => Module::t('geonames', 'Language'), 'name' => Module::t('geonames', 'Name', [], $this->language) . '(' . $this->language . ')', 'capital' => Module::t('geonames', 'Capital', [], $this->language) . '(' . $this->language . ')', 'currency_name' => Module::t('geonames', 'Currency Name', [], $this->language) . '(' . $this->language . ')']; }
<?php /** * @var $this yii\web\View */ use yii\bootstrap\Nav; use filsh\geonames\Module; ?> <?php echo Nav::widget(['options' => ['class' => 'nav-tabs', 'style' => 'margin-bottom: 15px'], 'items' => [['label' => Module::t('geonames', 'Countries'), 'url' => ['/geonames/countries/index']], ['label' => Module::t('geonames', 'Timezones'), 'url' => ['/geonames/timezones/index']]]]);
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ use yii\helpers\Html; use yii\bootstrap\ActiveForm; use filsh\geonames\Module; $form = ActiveForm::begin(['layout' => 'horizontal', 'enableAjaxValidation' => true, 'enableClientValidation' => false, 'fieldConfig' => ['horizontalCssClasses' => ['wrapper' => 'col-sm-9']]]); ?> <?php echo $this->render('_timezone', ['form' => $form, 'model' => $model]); ?> <div class="form-group"> <div class="col-lg-offset-3 col-lg-9"> <?php echo Html::submitButton($model->getIsNewRecord() ? Module::t('geonames', 'Create') : Module::t('geonames', 'Update'), ['class' => 'btn btn-block btn-success']); ?> </div> </div> <?php ActiveForm::end();
/** * @inheritdoc */ public function attributeLabels() { return ['timezone_id' => Module::t('geonames', 'Timezone ID'), 'language' => Module::t('geonames', 'Language'), 'title' => Module::t('geonames', 'Title', [], $this->language) . '(' . $this->language . ')']; }
/** * @inheritdoc */ public function attributeLabels() { return ['id' => Module::t('geonames', 'ID'), 'iso' => Module::t('geonames', 'Iso'), 'iso3' => Module::t('geonames', 'Iso3'), 'iso_numeric' => Module::t('geonames', 'Iso Numeric'), 'fips' => Module::t('geonames', 'Fips'), 'name' => Module::t('geonames', 'Name'), 'capital' => Module::t('geonames', 'Capital'), 'area' => Module::t('geonames', 'Area'), 'population' => Module::t('geonames', 'Population'), 'continent' => Module::t('geonames', 'Continent'), 'tld' => Module::t('geonames', 'Tld'), 'currency_code' => Module::t('geonames', 'Currency Code'), 'currency_name' => Module::t('geonames', 'Currency Name'), 'phone_code' => Module::t('geonames', 'Phone Code'), 'postal_code_format' => Module::t('geonames', 'Postal Code Format'), 'postal_code_regex' => Module::t('geonames', 'Postal Code Regex'), 'languages' => Module::t('geonames', 'Languages'), 'geoname_id' => Module::t('geonames', 'Geoname ID'), 'neighbours' => Module::t('geonames', 'Neighbours'), 'equivalent_fips_code' => Module::t('geonames', 'Equivalent Fips Code'), 'created_at' => Module::t('geonames', 'Create Time'), 'updated_at' => Module::t('geonames', 'Update Time')]; }
/** * @inheritdoc */ public function attributeLabels() { return ['id' => Module::t('geonames', 'ID'), 'title' => Module::t('geonames', 'Title'), 'country' => Module::t('geonames', 'Country'), 'timezone' => Module::t('geonames', 'Timezone'), 'offset_gmt' => Module::t('geonames', 'Offset Gmt'), 'offset_dst' => Module::t('geonames', 'Offset Dst'), 'offset_raw' => Module::t('geonames', 'Offset Raw'), 'order_popular' => Module::t('geonames', 'Order Popular'), 'created_at' => Module::t('geonames', 'Create Time'), 'updated_at' => Module::t('geonames', 'Update Time')]; }
?> <?php echo $this->render('/_alert', ['module' => Yii::$app->getModule('geonames')]); ?> <?php echo $this->render('/_menu'); ?> <div class="row"> <div class="col-md-3"> <div class="panel panel-default"> <div class="panel-body"> <?php echo Nav::widget(['options' => ['class' => 'nav-pills nav-stacked'], 'items' => [['label' => Module::t('geonames', 'Timezone details'), 'url' => ['/geonames/timezones/update', 'id' => $model->id]], '<hr>', ['label' => Module::t('geonames', 'Delete'), 'url' => ['/geonames/timezones/delete', 'id' => $model->id], 'linkOptions' => ['class' => 'text-danger', 'data-method' => 'post', 'data-confirm' => Module::t('geonames', 'Are you sure you want to delete this record?')]]]]); ?> </div> </div> </div> <div class="col-md-9"> <div class="panel panel-default"> <div class="panel-body"> <?php echo $content; ?> </div> </div> </div> </div>
/** * Import timezones from external source. * This command load and parse timezones csv data file. * * @throws Exception if the path argument is invalid. */ public function actionTimezones() { $this->module->importer->run('TimezoneRunner'); $this->stdout(Module::t('common', 'Timezones has been imported') . "!\n", Console::FG_YELLOW); }