function tzs_city_to_str($country_id, $region_id, $city_id, $def, $title = '') { $def = htmlspecialchars($def); if ($city_id != NULL && $city_id > 0) { return '<span title="' . ($title !== '' ? $title : $def) . '"><strong>' . htmlspecialchars(tzs_get_city($city_id)) . '</strong>' . ($region_id != NULL && $region_id > 0 && $region_id != 20070188 ? '<br>' . htmlspecialchars(tzs_get_region($region_id)) : '') . ($country_id != 23424976 ? ' (' . htmlspecialchars(tzs_get_country_code($country_id)) . ')' : '') . '</span>'; } elseif ($region_id != NULL && $region_id > 0) { return "<span title=\"{$def}\">" . htmlspecialchars(tzs_get_region($region_id)) . " (" . htmlspecialchars(tzs_get_country_code($country_id)) . ")</span>"; } elseif ($country_id != NULL && $country_id > 0) { return "<span title=\"{$def}\">" . htmlspecialchars(tzs_get_country($country_id)) . "</span>"; } else { return "<span>" . $def . "</span>"; } }
function tzs_tr_sh_table_record_out($row, $form_type, $profile_td_text = null) { // $user_info = tzs_get_user_meta($row->user_id); if ($form_type === 'shipments') { $prefix = 'sh'; } else { $prefix = 'tr'; } $type = trans_types_to_str($row->trans_type, $row->tr_type); $path_segment_cities = explode(";", $row->path_segment_cities); //$cost = tzs_cost_to_str($row->cost, true); $cost = tzs_price_query_to_str($row); $dt_created = convert_time($row->time, "d.m.Y (Hч:iмин)"); $dt_created = explode(" ", $dt_created); if ($row->dt_pickup != '0000-00-00 00:00:00') { $dt_pickup = convert_time($row->dt_pickup, "d.m.Y (Hч:iмин)"); $dt_pickup = explode(" ", $dt_pickup); } else { $dt_pickup = ''; } // Определение статуса записи $output_tbody = '<tr rid="' . $row->id . '"'; if ($row->top_status == 2) { $output_tbody .= $row->order_status == 1 ? ' class="vip_top_record"' : ($profile_td_text && $row->order_status !== null && $row->order_status == 0 ? ' class="pre_vip_top_record"' : ''); } else { if ($row->top_status == 1) { $output_tbody .= ' class="top_record"'; } else { } } $output_tbody .= '>'; if ($profile_td_text == 'no') { $output_tbody .= '<td><input type="radio" order-status="' . ($row->order_status == null ? '' : $row->order_status) . '" top-status="' . $row->top_status . '" order-id="' . $row->order_id . '" record-active="' . $row->active . '" id="r_table_record_id" name="r_table_record_id" value="' . $row->id . '"'; if (isset($_POST['table_record_id']) && $_POST['table_record_id'] == "{$row->id}") { $output_tbody .= 'checked="checked"'; } $output_tbody .= '></td>'; } /* <div class="record_number"> <span class="middle" title="Номер заявки"> № '.$row->id.' </span> </div><br> */ $output_tbody .= ' <td> <div class="date_label" title="Дата публикации заявки"> ' . $dt_created[0] . ' </div> <div class="time_label" title="Время публикации заявки"> ' . str_replace(':', ' : ', $dt_created[1]) . ' </div><br>'; if ($dt_pickup != '') { $output_tbody .= '<div class="date_label" title="Дата бесплатного поднятия заявки в ТОП"> ' . $dt_pickup[0] . ' </div> <div class="time_label" title="Время бесплатного поднятия заявки в ТОП"> ' . str_replace(':', ' : ', $dt_pickup[1]) . ' </div>'; } $output_tbody .= '</td> <td style="min-width: 260px; width: 260px;"> <div class="tbl_trucks_path_td"> <div class="city_label">' . htmlspecialchars(tzs_get_city($row->from_sid)) . (count($path_segment_cities) > 2 ? '...' : '') . '</div> <div class="country_flag"><img id ="first_city_flag" src="/wp-content/plugins/tzs/assets/images/flags/' . $row->from_code . '.png" width=18 height=12 alt=""></div> </div> <div class="tbl_trucks_dtc_td"> <div class="date_from_label" title="Дата погрузки"> ' . convert_date_year2($prefix === 'tr' ? $row->tr_date_from : $row->sh_date_from) . '<br/> </div> </div> <div class="tbl_trucks_path_td"> <div class="region_label">' . ($row->from_rid != NULL && $row->from_rid > 0 && $row->from_rid != 20070188 ? str_replace('область', 'обл.', htmlspecialchars(tzs_get_region($row->from_rid))) : ' ') . '</div> </div> <div class="tbl_distance_td2"> <div class="distance_label"> '; if ($row->distance > 0 && $prefix === 'tr') { //$output_tbody .= ' расстояние '.tzs_make_distance_link($row->distance, false, array($row->tr_city_from, $row->tr_city_to)); $output_tbody .= ' расстояние ' . tzs_make_distance_link($row->distance, false, explode(";", $row->path_segment_cities)); } else { if ($row->distance > 0 && $prefix === 'sh') { //$output_tbody .= ' расстояние '.tzs_make_distance_link($row->distance, false, array($row->sh_city_from, $row->sh_city_to)); $output_tbody .= ' расстояние ' . tzs_make_distance_link($row->distance, false, explode(";", $row->path_segment_cities)); } } $output_tbody .= ' (см. карту)</div>'; $output_tbody .= ' </div> <div class="tbl_trucks_path_td"> <div class="city_label">' . (count($path_segment_cities) > 2 ? '...' : '') . htmlspecialchars(tzs_get_city($row->to_sid)) . '</div> <div class="country_flag"><img id ="second_city_flag" src="/wp-content/plugins/tzs/assets/images/flags/' . $row->to_code . '.png" width=18 height=12 alt=""></div> </div> <div class="tbl_trucks_dtc_td"> <div class="date_to_label" title="Дата выгрузки"> ' . convert_date_year2($prefix === 'tr' ? $row->tr_date_to : $row->sh_date_to) . ' </div> </div> <div class="tbl_trucks_path_td"> <div class="region_label">' . ($row->to_rid != NULL && $row->to_rid > 0 && $row->to_rid != 20070188 ? str_replace('область', 'обл.', htmlspecialchars(tzs_get_region($row->to_rid))) : ' ') . '</div>'; if ($row->cash + $row->nocash + $row->way_ship + $row->way_debark + $row->soft + $row->way_prepay > 5) { $output_tbody .= '<div> <div>'; } $output_tbody .= ' </div> </td>'; if ($prefix === 'sh') { $output_tbody .= '<td> <div title="Тип груза">' . (isset($GLOBALS['tzs_sh_types'][$row->sh_type]) ? $GLOBALS['tzs_sh_types'][$row->sh_type] : '') . '</div><br> <div class="tr_type_label" title="Тип транспортного средства">' . $type . '</div> </td>'; $output_tbody .= '<td><div>'; if ($row->tr_weight > 0 || $row->sh_weight > 0) { $output_tbody .= '<span title="Вес груза">' . remove_decimal_part($prefix === 'tr' ? $row->tr_weight : $row->sh_weight) . ' т</span><br>'; } if ($row->tr_volume > 0 || $row->sh_volume > 0) { $output_tbody .= '<span title="Объем груза">' . remove_decimal_part($prefix === 'tr' ? $row->tr_volume : $row->sh_volume) . ' м³</span>'; } $output_tbody .= '</div></td> <td><div title="Описание груза">' . $row->sh_descr . '</div></td>'; } else { $output_tbody .= '<td> <div class="tr_type_label" title="Тип транспортного средства">' . $type . '</div> </td> <td><div title="Описание транспортного средства">'; $tr_ds1 = ''; $tr_ds2 = ''; if ($row->tr_length > 0) { $tr_ds1 .= 'Д'; $tr_ds2 .= intval($row->tr_length); } if ($row->tr_width > 0) { if ($tr_ds1 !== '') { $tr_ds1 .= 'x'; } if ($tr_ds2 !== '') { $tr_ds2 .= 'x'; } $tr_ds1 .= 'Ш'; $tr_ds2 .= intval($row->tr_width); } if ($row->tr_height > 0) { if ($tr_ds1 !== '') { $tr_ds1 .= 'x'; } if ($tr_ds2 !== '') { $tr_ds2 .= 'x'; } $tr_ds1 .= 'В'; $tr_ds2 .= intval($row->tr_height); } if ($tr_ds1 !== '' && $tr_ds2 !== '') { $output_tbody .= $tr_ds1 . ': ' . $tr_ds2 . ' м<br>'; } if ($row->tr_weight > 0) { $output_tbody .= remove_decimal_part($row->tr_weight) . ' т<br>'; } if ($row->tr_volume > 0) { $output_tbody .= remove_decimal_part($row->tr_volume) . ' м³<br>'; } if ($row->tr_descr && strlen($row->tr_descr) > 0) { $output_tbody .= $row->tr_descr . '<br>'; } $output_tbody .= '</div></td> <td><div title="Желаемый груз">' . $row->sh_descr . '</div></td>'; } $output_tbody .= '<td>'; //if ($row->price > 0) { // round($row->price / $row->distance, 2).' '.$GLOBALS['tzs_curr'][$row->price_val]. // number_format($row->cost, 0, '.', ' ').' '.$GLOBALS['tzs_curr'][$row->price_val].'<div><br> // $row->price.' '.$GLOBALS['tzs_curr'][$row->price_val]. // '/км)</div>'; $output_tbody .= '<div class="price_label" title="Стоимость перевозки груза">' . $cost[0] . '<div><br>'; if (strlen($cost[1]) > 0) { $output_tbody .= '<div class="cost_label" title="Цена за 1 км перевозки груза">(' . $cost[1] . ')</div>'; } //} else { // $output_tbody .= '<div class="price_label" title="Стоимость перевозки груза">'.$cost[0].'</div>'; //} // <div class="payment_label" title="Форма оплаты услуг по перевозке груза">'.$cost[1].'</div> $output_tbody .= ' </td> <td> <div class="payment_label" title="Форма оплаты услуг по перевозке груза">' . str_replace(', ', ',<br>', $cost[2]) . '</div> </td>'; //<div class="payment_label" title="Форма оплаты услуг по перевозке груза">'.str_replace(', ', ',<br>', $cost[1]).'</div> if ($prefix === 'tr') { //$output_tbody .= '<td><div title="Комментарии">'.$row->comment.'</div></td>'; } if ($profile_td_text == 'no') { $output_tbody .= ''; } else { if ($profile_td_text) { $output_tbody .= '<td>' . $profile_td_text . '</td>'; } else { $output_tbody .= '<td>' . tzs_print_user_contacts($row, $form_type, 0) . '</td>'; } } $output_tbody .= '</tr>'; return $output_tbody; }