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 .= "