public function contentAction($param1, $param2 = "") { if ($param1 == "main") { $id = $param2; } else { $id = $param1; } $id = $this->int($id); $rubriques = Rubrique::find(array("idDomaine = " . $id, "order" => "ordre")); foreach ($rubriques as $rubrique) { echo "<h1>" . $rubrique->getTitre() . "</h1>"; echo $rubrique->getDescription(); ob_start(); $exemples = $rubrique->getExemples(['order' => 'ordre']); foreach ($exemples as $exemple) { echo $this->replaceTitre($exemple->getTitre()); echo $this->replaceAlerts($exemple->getDescription()); $header = NULL; if (StrUtils::isNotNull($exemple->getHeader())) { $header = $exemple->getHeader(); } $footer = NULL; if (StrUtils::isNotNull($exemple->getCode())) { $footer = "<pre><code class='language-" . $exemple->getLanguage() . "'>" . htmlentities($exemple->getCode()) . "</code></pre>"; } $p = $this->jquery->bootstrap()->htmlPanel("id-" . $exemple->getId(), null, $header, $footer); echo $p->compile(); } $all = ob_get_contents(); ob_end_clean(); if (count($this->anchors) > 2) { $ddAnchors = new HtmlDropdown("anchors", "Accès rapide"); $ddAnchors->setStyle("btn-default"); $ddAnchors->asButton(); foreach ($this->anchors as $kAnchor => $vAnchor) { $ddAnchors->addItem($vAnchor, "#" . $kAnchor); } echo $ddAnchors->compile(); } echo $all; } $this->jquery->exec("Prism.highlightAll();", true); if ($param1 == "main") { $this->jquery->get("index/menu/" . $id, ".col-md-3"); } echo $this->jquery->compile(); $this->view->disable(); }
public function searchAction() { $text = $_POST["text"]; if (Text::startsWith($this->translateEngine->getLanguage(), "en", true)) { $domaines = Domaine::find("libelle LIKE '%" . $text . "%'"); $rubriques = Rubrique::find("titre LIKE '%" . $text . "%' OR description LIKE '%" . $text . "%'"); $exemples = Exemple::find("titre LIKE '%" . $text . "%' OR description LIKE '%" . $text . "%'"); } else { $domaines = array(); $rubriques = array(); $exemples = array(); $translations = $this->translateEngine->getTranslations(); if ($text != "") { $arrayTranslations = $translations->filter(function ($object) use($text) { if ($object->getName() == "domaine.libelle" && stristr($object->getText(), $text) !== false) { return $object; } }); if (sizeof($arrayTranslations) > 0) { $domaines = Domaine::find($this->_getCondition($arrayTranslations)); } $arrayRubriques = $translations->filter(function ($object) use($text) { if (Text::startsWith($object->getName(), "rubrique" && stristr($object->getText(), $text) !== false)) { return $object; } }); if (sizeof($arrayRubriques) > 0) { $rubriques = Rubrique::find($this->_getCondition($arrayRubriques)); } $arrayExemples = $translations->filter(function ($object) use($text) { if (Text::startsWith($object->getName(), "exemple")) { if (stristr($object->getText(), $text) !== false) { return $object; } } }); if (sizeof($arrayExemples) > 0) { $exemples = Exemple::find($this->_getCondition($arrayExemples)); } } } $this->_searchResults($text, $domaines, $rubriques, $exemples); }