<?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($languageTextPath . 'node_rules.lang.php');
require_once($languageArrayPath . 'arr_language_name.lang.php');
require_once($languageArrayPath . 'arr_user.lang.php');
require_once($languageArrayPath . 'arr_group.lang.php');


if (isset($_POST['delete_group'])) {

	$display = "confirm_delete";
}
elseif (isset($_POST['delete_group_confirm'])) {
	//$group->deleteGroup($group_id);
	//header("Location: g_groups.php?".SID);
	//exit;
	echo "bye - " .$group_id;
}




//get count of each memberships role
$group_acs->group_id = $group_id;
$group_roles = $group_acs->getGroupRoles();
$group->member_status_id = $c_node['group']['member_status']['active'];

if (isset($group_roles)) {
    foreach($group_roles as $key => $i):
		$group->role_id = $i['role_id'];
		$group_roles[$key]['total_members'] = $group->getCountMembers();
	endforeach;
}

$lang['txt_node_rules'] = nl2br($lang['txt_node_rules']);


$wiki_path = "g_library.php?group_id=" . $group->group_id . "&page=";
$wiki_new_path = "g_library_edit.php?group_id=" . $group->group_id . "&page=";
$wiki_image_base = $c_node['dir']['asset_path'] . "group/";

require_once($c_node['dir']['class_path'] . 'Wiki/Wiki.php');
//wiki setup
$wiki =& new Text_Wiki();
$wiki->setRenderConf('xhtml', 'wikilink', 'view_url', $wiki_path);
$wiki->setRenderConf('xhtml', 'wikilink', 'new_url', $wiki_new_path);
$wiki->setRenderConf('xhtml', 'image', 'base', $c_node['dir']['asset_path'] . $wiki_image_base);

$output_group['group_rules'] = $wiki->transform($output_group['group_rules'], 'Xhtml');

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

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

if (!empty($display)) {
	$body->set('display', $display);
}
include "inc/footer.inc.php";

?>
