" . elgg_echo("koolielu:heading_browse_by_tag") . $tag . ""; } else if ($subject) { $objs_count = get_entities_from_metadata('subjects', $subject, 'object', 'tool', 0, 10, 0, "", 0, true); $objs = get_entities_from_metadata('subjects', $subject, 'object', 'tool', 0, $objs_count, 0, "", 0, false); //$objs = list_entities_from_metadata('subjects', $subject, 'object', 'tool', 0, 10, false, false, true); $curriculum_subject = getSubject($subject); if ($curriculum_subject) /*translation:Browse by subject: */ $area2 .= "

" . elgg_echo("koolielu:heading_browse_by_subject") . $curriculum_subject->title . "

"; } else if ($show_all) { $objs_count = get_entities('object', 'tool', 0, "", 10, 0, true); $objs = get_entities('object', 'tool', 0, "", $objs_count, 0, false); //$objs = list_entities('object', 'tool', 0, 10, false, false, true); /*translation:All tools*/ $area2 .= "

" . elgg_echo("koolielu:heading_all_tools") . "

"; } else { $objs_listing = list_entities("object", "tool", 0, 5, false, false, false); /*translation:Latest tools*/ $area2 .= "

" . elgg_echo("koolielu:heading_latest_tools") . "

"; } if ($objs) { $area2 .= elgg_view("koolielu/ke_rss_link_view"); /*translation:Tools count*/ $area2 .= '
' . elgg_echo("koolielu:tools_found_count") . ': ' . $objs_count . '
'; $sort_opts = array( /*translation:Created*/ 'created'=>elgg_echo('koolielu:sortby_Created'), /*translation:Updated*/ 'updated'=>elgg_echo('koolielu:sortby_Updated'), /*translation:Title*/ 'title'=>elgg_echo('koolielu:sortby_Title') ); /*translation:Sorted by*/ $area2 .= '
' . elgg_echo("koolielu:sortedby") . ': '; // Keep 'tag' and 'subject' present in the link $link_addition = ""; if ($tag) { $link_addition = "&tag=" . $tag; } else if ($subject) { $link_addition = "&subject=" . $subject; } foreach ($sort_opts as $sort_opt => $sort_opt_title) { if ($sort_val == $sort_opt) { $area2 .= '' . $sort_opt_title . ' '; } else { $area2 .= '' . $sort_opt_title . ' '; } } $area2 .= '
'; $offset = get_input("offset", 0); // Sort objects if needed if (in_array($sort_val, array('title', 'updated'))) { // Sorting by title $sorting_objs = array(); $sorted_objs = array(); foreach ($objs as $obj) { $sorting_objs[] = array('entity' => $obj, 'title' => $obj->title, 'updated' => $obj->time_updated); } $descsort = false; if ($sort_val == "title") $descsort = true; sksort($sorting_objs, $sort_val, $descsort); foreach ($sorting_objs as $sorting_obj) { $sorted_objs[] = $sorting_obj['entity']; } $ents = array_slice($sorted_objs, $offset, 10); $area2 .= elgg_view_entity_list($ents, count($sorted_objs), $offset, 10, false, false, true); } else { $ents = array_slice($objs, $offset, 10); $area2 .= elgg_view_entity_list($ents, count($objs), $offset, 10, false, false, true); } } else if ($objs_listing) { $area2 .= elgg_view("koolielu/ke_rss_link_view"); $area2 .= $objs_listing; } // External RSS parsed by tags $tools_rss = array(); $external_rss = ""; $tool_rss_1 = get_plugin_setting('rss_1', 'tools'); $tool_rss_1_cat = get_plugin_setting('rss_1_category', 'tools'); if (!empty($tool_rss_1)) { $tool_rss_1_result = elgg_view("koolielu/ke_externaltools_rss_view", array('items_number' => 4, 'feed_url' => $tool_rss_1, "category" => $tool_rss_1_cat)); if (!empty($tool_rss_1_result)) array_push($tools_rss, $tool_rss_1_result); } $tool_rss_2 = get_plugin_setting('rss_2', 'tools'); $tool_rss_2_cat = get_plugin_setting('rss_2_category', 'tools'); if (!empty($tool_rss_2)) { $tool_rss_2_result = elgg_view("koolielu/ke_externaltools_rss_view", array('items_number' => 4, 'feed_url' => $tool_rss_2, "category" => $tool_rss_2_cat)); if (!empty($tool_rss_2_result)) array_push($tools_rss, $tool_rss_2_result); } $tool_rss_3 = get_plugin_setting('rss_3', 'tools'); $tool_rss_3_cat = get_plugin_setting('rss_3_category', 'tools'); if (!empty($tool_rss_3)) { $tool_rss_3_result = elgg_view("koolielu/ke_externaltools_rss_view", array('items_number' => 4, 'feed_url' => $tool_rss_3, "category" => $tool_rss_3_cat)); if (!empty($tool_rss_3_result)) array_push($tools_rss, $tool_rss_3_result); } if (sizeof($tools_rss) > 0) { $external_rss .= ""; foreach ($tools_rss as $key => $value) { $external_rss .= ""; } $external_rss .= "
"; $external_rss .= $value; $external_rss .= "
"; } // Add external rss to main content $area2 .= $external_rss; // Add categories menu $area1 .= elgg_view("tools/ke_menu_tools_section_moderator"); $area1 .= elgg_view("tools/ke_menu_subjects_view"); $body = elgg_view_layout('two_columns', $area1, $area2); page_draw($title, $body); ?>