while ($rsCategories->fetch()) { if (!in_array($rsCategories->id, $aChildrens)) { $aAllowedParents[] = new formSelectOption(str_repeat(' ', $rsCategories->level - 1) . '• ' . html::escapeHTML($rsCategories->title), $rsCategories->id); } } # button set $okt->page->setButtonset('newsCatsBtSt', array('id' => 'news-cats-buttonset', 'type' => '', 'buttons' => array(array('permission' => true, 'title' => __('c_c_action_Go_back'), 'url' => 'module.php?m=news&action=categories', 'ui-icon' => 'arrowreturnthick-1-w')))); if ($iCategoryId) { # bouton add cat $okt->page->addButton('newsCatsBtSt', array('permission' => true, 'title' => __('m_news_cats_add_category'), 'url' => 'module.php?m=news&action=categories&do=add', 'ui-icon' => 'plusthick')); # bouton switch statut $okt->page->addButton('newsCatsBtSt', array('permission' => true, 'title' => $aCategoryData['active'] ? __('c_c_status_Online') : __('c_c_status_Offline'), 'url' => 'module.php?m=news&action=categories&do=edit&switch_status=1&category_id=' . $iCategoryId, 'ui-icon' => $aCategoryData['active'] ? 'volume-on' : 'volume-off', 'active' => $aCategoryData['active'])); # bouton de suppression $okt->page->addButton('newsCatsBtSt', array('permission' => $iCategoryNumPosts == 0, 'title' => __('c_c_action_Delete'), 'url' => 'module.php?m=news&action=categories&delete=' . $iCategoryId, 'ui-icon' => 'closethick', 'onclick' => 'return window.confirm(\'' . html::escapeJS(__('m_news_cats_delete_confirm')) . '\')')); # bouton vers la catégorie côté public $okt->page->addButton('newsCatsBtSt', array('permission' => $aCategoryData['active'] ? true : false, 'title' => __('c_c_action_Show'), 'url' => newsHelpers::getCategoryUrl($aCategoryLocalesData[$okt->user->language]['slug']), 'ui-icon' => 'extlink')); } # Titre de la page $okt->page->addGlobalTitle(__('m_news_cats_categories'), 'module.php?m=news&action=categories'); if ($iCategoryId) { $path = $okt->news->categories->getPath($iCategoryId, true, $okt->user->language); while ($path->fetch()) { $okt->page->addGlobalTitle($path->title, 'module.php?m=news&action=categories&do=edit&category_id=' . $path->id); } } else { $okt->page->addGlobalTitle(__('m_news_cats_add_category')); } # Lockable $okt->page->lockable(); # Tabs $okt->page->tabs();
/** * Affichage d'un article d'actualités. * */ public function newsItem($aMatches) { # module actuel $this->okt->page->module = 'news'; $this->okt->page->action = 'item'; # récupération de la page en fonction du slug if (!empty($aMatches[0])) { $sPostSlug = $aMatches[0]; } else { $this->serve404(); } # récupération de l'article $rsPost = $this->okt->news->getPost($sPostSlug, 1); if ($rsPost->isEmpty()) { $this->serve404(); } # is default route ? $bIsDefaultRoute = $this->isDefaultRoute(__CLASS__, __FUNCTION__, $sPostSlug); # permission de lecture ? if (!$this->okt->news->isPublicAccessible() || !$rsPost->isReadable()) { if ($this->okt->user->is_guest) { http::redirect(html::escapeHTML(usersHelpers::getLoginUrl($rsPost->url))); } else { $this->serve404(); } } # meta description if ($rsPost->meta_description != '') { $this->okt->page->meta_description = $rsPost->meta_description; } else { if ($this->okt->news->config->meta_description[$this->okt->user->language] != '') { $this->okt->page->meta_description = $this->okt->news->config->meta_description[$this->okt->user->language]; } else { $this->okt->page->meta_description = util::getSiteMetaDesc(); } } # meta keywords if ($rsPost->meta_keywords != '') { $this->okt->page->meta_keywords = $rsPost->meta_keywords; } else { if ($this->okt->news->config->meta_keywords[$this->okt->user->language] != '') { $this->okt->page->meta_keywords = $this->okt->news->config->meta_keywords[$this->okt->user->language]; } else { $this->okt->page->meta_keywords = util::getSiteMetaKeywords(); } } # title tag du module $this->okt->page->addTitleTag($this->okt->news->getTitle()); # début du fil d'ariane if (!$bIsDefaultRoute) { $this->okt->page->breadcrumb->add($this->okt->news->getName(), $this->okt->news->config->url); } # si les rubriques sont activées if ($this->okt->news->config->categories['enable'] && $rsPost->category_id) { # title tag de la rubrique $this->okt->page->addTitleTag($rsPost->category_title); # ajout de la hiérarchie des rubriques au fil d'ariane if (!$bIsDefaultRoute) { $rsPath = $this->okt->news->categories->getPath($rsPost->category_id, true, $this->okt->user->language); while ($rsPath->fetch()) { $this->okt->page->breadcrumb->add($rsPath->title, newsHelpers::getCategoryUrl($rsPath->slug)); } unset($rsPath); } } # title tag de la page $this->okt->page->addTitleTag($rsPost->title_tag == '' ? $rsPost->title : $rsPost->title_tag); # titre de la page $this->okt->page->setTitle($rsPost->title); # titre SEO de la page $this->okt->page->setTitleSeo($rsPost->title_seo); # fil d'ariane de la page if (!$bIsDefaultRoute) { $this->okt->page->breadcrumb->add($rsPost->title, $rsPost->url); } # affichage du template echo $this->okt->tpl->render($this->okt->news->getItemTplPath($rsPost->tpl, $rsPost->category_items_tpl), array('rsPost' => $rsPost)); }
/** * Retourne l'URL publique d'une rubrique * * @param string $sLanguage * @return string */ public function getCategoryUrl($sLanguage = null) { return newsHelpers::getCategoryUrl($this->category_slug, $sLanguage); }
} # fin Okatea : affichage des news de la rubrique id 1 ?> <?php # début Okatea : affichage des sous-rubriques de la rubrique id 1 if ($okt->modules->moduleExists('news')) { echo newsHelpers::getSubCatsByCatId(1); } # fin Okatea : affichage des sous-rubriques de la rubrique id 1 ?> <?php # début Okatea : affichage de l'arbre des rubriques if ($okt->modules->moduleExists('news')) { echo newsHelpers::getCategories(); } # fin Okatea : affichage de l'arbre des rubriques ?> </div><!-- #sidebar --> <div id="content"> <?php # début Okatea : titre de la page if ($okt->page->hasTitle()) { ?> <h2 id="rubric_title"><?php echo html::escapeHtml($okt->page->getTitle()); ?>
/** * Retourne sous forme de liste HTML les sous-catégories d'une catégorie donnée. * * @param integer $iCatId L'identifiant de la catégorie a lister. * @param string $sBlockFormat Masque de formatage du bloc de la liste. * @param string $sItemFormat Masque de formatage d'un élément de la liste. * @param string $sItemActiveFormat Masque de formatage de l'élément actif de la liste. * @param string $sLinkFormat Masque de formatage d'un lien de la liste. * @param string $sItemsGlue Chaine de liaison entre les éléments. * @return string * @deprecated use newsHelpers::getSubCatsByCatId() instead */ public function getSubCatsByCatId($iCatId, $sBlockFormat = '<ul>%s</ul>', $sItemFormat = '<li>%s</li>', $sItemActiveFormat = '<li class="active"><strong>%s</strong></li>', $sLinkFormat = '<a href="%s">%s</a>', $sItemsGlue = '') { trigger_error('Deprecated method, please use newsHelpers::getSubCatsByCatId() instead', E_USER_WARNING); return newsHelpers::getSubCatsByCatId($iCatId, $sBlockFormat, $sItemFormat, $sItemActiveFormat, $sLinkFormat, $sItemsGlue); }
} } # Images if ($okt->news->config->images['enable']) { $aPostData['images'] = $rsPost->getImagesInfo(); } # Fichiers if ($okt->news->config->files['enable']) { $aPostData['files'] = $rsPost->getFilesInfo(); } # Permissions if ($okt->news->canUsePerms()) { $aPostData['perms'] = $okt->news->getPostPermissions($aPostData['post']['id']); } # URL $sPostUrl = newsHelpers::getPostUrl($aPostData['locales'][$okt->user->language]['slug']); } } # -- TRIGGER MODULE NEWS : adminPostInit $okt->news->triggers->callTrigger('adminPostInit', $okt, $aPostData, $rsPost, $rsPostI18n); /* Traitements ----------------------------------------------------------*/ # switch post status if (!empty($_GET['switch_status']) && !empty($aPostData['post']['id']) && $bCanEditPost) { try { $okt->news->switchPostStatus($aPostData['post']['id']); # log admin $okt->logAdmin->info(array('code' => 32, 'component' => 'news', 'message' => 'post #' . $aPostData['post']['id'])); $okt->redirect('module.php?m=news&action=edit&post_id=' . $aPostData['post']['id'] . '&switched=1'); } catch (Exception $e) { $okt->error->set($e->getMessage());