Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Agendas::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]);
     $query->andFilterWhere(['like', 'nome', $this->nome]);
     return $dataProvider;
 }
 /**
  * Finds the Agendas model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Agendas the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Agendas::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAgenda()
 {
     return $this->hasOne(Agendas::className(), ['id' => 'agenda_id']);
 }
Пример #4
0
/* @var $form yii\widgets\ActiveForm */
?>


<div class="atividades-form">
    <div class="row">
        <div class="col-md-9">

            <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'formConfig' => ['labelSpan' => 5]]);
?>
            <?php 
echo $form->field($model, 'atividade')->textInput(['maxlength' => true]);
?>
            <?php 
echo $form->field($model, 'agenda_id')->dropDownList(ArrayHelper::map(Agendas::find()->all(), 'id', 'nome'), ['prompt' => 'Escolha uma agenda']);
?>
            <?php 
echo $form->field($model, 'relacionamento_id')->dropDownList(ArrayHelper::map(Relacionamentos::find()->all(), 'id', 'nome'), ['prompt' => 'Escolha um relacionamento']);
?>
            <?php 
echo $form->field($model, 'setor_id')->dropDownList(ArrayHelper::map(Setores::find()->all(), 'id', 'nome'), ['prompt' => 'Escolha um setor']);
?>

            <div class="form-group">
                <?php 
echo Html::activeLabel($model, 'data_inicio', ['label' => 'Data Início', 'class' => 'col-sm-5 control-label']);
?>
                <div class="col-md-4">

                    <?php