File: /home/awaldron/www/archive/demo/functions/_modules.php
<?php
function mod_actions($pt) {
if (isset($_GET["p"]) && authorize(get_owners($_GET["p"]))) {
$subs = quickSQL("SELECT COUNT(page_id) FROM tbl_pages WHERE parent_id=".$_GET["p"]);
echo "<br><center> ";
echo "<a href=\"/content_add.php?p=".$_GET["p"]."\"><img src=\"/gui/tadd.gif\" border=0 alt=\"Add a Sub-Page to ".$pt."\"></a> ";
echo "<a href=\"/content_edit.php?p=".$_GET["p"]."\"><img src=\"/gui/tedit.gif\" border=0 alt=\"Edit This Page\"></a> ";
if ($subs > 0) echo "<a href=\"/rank.php?p=".$_GET["p"]."\"><img src=\"/gui/trank.gif\" border=0 alt=\"Rank Left Navigation Links\"></a> ";
echo "<a href=\"#\" onClick=\"openWindow('content_stats.php?self=".self()."&title=".str_replace("'","\'",str_replace("&","and",$pt))."','','resizable=yes,width=350,height=235')\"><img src=\"/gui/tstats.gif\" border=0 alt=\"View Page Statistics\"></a> ";
if (is_admin()) echo "<a href=\"/admin\" class=\"small\"><img src=\"/gui/tadmin.gif\" border=0 alt=\"Administration Panel\"></a> \n";
echo "</center>\n";
}
}
function mod_birthdays() {
$sql = "SELECT fname,lname,username FROM tbl_employees WHERE emp_type_id<4 AND is_employee=1 AND acct_confirmed=1 AND birthday='".date("md")."'";
$res = mysql_query($sql);
if (mysql_num_rows($res) > 0) {
echo "<div id=\"heading\">Happy Birthday!</div>";
echo "<div id=\"box\">\n";
while ($row = mysql_fetch_array($res)) {
echo "<li> <a href=\"/profile.php?u=".$row["username"]."\">".$row["fname"]." ".$row["lname"]."</a>\n";
}
echo "</div>\n";
}
}
function mod_core_values() {
echo "<div id=\"heading\">Vision & Core Values of ".CMP_NAME_INF."</div>\n";
echo "<div id=\"box\">\n";
echo "<div> <b>Applying Voice to Improve Work</b></div>\n";
echo "<ul style=\"font-size:11px;line-height:normal;\">\n";
echo " <li> We create an opportunity for each of us to excel and grow in a fun and rewarding environment\n";
echo " <li> We insist on functioning with the utmost integrity in all situations\n";
echo " <li> We foster an open, team-oriented and friendly working environment\n";
echo " <li> We value individual initiative to meet challenges with creativity and intelligence\n";
echo " <li> We apply the best technology and practices to create industry leading solutions for our customers and to improve business operations\n";
echo " <li> We commit to a balance of our personal and professional lives\n";
echo "</ul>\n";
echo "<P style=\"font-size:11px;line-height:normal;\"><center><a href=\"/content.php?p=459\" >Core Values Recognition Program</a> | <a href=\"/files/corporate/vocollect.pdf\" target=\"new\">Core Values Poster</a>\n";
echo "</div>\n";
}
function mod_coursereg() {
$sql = "SELECT * FROM tbl_event WHERE event_id IN(".event_in().") ORDER BY event_title ASC";
$res = mysql_query($sql);
echo "<div id=\"heading\"><div style=\"float:right\"><a href=\"/event_new.php\"><img src=\"/gui/icons/sm_add.gif\" border=0 style=\"margin:2px 4px 0px 0px;\"></a></div>Events & Education Registration</div>";
echo "<div id=\"box\">\n";
echo "<table border=0 cellspacing=5 cellpadding=0 class=\"textdn\">\n";
if (mysql_num_rows($res) < 1) echo "<tr><td><img src=\"/gui/bullet.gif\"></td><td>No events are currently scheduled for registration.</td></tr>\n";
else while ($row = mysql_fetch_array($res)) {
echo "<tr><td><img src=\"/gui/bullet.gif\"></td><td><a href=\"/eventreg_".$row["event_type"].".php?id=".$row["event_id"]."\" class=\"notice\">".$row["event_title"]."</a></td></tr>\n";
}
echo "</table></div>\n";
}
function mod_popular_pages() {
$in = file("/home/intranet/functions/_top10.php");
$last_updated = (int)trim(substr($in[0],8));
if (time() > ($last_updated + 86400)) {
$start = date_unixtots(date_tstounix(now())-1209600);
$sql = "SELECT COUNT(log_page) AS hits, log_title, log_page FROM tbl_userlog WHERE ";
$sql .= "log_stamp >= '".$start."' ";
$sql .= "AND log_name <> 'falcon1' ";
$sql .= "AND log_page LIKE '%content.php%' ";
$sql .= "AND log_page NOT LIKE '%content.php?p=1%' ";
$sql .= "AND log_page NOT LIKE '%content.php?p=284%' ";
$sql .= "AND log_page NOT LIKE '%content.php?p=68%' ";
$sql .= "OR log_page LIKE '%vocollect_store.php%' ";
$sql .= "OR log_page LIKE '%guidebook/%' ";
$sql .= "GROUP BY log_page ORDER BY hits DESC LIMIT 0,12";
$res = mysql_query($sql);
for ($i=0; $i < mysql_num_rows($res); $i++) {
$row = mysql_fetch_array($res);
$top10[$i]["path"] = $row["log_page"];
$top10[$i]["title"] = $row["log_title"];
}
update_top10($top10);
}
if (!MOBILE) {
echo "<div style=\"width:100%;margin:5px;\">\n";
echo "<table border=0 width=200 cellspacing=0 cellpadding=0>\n";
echo "<tr style=\"background:url(/gui/left_nav_top.gif);\"><td height=10 colspan=2><img src=\"/gui/clear.gif\" width=1 height=6></td></tr>\n";
echo "<tr bgcolor=\"#FFFFFF\"><td height=1 colspan=2><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
echo "<tr bgcolor=\"#5C6C92\"><td height=20 valign=\"middle\"> <a href=\"/content.php?p=1\"><img src=\"/gui/page_up.gif\" border=0></a> </td><td><a href=\"/content.php?p=1\" class=\"leftnav-w\">Intranet Home</a></td></tr>\n";
echo "<tr bgcolor=\"#FFFFFF\"><td height=1 colspan=2><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
echo "<tr bgcolor=\"#9D1C29\"><td height=20 valign=\"middle\"> <img src=\"/gui/page_this.gif\" border=0 style=\"margin-top:3px\"></a> </td><td><span class=\"leftnav-w\"><b>Most Requested Pages</b></span></td></tr>\n";
echo "<tr bgcolor=\"#FFFFFF\"><td height=1 colspan=2><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
} else {
echo "<P><b>Most Requested Pages</b>\n";
echo "<br><table border=0 cellspacing=0 cellpadding=0>\n";
}
include("/home/intranet/functions/_top10.php");
if (!MOBILE) echo "<tr style=\"background:url(/gui/left_nav_bot.gif);\"><td height=10 colspan=2><img src=\"/gui/clear.gif\" width=1 height=6></td></tr>\n";
echo "</table>\n";
}
function mod_addpage() {
if (isset($_GET["p"]) && authorize(get_owners($_GET["p"])) && (!isset($GLOBALS["leftnav"]))) {
$sql = "SELECT * FROM tbl_pages WHERE parent_id=".$_GET["p"]." AND page_active=1 AND gbtab_id=0";
$result = mysql_query($sql);
if (mysql_num_rows($result) == 0) {
echo "<center><a href=\"/content_add.php?p=".$_GET["p"]."\" class=\"small\">Add A Sub-Page</a></center>\n";
}
}
}
function mod_addthread() {
$isdisc = quickSQL("SELECT tbl_notice_types.notice_type_discuss FROM tbl_notice_types, tbl_notices WHERE tbl_notices.notice_id=".$_GET["nid"]." AND tbl_notices.notice_type_id=tbl_notice_types.notice_type_id");
$comm = quickSQL("SELECT COUNT(thread_id) AS comments FROM tbl_threads WHERE thread_active=1 AND notice_id=".$_GET["nid"]);
if ($isdisc) {
echo "<P><div id=\"heading\">Comment on this Notice</div>\n";
echo "<div id=\"box\"><center>\n";
echo "<table border=0 cellspacing=0 class=\"textdn\"><tr>\n";
echo "<td width=72><a href=\"/thread_add.php?nid=".$_GET["nid"].(isset($_GET["sf"])?"&sf=1":"")."\"><img src=\"/gui/comment.gif\" border=0 style=\"margin-right:6px;\"></a></td>\n";
echo "<td align=\"center\" valign=\"middle\">This thread has<br><b>".$comm."</b> comment".($comm==1?"":"s")."</td></tr>\n";
echo "</table></center></div>\n";
}
}
function mod_buzzword() {
//echo boxhead("Keywords",0);
//echo "<center>\n";
//echo "<table border=0 cellspacing=2 width=90%>\n";
//echo "<form action=\"/buzzwords.php\" method=\"get\" name=\"buzzwords\">\n";
//if (isset($_GET["err"]) && ($_GET["err"]=="bz")) {
// echo "<tr><td colspan=2 valign=\"middle\">".error("Keyword does not exist.")."</td></tr>\n";
//}
//echo "<tr><td valign=\"middle\">Enter Keyword:</td></tr>\n";
//echo "<tr><td><center><input type=\"text\" style=\"width:100%\" name=\"buzz\"></td>\n";
//echo "<td align=\"right\"><input type=\"submit\" value=\"Go\"></td></form>\n";
//echo "<tr><td colspan=2 align=center><a href=\"/buzzwords.php?a=list\">View Keyword List</a></td></tr>\n";
//echo "</table>\n";
//echo "</center>\n";
//echo boxfoot();
}
function mod_calendar($cid=1) {
$key = "<table border=0 cellspacing=0 cellpadding=0 style=\"font-size:9px\">\n";
$key .= "<tr><td width=5 style=\"background:url(/gui/cal_tab.gif) no-repeat top right\"><img src=\"/gui/clear.gif\" width=5 height=5></td>\n";
$key .= " <td> Birthday </td>\n";
$key .= " <td bgcolor=\"#FFDA6A\"> </td><td> Event </td>\n";
$key .= " <td bgcolor=\"#FFA66A\"> </td><td> Holiday</td>\n";
$key .= "</tr>\n";
$key .= "<tr><td colspan=6 height=4><img src=\"/gui/clear.gif\" width=3 height=3></td></tr>\n";
$key .= "</table>\n";
//echo "<div id=\"heading\">Company Calendar</div>";
$month = array("","January","February","March","April","May","June","July","August","September","October","November","December");
if ($cid != 1) {
$show_bdays = quickSQL("SELECT display_bday FROM tbl_calendars WHERE calendar_id=".$cid);
$include_corp = quickSQL("SELECT include_corp FROM tbl_calendars WHERE calendar_id=".$cid);
} else {
$show_bdays = 1;
$include_corp = 0;
}
if (isset($_GET["month"])) $mon = $_GET["month"];
else $mon = (int)date("n");
$mon_next = ($mon==12?1:($mon+1));
$mon_prev = ($mon==1?12:($mon-1));
if (isset($_GET["year"])) $year = $_GET["year"];
else $year = date("Y");
$year_next = ($mon==12?($year+1):$year);
$year_prev = ($mon==1?($year-1):$year);
$first = $year.(strlen($mon)==1?"0".$mon:$mon)."01"; //(int)(date("Ym")."01");
$last = $year.(strlen($mon)==1?"0".$mon:$mon)."31";;
$data = getdate(mktime(0,0,1,$mon,1,$year));
if (($cid != 1) && ($include_corp == 1)) $sql = "SELECT * FROM tbl_calendar_dates WHERE (calendar_id=".$cid." OR calendar_id=1) AND (cal_date >= ".$first.") AND (cal_date <= ".$last.")";
else $sql = "SELECT * FROM tbl_calendar_dates WHERE calendar_id=".$cid." AND (cal_date >= ".$first.") AND (cal_date <= ".$last.")";
$result = mysql_query($sql);
$dbdata = array(0);
for ($k=0; $k < mysql_num_rows($result); $k++) {
$row = mysql_fetch_array($result);
$sub = substr($row["cal_date"],6,2);
if (substr($sub,0,1)=="0") $sub = substr($sub,1,1);
$sub = (int)$sub;
$dbdata[$sub] = $row["cal_type"];
}
$ctr=0;
$self = self();
if (strstr($self,"&month=")) {
$self = substr($self,0,strpos($self,"&month="));
} else if (strstr($self,"?month=")) {
$self = substr($self,0,strpos($self,"?month="));
}
$self .= (strstr($self,"?")!==FALSE?"&":"?");
$display = "<a href=\"#\" onClick=\"document.prevmon.submit();\"><img src=\"/gui/cal_prev.gif\" border=0></a> ";
$display .= "<span class=\"leftnav-w\">".$month[$mon]." ".$year."</span>\n";
$display .= " <a href=\"#\" onClick=\"document.nextmon.submit();\"><img src=\"/gui/cal_next.gif\" border=0></a>";
echo "<center><P><table border=0 cellspacing=1 cellpadding=0 class=\"calendar\">\n";
echo "<form name=\"prevmon\" method=\"get\" action=\"/content.php\">".input_hidden("p","1").input_hidden("month",$mon_prev).input_hidden("year",$year_prev)."</form>\n";
echo "<form name=\"nextmon\" method=\"get\" action=\"/content.php\">".input_hidden("p","1").input_hidden("month",$mon_next).input_hidden("year",$year_next)."</form>\n";
echo "<tr><td background=\"/gui/cal_head_bg.gif\" height=18 colspan=7 align=center valign=\"middle\">".$display."</td></tr>\n";
echo "<tr><td class=\"cal_head\" height=9 colspan=7 align=center valign=\"middle\"><img src=\"/gui/cal_head.gif\"></td></tr>\n";
echo "<tr>";
for ($i=0; $i < $data["wday"]; $i++) {
echo "<td width=24 height=18 bgcolor=\"#EEEEEE\"> </td>\n";
$ctr++;
}
for ($j=1; checkdate($mon,$j,$year); $j++) {
if ($show_bdays == 1) {
$bsql = "SELECT eid FROM tbl_employees WHERE acct_confirmed=1 AND is_employee=1 AND emp_type_id<4 AND birthday='".((int)$mon<10?"0".$mon:$mon).($j<10?"0".$j:$j)."'";
$bres = mysql_query($bsql);
if (mysql_num_rows($bres) > 0) $bday_tab = "background=\"/gui/cal_tab.gif\" ";
else $bday_tab = "";
} else $bday_tab = "";
if ($dbdata[$j]==1) echo "<td width=24 height=18 bgcolor=\"#FFDA6A\" ".$bday_tab."align=\"center\" valign=\"middle\" onClick=\"openWindow('/event_view.php?d=".$year.($mon<10?"0".$mon:$mon).($j<10?"0".$j:$j)."&cid=".$cid."','','resizable=yes,width=350,height=235')\" class=\"calendar\"><a href=\"#\" class=\"calendar\">".$j."</a></td>\n";
else if ($dbdata[$j]==2) echo "<td width=24 height=18 bgcolor=\"#FFA66A\" ".$bday_tab."align=\"center\" valign=\"middle\" onClick=\"openWindow('/event_view.php?d=".$year.($mon<10?"0".$mon:$mon).($j<10?"0".$j:$j)."&cid=".$cid."','','resizable=yes,width=350,height=235')\" class=\"calendar\"><a href=\"#\" class=\"calendar\">".$j."</a></td>\n";
else if ($bday_tab != "") echo "<td width=24 height=18 bgcolor=\"".((($j==date("j"))&&($mon==date("n"))&&($year==date("Y")))?"FFFFFF":"DEDEDE")."\" ".$bday_tab."align=\"center\" valign=\"middle\" onClick=\"openWindow('/event_view.php?d=".$year.($mon<10?"0".$mon:$mon).($j<10?"0".$j:$j)."&cid=".$cid."','','resizable=yes,width=350,height=235')\" class=\"calendar\"><a href=\"#\" class=\"calendar\">".$j."</a></td>\n";
else echo "<td width=24 height=18 bgcolor=\"".((($j==date("j"))&&($mon==date("n"))&&($year==date("Y")))?"FFFFFF":"DEDEDE")."\" ".$bday_tab."align=\"center\" valign=\"middle\" onClick=\"openWindow('/event_add.php?d=".$year.($mon<10?"0".$mon:$mon).($j<10?"0".$j:$j)."&cid=".$cid."','','resizable=yes,width=350,height=235')\" class=\"calendar\"><a href=\"#\" class=\"calendar\">".$j."</a></td>\n";
$ctr++;
if ((!checkdate($mon,($j+1),$year)) && ($ctr == 7)) echo "</tr>\n";
else if ($ctr == 7) { echo "</tr><tr>\n"; $ctr=0; }
}
if ($ctr != 0) {
while ($ctr < 7) { echo "<td width=24 height=18 bgcolor=\"#EEEEEE\"> </td>\n"; $ctr++; }
echo "</tr>";
}
echo "</table>\n";
echo "<table border=0 cellspacing=0 cellpadding=0 style=\"font-size:9px;margin-top:3px;\">\n";
echo "<tr><td width=5 style=\"background:url(/gui/cal_tab.gif) no-repeat top right\"><img src=\"/gui/clear.gif\" width=5 height=5></td>\n";
if ($show_bdays == 1) echo " <td> Birthday </td>\n";
echo " <td bgcolor=\"#FFDA6A\"> </td><td> Event </td>\n";
echo " <td bgcolor=\"#FFA66A\"> </td><td> Holiday</td>\n";
echo "</tr>\n";
echo "<tr><td colspan=6 height=10><img src=\"/gui/clear.gif\" width=3 height=10></td></tr>\n";
echo "</table>\n";
echo "</center>\n";
}
function mod_company_calendar() {
$this_year = $next_year = $prev_year = (int)date("Y");
$this_month = (int)date("n");
$next_month = (int)date("n") + 1;
$prev_month = (int)date("n") - 1;
if ($next_month == 13) { $next_month = 1; $next_year++; }
if ($prev_month == 0) { $prev_month = 12; $next_year--; }
echo "<div id=\"heading\"><div style=\"float:right;\">".$key."</div>".CMP_NAME_INF." Company Calendar</div>";
echo "<center><table border=0 cellspacing=0 cellpadding=0><tr>\n";
//$_GET["month"] = $prev_month;
//$_GET["year"] = $prev_year;
//echo "<td valign=\"top\">"; mod_calendar(); echo "</td>";
//echo "<td width=12><img src=\"/gui/clear.gif\" width=10 height=1></td>\n";
$_GET["month"] = $this_month;
$_GET["year"] = $this_year;
echo "<td valign=\"top\">"; mod_calendar(); echo "</td>";
echo "<td width=12><img src=\"/gui/clear.gif\" width=10 height=1></td>\n";
$_GET["month"] = $next_month;
$_GET["year"] = $next_year;
echo "<td valign=\"top\">"; mod_calendar(); echo "</td>";
echo "</tr></table></center>\n";
}
function mod_contacts() {
if (is_logged()) {
echo "<div id=\"boxhead\">Common Contacts</div>\n";
echo "<div id=\"box\">\n";
echo "<table width=\"100%\" cellpadding=0 cellspacing=4>\n";
echo "<tr><td><a href=\"\">Mike Bennett</a></td><td>x2542</td></tr>\n";
echo "<tr><td><a href=\"\">Ryan Brown</a></td><td>x2567</td></tr>\n";
echo "<tr><td><a href=\"\">Matt Crognale</a></td><td>x2569</td></tr>\n";
echo "<tr><td><a href=\"\">Bill Geppert</a></td><td>x2459</td></tr>\n";
echo "<tr><td><a href=\"\">Tom Malley</a></td><td>x2510</td></tr>\n";
echo "<tr><td><a href=\"\">Matt Moritz</a></td><td>x2538</td></tr>\n";
echo "<tr><td><a href=\"\">Debbie Olah</a></td><td>x2427</td></tr>\n";
echo "<tr><td><a href=\"\">Mark Rigby</a></td><td>x2572</td></tr>\n";
echo "<tr><td><a href=\"\">Jason Rosenbaum</a></td><td>x2477</td></tr>\n";
echo "</table>\n";
echo "</div>\n";
}
}
function mod_empdir() {
$out = "<table border=0 width=200 cellspacing=0 cellpadding=0>\n";
$out .= "<tr style=\"background:url(/gui/left_nav_top.gif);\"><td height=10 colspan=3><img src=\"/gui/clear.gif\" width=1 height=6></td></tr>\n";
//$out .= "<tr bgcolor=\"#FFFFFF\"><td height=1><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
$out .= "<tr><td bgcolor=\"#CCCCCC\" width=1><img src=\"/gui/clear.gif\" width=1 height=1></td>\n";
$out .= "<td bgcolor=\"#F0F0F0\"><center>\n";
$out .= "<table border=0 cellspacing=2 width=90% class=\"textdn\">\n";
$out .= "<form action=\"/directory.php\" method=\"get\" name=\"directory\">\n";
$out .= "<tr><td colspan=2 valign=\"middle\">Find Employees:</td></tr>\n";
$out .= "<tr><td colspan=2><center><input type=\"text\" style=\"width:100%\" name=\"e\" value=\"".$_POST["e"]."\"></td></tr>\n";
$out .= "<tr><td align=\"right\"><input type=\"submit\" value=\"Search\"> </td></form>\n";
$out .= "<form action=\"/directory.php\" method=\"get\">\n";
$out .= "<td> <input type=\"hidden\" name=\"tab\" value=\"all\"><input type=\"submit\" value=\"Browse All\"></td></form>\n";
$out .= "</tr></table></center></td><td bgcolor=\"#CCCCCC\" width=1><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
$out .= "<tr bgcolor=\"#CCCCCC\"><td height=1 colspan=3><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
$out .= "</table><P>\n";
echo $out;
}
function mod_empweek() {
if (now() >= FEAT_EMP_NXT) feat_emp_update();
$sql = "SELECT username,fname,lname,title FROM tbl_employees WHERE username='".FEAT_EMP."'";
$result = mysql_query($sql);
$e = mysql_fetch_array($result);
echo "<div id=\"heading\">Feature Employee</div>";
echo "<div id=\"box\">\n";
echo "<table border=0 width=95% class=\"textdn\"><tr><td><a href=\"/profile.php?u=".$e["username"]."\"><img src=\"/image.php?u=".$e["username"]."&s=1\" align=\"left\" border=0></a></td>\n";
echo "<td><b>".$e["fname"]." ".$e["lname"]."</b>\n";
echo "<br>".$e["title"]."\n";
echo "<P><center><a href=\"/profile.php?u=".$e["username"]."\">Profile ></a></td></tr></table></center>\n";
echo "</div>\n";
}
function mod_google_big() {
echo boxhead("Search Google",0);
echo "<center>\n";
echo "<FORM method=GET action=\"http://www.google.com/search\">\n";
echo "<input type=hidden name=ie value=UTF-8><input type=hidden name=oe value=UTF-8>\n";
echo "<A HREF=\"http://www.google.com/\"><IMG SRC=\"/gui/google.gif\" border=\"0\" ALT=\"Google\" align=\"absmiddle\"></A>\n";
echo "<br><INPUT TYPE=text name=q style=\"width:90%\" maxlength=255 value=\"\">\n";
echo "<br><INPUT type=submit name=btnG VALUE=\"Google Search\" style=\"margin-top:4px;\">\n";
echo "</FORM></center>\n";
echo boxfoot();
}
function mod_google_med() {
echo boxhead("Search Google",0);
echo "<center>\n";
echo "<table border=0 cellspacing=5 cellpadding=0><tr>\n";
echo "<FORM method=GET action=\"http://www.google.com/search\">\n";
echo "<input type=hidden name=ie value=UTF-8><input type=hidden name=oe value=UTF-8>\n";
echo "<td valign=middle><INPUT TYPE=text name=q style=\"width:125px\" maxlength=255 value=\"\"></td>\n";
echo "<td valign=middle><INPUT type=\"image\" src=\"/gui/google_button.gif\"></td>\n";
echo "</FORM></tr></table></center>\n";
echo boxfoot();
}
function mod_google() {
//echo boxhead("Search Google",0);
echo "<P><center>\n";
echo "<table border=0 cellspacing=5 cellpadding=0><tr>\n";
echo "<FORM method=GET action=\"http://www.google.com/search\" name=\"googlesearch\">\n";
echo "<input type=hidden name=ie value=UTF-8><input type=hidden name=oe value=UTF-8>\n";
echo "<td valign=middle><INPUT TYPE=text name=q style=\"width:135px;\" maxlength=255 value=\"Search Google\" onFocus=\"document.googlesearch.q.value='';\"></td>\n";
echo "<td valign=middle><INPUT type=\"image\" src=\"/gui/google_button.gif\"></td>\n";
echo "</FORM></tr></table></center>\n";
//echo boxfoot();
}
function mod_it_notices() {
$checkdate = mktime();
$day = getdate($checkdate);
while ($day["weekday"] != "Monday") {
$checkdate -= 86400;
$day = getdate($checkdate);
}
$sql = "SELECT notice_id, notice_date FROM tbl_notices WHERE notice_type_id=5 AND notice_active=1";
$result = mysql_query($sql);
$ctr = 0;
for ($i=0; $i < mysql_num_rows($result); $i++) {
$ndate = mysql_fetch_array($result);
if ($ndate["notice_date"] > $checkdate) $ctr++;
}
echo boxhead("IT Notices",0);
echo "<center><table cellspacing=4 cellpadding=0 border=0 style=\"margin:5px;\"><tr>\n";
echo "<td valign=\"top\"><a href=\"/noticeboard.php?ntid=5\"><img src=\"/gui/icons/it_".($ctr>0?"warning":"lg").".gif\" style=\"margin-right:5px;\" border=0></a></td>\n";
if ($ctr == 1) echo "<td valign=\"top\" align=\"center\">There has been<br><b>".$ctr."</b> IT Notice<br>posted since ".date("m/d",$checkdate);
else echo "<td valign=\"top\" align=\"center\">There have been<br><b>".$ctr."</b> IT Notices<br>posted since ".date("m/d",$checkdate);
echo "</td></tr>\n";
echo "<tr><td colspan=2 align=\"center\"><a href=\"/noticeboard.php?ntid=5\">IST Noticeboard >></a></td></tr>\n";
echo "</table></center>\n";
echo boxfoot();
}
function mod_leftnav($nav_id=0,$add_rank=1) {
if (((strstr(self(),"notice.php")) || (strstr(self(),"notice_edit.php"))) && !isset($_GET["sf"])) $nav_id = quickSQL("SELECT tbl_notice_types.parent_id FROM tbl_notice_types, tbl_notices WHERE tbl_notices.notice_id=".$_GET["nid"]." AND tbl_notices.notice_type_id=tbl_notice_types.notice_type_id");
if ((strstr(self(),"noticeboard.php")) && !isset($_GET["sf"])) $nav_id = quickSQL("SELECT parent_id FROM tbl_notice_types WHERE notice_type_id=".$_GET["ntid"]);
else if (($nav_id==0) && (!isset($_GET["p"]))) $nav_id = 1;
else if ($nav_id==0) $nav_id = $_GET["p"];
if (isset($GLOBALS["leftnav"])) { $nav_id = $GLOBALS["leftnav"]; $add_rank=0; }
if (zero($nav_id)) $nav_id = 1;
// GET ID OF THIS $nav_id's PARENT
$parent_id = quickSQL("SELECT parent_id FROM tbl_pages WHERE page_id=".$nav_id);
// GET SUBPAGES OF $nav_id
$sql1 = "SELECT * FROM tbl_pages WHERE parent_id=".$nav_id." AND page_active=1 AND gbtab_id=0 ORDER BY page_rank ASC, page_id ASC";
$res1 = mysql_query($sql1);
// GET ANY POSSIBLE NOTICE BOARDS ATTACHED TO $nav_id
$sql2 = "SELECT * FROM tbl_notice_types WHERE parent_id=".$nav_id." AND notice_type_active=1";
$res2 = mysql_query($sql2);
// GET ANY POSSIBLE COURSE/EVENT REGISTRATION PAGES ATTACHED TO $nav_id
$sql4 = "SELECT * FROM tbl_event WHERE event_id IN(".event_in().") AND event_parent=".$nav_id." ORDER BY event_title ASC";
$res4 = mysql_query($sql4);
// GET PARENT INFO
if ($parent_id > 0) {
$sql3 = "SELECT * FROM tbl_pages WHERE page_id=".$parent_id;
$res3 = mysql_query($sql3);
}
if ((mysql_num_rows($res1) > 0) || (mysql_num_rows($res2) > 0)) {
$out = "<table border=0 width=200 cellspacing=0 cellpadding=0>\n";
$out .= "<tr style=\"background:url(/gui/left_nav_top.gif);\"><td height=10 colspan=2><img src=\"/gui/clear.gif\" width=1 height=6></td></tr>\n";
$out .= "<tr bgcolor=\"#FFFFFF\"><td height=1 colspan=2><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
if ($parent_id > 0) {
$row = mysql_fetch_array($res3);
$out .= "<tr class=\"leftnav-up\"><td height=20 valign=\"middle\"> <a href=\"/content.php?p=".$row["page_id"]."\"><img src=\"/gui/page_up.gif\" border=0></a> </td><td><a href=\"/content.php?p=".$row["page_id"]."\" class=\"leftnav-w\">".($row["page_id"]==1?"Intranet Home":$row["page_title"])."</a></td></tr>\n";
$out .= "<tr bgcolor=\"#FFFFFF\"><td height=1 colspan=2><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
}
$out .= "<tr class=\"leftnav-on\"><td height=20 valign=\"middle\"> <a href=\"/content.php?p=".$nav_id."\"><img src=\"/gui/page_this.gif\" border=0 style=\"margin-top:3px\"></a> </td><td><a href=\"/content.php?p=".$nav_id."\" class=\"leftnav-w\"><b>".($nav_id==1?"Intranet Home":quickSQL("SELECT page_title FROM tbl_pages WHERE page_id=".$nav_id))."</b></a></td></tr>\n";
$out .= "<tr bgcolor=\"#FFFFFF\"><td height=1 colspan=2><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
for ($i=0; $i < mysql_num_rows($res1); $i++) {
$omout = COLOR_LNAV_OFF;
$omovr = COLOR_LNAV_ON;
$l = mysql_fetch_array($res1);
if ($_GET["p"] == $l["page_id"]) $omout = $omovr;
if ($l["page_linkto"] == "0") $out .= "<tr style=\"cursor:hand\" onmouseover=\"bgColor='".$omovr."'\" onmouseout=\"bgColor='".$omout."'\" bgColor='".$omout."' onclick=\"window.location='/content.php?p=".$l["page_id"]."'\"><td valign=\"middle\" align=\"center\" height=20><img src=\"/gui/bullet.gif\"></td><td><a href=\"/content.php?p=".$l["page_id"]."\"".($l["page_window"]==1?" target=\"new\"":"")." class=\"leftnav\">".$l["page_title"]."</a></td></tr>\n";
else $out .= "<tr style=\"cursor:hand\" onmouseover=\"bgColor='".$omovr."'\" onmouseout=\"bgColor='".$omout."'\" bgColor='".$omout."' ".($l["page_window"]==1?"onclick=\"window.open('".$l["page_linkto"]."','new')\"":"onclick=\"window.location='".$l["page_linkto"]."'\"")."><td valign=\"middle\" align=\"center\" height=20><img src=\"/gui/bullet.gif\"></td><td><a href=\"".$l["page_linkto"]."\"".($l["page_window"]==1?" target=\"new\"":"")." class=\"leftnav\">".$l["page_title"]."</a>".(authorize(get_owners($l["page_id"]))&&!MOBILE?" <a href=\"/content_edit.php?p=".$l["page_id"]."\" class=\"leftnav\" style=\"font-size:9px\"><img src=\"/gui/pencil.gif\" border=0></a>":"")."</td></tr>\n";
$out .= "<tr bgcolor=\"#FFFFFF\"><td height=1 colspan=2><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
}
for ($j=0; $j < mysql_num_rows($res2); $j++) {
$omout = COLOR_LNAV_OFF;
$omovr = COLOR_LNAV_ON;
$l = mysql_fetch_array($res2);
if ($_GET["ntid"] == $l["notice_type_id"]) $omout = $omovr;
if ($GLOBALS["ntid"] == $l["notice_type_id"]) $omout = $omovr;
$out .= "<tr style=\"cursor:hand\" onmouseover=\"bgColor='".$omovr."'\" onmouseout=\"bgColor='".$omout."'\" bgColor='".$omout."' onclick=\"window.location='/noticeboard.php?ntid=".$l["notice_type_id"]."'\"><td valign=\"middle\" align=\"center\" height=20><img src=\"/gui/bullet.gif\"></td><td><a href=\"/noticeboard.php?ntid=".$l["notice_type_id"]."\" class=\"leftnav\">".$l["notice_type_name"]."</a></td></tr>\n";
$out .= "<tr bgcolor=\"#FFFFFF\"><td height=1 colspan=2><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
}
for ($k=0; $k < mysql_num_rows($res4); $k++) {
$omout = COLOR_LNAV_OFF;
$omovr = COLOR_LNAV_ON;
$l = mysql_fetch_array($res4);
if ($_GET["id"] == $l["event_id"]) $omout = $omovr;
//if ($GLOBALS["id"] == $l["set_id"]) $omout = $omovr;
$out .= "<tr style=\"cursor:hand\" onmouseover=\"bgColor='".$omovr."'\" onmouseout=\"bgColor='".$omout."'\" bgColor='".$omout."' onclick=\"window.location='/eventreg_".$l["event_type"].".php?id=".$l["event_id"]."'\"><td valign=\"middle\" align=\"center\" height=20><img src=\"/gui/bullet.gif\"></td><td><a href=\"/eventreg_".$l["event_type"].".php?id=".$l["event_id"]."\" class=\"leftnav\">".$l["event_title"]."</a></td></tr>\n";
$out .= "<tr bgcolor=\"#FFFFFF\"><td height=1 colspan=2><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
}
if (mysql_num_rows($res1) + mysql_num_rows($res2) == 0) $out .= "<tr bgcolor=\"#E0E0E0\"><td height=20 valign=\"middle\" align=\"center\"> </td><td> <span style=\"color:#999999\">No Subpages</span></td></tr>\n";
$out .= "<tr style=\"background:url(/gui/left_nav_bot.gif);\"><td height=10 colspan=2><img src=\"/gui/clear.gif\" width=1 height=6></td></tr>\n";
$out .= "</table>\n";
} else mod_leftnav_parent($nav_id);
echo $out;
}
function mod_leftnav_parent($p) {
$par = quickSQL("SELECT parent_id FROM tbl_pages WHERE page_id=".$p);
if (!$par) return FALSE;
else mod_leftnav($par,0);
}
function mod_login() {
}
function mod_login_head() {
if (!is_logged()) {
echo "<center><table border=0 width=210 class=\"login\">\n";
echo "<form action=\"/login.php\" method=\"post\" name=\"login\">\n";
echo "<input type=\"hidden\" name=\"refer\" value=\"".self()."\">\n";
echo "<input type=\"hidden\" name=\"force\" value=\"0\">\n";
//if ($_GET["xlog"] == 1) echo "<tr><td colspan=2 valign=middle>".error("Invalid Login")."</td></tr>\n";
echo "<tr><td align=\"right\">Username:</td><td><input type=\"text\" name=\"username\" style=\"width:100px\" maxlength=32></td></tr>\n";
echo "<tr><td align=\"right\">Password:</td><td><input type=\"password\" name=\"password\" style=\"width:100px\" maxlength=32></td></tr>\n";
echo "<tr><td colspan=2 align=center>".($_GET["xlog"]==1?error2("Invalid Login! ","<input type=\"submit\" value=\"Login\" class=\"btn\">"):"<input type=\"submit\" value=\"Login\" class=\"btn\">")."</td></tr>\n";
echo "</form>\n";
echo "</table>\n</center>\n";
}
}
function market_format($sym,$ret=0) {
$fd = fopen("http://quote.yahoo.com/d/quotes.csv?s=^".$sym."&f=sl1d1t1c1cohgv&e=.csv", "r");
$dat = fread($fd,200); fclose($fd);
$dat = str_replace("\"","",$dat);
$dat = explode (",",$dat);
$chg = $dat[5];
if (substr($chg,0,1) == "+") {
$chg = str_replace("+","",$chg);
$chg = str_replace(" - "," (",$chg);
$chg = str_replace("%","%)",$chg);
$chg = "<img src=\"/gui/up_g.gif\"> <span style=\"color:#009900;\">".$chg."</span>\n";
} else if (substr($chg,0,1) == "-") {
$chg = str_replace(" - "," (",$chg);
$chg = str_replace("-","",$chg);
$chg = str_replace("%","%)",$chg);
$chg = "<img src=\"/gui/down_r.gif\"> <span style=\"color:#CC0000;\">".$chg."</span>\n";
} else {
$chg = str_replace(" - "," (",$chg);
$chg = str_replace("%","%)",$chg);
}
if ($ret == 0) return $chg;
else return $dat[$ret];
}
function mod_market() {
echo "<div id=\"heading\"><div style=\"float:right;\"><a href=\"http://finance.yahoo.com/\" target=\"yah\"><img src=\"/gui/icons/yahooy.gif\" style=\"margin-top:3px;\" border=0></a></div>Market Summary</div>";
echo "<center><!--div style=\"background:#FFFFFF;border:solid 1px #CCCCCC;\"--><img border=0 src=\"http://ichart.yahoo.com/t?s=^dji\" style=\"margin:3px;\"><!--/div-->\n";
echo "<table border=0>\n";
echo "<tr><td valign=\"bottom\"><a href=\"http://finance.yahoo.com/q?s=%5EDJI\" target=\"yah\">Dow</a></td><td align=\"right\" valign=\"bottom\">".market_format("dji",1)."</td><td align=\"right\" valign=\"bottom\"> ".market_format("dji")."</td></tr>\n";
echo "<tr><td valign=\"bottom\"><a href=\"http://finance.yahoo.com/q?s=%5EIXIC\" target=\"yah\">Nasdaq</a></td><td align=\"right\" valign=\"bottom\">".market_format("ixic",1)."</td><td align=\"right\" valign=\"bottom\"> ".market_format("ixic")."</td></tr>\n";
echo "<tr><td valign=\"bottom\"><a href=\"http://finance.yahoo.com/q?s=%5EGSPC\" target=\"yah\">S&P 500</a></td><td align=\"right\" valign=\"bottom\">".market_format("gspc",1)."</td><td align=\"right\" valign=\"bottom\"> ".market_format("gspc")."</td></tr>\n";
echo "</table></center>\n";
}
function mod_meetroom() {
//echo "<div id=\"boxhead\">Reserve a Meeting Room</div>\n";
//echo "<div id=\"box\">\n";
//echo "Enter the date and time your meeting will begin:\n";
//echo "<center><table cellpadding=0 cellspacing=4>\n";
//echo "<tr><td><b>Date:</b> </td><td><input type=\"text\" size=2 value=10 style=\"text-align:center\"> / <input type=\"text\" size=2 value=15 style=\"text-align:center\"> / <input type=\"text\" size=4 value=2004 style=\"text-align:center\"></td></tr>\n";
//echo "<tr><td><b>Time:</b> </td><td><SELECT><option>8:30 am</option><option>9:00 am</option></SELECT></td></tr>\n";
//echo "</table>\n";
//echo "<input type=\"submit\" value=\"Search\">\n";
//echo "</center>\n";
//echo "</div>\n";
}
function mod_mylinks() {
}
function mod_mywsnav() {
echo boxhead("My Workspace",0);
echo "<center><div style=\"width:100%;margin:5px;\">\n";
echo "<table border=0 width=100% cellspacing=3 cellpadding=0>\n";
echo "<tr><td valign=\"top\"><img src=\"/gui/bullet.gif\"></td><td> <a href=\"/ws_documents.php?id=".$_SESSION["auth_user"]."\">My Documents</a></td></tr>\n";
echo "<tr><td valign=\"top\"><img src=\"/gui/bullet.gif\"></td><td> <a href=\"/ws_schedule.php?id=".$_SESSION["auth_user"]."\">My Schedule</a></td></tr>\n";
echo "<tr><td valign=\"top\"><img src=\"/gui/bullet.gif\"></td><td> <a href=\"/ws_meetings.php?id=".$_SESSION["auth_user"]."\">My Meetings</a></td></tr>\n";
echo "<tr><td valign=\"top\"><img src=\"/gui/bullet.gif\"></td><td> <a href=\"/ws_profile.php?id=".$_SESSION["auth_user"]."\">My Profile</a></td></tr>\n";
echo "<tr><td valign=\"top\"><img src=\"/gui/bullet.gif\"></td><td> <a href=\"/ws_visitors.php?id=".$_SESSION["auth_user"]."\">My Visitors</a></td></tr>\n";
echo "<tr><td valign=\"top\"><img src=\"/gui/bullet.gif\"></td><td> <a href=\"/ws_contacts.php?id=".$_SESSION["auth_user"]."\">My Contacts</a></td></tr>\n";
echo "<tr><td valign=\"top\"><img src=\"/gui/bullet.gif\"></td><td> <a href=\"/ws_timesheet.php?id=".$_SESSION["auth_user"]."\">My Timesheet</a></td></tr>\n";
echo "</table>\n";
echo "</div></center>\n";
echo boxfoot();
}
function mod_mergedboard($type=1) {
if (isset($_GET["mar"])) set_allread();
if ($type == 1) { $in = "1,3,5,7"; $lim = "20"; $ptitle = CMP_NAME_INF."'s Most Recent Notices"; }
else if ($type == 2) { $in = "4,20,21,22,23,24,25"; $lim = "10"; $ptitle = "Most Recent Forum Messages"; }
$is_logged = FALSE;
$nids = array();
if (is_logged()) {
$is_logged = TRUE;
$sql = "SELECT notice_id FROM tbl_notice_visits WHERE username='".$_SESSION["auth_user"]."'";
$res = mysql_query($sql);
for ($i=0; $nid = mysql_fetch_array($res); $i++) $nids[$i] = $nid["notice_id"];
}
if (!$is_logged) define('OUTOFDATE',mktime(0,0,0,date("m"),date("d"),date("Y"))); //make bold today's messages
else {
// CHECK DB FOR ALLREAD
$allread = get_allread();
if ($allread !== FALSE) define('OUTOFDATE',$allread);
else define('OUTOFDATE',(time()-1209600)); //2419200 = 4 weeks; 1209600 = 2 weeks
}
$sql1 = "SELECT * FROM tbl_notice_types WHERE notice_type_id IN(".$in.")";
$result1 = mysql_query($sql1);
$t = mysql_fetch_array($result1);
$start = ((isset($_GET["pag"])?$_GET["pag"]:1)-1) * 30;
$limit = PAG_LENGTH;
$sql2 = "SELECT tbl_notices.*, tbl_icons.icon_file FROM tbl_notices, tbl_icons ";
$sql2 .= "WHERE tbl_notices.notice_type_id IN(".$in.") AND tbl_notices.icon_id=tbl_icons.icon_id AND tbl_notices.notice_active=1 AND tbl_notices.notice_date < ".time()." ";
$sql2 .= "ORDER BY notice_sticky DESC, notice_date DESC LIMIT 0,".(MOBILE?"10":$lim);
$result2 = mysql_query($sql2);
if (MOBILE) {
echo "<b>".$ptitle."</b><ul>";
for ($i=0; $i < mysql_num_rows($result2); $i++) {
$n = mysql_fetch_array($result2);
// Add Notice Headline Prefix
if ($n["notice_type_id"] == 5) $prefix = "IST: ";
else if ($n["notice_type_id"] == 3) $prefix = "Careers: ";
else $prefix = "";
echo "<br><li>".date("m/d",$n["notice_date"])." : ";
if (strlen($n["notice_linkto"]) > 7) echo "<a href=\"".$n["notice_linkto"]."\"".(local_url($n["notice_linkto"])?"":" target=\"new\"")." class=\"notice\">";
else echo "<a href=\"/notice.php?nid=".$n["notice_id"]."\" class=\"notice\">";
echo ($n["notice_sticky"]==1?"<b>":"").$prefix.strip_tags($n["notice_headline"]).($n["notice_sticky"]==1?"</b>":"")."</a>";
}
echo "</ul>\n";
if ($type == 1) {
echo "<br> <a href=\"/noticeboard.php?ntid=1\">Corporate Noticeboard</a>";
echo "<br> <a href=\"/noticeboard.php?ntid=3\">Career Opportunities</a>";
echo "<br> <a href=\"/noticeboard.php?ntid=5\">IST Noticeboard</a>";
}
} else {
echo "<div id=\"heading\">".$ptitle."</div>";
echo "<div id=\"box\">\n";
echo "<table border=0 cellpadding=0 cellspacing=6 class=\"textdn\">\n";
if (mysql_num_rows($result2) < 1) {
echo "<tr><td align=\"center\"><br><b>There are no available notices in this section.</b><br><br></td></tr>\n";
} else {
for ($i=0; $i < mysql_num_rows($result2); $i++) {
$n = mysql_fetch_array($result2);
// Add Notice Headline Prefix
if ($n["notice_type_id"] == 5) $prefix = "IST: ";
else if ($n["notice_type_id"] == 3) $prefix = "Careers: ";
else $prefix = "";
// Get Correct Icon
if ($n["notice_sticky"]==1) $icon = "/gui/icons/announcement.gif";
else if ($n["notice_type_id"] == 5) $icon = "/gui/icons/it.gif";
else if ($n["notice_type_id"] == 3) $icon = "/gui/icons/hr.gif";
else $icon = $n["icon_file"];
// Create Headline/Date
$headline = $prefix.strip_tags($n["notice_headline"]);
if (zero($headline)) $headline = "No Title";
$date = date("m/d",$n["notice_date"]);
if ($n["notice_date"] > OUTOFDATE) {
// Style BOLD if unread
if (!in_array($n["notice_id"],$nids)) $headline = "<b>".$headline."</b>";
// Style Date
if ($n["notice_sticky"]==1) $date = "<b class=\"sticky\">".$date."</b>";
else if (!in_array($n["notice_id"],$nids)) $date = "<b>".$date."</b>";
}
echo "<tr>";
echo "<td width=10 valign=top><img src=\"".$icon."\"></td>";
echo "<td width=10 valign=top>".$date." -</td>";
echo "<td valign=top width=\"*\">";
echo "<a href=\"/notice.php?nid=".$n["notice_id"].($type!=1?"&sf=1":"")."\" class=\"".($n["notice_sticky"]==1?"sticky":"notice")."\"".(strlen($n["notice_linkto"])>7 && new_window($n["notice_linkto"]) ? " target=\"_blank\"":"").">";
echo $headline."</a>";
if ((strlen($n["notice_linkto"]) > 7) && (authorize($n["username"]))) echo " (<a href=\"/notice_edit.php?nid=".$n["notice_id"]."\" class=\"notice\">edit</a>)";
echo "</td>";
echo "</tr>\n";
}
echo "<tr><td colspan=3>";
if ($type == 1) {
echo "<a href=\"/noticeboard.php?ntid=1\">Corporate Noticeboard</a> | ";
echo "<a href=\"/noticeboard.php?ntid=3\">Career Opportunities</a> | ";
echo "<a href=\"/noticeboard.php?ntid=5\">IST Noticeboard</a>";
if (is_logged()) echo " | <a href=\"".self().(strstr(self(),"&mar=1")?"":"&mar=1")."\">Mark All Topics Read</a>";
} else {
echo "<a href=\"/forums.php\">Enter the Discussion Forums</a>";
if (is_logged()) echo " | <a href=\"".self().(strstr(self(),"&mar=1")?"":"&mar=1")."\">Mark All Topics Read</a>\n";
}
echo "</td></tr>\n";
echo "</table></div>\n";
}
}
}
function mod_new_employees($format=1) {
$checkdate = mktime();
$day = getdate($checkdate);
while ($day["weekday"] != "Monday") {
$checkdate -= 86400;
$day = getdate($checkdate);
}
$checkdate2 = $checkdate + 432000;
$checkdate -= 1814400;
$sql = "SELECT * FROM tbl_employees WHERE start_date >= '".$checkdate."' AND start_date < '".$checkdate2."' AND is_employee=1 ORDER BY emp_type_id ASC, lname ASC";
$res = mysql_query($sql);
$ctr = 0;
if (MOBILE) {
echo "<b>Who's New at ".CMP_NAME_INF."</b>";
if (mysql_num_rows($res) < 1) echo "<br><li> No new personnel in past month.";
else for ($i=0; $row = mysql_fetch_array($res); $i++) {
echo "<br><li> <a href=\"/profile.php?u=".$row["username"]."\">".$row["lname"].", ".$row["fname"]."</a> : ".$row["title"]."\n";
}
} else {
echo "<div id=\"heading\">Who's New at ".CMP_NAME_INF."</div>";
echo "<div id=\"box\">\n";
if ($format == 1) {
echo "<table border=0 cellspacing=2 cellpadding=0 class=\"textdn\">\n";
if (mysql_num_rows($res) < 1) echo "<tr><td><img src=\"/gui/bullet.gif\"></td><td> No new personnel in past month.</td></tr>\n";
else for ($i=0; $row = mysql_fetch_array($res); $i++) {
echo "<tr><td> <img src=\"/gui/bullet.gif\"> </td><td><a href=\"/profile.php?u=".$row["username"]."\">".$row["lname"].", ".$row["fname"]."</a></td><td> ".$row["title"]."</td></tr>\n";
}
echo "</table>\n";
} else {
if (mysql_num_rows($res) < 1) echo "<li> No new personnel in past month.\n";
else for ($i=0; $row = mysql_fetch_array($res); $i++) {
if ($i > 0) echo "<br>";
echo "<li> <a href=\"/profile.php?u=".$row["username"]."\">".$row["lname"].", ".$row["fname"]."</a><div style=\"margin-left:15px;\">".$row["title"]."</div>\n";
}
}
echo "</div>\n";
}
}
function mod_noticeboard($type,$display) {
if (isset($_GET["mar"])) set_allread();
$is_logged = FALSE;
$nids = array();
if (is_logged()) {
$is_logged = TRUE;
$sql = "SELECT notice_id FROM tbl_notice_visits WHERE username='".$_SESSION["auth_user"]."'";
$res = mysql_query($sql);
for ($i=0; $nid = mysql_fetch_array($res); $i++) $nids[$i] = $nid["notice_id"];
}
if (!$is_logged) define('OUTOFDATE',mktime(0,0,0,date("m"),date("d"),date("Y"))); //make bold today's messages
else {
// CHECK DB FOR ALLREAD
$allread = get_allread();
if ($allread !== FALSE) define('OUTOFDATE',$allread);
else define('OUTOFDATE',(time()-1209600)); //2419200 = 4 weeks; 1209600 = 2 weeks
}
$sql1 = "SELECT * FROM tbl_notice_types WHERE notice_type_id=".$type;
$result1 = mysql_query($sql1);
$t = mysql_fetch_array($result1);
$forumview = $t["forum_view"];
$replies = $t["notice_type_discuss"];
$sf = (isset($_GET["sf"])?"&sf=1":"");
$board = strstr(self(),"noticeboard.php");
$start = ((isset($_GET["pag"])?$_GET["pag"]:1)-1) * 30;
$limit = PAG_LENGTH;
$sql2 = "SELECT tbl_notices.*, tbl_icons.icon_file FROM tbl_notices, tbl_icons ";
$sql2 .= "WHERE tbl_notices.notice_type_id=".$type." AND tbl_notices.icon_id=tbl_icons.icon_id AND tbl_notices.notice_active=1 AND tbl_notices.notice_date < ".time()." ";
if ($forumview) $sql2 .= "ORDER BY latest_thread DESC";
else $sql2 .= "ORDER BY notice_sticky DESC, notice_date DESC";
if ($board) $sql2 .= " LIMIT ".$start.",".$limit;
else $sql2 .= ($display==0?"":" LIMIT 0,".$display);
$result2 = mysql_query($sql2);
// Header
if ($board || $forumview) echo "<div class=\"headline\">".$t["notice_type_name"]."</div><P>\n";
else {
echo "<div id=\"heading\">".$t["notice_type_name"]."</div>";
echo "<div id=\"box\" style=\"margin-bottom:8px;\">\n";
}
// Board Description
if (!zero($t["notice_type_desc"])) echo "<P>".format_body($t["notice_type_desc"])."<P>\n";
// Begin Table / Actions / Pagination
if ($board || $forumview) {
echo "<center><table width=\"95%\" border=0 cellpadding=0 style=\"margin-bottom:6px;\" class=\"textdn\"><tr><td><a href=\"/notice_add.php?ntid=".$type.(isset($_GET["sf"])?"&sf=1":"")."\">Add New Topic</a>".($is_logged?" | <a href=\"".self().(strstr(self(),"&mar=1")?"":"&mar=1")."\">Mark All Topics Read</a>":"")."</td><td align=\"right\">".pagination($type,(isset($_GET["pag"])?$_GET["pag"]:1))."</td></tr></table>\n";
echo "<table width=\"95%\" border=0 cellpadding=4 cellspacing=1 style=\"background:#CCCCCC;\" class=\"textdn\">\n";
} else echo "<table width=\"95%\" border=0 cellpadding=0 cellspacing=6 class=\"textdn\">\n";
// Forum Header
if ($board || $forumview) echo "<tr class=\"header\"><td> </td><td>Topic</td><td>Author</td>".($replies?"<td>Replies</td>":"")."<td>Views</td>".($replies?"<td>Last Post</td>":"<td>Date Posted</td>")."</tr>\n";
if (mysql_num_rows($result2) < 1) {
echo "<tr><td align=\"center\"><br><b>There are no available notices in this section.</b><br><br></td></tr>\n";
} else {
for ($i=0; $i < mysql_num_rows($result2); $i++) {
$n = mysql_fetch_array($result2);
// Get Correct Icon
if ($n["notice_sticky"]==1) $icon = "/gui/icons/announcement.gif";
else if ($n["notice_type_id"] == 5) $icon = "/gui/icons/it.gif";
else if ($n["notice_type_id"] == 3) $icon = "/gui/icons/hr.gif";
else $icon = $n["icon_file"];
// Create Headline/Date
$headline = strip_tags($n["notice_headline"]);
if (zero($headline)) $headline = "No Title";
$date = date("m/d",$n["notice_date"]);
$user_display = $n["username"];
$view_display = $n["notice_views"];
// FIND COMMENTS
$comments = quickSQL("SELECT COUNT(thread_id) AS comments FROM tbl_threads WHERE thread_active=1 AND notice_id=".$n["notice_id"]);
if ($comments > 0) $maxdate = quickSQL("SELECT MAX(thread_date) AS maxdate FROM tbl_threads WHERE thread_active=1 AND notice_id=".$n["notice_id"]);
else $maxdate = $n["notice_date"];
$maxdate = str_replace(" "," ",date("F j, Y h:i a",$maxdate));
// IF STICKY, MAKE STICKY STYLE
if ($n["notice_sticky"]==1) {
$date = "<b class=\"sticky\">".$date."</b>";
$user_display = "<b class=\"sticky\">".$user_display."</b>";
$view_display = "<b class=\"sticky\">".$view_display."</b>";
$comments = "<b class=\"sticky\">".$comments."</b>";
$maxdate = "<b class=\"sticky\">".$maxdate."</b>";
// ELSE IF POSTED AFTER OUTOFDATE, AND UNREAD, MAKE BOLD
} else if (($n["notice_date"] > OUTOFDATE) && !in_array($n["notice_id"],$nids)) {
$headline = "<b>".$headline."</b>";
$date = "<b>".$date."</b>";
$user_display = "<b>".$user_display."</b>";
$view_display = "<b>".$view_display."</b>";
$comments = "<b>".$comments."</b>";
$maxdate = "<b>".$maxdate."</b>";
}
// START PRINTING ROW
if ($board || $forumview) echo "<tr".($i%2==1?" bgcolor=\"#FFFFFF\"":" bgcolor=\"#EEEEEE\"").">\n";
echo "<td width=10 valign=top><img src=\"".$icon."\"></td>";
if (!($board || $forumview)) echo "<td width=10 valign=top><b>".$date."</b> -</td>";
echo "<td valign=top width=\"*\">";
echo "<a href=\"/notice.php?nid=".$n["notice_id"].$sf."\" class=\"".($n["notice_sticky"]==1?"sticky":"notice")."\"".(strlen($n["notice_linkto"])>7 && new_window($n["notice_linkto"]) ? " target=\"_blank\"":"").">";
echo $headline."</a>";
if ((strlen($n["notice_linkto"]) > 7) && (authorize($n["username"]))) echo " (<a href=\"/notice_edit.php?nid=".$n["notice_id"]."\" class=\"notice\">edit</a>)";
echo "</td>";
if ($board || $forumview) {
echo "<td><a href=\"/profile.php?u=".$n["username"]."\" class=\"notice\">".$user_display."</a></td>\n";
if ($replies) echo "<td align=\"center\">".$comments."</td>\n";
echo "<td align=\"center\">".$view_display."</td>\n";
echo "<td>".$maxdate."</td>\n";
}
echo "</tr>\n";
}
}
if (!($board || $forumview)) {
echo "<tr><td colspan=3 align=\"center\"><a href=\"/notice_add.php?ntid=".$type.(isset($_GET["sf"])?"&sf=1":"")."\">Add a Notice</a>";
if ((mysql_num_rows($result2) >= $display) && ($display != 0)) {
echo " <a href=\"/noticeboard.php?ntid=".$type.(isset($_GET["sf"])?"&sf=1":"")."\">View All Results <b>>></b>";
}
echo "</td></tr>\n";
}
echo "</table>\n";
if (!($board || $forumview)) echo "</div>";
if ($board || $forumview) {
echo "<table width=\"95%\" border=0 cellpadding=0 style=\"margin-top:6px;\" class=\"textdn\"><tr><td><a href=\"/notice_add.php?ntid=".$type.(isset($_GET["sf"])?"&sf=1":"")."\">Add New Topic</a>".($is_logged?" | <a href=\"".self().(strstr(self(),"&mar=1")?"":"&mar=1")."\">Mark All Topics Read</a>":"")."</td><td align=\"right\">".pagination($type,(isset($_GET["pag"])?$_GET["pag"]:1))."</td></tr></table>\n";
}
echo "</center>\n";
if ($board || $forumview) {
echo "<P><div class=\"pagefoot\" style=\"border-width:1px 0px 0px 0px;\"><b>Forum Moderators: </b>";
//ECHO MODERATORS
$sql = "SELECT username FROM tbl_pgroup_user WHERE pgroup_id=".$t["board_admins"];
$res = mysql_query($sql);
for ($i=0; $row = mysql_fetch_array($res); $i++) {
if ($i != 0) echo ", ";
echo "<a href=\"/profile.php?u=".$row["username"]."\">".$row["username"]."</a>";
} if (mysql_num_rows($res) == 0) echo "None";
}
}
function mod_oracledocs() {
echo boxhead("Oracle Documentation",0);
echo "<center><a href=\"/oracledocs\" target=\"odl\"><img src=\"/gui/ist/oracle_doclib.gif\" border=0 vspace=8></a></center>\n";
echo boxfoot();
}
function mod_search_portal() {
echo "<div id=\"heading2\">Search</div>";
echo "<div id=\"box2\">\n";
echo "<center><table border=0 cellspacing=8 cellpadding=0>\n";
echo "<form name=\"gs\" method=\"GET\" action=\"http://google-int.vocollect.int/search\"><tr><td align=\"right\"><b>Intranet:</b></td><td><input type=\"text\" style=\"width:235px\" name=\"q\"><input type=\"hidden\" name=\"site\" value=\"intranet\"><input type=\"hidden\" name=\"client\" value=\"intranet\"><input type=\"hidden\" name=\"proxystylesheet\" value=\"intranet\"><input type=\"hidden\" name=\"output\" value=\"xml_no_dtd\"></td><td><input type=\"submit\" value=\"Search\" class=\"btn\" name=\"btnG\"></td></tr></form>\n";
echo "<form action=\"/directory.php\" method=\"get\" name=\"directory\"><tr><td align=\"right\"><b>Employees:</b></td><td><input type=\"text\" style=\"width:235px\" name=\"e\" value=\"".$_POST["e"]."\"></td><td><input type=\"submit\" value=\"Search\" class=\"btn\"></td></tr></form>\n";
echo "<FORM method=GET action=\"http://www.google.com/search\"><tr><td align=\"right\"><b>Google.com:</b></td><td><input type=\"text\" style=\"width:235px\" name=\"q\"></td><td><input type=\"submit\" value=\"Search\" class=\"btn\"></td></tr></form>\n";
echo "</table></center>\n";
echo "</div>\n";
}
function mod_top_level_nav() {
mod_leftnav(1);
}
function mod_weather() {
if (dbVAR("weather_on") == 1) {
//echo "<div id=\"heading\">Today's Weather</div>";
$zip = 0;
if (isset($_SESSION["auth_user"])) $zip = quickSQL("SELECT weather_zip FROM tbl_employees WHERE username='".$_SESSION["auth_user"]."'");
if ($zip == 0) $zip = WEATHER_ZIP;
echo "<P><center><div style=\"margin:3px\">";
echo "<script src='http://voap.weather.com/weather/oap/".$zip."?template=GENXV&par=null&unit=0&key=054f72d0eb7d2245c451c916c7114c10'></script>\n";
if (is_logged()) echo "<a class=\"small\" href=\"#\" onClick=\"openWindow('/quick_change.php?a=weather','','resizable=yes,width=350,height=235')\" style=>Change Location</a>\n";
//echo "<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"http://data.geo.yahoo.com/geo/v1?w=f,15201,60601,uk_londo&hbc=F7F8FA&hfc=000000&hff=tahoma&hfs=1&ibc=F7F8FA&ifc=003882&iff=tahoma&ifs=1&ufc=F7F8FA&uff=tahoma&ufs=1&ts=1123272000\"></SCRIPT>";
echo "</center></div>\n";
}
}
function mod_workspace() {
mboxhead($page_title);
echo "<div id=\"breadcrumb\">";
echo "<div style=\"float:right\"><table border=0 cellspacing=0 cellpadding=0><tr><td><a href=\"/content_pf.php?p=".$_GET["p"]."\" target=\"pf\">Print</a> </td><td><a href=\"/content_pf.php?p=".$_GET["p"]."\" target=\"pf\"><img src=\"gui/icons/print.gif\" border=0 align=middle></a></td></tr></table></div>";
echo breadcrumb($page_id)."</div>\n";
echo "<P><span class=\"headline\"><b>".$page_title."</b></font></span><br><br>\n";
echo format_body($page_body,0);
echo "<br><br><div id=\"breadcrumb\" style=\"border-width:1px 0px 0px 0px;\"><div style=\"float:right\">Last Updated: ".date("F j, Y",$page_updated)." by <a href=\"/profile.php?u=".$username."\">".$username."</a></div>".owners($_GET["p"])."</div>\n";
boxfoot();
}
function mod_workspace_home() {
$sql = "SELECT * FROM tbl_pages WHERE page_id=".$_GET["p"];
$result = mysql_query($sql);
$p = mysql_fetch_array($result);
extract($p);
mboxhead($page_title);
echo "<div id=\"breadcrumb\">".breadcrumb($page_id)."</div>\n";
echo "<P><span class=\"headline\"><b>".$page_title."</b></font></span><br><br>\n";
echo "<P>Workspaces are the staging ground for successful employee-to-employee communication. Using a workspace, individual users or groups of users can maintain files and documents, schedules, meetings, tasks, contacts and timesheets.\n";
echo "<br><br><div id=\"breadcrumb\" style=\"border-width:1px 0px 0px 0px;\"><div style=\"float:right\">Last Updated: ".date("F j, Y",$page_updated)." by <a href=\"/profile.php?u=".$username."\">".$username."</a></div>".owners($_GET["p"])."</div>\n";
boxfoot();
}
function mod_zsearch() {
$sql = "SELECT * FROM tbl_pages WHERE page_id=".$_GET["p"];
$result = mysql_query($sql);
$p = mysql_fetch_array($result);
extract($p);
mboxhead($page_title);
echo "<div id=\"breadcrumb\">".breadcrumb($page_id)."</div>\n";
echo "<P><span class=\"headline\"><b>".$page_title."</b></font></span><br><br>\n";
echo "<br><br><div id=\"breadcrumb\" style=\"border-width:1px 0px 0px 0px;\"><div style=\"float:right\">Last Updated: ".date("F j, Y",$page_updated)." by <a href=\"/profile.php?u=".$username."\">".$username."</a></div>".owners($_GET["p"])."</div>\n";
boxfoot();
}
?>