| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- <?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(); //@2016-08-05 TODO bindera - dla czego to sie nie wykonalo???
-
- //$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";
- $RAPORT['IGNORE_TABLES'][] = "crm_proces_idx_group_to_init_view";
- $RAPORT['IGNORE_TABLES'][] = "crm_proces_idx_table_to_proces_grouped_view";
- $RAPORT['IGNORE_TABLES'][] = "crm_proces_idx_table_to_proces_perms_view";
- $RAPORT['IGNORE_TABLES'][] = "crm_proces_idx_table_to_proces_view";
- $RAPORT['IGNORE_TABLES'][] = "crm_proces_idx_table_to_user_view";
- $RAPORT['IGNORE_TABLES'][] = "crm_proces_idx_tables_info_view";
- $RAPORT['IGNORE_TABLES'][] = "crm_proces_idx_url_to_proces_view";
- $RAPORT['IGNORE_TABLES'][] = "crm_proces_idx_user_to_init_view";
- $RAPORT['IGNORE_TABLES'][] = "_TASKS_INFO_trigger";
- $RAPORT['IGNORE_TABLES'][] = "budget_project_to_realization_view";
- $RAPORT['IGNORE_TABLES'][] = "crm_proces_idx_user_to_proces_view";
- $RAPORT['IGNORE_TABLES'][] = "CRM_PROCES_idx_GROUP_to_PROCES";
- $RAPORT['IGNORE_TABLES'][] = "CRM_AUTH_PROFILE";
- $RAPORT['IGNORE_TABLES'][] = "CRM_CONFIG";
- $RAPORT['IGNORE_TABLES'][] = "CRM_CZYNNOSCI";
- $RAPORT['IGNORE_TABLES'][] = "CRM_IMPORT_TRANSLATE";
- $RAPORT['IGNORE_TABLES'][] = "CRM_PROCES_idx_GROUP_to_PROCES";
- $RAPORT['IGNORE_TABLES'][] = "CRM_PROCES_idx_GROUP_to_PROCES_PERM";
- $RAPORT['IGNORE_TABLES'][] = "CRM_PROCES_idx_TEMP";
- $RAPORT['IGNORE_TABLES'][] = "CRM_PRZYPADEK";
- $RAPORT['IGNORE_TABLES'][] = "CRM_UI_MSGS__EXEC_LOG";
- $RAPORT['IGNORE_TABLES'][] = "CRM_UI_MSGS";
- $RAPORT['IGNORE_TABLES'][] = "DEVICES_GROUP";
- $RAPORT['IGNORE_TABLES'][] = "GRAFIK_PRACY_view";
- $RAPORT['IGNORE_TABLES'][] = "ITEM_LINKS";
- $RAPORT['IGNORE_TABLES'][] = "KONTAKTY_view";
- $RAPORT['IGNORE_TABLES'][] = "ITEM_LINK_TYPES";
- $RAPORT['IGNORE_TABLES'][] = "LDAP_GROUPS";
- $RAPORT['IGNORE_TABLES'][] = "NETWORKS_SERVERS";
- $RAPORT['IGNORE_TABLES'][] = "_CRM_PROCES_GOTO_CACHE";
- $RAPORT['IGNORE_TABLES'][] = "_CRM_PROCES_STATS_proc_wiev";
- $RAPORT['IGNORE_TABLES'][] = "_SYNC_FILE_PERMS";
- $RAPORT['IGNORE_TABLES'][] = "_project_path_idx";
- $RAPORT['IGNORE_TABLES'][] = "BILLING_USERS_ADD_OLD";
- $RAPORT['IGNORE_TABLES'][] = "CRM_LISTA_ZASOBOW_ACL";
- $RAPORT['IGNORE_TABLES'][] = "CRM_LISTA_ZASOBOW_test";
- $RAPORT['IGNORE_TABLES'][] = "CRM_PROCES_idx_USER_to_PROCES_VIEW";
- $RAPORT['IGNORE_TABLES'][] = "CRM_PROCES_idx_USER_to_INIT_VIEW";
- $RAPORT['IGNORE_TABLES'][] = "DEALS_TABLE_2015_03_17_zest_dla_zubryka";
- $RAPORT['IGNORE_TABLES'][] = "_PLUGIN_MANAGER";
- $RAPORT['IGNORE_TABLES'][] = "_PRZYPOMNIJ_CACHE";
- // $RAPORT['IGNORE_TABLES'][] = "";
- //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']}' ";
- }
-
- echo "<br>Jade zapytanie ".$ZAP_SQL;
-
- $res = $db->query($ZAP_SQL);
- while($R = $db->fetch_array($res)) {
- $dbTbls[] = $R;
- }
-
- echo "<br> Widoki : ".print_r($dbTbls);
-
- DEBUG_S(-1,'widoki ',$dbTbls,__FILE__,__FUNCTION__,__LINE__);
- foreach ($dbTbls as $R) {
- if (!in_array($R[0], $RAPORT['IGNORE_TABLES'])) {
- if(!strstr($R[0], '_HIST'))
- $RAPORT['TABLES_ALL'][] = $R[0];
- }
- }
-
-
- echo "<br> TABLES_ALL : ".print_r($RAPORT['TABLES_ALL']);
- unset($dbTbls);
- $ZAP_SQL = array();
-
-
-
- foreach ($RAPORT['TABLES_ALL'] as $RTH_I=>$RTH_A) {
- $sql="select A_STATUS as VALUE, count(ID) as COUNT from ".$RTH_A." group by A_STATUS ";
- $res = $db->query($sql);
- //$r2 = $db->fetch_array($res);
-
- echo "<br> jade raport dla tabeli ".$RTH_A." sql:".$sql." print_r r2".print_r($r2) ;
- while($h=$db->fetch($res)) {
- if (isset($h->VALUE)) {
- //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}','{$h->COUNT}','A_STATUS','{$h->VALUE}',now())";
- echo "<br>".$sql;
- DB::query($sql) or die($sql);
- }
- }
-
- //teraz the_geom
- $sql="select if(the_geom like '_%',1,0) as VALUE, count(ID) as COUNT from ".$RTH_A." group by if(the_geom like '_%',1,0) ";
- $res = $db->query($sql);
- //$r2 = $db->fetch_array($res);
-
- echo "<br> jade raport dla tabeli ".$RTH_A." sql:".$sql." print_r r2".print_r($r2) ;
- while($h=$db->fetch($res)) {
- if (isset($h->VALUE)) {
- //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}','{$h->COUNT}','the_geom','{$h->VALUE}',now())";
- echo "<br>".$sql;
- DB::query($sql) or die($sql);
- }
- }
-
-
- }
-
- }
|