示例#1
0
/* @var $this yii\web\View */
/* @var $model app\models\Projekt */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="projekt-form">

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

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

    <?php 
echo $form->field($model, 'firma_id')->dropDownList(ArrayHelper::map(Firma::find()->all(), 'id', 'name'));
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
 /**
  * Finds the Firma model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Firma the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Firma::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFirma()
 {
     return $this->hasOne(Firma::className(), ['id' => 'firma_id']);
 }
示例#4
0
    <div class="row">
        <div class="col-sm-2">
            <?php 
echo $form->field($modelDatenblatt, 'nummer')->textInput(['maxlength' => true]);
?>
        </div>
    </div>
    
    <?php 
if ($modelDatenblatt->id) {
    ?>
    <div class="row">
        <div class="col-sm-2">
            <?php 
    echo $form->field($modelDatenblatt, 'firma_id')->dropDownList(ArrayHelper::map(Firma::find()->all(), 'id', 'name'), ['prompt' => 'Firma auswählen']);
    ?>
        </div>
        <div class="col-sm-2">
            <?php 
    $projekte = $modelDatenblatt->firma ? $modelDatenblatt->firma->projekts : [];
    echo $form->field($modelDatenblatt, 'projekt_id')->dropDownList(ArrayHelper::map($projekte, 'id', 'name'), ['prompt' => 'Projekt auswählen']);
    ?>
        </div>
        <div class="col-sm-2">
            <?php 
    $haeuser = $modelDatenblatt->firma && $modelDatenblatt->projekt ? $modelDatenblatt->projekt->hauses : [];
    echo $form->field($modelDatenblatt, 'haus_id')->dropDownList(ArrayHelper::map($haeuser, 'id', 'id'), ['prompt' => 'Haus auswählen']);
    ?>
        </div>
    </div>