Commit f482334e54d171e42a1603aab41621ed8acf39d5

Authored by Michael Joseph
1 parent 7d4d1025

changed helper function to return the unit admin user object instead of just the email address


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2081 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/webpageTemplate.inc
@@ -19,7 +19,7 @@ require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.i @@ -19,7 +19,7 @@ require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.i
19 require_once("$default->fileSystemRoot/lib/visualpatterns/NavBar.inc"); 19 require_once("$default->fileSystemRoot/lib/visualpatterns/NavBar.inc");
20 20
21 21
22 -function getUnitAdminEmail() { 22 +function getUnitAdminUser() {
23 global $default; 23 global $default;
24 // find out what unit we're in 24 // find out what unit we're in
25 $iUnitID = User::getUnitID($_SESSION["userID"]); 25 $iUnitID = User::getUnitID($_SESSION["userID"]);
@@ -35,19 +35,19 @@ function getUnitAdminEmail() { @@ -35,19 +35,19 @@ function getUnitAdminEmail() {
35 if ($sql->next_record()) { 35 if ($sql->next_record()) {
36 $iGroupID = $sql->f("group_id"); 36 $iGroupID = $sql->f("group_id");
37 // then find the first user in this group that has an email address 37 // then find the first user in this group that has an email address
38 - if ($sql->query("SELECT U.email FROM $default->owl_users_table U " . 38 + if ($sql->query("SELECT U.id, U.email FROM $default->owl_users_table U " .
39 "INNER JOIN $default->owl_users_groups_table UGL on UGL.user_id=U.id " . 39 "INNER JOIN $default->owl_users_groups_table UGL on UGL.user_id=U.id " .
40 "WHERE group_id=$iGroupID")) { 40 "WHERE group_id=$iGroupID")) {
41 while ($sql->next_record()) { 41 while ($sql->next_record()) {
42 if (strlen($sql->f("email")) > 0) { 42 if (strlen($sql->f("email")) > 0) {
43 - $sEmail = $sql->f("email"); 43 + return User::get($sql->f("id"));
44 } 44 }
45 } 45 }
46 } 46 }
47 } 47 }
48 } 48 }
49 } 49 }
50 - return ($sEmail == "") ? $default->emailAdmin : $sEmail; 50 + return false;
51 } 51 }
52 52
53 // create the navbar and north payload 53 // create the navbar and north payload
@@ -96,13 +96,15 @@ if ($sectionName != "General") { @@ -96,13 +96,15 @@ if ($sectionName != "General") {
96 $cAdmin = "$default->graphicsUrl/leftnav/cadmin.gif" ; 96 $cAdmin = "$default->graphicsUrl/leftnav/cadmin.gif" ;
97 $uAdmin = "$default->graphicsUrl/leftnav/uadmin.gif" ; 97 $uAdmin = "$default->graphicsUrl/leftnav/uadmin.gif" ;
98 98
  99 +$oUnitAdmin = getUnitAdminUser();
  100 +$sUnitAdminEmail = $oUnitAdmin ? $oUnitAdmin->getEmail() : $default->emailAdmin;
99 //setup the westpayload 101 //setup the westpayload
100 $westLoad = "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\" height=\"75%\">\n" . 102 $westLoad = "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\" height=\"75%\">\n" .
101 "\t<tr><td>$westRender</td></tr>\n" . 103 "\t<tr><td>$westRender</td></tr>\n" .
102 "</table>" . 104 "</table>" .
103 "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\" height=\"25%\">\n" . 105 "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\" height=\"25%\">\n" .
104 "\t<tr valign=\"bottom\"><td align=left><a href=\"mailto:$default->emailAdmin\"><img src=\"$cAdmin\"/ border=\"0\"></a></td></tr>\n" . 106 "\t<tr valign=\"bottom\"><td align=left><a href=\"mailto:$default->emailAdmin\"><img src=\"$cAdmin\"/ border=\"0\"></a></td></tr>\n" .
105 - "\t<tr valign=\"middle\"><td align=left><a href=\"mailto:" . getUnitAdminEmail() . "\"><img src=\"$uAdmin\"/ border=\"0\"></a></td></tr>\n" . 107 + "\t<tr valign=\"middle\"><td align=left><a href=\"mailto:$sUnitAdminEmail\"><img src=\"$uAdmin\"/ border=\"0\"></a></td></tr>\n" .
106 "</table>"; 108 "</table>";
107 109
108 $westPayLoad = new PatternCustom; 110 $westPayLoad = new PatternCustom;