$period = $_SESSION[$session_page]['period']; if (isset($_POST['period'])) { $period = tep_db_prepare_input($_POST['period']); } if (is_null($period) || !array_key_exists($period, $period_options)) { $period_keys = array_keys($period_options); $period = $period_keys[0]; } $_SESSION[$session_page]['period'] = $period; $period_opt = '<select name="period">'; foreach ($period_options as $value => $option) { $sel = $period == $value ? 'selected="selected"' : ''; $period_opt .= '<option value="' . $value . '" ' . $sel . '>' . $option . '</option>'; } $period_opt .= '</select>'; $wh_lists = $class_jw->retrieveList(); $wh_options = array(); foreach ($wh_lists as $wh) { $wh_options[$wh['jng_warehouses_id']] = $wh['name']; } $jng_warehouses_id = $_SESSION[$session_page]['jng_warehouses_id']; if (isset($_POST['warehouse'])) { $jng_warehouses_id = tep_db_prepare_input($_POST['warehouse']); } if (!array_key_exists($jng_warehouses_id, $wh_options)) { $jng_warehouses_id = $wh_options[0]; } if (is_null($jng_warehouses_id) || !array_key_exists($jng_warehouses_id, $wh_options)) { $wh_keys = array_keys($wh_options); $jng_warehouses_id = $wh_keys[0]; }
<?php use_class('jng_warehouses'); $class_jw = new jng_warehouses(); //START TEMPLATE $filter = ''; $order = "jng_warehouses_id"; $warehouses = $class_jw->retrieveList($filter, $order); $g = array(); $g['id'] = 'ID'; $g['name'] = 'Name'; $g['long_id'] = 'Code'; $g['source'] = 'Type'; //$g['nick'] = 'PIC'; //$g['city'] = 'City'; $g['act'] = 'Status'; $wh_table[] = $g; if (count($warehouses) > 0) { foreach ($warehouses as $row) { $detail = '?open=warehouse&id=' . $row['jng_warehouses_id'] . '&hidemenu=true'; $g = array(); $g['id'] = '<a href="' . $detail . '" class="view_webpage" title="Manage warehouse detail">' . $row['jng_warehouses_id'] . '</a>'; $g['name'] = '<a href="' . $detail . '" class="view_webpage" title="Manage warehouse detail">' . $row['name'] . '</a>'; $g['long_id'] = $row['warehouse_code']; $g['source'] = $class_jw->typeName($row['warehouse_type']); //$g['nick'] = '<a href="'.$row['pic'].'">'.$row['pic'].'</a>'; //$g['city'] = $row['address_city']; $g['act'] = '<img src="images/icon-tick' . ($row['is_active'] == '1' ? '' : '-dis') . '.png" />'; $wh_table[] = $g; } } else {