function browsingMenu($dbconn, $current, $content = 'default') { $params = build_qs(array(), 'offset', null); $rv = ""; if ($content == 'both' || $content == 'default' || $content == 'locations') { if ($content == 'locations') { $arr = array('byname' => "Global"); } else { $arr = array('byname' => "By Name", 'bydept' => "By Team", 'byoffice' => "By Office", 'hier' => "By Org", 'random' => "Random"); } foreach ($arr as $k => $v) { if ($content == 'default') { $url = build_url(build_qs($params, 'index', $k), "./"); } else { $url = build_url(build_qs($params, 'index', $k)); } $lab = $arr[$k]; if (strlen($rv)) { $rv = "{$rv} "; } if ($current == $k) { $class = 'activefilter'; } else { $class = 'inactivefilter'; } $rv = "{$rv} | <a class=\"{$class} filteroption\" href=\"{$url}\"> {$lab} </a> "; } $rv .= " |"; } $sitelimit = ""; if ($content == 'both' || $content == 'locations') { $query = "\n\t\t\tWITH occupied_offices AS (\n\t\t\t SELECT DISTINCT\n\t\t\t physical_address_id\n\t\t\t FROM\n\t\t\t person_location\n\t\t\t INNER JOIN\n\t\t\t v_corp_family_account\n\t\t\t USING\n\t\t\t (person_id)\n\t\t\t WHERE\n\t\t\t is_enabled = 'Y'\n\t\t\t)\n\t\t\tSELECT\n\t\t\t physical_address_id,\n\t\t\t display_label\n\t\t\tFROM\n\t\t\t physical_address\n\t\t\tINNER JOIN\n\t\t\t occupied_offices\n\t\t\tUSING\n\t\t\t (physical_address_id)\n\t\t\tWHERE\n\t\t\t physical_address_type = 'location'\n\t\t\tORDER BY \n\t\t\t display_label\n\t\t"; $result = pg_query($dbconn, $query) or die('Query failed: ' . pg_last_error()); $params = build_qs(null, 'offset', null); # used to have the site limiter in the menubar $label = ""; while ($row = pg_fetch_array($result, null, PGSQL_ASSOC)) { if (isset($_GET['physical_address_id']) && $_GET['physical_address_id'] == $row['physical_address_id']) { $class = 'activefilter'; $label = $row['display_label']; } else { $class = 'inactivefilter'; } $url = build_url(build_qs($params, 'physical_address_id', $row['physical_address_id'])); $lab = $row['display_label']; $sitelimit = "{$sitelimit} | <a class=\"{$class} limitsiterow\" href=\"{$url}\"> {$lab} </a>"; } $sitelimit .= "|"; if (isset($_GET['physical_address_id'])) { $url = build_url(build_qs($params, 'physical_address_id', null)); $lab = '| Clear'; $return = "{$return} <a class=\"inactivefilter limitsiterow\" href=\"{$url}\"> {$lab} </a> "; } $rv = "{$rv} <a class=\"{$class} filteroption locationfilter\"> </a>"; } return "<div class=filterbar>{$rv}</div> <div class=\"sitelimit \">{$sitelimit}</div>"; }
"> FIRST </a> // <?php $qs = build_url(build_qs(null, 'offset', $offset - 1)); ?> <a href="<?php echo $qs; ?> "> PREV </a> // <?php } if ($numpages) { $qs = build_url(build_qs(null, 'offset', $offset + 1)); ?> <a href="<?php echo $qs; ?> "> NEXT </a> <?php $qs = build_url(build_qs(null, 'offset', $numpages)); ?> // <a href="<?php echo $qs; ?> "> LAST </a> <?php } echo "</div>\n"; } } else { echo browsingMenu($dbconn, $index); echo "<h3> Browse by Functional Team </h3>\n"; echo "<div class=teamlist><ul>\n"; while ($row = pg_fetch_array($result, null, PGSQL_ASSOC)) { echo "<li>" . hierlink('team', $row['account_collection_id'], $row['account_collection_name']) . "</li>\n"; }