/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Tarea::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(['idtarea' => $this->idtarea, 'fecha_ini' => $this->fecha_ini, 'fecha_fin' => $this->fecha_fin, 'usuario_idusuario' => $this->usuario_idusuario]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'descripcion', $this->descripcion]);
     return $dataProvider;
 }
Example #2
0
 /**
  * Finds the Tarea model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Tarea the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Tarea::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #3
0
 protected function getOrders($id_mother)
 {
     date_default_timezone_set('America/Monterrey');
     $tareas = Tarea::find()->where(['id_mother' => $id_mother])->all();
     $personas = Personas::find()->where(['id_mother' => $id_mother])->orderBy('orden')->all();
     $ini = strtotime('2015-01-01');
     //$fin = strtotime('2015-10-31');
     $fin = strtotime(date('Y') . "-" . date('m') . '-' . date('d'));
     $day = floor(($fin - $ini) / (60 * 60 * 24));
     //$day = date('Y');
     //$day += date('d');
     //$day += date('m');
     //$day += 11;
     //$day += 1;
     $orden = $day % count($personas);
     for ($i = 0; $i < count($tareas); $i++) {
         $orden = $orden % count($personas) + 1;
         $model[$i] = new Orden();
         //$model[$i]->tarea = $day.' - '.$orden.' - '.$fin;
         $model[$i]->tarea = $tareas[$i]->nombre;
         $model[$i]->nombre = $personas[$orden - 1]->nombre;
     }
     $provider = new ArrayDataProvider(['allModels' => $model]);
     return $tareas > 0 ? $provider : [];
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTareaIdtarea()
 {
     return $this->hasOne(Tarea::className(), ['idtarea' => 'tarea_idtarea']);
 }
Example #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTareas()
 {
     return $this->hasMany(Tarea::className(), ['usuario_idusuario' => 'idusuario']);
 }
Example #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdTarea()
 {
     return $this->hasOne(Tarea::className(), ['id' => 'id_tarea']);
 }
Example #7
0
    <?php 
$form = ActiveForm::begin();
?>
	
	<?php 
echo $form->field($model, 'id_mother')->dropDownList(ArrayHelper::map(Mother::find()->all(), 'id', 'nombre'))->label('Mother');
?>

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

    <?php 
echo $form->field($model, 'orden')->textInput();
?>

	<?php 
echo $form->field($model, 'relPersonaTareas[]')->checkboxList(ArrayHelper::map(Tarea::find()->all(), 'id', 'nombre'))->label('Tareas');
?>

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

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

</div>