示例#1
0
 public function indexAction()
 {
     #vynulovani rozpadu stromu
     $_SESSION['katalog']['pars']['u1'] = 0;
     $_SESSION['katalog']['rozpad'] = 0;
     $this->view->strom = stromek(0, $this->_getAllParams());
     $pom_txt = zpracujTexty(readData('texty', array('jazyk' => $_SESSION['jazyk'], 'kody' => "'uvod_top'")));
     $vysl = readData('index', array());
     $this->view->kategorie = array();
     foreach ($vysl->k->row as $r) {
         $this->view->kategorie[(string) $r->idk] = (string) $r->kat;
     }
     //definice stylu pro kategorie
     $css = '';
     $index = 1;
     foreach ($this->view->kategorie as $id => $kat) {
         $css .= '#rozcestnik li#kat-' . trim($id) . ' a, #rozcestnik li#kat-' . trim($id) . ' a:visited {' . "\n";
         $css .= 'background: #162983 url("/grafika/kat_' . trim($id) . '.jpg");' . "\n";
         if ($index == $index) {
             $css .= "height: 41px;\n";
             $css .= "padding-top: 37px;\n";
         }
         $css .= "}\n";
         $css .= '#rozcestnik li#kat-' . trim($id) . ' a:hover, #rozcestnik li#kat-' . trim($id) . ' a:focus, #rozcestnik li#kat-' . trim($id) . ' a:active {' . "\n";
         $css .= 'background: #5da6dc url("/grafika/kat_' . trim($id) . '_ho.jpg");' . "\n";
         $css .= "}\n";
         if ($index >= 3) {
             $index = 0;
         }
         $index++;
     }
     //$this->view->css_defs = array(0 => $css);
     $textile = new Textile();
     $this->view->txt = array('uvod_top' => $textile->TextileThis($pom_txt['uvod_top']));
 }
示例#2
0
 public function zobrazAction()
 {
     $textile = new Textile();
     $pars = $this->_getAllParams();
     if (isset($pars['idt']) && trim($this->_getParam('idt')) != '') {
         $this->view->kod = trim($this->_getParam('idt'));
         $this->view->txt = zpracujTexty(readData('texty', array('jazyk' => $_SESSION['jazyk'], 'kody' => "'" . trim($this->_getParam('idt')) . "'")));
         //print_r($this->view->nacteny);
         #print_r($this->view->txt);
         #echo "\n\nPOSLEDNI XML:\n";
         #echo ukazXML($_SESSION['vracene_xml']);
         #die();
         if (sizeof($this->view->txt) == 0 || !isset($this->view->txt[$this->view->kod])) {
             $this->view->txt = array($this->view->kod => $textile->TextileThis('Text s kódem *' . $this->view->kod . '* nebyl nalezen.'));
         } else {
             $this->view->txt[$this->view->kod] = $textile->TextileThis($this->view->txt[$this->view->kod]);
         }
     } else {
         $this->view->kod = 'info';
         $this->view->txt = array('info' => 'Nebyl specifikován požadovaný text.');
     }
     $this->view->strom = stromek(0, $this->_getAllParams());
 }
