"The Company Intranet", "header" => "The Company Intranet", "bottom" => "Copyright(R) 2005", "left_nav_links" => array(), "body_links" => array(), "col_headers" => array(), "data_rows" => array(), ); $admin = FALSE; $base_url = "CompanyHome.php"; $trail = "Home"; #24 if (!isset($_SESSION['user_name'])) header("Location: Login.php"); #27 else { if (isset($_SESSION['user_dept']) && isset($_GET['dept_id'])) { #32 $admin = $_SESSION['user_dept'] == $_GET['dept_id']; } $cxn = Connect_to_db("Vars.inc"); $left_nav_links = array(); $page["browse_level"] = #38 isset($_GET['browse_level']) ? $_GET['browse_level'] : "home"; switch ($page["browse_level"]) #42 { case "home": $sql = "SELECT name, dept_id, description FROM Department ORDER BY name"; $results = mysqli_query($cxn, $sql); $body_links = ""; while($row = mysqli_fetch_assoc($results)) #50 { $link = "$base_url?dept_id=" . $row['dept_id'] . "&browse_level=department"; $page["left_nav_links"][$link] = $row['name']; $body_links .= "
Vist the departments' " . "home pages: $body_links"; break; case "department": #70 $dept_id = $_GET['dept_id']; $sql = "SELECT name, dept_id, description FROM Department WHERE dept_id = $dept_id ORDER BY name"; $results = mysqli_query($cxn, $sql); $row = mysqli_fetch_assoc($results); $dept_name = $row['name']; $dept_desc= $row['description']; $page["left_nav"] = "$dept_name Content"; $page["body_text"] = "$dept_name - $dept_desc"; $sql = "SELECT a.name, a.type_id, count(b.content_id) FROM Content_Type a LEFT OUTER JOIN Content b on a.type_id = b.content_type and b.dept_id = $dept_id GROUP BY a.name, a.type_id ORDER BY name"; $results = mysqli_query($cxn, $sql); $body_links = ""; while($row = mysqli_fetch_assoc($results)) #92 { $link = "$base_url?dept_id=$dept_id" . "&type_id=" . $row['type_id'] . "&browse_level=content"; $page["left_nav_links"][$link] = $row['name']; $body_links .= "
Vist the departments' " . "areas: $body_links"; $trail .= " - $dept_name"; break; case "content": #110 $dept_id = $_GET['dept_id']; $type_id = $_GET['type_id']; $sql = "SELECT a.name, a.type_id, b.title, b.description, b.bid_date, b.create_date, b.created_by, b.last_upd_date, b.last_upd_by, c.name as dept_name, content_id FROM Content_Type a, Department c LEFT OUTER JOIN Content b on a.type_id = b.content_type and a.type_id = b.content_type and b.dept_id = $dept_id and b.content_type = $type_id WHERE c.dept_id = $dept_id ORDER BY bid_date DESC"; $results = mysqli_query($cxn, $sql); $body_links = ""; $content_count = 0; $page["body_text"] = ""; while($row = mysqli_fetch_assoc($results)) #132 { if (!isset($area_name) && $type_id == $row["type_id"]) { $area_name = $row["name"]; $dept_name = $row["dept_name"]; } $link = "$base_url?dept_id=$dept_id" . "&type_id=" . $row['type_id'] . "&browse_level=content"; $page["left_nav_links"][$link] = $row['name']; if (!isset($row["content_id"])) #144 continue; $content_id = $row["content_id"]; $content_count++; $link = "$base_url?dept_id=$dept_id" . "&type_id=$type_id&browse_level=content"; $page["left_nav_links"][$link] = $row['name']; $page["data_rows"][] = $row; } if ($content_count == 0) #156 { $page["body_text"] = "There are no $area_name content items for $dept_name"; } if ($admin) #161 { $page["body_text"] .= "
[add]"; } $page["col_headers"]["title"] = "$area_name Title"; $page["col_headers"]["bid_date"] = "$area_name Date"; $page["col_headers"]["create_date"] = "Created On"; $page["col_headers"]["created_by"] = "Created By"; $page["col_headers"]["last_upd_date"] = "Last Updated On"; $page["col_headers"]["last_upd_by"] = "Last Updated By"; $page["left_nav_header"] = "Content"; #176 $page["top"] = "$dept_name - $area_name"; $trail .= " - $dept_name"; $trail .= " - $area_name"; break; case "details": #185 $dept_id = $_GET['dept_id']; $type_id = $_GET['type_id']; $sql = "SELECT a.name as dept_name, b.name FROM Department a, Content_Type b WHERE b.type_id = $type_id and a.dept_id = $dept_id ORDER BY name"; $results = mysqli_query($cxn, $sql); $body_links = ""; $content_count = 0; while($row = mysqli_fetch_assoc($results)) #198 { $area_name = $row["name"]; $dept_name = $row["dept_name"]; if (!isset($row["content_id"])) #203 continue; $content_count++; $link = "$base_url?dept_id=$dept_id" . "&type_id=".$row['type_id'] . "&browse_level=content"; $page["left_nav_links"][$link] = $row['name']; $body_links .= "