public function display_news() { if (isset($_GET['readmore']) && isnum($_GET['readmore'])) { // Item Result $info = $this->set_NewsItemInfo($_GET['readmore']); render_news_item($info); } elseif (isset($_GET['cat_id']) && isnum($_GET['cat_id'])) { // Category Result $info = $this->set_NewsCatInfo($_GET['cat_id']); render_main_news($info); } else { // All Results $info = $this->set_NewsInfo(); render_main_news($info); } }
/** * News Page Template * @param $info */ function render_main_news($info) { global $userdata, $settings, $news_settings, $locale; add_to_head("<link href='" . INFUSIONS . "news/templates/css/news.css' rel='stylesheet'/>\n"); add_to_head("<script type='text/javascript' src='" . INCLUDES . "jquery/jquery.cookie.js'></script>"); if (isset($_POST['switchview'])) { add_to_jquery("\$.cookie('fusion_news_view', '" . $_POST['switchview'] . "', {expires: 7});"); $_COOKIE['fusion_news_view'] = $_POST['switchview']; } opentable($locale['news_0004']); echo render_breadcrumbs(); /* Slideshow */ $carousel_indicators = ''; $carousel_item = ''; $res = 0; $carousel_height = "300"; if (!empty($info['news_items'])) { $i = 0; foreach ($info['news_items'] as $news_item) { if ($news_item['news_image_src'] && file_exists($news_item['news_image_src'])) { $carousel_active = $res == 0 ? 'active' : ''; $res++; $carousel_indicators .= "<li data-target='#news-carousel' data-slide-to='{$i}' class='" . $carousel_active . "'></li>\n"; $carousel_item .= "<div class='item " . $carousel_active . "'>\n"; $carousel_item .= "<img class='img-responsive' style='position:absolute; width:100%; margin-top:-25%' src='" . $news_item['news_image_src'] . "' alt='" . $news_item['news_subject'] . "'>\n"; $carousel_item .= "\n\t\t\t\t\t<div class='carousel-caption'>\n\t\t\t\t\t\t<div class='overflow-hide'>\n\t\t\t\t\t\t<a class='text-white' href='" . INFUSIONS . "news/news.php?readmore=" . $news_item['news_id'] . "'><h4 class='text-white m-t-10'>" . $news_item['news_subject'] . "</h4></a>\n\n\t\t\t\t\t\t<span class='news-carousel-action m-r-10'><i class='fa fa-eye fa-fw'></i>" . $news_item['news_reads'] . "</span>\n\t\t\t\t\t\t" . ($news_item['news_allow_comments'] ? "<span class='m-r-10'>" . display_comments($news_item['news_comments'], INFUSIONS . "news/news.php?readmore=" . $news_item['news_id'] . "#comments") . "</span>" : '') . "\n\t\t\t\t\t\t" . ($news_item['news_allow_ratings'] ? "<span class='m-r-10'>" . display_ratings($news_item['news_sum_rating'], $news_item['news_count_votes'], INFUSIONS . "news/news.php?readmore=" . $news_item['news_id'] . "#postrating") . " </span>" : '') . "\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t</div>\n</div>\n\n\t\t\t\t\t"; $i++; } } } /* Title Panel */ if (!isset($_GET['readmore'])) { if ($res) { echo "<div id='news-carousel' class='carousel slide' data-interval='20000' data-ride='carousel'>\n"; if ($res > 1) { echo "<ol class='carousel-indicators'>\n"; echo $carousel_indicators; echo "</ol>"; } echo "<div class='carousel-inner' style='height:" . $carousel_height . "px' role='listbox'>\n"; echo $carousel_item; echo "</div>\n"; echo "\n\t\t\t\t<a class='left carousel-control' href='#news-carousel' role='button' data-slide='prev'>\n\t\t\t\t\t<span class='glyphicon glyphicon-chevron-left' aria-hidden='true'></span>\n\t\t\t\t\t<span class='sr-only'>" . $locale['previous'] . "</span>\n\t\t\t \t</a>\n\t\t\t \t<a class='right carousel-control' href='#news-carousel' role='button' data-slide='next'>\n\t\t\t\t\t<span class='glyphicon glyphicon-chevron-right' aria-hidden='true'></span>\n\t\t\t\t\t<span class='sr-only'>" . $locale['next'] . "</span>\n\t\t\t \t</a>\n\n\t\t\t\t"; echo "</div>\n"; } echo "<div class='panel panel-default panel-news-header'>\n"; echo "<div class='panel-body'>\n"; echo "<div class='pull-right'>\n"; echo "<a class='btn btn-sm btn-default text-dark' href='" . INFUSIONS . "news/news.php'><i class='entypo newspaper'></i>" . $locale['news_0007'] . "</a>\n"; echo "<button type='button' class='btn btn-sm btn-primary' data-toggle='collapse' data-target='#newscat' aria-expanded='true' aria-controls='newscat'><i class='entypo book open'></i>" . $locale['news_0009'] . "</button>\n"; echo "</div>\n"; echo "<div class='pull-left m-r-10' style='position:relative; margin-top:-30px;'>\n"; echo "<div style='max-width:80px;'>\n"; echo $info['news_cat_image']; echo "</div>\n"; echo "</div>\n"; echo "<div class='overflow-hide'>\n"; echo "<h3 class='display-inline text-dark'>" . $info['news_cat_name'] . "</h3><br/><span class='strong'>" . $locale['news_0008'] . ":</span> <span class='text-dark'>\n\n\t\t\t" . ($info['news_last_updated'] > 0 ? showdate('newsdate', $info['news_last_updated']) : $locale['na']) . "</span>"; echo "</div>\n"; echo "</div>\n"; echo "<div id='newscat' class='panel-collapse collapse m-b-10'>\n"; echo "<!--pre_news_cat_idx-->"; echo "<ul class='list-group'>\n"; echo "<li class='list-group-item'><hr class='m-t-0 m-b-5'>\n"; echo "<span class='display-inline-block m-b-10 strong text-smaller text-uppercase'> " . $locale['news_0010'] . "</span><br/>\n"; foreach ($info['news_categories'] as $cat_id => $cat_data) { echo isset($_GET['cat_id']) && $_GET['cat_id'] == $cat_id ? '' : "<a href='" . INFUSIONS . "news/news.php?cat_id=" . $cat_id . "' class='btn btn-sm btn-default'>" . $cat_data['name'] . "</a>"; } echo "<a href='" . INFUSIONS . "news/news.php?cat_id=0' class='btn btn-sm btn-default'>" . $locale['news_0006'] . "</a>\n"; echo "</li>"; echo "</ul>\n"; echo "<!--sub_news_cat_idx-->\n"; echo "</div>\n</div>\n"; echo "<div class='row m-b-20 m-t-20'>\n"; echo "<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>\n"; echo openform('viewform', 'post', FUSION_REQUEST, array('max_tokens' => 1, 'class' => 'pull-right display-inline-block m-l-10')); echo "<div class='btn-group'>\n"; $active = isset($_COOKIE['fusion_news_view']) ? $_COOKIE['fusion_news_view'] : ''; echo form_button('switchview', '', '1', array('class' => "btn-sm btn-default nsv " . ($active == 1 ? 'active' : '') . " ", 'icon' => 'entypo layout', 'alt' => $locale['news_0014'])); echo form_button('switchview', '', '2', array('class' => "btn-sm btn-default nsv " . ($active == 2 ? 'active' : '') . "", 'icon' => 'entypo menu', 'alt' => $locale['news_0015'])); echo "</div>\n"; echo closeform(); // Filters echo "<div class='display-inline-block'>\n"; echo "<span class='text-dark strong m-r-10'>" . $locale['show'] . " :</span>"; $i = 0; foreach ($info['news_filter'] as $link => $title) { $filter_active = !isset($_GET['type']) && $i == '0' || isset($_GET['type']) && stristr($link, $_GET['type']) ? 'text-dark strong' : ''; echo "<a href='" . $link . "' class='display-inline {$filter_active} m-r-10'>" . $title . "</a>"; $i++; } echo "</div>\n"; // end filter. echo "</div>\n</div>\n"; $news_span = $active == 2 ? 12 : 4; if (!empty($info['news_items'])) { echo "<div class='row'>\n"; foreach ($info['news_items'] as $i => $news_info) { echo "<div class='col-xs-12 col-sm-{$news_span} col-md-{$news_span} col-lg-{$news_span}'>\n"; echo isset($_GET['cat_id']) ? "<!--pre_news_cat_idx-->\n" : "<!--news_prepost_" . $i . "-->\n"; render_news($news_info['news_subject'], $news_info['news_news'], $news_info, $active == 2); echo isset($_GET['cat_id']) ? "<!--sub_news_cat_idx-->" : "<!--sub_news_idx-->\n"; echo "</div>\n"; } echo "</div>\n"; if ($info['news_item_rows'] > $news_settings['news_pagination']) { $type_start = isset($_GET['type']) ? "type=" . $_GET['type'] . "&" : ''; $cat_start = isset($_GET['cat_id']) ? "cat_id=" . $_GET['cat_id'] . "&" : ''; echo "<div class='text-center m-t-10 m-b-10'>" . makepagenav($_GET['rowstart'], $news_settings['news_pagination'], $info['news_item_rows'], 3, INFUSIONS . "news/news.php?" . $cat_start . $type_start) . "</div>\n"; } } else { echo "<div class='well text-center'>" . $locale['news_0005'] . "</div>\n"; } } else { render_news_item($info); } closetable(); }