Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Setores::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 Setores model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Setores the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Setores::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSetor()
 {
     return $this->hasOne(Setores::className(), ['id' => 'setor_id']);
 }
Example #4
0
        <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 
echo $form->field($model, 'data_inicio', ['contentBeforeInput' => '<div class="input-group"><div class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></div>', 'contentAfterInput' => '</div>', 'showLabels' => false])->textInput(['placeholder' => 'Data']);
?>
                </div>
                <div class="col-sm-3 atividades-hora_inicio">
                    <?php 
echo $form->field($model, 'hora_inicio', ['contentBeforeInput' => '<div class="input-group"><div class="input-group-addon"><span class="glyphicon glyphicon-dashboard"></span></div>', 'contentAfterInput' => '</div>', 'showLabels' => false])->textInput(['placeholder' => 'Hora']);