/** * News Item Page Template * @param $info */ function render_news_item($info) { global $aidlink; $locale = fusion_get_locale(); $news_settings = get_settings('news'); $data = $info['news_item']; add_to_head("<link rel='stylesheet' href='" . INFUSIONS . "news/templates/css/news.css' type='text/css'>"); add_to_head("<link rel='stylesheet' href='" . INCLUDES . "jquery/colorbox/colorbox.css' type='text/css' media='screen' />"); add_to_head("<script type='text/javascript' src='" . INCLUDES . "jquery/colorbox/jquery.colorbox.js'></script>"); add_to_footer('<script type="text/javascript"> $(document).ready(function() { $(".news-image-overlay").colorbox({ transition: "elasic", height:"100%", width:"100%", maxWidth:"98%", maxHeight:"98%", scrolling:false, overlayClose:true, close:false, photo:true, onComplete: function(result) { $("#colorbox").live("click", function(){ $(this).unbind("click"); $.fn.colorbox.close(); }); }, onLoad: function () { } }); }); </script>'); opentable($locale['news_0004']); echo render_breadcrumbs(); echo "<!--news_pre_readmore-->"; echo "<article class='news-item' style='display:block; width:100%; overflow:hidden;'>\n"; echo "<h2 class='text-center'>" . $data['news_subject'] . "</h2>\n"; echo "<div class='news_news text-dark m-t-20 m-b-20'>\n"; if ($data['news_image_src']) { echo "<a class='" . $data['news_ialign'] . " news-image-overlay' href='" . $data['news_image_src'] . "'>\n <img class='img-responsive' src='" . $data['news_image_src'] . "' alt='" . $data['news_subject'] . "' style='padding:5px; max-height:" . $news_settings['news_photo_h'] . "px; overflow:hidden;' /></a>"; } elseif (!empty($data['news_image']) && !empty($data['news_cat_image_src'])) { echo "<a class='" . $data['news_ialign'] . "' href='" . INFUSIONS . "news/news.php?cat_id=" . $data['news_cat_id'] . "'>\n <img class='img-responsive' src='" . IMAGES_NC . $data['news_cat_image_src'] . "' style='padding:5px; max-height:" . $news_settings['news_photo_h'] . "px; alt='" . $data['news_cat_name'] . "' />\n </a>"; } echo $data['news_news']; echo "</div>\n"; echo "<div class='news_extended text-dark m-t-20 m-b-20'>" . $data['news_extended'] . "</div>\n"; echo "<div style='clear:both;'></div>\n"; echo "<div class='well m-t-5 text-center'>\n"; echo "<span class='news-action m-r-10'><i class='fa fa-user'></i>" . profile_link($data['user_id'], $data['user_name'], $data['user_status']) . "</span>\n"; echo "<span class='news-action m-r-10'><i class='fa fa-calendar'></i>" . showdate("newsdate", $data['news_datestamp']) . "</span>\n"; echo "<span class='news-action'><i class='fa fa-eye'></i><span class='text-dark m-r-10'>" . number_format($data['news_reads']) . "</span>\n</span>"; echo $data['news_allow_comments'] ? display_comments($data['news_comments'], INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "#comments") : ''; echo $data['news_allow_ratings'] ? "<span class='m-r-10'>" . display_ratings($data['news_sum_rating'], $data['news_count_votes'], INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "#ratings") . " </span>" : ''; echo "<a class='m-r-10' title='" . $locale['news_0002'] . "' href='" . BASEDIR . "print.php?type=N&item_id=" . $data['news_id'] . "'><i class='fa fa-print'></i></a>"; echo iADMIN && checkrights("N") ? "<a title='" . $locale['news_0003'] . "' href='" . INFUSIONS . "news/news_admin.php" . $aidlink . "&action=edit&section=news_form&news_id=" . $data['news_id'] . "' title='" . $locale['news_0003'] . "' />" . $locale['news_0003'] . "</a>\n" : ""; echo "</div>"; echo "<!--news_sub_readmore-->"; echo !isset($_GET['readmore']) && $data['news_ext'] == "y" ? "<div class='m-t-20'>\n<a href='" . INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "' class='button'>" . $locale['news_0001'] . "</a>\n</div>\n" : ""; if ($data['page_count'] > 0) { echo "<div class='text-center m-t-10'>\n" . makepagenav($_GET['rowstart'], 1, $data['page_count'], 3, INFUSIONS . "news/news.php?readmore=" . $_GET['readmore'] . "&") . "\n</div>\n"; } if ($data['news_allow_comments']) { echo "<hr />" . showcomments("N", DB_NEWS, "news_id", $_GET['readmore'], INFUSIONS . "news/news.php?readmore=" . $_GET['readmore']) . "\n"; } if ($data['news_allow_ratings']) { echo "<hr />" . showratings("N", $_GET['readmore'], INFUSIONS . "news/news.php?readmore=" . $_GET['readmore']) . "\n"; } echo "</article>\n"; closetable(); }
/** * Parse MVC Data output * @param array $data - dbarray of newsQuery() * @return array */ public static function get_NewsData(array $data) { $news_settings = self::get_news_settings(); if (!empty($data)) { $largeImg = ""; $news_subject = stripslashes($data['news_subject']); $imageSource = IMAGES_N . "news_default.jpg"; if ($data['news_cat_image']) { $imageSource = get_image("nc_" . $data['news_cat_name']); } if ($news_settings['news_image_frontpage'] == 0) { if ($data['news_image'] && file_exists(IMAGES_N . $data['news_image'])) { $imageSource = IMAGES_N . $data['news_image']; $largeImg = $imageSource; } if ($data['news_image_t2'] && file_exists(IMAGES_N_T . $data['news_image_t2'])) { $imageSource = IMAGES_N_T . $data['news_image_t2']; } if ($data['news_image_t1'] && file_exists(IMAGES_N_T . $data['news_image_t1'])) { $imageSource = IMAGES_N_T . $data['news_image_t1']; } } $image = "<img class='img-responsive' src='" . $imageSource . "' alt='" . $data['news_subject'] . "' />\n"; if (!empty($data['news_extended'])) { $news_image_link = $news_settings['news_image_link'] == 0 ? INFUSIONS . "news/news.php?cat_id=" . $data['news_cat'] : INFUSIONS . "news/news.php?readmore=" . $data['news_id']; $news_image = "<a class='img-link' href='{$news_image_link}'>{$image}</a>\n"; } else { $news_image = $image; } $news_cat_image = "<a href='" . ($news_settings['news_image_link'] == 0 ? "" . INFUSIONS . "news/news.php?cat_id=" . $data['news_cat'] : INFUSIONS . "news/news.php?readmore=" . $data['news_id']) . "'>"; if ($data['news_image_t2'] && $news_settings['news_image_frontpage'] == 0) { $news_cat_image .= $image . "</a>"; } elseif ($data['news_cat_image']) { $news_cat_image .= "<img src='" . get_image("nc_" . $data['news_cat_name']) . "' alt='" . $data['news_cat_name'] . "' class='img-responsive news-category' /></a>"; } $news_news = preg_replace("/<!?--\\s*pagebreak\\s*-->/i", "", $data['news_breaks'] == "y" ? nl2br(parse_textarea($data['news_news'])) : parse_textarea($data['news_news'])); $info = array("news_id" => $data['news_id'], 'news_subject' => $news_subject, "news_url" => INFUSIONS . 'news/news.php?readmore=' . $data['news_id'], "news_cat_url" => INFUSIONS . 'news/news.php?cat_id=' . $data['news_cat_id'], "news_image_url" => $news_settings['news_image_link'] == 0 ? INFUSIONS . "news/news.php?cat_id=" . $data['news_cat_id'] : INFUSIONS . "news/news.php?readmore=" . $data['news_id'], 'news_anchor' => "<a name='news_" . $data['news_id'] . "' id='news_" . $data['news_id'] . "'></a>", 'news_news' => $news_news, "news_keywords" => $data['news_keywords'], "user_id" => $data['user_id'], "user_name" => $data['user_name'], "user_status" => $data['user_status'], "user_avatar" => $data['user_avatar'], 'user_level' => $data['user_level'], "news_date" => $data['news_datestamp'], "news_cat_id" => $data['news_cat'], "news_cat_name" => !empty($data['news_cat_name']) ? $data['news_cat_name'] : fusion_get_locale('news_0006'), "news_cat_image" => $news_cat_image, "news_image" => $news_image, 'news_image_src' => $largeImg, "news_image_optimized" => $imageSource, "news_ext" => $data['news_extended'] ? "y" : "n", "news_reads" => $data['news_reads'], "news_comments" => $data['count_comment'], 'news_sum_rating' => $data['sum_rating'] ? $data['sum_rating'] : 0, 'news_count_votes' => $data['count_votes'], "news_allow_comments" => $data['news_allow_comments'], "news_display_comments" => $data['news_allow_comments'] ? display_comments($data['count_comment'], INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "#comments", '', 2) : '', "news_allow_ratings" => $data['news_allow_ratings'], "news_display_ratings" => $data['news_allow_ratings'] ? display_ratings($data['sum_rating'], $data['count_votes'], INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "#postrating", '', 2) : '', "news_sticky" => $data['news_sticky'], "print_link" => BASEDIR . "print.php?type=N&item_id=" . $data['news_id']); $info += $data; return (array) $info; } return array(); }