Пример #1
0
 public function cena($format, $material, $fotopapir, $deska, $typ, $pocet)
 {
     $Formaty = new Formaty();
     $Desky = new Desky();
     $Fotopapiry = new Fotopapiry();
     $Materialy = new Materialy();
     $Typy = new Typy();
     $format_cena = $Formaty->cena($format);
     $deska_cena = $Desky->cena($deska);
     $fotopapir_cena = $Fotopapiry->cena($fotopapir);
     $material_cena = $Materialy->cena($material);
     $typ_cena = $Typy->cena($typ);
     return ($format_cena + $material_cena + $fotopapir_cena + $deska_cena + $typ_cena) * $pocet;
 }
Пример #2
0
 public function vlozit()
 {
     $Formaty = new Formaty();
     $Desky = new Desky();
     $Fotopapiry = new Fotopapiry();
     $Materialy = new Materialy();
     $Typy = new Typy();
     $Fotky = new Fotky();
     $formaty = $Formaty->vse();
     $desky = $Desky->vse();
     $typy = $Typy->vse();
     $materialy = $Materialy->vse();
     $fotopapiry = $Fotopapiry->vse();
     foreach ($_SESSION["fotky"] as $fotka) {
         $id_foto = $fotka["id"];
         $this->fotky[$id_foto]["id"] = $id_foto;
         $this->fotky[$id_foto]["url"] = $_SESSION["fotky"][$id_foto]["url"];
         //FORMÁT
         $this->fotky[$id_foto]["format"] = $_SESSION["kosik_post"]["format"][$id_foto];
         foreach ($formaty as $format) {
             if ($format->id == $_SESSION["kosik_post"]["format"][$id_foto]) {
                 $this->fotky[$id_foto]["format_nazev"] = $format->nazev;
             }
         }
         //MATERIÁL
         if ($_SESSION["kosik_post"]["material"][$id_foto] == null || $this->fotky[$id_foto]["material"] == "NULL") {
             $this->fotky[$id_foto]["material"] = 0;
             $this->fotky[$id_foto]["material_nazev"] = "―";
         } else {
             //ID MATERIÁLU
             $this->fotky[$id_foto]["material"] = $_SESSION["kosik_post"]["material"][$id_foto];
             //NÁZEV MATERIÁLU
             foreach ($materialy as $material) {
                 if ($material->id == $_SESSION["kosik_post"]["material"][$id_foto]) {
                     $this->fotky[$id_foto]["material_nazev"] = $material->nazev;
                 }
             }
         }
         //FOTOPAPÍR
         if ($_SESSION["kosik_post"]["fotopapir"][$id_foto] == null || $this->fotky[$id_foto]["fotopapir"] == "NULL") {
             $this->fotky[$id_foto]["fotopapir"] = 0;
             $this->fotky[$id_foto]["fotopapir_nazev"] = "―";
         } else {
             //ID FOTOPAPÍRU
             $this->fotky[$id_foto]["fotopapir"] = $_SESSION["kosik_post"]["fotopapir"][$id_foto];
             //NÁZEV FOTOPAPÍRU
             foreach ($fotopapiry as $fotopapir) {
                 if ($fotopapir->id == $_SESSION["kosik_post"]["fotopapir"][$id_foto]) {
                     $this->fotky[$id_foto]["fotopapir_nazev"] = $fotopapir->nazev;
                 }
             }
         }
         //DESKA
         //ID DESKA
         $this->fotky[$id_foto]["deska"] = $_SESSION["kosik_post"]["deska"][$id_foto];
         //NÁZEV DESKA
         foreach ($desky as $deska) {
             if ($deska->id == $_SESSION["kosik_post"]["deska"][$id_foto]) {
                 $this->fotky[$id_foto]["deska_nazev"] = $deska->nazev;
             }
         }
         //TYP
         //ID TYP
         $this->fotky[$id_foto]["typ"] = $_SESSION["kosik_post"]["typ"][$id_foto];
         //NÁZEV TYP
         foreach ($typy as $typ) {
             if ($typ->id == $_SESSION["kosik_post"]["typ"][$id_foto]) {
                 $this->fotky[$id_foto]["typ_nazev"] = $typ->nazev;
             }
         }
         //POČET
         $this->fotky[$id_foto]["pocet"] = $_SESSION["kosik_post"]["pocet"][$id_foto];
         //CENA
         $this->fotky[$id_foto]["cena"] = $Fotky->cena($this->fotky[$id_foto]["format"], $this->fotky[$id_foto]["material"], $this->fotky[$id_foto]["fotopapir"], $this->fotky[$id_foto]["deska"], $this->fotky[$id_foto]["typ"], $this->fotky[$id_foto]["pocet"]);
         //INFORMACE O FOTCE
         //URL
         $this->fotky[$id_foto]["informace"]["url"] = $_SESSION["fotky"][$id_foto]["url"];
         $this->fotky[$id_foto]["informace"]["mini_url"] = $_SESSION["fotky"][$id_foto]["mini_url"];
         //ROZMĚRY
         list($sirka, $vyska) = getimagesize($this->fotky[$id_foto]["informace"]["url"]);
         $this->fotky[$id_foto]["informace"]["sirka"] = $sirka;
         $this->fotky[$id_foto]["informace"]["vyska"] = $vyska;
         //INFO
         //velikosti souborů
         $info_o_soboru = pathinfo($this->fotky[$id_foto]["informace"]["url"]);
         $this->fotky[$id_foto]["informace"]["nazev"] = $info_o_soboru["filename"];
         $this->fotky[$id_foto]["informace"]["typ_s"] = $info_o_soboru["extension"];
         chmod("php/nahrani/tmp-nahrane", 0777);
         $this->fotky[$id_foto]["informace"]["velikost"] = filesize("php/nahrani/tmp-nahrane/" . $info_o_soboru["filename"] . "." . $info_o_soboru["extension"]);
         $this->pocet_fotek++;
     }
     $this->cena_bez_dopravy = self::cenaZaFotky();
 }