Exemple #1
0
 public function action_test()
 {
     $zvo = [1];
     $html = "<head><meta charset='UTF-8'></head>";
     $vypocet = new vypocetControl();
     for ($t = 0; $t < count($zvo); $t++) {
         $osevPostup = OsevData::getOsevPostupData($zvo[$t]);
         for ($i = 0; $i < count($osevPostup); $i++) {
             $vypocet->request['osevPostup'] = $osevPostup[$i]['id'];
             $vypocet->request['zvo'] = $zvo[$t];
             $res = $vypocet->action_solveOsevPostup();
             $html .= 'ZVO' . $zvo[$t] . ' nazev:' . $osevPostup[$i]['nazev'] . ' id:' . $osevPostup[$i]['id'] . '<table>';
             foreach ($res['terms'] as $key => $value) {
                 $html .= '<tr>';
                 foreach ($value as $key2 => $value2) {
                     $html .= '<td> ' . $key2 . ': ' . $value2 . ' </td>';
                 }
                 $html .= '</tr>';
             }
             $html .= "</table><br><hr><br>";
         }
     }
     echo $html;
     exit;
     return [];
 }
Exemple #2
0
 /**
  *
  * @return type
  */
 public function action_getDetailDpb()
 {
     $this->STOP_PROPAGATION = true;
     if (!isset($this->request['skupina']) || !isset($this->request['hon']) || !isset($this->request['id_geom'])) {
         return ["success" => false, "msg" => "Chybí vstupní parametry."];
     }
     $skupina = $this->doctrine->entityManager->getRepository('Skupina')->findOneBy(array('skupina_cislo' => $this->request['skupina'], 'id_lokalizace' => $this->idLocation));
     $vypocet = new vypocetControl();
     if ($skupina->getUzivPostup()) {
         $vypocet->request['osevPostup'] = $skupina->getUzivPostup()->getId();
         $vypocetRes = $vypocet->action_solveUserOsevPostup();
     } else {
         $vypocet->request['osevPostup'] = $skupina->getModelPostup()->getId();
         $vypocet->request['zvo'] = $skupina->getZvoOblast();
         $vypocetRes = $vypocet->action_solveOsevPostup();
     }
     $plodiny = $vypocetRes['c_plodina'];
     /**
      * protierozni opatreni
      * array [plodina => nazev plodinz, c => hodnota c plodiny, p => hodnota p faktoru protier. opatreni]
      * $opatreni => vycet opatreni pro dane DPB, jinak false
      */
     $opatreni = skupinaData::getOpatreniForPb($this->request['id_geom'], $this->request['skupina']);
     $opatreniOsev = $this->applyOpatreni($plodiny, $opatreni);
     /**
      * organicka hmota
      */
     $organika = $this->applyOrganika($vypocetRes);
     /// SORTING BY HON
     if ((int) $this->request['hon'] === 0) {
         $hon = 1;
     } else {
         $hon = (int) $this->request['hon'];
     }
     $orderOpatreni = [];
     $orderOrganika = [];
     for ($j = 0; $j < count($opatreniOsev); $j++) {
         $key = (count($opatreniOsev) - ($hon - 1) + $j) % count($opatreniOsev);
         $orderOpatreni[$j] = $opatreniOsev[$key];
         $orderOrganika[$j] = $organika[$key];
     }
     return ["success" => true, "msg" => "OK", 'opatreni' => $orderOpatreni, 'organika' => $orderOrganika, 'numYears' => $vypocetRes['numYears']];
 }