guid == $category_guid) { $subcategories = get_koolielu_subcategories($category->guid); foreach ($subcategories as $subcategory) { $cattoquery[] = $subcategory->guid; } } } $objs = ""; $results_count = get_entities_from_metadata_and_subtypes( array("categories" => $cattoquery, 'prioval' => '9'), "object", array("news", "infopage"), 0, 10, 0, "", 0, true); $results = get_entities_from_metadata_and_subtypes( array("categories" => $cattoquery, 'prioval' => '9'), "object", array("news", "infopage"), 0, 999, 0, "", 0, false); $prioresults = get_entities_from_metadata_and_subtypes( array("categories" => $cattoquery, 'prioval' => array('1', '2', '3', '4', '5')), "object", array("news", "infopage"), 0, 999, 0, "", 0, false); $finalarray = array(); $news_subtype_id = get_subtype_id(sanitise_string("object"), "news"); $page_subtype_id = get_subtype_id(sanitise_string("object"), "infopage"); if (is_array($results) && sizeof($results) > 0) { foreach ($results as $single_result) { if ($single_result->subtype == $page_subtype_id) { $finalarray[] = $single_result; } else if ($single_result->subtype == $news_subtype_id && $single_result->approved == 1 && $single_result->archived == 0) { $finalarray[] = $single_result; } } } $objs .= elgg_view_entity_list(sort_by($prioresults, 'prioval'), count($prioresults), 0, 10, false, false, true); if (sizeof($finalarray) > 0) { $ents = array_slice($finalarray, $offset, 10); $objs .= elgg_view_entity_list($ents, count($finalarray), $offset, 10, false, false, true); } $category = get_koolielu_category($category_guid); /*translation:Browse by category: */ //$area2 .= "

" . elgg_echo("koolielu:heading_browse_by_category") . $category->title . "

"; $area2 .= "

" . $category->title . "

"; } else if ($news_tag) { $news_tag = urldecode($news_tag); $objs = list_entities_from_metadata_multi(array("tags" => $news_tag, "approved" => 1, "archived" => 0), "object", "news", 0, 10, false, false, false); /*translation:Browse by tag: */ $area2 .= "

" . elgg_echo("koolielu:heading_browse_by_tag") . $news_tag . "

"; } else { $objs = list_entities_from_metadata_multi(array("approved" => 1, "archived" => 0), "object", "news", 0, 10, false, false, true); } $area1 .= elgg_view("koolielu/ke_menu_categories_view"); if (empty($objs)) { /*translation:No news found.*/ $area2 .= elgg_echo("koolielu:error_no_news_found"); } else { $area2 .= elgg_view("koolielu/ke_rss_link_view"); $area2 .= $objs; } $body = elgg_view_layout('two_columns', $area1, $area2); page_draw($title, $body); ?>