558 lines
26 KiB
PHP
558 lines
26 KiB
PHP
<?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 hack($ch,$env) {
|
|
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl.'.$env);
|
|
// Anfrage abschicken
|
|
|
|
$post = ['<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
<ASD_ANFRAGE_SVSW_ASD>
|
|
<LIEFERUNGSCHLUESSEL>6460632610085</LIEFERUNGSCHLUESSEL>
|
|
<DIENSTSTELLE>9400</DIENSTSTELLE>
|
|
<SCHULJAHR>2019</SCHULJAHR>
|
|
<AUFTRAG>
|
|
<AUFTRAGSCHLUESSEL>6460632613170</AUFTRAGSCHLUESSEL>
|
|
<SST_OBJECT_TYPE>UsSchuelerSucheSvswAsd</SST_OBJECT_TYPE>
|
|
<US_SCHUELER_SUCHE_SVSW_ASD ANFRAGEMODUS="einzelabfrage">
|
|
<NACHNAME>Trinkl</NACHNAME>
|
|
<VORNAMEN>Fabian</VORNAMEN>
|
|
<GEBURTSDATUM>
|
|
<GEBURTSJAHR>2004</GEBURTSJAHR>
|
|
<GEBURTSMONAT>1</GEBURTSMONAT>
|
|
<GEBURTSTAG>1</GEBURTSTAG>
|
|
</GEBURTSDATUM>
|
|
<GESCHLECHT>1</GESCHLECHT>
|
|
<GEBURTSORT>München</GEBURTSORT>
|
|
<PHONETISCHE_SUCHE>1</PHONETISCHE_SUCHE>
|
|
</US_SCHUELER_SUCHE_SVSW_ASD>
|
|
</AUFTRAG>
|
|
<SCHEMA_VERSION>1.0</SCHEMA_VERSION>
|
|
<WERTELISTEN_VERSION>183.0.514</WERTELISTEN_VERSION>
|
|
<CLIENT_VERSION>2.10.295_032_57_by</CLIENT_VERSION>
|
|
<PLAUSI_VERSION>190809.093</PLAUSI_VERSION>
|
|
</ASD_ANFRAGE_SVSW_ASD>
|
|
'
|
|
];
|
|
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asd-sst/sst/any', $post);
|
|
if(!($this->status)) {
|
|
die($this->error);
|
|
}
|
|
}
|
|
|
|
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');
|
|
$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 . '/asdus/us_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');
|
|
$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_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);
|
|
}
|
|
//echo $this->html;
|
|
// 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="', '" />');
|
|
|
|
$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');
|
|
foreach($hrefs as $href) {
|
|
if($href->textContent == 'ALLE') {
|
|
foreach ($href->attributes as $attribute) {
|
|
if($attribute->name == 'onclick') {
|
|
$linktext = $attribute->textContent;
|
|
preg_match('/j_idt\d\d\d/',$linktext,$matches);
|
|
$linkid = substr($matches[0],5,3);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$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_idt'.$linkid => 'mainForm:j_idt'.$linkid,
|
|
];
|
|
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_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);die;
|
|
$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);die;
|
|
$usdates = TableRegistry::get('Usdates');
|
|
$usdates->deleteAll('id' > 0);
|
|
$entities = $usdates->newEntities($data);
|
|
$result = $usdates->saveMany($entities);
|
|
if(!($result)) {
|
|
debug($entities);die;
|
|
}
|
|
//die;
|
|
}
|
|
|
|
public function save_up_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');
|
|
$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);
|
|
}
|
|
|
|
$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');
|
|
foreach($hrefs as $href) {
|
|
if($href->textContent == 'ALLE') {
|
|
foreach ($href->attributes as $attribute) {
|
|
if($attribute->name == 'onclick') {
|
|
$linktext = $attribute->textContent;
|
|
preg_match('/j_idt\d\d\d/',$linktext,$matches);
|
|
$linkid = substr($matches[0],5,3);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//echo $this->html;die;
|
|
// 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_idt'.$linkid => 'mainForm:j_idt'.$linkid
|
|
];
|
|
$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);
|
|
}
|
|
}
|