File "class.float.wpdatacolumn.php"

Full Path: /var/www/bvnghean.vn/save_bvnghean.vn/wp-content/plugins/wpDataTables_v1.6.1/source/class.float.wpdatacolumn.php
File size: 1.56 KB
MIME-type: text/x-php
Charset: utf-8

<?php
class FloatWDTColumn extends WDTColumn {

    protected $_jsDataType = 'formatted-num';
    protected $_dataType = 'float';
    
    public function __construct( $properties = array () ) {
		parent::__construct( $properties );
		$this->dataType = 'float';
		$this->_jsFilterType = 'number';
		$this->addCSSClass('numdata float');
    }
    
    public function prepareCellOutput( $content ) {

		if( $content == '' ){ return $content; }
    	
		$number_format = get_option('wdtNumberFormat') ? get_option('wdtNumberFormat') : 1;
		$decimal_places = get_option('wdtDecimalPlaces') !== false ? get_option('wdtDecimalPlaces') : 2;
		
		if($number_format == 1){
			$formattedValue = number_format( 
                                            (float) $content, 
                                            $decimal_places, 
                                            ',', 
                                            $this->thousandsSeparatorVisible() ? '.' : ''
                                        );
		}else{
			$formattedValue = number_format(
                                            (float) $content, 
                                            $decimal_places,
                                            '.', 
                                            $this->thousandsSeparatorVisible() ? ',' : ''
                                            );
		}
    	
		$formattedValue = apply_filters( 'wpdatatables_filter_float_cell', $formattedValue );
		return $formattedValue;
    }
    
    public function getGoogleChartColumnType(){
        return 'number';
    }    
    
}


?>