wwwroot}pg/discussions/section?section={$section}\">{$title} ";
$tag = get_input('tag');
$filter = get_input('filter');
if (($filter != 'comm') && ($filter != 'latest') && ($filter != 'search')) {
$filter = 'latest';
}
$tabbed_nav = "";
$tabbed_nav .= "
";
$tabbed_nav .= "
";
// Display tagcloud
$area2 .= "";
$offset = get_input('offset', 0);
$limit = 10;
// If tag is set, make a search with it
if ($tag) {
$tag = urldecode($tag);
/*translation:Browse by tag: */
$area2 .= "" . elgg_echo("koolielu:heading_browse_by_tag") . $tag . " ";
$objs = list_entities_from_metadata_multi(array('tags' => $tag, 'section' => $section), 'object', 'disctopic', 0, $limit, false, false, true);
} else {
$objs = $tabbed_nav;
if ($filter == 'comm') {
$results_count = discussions_get_last_commented_from_metadata("section", $section, "object", "disctopic", 0, 0, 0, "", 0, true);
$results = discussions_get_last_commented_from_metadata("section", $section, "object", "disctopic", 0, $limit, $offset);
$objs .= elgg_view_entity_list($results, $results_count, $offset, $limit, false, false, true);
} else if ($filter == 'latest') {
$objs .= list_entities_from_metadata('section', $section, 'object', 'disctopic', 0, $limit, false, false, true);
} else if ($filter == 'search') {
$search_criteria = get_input("criteria");
$objs .= "";
$objs .= <<
jQuery(document).ready(function(){
jQuery('#search_discussions').click(function(){
var search_criteria = jQuery('#search_criteria').val();
window.location = '{$CONFIG->wwwroot}pg/discussions/section?section={$section}&filter=search&criteria='+search_criteria;
});
});
EOT;
/*translation:Search discussions*/
$objs .= "".elgg_echo("koolielu:discussions:search_discussions")." ";
$objs .= elgg_view('input/text', array('internalname' => 'search_criteria', 'internalid' => 'search_criteria', 'value' => $search_criteria, 'class' => 'search_input'));
$objs .= elgg_view('input/button', array('internalname' => 'search_discussions', 'internalid' => 'search_discussions', 'value' => elgg_echo('search:go'), 'type' => 'button'));
$objs .= "
";
if ($search_criteria) {
$results_count = search_discussions_from_metadata("section", $section, "object", "disctopic", 0, 0, 0, "", 0, true, $search_criteria);
$results = search_discussions_from_metadata("section", $section, "object", "disctopic", 0, $limit, $offset, "", 0, false, $search_criteria);
$objs .= elgg_view_entity_list($results, $results_count, $offset, $limit, false, flase, true);
}
}
}
if (!empty($objs)) {
//$area2 .= elgg_view("koolielu/ke_rss_link_view");
$area2 .= $objs;
}
$body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
page_draw($title, $body);
?>