<?php
//v1.0.4 www.bcoos.net 2006/10 GPL
// www.bcoos.net 2006-09 1.0.2 GPL
// $Id: groupform.php,v 1.4 2003/03/19 07:03:27 half-dead Exp $
// ------------------------------------------------------------------------- //
//               E-Xoops: Content Management for the Masses                  //
//                       < http://www.e-xoops.com >                          //
// ------------------------------------------------------------------------- //
// Original Author: Kazumi Ono
// Author Website : http://www.mywebaddons.com/ , http://www.myweb.ne.jp
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //
global $_SERVER;
if ( preg_match("/groupform\.php/i", $_SERVER['PHP_SELF']) ) {
	exit();
	}
include_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php");
$name_text      = new XoopsFormText(_NAME, "name", 30, 50, $name_value);
$desc_text      = new XoopsFormTextArea(_DESCRIPTION, "desc", $desc_value);
// GET modules with admin rights
$modules_array  = array();
$modules_array  = XoopsModule::getHasAdminModulesList();
$a_mod_checkbox = new XoopsFormCheckBox(_AM_ACTIVERIGHTS, "admin_mids[]", $a_mod_value);
foreach ($modules_array as $key=>$value) {
	$modules_array[$key] = $value."<br />";
}
$a_mod_checkbox->addOptionArray($modules_array);
// GET normal modules
$modules_array  = array();
$modules_array  = XoopsModule::getHasMainModulesList();
$r_mod_checkbox = new XoopsFormCheckBox(_AM_ACCESSRIGHTS, "read_mids[]", $r_mod_value);
foreach ($modules_array as $key=>$value) {
	$modules_array[$key] = "$value<br />";
}
$r_mod_checkbox->addOptionArray($modules_array);
// GET leftblocks
$new_blocks_array  = array();
$r_lblock_checkbox = new XoopsFormCheckBox(_AM_BLOCKRIGHTS.":<br /><i>"._LEFT."</i>", "read_bids[]", $r_block_value);
$blocks_array      = XoopsBlock::getAllBlocks("list", XOOPS_SIDEBLOCK_LEFT, 1, "weight", 1);
foreach ($blocks_array as $key=>$value) {
	$new_blocks_array[$key] = "<a href='".XOOPS_URL."/modules/system/admin.php?fct=blocksadmin&op=edit&bid=".$key."'>".$value."</a><br />";
}
$r_lblock_checkbox->addOptionArray($new_blocks_array);
// GET centerblocks
$new_blocks_array   = array();
$r_tcblock_checkbox = new XoopsFormCheckBox(_AM_BLOCKRIGHTS.":<br /><i>"._CENTER."</i>", "read_bids[]", $r_block_value);
$blocks_array       = XoopsBlock::getAllBlocks("list", XOOPS_CENTERBLOCK_ALL, 1, "weight", 1);
foreach ($blocks_array as $key=>$value) {
	$new_blocks_array[$key] = "<a href='".XOOPS_URL."/modules/system/admin.php?fct=blocksadmin&op=edit&bid=".$key."'>".$value."</a><br />";
}
$r_tcblock_checkbox->addOptionArray($new_blocks_array);
// GET rightblocks
$new_blocks_array  = array();
$r_rblock_checkbox = new XoopsFormCheckBox(_AM_BLOCKRIGHTS.":<br /><i>"._RIGHT."</i>", "read_bids[]", $r_block_value);
$blocks_array      = XoopsBlock::getAllBlocks("list", XOOPS_SIDEBLOCK_RIGHT, 1, "weight", 1);
foreach ($blocks_array as $key=>$value) {
	$new_blocks_array[$key] = "<a href='".XOOPS_URL."/modules/system/admin.php?fct=blocksadmin&op=edit&bid=".$key."'>".$value."</a><br />";
}
$r_rblock_checkbox->addOptionArray($new_blocks_array);
$op_hidden     = new XoopsFormHidden("op", $op_value);
$fct_hidden    = new XoopsFormHidden("fct", "groups");
$submit_button = new XoopsFormButton("", "groupsubmit", $submit_value, "submit");
$form = new XoopsThemeForm($form_title, "groupform", "admin.php");
$form->addElement($name_text);
$form->addElement($desc_text);
$form->addElement($a_mod_checkbox);
$form->addElement($r_mod_checkbox);
$form->addElement($r_lblock_checkbox);
$form->addElement($r_tcblock_checkbox);
$form->addElement($r_rblock_checkbox);
$form->addElement($op_hidden);
$form->addElement($fct_hidden);
if ( !empty($g_id_value) ) {
	$g_id_hidden = new XoopsFormHidden("g_id", $g_id_value);
	$form->addElement($g_id_hidden);
}
$form->addElement($submit_button);
$form->setRequired("name");
$form->display();
?>
