Пример #1
0
 /** Vytvorenie ponuky
  * @return array
  */
 private function _addpolmenu()
 {
     if ($this->id < 0) {
         //Zaporne id je pre cast
         $ponuka = $this->druh->findBy(array("povolene" => 1));
         $this->id = -1 * $this->id;
         if (($cast = $this->hlavne_menu_cast->find($this->id)) !== FALSE && count($cast)) {
             $out["nadpis"] = $cast->nazov;
         } else {
             $this->chyba = "Chybne zadané id = " . $this->id;
             return;
         }
         $uroven = 0;
     } else {
         //Kladne id je pre polozku
         $ponuka = $this->druh->findBy(array("povolene" => 1, "je_spec_naz > 0"));
         if (($cast = $this->hlavne_menu_lang->findOneBy(array("id_hlavne_menu" => $this->id, "id_lang" => 1))) !== FALSE && count($cast)) {
             $out["nadpis"] = $cast->nazov;
         } else {
             $this->chyba = "Chybne zadané id = " . $this->id;
             return;
         }
         $uroven = $cast->hlavne_menu->uroven + 1;
     }
     foreach ($ponuka as $g) {
         $out["ponuka"][] = array("link" => $g->presenter . ":add", "id" => $this->id, "uroven" => $uroven, "presenter" => $g->presenter, "popis" => $g->popis);
     }
     return $out;
 }
Пример #2
0
      }
  }
  /** Grid pre tabulku Udaje
 * @return \App\AdminModule\Components\Udaje\UdajeWebuGrid
 */
  public function createComponentUdajeTableGrid()
  {
      return new \App\AdminModule\Components\Udaje\UdajeWebuGrid($this->udaje);
  }
  protected function createComponentAddTypeUdajeForm()
  {
      $form = $this->addTypeUdajeForm->create($this->udaje_typ_form);
Пример #3
0
 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;
     // Nastavenie z config-u
     $this->nastavenie = $this->context->parameters;
     $modul_presenter = explode(":", $this->name);
     // Skontroluj ci je nastaveny jazyk a ci pozadovany jazyk existuje ak ano akceptuj
     if (!isset($this->language)) {
         //Prednastavim hodnotu jazyka
         $lang_temp = $this->lang->find(1);
         $this->language = $lang_temp->skratka;
         $this->language_id = $lang_temp->id;
     }
     if (isset($this->params['language'])) {
         $lang_temp = $this->lang->findOneBy(['skratka' => $this->params['language']]);
         if (isset($lang_temp->skratka) && $lang_temp->skratka == $this->params['language']) {
             $this->language = $this->params['language'];
             $this->language_id = $lang_temp->id;
         } else {
             //Inak nastav Slovencinu
             $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
     $this->max_id_reg = $this->registracia->findAll()->max('id');
     //Najdi max. ur. reg.
     //Najdi info o druhu
     $tmp_druh = $this->druh->findBy(["druh.presenter" => ucfirst($this->udaje_webu['meno_presentera'])])->where("druh.modul IS NULL OR druh.modul = ?", $modul_presenter[0])->limit(1)->fetch();
     if ($tmp_druh !== FALSE) {
         if ($tmp_druh->je_spec_naz) {
             //Ak je spec_nazov pozadovany a mam id
             $hl_udaje = $this->hlavne_menu->hladaj_id(isset($this->params['id']) ? (int) trim($this->params['id']) : 0, $this->id_reg);
         } else {
             //Ak nie je spec_nazov pozadovany
             $hl_udaje = $this->hlavne_menu->findOneBy(["id_druh" => $tmp_druh->id]);
         }
     } else {
         $hl_udaje = FALSE;
     }
     if ($hl_udaje !== FALSE) {
         //Ak sa hl. udaje nasli
         //Nacitanie textov hl_udaje pre dany jazyk
         $lang_hl_udaje = $this->hlavne_menu_lang->findOneBy(['id_lang' => $this->language_id, 'id_hlavne_menu' => $hl_udaje->id]);
         if ($lang_hl_udaje !== FALSE) {
             //Nasiel som udaje a tak aktualizujem
             $this->udaje_webu["nazov"] = $lang_hl_udaje->nazov;
             $this->udaje_webu["h1part2"] = $lang_hl_udaje->h1part2;
             $this->udaje_webu["description"] = $lang_hl_udaje->description;
         } else {
             //Len preto aby tam nieco bolo
             $this->udaje_webu["nazov"] = "Error nazov";
             $this->udaje_webu["h1part2"] = "Error h1part2";
             $this->udaje_webu["description"] = "Error description";
         }
         $this->udaje_webu['hl_udaje'] = $hl_udaje->toArray();
     } else {
         //Len preto aby tam nieco bolo
         $this->udaje_webu["description"] = "Nenájdená stránka";
         $this->udaje_webu['hl_udaje'] = FALSE;
     }
     //Vypocet max. velkosti suboru pre upload
     $ini_v = trim(ini_get("upload_max_filesize"));
     $s = ['g' => 1 << 30, 'm' => 1 << 20, 'k' => 1 << 10];
     $this->upload_size = intval($ini_v) * ($s[strtolower(substr($ini_v, -1))] ?: 1);
     // -- Povodny:
     $this->texty_presentera->setLanguage($this->language);
     //Nastavenie textov podla jazyka
 }