/** * Vrátí model šablony s nastavením * * @return KT_ZZZ_Theme_Model */ public static function getThemeModel() { if (isset(self::$themeModel)) { return self::$themeModel; } $themeModel = new KT_ZZZ_Theme_Model(); return self::$themeModel = $themeModel; }
private function initPosts() { $args = array("post_type" => KT_WP_POST_KEY, "post_status" => "publish", "posts_per_page" => self::DEFAULT_COUNT, "orderby" => "date", "order" => KT_Repository::ORDER_DESC, "cat" => KT_ZZZ::getThemeModel()->getCategoryNewsId()); $query = new WP_Query(); $posts = $query->query($args); if (KT::arrayIssetAndNotEmpty($posts)) { $this->posts = $posts; $this->postsCount = count($posts); } else { $this->posts = array(); $this->postsCount = 0; } }
private function initItems() { $items = array(); $repository = new KT_Repository("KT_ZZZ_Competitive_Advantage_Model", KT_ZZZ_Competitive_Advantage_Model::TABLE); $repository->addWhereParam(KT_ZZZ_Competitive_Advantage_Model::VISIBILITY_COLUMN, KT_Switch_Field::YES)->addWhereParam(KT_ZZZ_Competitive_Advantage_Model::CODE_COLUMN, "", "!=")->addOrder(KT_ZZZ_Competitive_Advantage_Model::MENU_ORDER_COLUMN)->addOrder(KT_ZZZ_Competitive_Advantage_Model::TITLE_COLUMN); if (KT_ZZZ::getThemeModel()->isCompetitiveAdvantagesMaxCount()) { $repository->setLimit(KT_ZZZ::getThemeModel()->getCompetitiveAdvantagesMaxCount()); } $repository->selectData(); if ($repository->haveItems()) { foreach ($repository->getItems() as $item) { $items[$item->getId()] = $item; } } $this->items = $items; $this->count = count($items); }
<?php $competitiveAdvantagesPresenter = new KT_ZZZ_Competitive_Advantages_Presenter(); ?> <section id="competitive-advantages"> <?php if (KT_ZZZ::getThemeModel()->isCompetitiveAdvantagesTitle()) { ?> <header> <h2><?php echo KT_ZZZ::getThemeModel()->getCompetitiveAdvantagesTitle(); ?> </h2> </header> <?php } ?> <div class="row"> <?php $competitiveAdvantagesPresenter->theItems(); ?> </div> </section>
?> " /> <?php wp_head(); ?> <!--[if lte IE 9]> <script src="<?php echo KT_ZZZ_JS_URL; ?> /compatibility.js"></script> <![endif]--> </head> <body> <?php if (KT_ZZZ::getThemeModel()->isAnalyticsTrackingCode()) { echo KT_ZZZ::getThemeModel()->getAnalyticsTrackingCode(); } ?> <header id="header" class="container"> <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only"><?php _e("Menu", "ZZZ_DOMAIN"); ?> </span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span>
<?php if (KT_ZZZ::getThemeModel()->isCategoryNews()) { $newsPresenter = new KT_ZZZ_News_Presenter(); ?> <section id="news"> <header> <h2><?php echo KT_ZZZ::getThemeModel()->getCategoryNewsTitle(); ?> </h2> </header> <div class="row"> <?php $newsPresenter->thePosts(); ?> </div> </section> <?php }