public function getStationList() { $allStations = Stationsoftheregion::find()->asArray()->orderBy("p_nom DESC")->all(); return $allStations; // arrayHelper::map($allStations, 'p_nom', 'kod_stan','name_stan','vr_ch','vr_n','rast_ch','ot','kput','podhod','kod_uchast','k_dor','kod_otd','pr_kn_uch','pr_dop_puti'); }
public function actionDesigner() { //$stations = new Stationslistofregion; //$approaches = new Approaches(); $nonstandartways = new Nonstandartways(); $allStationlist = Stationsoftheregion::find()->orderBy("p_nom DESC")->all(); $stationsNameToDraw = array(); $stationsLengthToDraw = array(); //$stations = $model->getStationList(); $request = Yii::$app->request; $openedStationList = $request->post('openedStations'); if ($request->isAjax) { foreach ($allStationlist as $station) { if (in_array($station->name, $openedStationList)) { if ($station->podhod == '1') { $approaches = Approaches::find()->where('st_sov > :kodstan', [':kodstan' => $station->kod_stan])->oderBy('n_pod')->all(); foreach ($approaches as $approache) { if ($approache->n_pod == '-1') { if (!empty($stationsLengthToDraw)) { array_push($stationsLengthToDraw, $station->rast); } array_push($stationsNameToDraw, $approache->st_prim); array_push($stationsLengthToDraw, '25'); } elseif ($approache->n_pod == '1') { array_push($stationsNameToDraw, $station->name); if ($station->kput != '0') { $waysNumber = (int) $station->kput; for ($i = 1; $i < $waysNumber; $i++) { # code... array_push($stationsNameToDraw, (string) (i + 1)); array_push($stationsLengthToDraw, '5'); } } array_push($stationsLengthToDraw, '25'); array_push($stationsNameToDraw, $approache->st_prim); # code... } # code... } } else { if ($station->kput != '0') { $waysNumber = (int) $station->kput; for ($i = 1; $i < $waysNumber; $i++) { # code... array_push($stationsNameToDraw, (string) ($i + 1)); array_push($stationsLengthToDraw, '5'); } } } } else { array_push($stationsNameToDraw, $station->name); array_push($stationsLengthToDraw, $station->rast); } # code... } return $this->render('designer', ['stations' => $stationsNameToDraw, 'lengthes' => $stationsLengthToDraw]); } else { foreach ($allStationlist as $oneStation) { array_push($stationsNameToDraw, $oneStation->name); array_push($stationsLengthToDraw, $oneStation->rast); # code... } return $this->render('designer', ['stations' => $stationsNameToDraw, 'lengthes' => $stationsLengthToDraw]); //return $this->render('designer', ['stations'=>$stationsNameToDraw,'stationsLength'=>$stationsLengthToDraw]); } }