/** 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; }
/** Akcia pre pridanie polozky polozky - krok c.1 - udaje pre DB tab.: hlavne_menu a hlavne_menu_lang * @param int $id - id nadradenej polozky * @param int $uroven - uroven menu */ public function actionAdd($id, $uroven) { //Kontrola urovne if (!isset($uroven)) { return $this->_toNotFound("Nezadaná úroveň!"); } $this->uroven = (int) $uroven; if (($druh = $this->druh->findOneBy(["presenter" => ucfirst($this->udaje_webu['meno_presentera']), "povolene" => 1])) === FALSE) { $this->texts_for_notFound["h2"] = "Nepodarilo sa nájsť druh!"; $this->setView("notFound"); return FALSE; } $hladaj = $this->uroven == 0 ? "id_hlavne_menu_cast" : "id_nadradenej"; $poradie = $this->hlavne_menu->findBy([$hladaj => (int) $id, "uroven" => $this->uroven])->max('poradie') + 1; $this->pol_menu = ['id' => 0, 'id_druh' => $druh->id, 'id_user_profiles' => $this->getUser()->getId(), 'poradie' => $poradie, 'uroven' => $this->uroven, 'id_hlavne_menu_cast' => (int) $id, 'id_nadradenej' => $this->uroven == 0 ? NULL : (int) $id, 'datum_platnosti' => NULL]; if (!$this->uroven) { //Pridavam priamo do casti $nad_pol = $this->hlavne_menu_cast->find($id); if ($nad_pol === FALSE) { return $this->_toNotFound("Nepodarilo sa nájsť časť!"); } } else { //Pridavam do menu $nad_pol = $this->hlavne_menu_lang->findOneBy(["id_hlavne_menu" => $id, "id_lang" => 1]); //Ak nemam polozku if ($nad_pol === FALSE) { return $this->_toNotFound("Nepodarilo sa nájsť nadradenú položku!"); } $this->pol_menu = array_merge($this->pol_menu, ['id_hlavne_menu_cast' => $nad_pol->hlavne_menu->id_hlavne_menu_cast, 'id_hlavicka' => $nad_pol->hlavne_menu->id_hlavicka]); } $vychodzie_pre_form = array_merge($this->pol_menu, ['langtxt' => ""]); foreach ($this->jaz as $j) { //Pridanie vychodzich hodnot pre jazyky $vychodzie_pre_form = array_merge($vychodzie_pre_form, [$j->skratka . '_nazov' => "", $j->skratka . '_h1part2' => "", $j->skratka . '_description' => ""]); $vychodzie_pre_form["langtxt"] .= " " . $j->skratka; } $vychodzie_pre_form["langtxt"] = trim($vychodzie_pre_form["langtxt"]); $this["menuEditForm"]->setDefaults($vychodzie_pre_form); //----------------------------------- $this->template->h2 = 'Pridanie položky pre: ' . $nad_pol->nazov; $this->template->pridanie = $this->jaz; $this->setView('krok1'); }
* * @author Ing. Peter VOJTECH ml. <*****@*****.**> * @copyright Copyright (c) 2012 - 2016 Ing. Peter VOJTECH ml. * @license * @link http://petak23.echo-msz.eu * @version 1.0.4 */
* Modul: ADMIN * * @author Ing. Peter VOJTECH ml. <*****@*****.**> * @copyright Copyright (c) 2012 - 2016 Ing. Peter VOJTECH ml. * @license * @link http://petak23.echo-msz.eu