<?
include ("../../../mainfile.php");
include_once(XOOPS_ROOT_PATH."/class/xoopsmodule.php");
include_once(XOOPS_ROOT_PATH."/include/cp_functions.php");
global $db, $_POST;
xoops_cp_header();
/*	if($xoopsUser)
	{
		$xoopsModule = XoopsModule::getByDirname("directory");
	
		if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) 
		{ 
			redirect_header(XOOPS_URL."/",3,_NOPERM);
			exit();
		}
	} 
	else
	{
		redirect_header(XOOPS_URL."/",3,_NOPERM);
		exit();
	}
*/
if ( @file_exists(XOOPS_ROOT_PATH."/modules/directory/language/".$bcoosConfig['language'].'/language.php') ) {
	include_once(XOOPS_ROOT_PATH."/modules/directory/language/".$bcoosConfig['language'].'/language.php');
	} else {
		include_once(XOOPS_ROOT_PATH."/modules/directory/language/english/language.php");
	}
include (XOOPS_ROOT_PATH."/modules/directory/dbkey.php");
include (XOOPS_ROOT_PATH."/modules/directory/queries.php");
include (XOOPS_ROOT_PATH."/modules/directory/functions.php");
include (XOOPS_ROOT_PATH."/modules/directory/head.admin.php");
if ($action == 'add') {
	add_dept($action,$department);
} elseif ($action == 'edit') {
	edit_dept($action,$serial);
} elseif ($action == 'del') {
	del_dept($action,$serial);
} elseif ($action == 'upd') {
	upd_dept($action,$serial,$deptartment);
} else {
	echo "<td class=bg3 valign=\"top\">";
	OpenTable();
  echo "<p>";
  echo _CODE_DIR_NEW_DEPT;
  echo ":</p>
		<form action=\"$adm_path/dept.php?action=add\" method=\"post\">
		<input type=\"text\" class=\"text\" name=\"department\" size=\"15\">
		<input type=\"image\" src=\"$img_path/button_add.gif\" border=\"0\" alt=\"Add department!\"></form>";
		echo _CODE_DIR_EDIT_DEPT;
		echo ": <br>";
		echo "<span class=TinyText><p>";
		echo _CODE_DIR_TXT_DEPT;
		echo "</p><form action=\"$adm_path/dept.php?action=edit\" method=\"post\"><select class=\"select\" name=\"serial\">";
	/* List departments in DB and build SELECT */
	$result_list = $db->query($select_dept_list);
	while ( $a_row = mysql_fetch_array( $result_list ))
		{
		 print "<option value=\"$a_row[serial]\">$a_row[department]</option>\n";
		}
	echo "</select>
		<input type=\"image\" src=\"$img_path/button_edit.gif\" border=\"0\" alt=\"Edit department!\">
		</form>";
		CloseTable();
    echo "</td>";
		
}
include	(XOOPS_ROOT_PATH."/modules/directory/footer.php");
xoops_cp_footer();
?>
