コード例 #1
0
ファイル: Orgn.php プロジェクト: sangkil/biz3-distro
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = OrgnModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         $query->where('1=0');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: Branch.php プロジェクト: sangkil/biz3-distro
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrgn()
 {
     return $this->hasOne(Orgn::className(), ['id' => 'orgn_id']);
 }
コード例 #3
0
ファイル: _form.php プロジェクト: sangkil/biz3-distro
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\master\Branch */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="branch-form">

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

    <?php 
echo $form->field($model, 'orgn_id')->dropDownList(\backend\models\master\Orgn::selectOptions(), ['style' => 'width:40%;']);
?>

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

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

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

    <div class="form-group">
コード例 #4
0
 /**
  * Finds the Orgn model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Orgn the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Orgn::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #5
0
ファイル: index.php プロジェクト: sangkil/biz3-distro
<?php

use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\master\search\Branch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Branches';
$this->params['breadcrumbs'][] = $this->title;
?>
<p class='pull-right'>
    <?php 
echo Html::a('Create Branch', ['create'], ['class' => 'btn btn-default']);
?>
</p>
<br>

<div class="branch-index">

    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table table-hover'], 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'code', 'name', 'addr', ['header' => 'Orgn', 'attribute' => 'orgn_id', 'value' => 'orgn.name', 'filter' => \backend\models\master\Orgn::selectOptions()], 'created_at:datetime', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>