employee_actions.php

来自「这是一个用于资产管理的源码工具包」· PHP 代码 · 共 608 行 · 第 1/3 页

PHP
608
字号
<?/******************************************************************************	SimpleAssets - an online web based asset management application.*	Copyright (C) 2002 Jeff Gordon (jgordon81@users.sourceforge.net). All rights reserved.*	Public Works and Government Services Canada (PWGSC)*   Architecture and Standards Directorate**	Released July 2002**  	This program is free software licensed under the * 	GNU General Public License (GPL).**	This file is part of SimpleAssets.**	SimpleAssets 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.**	SimpleAssets 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 SimpleAssets; if not, write to the Free Software*	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*******************************************************************************/// contains functions:// employee_format($query_data, $color, $color_header, $class)// employee_summary()// employee_view($key)// employee_menu_header($domain, $section, $title, $key)// employee_tabs($empid)// employee_print_info($key)//prints out one employeefunction employee_format($query_data, $color, $color_header, $class) {	global $print_screen;	global $lastaction;	global $action;	global $key;	global $my_access_level;	global $my_emp_id;	global $emp_db;		// display start / end date, if it exists	if (($query_data["StartDate"] != "") && ($query_data["EndDate"] != "")) {		echo "<table width=100% bgcolor='" . $color_header . "' class='" . $class . "'>";		echo "<tr>";		echo "<td class='text12bold'>";		if ($query_data["StartDate"] == "0") $startdate_out = "From an unknown install date";		else $startdate_out = "From " . date("l, F d, Y", $query_data["StartDate"]);		if ($query_data["EndDate"] == "0") $enddate_out = "";		else $enddate_out = " to " . date("l, F d, Y", $query_data["EndDate"]);						$transfer_date_text = $startdate_out . $enddate_out;		// rules for determining if cancel and sign in buttons should be shown			if (((($my_access_level > 1) || ($my_emp_id == $query_data["Employees_ID"]))) && ($print_screen == false)) {			// user is an admin user or viewing their own profile			if ($query_data["StartDate"] > time()) {				// start date is after today				echo $transfer_date_text;				echo "&nbsp;&nbsp;<a href='" . $PHP_SELF . "?action=assettransfererase&key=" . $query_data["Assignments_ID"] . "&lastaction=" . $action ."&lastkey=" . html($key) . "'>(cancel)</a>&nbsp";			} else {				// start date is before or on today				if ($query_data["Temp"] == "1") {					// A signout is being performed					if ($query_data["Completed"] == "0") {						// asset not signed in						$day_now = date("d",time());						$month_now = date("m",time());						$year_now = date ("Y",time());						$new_time = mktime(0,0,0,$month_now,$day_now,$year_now);						$time_diff = ceil((($query_data["EndDate"]) - $new_time) / 86400);						$time_diff--;						if ($time_diff == 0) $due_text = "<font color='#ff6600'>due today</font>";						elseif ($time_diff == 1) $due_text = "due tommorow";						elseif ($time_diff == -1) $due_text = "<font color='#ff0033'>overdue by 1 day</font>";						elseif ($time_diff < 0) $due_text = "<font color='#ff0033'>overdue by " . abs($time_diff) . " days</font>";						else $due_text = "due in " . $time_diff . " days";						echo "<table width=100% cellspacing=0 cellpadding=0 border=0><tr>";						echo "<td class='text12bold'>";						echo $transfer_date_text . "&nbsp;&nbsp;<a href='" . $PHP_SELF . "?action=assettransfersignin&key=" . $query_data["Assignments_ID"] . "&lastaction=" . $action ."&lastkey=" . html($key) . "'>(sign in)</a>&nbsp";						if ($my_access_level > 1) echo "<a href='" . $PHP_SELF . "?action=assettransfererase&key=" . $query_data["Assignments_ID"] . "&lastaction=" . $action ."&lastkey=" . html($key) . "'>(erase)</a>&nbsp";						echo "</td>";						echo "<td class='text12bold' align=right>" . $due_text . "</td>";						echo "</tr></table>";					} else {						// asset signed in						echo $transfer_date_text;						if ($my_access_level > 1) echo "&nbsp;&nbsp;<a href='" . $PHP_SELF . "?action=assettransfererase&key=" . $query_data["Assignments_ID"] . "&lastaction=" . $action ."&lastkey=" . html($key) . "'>(cancel)</a>&nbsp";					}				} else {					// A transfer is occurring					echo $transfer_date_text;				}			}		} else {			echo $transfer_date_text;		}		echo "</td>";		echo "</tr>";		echo "</table>";	}			echo "<table width=100% bgcolor='" . $color . "' class='" . $class . "'><tr><td>";	echo "<table width=100%>";	echo "<tr>";	echo "<td class='text13bold'>";	// employee's name (or general assets/surplus)	// if not employeeview or not printscreen, use links	if ((strcmp($action,"employeeview") != 0) && ($print_screen == false)) {		switch($query_data["Employees_ID"]) {			case "0":				echo "<a href='" . $PHP_SELF . "?action=employeeview&key=" . $query_data["Employees_ID"] . "' class='text13bold'><b>General Assets</b></a></font><font class='text11'> &nbsp; </font>\n";				break;			case "-1":				echo "<a href='" . $PHP_SELF . "?action=employeeview&key=" . $query_data["Employees_ID"] . "' class='text13bold'><b>Surplus</b></a></font><font class='text11'> &nbsp; </font>\n";				break;			case "-2":				echo "<a href='" . $PHP_SELF . "?action=employeeview&key=" . $query_data["Employees_ID"] . "' class='text13bold'><b>Retired</b></a></font><font class='text11'> &nbsp; </font>\n";				break;			default:				echo "<a href='" . $PHP_SELF . "?action=employeeview&key=" . $query_data["Employees_ID"] . "'class='text13bold'><b>" . $query_data["LastName"] . ", " . $query_data["FirstName"];				if ($query_data["Active"] == 0) echo " (Inactive)";				echo "</b></a></font>\n";				break;		}	} else {		switch($query_data["Employees_ID"]) {			case "0":				echo "<font class='text13bold'><b>General Assets</b></font><font class='text11'> &nbsp; </font>\n";				break;			case "-1":				echo "<font class='text13bold'><b>Surplus</b></font><font class='text11'> &nbsp; </font>\n";				break;			case "-2":				echo "<font class='text13bold'><b>Retired</b></font><font class='text11'> &nbsp; </font>\n";				break;			default:				echo "<font class='text13bold'><b>";				echo $query_data["LastName"] . ", " . $query_data["FirstName"];				if ($query_data["Active"] == 0) echo " (Inactive)";				echo "</b></font>\n";				break;		}	}		echo "</td>";	echo "<td align=right class='text11bold'>";	//org and dept	$orgdept = "";	if ($query_data["Employees_ID"] > 0) {		$orgdept = $query_data["Organization"];		if ((strlen($query_data["Dept"]) > 0) && (strlen($query_data["Organization"]) > 0)) $orgdept = $orgdept . ", ";		$orgdept = $orgdept . $query_data["Dept"] . "<br>";	}	if (strlen($orgdept) > 1) echo $orgdept;	else echo "&nbsp;";	echo "</td>";	echo "</tr>";	echo "<tr>";	echo "<td class='text12'>";	// login	if ($my_access_level > 1) echo "<font class='text12'>" . $query_data["LoginName"] .  "</font> &nbsp;";	echo "</td>";	echo "<td align=right class='text11' valign='top'>";	// telephone number	if (strlen($query_data["Tel"]) > 1) $print_tel = $query_data["Tel"];	// email	if ($query_data["EMail"] != "") $print_email = "<a href='mailto:" . $query_data["EMail"] . "'><b>email</b></a>";		// location	$print_location = $query_data["Building"] . " " . $query_data["Floor"];	if ($query_data["Workstation"] != "") $print_location = $print_location . "-" . $query_data["Workstation"];	// print out above three	if (strlen($print_tel) > 2) echo $print_tel;	if ((strlen($print_tel) > 2) && (strlen($print_email) > 2)) echo "<font class='text13'>&nbsp;&middot;&nbsp;</font>";	if (strlen($print_email) > 2) echo $print_email;	if ((strlen($print_email) > 2) && (strlen($print_location) > 2)) echo "<font class='text13'>&nbsp;&middot;&nbsp;</font>";	if (strlen($print_location) > 2) echo $print_location;	echo "</td>";	echo "</tr>";	echo "</table>";	echo "</td></tr></table>";}// List all employees (employee summary)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?