From 9bf57f696b44d7a862acbd8128a15b10fc6c12eb Mon Sep 17 00:00:00 2001 From: Wilfried Trinkl Date: Fri, 28 May 2021 07:24:22 +0200 Subject: [PATCH] Neue Statistik --- plugins/AsdCurl/config/bootstrap.php | 7 +- plugins/AsdCurl/src/AsdCurl.php | 25 +- plugins/AsdCurl/src/AsdUs.php | 39 +- src/Controller/CurlsController.php | 13 +- src/Controller/EmailsController.php | 10 +- src/Controller/ExaminationsController.php | 6 + src/Controller/ImportsController.php | 51 +- src/Controller/OfficesController.php | 9 +- src/Template/Curls/up_statistik_para.ctp | 90 +- src/Template/Curls/up_statistik_test.ctp | 113 + src/Template/Curls/us_statistik.ctp | 2 +- src/Template/Curls/us_statistik_para.ctp | 9 +- src/Template/Imports/ftp_get_json.ctp | 0 src/Template/Layout/pivotdatatables.ctp | 56 + .../DataTables-1.10.24/images/sort_asc.png | Bin 0 -> 160 bytes .../images/sort_asc_disabled.png | Bin 0 -> 146 bytes .../DataTables-1.10.24/images/sort_both.png | Bin 0 -> 201 bytes .../DataTables-1.10.24/images/sort_desc.png | Bin 0 -> 158 bytes .../images/sort_desc_disabled.png | Bin 0 -> 148 bytes webroot/css/datatables.css | 1277 + webroot/css/datatables.min.css | 21 + webroot/css/pivot-costum.css | 24 +- webroot/files/ap/export.csv | 1677 - webroot/files/ap/results.csv | 5909 +- webroot/files/data-up-old.json | 1 + webroot/files/data-up.json | 4237 +- webroot/files/para-data-up.json | 33 + webroot/files/para-data-us.json | 2 +- webroot/files/prod-data-us.json | 2 +- webroot/files/test.json | 55 +- webroot/files/test.zip | Bin 0 -> 92352 bytes webroot/files/übermittlungsstatistik.sql | 64 + webroot/img/img/cake.icon.png | Bin 0 -> 1449 bytes webroot/js/German.json | 182 + webroot/js/datatables.js | 81531 ++++++++++++++++ webroot/js/datatables.min.js | 437 + 36 files changed, 91139 insertions(+), 4743 deletions(-) create mode 100644 src/Template/Curls/up_statistik_test.ctp create mode 100644 src/Template/Imports/ftp_get_json.ctp create mode 100644 src/Template/Layout/pivotdatatables.ctp create mode 100644 webroot/css/DataTables-1.10.24/images/sort_asc.png create mode 100644 webroot/css/DataTables-1.10.24/images/sort_asc_disabled.png create mode 100644 webroot/css/DataTables-1.10.24/images/sort_both.png create mode 100644 webroot/css/DataTables-1.10.24/images/sort_desc.png create mode 100644 webroot/css/DataTables-1.10.24/images/sort_desc_disabled.png create mode 100644 webroot/css/datatables.css create mode 100644 webroot/css/datatables.min.css create mode 100644 webroot/files/data-up-old.json create mode 100644 webroot/files/test.zip create mode 100644 webroot/files/übermittlungsstatistik.sql create mode 100644 webroot/img/img/cake.icon.png create mode 100644 webroot/js/German.json create mode 100644 webroot/js/datatables.js create mode 100644 webroot/js/datatables.min.js diff --git a/plugins/AsdCurl/config/bootstrap.php b/plugins/AsdCurl/config/bootstrap.php index 6fff6cd..8ba45ed 100644 --- a/plugins/AsdCurl/config/bootstrap.php +++ b/plugins/AsdCurl/config/bootstrap.php @@ -16,8 +16,8 @@ define('SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesigc3ba168505 //define('PROD_SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesigc3ba1685059aaf325d44099df697a0a635e79a4ec36ec614a98f3bf4b79d7c043ac3880605b7751df91d11233380ad86/uniquesig0/asd'); //define('PROD_SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig632cea04e8c585dd8dd40ffb367af53448ad1113e945323b22126735ae9513abb1f12262cb9414f17e32ca470882289a/uniquesig0/asd'); define('PROD_SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/f5-w-687474703a2f2f6173642d6170702d70726f642e727a2d737565642e62617965726e2e64653a38323830$$/asd/'); -define('PARA_SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesiga877c16a8d4fa0326c4d1f7447020d3867d9b0ca4503652219a0f5b2b569f316747c8c199bc9626ccb01613a0a36a342/uniquesig0/asd'); - +//define('PARA_SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesiga877c16a8d4fa0326c4d1f7447020d3867d9b0ca4503652219a0f5b2b569f316747c8c199bc9626ccb01613a0a36a342/uniquesig0/asd'); +define('PARA_SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/f5-w-687474703a2f2f6173642d6170702d766d7030312e727a2d737565642e6279626e2e64653a38323830$$/asd/'); //define('SCHULPORTAL_MSTR_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig9adaec6129c81dbeb2f42638bc9f27ac0c442a10891f0c915c9d7f0c371a00b3/uniquesig1/asd'); define('SCHULPORTAL_MSTR_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig182e937bef9540ecffb7e0ba167caaea052491068bd93a46e70dbd73bf9f8963/uniquesig1/asd'); @@ -31,7 +31,8 @@ Configure::write('AsdCurl.cookiefile', '/tmp/cookies.txt'); Configure::write('AsdCurl.cookie', 'cookiename=cookievalue'); Configure::write('AsdCurl.useragent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0'); //Configure::write('AsdCurl.useragent', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36'); -Configure::write('AsdCurl.cert','/var/www/html/ssl_KM_Z2016_asd.trinkl.pem'); +//Configure::write('AsdCurl.cert','/var/www/html/ssl_KM_Z2016_asd.trinkl.pem'); +Configure::write('AsdCurl.cert','/var/www/html/ssl_Z_KM2019_asd.trinkl.pem'); Configure::write('AsdCurl.schulbase0url',SCHULPORTAL_BASE0_URL); Configure::write('AsdCurl.schulbaseurl',SCHULPORTAL_BASE_URL); Configure::write('AsdCurl.asdbaseurl',SCHULPORTAL_ASD_BASE_URL); diff --git a/plugins/AsdCurl/src/AsdCurl.php b/plugins/AsdCurl/src/AsdCurl.php index 5d83fd9..687745f 100644 --- a/plugins/AsdCurl/src/AsdCurl.php +++ b/plugins/AsdCurl/src/AsdCurl.php @@ -97,13 +97,12 @@ class AsdCurl if(!($this->status)) { die($this->error); } - $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); - + //debug($this->html);die; + $viewstate = $this->get_string_between($this->html, 'id="j_id1:javax.faces.ViewState:0" value="', '" autocomplete'); + //debug($viewstate); $login_data = [ 'asd_username' => 'A005_TrinklW', - 'asd_password' => 'HiegTzs!195', - //'asd_username' => 'A005_KnollmüllerP', - //'asd_password' => 'Ooricha8e!', + 'asd_password' => 'qQ8r&Dm->>sAKv $login_data['asd_username'], @@ -116,7 +115,7 @@ class AsdCurl if(!($this->status)) { die($this->error); } - $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $viewstate = $this->get_string_between($this->html, 'id="j_jdi:javax.faces.ViewState:0" value="', '" autocomplete'); Configure::write('Session', ['viewstate' => $viewstate]); //echo $this->html;die; } @@ -131,7 +130,7 @@ class AsdCurl $post = [ 'Uid' => 'A005_TrinklW', - 'Pwd' => 'HiegTzs!12', + 'Pwd' => 'geheim', ]; $pvar['ConnMode'] = $this->get_string_between($this->html, ''); $pvar['3054'] = $this->get_string_between($this->html, ''); @@ -178,10 +177,9 @@ class AsdCurl if(!($this->status)) { die($this->error); } - - $vorschalt = $this->get_string_between($this->html,'an parallelen Zugriffen zu ',' beim'); + $vorschalt = $this->get_string_between($this->html,'gibt es vereinzelt ',' beim'); //debug($vorschalt); - if($vorschalt == 'Anmeldeproblemen') { + if($vorschalt == 'Störungen') { $post = [ 'choice' => 1 @@ -191,7 +189,7 @@ class AsdCurl //debug($this->html); } - //echo $this->html; die; + //echo $this->html; die; $login_data = [ 'portal_username' => 'asd.trinkl', 'portal_password' => 'HiegTzs!193', @@ -208,7 +206,7 @@ class AsdCurl ]; // Anmeldeformular fuer das Schulportal abschicken - Step 2 -//https://portal.schulen.bayern.de/uniquesig2d1dfad4a11c25e42c462e53b4721e48/uniquesig0/SecureSchulportalPortalHomePage/ + //https://portal.schulen.bayern.de/uniquesig2d1dfad4a11c25e42c462e53b4721e48/uniquesig0/SecureSchulportalPortalHomePage/ //$this->exec_curl($ch, $SCHULPORTAL_BASE_URL . '/SecureSchulportalPortalHomePage', $post); //debug($SCHULPORTAL_BASE_URL); //$this->exec_curl($ch, $SCHULPORTAL_BASE_URL . '/InternalSite/Validate.asp', $post); @@ -216,9 +214,10 @@ class AsdCurl if(!($this->status)) { die($this->error); } + //debug($this);die; //debug($this->html);die; //$this->exec_curl($ch, $SCHULPORTAL_BASE_URL . '/SecureSchulportalPortalHomePage/',false); - //debug($this->html);die; + //echo $this->html;die; } public function exec_mstr($ch, $url, $post) diff --git a/plugins/AsdCurl/src/AsdUs.php b/plugins/AsdCurl/src/AsdUs.php index f931ff7..f6da815 100644 --- a/plugins/AsdCurl/src/AsdUs.php +++ b/plugins/AsdCurl/src/AsdUs.php @@ -57,7 +57,7 @@ class AsdUs extends AsdCurl public function save_us_data($ch,$env) { $SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl.'.$env); // Maske US 01 01 vom linken Menü aufrufen - $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $viewstate = $this->get_string_between($this->html, 'id="j_id1:javax.faces.ViewState:0" value="', '" autocomplete'); $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); $post = [ 'sideMenu' => 'sideMenu', @@ -70,7 +70,7 @@ class AsdUs extends AsdCurl } //echo $this->html;die; // In Maske US 01 01 alle Felder leer lassen und "Suchen" ausführen - $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $viewstate = $this->get_string_between($this->html, 'id="j_id1:javax.faces.ViewState:0" value="', '" autocomplete'); $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); $post = [ 'mainForm' => 'mainForm', @@ -109,14 +109,16 @@ class AsdUs extends AsdCurl } //echo $this->html; // Auf der Ergebnisseite auf "Alle" Klicken - $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $viewstate = $this->get_string_between($this->html, 'id="j_id1:javax.faces.ViewState:0" value="', '" autocomplete'); $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); $htmlParser = new \DOMDocument(); //to parse html using DOMDocument libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal $htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml + //debug($this->html); $htmlParser->preserveWhiteSpace = false; $hrefs = $htmlParser->getElementsByTagName('a'); + //debug($hrefs);die; foreach($hrefs as $href) { if($href->textContent == 'ALLE') { foreach ($href->attributes as $attribute) { @@ -197,22 +199,31 @@ class AsdUs extends AsdCurl } public function save_up_data($ch,$env) { + //echo $this->html;die; $SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl.'.$env); // Maske US 01 01 vom linken Menü aufrufen - $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + //$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $viewstate = $this->get_string_between($this->html, 'id="j_id1:javax.faces.ViewState:0" value="', '" autocomplete'); $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); + //debug($viewstate); + //debug($conversationId); $post = [ 'sideMenu' => 'sideMenu', 'javax.faces.ViewState' => $viewstate, 'sideMenu:j_idt52:0:j_idt58:1:j_idt60' => 'sideMenu:j_idt52:0:j_idt58:1:j_idt60', ]; - $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_18_01.jsf?cid=' . $conversationId, $post); + //$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_18_01.jsf?cid=' . $conversationId, $post); + $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_00_00.jsf?cid=' . $conversationId, $post); if(!($this->status)) { die($this->error); } + //echo $this->html;die; // In Maske US 01 01 alle Felder leer lassen und "Suchen" ausführen - $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + //$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $viewstate = $this->get_string_between($this->html, 'id="j_id1:javax.faces.ViewState:0" value="', '" autocomplete'); $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); + //debug($viewstate); + //debug($conversationId); $post = [ 'mainForm' => 'mainForm', 'referenzBaumAnzeigen' => 'false', @@ -243,17 +254,21 @@ class AsdUs extends AsdCurl 'mainForm:action_suchen' => 'Suchen', 'javax.faces.ViewState' => $viewstate, ]; + //debug($post); $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_03_01.jsf?cid=' . $conversationId, $post); if(!($this->status)) { die($this->error); } + //debug($this->html);die; $htmlParser = new \DOMDocument(); //to parse html using DOMDocument libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal $htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml $htmlParser->preserveWhiteSpace = false; $hrefs = $htmlParser->getElementsByTagName('a'); + //debug($hrefs); foreach($hrefs as $href) { + debug($href->textContent); if($href->textContent == 'ALLE') { foreach ($href->attributes as $attribute) { if($attribute->name == 'onclick') { @@ -263,10 +278,12 @@ class AsdUs extends AsdCurl } } } - } - //echo $this->html;die; + } + //debug($linkid); + //debug($this->html);die; // Auf der Ergebnisseite auf "Alle" Klicken - $viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + //$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete'); + $viewstate = $this->get_string_between($this->html, 'id="j_id1:javax.faces.ViewState:0" value="', '" autocomplete'); $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); //$mainform = $this->get_string_between($this->html, '\\\':\\\'', '\\\'},\\\'\\\')\');return false\" class=\"ignoreChangeNotification notBold\">ALLE'); //debug($mainform);die; @@ -285,12 +302,14 @@ class AsdUs extends AsdCurl 'mainForm:istAnzeigeMaske' => 'false', 'javax.faces.ViewState' => $viewstate, 'mainForm:j_idt'.$linkid => 'mainForm:j_idt'.$linkid + //'mainForm:j_idt189' => 'mainForm:j_idt189' ]; + //debug($post); $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_03_02.jsf?cid=' . $conversationId, $post); if(!($this->status)) { die($this->error); } - //echo $this->html;die; + //debug($this->html);die; // Ergebnisse parsen und in die MySQL - Datenbank schreiben $htmlParser = new \DOMDocument(); //to parse html using DOMDocument libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal diff --git a/src/Controller/CurlsController.php b/src/Controller/CurlsController.php index c7a8a97..2f7ec6e 100644 --- a/src/Controller/CurlsController.php +++ b/src/Controller/CurlsController.php @@ -13,7 +13,7 @@ class CurlsController extends AppController { public function beforeFilter(Event $event) { //$this->Auth->setConfig('checkAuthIn', 'Controller.initialize'); - $this->Auth->allow(['saveus','getjsonus','saveup','getjsonup','usStatistik','usStatistikPara','upStatistik','upStatistikPara','hackasd']); + $this->Auth->allow(['saveus','getjsonus','saveup','getjsonup','usStatistik','usStatistikPara','upStatistik','upStatistikTest','upStatistikPara','hackasd']); } //public $uses = array('Monitoring'); @@ -132,7 +132,7 @@ class CurlsController extends AppController } $curl = new AsdUs(); //debug($curl->status); - $ch = $curl->init_curl_params(); + $ch = $curl->init_curl_params(); $curl->login_school($ch); $curl->login_asd($ch,$env); $curl->save_up_data($ch,$env); @@ -202,6 +202,15 @@ class CurlsController extends AppController $this->viewBuilder()->layout('pivot'); } + public function upStatistikTest() { + $file = new File('/var/www/html/asd-control/webroot/files/test.json', true, 0644); + $ts = $file->lastChange(); + $time = Time::createFromTimestamp($ts); + $time->timezone = 'Europe/Paris'; + $this->set('time', $time); + $this->viewBuilder()->layout('pivotdatatables'); + } + public function upStatistikPara() { $file = new File('/var/www/html/asd-control/webroot/files/para-data-up.json', true, 0644); $ts = $file->lastChange(); diff --git a/src/Controller/EmailsController.php b/src/Controller/EmailsController.php index 343c862..41dc4fd 100644 --- a/src/Controller/EmailsController.php +++ b/src/Controller/EmailsController.php @@ -180,7 +180,7 @@ class EmailsController extends AppController $email ->emailFormat('html') ->from(['abschlusspruefung@schulen.bayern.de' => 'Abschlusspruefung']) - //->to('asd.trinkl@schulen.bayern.de') + //->to('asd.statistik@schulen.bayern.de') ->to($mail->snr . '@schulen.bayern.de') ->cc('abschlusspruefung@schulen.bayern.de') ->template('abschluss') @@ -190,6 +190,7 @@ class EmailsController extends AppController $mail['sent'] = 1; //$line = $this->Apimports->patchEntity($line, (array) $data); $result = $this->Emails->save($mail); + //die; } //die; return $this->redirect(['controller' => 'Apresults', 'action' => 'export']); @@ -236,7 +237,8 @@ class EmailsController extends AppController $data->text .= ''. $item->anzahl . '' . $item->schuelerstatus .''; } $data->text .= ''; - $data->text .= '

