/** * Store a newly created resource in storage. * * @return Response */ public function store(ProfessorRequest $request) { $data = $request->all(); $professor = new Professor(); $professor->fromArray($data); $professor->save(); flash()->success("ADDED"); session(['attribute' => \Lang::get('general.PROFESSOR')]); return redirect($this->main_page); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Professor::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, 'Telefone' => $this->Telefone]); $query->andFilterWhere(['like', 'Nome', $this->Nome])->andFilterWhere(['like', 'Email', $this->Email]); return $dataProvider; }
/** * Filter the query by a related \App\Models\Professor object * * @param \App\Models\Professor|ObjectCollection $professor The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * * @return ChildEngagementQuery The current query, for fluid interface */ public function filterByProfessor($professor, $comparison = null) { if ($professor instanceof \App\Models\Professor) { return $this->addUsingAlias(EngagementTableMap::COL_PROFESSOR_ID, $professor->getId(), $comparison); } elseif ($professor instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(EngagementTableMap::COL_PROFESSOR_ID, $professor->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByProfessor() only accepts arguments of type \\App\\Models\\Professor or Collection'); } }
/** * @return \yii\db\ActiveQuery */ public function getProfessor() { return $this->hasOne(Professor::className(), ['ID' => 'idProfessor']); }
/** * Exclude object from result * * @param ChildProfessor $professor Object to remove from the list of results * * @return $this|ChildProfessorQuery The current query, for fluid interface */ public function prune($professor = null) { if ($professor) { $this->addUsingAlias(ProfessorTableMap::COL_ID, $professor->getId(), Criteria::NOT_EQUAL); } return $this; }
/** * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). */ public function clear() { if (null !== $this->aProfessor) { $this->aProfessor->removeAdminUser($this); } if (null !== $this->aStudent) { $this->aStudent->removeAdminUser($this); } if (null !== $this->aTranslationLanguage) { $this->aTranslationLanguage->removeAdminUser($this); } $this->id = null; $this->language_id = null; $this->professor_id = null; $this->student_id = null; $this->name = null; $this->login = null; $this->password = null; $this->email = null; $this->status = null; $this->remember_token = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->applyDefaultValues(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }
/** * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). */ public function clear() { if (null !== $this->aCourse) { $this->aCourse->removeEngagement($this); } if (null !== $this->aProfessor) { $this->aProfessor->removeEngagement($this); } if (null !== $this->aSubject) { $this->aSubject->removeEngagement($this); } if (null !== $this->aSchoolYear) { $this->aSchoolYear->removeEngagement($this); } $this->professor_id = null; $this->subject_id = null; $this->course_id = null; $this->school_year_id = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }
/** * Finds the Professor model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Professor the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Professor::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
--> <?php echo $form->field($model, 'idDisciplina')->dropDownList(ArrayHelper::map(Disciplina::find()->orderBy('nomeDisciplina')->asArray()->all(), 'id', 'nomeDisciplina'), ['prompt' => 'Selecione uma disciplina', 'style' => 'width:600px']); ?> <?php echo $form->field($model, 'codTurma')->textInput(['maxlength' => true, 'style' => 'width:130px']); ?> <?php echo $form->field($model, 'idCurso')->dropDownList(ArrayHelper::map(Curso::find()->orderBy('nome')->asArray()->all(), 'ID', 'nome'), ['prompt' => 'Selecione um curso', 'style' => 'width:300px']); ?> <?php echo $form->field($model, 'idProfessor')->dropDownList(ArrayHelper::map(Professor::find()->orderBy('Nome')->asArray()->all(), 'ID', 'Nome'), ['prompt' => 'Selecione o professor', 'style' => 'width:600px']); ?> <?php echo $form->field($model, 'nomeUnidade')->textInput(['maxlength' => true, 'style' => 'width:600px']); ?> <?php echo $form->field($model, 'qtdVagas')->textInput(['style' => 'width:130px']); ?> <?php echo $form->field($model, 'numPeriodo')->textInput(['style' => 'width:130px']); ?> <?php