Commit b6e51ea6ab12a888981845ea662f64d3ea81bb8b

Authored by michael
1 parent 5a71a0cd

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 19 require_once("$default->fileSystemRoot/lib/visualpatterns/NavBar.inc");
20 20  
21 21  
22   -function getUnitAdminEmail() {
  22 +function getUnitAdminUser() {
23 23 global $default;
24 24 // find out what unit we're in
25 25 $iUnitID = User::getUnitID($_SESSION["userID"]);
... ... @@ -35,19 +35,19 @@ function getUnitAdminEmail() {
35 35 if ($sql->next_record()) {
36 36 $iGroupID = $sql->f("group_id");
37 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 39 "INNER JOIN $default->owl_users_groups_table UGL on UGL.user_id=U.id " .
40 40 "WHERE group_id=$iGroupID")) {
41 41 while ($sql->next_record()) {
42 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 53 // create the navbar and north payload
... ... @@ -96,13 +96,15 @@ if ($sectionName != "General") {
96 96 $cAdmin = "$default->graphicsUrl/leftnav/cadmin.gif" ;
97 97 $uAdmin = "$default->graphicsUrl/leftnav/uadmin.gif" ;
98 98  
  99 +$oUnitAdmin = getUnitAdminUser();
  100 +$sUnitAdminEmail = $oUnitAdmin ? $oUnitAdmin->getEmail() : $default->emailAdmin;
99 101 //setup the westpayload
100 102 $westLoad = "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\" height=\"75%\">\n" .
101 103 "\t<tr><td>$westRender</td></tr>\n" .
102 104 "</table>" .
103 105 "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\" height=\"25%\">\n" .
104 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 108 "</table>";
107 109  
108 110 $westPayLoad = new PatternCustom;
... ...