File: /home/awaldron/public_html/archive/demo/profile.php
<?php
session_start();
include("_functions.php");
echo dbconnect();
$sql = "SELECT * FROM tbl_employees, tbl_group_user, tbl_groups, tbl_emp_types ";
$sql .= "WHERE tbl_employees.username='".$_GET["u"]."' AND tbl_employees.emp_type_id=tbl_emp_types.emp_type_id ";
$sql .= "AND tbl_group_user.username='".$_GET["u"]."' AND tbl_group_user.group_id=tbl_groups.group_id";
$result = mysql_query($sql);
$u = mysql_fetch_array($result);
if (zero($u["is_employee"])) {
$page_title = "Employee Profile";
$GLOBALS["ext_page"] = $page_title; // SET FAUX PAGE NAME
$_GET["p"] = 3; // SET FAUX PARENT ID
$lnav_mods = get_layout($_GET["p"],1);
$rnav_mods = get_layout($_GET["p"],3);
include("_pagestart.php");
echo "<P><div class=\"headline\">Employee Profile</div>";
echo "<br><br><br><br><center>".error("This user is no longer an employee.")."</center><br><br><br><br><br><br>\n";
} else {
$page_title = "Employee Profile: ".$u["fname"]." ".$u["lname"];
$GLOBALS["ext_page"] = $page_title; // SET FAUX PAGE NAME
$_GET["p"] = 3; // SET FAUX PARENT ID
$lnav_mods = get_layout($_GET["p"],1);
$rnav_mods = get_layout($_GET["p"],3);
include("_pagestart.php");
if (!MOBILE) echo "<P><div class=\"headline\">Employee Profile</div>";
$profile_admin = in_array($_SESSION["auth_user"],build_pgroup(4));
if ($profile_admin) $edit_btn = "<a href=\"/admin/employee_edit.php?u=".$_GET["u"]."\" target=\"edit_profile\"><img src=\"gui/edit.gif\" border=0 alt=\"Edit Profile\"></a> <a href=\"#\" onClick=\"openWindow('content_stats.php?self=".self()."&title=".str_replace("&","and",$page_title)."','','resizable=yes,width=350,height=235')\"><img src=\"/gui/stats.gif\" border=0 alt=\"View Page Statistics\"></a>";
else if (authorize($u["username"])) $edit_btn = "<a href=\"profile_edit.php?u=".$_GET["u"]."\"><img src=\"gui/edit.gif\" border=0 alt=\"Edit Profile\"></a> <a href=\"#\" onClick=\"openWindow('content_stats.php?self=".self()."&title=".str_replace("&","and",$page_title)."','','resizable=yes,width=350,height=235')\"><img src=\"/gui/stats.gif\" border=0 alt=\"View Page Statistics\"></a>";
else $edit_btn = 0;
$photo = "gui/photos/".$u["username"].".jpg";
if (!file_exists($photo)) $photo = "gui/photos/nophoto.jpg";
if ($u["emp_type_id"] == 1) $emptype = "Employee";
if ($u["emp_type_id"] == 2) $emptype = "Employee (PT)";
if ($u["emp_type_id"] == 3) $emptype = "Intern";
if ($u["emp_type_id"] == 4) $emptype = "Contractor";
if ($u["emp_type_id"] == 5) $emptype = "Temp";
if ($u["emp_type_id"] == 6) $emptype = "Consultant";
if ($u["emp_type_id"] == 7) $emptype = "Associate";
echo "<table border=0 width=\"100%\" cellspacing=15 class=\"mainbody\">\n";
echo "<tr><td width=10% align=\"right\" valign=\"top\"><img src=\"/".$photo."\" border=1>";
if (($edit_btn !== 0) && (!MOBILE)) {
if (PHOTO_UPLOAD == "1") echo "<br><center><a href=\"#\" onClick=\"openWindow('/upload/index.php?a=photo','','resizable=yes,width=500,height=300')\">Have a Better Photo?</a></center></td>\n";
//else echo "<br><center><a href=\"mailto:awaldron@vocollect.com?subject=New Photo for ".get_user($u["username"],"fullname")."\">Have a Better Photo?</a></center></td>\n";
}
if (MOBILE) echo "</tr><tr>\n";
echo "<td valign=\"top\">\n";
echo "<span id=\"headline\">".$u["fname"]." ".$u["lname"]."</span>\n";
if (!(($u["title"]=="0") || ($u["title"]==""))) echo "<br><span class=\"subhead\">".$u["title"]."</span>\n";
if ($u["group_id"]!=0) echo "<br><span class=\"subhead\">".$u["group_name"]."</span>\n";
echo "<P><table width=100%>\n";
echo "<tr><td width=10% colspan=2 id=\"vred\"><b>".CMP_NAME_INF." ".$emptype." since ".($u["start_date"]=="0"?"Unknown":date("F j, Y",$u["start_date"]))."</b></td></tr>\n";
echo "<tr><td width=10% colspan=2> </td></tr>\n";
echo "<tr><td width=10%><b>Direct Phone: </b></td><td>".(strlen($u["ph_direct"])<2?"N/A":$u["ph_direct"])."</td></tr>\n";
if (strlen($u["ph_remote_office"]) > 2) echo "<tr><td><b>Remote Office: </b></td><td>".($u["ph_remote_office"]=="0"?"N/A":$u["ph_remote_office"])."</td></tr>\n";
if (strlen($u["ph_remote_fax"]) > 2) echo "<tr><td><b>Remote Fax: </b></td><td>".($u["ph_remote_fax"]=="0"?"N/A":$u["ph_remote_fax"])."</td></tr>\n";
if (strlen($u["ph_cell"]) > 2) echo "<tr><td><b>Mobile Phone: </b></td><td>".$u["ph_cell"]."</td></tr>\n";
if (strlen($u["ph_home"]) > 2) echo "<tr><td><b>Home Phone: </b></td><td>".$u["ph_home"]."</td></tr>\n";
if (strlen($u["blackberry"]) > 2) echo "<tr><td><b>Blackberry PIN: </b></td><td>".$u["blackberry"]."</td></tr>\n";
echo "<tr><td><b>Email: </b></td><td><a href=\"mailto:".$u["email"]."\">".$u["email"]."</a></td></tr>\n";
echo "<tr><td colspan=4> </td></tr>\n";
echo "<tr><td><b>Manager: </b></td><td>".($u["manager"]=="0"||$u["manager"]==""?"N/A":"<a href=\"profile.php?u=".$u["manager"]."\">".get_user($u["manager"],"fullname")."</a>")."</td></tr>\n";
echo "<tr><td valign=\"top\"><b>Direct Reports: </b></td><td>";
$drsql = "SELECT username,fname,lname FROM tbl_employees WHERE is_employee=1 AND acct_confirmed=1 AND manager='".$_GET["u"]."' AND emp_type_id<4";
$drres = mysql_query($drsql);
if (mysql_num_rows($drres) > 0) {
for ($i=0; $i < mysql_num_rows($drres); $i++) {
$drep = mysql_fetch_array($drres);
if ($i != 0) echo ", ";
echo "<a href=\"/profile.php?u=".$drep["username"]."\">".substr($drep["fname"],0,1).". ".$drep["lname"]."</a>";
}
} else {
echo "N/A";
}
echo "</td></tr>\n";
echo "<tr><td><b>Location: </b></td><td>".($u["location"]=="0"?"":$u["location"])."</td></tr>\n";
echo "<tr><td><b>Room/Cubicle: </b></td><td>".($u["room_num"]=="0"?"":$u["room_num"])."</td></tr>\n";
echo "</table>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br><br>\n";
if ($u["my_job"] != "") {
echo "<P><div id=\"pheader\">What I do at ".CMP_NAME_INF.":</div>\n";
echo "<div id=\"para\">".format_body(stripslashes($u["my_job"]))."</div>\n";
}
if ($u["my_career"] != "") {
echo "<P><div id=\"pheader\">Career Highlights:</div>\n";
echo "<div id=\"para\">".format_body(stripslashes($u["my_career"]))."</div>\n";
}
if ($u["my_family"] != "") {
echo "<P><div id=\"pheader\">A little about my family:</div>\n";
echo "<div id=\"para\">".format_body(stripslashes($u["my_family"]))."</div>\n";
}
if ($u["my_interests"] != "") {
echo "<P><div id=\"pheader\">My Interests:</div>\n";
echo "<div id=\"para\">".format_body(stripslashes($u["my_interests"]))."</div>\n";
}
if (!MOBILE) {
if ($profile_admin) echo "<center><input type=\"button\" class=\"btn\" value=\" Edit This Profile \" onClick=\"location.href='/admin/employee_edit.php?u=".$_GET["u"]."'\"></center>\n";
else if (authorize($u["username"])) echo "<center><input type=\"button\" class=\"btn\" value=\" Edit Your Profile \" onClick=\"location.href='profile_edit.php?u=".$_GET["u"]."'\"></center>\n";
}
echo "<br><br><div class=\"pagefoot\">Profile Last Updated on <b>".date("F j, Y",$u["last_updated"])."</b></div>\n";
}
include("_pageend.php");
?>