$ord = "DESC"; if ($sortOrder == 'CountryCode' || $sortOrder == 'intName') { $ord = "ASC"; } $sortOrderFinal = $sortOrder; $filter_clause = $_SESSION["filter_clause"]; $where_clause .= $filter_clause; //----------------------------------------------------------------------------------------------------------- $query = "SELECT {$clubsTable}.* , count({$clubsPilotsTable}.pilotID) as pilotsCount\n\tFROM {$clubsPilotsTable},{$clubsTable} \n\tWHERE {$clubsPilotsTable}.clubID={$clubsTable}.ID \n" . $where_clause . " GROUP BY {$clubsTable}.ID ORDER BY {$sortOrderFinal} " . $ord . " "; // echo $query; $res = $db->sql_query($query); if ($res <= 0) { echo "no takeoffs found <br>"; return; } listTakeoffs($res, $legend, $query_str, $sortOrder); function printHeaderTakeoffs($width, $headerSelectedBgColor, $headerUnselectedBgColor, $sortOrder, $fieldName, $fieldDesc, $query_str) { global $moduleRelPath; global $Theme; if ($width == 0) { $widthStr = ""; } else { $widthStr = "width='" . $width . "'"; } if ($sortOrder == $fieldName) { echo "<td {$widthStr} bgcolor='{$headerSelectedBgColor}'>\n\t\t<div class='whiteLetter' align=left>\n\t\t<a href='" . CONF_MODULE_ARG . "&op=list_takeoffs&sortOrder={$fieldName}{$query_str}'>{$fieldDesc}<img src='{$moduleRelPath}/img/icon_arrow_down.png' border=0 width=10 height=10></div></td>"; } else { echo "<td {$widthStr} bgcolor='{$headerUnselectedBgColor}'>\n\t\t<div align=left>\n\t\t<a href='" . CONF_MODULE_ARG . "&op=list_takeoffs&sortOrder={$fieldName}{$query_str}'>{$fieldDesc}</div></td>"; } }
$where_clause .= $where_clause_country; //----------------------------------------------------------------------------------------------------------- $query = "SELECT DISTINCT takeoffID, name, intName, " . $waypointsTable . ".countryCode, count(*) as FlightsNum, max(LINEAR_DISTANCE) as max_distance \n \t\t\tFROM {$flightsTable},{$waypointsTable} {$extra_table_str}\n \t\t\tWHERE {$flightsTable}.takeoffID={$waypointsTable}.ID \n\t\t\tAND {$flightsTable}.userID<>0 " . $where_clause . " \n\t\t\tGROUP BY takeoffID ORDER BY {$sortOrderFinal} " . $ord . ",max_distance DESC"; // echo $query; $res = $db->sql_query($query); if ($res <= 0) { echo "no takeoffs found<br>"; return; } $legendRight = ""; if (0) { echo "<div class='tableTitle shadowBox'>\n <div class='titleDiv'>{$legend}</div>\n <div class='pagesDiv'>{$legendRight}</div>\n </div>"; } require_once dirname(__FILE__) . "/MENU_second_menu.php"; echo "<div class='list_header'>\n\t\t\t\t<div class='list_header_r'></div>\n\t\t\t\t<div class='list_header_l'></div>\n\t\t\t\t<h1>{$legend}</h1>\n\t\t\t\t<div class='pagesDiv'>{$legendRight}</div>\n\t\t\t</div>"; listTakeoffs($res, $legend, $queryExtraArray, $sortOrder); ?> <script type="text/javascript" src="<?php echo $moduleRelPath; ?> /js/tipster.js"></script> <?php echo makeTakeoffPopup(); function printHeaderTakeoffs($width, $sortOrder, $fieldName, $fieldDesc, $queryExtraArray) { global $moduleRelPath, $Theme; if ($width == 0) { $widthStr = ""; } else { $widthStr = "width='" . $width . "'"; }