/** * Displays a single Maker model. * @param integer $id * @return mixed */ public function actionView($id) { $model = $this->findModel($id); $begoodats = Begoodatprof::find()->where('id in (' . $model->begoodat . ')')->all(); // Yii::$app->MyComponent->p( implode(',',ArrayHelper::map ($begoodats,'id','begoodat') ) ) ;die() ; $model->begoodat = implode(',', ArrayHelper::map($begoodats, 'id', 'begoodat')); return $this->render('view', ['model' => $model]); }
<?php echo $form->field($model, 'prov')->dropDownList(ArrayHelper::map(Prov::find()->all(), 'id', 'provname'), ['prompt' => '选个省直/辖市', 'onchange' => ' $.post( "index.php?r=maker/lists&id=' . '"+$(this).val(), function( data ) { $( "select#maker-city" ).html( data ); });']); ?> <?php echo $form->field($model, 'city')->dropDownList(ArrayHelper::map(City::find()->all(), 'id', 'cityname'), []); ?> </div> <?php echo $form->field($model, 'begoodat')->checkboxlist(ArrayHelper::map(Begoodatprof::find()->all(), 'id', 'begoodat'), [0, 2]); ?> <?php echo $form->field($model, 'unicres')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'simpcv')->textarea(['maxlength' => true]); ?> <div class="form-inline"> <?php echo $form->field($model, 'tel')->textInput(['maxlength' => true]); ?> <?php