/**
  * @inheritdoc
  */
 public function actions()
 {
     return ArrayHelper::merge(parent::actions(), ['index' => ["columns" => [['class' => DataColumn::className(), 'attribute' => 'name', 'format' => 'raw', 'value' => function (KladrLocation $model) {
         if ($model->parent_id) {
             return $model->fullName . " <small>(" . implode(", ", ArrayHelper::map($model->parents, 'id', 'fullName')) . ") </small>";
         } else {
             return $model->fullName;
         }
     }], ['class' => DataColumn::className(), 'attribute' => 'type', 'filter' => KladrLocation::possibleTypes(), 'value' => function (KladrLocation $model) {
         return $model->typeName;
     }]]], 'update-database' => ["class" => AdminAction::className(), "name" => "Импорт местоположений", "icon" => "glyphicon glyphicon-paperclip", "callback" => [$this, 'actionUpdateDatabase']]]);
 }
Esempio n. 2
0
?>

<?php 
$form = ActiveForm::begin();
?>

<?php 
echo $form->fieldSet('Основное');
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->fieldSelect($model, 'type', \skeeks\cms\kladr\models\KladrLocation::possibleTypes());
?>
    <?php 
echo $form->fieldSelect($model, 'parent_id', \yii\helpers\ArrayHelper::map(\skeeks\cms\kladr\models\KladrLocation::find()->all(), 'id', 'name'));
?>

    <?php 
echo $form->field($model, 'name_short')->textInput(['maxlength' => 255]);
?>
    <?php 
echo $form->field($model, 'name_full')->textInput(['maxlength' => 255]);
?>

<?php 
echo $form->fieldSetEnd();
?>