function tzs_front_end_view_firms_handler($atts) { ob_start(); global $wpdb; $user_id = get_current_user_id(); $sh_id = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : 0; $form_type = $_GET['type']; //echo "pr-".$form_type."-"; //$sh_id=7; if ($sh_id <= 0) { print_error('Информация не найден'); } else { $sql = "SELECT * FROM wp_usermeta WHERE user_id={$sh_id}"; $row = $wpdb->get_row($sql); if (count($row) == 0 && $wpdb->last_error != null) { print_error('Не удалось отобразить информацию о товаре/услуге. Свяжитесь, пожалуйста, с администрацией сайта.'); } else { if ($row == null) { print_error('Пользователь не найден'); } else { if (isset($_GET['spis'])) { echo "<a id='edit_search' href='/account/my-products/'>Назад к списку</a>"; } else { echo "<button id='edit_search' onclick='history.back()'>Назад к списку</button>"; } ?> <script src="/wp-content/plugins/tzs/assets/js/table_reload.js"></script> <div style='clear: both'> <br /> <div class="container-fluid"> <div class="row-fluid" > <div class="span4" id=""> <div class="well well-large"> <?php $logo = get_user_meta($row->user_id, 'company_logo', true); ?> <img src="<?php echo $logo; ?> "/> </div> </div> <div class="span8"> <div class="well well-large" id="company-contact"> <?php //echo tzs_print_user_table_ed($row->user_id); // $form_type = get_param_def('form_type', ''); echo tzs_print_user_contacts($row, $form_type, 2); ?> </div> </div> </div> <div class="row-fluid"> <div class="span12" id=""> <div class="well well-large"> <?php $desc = get_user_meta($row->user_id, 'company_description', true); echo $desc; ?> </div> </div> </div> <div class="row-fluid"> <div class="span12" id=""> <?php if ($form_type == 'products') { echo do_shortcode('[tzs-view-user-products user_id=' . $row->user_id . ']'); } ?> <?php if ($form_type == 'shipments') { echo do_shortcode('[tzs-view-user-shipments user_id=' . $row->user_id . ']'); } ?> <?php if ($form_type == 'trucks') { echo do_shortcode('[tzs-view-user-trucks user_id=' . $row->user_id . ']'); } ?> </div> </div> </div> <script> jQuery('document').ready(function(){ var title=document.getElementsByClassName('entry-title'); if (document.getElementById('company-name')) { var company=document.getElementById('company-name').innerHTML; title[0].innerHTML=company; } }); </script> <?php } } } $output = ob_get_contents(); ob_end_clean(); return $output; }
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; }
function tzs_front_end_view_shipment_handler($atts) { ob_start(); global $wpdb; $user_id = get_current_user_id(); $sh_id = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : 0; if ($sh_id <= 0) { print_error('Груз не найден'); } else { $sql = "SELECT * FROM " . TZS_SHIPMENT_TABLE . " WHERE id={$sh_id};"; $row = $wpdb->get_row($sql); if (count($row) == 0 && $wpdb->last_error != null) { print_error('Не удалось отобразить информацию о грузе. Свяжитесь, пожалуйста, с администрацией сайта'); } else { if ($row == null) { print_error('Груз не найден'); } else { $type = isset($GLOBALS['tzs_tr_types'][$row->trans_type]) ? $GLOBALS['tzs_tr_types'][$row->trans_type] : ""; $sh_type = isset($GLOBALS['tzs_sh_types'][$row->sh_type]) ? $GLOBALS['tzs_sh_types'][$row->sh_type] : ""; $path_segment_cities = explode(";", $row->path_segment_cities); $loading_types = tzs_loading_types_to_str($row); ?> <script src="/wp-content/plugins/tzs/assets/js/distance.js"></script> <div id="contact-block-right" style="left: 82%;"> <div class="span2" style="width: 80%;"> <?php echo "<img src='" . get_user_meta($row->user_id, 'company_logo', true) . "' width='145px'/>"; $form_type = 'shipments'; echo tzs_print_user_contacts($row, $form_type); ?> <?php if (isset($_GET['spis'])) { echo "<a id='edit_search' href='/account/my-shipments/'>Назад к списку</a> <div style='clear: both'></div>"; } elseif (isset($_GET['link'])) { echo "<a id='edit_search' href='/" . $_GET['link'] . (isset($_GET['active']) ? "/?active=" . $_GET['active'] : "/") . "'>Назад к списку</a> <div style='clear: both'></div>"; } else { echo "<button id='edit_search' onclick='history.back()'>Назад к списку</button> <div style='clear: both'></div>"; } ?> <?php if ($user_id == $row->user_id) { ?> <div style="margin-top: 15px;"> <a id="view_edit" onClick="javascript: window.location.href = '/account/edit-shipment/?id=<?php echo $row->id; ?> ';">Изменить</a> </div> <?php } ?> </div> </div> <div class="container" id="product-container"> <div class="row-fluid" > <div class="span4" id="img_kart"> <div class="well well-large"> <div class="pull-left label-txt"> <label><strong>Номер груза:</strong></label> </div> <div class="pull-left"> <?php echo $row->id; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Активно:</strong></label> </div> <div class="pull-left"> <?php echo $row->active == 1 ? 'Да' : 'Нет'; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Дата размещения:</strong></label> </div> <div class="pull-left"> <?php echo convert_time($row->time); ?> </div> <div class="clearfix"></div> <?php if ($row->last_edited != null) { ?> <div class="pull-left label-txt"> <label><strong>Дата <!--последнего -->изменения:</strong></label> </div> <div class="pull-left"> <?php echo convert_time($row->last_edited); ?> </div> <div class="clearfix"></div> <?php } ?> </div> </div> <div class="span6" id="descript"> <div class="well well-large"> <div class="pull-left label-txt"> <label><strong>Дата погрузки:</strong></label> </div> <div class="pull-left"> <?php echo convert_date($row->sh_date_from); ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Дата выгрузки:</strong></label> </div> <div class="pull-left"> <?php echo convert_date($row->sh_date_to); ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Пункт погрузки:</strong></label> </div> <div class="pull-left" id="bet_label"> <?php echo tzs_city_to_str($row->from_cid, $row->from_rid, $row->from_sid, $row->sh_city_from); ?> </div> <div class="clearfix"></div> <?php if (count($path_segment_cities) > 2) { ?> <div class="pull-left label-txt"> <label><strong>Промежуточные<br>пункты:</strong></label> </div> <div class="pull-left"> <?php for ($i = 1; $i < count($path_segment_cities) - 1; $i++) { echo $path_segment_cities[$i] . "<br>"; } ?> </div> <div class="clearfix"></div> <?php } ?> <div class="pull-left label-txt"> <label><strong>Пункт выгрузки:</strong></label> </div> <div class="pull-left"> <?php echo tzs_city_to_str($row->to_cid, $row->to_rid, $row->to_sid, $row->sh_city_to); ?> </div> <div class="clearfix"></div> <?php if ($row->distance > 0) { ?> <div class="pull-left label-txt"> <label><strong>Расстояние:</strong></label> </div> <div class="pull-left"> <?php echo tzs_make_distance_link($row->distance, false, $path_segment_cities); ?> </div> <div class="clearfix"></div> <?php } ?> <?php if (strlen($sh_type) > 0) { ?> <div class="pull-left label-txt"> <label><strong>Тип груза:</strong></label> </div> <div class="pull-left"> <?php echo $sh_type; ?> </div> <div class="clearfix"></div> <?php } ?> <div class="pull-left label-txt"> <label><strong>Описание груза:</strong></label> </div> <div class="pull-left"> <?php echo htmlspecialchars($row->sh_descr); ?> </div> <div class="clearfix"></div> <?php if ($row->sh_weight > 0) { ?> <div class="pull-left label-txt"> <label><strong>Вес:</strong></label> </div> <div class="pull-left"> <?php echo $row->sh_weight; ?> т </div> <div class="clearfix"></div> <?php } ?> <?php if ($row->sh_volume > 0) { ?> <div class="pull-left label-txt"> <label><strong>Объем:</strong></label> </div> <div class="pull-left"> <?php echo $row->sh_volume; ?> м³ </div> <div class="clearfix"></div> <?php } ?> <div class="pull-left label-txt"> <label><strong>Количество машин:</strong></label> </div> <div class="pull-left"> <?php echo $row->trans_count; ?> </div> <div class="clearfix"></div> <?php if (strlen($type) > 0) { ?> <div class="pull-left label-txt"> <label><strong>Тип транспорта:</strong></label> </div> <div class="pull-left"> <?php echo $type; ?> </div> <div class="clearfix"></div> <?php } ?> <?php if ($row->sh_length > 0 || $row->sh_height > 0 || $row->sh_width > 0) { ?> <div class="pull-left label-txt"> <label><strong>Габариты:</strong></label> </div> <div class="pull-left" style="width: 60%"> Длина = <?php echo $row->sh_length; ?> м<br>Ширина = <?php echo $row->sh_width; ?> м<br>Высота = <?php echo $row->sh_height; ?> м </div> <div class="clearfix"></div> <?php } ?> <?php if (strlen($loading_types) > 0) { ?> <div class="pull-left label-txt"> <label><strong>Загрузка:</strong></label> </div> <div class="pull-left" style="width: 60%"> <?php echo str_replace(', ', ',<br>', $loading_types); ?> </div> <div class="clearfix"></div> <?php } ?> <?php //$cost = tzs_cost_to_str($row->cost); $cost = tzs_price_query_to_str($row); if (count($cost) > 0) { ?> <div class="pull-left label-txt"> <label><strong>Цена:</strong></label> </div> <div class="pull-left" style="width: 60%"> <?php echo $cost[0]; ?> <?php echo $cost[1] ? ' (' . $cost[1] . ')' : ''; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Форма оплаты:</strong></label> </div> <div class="pull-left" style="width: 60%"> <?php echo str_replace(', ', ',<br>', $cost[2]); ?> </div> <div class="clearfix"></div> <?php } ?> </div> </div> </div> </div> <script> function promptDelete(id) { jQuery('<div></div>').appendTo('body') .html('<div><h6>Удалить запись '+id+'?</h6></div>') .dialog({ modal: true, title: 'Удаление', zIndex: 10000, autoOpen: true, width: 'auto', resizable: false, buttons: { 'Да': function () { jQuery(this).dialog("close"); doDelete(id); }, 'Нет': function () { jQuery(this).dialog("close"); } }, close: function (event, ui) { jQuery(this).remove(); } }); } function doDelete(id) { var data = { 'action': 'tzs_delete_shipment', 'id': id }; jQuery.post(ajax_url, data, function(response) { if (response == '1') { window.open('/account/my-shipments/', '_self'); } else { alert('Не удалось удалить: '+response); } }); } </script> <?php } } } $output = ob_get_contents(); ob_end_clean(); return $output; }
function tzs_front_end_view_productsd_handler($atts) { ob_start(); global $wpdb; $user_id = get_current_user_id(); $sh_id = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : 0; if ($sh_id <= 0) { print_error('Товарр не найден'); } else { $sql = "SELECT * FROM " . TZS_PRODUCTS_TABLE . " WHERE id={$sh_id};"; $row = $wpdb->get_row($sql); if (count($row) == 0 && $wpdb->last_error != null) { print_error('Не удалось отобразить информацию о товаре. Свяжитесь, пожалуйста, с администрацией сайта.'); } else { if ($row == null) { print_error('Товар не найден'); } else { ?> <script src="/wp-content/plugins/tzs/assets/js/table_reload.js"></script> <!-- <div style='clear: both'> <br /> --> <?php $active = " AND active=1"; $userid = " AND user_id=" . $user_id; $sql = "SELECT COUNT(*) FROM " . TZS_PRODUCT_RATES_TABLE . " WHERE product_id={$sh_id} {$userid} {$active}"; /*$max = $wpdb->get_results($sql); */ $cnt_rate = $wpdb->get_var($sql); // Отбор ставок по тендеру - active=1 AND $sql = "SELECT MAX(rate) FROM " . TZS_PRODUCT_RATES_TABLE . " WHERE product_id={$sh_id} {$userid} {$active}"; /*$max = $wpdb->get_results($sql); */ $max_rate = $wpdb->get_var($sql); if ($max_rate > 0) { echo "<input id='act_rate_user' style='display: none;' value=" . round($max_rate, 2) . " />"; } else { echo "<input id='act_rate_user' style='display: none;' value=" . $row->price . " />"; } $rate = " AND rate=" . $max_rate; $sql = "SELECT * FROM " . TZS_PRODUCT_RATES_TABLE . " WHERE product_id={$sh_id} {$userid} {$active} {$rate}"; /*$max = $wpdb->get_results($sql); */ $descrip = $wpdb->get_results($sql); ?> <div id="contact-block-right" style="left: 82%;"> <div class="span2" style="width: 80%;"> <?php echo "<img width='145' height='95' src='" . get_user_meta($row->user_id, 'company_logo', true) . "'/>"; $form_type = 'products'; echo tzs_print_user_contacts($row, $form_type); ?> <?php if (isset($_GET['spis'])) { echo "<a id='edit_search' href='/account/my-products/'>Назад к списку</a> <div style='clear: both'></div>"; } elseif (isset($_GET['link'])) { echo "<a id='edit_search' href='/" . $_GET['link'] . (isset($_GET['active']) ? "/?active=" . $_GET['active'] : "/") . "'>Назад к списку</a> <div style='clear: both'></div>"; } else { echo "<button id='edit_search' onclick='history.back()'>Назад к списку</button> <div style='clear: both'></div>"; } ?> <?php if ($user_id != $row->user_id && $user_id != 0 && $row->fixed_or_tender == 2 && $cnt_rate <= 0) { ?> <button id="bet_button" type="button" onclick="bet_click();" <?php echo $user_id === 0 ? 'disabled="disabled"' : ''; ?> >Сделать ставку</button> <?php } ?> <?php if ($user_id != $row->user_id && $user_id != 0 && $row->fixed_or_tender == 2 && $cnt_rate > 0) { ?> <button id="bet_button" type="button" onclick="bet_click();" <?php echo $user_id === 0 ? 'disabled="disabled"' : ''; ?> >Изменить цену</button> <?php } ?> <?php if ($user_id != $row->user_id && $row->fixed_or_tender == 1) { ?> <button id="buy_button" type="button" onClick="javascript: window.location.href = '/company/?id=<?php echo $row->user_id; ?> ';" >Купить сейчас</button> <?php } ?> <?php if ($user_id == $row->user_id) { ?> <div style="margin-top: 15px;"> <a id="view_edit" onClick="javascript: window.location.href = '/account/edit-product/?id=<?php echo $row->id; ?> ';">Изменить</a> </div> <?php } ?> </div> </div> <div class="container" id="product-container"> <div class="row-fluid" > <div class="span4" id="img_kart"> <?php if (strlen($row->image_id_lists) > 0) { //$img_names = explode(';', $row->pictures); $img_names = explode(';', $row->image_id_lists); $main_image_id = $row->main_image_id; if (count($img_names) > 0) { ?> <?php // Вначале выведем главное изображение $attachment_info = wp_get_attachment_image_src($main_image_id, 'full'); if ($attachment_info !== false) { ?> <ul class="thumbnails" style="max-height: 470px;"> <li class="span12"> <a href="#" class="thumbnail" id="general-img"> <img id="general" src=<?php echo $attachment_info[0]; ?> alt=""> </a> </li> </ul> <?php } ?> <ul class="thumbnails"> <li class="span3"> <a href="#" class="thumbnail" > <img src=<?php echo $attachment_info[0]; ?> alt="" onclick="clickSmallImage(this);"> </a> </li> <?php // Затем выведем все остальные изображения for ($i = 0; $i < count($img_names); $i++) { if ($img_names[$i] !== $main_image_id) { $attachment_info = wp_get_attachment_image_src($img_names[$i], 'full'); //if (file_exists(ABSPATH . $img_names[$i])) { if ($attachment_info !== false) { ?> <li class="span3"> <a href="#" class="thumbnail" > <img src=<?php echo $attachment_info[0]; ?> alt="" onclick="clickSmallImage(this);"> </a> </li> <?php } } } ?> </ul> <?php } } else { ?> <ul class="thumbnails" style="max-height: 470px;"> <li class="span12"> <a href="#" class="thumbnail" id="general-img"> <img id="general" src="/wp-content/themes/twentytwelve/image/360x270.png" alt=""> </a> </li> </ul> <?php } ?> </div> <div class="span6" id="descript"> <div class="well well-large"> <div id="bet"> <form name="bet_form" id="bet_form" > <fieldset> <div id="bet_error" style="color: red;"><?php if ($row->fixed_or_tender != 1) { echo $user_id === 0 ? '<p>Для участия в тендере необходимо <a href="/account/login/">войти</a> или <a href="/account/registration/">зарегистрироваться</a></p>' : ''; } ?> </div> <?php if ($user_id == 0) { ?> <!-- <div class="pull-left label-txt"> <label><strong>Актуальная цена:</strong></label> </div> <div class="pull-left label-txt"> <strong><div id="tek_price"></div></strong> </div> --> <?php } if ($user_id == $row->user_id) { ?> <!-- <div class="pull-left label-txt"> <label><strong>Актуальная цена:</strong></label> <center><strong><div id="tek_price"></div></strong></center> </div> --> <div class="pull-left label-txt" style="min-width: 60px;"> <label><strong>Предложений:</strong></label> <strong><div id="tek_stavki"></div></strong> </div> <?php } ?> <?php if ($user_id != $row->user_id && $user_id != 0) { if ($row->fixed_or_tender == 1) { ?> <!-- <div class="pull-left label-txt"> <label><strong>Актуальная цена:</strong></label> </div> <div class="pull-left label-txt"> <strong><div id="tek_price"></div></strong> </div> --> <?php } if ($row->fixed_or_tender == 2) { ?> <!-- <div class="pull-left label-txt"> <label><strong>Актуальная цена:</strong></label> <center><strong><div id="tek_price"></div></strong></center> </div> --> <?php if ($cnt_rate <= 0) { ?> <div class="pull-left" style="padding-left: 10px;"> <strong>Ваша цена:</strong> <div class="clearfix"></div> <input id="bet_user" type="number" style="width: 45%;" <?php echo $user_id === 0 ? 'disabled="disabled"' : ''; ?> /> </div> <?php } ?> <?php if ($cnt_rate > 0) { ?> <div class="pull-left" style="padding-left: 10px;"> <strong>Изменить цену:</strong> <div class="clearfix"></div> <input id="bet_user" type="number" value="<?php echo $max_rate; ?> " style="width: 45%;" <?php echo $user_id === 0 ? 'disabled="disabled"' : ''; ?> /> </div> <?php } ?> <div class="pull-left" style="padding-left: 10px; width: 50%"> <strong>Комментарий к ставке</strong> <div class="clearfix"></div> <?php if ($descrip[0]->user_id == $user_id) { ?> <textarea id="text_bet" class="bet-area" rows="1" cols="75" name="text-bet"> <?php echo $descrip[0]->description; ?> </textarea> <?php } else { ?> <textarea id="text_bet" class="bet-area" rows="1" cols="75" name="text-bet" placeholder="Текст ставки"></textarea> <?php } ?> </div> <?php } ?> <?php } ?> <input id="user_id" style="display: none;" value=<?php echo $user_id; ?> /> <input id="user_name" style="display: none;" value=<?php $meta = get_user_meta($row->user_id, 'fio'); echo $meta[0]; ?> /> <input id="auction_id" style="display: none;" value=<?php echo $sh_id; ?> /> <input id="created" style="display: none;" value=<?php echo date("Y-m-d H:i:s"); ?> /> <input id="currency" style="display: none;" value="<?php echo $GLOBALS['tzs_pr_curr'][$row->currency]; ?> " /> <input id="title-company" style="display: none;" value="<?php echo $row->title; ?> " /> <div class="clearfix"></div> </fieldset> </form> </div> <div id="labeltxt"> <div class="pull-left label-txt"> <label><strong>Активно:</strong></label> </div> <div class="pull-left"> <?php echo $row->active == 1 ? 'Да' : 'Нет'; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Категория:</strong></label> </div> <div class="pull-left"> <?php echo get_the_title($row->type_id); ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Дата размещения:</strong></label> </div> <div class="pull-left"> <?php echo convert_time($row->created); ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Дата окончания:</strong></label> </div> <div class="pull-left"> <?php echo convert_date($row->expiration); ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Краткое описание:</strong></label> </div> <div class="pull-left"> <?php echo htmlspecialchars($row->title); ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Количество:</strong></label> </div> <div class="pull-left"> <?php echo $row->copies . ' ' . $GLOBALS['tzs_pr_unit'][$row->unit]; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Начальная стоимость:</strong></label> </div> <div class="pull-left" id="bet_label"> <?php echo $row->price . " " . $GLOBALS['tzs_pr_curr'][$row->currency]; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Форма оплаты:</strong></label> </div> <div class="pull-left"> <?php echo $GLOBALS['tzs_pr_payment'][$row->payment]; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Место нахождение:</strong></label> </div> <div class="pull-left"> <?php echo tzs_city_to_str($row->from_cid, $row->from_rid, $row->from_sid, $row->city_from); ?> </div> <div class="clearfix"></div> </div> </div> </div> <div class="span2" id="left-control"> </div> </div> <div class="row-fluid"> <div class="span11"> <ul id="myTab" class="nav nav-tabs"> <li class="active"><a href="#description" data-toggle="tab">Описание</a></li> <?php if ($user_id == $row->user_id) { ?> <li><a href="#dopolnenie" data-toggle="tab">История ставок</a></li> <?php } ?> </ul> <div id="myTabContent" class="tab-content"> <div class="tab-pane fade in active" id="description"> <?php echo $row->description; ?> </div> <div class="tab-pane fade" id="dopolnenie"> <div class="well well-large"> <div id="wrapper_bet"> <?php $active = " AND active=1"; // Отбор ставок по тендеру - active=1 AND $sql = "SELECT MAX(rate) FROM " . TZS_PRODUCT_RATES_TABLE . " WHERE product_id={$sh_id} {$active}"; /*$max = $wpdb->get_results($sql); */ $max = $wpdb->get_var($sql); if ($max > 0) { echo "<input id='act_rate' style='display: none;' value='" . round($max, 2) . "' />"; } else { echo "<input id='act_rate' style='display: none;' value='" . $row->price . " " . $GLOBALS['tzs_pr_curr'][$row->currency] . "' />"; } $sql = "SELECT COUNT(*) FROM " . TZS_PRODUCT_RATES_TABLE . " WHERE product_id={$sh_id} {$active}"; /*$max = $wpdb->get_results($sql); */ $cnt_rate = $wpdb->get_var($sql); if ($cnt_rate > 0) { echo "<input id='cnt_rate' style='display: none;' value=" . $cnt_rate . " />"; } else { echo "<input id='cnt_rate' style='display: none;' value='0' />"; } $sql = "SELECT * FROM " . TZS_PRODUCT_RATES_TABLE . " WHERE product_id={$sh_id} ORDER BY active DESC,created DESC;"; $res = $wpdb->get_results($sql); if (count($res) == 0 && $wpdb->last_error != null) { print_r($wpdb->last_error); print_error('Не удалось отобразить информацию о ставках. Свяжитесь, пожалуйста, с администрацией сайта.'); } else { if (count($res) == 0) { print_error('Ставки не найдены'); } else { ?> <table border="0" id="tbl_products" style="float: none !important;"> <tr> <th>Статус</th> <th id="tbl_products_dtc">Размещена <br /> Отозвана</th> <!-- <th id="tbl_products_dtc">Дата и время отзыва</th> --> <th id="price">Предложенная стоимость</th> <th id="price">Комментарий</th> <!-- <th id="price">Автор</th> --> <?php if ($user_id !== 0 || $GLOBALS['tzs_au_contact_view_all'] !== false) { ?> <th id="price">Автор <br /> Контактные данные</th> <?php } ?> </tr> <?php $i = 0; foreach ($res as $row) { $user_info = get_userdata($row->user_id); if ($row->reviewed == null) { $reviewed = " "; } else { $reviewed = convert_time($row->reviewed); } ?> <tr id="<?php echo $row->active == 1 ? 'tbl_auction_rate_active' : 'tbl_auction_rate_reviewed'; ?> "> <td><?php echo $row->active == 1 ? 'Активна' : 'Отозвана'; ?> </td> <td><?php echo ' ' . convert_time($row->created) . "<br />" . $reviewed; ?> </td> <!-- <td><?php /*echo $row->reviewed == null ? ' ' : convert_time($row->reviewed); */ ?> </td> --> <td><?php echo $row->rate . " " . $GLOBALS['tzs_pr_curr'][$row->currency]; ?> </td> <td><?php echo $row->description; ?> </td> <!-- <td><?php /* $meta = get_user_meta($row->user_id, 'fio'); echo $meta[0]; */ ?> </td> --> <?php if ($user_id !== 0 || $GLOBALS['tzs_au_contact_view_all'] !== false) { ?> <td> <?php $meta = get_user_meta($row->user_id, 'fio'); echo $meta[0] . '<br />'; ?> <?php $meta = get_user_meta($row->user_id, 'telephone'); echo $meta[0] == null ? '' : 'Номера телефонов: ' . htmlspecialchars($meta[0]) . '<br/>'; ?> <?php echo $user_info->user_email == null ? '' : 'E-mail: ' . htmlspecialchars($user_info->user_email) . '<br/>'; ?> <?php $meta = get_user_meta($row->user_id, 'skype'); echo $meta[0] == null ? '' : 'Skype: ' . htmlspecialchars($meta[0]) . '<br/>'; ?> </td> <?php } ?> </tr> <?php } ?> </table> <?php } } ?> </div> </div> </div> </div> </div> </div> </div> <script> jQuery('#myTab a').click(function (e) { e.preventDefault(); jQuery(this).tab('show'); }) </script> <script> jQuery(document).ready(function() { if (document.getElementById('tek_price')){ document.getElementById('tek_price').innerHTML=document.getElementById('act_rate_user').value+' '+document.getElementById('currency').value; } if(document.getElementById('tek_stavki')){ document.getElementById('tek_stavki').innerHTML=document.getElementById('cnt_rate').value; } now = new Date(); month=now.getUTCMonth()+1; now_str=now.getFullYear()+'-'+month+'-'+now.getUTCDate()+' '+now.getHours()+':'+now.getMinutes()+':'+now.getSeconds(); var title=document.getElementsByClassName('entry-title'); var company=document.getElementById('title-company').value; title[0].innerHTML=company; }); function clickSmallImage(element) { document.getElementById("general").src=element.src; } function bet_click() { flag_subs=0; document.getElementById('bet_error').innerHTML=""; paramstr=document.getElementById('text_bet').id+"=" + encodeURIComponent(document.getElementById('text_bet').value) + "&"+document.getElementById('user_id').id+"="+document.getElementById('user_id').value+"&"+document.getElementById('user_name').id+"="+document.getElementById('user_name').value+"&"+document.getElementById('auction_id').id+"="+document.getElementById('auction_id').value+"&"+document.getElementById('bet_user').id+"=" + document.getElementById('bet_user').value + "&"+document.getElementById('currency').id+"=" + document.getElementById('currency').value + "&"+document.getElementById('created').id+"=" + now_str + "&"; if ((document.getElementById('bet_user').value != "") ) { flag_subs=flag_subs+1; } else { document.getElementById('bet_error').innerHTML="Ставка не может быть пустой!"; return false; } if(flag_subs>=1) { jQuery.ajax({ url: "/wp-admin/admin-ajax.php?action=add_bet", // url: "/wp-content/plugins/tzs/functions/tzs.functions.php?action=add_bet", type: "POST", data: paramstr, success: function(data){ //document.forms["bet_form"].submit(); bet_rate=document.getElementById('bet_user').value; //document.getElementById('tek_price').innerHTML=bet_rate+' '+document.getElementById('currency').value+'.'; document.getElementById('bet_error').innerHTML="Ваша ставка принята!"; //document.getElementById('bet_user').value=""; //document.getElementById('text_bet').value=""; //jQuery("#wrapper_bet").load("/wp-content/plugins/tzs/front-end/tzs.view.auctions#wrapper_bet"); document.getElementById('wrapper_bet').innerHTML=data; //alert(data); }, error: function(data){ //document.forms["bet_form"].submit(); alert(data); } }); } } </script> <br/> <script> function promptDelete(id, active) { if (active === 1) { var s_text = '<div><h2>Удалить запись '+id+' или перенести в архив ?</h2><hr/><p>Запись из архива можно в любой момент снова опубликовать.</p><p>При удалении записи будут так же удалены все прикрепленные изображения.</p></div>'; buttons1 = new Object({ 'В архив': function () { jQuery(this).dialog("close"); doDelete(id, 0); }, 'Удалить': function () { jQuery(this).dialog("close"); doDelete(id, 1); }, 'Отменить': function () { jQuery(this).dialog("close"); } }); } else { var s_text = '<div><h2>Удалить запись '+id+' из архива ?</h2><hr/><p>Запись из архива можно в любой момент снова опубликовать.</p><p>При удалении записи будут так же удалены все прикрепленные изображения.</p></div>'; buttons1 = new Object({ 'Удалить': function () { jQuery(this).dialog("close"); doDelete(id, 1); }, 'Отменить': function () { jQuery(this).dialog("close"); } }); } jQuery('<div></div>').appendTo('body') .html(s_text) .dialog({ modal: true, title: 'Удаление', zIndex: 10000, autoOpen: true, width: 'auto', resizable: false, buttons: buttons1, close: function (event, ui) { jQuery(this).remove(); } }); } function doDelete(id, is_delete) { p_data = "id=" + id + "&is_delete=" + is_delete; jQuery.ajax({ url: "/wp-admin/admin-ajax.php?action=tzs_delete_auction", type: "POST", data: p_data, success: function(response){ //window.open('/account/my-auctions/', '_self'); window.open('/account/my-auctions/', ''); }, error: function(response){ alert('Не удалось удалить: '+response); } }); /*var data = { 'action': 'tzs_delete_auction', 'id': id, 'is_delete': is_delete }; jQuery.post(ajax_url, data, function(response) { if (response == '1') { window.open('/account/my-auctions/', '_self'); } else { alert('Не удалось удалить: '+response); } });*/ } </script> <?php } } } $output = ob_get_contents(); ob_end_clean(); return $output; }