Location: PHPKode > projects > Epiware Document Management > Epiware_4.8.6/epi/project_user_group_delete.php
<?
/******************************************************************************
Epiware: Project and Document Management
http://www.epiware.com
Copyright (C) 2006 James Kern

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. 

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Epiware, Inc. and Praxis Inc, hereby disclaims all copyright
interest in the program 'Epiware' written
by James Kern, Edward Kline, Ryan Gilfether, Ray Gorospe, Patrick Waddingham

06 September 2006
James Kern, President of Epiware 
Jack Chapman, President of Praxis
*****************************************************************************/ 
require_once("./module_prepend.php");
include_once("./epi_misc_state_class.inc.php");
include_once("./epi_group_functions.inc.php");

$epi_translator->language_check(__FILE__,$db);

//make sure that the user is an admin of this project and check for if in demo
if(DEMO_MODE==1)
{
	$is_admin = $epi_translator->is_true_admin;//is_admin($user_id,&$db,$group_id,false);
}	 
//check to see if the user is a member of HR Administrators
$is_hr_admin = realm_user::is_member_of_system_realm($group_id,$user_id,HR_ADMIN_KEY_REALM,$db);

//begin the html output
$epi_html_helper->begin_html_page(&$priv,&$epi_translator);

//begin the body of the document




echo "
<div align=center >
";


if($enc_rid != "")
{
	$realm_id = $crypt->WEB_decrypt($enc_rid);
}

if((!($is_admin||$is_hr_admin))||(!$realm_id>0))
{
	/*echo "
	<script language=\"javascript\">
	window.close();
	</script>
	";*/

}//end of if user does not have permission to be here
else
{	

  	if($confirm_val != "")
	{
		$realm_id = $crypt->WEB_decrypt($enc_rid);
		$the_realm = new realms();
		$the_realm->get($realm_id,&$db);
		$cuid = $crypt->WEB_decrypt($confirm_val);
		if($cuid==$user_id && ($the_realm->key_realm != 1 || $the_realm->key_realm != 2) )
		{			
			$dr = $the_realm->delete(&$db);
						
		}//end of if we matched the encrypted user_id to the current user
		
		//reload parent page and close this window
			echo "
			<script language=\"javascript\">
			window.opener.location.href=window.opener.location.href;
			window.close();
			</script>
			";
	}//end of actually deleting
	else
	{
		$d_name = htmlentities($the_realm->realm_name);
		$btn_save = epi_translate("project_group_delete::yes",__FILE__,&$db,false,true,"ucwords");
		$btn_cancel = epi_translate("project_group_delete::no",__FILE__,&$db,false,true,"ucwords");
		$cancel = epi_translate("cancel",__FILE__,&$db,false,true,"ucwords");

		$enc_uid = $crypt->WEB_encrypt($user_id);
		$enc_rid = $crypt->WEB_encrypt($realm_id);

echo "<div id=\"page-content\" style=\"width:400px\">";

contentBubble::start("","","100%;");


		echo "
		<form name=\"data_entry\" action=\"./project_user_group_delete.php\" method=\"post\">
		<input type=\"hidden\" name=\"confirm_val\" value=\"$enc_uid\">
		<input type=\"hidden\" name=\"enc_rid\" value=\"$enc_rid\">
		";
		$menu_title = "<b class=\"medtitle\">".epi_translate("project_group_delete::title",__FILE__,$db)."</b>"; 
		$message = "<b><a href=\"javascript:window.close();\" class=\"menuonu\">$cancel</a></b> &nbsp;";
		// print_menu_title($menu_title,250,$message,110,385);
		echo "
		<table border=0  width=385 cellpadding=0 cellspacing=0>
			<tr>
			  	<td align=left valign=top>
				Are you sure that you want to delete the following project user group? Once it has been deleted, it cannot be recovered.<br><br>
				$d_name
				</td>
			</tr>
			<tr>
				<td align=center valign=top>



                <input type=button value=\"Yes, Delete Group\" onclick=\"javascript:document.data_entry.submit();\">
				&nbsp; &nbsp; &nbsp;
                <input type=button value=\"No, Do Not Delete Group\" onclick=\"window.close()\">

			 
				</td>
			</tr>
		</table>
		</form>
		";
	}//end of else we need to prompt for confirmation

}//end of else they do have permission to be here



//get the standard footer
print "<br>";

 

contentBubble::end("100%;");

echo "
</div>
";


echo "
</div>
";





echo "
</body>
</html>
";


require_once("./epi_append.php");
?>
Return current item: Epiware Document Management