コード例 #1
0
ファイル: Links.php プロジェクト: mark38/yii2-site-mng
 /**
  * @return \yii\db\`ctiveQuery
  */
 public function getLayout()
 {
     return $this->hasOne(Layouts::className(), ['id' => 'layouts_id']);
 }
コード例 #2
0
ファイル: linkForm.php プロジェクト: mark38/yii2-site-mng
<?php

use yii\bootstrap\ActiveForm;
use yii\bootstrap\Tabs;
use yii\bootstrap\Modal;
use yii\helpers\Html;
use yii\helpers\Url;
use common\models\main\Layouts;
use common\models\main\Views;
use mark38\galleryManager\GalleryManager;
/** @var $link \common\models\main\Links */
$link_close = ['/map/links', 'categories_id' => Yii::$app->request->get('categories_id')];
$layouts = array();
foreach (Layouts::find()->orderBy(['seq' => SORT_ASC])->all() as $layout) {
    $layouts[$layout['id']] = $layout->comment . ' &mdash; ' . $layout->name;
}
$views = array();
foreach (Views::find()->orderBy(['seq' => SORT_ASC])->all() as $view) {
    $views[$view->id] = $view->comment . ' &mdash; ' . $view->name;
}
?>

<?php 
$form = ActiveForm::begin(['method' => 'post', 'layout' => 'horizontal', 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-4', 'offset' => 'col-sm-offset-4', 'wrapper' => 'col-sm-5', 'error' => '', 'hint' => '']]]);
?>

<div class="box box-default">
    <div class="box-header with-border">
        <h3 class="box-title"><?php 
echo Yii::$app->request->get('action') == 'add' ? 'Добавление новой ссылки' : 'Редактирование ссылки';
?>