/**
  * 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;
 }
Beispiel #2
0
 /**
  * Lists all Tarea models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Tarea::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
Beispiel #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 : [];
 }
Beispiel #4
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>