Explorar o código

dodanie raportu do sprawdzania postepow statusow w roznych tabelach

a.binder %!s(int64=9) %!d(string=hai) anos
pai
achega
514fc69f69
Modificáronse 1 ficheiros con 230 adicións e 0 borrados
  1. 230 0
      SE/superedit-ANALIZA_WIDOKOW_RAPORT_DAILY.php

+ 230 - 0
SE/superedit-ANALIZA_WIDOKOW_RAPORT_DAILY.php

@@ -0,0 +1,230 @@
+<?php
+
+function ANALIZA_WIDOKOW_RAPORT_DAILY() {
+	global $result;
+
+	SE_Layout::menu();
+
+	$_GET['F_LIMIT'] = V::get('F_LIMIT', 50, $_GET, 'int');
+	$_GET['TABLES_LIKE'] = V::get('TABLES_LIKE', '', $_GET);
+		
+	
+	$__install = V::get('__install', '', $_GET); 
+	$db = DB::getDB();
+
+
+
+
+	Lib::LoadClass('InstallerHelper') ;
+
+
+
+	if(!empty($__install)) { 
+	//TODO example
+	 $installer=new InstallerHelper(); //('new_parent_option','NEW_TABLE');
+	 $new_MYSQL_SCHEMA = $installer->new_child('MYSQL_SCHEMA');
+		 $new_table = $new_MYSQL_SCHEMA->new_child('TABLES');
+		 	$new_table->set_option('Table_type','BASE TABLE');
+		 	$new_table->set_option('NAME','_ANALIZA_WIDOKOW_RAPORT_DAILY');
+
+		 		$new_table_field = $new_table->new_child('FIELDS');
+		 		$new_table_field->set_option('Field','ID');
+		 		$new_table_field->set_option('Null','NO');
+		 		$new_table_field->set_option('Key','PRI');
+		 		$new_table_field->set_option('Default','');
+		 		$new_table_field->set_option('Extra','auto_increment');
+		 		$new_table_field_id = $new_table_field->new_child('Type');
+		 			$new_table_field_id_int = $new_table_field_id->new_child('int');
+		 			$new_table_field_id_int->set_option('M','11');
+
+
+	 	DEBUG_S(-3,'new_table_field',$new_table_field);
+
+		// 		unset($new_table_field);unset($new_table_field_id);unset($new_table_field_id_int);
+
+		 		$new_table_field = $new_table->new_child('FIELDS');
+		 		$new_table_field->set_option('Field','TABLE_NAME');
+		 		$new_table_field->set_option('Null','NO');
+		 		$new_table_field->set_option('Key','');
+		 		$new_table_field->set_option('Default','');
+		 		$new_table_field->set_option('Extra','auto_increment');
+		 		$new_table_field_id = $new_table_field->new_child('Type');
+		 			$new_table_field_id_int = $new_table_field_id->new_child('varchar');
+		 			$new_table_field_id_int->set_option('M','255');		 	
+
+		 DEBUG_S(-3,'new_table_field',$new_table_field);
+
+		 
+		 		$new_table_field = $new_table->new_child('FIELDS');
+		 		$new_table_field->set_option('Field','COUNT');
+		 		$new_table_field->set_option('Null','NO');
+		 		$new_table_field->set_option('Key','');
+		 		$new_table_field->set_option('Default','');
+		 		$new_table_field->set_option('Extra','auto_increment');
+		 		$new_table_field_id = $new_table_field->new_child('Type');
+		 			$new_table_field_id_int = $new_table_field_id->new_child('int');
+		 			$new_table_field_id_int->set_option('M','11');		 	
+   		 
+ 		 		$new_table_field = $new_table->new_child('FIELDS');
+		 		$new_table_field->set_option('Field','FIELD');
+		 		$new_table_field->set_option('Null','NO');
+		 		$new_table_field->set_option('Key','');
+		 		$new_table_field->set_option('Default','');
+		 		$new_table_field->set_option('Extra','auto_increment');
+		 		$new_table_field_id = $new_table_field->new_child('Type');
+		 			$new_table_field_id_int = $new_table_field_id->new_child('varchar');
+		 			$new_table_field_id_int->set_option('M','255');		 	
+
+   				
+ 		 		   							  							
+		 		$new_table_field = $new_table->new_child('FIELDS');
+		 		$new_table_field->set_option('Field','VALUE');
+		 		$new_table_field->set_option('Null','NO');
+		 		$new_table_field->set_option('Key','');
+		 		$new_table_field->set_option('Default','');
+		 		$new_table_field->set_option('Extra','auto_increment');
+		 		$new_table_field_id = $new_table_field->new_child('Type');
+		 			$new_table_field_id_int = $new_table_field_id->new_child('text');
+   			
+	
+
+ 
+		 		$new_table_field = $new_table->new_child('FIELDS');
+		 		$new_table_field->set_option('Field','A_RECORD_CREATE_DATE');
+		 		$new_table_field->set_option('Null','NO');
+		 		$new_table_field->set_option('Key','');
+		 		$new_table_field->set_option('Default','');
+		 		$new_table_field->set_option('Extra','auto_increment');
+		 		$new_table_field_id = $new_table_field->new_child('Type');
+		 			$new_table_field_id_int = $new_table_field_id->new_child('varchar');
+		 			$new_table_field_id_int->set_option('M','30');		 	
+
+  		
+  		
+		 		$new_table_index = $new_table->new_child('INDEX');
+		 		$new_table_index->set_option('Key_name','TABLE_NAME');
+		 		
+		 		$new_table_index_col = $new_table_index->new_child('Column_name');
+		 			$new_table_index_col->set_option('column','TABLE_NAME');
+		 		$new_table_index_col = $new_table_index->new_child('Column_name');
+		 			$new_table_index_col->set_option('column','VALUE');
+		 		$new_table_index_col = $new_table_index->new_child('Column_name');
+		 			$new_table_index_col->set_option('column','FIELD');
+		 		$new_table_index_col = $new_table_index->new_child('Column_name');
+		 			$new_table_index_col->set_option('column','A_RECORD_CREATE_DATE');
+
+
+		
+
+
+
+//	 $new_table_index = $new_table->new_child('INDEX');
+
+//	 $new_table_field = $new_table_field->set_option('TABLE_FIELD_TYPE','INT');
+//
+//	 $new_table_field = $new_table->new_child('TABLE_FIELD');
+//	 $new_table_field = $new_table_field->set_option('TABLE_FIELD_NAME','A_RECORD_UPDATE_DATE');
+//	 $new_table_field = $new_table_field->set_option('TABLE_FIELD_TYPE','VARCHAR');
+//	 $new_table_field = $new_table_field->set_option('TABLE_FIELD_LENGHT','100');
+
+	
+	// $new_table->NEW_TABLE('dupa');
+
+
+
+
+
+	 
+	 	DEBUG_S(-3,'installer',$installer);
+	 	DEBUG_S(-3,'new_MYSQL_SCHEMA',$new_MYSQL_SCHEMA);
+	 	DEBUG_S(-3,'new_table',$new_table);
+	 	DEBUG_S(-3,'new_table_field',$new_table_field);
+	 	
+	// 	DEBUG_S(-3,'new_table',$new_table);
+
+	//$install->__add_req_option('table');
+	$installer->__install();
+	
+	//$table->get_options_status();
+	
+	//var_dump($install);
+	
+   	 //InstallerHelper::__install();
+   	 
+   	 die('umarlem');
+	
+	}
+
+
+
+Lib::loadClass('ProcesHelper');
+$zasob_tabeli_hist=ProcesHelper::getZasobTableID('ANALIZA_WIDOKOW_RAPORT_DAILY');
+
+?>
+ANALIZA_WIDOKOW_RAPORT_DAILY <form action='' METHOD='GET'>
+<input type="hidden" name="ADD" value="ADD">
+<input type="hidden" name="MENU_INIT" value="ANALIZA_WIDOKOW_RAPORT_DAILY">
+
+<a href=index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=<?php echo $zasob_tabeli_hist; ?> >Przeglądanie</a>
+
+
+<br>Czy zainstalować moduł ANALIZA_WIDOKOW_RAPORT_DAILY ?<input type="checkbox" name="__install"> 
+
+<table border=1>
+	<tr>
+		<td>Uruchomienie analizy statusow</td>
+		
+	</tr>
+	<tr>
+		<td colspan=1><input type="submit" name="ANALIZA_WIDOKOW_RAPORT_DAILY" value="ANALIZA_WIDOKOW_RAPORT_DAILY"></td>
+	</tr>
+	
+	</table>
+	
+
+<?php
+
+	$RAPORT['IGNORE_TABLES'][] = "AUTOSHAPE";
+
+	//echo statystyka pracy historyczna w systemie 
+	$dbTbls = array();
+	$ZAP_SQL = " SHOW FULL TABLES WHERE TABLE_TYPE LIKE  'VIEW' ";
+	if (!empty($_GET['TABLES_LIKE'])) {
+		$ZAP_SQL .= " like '{$_GET['TABLES_LIKE']}' ";
+	}
+	$res = $db->query($ZAP_SQL);
+	while($R = $db->fetch_array($res)) {
+		$dbTbls[] = $R;
+	}
+	foreach ($dbTbls as $R) {
+		if (!in_array($R[0], $RAPORT['IGNORE_TABLES'])) {
+			$RAPORT['TABLES_ALL'][] = $R[0];
+		}
+	}
+		unset($dbTbls);
+
+	$ZAP_SQL = array();
+	
+	
+	
+	foreach ($RAPORT['TABLES_ALL'] as $RTH_I=>$RTH_A) {
+			$res = $db->query("select DISTINCT(A_STATUS) as VALUE, count(ID) as COUNT from ".$RTH_A['TABLE']." ");
+			$r2 = $db->fetch_array($res);
+			
+			
+			
+			if (isset($r2['A_STATUS']) && isset($r2['ID'])) {
+					
+				//dobudowanie tabeli 	_ANALIZA_HISTORII_ALL					
+				$sql="insert ignore into _ANALIZA_WIDOKOW_RAPORT_DAILY( TABLE_NAME, COUNT,FIELD,VALUE,A_RECORD_CREATE_DATE ) values (
+				'{$RTH_A['TABLE']}','{$h->COUNT}','A_STATUS','{$h->VALUE}',now())";
+				//echo "<br>".$sql;
+				DB::query($sql) or die($sql);
+					
+
+			}
+		}
+
+
+			
+}