예제 #1
0
 public $nastavenie;
 /** @var string - relatívna cesta pre avatar poloziek menu */
 public $avatar_path = "files/menu/";
 /** @var int Maximalna velkost suboru pre upload */
 public $upload_size = 0;
 // -- KONIEC Premenne z o stareho CommonBasePresentera
 /** @var array Hodnoty role=>id v DB tab registracia */
 public $ur_reg = [];
 /** @var array Hodnoty id=>nazov pre formulare z tabulky registracia */
 public $urovneReg;
 /** @var array - pole s chybami pri uploade */
 public $upload_error = [0 => "Bez chyby. Súbor úspešne nahraný.", 1 => "Nahrávaný súbor je väčší ako systémom povolená hodnota!", 2 => "Nahrávaný súbor je väčší ako je formulárom povolená hodnota!", 3 => "Nahraný súbor bol nahraný len čiastočne...", 4 => "Žiadny súbor nebol nahraný... Pravdepodobne ste vo formuláry žiaden nezvolili!", 5 => "Upload error 5.", 6 => "Chýbajúci dočasný priečinok!"];
 /** Vychodzie nastavenia */
 protected function startup()
 {
     parent::startup();
     // Sprava uzivatela
     $user = $this->getUser();
     //Nacitanie uzivatela
     // Kontrola prihlasenia a nacitania urovne registracie
     $this->id_reg = $user->isLoggedIn() ? $user->getIdentity()->id_registracia : 0;
     // Kontrola prihlasenia
     if ($this->id_reg) {
         //Prihlaseny uzivatel
         if (!$user->isAllowed($this->name, $this->action)) {
             //Kontrola ACL
             $this->flashRedirect('Homepage:', 'Na požadovanú akciu nemáte dostatočné oprávnenie!', 'danger');
         }
     } else {
         //Neprihlaseny
         if ($user->getLogoutReason() === User::INACTIVITY) {
             $backlink = $this->getApplication()->storeRequest();
             $this->flashRedirect([':Front:User:'******'backlink' => $backlink]], 'Boli ste príliš dlho neaktívny a preto ste boli odhlásený! Prosím, prihláste sa znovu.', 'danger');
         } else {
             $this->flashRedirect(':Front:User:in', 'Nemáte dostatočné oprávnenie na danú operáciu!', 'danger');
         }
     }
     // Nastavenie z config-u
     $this->nastavenie = $this->context->parameters;
     $modul_presenter = explode(":", $this->name);
     $this->language = 'sk';
     $this->language_id = 1;
     //Nacitanie a spracovanie hlavnych udajov webu
     $this->udaje_webu = $this->udaje->findAll()->fetchPairs('nazov', 'text');
     $vysledok = [];
     //Nacitanie len tych premennych, ktore platia pre danu jazykovu mutaciu
     foreach ($this->udaje_webu as $key => $value) {
         $kluc = explode("-", $key);
         if (count($kluc) == 2 && $kluc[1] == $this->language) {
             $vysledok[substr($key, 0, strlen($key) - strlen($this->language) - 1)] = $value;
         }
         if (count($kluc) == 1) {
             $vysledok[$key] = $value;
         }
     }
     $this->udaje_webu = $vysledok;
     // Nacitanie pomocnych premennych
     $this->udaje_webu['meno_presentera'] = strtolower($modul_presenter[1]);
     //Meno aktualneho presentera
     $httpR = $this->httpRequest->getUrl();
     $this->nazov_stranky = $httpR->host . $httpR->scriptPath;
     // Nazov stranky v tvare www.nieco.sk
     $this->nazov_stranky = substr($this->nazov_stranky, 0, strlen($this->nazov_stranky) - 1);
     // Priradenie hlavnych parametrov a udajov