<?php

	/*
	*	Gekko - Open Source Web Development Framework
	*	------------------------------------------------------------------------
	*	Copyright (C) 2004-2005, J. Carlos Nieto <xiam@users.sourceforge.net>
	*	This program is Free Software.
	*
	*	@package	Gekko
	*	@license	http://www.gnu.org/copyleft/gpl.html GNU/GPL License 2.0
	*	@author		J. Carlos Nieto <xiam@users.sf.net>
	*	@version	CVS: $Id:$
	*	@link		http://gekkoware.sourceforge.net
	*/

	if (!defined("IN-GEKKO")) die("Get a life!");

	$action = _ext("action", 2);
	$page = _ext("page", 2);
	$id = _ext("id", 3);

	switch ($action) {
		case "edit":
			if (!$id) break;

			$tpl = new ContentBlock();

			$tpl->insert("BLOCK_CONTENT", "groups/index.admin.tpl");
			$tpl->insert("GROUPS.FORM", "groups/groups.form.tpl");

			$db->query("
				SELECT
					ID, Groupname, Description, Status, IncludeGroups
				FROM ".db_table("group")." WHERE ID = '".$id."'
			");

			if (!$db->num_rows()) break;

			$row = $db->fetch_row();
			saneHTML($row);

			$row["BLOCK_TITLE"] = _l("L_GROUPS");
			$row["BLOCK_ICON"] = mkIcon("packages.png", 16);
			$row["BLOCK_SUBTITLE"] = _l("L_EDIT");
			$row["STATUS.SEL"] = mkSelect(array(_l("L_DISABLED"), _l("L_ENABLED")), $row["Status"], "status");
			$row["ACTION"] = "edit";
			$row["RETURN"] = "../../index.php/admin/groups";

			$tpl->set_arr($row);

			$mcBuff = $tpl->make();

		break;
		default:

			use_ssl();

			$tpl = new ContentBlock();

			$tpl->insert("BLOCK_CONTENT", "packages/index.admin.tpl");

			$tpl->set_arr(
				Array (
					"BLOCK_TITLE" => _l("L_PACKAGES"),
					"BLOCK_ICON" => mkIcon("packages.png", 16),
					"BLOCK_SUBTITLE" => _l("L_INSTALL_PACKAGE"),
					"ACTION" => "install",
					"RETURN" => ""
				)
			);

			$mcBuff = $tpl->make();
		break;
	}


?>