示例#3
0
 public function zpracujobjednavkuAction()
 {
     $_t = new Zend_Translate('csv', CESTA . '/preklad/mfpshop.cs.csv', 'cs');
     $_t->addTranslation(CESTA . '/preklad/mfpshop.sk.csv', 'sk');
     $_t->addTranslation(CESTA . '/preklad/mfpshop.en.csv', 'en');
     // Create a log instance
     $writer_preklad = new Zend_Log_Writer_Stream(CESTA . '/logy/preklad.log');
     $log_preklad = new Zend_Log($writer_preklad);
     /*
     firma, osoba, datum, doprava, platba, poznamka, cena_celkem, cena_celkem_DPH
     */
     #zjisteni celkove ceny
     $soucet = 0;
     $soucet_dph = 0;
     foreach ($_SESSION['kosik'] as $r) {
         $soucet += (double) $r['cena_radek'];
         $soucet_dph += (double) $r['cena_radek_dph'];
     }
     $sleva_obj = $soucet * (double) $_SESSION['objemova_sleva'] / 100;
     $sleva_obj_dph = $soucet_dph * (double) $_SESSION['objemova_sleva'] / 100;
     $cena_obj = $soucet - $sleva_obj;
     $cena_obj_dph = $soucet_dph - $sleva_obj_dph;
     $sleva_kupon = $cena_obj * (double) $_SESSION['objednavka']['kupon']['sleva'] / 100;
     $sleva_kupon_dph = $cena_obj_dph * (double) $_SESSION['objednavka']['kupon']['sleva'] / 100;
     $cena_kupon = $cena_obj - $sleva_kupon;
     $cena_kupon_dph = $cena_obj_dph - $sleva_kupon_dph;
     $_SESSION['objednavka']['doprava']['kod'] = isset($_SESSION['objednavka']['doprava']['kod']) ? $_SESSION['objednavka']['doprava']['kod'] : '';
     $_SESSION['objednavka']['platba']['kod'] = isset($_SESSION['objednavka']['platba']['kod']) ? $_SESSION['objednavka']['platba']['kod'] : '';
     $vysl = readData('objednavka_hl', array('firma' => $_SESSION['uzivatel']['firma'], 'osoba' => $_SESSION['uzivatel']['jmeno'], 'doprava' => $_SESSION['objednavka']['doprava']['kod'], 'platba' => $_SESSION['objednavka']['platba']['kod'], 'cena_celkem' => $cena_kupon, 'cena_celkem_dph' => $cena_kupon_dph, 'poznamka' => $_SESSION['objednavka']['ostatni']['poznamky'], 'objemova_sleva' => $_SESSION['objemova_sleva'], 'kupon' => $_SESSION['objednavka']['kupon']['cislo'], 'kupon_sleva' => $_SESSION['objednavka']['kupon']['sleva']));
     #Firma, Poradi, Polozka, Produkt, Mj, Mj_v_bal, Mnozstvi, Cena_cenik, Sleva_proc, Cena_celkem, Cena_celkem_DPH
     #neplneni polozek objednavky - vzdy vlozeni do objednavky
     $rozpis = '';
     #rozpis objednavky do mailu
     $rozpis_obch = '';
     #rozpis objednavky do mailu
     $rozpis .= "=================================================================================================\r\n";
     $rozpis .= sprintf('|%-15s|%-50s|%6s|%10s|%10s|' . "\r\n", "Produkt", iconv('UTF-8', 'iso-8859-2//TRANSLIT', "Název"), iconv('UTF-8', 'iso-8859-2//TRANSLIT', "Počet"), "Cena", "Cena s DPH");
     $rozpis .= "=================================================================================================\r\n";
     foreach ($_SESSION['kosik'] as $r) {
         $vysl_pol = readData('objednavka_pol', array('firma' => $_SESSION['uzivatel']['firma'], 'poradi' => (int) $vysl->o->row->cobj, 'produkt' => $r['produkt'], 'mj' => $r['mj'], 'mj_v_bal' => '1', 'mnozstvi' => $r['mj_evid'], 'zakl_cena' => $r['zakl_cena'], 'cena' => $r['cena'], 'sleva_proc' => $r['sleva'], 'cena_celkem' => $r['cena_radek'], 'cena_celkem_dph' => $r['cena_radek_dph']));
         $rozpis .= sprintf('|%-15s|%-50s|%6.0F|%10.2F|%10.2F|' . "\r\n", iconv('UTF-8', 'iso-8859-2//TRANSLIT', $r['produkt']), iconv('UTF-8', 'iso-8859-2//TRANSLIT', $r['nazev']), $r['mj_evid'], $r['cena_radek'], $r['cena_radek_dph']);
     }
     // dokonceni objednavky - rozpusteni slev
     $vysl_pol = readData('dokonci_objednavku', array('firma' => $_SESSION['uzivatel']['firma'], 'poradi' => (int) $vysl->o->row->cobj));
     $rozpis .= "=================================================================================================\r\n";
     $rozpis .= sprintf('|%-73s|%10.2F|%10.2F|' . "\r\n", "Celkem", $soucet, $soucet_dph);
     if ((double) $_SESSION['objemova_sleva'] != 0) {
         $rozpis .= "=================================================================================================\r\n";
         $rozpis .= sprintf('|%-73s|%10.2F|%10.2F|' . "\r\n", iconv('UTF-8', 'iso-8859-2//TRANSLIT', "Objemová sleva: ") . $_SESSION['objemova_sleva'] . "%", $sleva_obj, $sleva_obj_dph);
     }
     if ((double) $_SESSION['objednavka']['kupon']['sleva'] != 0) {
         $rozpis .= "=================================================================================================\r\n";
         $rozpis .= sprintf('|%-73s|%10.2F|%10.2F|' . "\r\n", iconv('UTF-8', 'iso-8859-2//TRANSLIT', "Slevový kupon ") . $_SESSION['objednavka']['kupon']['cislo'] . ': ' . $_SESSION['objednavka']['kupon']['sleva'] . "%", $sleva_kupon, $sleva_kupon_dph);
     }
     $rozpis .= "=================================================================================================\r\n";
     $rozpis .= sprintf('|%-73s|%10.2F|%10.2F|' . "\r\n", iconv('UTF-8', 'iso-8859-2//TRANSLIT', "Výsledná cena"), $cena_kupon, $cena_kupon_dph);
     $rozpis .= "=================================================================================================\r\n";
     //$rozpis = ($rozpis);
     $rozpis .= "Doprava: " . iconv('UTF-8', 'iso-8859-2//TRANSLIT', $_SESSION['objednavka']['doprava']['popis']) . ", " . "cena: " . number_format($_SESSION['objednavka']['doprava']['cena'], 2, ',', ' ') . iconv('UTF-8', 'iso-8859-2//TRANSLIT', " Kč\r\n");
     $rozpis .= "Platba: " . iconv('UTF-8', 'iso-8859-2//TRANSLIT', $_SESSION['objednavka']['platba']['popis']) . ", " . "cena: " . number_format($_SESSION['objednavka']['platba']['cena'], 2, ',', ' ') . iconv('UTF-8', 'iso-8859-2//TRANSLIT', " Kč\r\n");
     $rozpis .= "=================================================================================================\r\n";
     if (trim($_SESSION['objednavka']['ostatni']['poznamky']) != '') {
         $rozpis .= iconv('UTF-8', 'iso-8859-2//TRANSLIT', "Poznámky:\r\n" . $_SESSION['objednavka']['ostatni']['poznamky'] . "\r\n");
         $rozpis .= "=================================================================================================\r\n";
     }
     $rozpis_obch .= "Objednal:\r\n";
     foreach ($_SESSION['objednavka']['osoba'] as $k => $h) {
         $rozpis_obch .= iconv('UTF-8', 'iso-8859-2//TRANSLIT', $_t->_($k) . ": {$h}\r\n");
     }
     $rozpis_obch .= "=================================================================================================\r\n";
     $rozpis_obch .= "Objednatel:\r\n";
     foreach ($_SESSION['objednavka']['firma'] as $k => $h) {
         $rozpis_obch .= iconv('UTF-8', 'iso-8859-2//TRANSLIT', $_t->_($k) . ": {$h}\r\n");
     }
     $rozpis_obch .= "=================================================================================================\r\n";
     $rozpis_obch .= iconv('UTF-8', 'iso-8859-2//TRANSLIT', "Dodací místo:\r\n");
     foreach ($_SESSION['objednavka']['doruceni'] as $k => $h) {
         $rozpis_obch .= iconv('UTF-8', 'iso-8859-2//TRANSLIT', $_t->_($k) . ": {$h}\r\n");
     }
     $rozpis_obch .= "=================================================================================================\r\n";
     //zjisteni textu a odeslani mailu
     $texty = zpracujTexty(readData('texty', array('jazyk' => $_SESSION['jazyk'], 'kody' => "'obj_zak','obj_obch'")));
     #print_r($texty);
     #a nakonec vyprazdneni kosiku
     //echo "<pre>\n";die(str_replace('#COBJ#', (string)  $vysl->o->row->cobj, str_replace('#ROZPIS#', $rozpis, $texty['obj_obch'])));
     //die(str_replace('#COBJ#', (string)  $vysl->o->row->cobj, str_replace('#ROZPIS#', $rozpis, iconv('UTF-8', 'iso-8859-2//TRANSLIT', $texty['obj_zak']))));
     //die("<pre>\n" . str_replace('#ROZPIS#', $rozpis . $rozpis_obch, iconv('UTF-8', 'iso-8859-2//TRANSLIT', $texty['obj_zak'])));
     @mailuj($_SESSION['uzivatel']['e_mail'], 'MFP shop - potvrzeni objednavky', str_replace('#COBJ#', (string) $vysl->o->row->cobj, str_replace('#ROZPIS#', $rozpis . $rozpis_obch, iconv('UTF-8', 'iso-8859-2//TRANSLIT', $texty['obj_zak']))), 'iso-8859-2');
     @mailuj(EMAIL_OBCHODNIK, 'MFP shop - nova objednavka', str_replace('#COBJ#', (string) $vysl->o->row->cobj, str_replace('#ROZPIS#', $rozpis . $rozpis_obch, iconv('UTF-8', 'iso-8859-2//TRANSLIT', $texty['obj_obch']))), 'iso-8859-2');
     //vyprazdnit klientsky kosik
     $_SESSION['kosik'] = array();
     $_SESSION['objednavka'] = array();
     //a jeste kosik na serveru
     readData('vysyp_kosik', array('osoba' => $_SESSION['uzivatel']['jmeno']));
     unset($_t);
     unset($writer_preklad);
     unset($log_preklad);
     #$this->_Redirect(THIS_SERVER . '/katalog/index/index');
     $this->_Redirect('/katalog/index/index');
     #echo '<h1>Cislo objednavky: ' . (string) $vysl->o->row->cobj . '</h2>';
     #echo '<pre>';print_r($_SESSION['objednavka']);echo "\n\n";print_r($_SESSION['kosik']);echo "\n\n";print_r($_SESSION['uzivatel']);echo '</pre>';die();
 }
 public function zpracujregistraciAction()
 {
     //overim, jestli firma neexistuje
     $data = array();
     foreach ($_POST as $k => $h) {
         $data[$k] = textToDB($h);
     }
     $cele_jmeno = trim($data['prijmeni']);
     if (trim($data[jmeno]) != '') {
         $cele_jmeno .= ' ' . trim($data['jmeno']);
     }
     //napleneni informaci o firme
     $pars = array();
     if (trim($_POST['firma']) == '') {
         $pars['xfirma'] = substr($cele_jmeno, 0, 30);
         $pars['nazev_firmy'] = $cele_jmeno;
     } else {
         $pars['xfirma'] = substr(textToDB(trim($_POST['firma'])), 0, 30);
         $pars['nazev_firmy'] = textToDB(trim($_POST['firma']));
     }
     $pars['kniha'] = 'Adresář';
     $pars['ulice'] = textToDB(trim($_POST['ulice']));
     $pars['mesto'] = textToDB(trim($_POST['mesto']));
     $pars['psc'] = textToDB(trim($_POST['psc']));
     $pars['adresa'] = $pars['ulice'] . ' ' . $pars['psc'] . ' ' . $pars['mesto'];
     switch (trim($_POST['stat'])) {
         case 'sk':
             $pars['stat'] = 'Slovenská republika';
             break;
         default:
             $pars['stat'] = 'Česká republika';
             break;
     }
     $pars['telefon'] = textToDB(trim($_POST['telefon']));
     $pars['email'] = textToDB(trim($_POST['email']));
     $pars['ic'] = textToDB(trim($_POST['ic']));
     $pars['dic'] = textToDB(trim($_POST['dic']));
     if ($pars['dic'] != '') {
         $pars['platce_dph'] = '-1';
     } else {
         $pars['platce_dph'] = '0';
     }
     if ($pars['ic'] != '') {
         $pars['pravnicka_osoba'] = '-1';
     } else {
         $pars['pravnicka_osoba'] = '0';
     }
     $pars['udaj_1'] = WEB_SKUPINA;
     $pars['osoba'] = $cele_jmeno;
     $pars['ujmeno'] = textToDB(trim($_POST['ujmeno']));
     $pars['heslo'] = textToDB(trim($_POST['heslo']));
     if (trim($_POST['firma2']) == '') {
         $pars['dodani_nazev_firmy'] = textToDB(trim($_POST['jmeno2']));
     } else {
         $pars['dodani_nazev_firmy'] = textToDB(trim($_POST['firma2']));
     }
     $pars['dodani_ulice'] = textToDB(trim($_POST['ulice2']));
     $pars['dodani_mesto'] = textToDB(trim($_POST['mesto2']));
     $pars['dodani_psc'] = textToDB(trim($_POST['psc2']));
     $pars['dodani_adresa'] = $pars['dodani_ulice'] . ' ' . $pars['dodani_psc'] . ' ' . $pars['dodani_mesto'];
     //print_r($data);
     //overeni existence duplicitni firmy
     $parso = array();
     $parso['jmeno'] = $cele_jmeno == '' ? 'xxxxx' : $cele_jmeno;
     if (trim($data['firma']) == '') {
         $parso['xfirma'] = $cele_jmeno == '' ? 'xxxxx' : $cele_jmeno;
     } else {
         $parso['xfirma'] = trim($data['firma']) == '' ? 'xxxxx' : trim($data['firma']);
     }
     $parso['frmpk'] = trim($data['firma']) == '' ? 'xxxxx' : substr(trim($data['firma'], 0, 30));
     $parso['email'] = trim($data['email']) == '' ? 'xxxxx' : trim($data['email']);
     $parso['dic'] = trim($data['dic']) == '' ? 'xxxxx' : trim($data['dic']);
     $parso['ic'] = trim($data['ic']) == '' ? 'xxxxx' : trim($data['ic']);
     #print_r($pars);#die();
     $vysl = readData('duplicitafirmy', $parso);
     #echo "\n\nPOSLEDNI XML:\n";
     #echo ukazXML($_SESSION['vracene_xml']);
     #die();
     if (isset($vysl->c->row) || isset($vysl->s->row)) {
         //nalezena nejaka jina firma
         #echo 'Nalezena jina firma';
         //$this->_Redirect('/web/texty/zobraz/idt/reg_ok');
         $texty = zpracujTexty(readData('texty', array('jazyk' => $_SESSION['jazyk'], 'kody' => "'dup_reg_zak','dup_reg_obch'")));
         //mail zakaznikovi
         mailuj($data['email'], 'MFP shop - zprava o registraci', str_replace('#TEL#', TEL_OBCHODNIK, str_replace('#MAIL#', EMAIL_OBCHODNIK, $texty['dup_reg_zak'])));
         $porizeno = "Pořízené údaje:\n===============\n";
         foreach ($_POST as $k => $h) {
             $porizeno .= "{$k}: {$h}\r\n";
         }
         $nalezeno = "\nNalezené firmy:\n===============\n";
         if (isset($vysl->c->row)) {
             //ceske firmy
             $nalezeno .= "Česká databáze:\r\n";
             foreach ($vysl->c->row as $r) {
                 $nalezeno .= (string) $r->kod_firmy . "\r\n";
             }
         }
         if (isset($vysl->s->row)) {
             //slovenske firmy
             $nalezeno .= "\r\nSlovenská databáze:\r\n";
             foreach ($vysl->s->row as $r) {
                 $nalezeno .= (string) $r->kod_firmy . "\r\n";
             }
         }
         $vysl = readData('registruj_duplicitni_firmu', $pars);
         mailuj(EMAIL_OBCHODNIK, 'MFP shop - zprava o registraci duplicitniho zakaznika', str_replace('#NALEZENO#', $nalezeno, str_replace('#PORIZENO#', $porizeno, str_replace('#CAS#', date('H:i'), str_replace('#DATUM#', date('d.m.Y'), $texty['dup_reg_obch'])))));
         unset($pars);
         unset($parso);
         $this->_Redirect('/web/texty/zobraz/idt/dup_reg_zak_txt');
     } else {
         //firma nalezena nebyla, takze se muze zalozit
         $vysl = readData('registruj_firmu', $pars);
         #echo "<pre>\nPars:\n";print_r($pars);
         #echo "\nzalozeno firem: " . (string) $vysl->f->row->pocet_firem;
         #echo "\nzalozeno uzivatelu: " . (string) $vysl->f->row->pocet_uzivatelu;
         $texty = zpracujTexty(readData('texty', array('jazyk' => $_SESSION['jazyk'], 'kody' => "'reg_zak','reg_obch'")));
         //mail zakaznikovi
         mailuj($data['email'], 'MFP shop - zprava o registraci', str_replace('#JMENO#', $pars['ujmeno'], str_replace('#HESLO#', $pars['heslo'], $texty['reg_zak'])));
         $porizeno = "Pořízené údaje:\r\n===============\r\n";
         foreach ($pars as $k => $h) {
             $porizeno .= "{$k}: {$h}\r\n";
         }
         mailuj(EMAIL_OBCHODNIK, 'MFP shop - zprava o registraci zakaznika', str_replace('#PORIZENO#', $porizeno, str_replace('#CAS#', date('H:i'), str_replace('#DATUM#', date('d.m.Y'), $texty['reg_obch']))));
         unset($parso);
         unset($pars);
         $this->_Redirect('/web/texty/zobraz/idt/reg_zak_txt');
     }
     #echo "\n\n<pre>POST:\n";print_r($_POST);
     #die();
 }