Пример #1
0
 /**
  * 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]);
     if (!($this->load($params) && $this->validate())) {
         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
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\master\Orgn;
/* @var $this yii\web\View */
/* @var $model app\models\master\Branch */
/* @var $form yii\widgets\ActiveForm */
?>


<div class="box box-warning">
    <?php 
$form = ActiveForm::begin();
?>
    <div class="box-body">
        <?php 
echo $form->field($model, 'orgn_id')->dropDownList(Orgn::selectOptions());
?>

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

        <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 32]);
?>
    </div>
    <div class="box-footer">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
Пример #3
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.');
     }
 }
Пример #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrgn()
 {
     return $this->hasOne(Orgn::className(), ['id' => 'orgn_id']);
 }