public function getMainMenu()
 {
     $url = $this->controller->url;
     $translateEngine = $this->controller->getTranslateEngine();
     $jquery = $this->controller->jquery;
     $menu = $jquery->semantic()->htmlMenu("navbarJS");
     $menu->addItem($translateEngine->translate(1, "index.home", "home"));
     $domaines = \Domaine::find("isNull(idParent)");
     $menu->fromDatabaseObjects($domaines, function ($domaine) use($url, $translateEngine) {
         $libelle = $translateEngine->translate($domaine->getId(), "domaine.libelle", $domaine->getLibelle());
         $item = new HtmlSemDoubleElement("menu-" . $libelle, "a", "item");
         $item->setContent($libelle);
         if (!$domaine->getSemantic()) {
             $item->setProperty("href", $url->get("Index/bootstrap/" . $domaine->getId()));
         } else {
             $item->getOnClick("Index/content/main/" . $domaine->getId(), "#response");
         }
         return $item;
     });
     $menu->getItem(0)->addToProperty("class", "navbar-brand")->setProperty("href", $url->get("index"));
     $menu->setInverted()->setSize(Size::LARGE);
     $input = new HtmlInput("search", "search", "", $translateEngine->translate(1, "index.search", "Search..."));
     $input->addIcon("search", Direction::RIGHT)->asLink();
     $jquery->postOnClick("#div-search i", "Index/search", '{"text":$("#search").val()}', "#response");
     $ddLang = new \Ajax\semantic\html\modules\HtmlDropdown("idLang");
     foreach (TranslateEngine::$languages as $keyLang => $valueLang) {
         $item = $ddLang->addItem($valueLang, $url->get("Index/index/" . $keyLang));
         $item->setProperty("href", $url->get("Index/index/" . $keyLang));
         // $item->getOnClick("Index/index/".$keyLang,"body");
         if (JString::startsWith($translateEngine->getLanguage(), $keyLang, true)) {
             $ddLang->setValue($valueLang . " : " . $keyLang);
         }
     }
     $ddLang->asButton();
     $menu2 = $jquery->semantic()->htmlMenu("menu2", array($input, $ddLang));
     $menu2->setPosition("right");
     $menu2->setInverted();
     $menu->addItem($menu2);
     return $menu;
 }
 public function getMenuTabs($domaines)
 {
     $translateEngine = $this->controller->getTranslateEngine();
     $jquery = $this->controller->jquery;
     $sticky = $jquery->semantic()->htmlSticky("tabs");
     $sticky->setContext("#response");
     $tabs = $jquery->semantic()->htmlMenu("tabs-menu");
     $tabs->setVertical()->setInverted();
     $tabs->fromDatabaseObjects($domaines, function ($domaine) use($translateEngine, $tabs) {
         if (count($domaine->getDomaines()) > 0) {
             $libelle = $translateEngine->translate($domaine->getId(), "domaine.libelle", $domaine->getLibelle());
             if ($domaine->getComponent() === "HtmlDropdown") {
                 $dd = new HtmlDropdown("tab-" . $domaine->getId(), $libelle);
                 $dd->asButton();
                 $dd->fromDatabaseObjects($domaine->getDomaines(), function ($sousDomaine) use($translateEngine) {
                     $libelle = $translateEngine->translate($sousDomaine->getId(), "domaine.libelle", $sousDomaine->getLibelle());
                     return new HtmlDropdownItem("dd-item-" . $sousDomaine->getId(), $libelle);
                 });
                 return $dd;
             } else {
                 $ssMenu = new HtmlMenu("ss-" . $domaine->getId());
                 $ssMenu->fromDatabaseObjects($domaine->getDomaines(), function ($sousDomaine) use($translateEngine) {
                     $libelle = $translateEngine->translate($sousDomaine->getId(), "domaine.libelle", $sousDomaine->getLibelle());
                     $elm = new HtmlSemDoubleElement("ss-item-" . $sousDomaine->getId(), "a", "", $libelle);
                     return $elm;
                 });
             }
             $returnTabs = $tabs->generateMenuAsItem($ssMenu, $libelle);
             $tabs->getItemHeader()->setIdentifier("itemHeader-" . $domaine->getId());
             return $returnTabs;
         } else {
             $libelle = $translateEngine->translate($domaine->getId(), "domaine.libelle", $domaine->getLibelle());
             $elm = new HtmlSemDoubleElement("ss-item-" . $domaine->getId(), "a", "", $libelle);
             return $elm;
         }
     });
     $jquery->getOnClick("#tabs a.item, #tabs .ui.dropdown.item,#tabs .ui.item>.header", "Index/content/", "#response");
     $sticky->setContent($tabs);
     return $sticky;
 }
Example #3
0
 public function addDropdown($label = "", $items = array(), $direction = Direction::RIGHT)
 {
     $labelO = new HtmlDropdown("dd-" . $this->identifier, $label, $items);
     $labelO->asSelect("select-" . $this->identifier, false, true);
     return $this->labeled($labelO, $direction);
 }