<?php

// -----------------------------------------------------------------------
// This file is part of aroundme
// 
// Copyright (C) 2003, 2005 Barnraiser
// http://www.barnraiser.org/
// info@barnraiser.org
// 
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option) any
// later version.
// 
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with program; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
// -----------------------------------------------------------------------

include "inc/header_group.inc.php";

//append language setup
require_once($languageArrayPath . 'arr_genre.lang.php');
require_once($languageArrayPath . 'arr_group.lang.php');


//setup group
$group->group_visibility = 1;
$group->file->noimage = $c_node['file']['image']['thumb'][3]['noimage'];
$group->file->thumb = $c_node['file']['image']['thumb'][3]['name'];

if (isset($_POST['search'])) {
	$search = trim($_POST['search_text']);
	
	if (isset($_POST['search_genre_id'])) {
	    $group->genre_id = $_POST['search_genre_id'];
	}
		
	$output_search_results = $group->getGroups($search);
	
	$display = "search";
}
elseif (isset($_REQUEST['my_groups'])) {
	$output_my_groups = $group->getMyGroups();
	
	$display = "mygroups";
}
else {
	$group->limit = 25;
	$lastest_groups = $group->getGroups();
}

//move to template
if (!empty($lastest_groups)) {
	$body->set('latest_groups', $lastest_groups);
}

if (!empty($output_my_groups)) {
	$body->set('my_groups', $output_my_groups);
}

if (!empty($output_search_results)) {
	$body->set('search_results', $output_search_results);
}

if (isset($display)) {
	$body->set('display', $display);
}

if (!empty($search)) {
	$body->set('search', $search);
}

if (isset($search_genre_id)) {
	$body->set('search_genre_id', $search_genre_id);
}


$template_pageLink = "groups";
include "inc/footer.inc.php";

?>
