/**
  * Displays a single Company model.
  * @param integer $id
  * @return mixed
  */
 public function actionView($id)
 {
     $query = Park::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->andFilterWhere(['company_id' => $id]);
     return $this->render('view', ['model' => $this->findModel($id), 'dataProvider' => $dataProvider]);
 }
Exemple #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Park::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'build_time' => $this->build_time, 'pro_start_time' => $this->pro_start_time, 'company_id' => $this->company_id]);
     $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'addr', $this->addr])->andFilterWhere(['like', 'scale', $this->scale])->andFilterWhere(['like', 'intro', $this->intro])->andFilterWhere(['like', 'tel', $this->tel])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'comment', $this->comment])->andFilterWhere(['like', 'pricipal_id', $this->pricipal_id])->andFilterWhere(['like', 'connecter_id', $this->connecter_id]);
     return $dataProvider;
 }
Exemple #3
0
use yii\widgets\ActiveForm;
use app\models\Park;
use app\models\Person;
/* @var $this yii\web\View */
/* @var $model app\models\Land */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="land-form">

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

    <?php 
echo $form->field($model, 'park_id')->dropdownlist(Park::find()->select(['name'])->indexBy('id')->column(), ['prompt' => '所属园区']);
?>

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

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

    <?php 
echo $form->field($model, 'intro')->textarea(['rows' => 6]);
?>

    <?php 
Exemple #4
0
 /**
  * Finds the Park model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Park the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Park::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPark()
 {
     return $this->hasOne(Park::className(), ['id' => 'park_id']);
 }