<?php
/* $Id: mycatgroupperm.php 1 2006-06-07 08:07:41Z hodaka $
 *  ------------------------------------------------------------------------ *
 *                XOOPS - PHP Content Management System                      *
 *                    Copyright (c) 2000 XOOPS.org                           *
 *                       <http://www.xoops.org/>                             *
 *  ------------------------------------------------------------------------ *
 *                     MyAddress - XOOPS addressbook                         *
 *                        <http://www.kuri3.net/>                            *
 *             Copyright (c) 2004 by hodaka <hodaka@kuri3.net>               *
 * ------------------------------------------------------------------------- *
 * 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 of the License, or         *
 * (at your option) any later version.                                       *
 *                                                                           *
 * You may not change or alter any portion of this comment or credits        *
 * of supporting developers from this source code or any supporting          *
 * source code which is considered copyrighted (c) material of the           *
 * original comment or credit authors.                                       *
 *                                                                           *
 * 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 this program; if not, write to the Free Software               *
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  *
 */

// Some initial settings
include("admin_header.php");
include_once( XOOPS_ROOT_PATH."/class/xoopstree.php" );
include_once XOOPS_ROOT_PATH.'/class/xoopsform/grouppermform.php';
$module_id = $xoopsModule->getVar('mid');

// A list of items that we will be setting permissions to.
// The title of the group permission form
//$title_of_form = 'Permission form for MyAddress module';
$title_of_form = _AM_MYADDRESS_PERMTITLE;
// The name of permission which should be unique within the module
$perm_name = 'myadrs_category';
// A short description of this permission
//$perm_desc = 'Select categories for each group allowed to view';
$perm_desc = _AM_MYADDRESS_PERMDESC;
// Create and display the form
$form = new XoopsGroupPermForm($title_of_form, $module_id, $perm_name, $perm_desc);

// get categories
$rscat = $xoopsDB->query( "SELECT cid, title, pid FROM $table_cat ORDER BY cid") or die( "Error: Can't Get Category table." ) ;

$categories = array();

while ( list( $cid, $title, $pid ) = $xoopsDB->fetchRow($rscat)) {
	$categories[ $cid ] = array('name' => $title, 'parent' => $pid );
	$form->addItem( $cid, $title, $pid );
}

xoops_cp_header();
include('./mymenu.php'); // GIJOE
echo $form->render();
xoops_cp_footer();
?>