Bitte überprüfen Sie diese Ergebnisse sorgfältig und wenden Sie sich umgehend an den ASV Support, falls Unstimmigkeiten auftreten sollten.

'; + $data->text .= '

Bitte überprüfen Sie ob die Anzahl der Prüflinge, externen Prüfungsteilnehmer und insbesondere die der Nichtschüler plausibel ist.

'; + $data->text .= '

Wenden Sie sich bitte umgehend an den ASV Support, falls Unstimmigkeiten auftreten sollten.

'; $data->text .= '

Ihr ASD-Team

'; //debug($data); @@ -282,8 +284,10 @@ class EmailsController extends AppController $data->erzeugungsdatum = date('Y-m-d H:i:s', strtotime(str_replace('-', '/', trim($row[4])))); $data->lieferung = trim($row[5]); $line = $this->Apimports->newEntity(); - $line = $this->Apimports->patchEntity($line, (array) $data); + $line = $this->Apimports->patchEntity($line, (array) $data); + //debug($line); $result = $this->Apimports->save($line); + //debug($result); //$i++; } //die; diff --git a/src/Controller/ExaminationsController.php b/src/Controller/ExaminationsController.php index 2de0f8c..b4f872a 100644 --- a/src/Controller/ExaminationsController.php +++ b/src/Controller/ExaminationsController.php @@ -4,6 +4,7 @@ namespace App\Controller; use App\Controller\AppController; use Cake\Mailer\Email; +use Cake\Event\Event; /** * Examinations Controller @@ -12,6 +13,11 @@ use Cake\Mailer\Email; */ class ExaminationsController extends AppController { + public function beforeFilter(Event $event) { + //$this->Auth->setConfig('checkAuthIn', 'Controller.initialize'); + $this->Auth->allow(['sendresult']); + } + public function sendresult() { $email = new Email('default'); $email->from(['asd.trinkl@schulen.bayern.de' => 'ASD Trinkl']) diff --git a/src/Controller/ImportsController.php b/src/Controller/ImportsController.php index 5ba5219..1c95a21 100644 --- a/src/Controller/ImportsController.php +++ b/src/Controller/ImportsController.php @@ -17,7 +17,7 @@ class ImportsController extends AppController { public function beforeFilter(Event $event) { //$this->Auth->setConfig('checkAuthIn', 'Controller.initialize'); //$this->Auth->allow('ftp','ftpAnalyse','ftp_analyse','index'); - $this->Auth->allow(['ftp','ftpanalyse']); + $this->Auth->allow(['ftp','ftpanalyse','ftpGetJson']); } @@ -137,6 +137,45 @@ class ImportsController extends AppController { } + public function ftpGetJson() { + $ftp_server = "10.190.22.35"; + $ftp_port = "2587"; + $ftp_user = "LfStaD-Log"; + $ftp_pass = "135!Log!086"; + $local_file = '/var/www/html/asd-control/webroot/files/test.zip'; + $zip_pass = 'z&bwr8zx3$$)'; + $local_folder = '/var/www/html/asd-control/webroot/files'; + + $conn_id = ftp_connect($ftp_server, $ftp_port) or die("Couldn't connect to $ftp_server"); + + if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) { + echo "Angemeldet als $ftp_user@$ftp_server\n"; + } else { + echo "Anmeldung als $ftp_user nicht möglich\n"; + } + + ftp_get($conn_id, $local_file, 'AB-1928_data_up_2021.zip', FTP_BINARY); + + $zip = new ZipArchive(); + $zip_status = $zip->open($local_file); + + if ($zip_status === true) { + if ($zip->setPassword($zip_pass)) { + if (!$zip->extractTo($local_folder)) + echo "Extraction failed (wrong password?)"; + } + //debug($zip->statIndex(0)); + $file = $zip->statIndex(0)['name']; + //debug($file); + //debug($file); + $zip->close(); + } + else { + die("Failed opening archive: " . @$zip->getStatusString() . " (code: " . $zip_status . ")"); + } + rename($local_folder. DS . $file,'/var/www/html/asd-control/webroot/files/data-up.json'); + } + public function ftp() { $ftp_server = "10.190.22.35"; $ftp_port = "2587"; @@ -157,8 +196,9 @@ class ImportsController extends AppController { ftp_chdir($conn_id, 'ap-csv'); $contents = ftp_nlist($conn_id, "."); //debug($contents); - $abschluss = array_search('AB-341_Abschlusspruefung_2019_PROD.zip',$contents); - debug($abschluss); + //$abschluss = array_search('AB-1153_Abschlusspruefung_2020_VorProd.zip',$contents); + $abschluss = array_search('AB-1189_Abschlusspruefung_2020_Prod.zip',$contents); + //debug($abschluss); //die; ftp_get($conn_id, $local_file, $contents[$abschluss], FTP_BINARY); @@ -180,7 +220,8 @@ class ImportsController extends AppController { die("Failed opening archive: " . @$zip->getStatusString() . " (code: " . $zip_status . ")"); } rename('/test/results/'.$file,'/var/www/html/asd-control/webroot/files/ap/results.csv'); - exec('/usr/bin/smbclient -U \'BAYKM/km-tri-wil%HiegTzs!193\' //KM-Svr-Daten/Projektshare -c \'cd /14_Materialien/Austausch/WiTr/ap; put /var/www/html/asd-control/webroot/files/ap/results.csv results-ap.csv\''); + //die; + //exec('/usr/bin/smbclient -U \'BAYKM/km-tri-wil%HiegTzs!202\' //KM-Svr-Daten/Projektshare -c \'cd /14_Materialien/Austausch/WiTr/ap; put /var/www/html/asd-control/webroot/files/ap/results.csv results-ap.csv\''); //die; //debug($contents);die; @@ -210,6 +251,8 @@ class ImportsController extends AppController { $this->csv2db($job); } */ ftp_close($conn_id); + //debug($file); + //die; return $this->redirect(['controller' => 'Emails', 'action' => 'import']); } diff --git a/src/Controller/OfficesController.php b/src/Controller/OfficesController.php index 3c4fcac..01a379a 100644 --- a/src/Controller/OfficesController.php +++ b/src/Controller/OfficesController.php @@ -3,6 +3,7 @@ namespace App\Controller; use App\Controller\AppController; //use Cake\ORM\TableRegistry; +use Cake\Event\Event; /** * Offices Controller @@ -11,6 +12,10 @@ use App\Controller\AppController; */ class OfficesController extends AppController { + public function beforeFilter(Event $event) { + //$this->Auth->setConfig('checkAuthIn', 'Controller.initialize'); + $this->Auth->allow(['importdst']); + } public function importdst() { @@ -19,7 +24,7 @@ class OfficesController extends AppController //debug($this->request['data']);die; $options = [ 'length' => 0, - 'delimiter' => ',', + 'delimiter' => ';', 'enclosure' => '"', 'escape' => '\\', 'headers' => false, @@ -79,7 +84,9 @@ class OfficesController extends AppController 'text' => false, 'excel_bom' => false, ]; + //debug($this->request['data']['file']); $handle = fopen($this->request['data']['file']['tmp_name'], "r"); + //die; $i = 0; while ($row = fgetcsv($handle, $options['length'], $options['delimiter'])) { $data = array(); diff --git a/src/Template/Curls/up_statistik_para.ctp b/src/Template/Curls/up_statistik_para.ctp index 689b743..88d0560 100644 --- a/src/Template/Curls/up_statistik_para.ctp +++ b/src/Template/Curls/up_statistik_para.ctp @@ -1,48 +1,23 @@ UP 2020 (PARA) - Stand: ' . $time->i18nFormat('dd.MM.yyyy HH:mm') . ''; +echo '

UP 2021 (PARA) - Stand: ' . $time->i18nFormat('dd.MM.yyyy HH:mm') . '

'; ?> + +
+

+ + + \ No newline at end of file diff --git a/src/Template/Curls/us_statistik.ctp b/src/Template/Curls/us_statistik.ctp index ff7daab..ff08913 100644 --- a/src/Template/Curls/us_statistik.ctp +++ b/src/Template/Curls/us_statistik.ctp @@ -1,5 +1,5 @@ US 2019 (PROD) - Stand: ' . $time->i18nFormat('dd.MM.yyyy HH:mm') . ''; +echo '

US 2020 (PROD) - Stand: ' . $time->i18nFormat('dd.MM.yyyy HH:mm') . '

'; ?>