$nDir = $direction == 'ASC' ? 'DESC' : 'ASC';
Dzięki
if ($_SESSION[$page_action_href . '_orderby_direction'] == 'ASC') { $nDir = 'ASC'; } else { $nDir = 'DESC'; } } else { $nDir = 'ASC'; }
$nDir = (isset($_SESSION[$page_action_href . '_orderby_direction'])) ? (($_SESSION[$page_action_href . '_orderby_direction'] == 'ASC') ? $nDir = 'ASC' : $nDir = 'DESC') : $nDir = 'ASC';
<?php $page_action_href = 'hdd_list'; $nDir = (isset($_SESSION[$page_action_href . '_orderby_direction'])) ? (($_SESSION[$page_action_href . '_orderby_direction'] == 'DESC') ? $nDir = 'ASC' : $nDir = 'DESC') : $nDir = 'ASC'; $hdd_object = $hdd->get_hdd_list( $_SESSION[$page_action_href . '_limit'], ($_GET['page'] - 1) * $_SESSION[$page_action_href . '_limit'], isset($_SESSION[$page_action_href . '_orderby']) ? $_SESSION[$page_action_href . '_orderby'] : null, isset( $_SESSION[$page_action_href . '_orderby_direction'] ) ? $_SESSION[$page_action_href . '_orderby_direction'] : null ); if ( $_GET['page'] > 1) { $k = ( $_SESSION[$page_action_href . '_limit'] ) * ( $_GET['page'] - 1 ) + 1; } else { $k = 1 ; } echo "<span class=\"huge user_data width_15 right\"> " . implode($hdd->count_hdd_capacity( $_SESSION[$page_action_href . '_limit'], ($_GET['page'] - 1) * $_SESSION[$page_action_href . '_limit'], isset($_SESSION[$page_action_href . '_orderby']) ? $_SESSION[$page_action_href . '_orderby'] : null , isset( $_SESSION[$page_action_href . '_orderby_direction'] ) ? $_SESSION[$page_action_href . '_orderby_direction'] : null )) . " TB</span>" ; echo "<div class=\"dvr_list\" onClick=\"changeOrderBy( 'hdd_vendor', '$nDir', '$page_action_href' );\">Producent</div>"; echo "<div class=\"dvr_list\" onClick=\"changeOrderBy( 'hdd_model_name', '$nDir', '$page_action_href' );\">Model</div>"; echo "<div class=\"dvr_list\" onClick=\"changeOrderBy( 'hdd_sn', '$nDir', '$page_action_href' );\">Numer Seryjny</div>"; echo "<div class=\"dvr_list\" onClick=\"changeOrderBy( 'hdd_capacity', '$nDir', '$page_action_href' );\">Pojemność</div>"; echo "<div class=\"dvr_list\" onClick=\"changeOrderBy( 'hdd_status', '$nDir', '$page_action_href' );\">Status</div>"; echo "<div class=\"dvr_list\" onClick=\"changeOrderBy( 'hdd_dvr_id', '$nDir', '$page_action_href' );\">Rejestrator</div>"; foreach ($hdd_object as $hdd_object) { echo "<div class=\"dvr_list icon\"><a href=\"../panel/index.php?action=hdd_edit_page&edit=" . $dvr->encrypt_decrypt_passwd('encrypt', $hdd_object['hdd_id']) . "_" . $dvr->encrypt_decrypt_passwd('encrypt', $hdd_object['hdd_sn']) . "\">"; include "" . $_SERVER['DOCUMENT_ROOT'] . "/images/icons/edit.svg"; } ?> <script src="../../js/logged_in_scripts.js"></script>