Initial commit
This commit is contained in:
11
plugins/AsdCurl/README.md
Normal file
11
plugins/AsdCurl/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# AsdCurl plugin for CakePHP
|
||||
|
||||
## Installation
|
||||
|
||||
You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).
|
||||
|
||||
The recommended way to install composer packages is:
|
||||
|
||||
```
|
||||
composer require your-name-here/AsdCurl
|
||||
```
|
||||
23
plugins/AsdCurl/composer.json
Normal file
23
plugins/AsdCurl/composer.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "your-name-here/AsdCurl",
|
||||
"description": "AsdCurl plugin for CakePHP",
|
||||
"type": "cakephp-plugin",
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"cakephp/cakephp": ">=3.3.2 <4.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"AsdCurl\\": "src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"AsdCurl\\Test\\": "tests",
|
||||
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
|
||||
}
|
||||
}
|
||||
}
|
||||
32
plugins/AsdCurl/config/bootstrap.php
Normal file
32
plugins/AsdCurl/config/bootstrap.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use Cake\Core\Configure\Engine\PhpConfig;
|
||||
|
||||
try {
|
||||
Configure::config('default', new PhpConfig());
|
||||
Configure::load('app', 'default', false);
|
||||
} catch (\Exception $e) {
|
||||
exit($e->getMessage() . "\n");
|
||||
}
|
||||
|
||||
define('SCHULPORTAL_BASE0_URL', "https://portal.schulen.bayern.de");
|
||||
define('SCHULPORTAL_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig2d1dfad4a11c25e42c462e53b4721e48/uniquesig0');
|
||||
define('SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesigc3ba1685059aaf325d44099df697a0a635e79a4ec36ec614a98f3bf4b79d7c043ac3880605b7751df91d11233380ad86/uniquesig0/asd');
|
||||
//define('SCHULPORTAL_MSTR_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig9adaec6129c81dbeb2f42638bc9f27ac0c442a10891f0c915c9d7f0c371a00b3/uniquesig1/asd');
|
||||
define('SCHULPORTAL_MSTR_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig182e937bef9540ecffb7e0ba167caaea052491068bd93a46e70dbd73bf9f8963/uniquesig1/asd');
|
||||
|
||||
|
||||
Configure::write('AsdCurl.proxy','10.1.248.1:82');
|
||||
Configure::write('AsdCurl.cookiejar', '/tmp/cookies.txt');
|
||||
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.cert','/var/www/html/ssl_KM_Z2016_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);
|
||||
Configure::write('AsdCurl.mstrbaseurl',SCHULPORTAL_MSTR_BASE_URL);
|
||||
|
||||
?>
|
||||
|
||||
12
plugins/AsdCurl/config/routes.php
Normal file
12
plugins/AsdCurl/config/routes.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
use Cake\Routing\RouteBuilder;
|
||||
use Cake\Routing\Router;
|
||||
use Cake\Routing\Route\DashedRoute;
|
||||
|
||||
Router::plugin(
|
||||
'AsdCurl',
|
||||
['path' => '/asd-curl'],
|
||||
function (RouteBuilder $routes) {
|
||||
$routes->fallbacks(DashedRoute::class);
|
||||
}
|
||||
);
|
||||
43
plugins/AsdCurl/phpunit.xml.dist
Normal file
43
plugins/AsdCurl/phpunit.xml.dist
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
colors="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
bootstrap="./tests/bootstrap.php"
|
||||
>
|
||||
<php>
|
||||
<ini name="memory_limit" value="-1"/>
|
||||
<ini name="apc.enable_cli" value="1"/>
|
||||
</php>
|
||||
|
||||
<!-- Add any additional test suites you want to run here -->
|
||||
<testsuites>
|
||||
<testsuite name="AsdCurl Test Suite">
|
||||
<directory>./tests/TestCase</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<!-- Setup a listener for fixtures -->
|
||||
<listeners>
|
||||
<listener
|
||||
class="\Cake\TestSuite\Fixture\FixtureInjector"
|
||||
file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php">
|
||||
<arguments>
|
||||
<object class="\Cake\TestSuite\Fixture\FixtureManager" />
|
||||
</arguments>
|
||||
</listener>
|
||||
</listeners>
|
||||
|
||||
<!-- Prevent coverage reports from looking in tests and vendors -->
|
||||
<filter>
|
||||
<blacklist>
|
||||
<directory suffix=".php">./vendor/</directory>
|
||||
<directory suffix=".ctp">./vendor/</directory>
|
||||
|
||||
<directory suffix=".php">./tests/</directory>
|
||||
<directory suffix=".ctp">./tests/</directory>
|
||||
</blacklist>
|
||||
</filter>
|
||||
|
||||
</phpunit>
|
||||
193
plugins/AsdCurl/src/AsdCurl.php
Normal file
193
plugins/AsdCurl/src/AsdCurl.php
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
namespace AsdCurl;
|
||||
|
||||
use Cake\Core\Configure;
|
||||
|
||||
|
||||
|
||||
class AsdCurl
|
||||
{
|
||||
public $status;
|
||||
public $error;
|
||||
public $html;
|
||||
public $message;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->status = false;
|
||||
$this->error = false;
|
||||
$this->html = '';
|
||||
$this->message = '';
|
||||
}
|
||||
|
||||
public function init_curl_params()
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_PROXY, Configure::read('AsdCurl.proxy'));
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, Configure::read('AsdCurl.useragent'));
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
|
||||
curl_setopt($ch, CURLOPT_COOKIEJAR, Configure::read('AsdCurl.cookiejar'));
|
||||
curl_setopt($ch, CURLOPT_COOKIEFILE, Configure::read('AsdCurl.cookiefile'));
|
||||
curl_setopt($ch, CURLOPT_COOKIE, Configure::read('AsdCurl.cookie'));
|
||||
curl_setopt($ch, CURLOPT_SSLCERT, Configure::read('AsdCurl.cert'));
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
return ($ch);
|
||||
}
|
||||
|
||||
public function get_string_between($string, $start, $end)
|
||||
{
|
||||
//debug($start);
|
||||
//debug($end);
|
||||
$string = " " . $string;
|
||||
$ini = strpos($string, $start);
|
||||
//debug($ini);
|
||||
//debug($string);die;
|
||||
if ($ini == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
$ini += strlen($start);
|
||||
$len = strpos($string, $end, $ini) - $ini;
|
||||
$sub = substr($string, $ini, $len);
|
||||
$elem = explode(' ', $sub)[0];
|
||||
return str_replace('"', '', $elem);
|
||||
}
|
||||
|
||||
public function exec_curl($ch, $url, $post)
|
||||
{
|
||||
if ($post == false) {
|
||||
curl_setopt($ch, CURLOPT_POST, 0);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array());
|
||||
} else {
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
$this->html = curl_exec($ch);
|
||||
//debug(curl_errno($ch));
|
||||
//debug(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
||||
if (curl_errno($ch)) {
|
||||
$this->status = false;
|
||||
$this->error = 'Couldn\'t send request: ' . curl_error($ch);
|
||||
} else {
|
||||
$resultStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
if ($resultStatus != 200) {
|
||||
$this->status = false;
|
||||
$this->error = 'Request failed: HTTP status code: ' . $resultStatus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function login_asd($ch)
|
||||
{
|
||||
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl');
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asddv/dv_xy_00.jsf', false);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
|
||||
$login_data = [
|
||||
'asd_username' => 'A005_TrinklW',
|
||||
'asd_password' => 'HiegTzs!12',
|
||||
];
|
||||
$post = [
|
||||
'login:username' => $login_data['asd_username'],
|
||||
'login:password' => $login_data['asd_password'],
|
||||
'login' => 'login',
|
||||
'javax.faces.ViewState' => $viewstate,
|
||||
'login:loginButton' => 'login:loginButton',
|
||||
];
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/login/login.jsf', $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
Configure::write('Session', ['viewstate' => $viewstate]);
|
||||
}
|
||||
|
||||
public function login_mstr($ch) {
|
||||
$SCHULPORTAL_MSTR_BASE_URL = Configure::read('AsdCurl.mstrbaseurl');
|
||||
$url = '/asp';
|
||||
//debug($SCHULPORTAL_MSTR_BASE_URL . $url);die;
|
||||
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, false);
|
||||
|
||||
//debug($this->html);die;
|
||||
|
||||
$post = [
|
||||
'Uid' => 'A005_TrinklW',
|
||||
'Pwd' => 'HiegTzs!12',
|
||||
];
|
||||
$pvar['ConnMode'] = $this->get_string_between($this->html, '<input name="ConnMode" id="ConnMode" type="hidden" class="mstrHiddenInput" value="', '"/>');
|
||||
$pvar['3054'] = $this->get_string_between($this->html, '<input name="3054" id="3054" type="submit" value="', '" class="mstrButton"/>');
|
||||
$mstr_login_vars = array('evt', 'src', 'target', 'key', 'Port', 'Project', 'Server', 'login', 'smartBanner', 'lb');
|
||||
foreach ($mstr_login_vars as $var) {
|
||||
$value = $this->get_string_between($this->html, 'name="' . $var . '" type="hidden" class="mstrHiddenInput" value="', '"/>');
|
||||
//$value = $this->get_string_between($this->html, 'name="' . $var . '" value=', 'type="hidden"');
|
||||
$pvar[$var] = $value;
|
||||
}
|
||||
|
||||
$post = array_merge($post, $pvar);
|
||||
//debug($post);die;
|
||||
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . '/asp/Main.aspx', $post);
|
||||
if(strpos($this->html,'Login failure')) {
|
||||
$this->status = false;
|
||||
}
|
||||
//debug($this->html);die;
|
||||
}
|
||||
|
||||
public function logout_mstr($ch) {
|
||||
$SCHULPORTAL_MSTR_BASE_URL = Configure::read('AsdCurl.mstrbaseurl');
|
||||
$url = '/asp/Main.aspx';
|
||||
$post = [
|
||||
'evt' => '3008',
|
||||
'src' => 'mstrWeb.3008',
|
||||
'xts' => exec('date +%s%3N'),
|
||||
];
|
||||
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, $post);
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
public function login_school($ch)
|
||||
{
|
||||
$SCHULPORTAL_BASE0_URL = Configure::read('AsdCurl.schulbase0url');
|
||||
$SCHULPORTAL_BASE_URL = Configure::read('AsdCurl.schulbaseurl');
|
||||
//$login_data = $this->request->session()->read('data');
|
||||
|
||||
$this->exec_curl($ch, $SCHULPORTAL_BASE_URL, false);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
$login_data = [
|
||||
'portal_username' => 'asd.trinkl',
|
||||
'portal_password' => 'HiegTzs!182',
|
||||
];
|
||||
|
||||
$post = [
|
||||
'user_name' => $login_data['portal_username'],
|
||||
'password' => $login_data['portal_password'],
|
||||
'repository' => 'schulen.bayern.de',
|
||||
'site_name' => 'schulportal',
|
||||
'secure' => '1',
|
||||
'resource_id' => '2',
|
||||
'login_type' => '2',
|
||||
];
|
||||
// Anmeldeformular fuer das Schulportal abschicken - Step 2
|
||||
|
||||
$this->exec_curl($ch, $SCHULPORTAL_BASE_URL . '/InternalSite/Validate.asp', $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
}
|
||||
|
||||
public function exec_mstr($ch, $url, $post)
|
||||
{
|
||||
$SCHULPORTAL_MSTR_BASE_URL = Configure::read('AsdCurl.mstrbaseurl');
|
||||
$html = $this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, $post);
|
||||
return ($html);
|
||||
}
|
||||
}
|
||||
120
plugins/AsdCurl/src/AsdMstr.php
Normal file
120
plugins/AsdCurl/src/AsdMstr.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace AsdCurl;
|
||||
|
||||
use AsdCurl\AsdCurl;
|
||||
use Cake\Core\Configure;
|
||||
|
||||
class AsdMstr extends AsdCurl
|
||||
{
|
||||
public function __construct($url = null)
|
||||
{
|
||||
$this->status = true;
|
||||
$this->error = false;
|
||||
}
|
||||
|
||||
public function send_mail($ch,$status,$message,$lastsuccess) {
|
||||
date_default_timezone_set("Europe/Berlin");
|
||||
$datestring = date('d.m.Y H:i');
|
||||
$url = 'http://www.dr-trinkl.de/index.php';
|
||||
// 'to' => 'wilfried.trinkl@stmbw.bayern.de;philipp.knollmueller@stmbw.bayern.de;johannes.moesl@stmbw.bayern.de',
|
||||
|
||||
$email_params=[
|
||||
'to' => 'wilfried.trinkl@stmbw.bayern.de;philipp.knollmueller@stmbw.bayern.de;johannes.moesl@stmbw.bayern.de',
|
||||
'bcc' => 'wilfried.trinkl@mail-wt.de',
|
||||
'from_name' => 'MSTR Monitoring',
|
||||
'from' => 'wilfried.trinkl@mail-wt.de',
|
||||
'secret' => 'QuaTe4tbchwFx9mxptEr'
|
||||
];
|
||||
if($status == 'Fail') {
|
||||
$email_content = [
|
||||
'subject' => 'MSTR Failing ' . $datestring,
|
||||
'body' => '<p>MSTR geht <b>WIEDER</b> nicht! Bitte umgehend tätig werden</p><p>' . $message .'</p>',
|
||||
];
|
||||
}
|
||||
else {
|
||||
$email_content = [
|
||||
'subject' => 'MSTR Up Again '. $datestring,
|
||||
'body' => '<p>MSTR geht <b>WIEDER</b>!</p>'.
|
||||
'<p>MSTR Monitoring auf JIRA: <a href="http://lfstad-sv-kmjira.rz-sued.bayern.de:8080/browse/AS-2112">http://lfstad-sv-kmjira.rz-sued.bayern.de:8080/browse/AS-2112</a></p>' .
|
||||
'<p>|Prod|' . $lastsuccess . '|'. $datestring . ' |WiTr| Die Verbindung zum Server ist fehlgeschlagen. |unbekannt |</p>',
|
||||
'bodyplain' => 'MSTR geht WIEDER!',
|
||||
];
|
||||
}
|
||||
$this->exec_curl($ch, $url, array_merge($email_params,$email_content));
|
||||
//debug($this->html);
|
||||
}
|
||||
|
||||
public function monit_mstr($ch)
|
||||
{
|
||||
$SCHULPORTAL_MSTR_BASE_URL = Configure::read('AsdCurl.mstrbaseurl');
|
||||
$reportID = '3F1FE53C4583613BABF14EA6242BACBE';
|
||||
// MSTR Bericht ausführen - Step 5
|
||||
|
||||
$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;
|
||||
|
||||
$links = $htmlParser->getElementsByTagName('a');
|
||||
foreach ($links as $link) {
|
||||
if ($link->nodeValue == 'Amtliche Schulstatistik') {
|
||||
$params = explode('&', $link->getAttribute('href'));
|
||||
foreach ($params as $param) {
|
||||
$parts = explode('=', $param);
|
||||
$lp[$parts[0]] = $parts[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
//debug($this->html);
|
||||
//debug($lp);
|
||||
if (!isset($lp)) {
|
||||
$this->status = false;
|
||||
$this->error = 'Project missing';
|
||||
} else {
|
||||
$url = '/asp/Main.aspx?evt=3010&src=' . $lp['src'] . '&ServerAlias=' . $lp['ServerAlias'] . '&Port=' . $lp['Port'] . '&Project=' . $lp['Project'] . '&Server=' . $lp['Server'] . '&loginReq=true';
|
||||
//debug($SCHULPORTAL_MSTR_BASE_URL . $url);die;
|
||||
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, false);
|
||||
|
||||
//$url = '/asp/Main.aspx?evt=4001&src=Main.aspx.4001&visMode=0&reportViewMode=1&reportID=' . $reportID . '&Server=' . $lp['ServerAlias'] . '&Project=PROD-1.46.1&Port=0&share=1';
|
||||
//debug($url);die;
|
||||
$url = '/asp/Main.aspx?evt=3067&src=Main.aspx.3067&reportViewMode=1&reportID=' . $reportID;
|
||||
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, false);
|
||||
|
||||
//debug($this->html);
|
||||
|
||||
sleep(20);
|
||||
|
||||
$post = array();
|
||||
$pvar = array();
|
||||
$mstr_result_vars = array('evt', 'src', 'reportViewMode', 'reportID', 'fastExport', 'rsfb', 'rb', 'directExport');
|
||||
foreach ($mstr_result_vars as $var) {
|
||||
$value = $this->get_string_between($this->html, 'name="' . $var . '" type="hidden" class="mstrHiddenInput" value=', '"/>');
|
||||
$pvar[$var] = $value;
|
||||
}
|
||||
$post = array_merge($post, $pvar);
|
||||
$action = $this->get_string_between($this->html, 'FORM ACTION="Main.aspx', '" ID="printForm"');
|
||||
$url = '/asp/Main.aspx' . $action;
|
||||
//debug($post);
|
||||
//debug($url);die;
|
||||
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, $post);
|
||||
|
||||
//debug($this->html);
|
||||
|
||||
$post = array();
|
||||
$pvar = array();
|
||||
$mstr_down_vars = array('evt', 'src', 'SaveReportProperties', 'rb');
|
||||
foreach ($mstr_down_vars as $var) {
|
||||
$value = $this->get_string_between($this->html, 'name="' . $var . '" type="hidden" class="mstrHiddenInput" value=', '"/>');
|
||||
$pvar[$var] = $value;
|
||||
}
|
||||
$post = array_merge($post, $pvar);
|
||||
$action = $this->get_string_between($this->html, 'FORM ACTION="', '" ID="printForm"');
|
||||
$url = '/asp/' . $action;
|
||||
//debug($post);
|
||||
//debug($url);
|
||||
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, $post);
|
||||
//debug($this->html);
|
||||
}
|
||||
}
|
||||
}
|
||||
480
plugins/AsdCurl/src/AsdUs.php
Normal file
480
plugins/AsdCurl/src/AsdUs.php
Normal file
@@ -0,0 +1,480 @@
|
||||
<?php
|
||||
|
||||
namespace AsdCurl;
|
||||
|
||||
use App\Controller\AppController;
|
||||
use Cake\ORM\TableRegistry;
|
||||
use AsdCurl\AsdCurl;
|
||||
use Cake\Core\Configure;
|
||||
use Cake\I18n\Time;
|
||||
|
||||
class AsdUs extends AsdCurl
|
||||
{
|
||||
public function __construct($url = null)
|
||||
{
|
||||
$this->status = true;
|
||||
$this->error = false;
|
||||
}
|
||||
|
||||
public function save_us_data($ch) {
|
||||
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl');
|
||||
// Maske US 01 01 vom linken Menü aufrufen
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
|
||||
$post = [
|
||||
'sideMenu' => 'sideMenu',
|
||||
'javax.faces.ViewState' => $viewstate,
|
||||
'sideMenu:j_idt51:0:j_idt57:1:j_idt59' => 'sideMenu:j_idt51:0:j_idt57:1:j_idt59',
|
||||
];
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_00_00.jsf?cid=' . $conversationId, $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
// 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');
|
||||
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
|
||||
$post = [
|
||||
'mainForm' => 'mainForm',
|
||||
'referenzBaumAnzeigen' => 'false',
|
||||
'conversationId' => $conversationId,
|
||||
'changeNotification' => 'false',
|
||||
'mainForm:hasChanged' => 'false',
|
||||
'mainForm:hasNotReleased' => 'false',
|
||||
'mainForm:hasPopUpChanged' => 'false',
|
||||
'mainForm:hasAdresseChanged' => 'false',
|
||||
'mainForm:confirmedOverride' => 'false',
|
||||
'mainForm:zuordnungNotification' => 'false',
|
||||
'skipvalidation' => 'false',
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'mainForm:dienststelle_schluessel' => '',
|
||||
'mainForm:dienststelle_nameoffiziell' => '',
|
||||
'mainForm:dienststelle_dst_wl_dsttyp_id_uebe' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_plzstrasse' => '',
|
||||
'mainForm:dienststelle_ort' => '',
|
||||
'mainForm:dienststelle_sat_kurz_bezeichnung' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_bdg_kurz_bezeichnung' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_wl_kurz_bezeichnung' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_dst_wl_regierung_id_u' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_dst_wl_schulamt_id' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_referent' => '',
|
||||
'mainForm:dienststelle_dst_wl_mb_bezirk_id_u' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_status' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_sortierung' => 'com.hp.asd.domain.tech.PersProperty:7',
|
||||
'mainForm:action_suchen' => 'Suchen',
|
||||
'javax.faces.ViewState' => $viewstate,
|
||||
];
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_01.jsf?cid=' . $conversationId, $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
// Auf der Ergebnisseite auf "Alle" Klicken
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" 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</a>');
|
||||
//debug($mainform);die;
|
||||
$post = [
|
||||
'mainForm' => 'mainForm',
|
||||
'referenzBaumAnzeigen' => 'false',
|
||||
'conversationId' => $conversationId,
|
||||
'changeNotification' => 'false',
|
||||
'mainForm:hasChanged' => 'false',
|
||||
'mainForm:hasNotReleased' => 'false',
|
||||
'mainForm:hasPopUpChanged' => 'false',
|
||||
'mainForm:hasAdresseChanged' => 'false',
|
||||
'mainForm:confirmedOverride' => 'false',
|
||||
'mainForm:zuordnungNotification' => 'false',
|
||||
'skipvalidation' => 'true',
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'javax.faces.ViewState' => $viewstate,
|
||||
'mainForm:j_idt189' => 'mainForm:j_idt189',
|
||||
];
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_02.jsf?cid=' . $conversationId, $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
// 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
|
||||
$htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml
|
||||
$htmlParser->preserveWhiteSpace = false;
|
||||
|
||||
$table = $htmlParser->getElementById('mainForm:resultTable');
|
||||
//debug($table);
|
||||
$rel = [
|
||||
'sname' => 0,
|
||||
'snr' => 1,
|
||||
'commune' => 2,
|
||||
'state' => 5,
|
||||
'delivery' => 6
|
||||
];
|
||||
$rows = $table->getElementsByTagName('tr');
|
||||
$i = 0;
|
||||
foreach ($rows as $row) {
|
||||
//debug('Hallo');
|
||||
if ($i > 0) {
|
||||
$cols = $row->getElementsByTagName('td');
|
||||
foreach($rel as $key => $value) {
|
||||
if ($key == 'delivery') {
|
||||
$time = Time::createFromFormat('d.m.Y, H:i:s', $cols->item($value)->nodeValue, 'UTC');
|
||||
$data[$i][$key] = $time;
|
||||
}
|
||||
else {
|
||||
$data[$i][$key] = $cols->item($value)->nodeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
//debug($data);
|
||||
$usdates = TableRegistry::get('Usdates');
|
||||
$usdates->deleteAll('id' > 0);
|
||||
$entities = $usdates->newEntities($data);
|
||||
$result = $usdates->saveMany($entities);
|
||||
if(!($result)) {
|
||||
debug($entities);die;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function save_up_data($ch) {
|
||||
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl');
|
||||
// Maske US 01 01 vom linken Menü aufrufen
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
|
||||
$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);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
// 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');
|
||||
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
|
||||
$post = [
|
||||
'mainForm' => 'mainForm',
|
||||
'referenzBaumAnzeigen' => 'false',
|
||||
'conversationId' => $conversationId,
|
||||
'changeNotification' => 'false',
|
||||
'mainForm:hasChanged' => 'false',
|
||||
'mainForm:hasNotReleased' => 'false',
|
||||
'mainForm:hasPopUpChanged' => 'false',
|
||||
'mainForm:hasAdresseChanged' => 'false',
|
||||
'mainForm:confirmedOverride' => 'false',
|
||||
'mainForm:zuordnungNotification' => 'false',
|
||||
'skipvalidation' => 'false',
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'mainForm:dienststelle_schluessel' => '',
|
||||
'mainForm:dienststelle_nameoffiziell' => '',
|
||||
'mainForm:dienststelle_dst_wl_dsttyp_id_uebe' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_plzstrasse' => '',
|
||||
'mainForm:dienststelle_ort' => '',
|
||||
'mainForm:dienststelle_sat_kurz_bezeichnung' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_bdg_kurz_bezeichnung' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_wl_kurz_bezeichnung' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_dst_wl_regierung_id_u' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_dst_wl_schulamt_id' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_referent' => '',
|
||||
'mainForm:dienststelle_dst_wl_mb_bezirk_id_u' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_status' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_sortierung' => 'com.hp.asd.domain.tech.PersProperty:7',
|
||||
'mainForm:action_suchen' => 'Suchen',
|
||||
'javax.faces.ViewState' => $viewstate,
|
||||
];
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_03_01.jsf?cid=' . $conversationId, $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
// Auf der Ergebnisseite auf "Alle" Klicken
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" 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</a>');
|
||||
//debug($mainform);die;
|
||||
$post = [
|
||||
'mainForm' => 'mainForm',
|
||||
'referenzBaumAnzeigen' => 'false',
|
||||
'conversationId' => $conversationId,
|
||||
'changeNotification' => 'false',
|
||||
'mainForm:hasChanged' => 'false',
|
||||
'mainForm:hasNotReleased' => 'false',
|
||||
'mainForm:hasPopUpChanged' => 'false',
|
||||
'mainForm:hasAdresseChanged' => 'false',
|
||||
'mainForm:confirmedOverride' => 'false',
|
||||
'mainForm:zuordnungNotification' => 'false',
|
||||
'skipvalidation' => 'true',
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'javax.faces.ViewState' => $viewstate,
|
||||
'mainForm:j_idt189' => 'mainForm:j_idt189',
|
||||
];
|
||||
$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;
|
||||
// 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
|
||||
$htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml
|
||||
$htmlParser->preserveWhiteSpace = false;
|
||||
|
||||
$table = $htmlParser->getElementById('mainForm:resultTable');
|
||||
//debug($table);
|
||||
$rel = [
|
||||
'sname' => 1,
|
||||
'snr' => 2,
|
||||
'commune' => 3,
|
||||
'state' => 6,
|
||||
'delivery' => 7
|
||||
];
|
||||
$rows = $table->getElementsByTagName('tr');
|
||||
$i = 0;
|
||||
foreach ($rows as $row) {
|
||||
//debug('Hallo');
|
||||
//debug($row);
|
||||
if ($i > 0) {
|
||||
$cols = $row->getElementsByTagName('td');
|
||||
foreach($rel as $key => $value) {
|
||||
//debug($key);
|
||||
//debug($value);
|
||||
if ($key == 'delivery') {
|
||||
//debug($cols->item($value)->nodeValue);
|
||||
$time = Time::createFromFormat('d.m.Y, H:i:s', $cols->item($value)->nodeValue, 'UTC');
|
||||
$data[$i][$key] = $time;
|
||||
}
|
||||
else {
|
||||
$data[$i][$key] = $cols->item($value)->nodeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
//debug($data);
|
||||
$usdates = TableRegistry::get('Usdates');
|
||||
$usdates->deleteAll('id' > 0);
|
||||
$entities = $usdates->newEntities($data);
|
||||
$result = $usdates->saveMany($entities);
|
||||
if(!($result)) {
|
||||
debug($entities);die;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function get_us_statistic($ch)
|
||||
{
|
||||
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl');
|
||||
$viewstate = Configure::read('Session.viewstate');
|
||||
//debug($viewstate);die;
|
||||
$schularten = array(
|
||||
'Gymnasium' => '747',
|
||||
'Grundsch.sow.Mittelschule' => '742',
|
||||
'Realschule' => '745',
|
||||
'Abendrealschule' => '752',
|
||||
'Realschule z. sp. F.' => '746',
|
||||
'Schulartunabhängige Orientierungsstufe' => '749',
|
||||
'Integrierte Gesamtschule' => '750',
|
||||
);
|
||||
$output = array();
|
||||
foreach ($schularten as $sakey => $savalue) {
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_03_01.jsf', false);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
|
||||
$post = [
|
||||
'mainForm' => 'mainForm',
|
||||
'referenzBaumAnzeigen' => 'false',
|
||||
'conversationId' => $conversationId,
|
||||
'changeNotification' => 'false',
|
||||
'mainForm:hasChanged' => 'false',
|
||||
'mainForm:hasNotReleased' => 'false',
|
||||
'mainForm:hasPopUpChanged' => 'false',
|
||||
'mainForm:hasAdresseChanged' => 'false',
|
||||
'mainForm:confirmedOverride' => 'false',
|
||||
'mainForm:zuordnungNotification' => 'false',
|
||||
'skipvalidation' => 'false',
|
||||
'mainForm:istAnzeigMaske' => 'false',
|
||||
'mainForm:dienststellenName' => '',
|
||||
'mainForm:schulart' => '',
|
||||
'mainForm:teilnehmendeGesamt' => '',
|
||||
'mainForm:nichtAbgegebenKeinLv' => '',
|
||||
'mainForm:nichtAbgegebenLv' => '',
|
||||
'mainForm:vollstaendigMitPlFehler' => '',
|
||||
'mainForm:vollstaendigOhnePlFehler' => '',
|
||||
'mainForm:abgegeben=&' => '',
|
||||
'mainForm:abgelehnt' => '',
|
||||
'mainForm:freigegeben' => '',
|
||||
'mainForm:us_03_01_popup_selectSchulart' => 'com.hp.asd.wl.domain.standard.SchulartRechtlich:' . $savalue,
|
||||
'mainForm:popup_ok' => 'Ok',
|
||||
'javax.faces.ViewState' => $viewstate,
|
||||
];
|
||||
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_03_01.jsf?cid=' . $conversationId, $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
|
||||
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
|
||||
//debug($this->html);die;
|
||||
$htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml
|
||||
$htmlParser->preserveWhiteSpace = false;
|
||||
$fields = array(
|
||||
'Teilnehmende Schulen insgesamt' => 'mainForm:teilnehmendeGesamt',
|
||||
'Schulen nicht übermittelt (kein Lieferversuch)' => 'mainForm:nichtAbgegebenKeinLv',
|
||||
'Schulen nicht übermittelt (Lieferversuch)' => 'mainForm:nichtAbgegebenLv',
|
||||
'Schulen übermittelt (PL-Fehler)' => 'mainForm:vollstaendigMitPlFehler',
|
||||
'Schulen übermittelt (keine PL-Fehler)' => 'mainForm:vollstaendigOhnePlFehler',
|
||||
'Schulen abgegeben' => 'mainForm:abgegeben',
|
||||
'Schulen von Schulaufsicht abgelehnt' => 'mainForm:abgelehnt',
|
||||
'Schulen von Schulaufsicht freigegeben' => 'mainForm:freigegeben');
|
||||
|
||||
foreach ($fields as $key => $field) {
|
||||
$output[$sakey][$key] = $htmlParser->getElementById($field)->getAttribute('value');
|
||||
}
|
||||
}
|
||||
|
||||
// staatliche Gymnasien
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
|
||||
$post = [
|
||||
'sideMenu' => 'sideMenu',
|
||||
'javax.faces.ViewState' => $viewstate,
|
||||
'sideMenu:j_idt51:0:j_idt57:1:j_idt59' => 'sideMenu:j_idt51:0:j_idt57:1:j_idt59',
|
||||
];
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_03_01.jsf?cid=' . $conversationId, $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
|
||||
$post = [
|
||||
'mainForm' => 'mainForm',
|
||||
'referenzBaumAnzeigen' => 'false',
|
||||
'conversationId' => $conversationId,
|
||||
'changeNotification' => 'false',
|
||||
'mainForm:hasChanged' => 'false',
|
||||
'mainForm:hasNotReleased' => 'false',
|
||||
'mainForm:hasPopUpChanged' => 'false',
|
||||
'mainForm:hasAdresseChanged' => 'false',
|
||||
'mainForm:confirmedOverride' => 'false',
|
||||
'mainForm:zuordnungNotification' => 'false',
|
||||
'skipvalidation' => 'false',
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'mainForm:dienststelle_schluessel' => '',
|
||||
'mainForm:dienststelle_nameoffiziell' => '',
|
||||
'mainForm:dienststelle_dst_wl_dsttyp_id_uebe' => 'com.hp.asd.wl.domain.standard.Dienststellentyp:1671',
|
||||
'mainForm:dienststelle_plzstrasse' => '',
|
||||
'mainForm:dienststelle_ort' => '',
|
||||
'mainForm:dienststelle_sat_kurz_bezeichnung' => 'com.hp.asd.wl.domain.standard.SchulartRechtlich:747',
|
||||
'mainForm:dienststelle_bdg_kurz_bezeichnung' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_wl_kurz_bezeichnung' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_dst_wl_regierung_id_u' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_dst_wl_schulamt_id' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_referent' => '',
|
||||
'mainForm:dienststelle_dst_wl_mb_bezirk_id_u' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_status' => 'EMPTY:0',
|
||||
'mainForm:dienststelle_sortierung' => 'com.hp.asd.domain.tech.PersProperty:7',
|
||||
'mainForm:action_suchen' => 'Suchen',
|
||||
'javax.faces.ViewState' => $viewstate,
|
||||
];
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_01.jsf?cid=' . $conversationId, $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
|
||||
$post = [
|
||||
'mainForm' => 'mainForm',
|
||||
'referenzBaumAnzeigen' => 'false',
|
||||
'conversationId' => $conversationId,
|
||||
'changeNotification' => 'false',
|
||||
'mainForm:hasChanged' => 'false',
|
||||
'mainForm:hasNotReleased' => 'false',
|
||||
'mainForm:hasPopUpChanged' => 'false',
|
||||
'mainForm:hasAdresseChanged' => 'false',
|
||||
'mainForm:confirmedOverride' => 'false',
|
||||
'mainForm:zuordnungNotification' => 'false',
|
||||
'skipvalidation' => 'true',
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'mainForm:resultTable:0:email' => '0252@schulen.bayern.de',
|
||||
'mainForm:resultTable:0:j_idt112' => 'on',
|
||||
'mainForm:resultTable:1:email' => '0282@schulen.bayern.de',
|
||||
'mainForm:resultTable:1:j_idt112' => 'on',
|
||||
'mainForm:resultTable:2:email' => '0180@schulen.bayern.de',
|
||||
'mainForm:resultTable:2:j_idt112' => 'on',
|
||||
'mainForm:resultTable:3:email' => '0072@schulen.bayern.de',
|
||||
'mainForm:resultTable:3:j_idt112' => 'on',
|
||||
'mainForm:resultTable:4:email' => '0151@schulen.bayern.de',
|
||||
'mainForm:resultTable:4:j_idt112' => 'on',
|
||||
'javax.faces.ViewState' => $viewstate,
|
||||
'mainForm:j_idt183' => 'mainForm:j_idt183',
|
||||
];
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_02.jsf?cid=' . $conversationId, $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
$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;
|
||||
|
||||
$table = $htmlParser->getElementById('mainForm:resultTable');
|
||||
//debug($table);
|
||||
|
||||
$rows = $table->getElementsByTagName('tr');
|
||||
$i = 0;
|
||||
foreach ($rows as $row) {
|
||||
//debug('Hallo');
|
||||
if ($i > 0) {
|
||||
$cols = $row->getElementsByTagName('td');
|
||||
$status[$i] = $cols->item(5)->nodeValue;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$result = array_count_values($status);
|
||||
|
||||
$output2['Staatliche Gymnasien']['Teilmende Schulen insgesamt'] = sizeof($status);
|
||||
if (!isset($result['n. überm. (kein Liefervers.)'])) {
|
||||
$output2['Staatliche Gymnasien']['Schulen nicht übermittelt (kein Lieferversuch)'] = 0;
|
||||
} else {
|
||||
$output2['Staatliche Gymnasien']['Schulen nicht übermittelt (kein Lieferversuch)'] = $result['n. überm. (kein Liefervers.)'];
|
||||
}
|
||||
if (!isset($result['n. überm. (Lieferversuch)'])) {
|
||||
$output2['Staatliche Gymnasien']['Schulen nicht übermittelt (Lieferversuch)'] = 0;
|
||||
} else {
|
||||
$output2['Staatliche Gymnasien']['Schulen nicht übermittelt (Lieferversuch)'] = $result['n. überm. (Lieferversuch)'];
|
||||
}
|
||||
if (!isset($result['übermittelt (PL-Fehler)'])) {
|
||||
$output2['Staatliche Gymnasien']['Schulen übermittelt (PL-Fehler)'] = 0;
|
||||
} else {
|
||||
$output2['Staatliche Gymnasien']['Schulen übermittelt (PL-Fehler)'] = $result['übermittelt (PL-Fehler)'];
|
||||
}
|
||||
if (!isset($result['übermittelt (keine PL-Fehler)'])) {
|
||||
$output2['Staatliche Gymnasien']['Schulen übermittelt (keine PL-Fehler)'] = 0;
|
||||
} else {
|
||||
$output2['Staatliche Gymnasien']['Schulen übermittelt (keine PL-Fehler)'] = $result['übermittelt (keine PL-Fehler)'];
|
||||
}
|
||||
if (!isset($result['abgegeben'])) {
|
||||
$output2['Staatliche Gymnasien']['Schulen abgegeben'] = 0;
|
||||
} else {
|
||||
$output2['Staatliche Gymnasien']['Schulen abgegeben'] = $result['abgegeben'];
|
||||
}
|
||||
if (!isset($result['Schulaufs. abgelehnt'])) {
|
||||
$output2['Staatliche Gymnasien']['Schulen von Schulaufsicht abgelehnt'] = 0;
|
||||
} else {
|
||||
$output2['Staatliche Gymnasien']['Schulen von Schulaufsicht abgelehnt'] = $result['Schulaufs. abgelehnt'];
|
||||
}
|
||||
if (!isset($result['freigegeben'])) {
|
||||
$output2['Staatliche Gymnasien']['Schulen von Schulaufsicht freigegeben'] = 0;
|
||||
} else {
|
||||
$output2['Staatliche Gymnasien']['Schulen von Schulaufsicht freigegeben'] = $result['freigegeben'];
|
||||
}
|
||||
|
||||
$output = array_merge($output2, $output);
|
||||
return ($output);
|
||||
}
|
||||
}
|
||||
10
plugins/AsdCurl/src/Controller/AppController.php
Normal file
10
plugins/AsdCurl/src/Controller/AppController.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace AsdCurl\Controller;
|
||||
|
||||
use App\Controller\AppController as BaseController;
|
||||
|
||||
class AppController extends BaseController
|
||||
{
|
||||
|
||||
}
|
||||
35
plugins/AsdCurl/src/Url.php
Normal file
35
plugins/AsdCurl/src/Url.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace AsdCurl;
|
||||
|
||||
class Url
|
||||
{
|
||||
/**
|
||||
* URL source
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $src;
|
||||
|
||||
public function __construct($url)
|
||||
{
|
||||
// Prepend http:// if the url doesn't contain it
|
||||
if (!stristr($url, 'http://') && !stristr($url, 'https://')) {
|
||||
$url = 'http://' . $url;
|
||||
}
|
||||
|
||||
if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
|
||||
throw new InvalidUrlException($url);
|
||||
}
|
||||
|
||||
$url = str_replace(array(';', '"', '<?'), '', strip_tags($url));
|
||||
$url = str_replace(array('\077', '\''), array(' ', '/'), $url);
|
||||
|
||||
$this->src = $url;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->src;
|
||||
}
|
||||
}
|
||||
0
plugins/AsdCurl/webroot/empty
Normal file
0
plugins/AsdCurl/webroot/empty
Normal file
Reference in New Issue
Block a user