예제 #1
0
파일: Majors.php 프로젝트: efgm1024/SysPGPP
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFaculty()
 {
     return $this->hasOne(Faculties::className(), ['id' => 'faculty_id']);
 }
예제 #2
0
 /**
  * Finds the Faculties model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Faculties the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Faculties::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #3
0
파일: _form.php 프로젝트: efgm1024/SysPGPP
<div class="majors-form">
  <div class="container">
    <div class="row">
      <?php 
$form = ActiveForm::begin();
?>

      <div class="input-field col s12">
        <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
      </div>
      
      <div class="input-field col s12">
        <?php 
echo Html::activeDropDownList($model, 'faculty_id', ArrayHelper::map(Faculties::find()->all(), 'id', 'name'));
?>
        <?php 
echo Html::tag('label', 'Facultad');
?>
      </div>

      <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Guardar' : 'Actualizar', ['class' => $model->isNewRecord ? 'waves-effect waves-light btn red lighten-1' : 'waves-effect waves-light btn red lighten-1']);
?>
      </div>

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