Commit af6468bd authored by f4eyq's avatar f4eyq

update 15/11

parent 234f45d9
<?php
// extends generic_crxItem
// v04082018
// v112018
class abstractDxClusterSpot{
var $_debug_details = '';
......@@ -118,11 +118,12 @@ class abstractDxClusterSpot{
//New filter date :
if(isset($params['use_date_filter'])) $this->display_spot_after_timestamp_v2 = $params['use_date_filter'];
if(isset($params['display_only_not_contacted_dx'])) $this->display_only_not_contacted_dx = $params['display_only_not_contacted_dx'];
if(isset($params['spots_comment_filter'])) $this->display_spots_comment_filter = $params['spots_comment_filter'];
if(isset($params['spots_comment_filter_in_out'])) $this->display_spots_comment_filter_in_out = $params['spots_comment_filter_in_out'];
if(isset($params['spots_comment_filter_in_out'])) $this->display_spots_comment_filter_in_out = $params['spots_comment_filter_in_out'];
if(isset($params['band_part_filter'])) $this->display_band_part_filter = $params['band_part_filter'];
......
<?php
/*
*************************************************************************************
*
* Crx-cms powered by CRX-PHP-FRAMEWORK http://git.crx.cloud/crx-php/crx-framework
* Copyright (c) Bastien Barbe and contributors. All rights
* reserved.
*
* Crx-cms is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Crx-cms is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*************************************************************************************
*/
/**
* @author Bastien Barbe - CRX-FRAMEWORK
* @date 01/01/2005
* @revision 04082018
* @revision 11112018
* @lib radioamator
* @copyright see header
* @version 1.2.2
*/
//TODO rename to : dxClusterSpot11m
class dxClusterSpots
extends abstractDxClusterSpot{
......@@ -67,11 +45,8 @@ extends abstractDxClusterSpot{
}
*/
$sql_select_time_range='date_spot >= '.$time_select['start'].' AND date_spot <= '.$time_select['end'];
//check is spot data are present for the given time :
$sql="SELECT COUNT(*) AS NB_SPOTCQ_BY_CONT FROM ".$this->_tblSpot." WHERE $sql_select_time_range";
$this->c_db->execSql($sql);
......@@ -198,6 +173,10 @@ extends abstractDxClusterSpot{
function getDataFromParameters($params){
//crxFile::setFileContent('/home/hosting/www_root/ham.crx.cloud/logs/test','params:'.dumper($params));
$this->initGetDataFromParameters($params);
$sql_limit_result = $this->display_filters_start_pointer.",".$this->display_filters_end_pointer;
......@@ -382,13 +361,51 @@ extends abstractDxClusterSpot{
}
if($this->display_spot_after_timestamp_v2){
$datecfg=$this->display_spot_after_timestamp_v2['DATE_FILTER']['value'];
if($sql_set_filter){
$join_this_filter=' AND';
}
else{
$join_this_filter='WHERE';
}
if(isset($datecfg['use_manual_date_setting']) && $datecfg['use_manual_date_setting']==1){
$s=$datecfg['date_start_ts'];
$e=$datecfg['date_end_ts'];
$fs='';
if($s){
$fs='`date_spot` >= '.$s.''; //11m version not time but date_spot column
if($e){
$fs.='AND `date_spot` <= '.$e.'';
}
}
$sql_set_filter.=' ';
$sql_set_filter_columns_settings.=' '.$join_this_filter.' '.$fs;
}
elseif($datecfg['date_last_hours_spots']<>'' && $datecfg['date_last_hours_spots']<>0){
$n=$datecfg['date_last_hours_spots'];//ex 6 hours
if(DEBUG_DEV_SPOT_TIME<>''){
$date=DEBUG_DEV_SPOT_TIME;
}else{
$date=time();
}
$n= $date - ($n * 60 * 60);
$sql_set_filter_columns_settings .= ' '.$join_this_filter.' (`date_spot` >= '.$n.') ';
}
}
$sql_limit_result=" ORDER BY ".$this->display_filters_order_by." DESC LIMIT ".$sql_limit_result;
$final_querie_get_dxcluster_spots = $sql_get_data." ".$sql_set_filter.$sql_set_filter_columns_settings." ".$sql_limit_result;
if($debug)var_dump($final_querie_get_dxcluster_spots);
$this->c_db -> query = $final_querie_get_dxcluster_spots;
//var_dump($final_querie_get_dxcluster_spots);
//var_dump($final_querie_get_dxcluster_spots);
//if($this->debug)crxFile::setFileContent('/home/hosting/www_root/ham.crx.cloud/logs/test','DEBUG:'.dumper($final_querie_get_dxcluster_spots));
$spots = $this->c_db -> getArrayOfResult();
......
<?php
//Interface class to use dxClusterSpot HAM or 11M.
//u:12072018
//u:112018
class dxClusterSpot {
var $__mode = '';
var $c_db = '';
var $debug = false;
function setDebug($d){
$this->debug=$d;
}
function getDxClusterStatsContinentDxSpotRepartition($db='spot',$time_select=array('start','end'),$user_continent='EU',$nb_total_spots=0,$user_band_selected='ALL',$debug=0){
......@@ -155,12 +163,14 @@ class dxClusterSpot {
if($this->__mode == 'HAM'){
$s=new dxClusterSpotHam();
$s->setDbHandler($this->c_db);
$s->setDebug($this->debug);
$filters['tbl_crx_spots'] = 'spot';
$filters['filters_order_by'] = 'time';
}
else{
$s=new dxClusterSpots();
$s->setDbHandler($this->c_db);
$s->setDebug($this->debug);
$filters['tbl_crx_spots'] = 'crx_cluster_spots';
$filters['filters_order_by'] = 'date_spot';
}
......@@ -172,7 +182,6 @@ class dxClusterSpot {
$c = new hamCountry();//HAM and 11M.
$c->c_db=$this->c_db;
$spl = array();
foreach($s->getDataFromParameters($filters) as $k=>$spot){
......
<?php
/**
* @author Bastien Barbe - DXCLUSTER CRX WEB (HAM Version)
* @creation date 082014
* @revision 22072018
* @revision 11112018
* @module dxClusterWeb/dxClusterSpotHam
*/
class dxClusterSpotHam
extends abstractDxClusterSpot{
var $_debug_sql = 0;
......@@ -533,29 +531,55 @@ extends abstractDxClusterSpot{
$sql_get_bmap="SELECT `spotcall` , `freq`, `time` FROM `spot`
WHERE `freq` >= '".$frequency_start."' AND `freq` <= '".$frequency_end."'
AND `time` >= '".$time_bengining_band_map."'
AND `time` >= '".$time_bengining_band_map."' GROUP BY `spotcall`
ORDER BY `spot`.`time` ASC";
$this->c_db -> execSql($sql_get_bmap);
$stack_arr=array();
$i=0;while($rs = $this->c_db -> returnLine()){
$list_of_spot = $stack_arr = array();
while($rs = $this->c_db -> returnLine()){
$list_of_spot[]=$rs;
}
$i=0;
foreach($list_of_spot as $k=>$rs){
if($i==0){$this->_firstCall=trim($rs[0]);$i++;}
$rs['spotcall']=trim($rs['spotcall']);
if(!in_array($rs['spotcall'],$stack_arr)){
$sql_get_bmap_no_spots="SELECT COUNT(*) AS nb_spots, spotdxcc, spotcall FROM `spot` WHERE `freq` >= '".$frequency_start."' AND `freq` <= '".$frequency_end."'
AND `time` >= '".$time_bengining_band_map."' AND `spotcall` = '".$rs['spotcall']."'";
$this->c_db -> execSql($sql_get_bmap_no_spots);
$rscount = $this->c_db -> returnLine();
$rss[$rs['freq']][$rs['time']]=$rs['spotcall'];
$stack_arr[$rs['spotcall']]=$rs['spotcall'];
$rss[$rs['freq']][$rs['time']]=array(
'dxcc'=>$rscount['spotdxcc'],
'call'=>$rs['spotcall'],
'nb'=>$rscount['nb_spots']
);
}
}
}
$rss1=crxArray::sortMultidimensionalArray($rss);
return array('callsign_dx_map'=>$rss1);
return array(
'callsign_dx_map'=>$rss1
);
}
......@@ -1341,6 +1365,7 @@ extends abstractDxClusterSpot{
/////////////////////////////////////////
if(!$this->display_spot_after_timestamp_v2 && $this->display_spot_after_timestamp){
if($sql_set_filter){
$join_this_filter=' AND';
}
......@@ -1349,37 +1374,48 @@ extends abstractDxClusterSpot{
}
$sql_set_filter.=' ';
$sql_set_filter_columns_settings .= ' '.$join_this_filter.' `time` < \''.$this->display_spot_after_timestamp.'\'';
}
if($this->display_spot_after_timestamp_v2){
$datecfg=$this->display_spot_after_timestamp_v2['DATE_FILTER']['value'];
if($sql_set_filter){
$join_this_filter=' AND';
}
else{
$join_this_filter=''.$where_inside.''.''.$where_open.'';
}
if(isset($datecfg['use_manual_date_setting']) && $datecfg['use_manual_date_setting']==1){
$s=$datecfg['date_start_ts'];
$e=$datecfg['date_end_ts'];
$fs='';
if($s){
$fs='`time` >= '.$s.'';
if($e){
$fs.='AND `time` <= '.$e.'';
}
}
$sql_set_filter.=' ';
$sql_set_filter_columns_settings .= ' '.$join_this_filter.' (`time` >= '.$s.' AND `time` <= '.$e.') ';
}
elseif($datecfg['date_last_hours_spots']<>'' && $datecfg['date_last_hours_spots']<>0){
$sql_set_filter_columns_settings .= ' '.$join_this_filter.' ('.$fs.') ';
}
elseif($datecfg['date_last_hours_spots']<>'' && $datecfg['date_last_hours_spots']<>0){
$n=$datecfg['date_last_hours_spots'];//ex 6 hours
if(DEBUG_DEV_SPOT_TIME<>''){
$date=DEBUG_DEV_SPOT_TIME;
}else{
#$date=gmmktime();//return local server time :/
$date=time();
}
$n= $date - ($n * 60 * 60);
$sql_set_filter_columns_settings .= ' '.$join_this_filter.' (`time` >= '.$n.') ';
}
}
}
//////////////////////////////////////////
......@@ -1434,17 +1470,15 @@ extends abstractDxClusterSpot{
$final_querie_get_dxcluster_spots = $sql_get_data." ".$sql_set_filter;
//var_dump($final_querie_get_dxcluster_spots);die();
}
}
//if($this->debug)crxFile::setFileContent('/home/hosting/www_root/ham.crx.cloud/logs/test','DEBUG:'.dumper($final_querie_get_dxcluster_spots));
$this->_dsql=$final_querie_get_dxcluster_spots;
//var_dump($this->_dsql);die();
if($exec_final_sql){
$this->c_db -> query = $final_querie_get_dxcluster_spots;
......
......@@ -2,7 +2,7 @@
/**
* @author Bastien Barbe - CRX-FRAMEWORK
* @date 01/01/2005
* @revision 24/05/2017
* @revision 11/2018
* @crx-core classes
* @copyright see header
* @version 1.2
......@@ -10,12 +10,17 @@
class dbDriver__MEMCACHED
extends crxDataSource{
var $_debug = false;
var $_debug = false;
var $_charset = 'utf8';
var $_charset = 'utf8';
var $_mem = '';
function __construct(){
}
function setDataSrcConfiguration($conf){
......
......@@ -261,7 +261,7 @@ function mysqlBulk(&$data, $table, $method = 'transaction', $options = array())
$x=(100*$ic)/$total;
if(round($x)==0){$x=1;}
$pct=round($x)."%";
$ct = ( mktime() - $timestartprocessing ) ;
$ct = ( time() - $timestartprocessing ) ;
$trs = $ct * 100 / round($x);
$min_trs = round(round($trs)/60);
$value="Save item(s) $pct ($ic/$total).<br />Time left <b>$min_trs</b> min";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment