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