Esempio n. 1
0
 public function openSeason()
 {
     global $config;
     $seasonStart = $config['season_start'];
     $seasonEnd = $config['season_end'];
     if ($seasonStart == 'closed' && ($seasonEnd = 'closed')) {
         // recupero dati
         $view = new VAdmin();
         //echo count(explode('%',$view->getRatesString()));
         $umbrella_rows = $view->getUmbrellaRows();
         $palm_rows = $view->getPalmRows();
         $umbrella_number = $view->getUmbrellaNumber();
         $palm_number = $view->getPalmNumber();
         $rates = $view->getRatesString();
         $n_sdate = $view->getNSDate();
         $n_edate = $view->getNEDate();
         $boolean = $this->controlDataPlant($umbrella_rows, $palm_rows, $umbrella_number, $palm_number);
         if ($boolean) {
             $tot = $umbrella_rows + $palm_rows;
             $ArrayRates = $this->controlDataRate($rates, $n_sdate, $n_edate, $tot);
             if ($ArrayRates) {
                 $FRate = new FRate();
                 $FUmbrella = new FUmbrella();
                 //$rates = $this->getRateArray($ArrayRates,$n_sdate,$n_edate,$tot); // calcolo le tariffe da salvare
                 //salvo le tariffe nel db
                 /*foreach($rates as $rat)
                 		{
                 			foreach($rat as $r)
                 					$FRate->saveRate($r);
                 		}*/
                 //calcolo i nuovi ombrelloni
                 $map = $this->getNewMap($palm_rows, $palm_number, $umbrella_rows, $umbrella_number);
                 /*
                  * salvo gli ombrelloni nel db
                  */
                 foreach ($map as $u) {
                     $FUmbrella->saveUmbrella($u);
                 }
                 // salvo l'input nel file
                 $UFile = new UFile();
                 $UFile->saveLine(10, "'{$n_sdate}';", 'Includes/config.inc.php');
                 $UFile->saveLine(12, "'{$n_edate}';", 'Includes/config.inc.php');
                 $config['season_start'] = $n_sdate;
                 $config['season_end'] = $n_edate;
                 return $this->getMap();
             } else {
                 return $view->fetch('season_start_error.tpl');
             }
         } else {
             return $view->fetch('season_start_error.tpl');
         }
     } else {
         return $view->fetch('season_start_error.tpl');
     }
 }
Esempio n. 2
0
 public function getPreviewMap()
 {
     // recupero dati
     $view = new VAdmin();
     $umbrella_rows = $view->getUmbrellaRows();
     $palm_rows = $view->getPalmRows();
     $umbrella_number = $view->getUmbrellaNumber();
     $palm_number = $view->getPalmNumber();
     if ($this->controlDataPlant($umbrella_rows, $palm_rows, $umbrella_number, $palm_number)) {
         $map = $this->getNewMap($palm_rows, $palm_number, $umbrella_rows, $umbrella_number);
         $view->setData('map', $map);
         $view->setData('maxUmb', null);
         $view->setData('numUmb', null);
         $html = $view->fetch('plant.tpl');
         echo $html;
     } else {
         echo 'invalid data';
     }
 }