<?php
class exblastobmen_Widget2 extends WP_Widget {
public function __construct($id_base = false, $widget_options = array(), $control_options = array()){
parent::__construct('exblastobmen_info', __('The last exchange','pntheme'), $widget_options = array(), $control_options = array());
}
public function widget($args, $instance){
extract($args);
$title = ($instance['title'] !== null && $instance['title'] != '')? $instance['title'] : __('The last exchange','pntheme');
$temp = '
<div class="lobmen_widget">
<div class="lobmenwidget_title">'. pn_strip_input($title) .'</div>';
global $wpdb;
$valuts = array();
$valutsn = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."valuts");
foreach($valutsn as $valut){
$valuts[$valut->id] = $valut;
}
$bid = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."bids WHERE status = 'success' ORDER BY id DESC LIMIT 1");
if(isset($bid->id)){
if(isset($valuts[$bid->valut1i]) and isset($valuts[$bid->valut2i])){
$table ='
<div class="lobmentable">
<div class="lobmline">
<div class="lobmlineico">
<div class="obmenlinewico" style="background: url('. is_ssl_url($valuts[$bid->valut1i]->vlogo) .') no-repeat center center"></div>
<div class="clear"></div>
</div>
<div class="lobmlinebac">
'. exb_is_my_rez($bid->summ1) .' '. pn_strip_input($bid->valut1type) .'
</div>
<div class="clear"></div>
</div>
<div class="lobmlinepr"></div>
<div class="lobmline">
<div class="lobmlineico">
<div class="obmenlinewico" style="background: url('. is_ssl_url($valuts[$bid->valut2i]->vlogo) .') no-repeat center center"></div>
<div class="clear"></div>
</div>
<div class="lobmlinebac">
'. exb_is_my_rez($bid->summz2) .' '. pn_strip_input($bid->valut2type) .'
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
';
$temp .= $table;
}
if(isset($bid->tdate)){
$temp .= '<div class="lobmendate">'. get_mytime($bid->tdate, 'd.m.Y H:i') .'</div>';
}
}
$temp .= '
</div>
';
echo $temp;
}
public function form($instance){
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title'); ?>: </label><br />
<input type="text" name="<?php echo $this->get_field_name('title'); ?>" id="<?php $this->get_field_id('title'); ?>" class="widefat" value="<?php echo is_isset($instance,'title'); ?>">
</p>
<?php
}
}
register_widget('exblastobmen_Widget2');
?>