diff --git a/presentation/webpageTemplate.inc b/presentation/webpageTemplate.inc index b81b50e..30cbac3 100644 --- a/presentation/webpageTemplate.inc +++ b/presentation/webpageTemplate.inc @@ -19,7 +19,7 @@ require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.i require_once("$default->fileSystemRoot/lib/visualpatterns/NavBar.inc"); -function getUnitAdminEmail() { +function getUnitAdminUser() { global $default; // find out what unit we're in $iUnitID = User::getUnitID($_SESSION["userID"]); @@ -35,19 +35,19 @@ function getUnitAdminEmail() { if ($sql->next_record()) { $iGroupID = $sql->f("group_id"); // then find the first user in this group that has an email address - if ($sql->query("SELECT U.email FROM $default->owl_users_table U " . + if ($sql->query("SELECT U.id, U.email FROM $default->owl_users_table U " . "INNER JOIN $default->owl_users_groups_table UGL on UGL.user_id=U.id " . "WHERE group_id=$iGroupID")) { while ($sql->next_record()) { if (strlen($sql->f("email")) > 0) { - $sEmail = $sql->f("email"); + return User::get($sql->f("id")); } } } } } } - return ($sEmail == "") ? $default->emailAdmin : $sEmail; + return false; } // create the navbar and north payload @@ -96,13 +96,15 @@ if ($sectionName != "General") { $cAdmin = "$default->graphicsUrl/leftnav/cadmin.gif" ; $uAdmin = "$default->graphicsUrl/leftnav/uadmin.gif" ; +$oUnitAdmin = getUnitAdminUser(); +$sUnitAdminEmail = $oUnitAdmin ? $oUnitAdmin->getEmail() : $default->emailAdmin; //setup the westpayload $westLoad = "\n" . "\t\n" . "
$westRender
" . "\n" . "\t\n" . - "\t\n" . + "\t\n" . "
emailAdmin\">
"; $westPayLoad = new PatternCustom;