Bugfixes Update

This commit is contained in:
2020-06-09 09:25:08 +02:00
parent 1ff233443b
commit c9bfd40728
29 changed files with 1584 additions and 466 deletions

View File

@@ -17,7 +17,7 @@
}, },
"require-dev": { "require-dev": {
"psy/psysh": "@stable", "psy/psysh": "@stable",
"cakephp/debug_kit": "~3.2", "cakephp/debug_kit": "~3.0",
"cakephp/bake": "~1.1" "cakephp/bake": "~1.1"
}, },
"suggest": { "suggest": {

1091
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -222,7 +222,9 @@ Plugin::load('Migrations');
* Debug Kit should not be installed on a production system * Debug Kit should not be installed on a production system
*/ */
if (Configure::read('debug')) { if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]); //Plugin::load('DebugKit', ['bootstrap' => true]);
Configure::write('DebugKit', ['forceEnable' => true]);
Plugin::load("DebugKit", ["bootstrap" => true]);
} }
//Plugin::load('AsdCurl', ['autoload' => true]); //Plugin::load('AsdCurl', ['autoload' => true]);
@@ -230,3 +232,4 @@ Plugin::load('AsdCurl', ['autoload' => true, 'bootstrap' => true, 'routes' => tr
Configure::write('Users.config', ['users']); Configure::write('Users.config', ['users']);
Plugin::load('CakeDC/Users', ['routes' => true, 'bootstrap' => true]); Plugin::load('CakeDC/Users', ['routes' => true, 'bootstrap' => true]);

View File

@@ -14,7 +14,8 @@ define('SCHULPORTAL_BASE0_URL', "https://portal.schulen.bayern.de");
define('SCHULPORTAL_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig2d1dfad4a11c25e42c462e53b4721e48/uniquesig0'); define('SCHULPORTAL_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig2d1dfad4a11c25e42c462e53b4721e48/uniquesig0');
define('SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesigc3ba1685059aaf325d44099df697a0a635e79a4ec36ec614a98f3bf4b79d7c043ac3880605b7751df91d11233380ad86/uniquesig0/asd'); define('SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesigc3ba1685059aaf325d44099df697a0a635e79a4ec36ec614a98f3bf4b79d7c043ac3880605b7751df91d11233380ad86/uniquesig0/asd');
//define('PROD_SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesigc3ba1685059aaf325d44099df697a0a635e79a4ec36ec614a98f3bf4b79d7c043ac3880605b7751df91d11233380ad86/uniquesig0/asd'); //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 . '/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');

View File

@@ -91,7 +91,9 @@ class AsdCurl
public function login_asd($ch,$env) public function login_asd($ch,$env)
{ {
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl.'.$env); $SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl.'.$env);
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asddv/dv_xy_00.jsf', false); //debug($SCHULPORTAL_ASD_BASE_URL);die;
//$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asddv/dv_xy_00.jsf', false);
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/login/login.jsf', false);
if(!($this->status)) { if(!($this->status)) {
die($this->error); die($this->error);
} }
@@ -99,7 +101,7 @@ class AsdCurl
$login_data = [ $login_data = [
'asd_username' => 'A005_TrinklW', 'asd_username' => 'A005_TrinklW',
'asd_password' => 'HiegTzs!183', 'asd_password' => 'HiegTzs!195',
//'asd_username' => 'A005_KnollmüllerP', //'asd_username' => 'A005_KnollmüllerP',
//'asd_password' => 'Ooricha8e!', //'asd_password' => 'Ooricha8e!',
]; ];
@@ -176,6 +178,19 @@ class AsdCurl
if(!($this->status)) { if(!($this->status)) {
die($this->error); die($this->error);
} }
$vorschalt = $this->get_string_between($this->html,'an parallelen Zugriffen zu ',' beim');
//debug($vorschalt);
if($vorschalt == 'Anmeldeproblemen') {
$post = [
'choice' => 1
];
$this->exec_curl($ch, 'https://portal.schulen.bayern.de/my.policy', $post);
//debug($this->html);
}
//echo $this->html; die; //echo $this->html; die;
$login_data = [ $login_data = [
'portal_username' => 'asd.trinkl', 'portal_username' => 'asd.trinkl',
@@ -183,23 +198,26 @@ class AsdCurl
]; ];
$post = [ $post = [
'user_name' => $login_data['portal_username'], 'username' => $login_data['portal_username'],
'password' => $login_data['portal_password'], 'password' => $login_data['portal_password'],
'repository' => 'schulen.bayern.de', //'repository' => 'schulen.bayern.de',
'site_name' => 'schulportal', //'site_name' => 'schulportal',
'secure' => '1', //'secure' => '1',
'resource_id' => '2', //'resource_id' => '2',
'login_type' => '2', //'login_type' => '2',
]; ];
// Anmeldeformular fuer das Schulportal abschicken - Step 2 // 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); //$this->exec_curl($ch, $SCHULPORTAL_BASE_URL . '/SecureSchulportalPortalHomePage', $post);
$this->exec_curl($ch, $SCHULPORTAL_BASE_URL . '/InternalSite/Validate.asp', $post); //debug($SCHULPORTAL_BASE_URL);
//$this->exec_curl($ch, $SCHULPORTAL_BASE_URL . '/InternalSite/Validate.asp', $post);
$this->exec_curl($ch,'https://portal.schulen.bayern.de/my.policy', $post);
if(!($this->status)) { if(!($this->status)) {
die($this->error); die($this->error);
} }
$this->exec_curl($ch, $SCHULPORTAL_BASE_URL . '/SecureSchulportalPortalHomePage/',false); //debug($this->html);die;
//$this->exec_curl($ch, $SCHULPORTAL_BASE_URL . '/SecureSchulportalPortalHomePage/',false);
//debug($this->html);die; //debug($this->html);die;
} }

View File

@@ -16,6 +16,44 @@ class AsdUs extends AsdCurl
$this->error = false; $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) { public function save_us_data($ch,$env) {
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl.'.$env); $SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl.'.$env);
// Maske US 01 01 vom linken Menü aufrufen // Maske US 01 01 vom linken Menü aufrufen
@@ -73,40 +111,24 @@ class AsdUs extends AsdCurl
// Auf der Ergebnisseite auf "Alle" Klicken // 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');
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />'); $conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
//$mainform = $this->get_string_between($this->html, 'j_idt', 'ALLE');
//$mainform = $this->get_string_between($this->html, 'mojarra.jsfcljs(document.getElementById(', 'ALLE');
//echo $this->html;
//debug($mainform);die;
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument $htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal 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->loadHTML($this->html); //Loaded the html string we took from simple xml
//$htmlParser->preserveWhiteSpace = false; $htmlParser->preserveWhiteSpace = false;
$hrefs = $htmlParser->getElementsByTagName('a');
$xpath = new \DOMXPath($htmlParser); foreach($hrefs as $href) {
$elements = $xpath->query("//a[text()='ALLE']/@onclick"); if($href->textContent == 'ALLE') {
if (!is_null($elements)) { foreach ($href->attributes as $attribute) {
foreach ($elements as $element) { if($attribute->name == 'onclick') {
//echo "<br/>[". $element->nodeName. "]"; $linktext = $attribute->textContent;
//echo "<br/>[". $element->nodeValue. "]"; preg_match('/j_idt\d\d\d/',$linktext,$matches);
$text = $element->nodeValue; $linkid = substr($matches[0],5,3);
preg_match_all('!\d+!', $text, $matches); }
//print_r($matches); }
$mainform = $matches[0][0];
} }
} }
$mainform='184';
//die;
/*
if($env == 'prod') {
$mainform = '189';
}
else {
$mainform = '184';
}
*/
$post = [ $post = [
'mainForm' => 'mainForm', 'mainForm' => 'mainForm',
'referenzBaumAnzeigen' => 'false', 'referenzBaumAnzeigen' => 'false',
@@ -121,7 +143,7 @@ class AsdUs extends AsdCurl
'skipvalidation' => 'true', 'skipvalidation' => 'true',
'mainForm:istAnzeigeMaske' => 'false', 'mainForm:istAnzeigeMaske' => 'false',
'javax.faces.ViewState' => $viewstate, 'javax.faces.ViewState' => $viewstate,
'mainForm:j_idt'.$mainform => 'mainForm:j_idt'.$mainform, 'mainForm:j_idt'.$linkid => 'mainForm:j_idt'.$linkid,
]; ];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_02.jsf?cid=' . $conversationId, $post); $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_02.jsf?cid=' . $conversationId, $post);
if(!($this->status)) { if(!($this->status)) {
@@ -225,6 +247,23 @@ class AsdUs extends AsdCurl
if(!($this->status)) { if(!($this->status)) {
die($this->error); 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; //echo $this->html;die;
// Auf der Ergebnisseite auf "Alle" Klicken // 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');
@@ -245,7 +284,7 @@ class AsdUs extends AsdCurl
'skipvalidation' => 'true', 'skipvalidation' => 'true',
'mainForm:istAnzeigeMaske' => 'false', 'mainForm:istAnzeigeMaske' => 'false',
'javax.faces.ViewState' => $viewstate, 'javax.faces.ViewState' => $viewstate,
'mainForm:j_idt189' => 'mainForm:j_idt189' 'mainForm:j_idt'.$linkid => 'mainForm:j_idt'.$linkid
]; ];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_03_02.jsf?cid=' . $conversationId, $post); $this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_03_02.jsf?cid=' . $conversationId, $post);
if(!($this->status)) { if(!($this->status)) {

View File

@@ -34,6 +34,7 @@ class Application extends BaseApplication
* @param \Cake\Http\MiddlewareQueue $middleware The middleware queue to setup. * @param \Cake\Http\MiddlewareQueue $middleware The middleware queue to setup.
* @return \Cake\Http\MiddlewareQueue The updated middleware. * @return \Cake\Http\MiddlewareQueue The updated middleware.
*/ */
public function middleware($middleware) public function middleware($middleware)
{ {
$middleware $middleware

View File

@@ -27,7 +27,6 @@ use Cake\Event\Event;
*/ */
class AppController extends Controller class AppController extends Controller
{ {
/** /**
* Initialization hook method. * Initialization hook method.
* *

View File

@@ -13,11 +13,30 @@ class CurlsController extends AppController
{ {
public function beforeFilter(Event $event) { public function beforeFilter(Event $event) {
//$this->Auth->setConfig('checkAuthIn', 'Controller.initialize'); //$this->Auth->setConfig('checkAuthIn', 'Controller.initialize');
$this->Auth->allow(['saveus','getjsonus','saveup','getjsonup','usStatistik','upStatistik']); $this->Auth->allow(['saveus','getjsonus','saveup','getjsonup','usStatistik','usStatistikPara','upStatistik','upStatistikPara','hackasd']);
} }
//public $uses = array('Monitoring'); //public $uses = array('Monitoring');
public function hackasd() {
//debug('Hallo');
if(isset($this->request->params['pass'][0])) {
$env = $this->request->params['pass'][0];
}
else {
$env = 'prod';
}
//debug($env);die;
$curl = new AsdUs();
//debug($curl->status);
$ch = $curl->init_curl_params();
$curl->login_school($ch);
//debug($curl->html);die;
$curl->hack($ch,$env);
debug($curl->html);die;
$this->set('html',$curl->html);
}
public function monitmstr() public function monitmstr()
{ {
$this->loadModel('Monitorings'); $this->loadModel('Monitorings');
@@ -183,6 +202,15 @@ class CurlsController extends AppController
$this->viewBuilder()->layout('pivot'); $this->viewBuilder()->layout('pivot');
} }
public function upStatistikPara() {
$file = new File('/var/www/html/asd-control/webroot/files/para-data-up.json', true, 0644);
$ts = $file->lastChange();
$time = Time::createFromTimestamp($ts);
$time->timezone = 'Europe/Paris';
$this->set('time', $time);
$this->viewBuilder()->layout('pivot');
}
public function asdus() public function asdus()
{ {
$curl = new AsdUs(); $curl = new AsdUs();

View File

@@ -0,0 +1,67 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\Event\Event;
use Cake\Http\Client;
class JirasController extends AppController
{
public function beforeFilter(Event $event) {
//$this->Auth->setConfig('checkAuthIn', 'Controller.initialize');
$this->Auth->allow(['index']);
}
public function index()
{
$http = new Client();
$tickets = ['423','469','533','568','421','424','569','422','586','587','588','589','514','420','590','591'];
$tabledata = array();
//$j = 0;
foreach($tickets as $ticket) {
//debug($ticket);
$response = $http->get('https://kmjira.bayern.de/rest/api/latest/issue/UHD-' . $ticket .'?fields=description', [],
[
'proxy' => ['proxy' => 'www.proxy.bybn.de:80'],
'auth' => ['type' => 'basic', 'username' => 'TrinklW', 'password' => 'HiegTzs!12']
]);
//debug($response->getStringBody());
$data = json_decode($response->getStringBody());
$skuList = explode(PHP_EOL, $data->fields->description);
$istable = 0;
$entries = array();
$i=0;
foreach($skuList as $line) {
if(substr($line,0,1) == '|' and substr($line,1,1) !== '|') {
$istable = 1;
//debug($i);
$entries[$i] = $line;
}
if($istable == 1 and substr($line,0,1) !== '|') {
//debug($i);
$entries[$i - 1] .= trim($line);
}
else if($istable == 1) {
$i++;
}
}
foreach($entries as $entry) {
$entry = trim(preg_replace('/\s+/', ' ', $entry));
//debug($entry);
//debug(explode('|',$entry));
array_push($tabledata,explode('|',$entry));
//$tabledate[$j][] = explode('|',$entry);
//debug($j);
//debug($tabledate[$j]);
//debug($tabledata);
//$j++;
}
}
//debug($tabledata);
$this->set('tabledata',$tabledata);
}
}

View File

@@ -1,26 +1,42 @@
<?php <?php
namespace App\Controller; namespace App\Controller;
use App\Controller\AppController; use App\Controller\AppController;
use Cake\Event\Event; use Cake\Event\Event;
use Cake\Http\Client; use Cake\Http\Client;
class JirasController extends AppController /**
{ * Jiras Controller
public function beforeFilter(Event $event) { *
//$this->Auth->setConfig('checkAuthIn', 'Controller.initialize'); * @property \App\Model\Table\JirasTable $Jiras
$this->Auth->allow(['index']); *
} * @method \App\Model\Entity\Jira[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
public function index() */
class JirasController extends AppController
{
public function beforeFilter(Event $event) {
//$this->Auth->setConfig('checkAuthIn', 'Controller.initialize');
$this->Auth->allow(['index','add','edit','show']);
}
/**
* Index method
*
* @return \Cake\Http\Response|null
*/
public function show($id = null)
{ {
$jira = $this->Jiras->get($id);
//debug($jira);
$http = new Client(); $http = new Client();
$tickets = ['423','469','533','568','421','424','569','422','586','587','588','589','514','420','590','591']; //$tickets = ['423','469','533','568','421','424','569','422','586','587','588','589','514','420','590','591'];
$tickets = explode(',',$jira->tickets);
//debug($tickets);die;
$tabledata = array(); $tabledata = array();
//$j = 0; //$j = 0;
foreach($tickets as $ticket) { foreach($tickets as $ticket) {
//debug($ticket); //debug($ticket);
$response = $http->get('https://kmjira.bayern.de/rest/api/latest/issue/UHD-' . $ticket .'?fields=description', [], $response = $http->get('https://kmjira.bayern.de/rest/api/latest/issue/' . $ticket .'?fields=description', [],
[ [
'proxy' => ['proxy' => 'www.proxy.bybn.de:80'], 'proxy' => ['proxy' => 'www.proxy.bybn.de:80'],
'auth' => ['type' => 'basic', 'username' => 'TrinklW', 'password' => 'HiegTzs!12'] 'auth' => ['type' => 'basic', 'username' => 'TrinklW', 'password' => 'HiegTzs!12']
@@ -64,4 +80,91 @@
//debug($tabledata); //debug($tabledata);
$this->set('tabledata',$tabledata); $this->set('tabledata',$tabledata);
} }
public function index()
{
$jiras = $this->paginate($this->Jiras);
$this->set(compact('jiras'));
} }
/**
* View method
*
* @param string|null $id Jira id.
* @return \Cake\Http\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$jira = $this->Jiras->get($id, [
'contain' => []
]);
$this->set('jira', $jira);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$jira = $this->Jiras->newEntity();
if ($this->request->is('post')) {
$jira = $this->Jiras->patchEntity($jira, $this->request->getData());
if ($this->Jiras->save($jira)) {
$this->Flash->success(__('The jira has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The jira could not be saved. Please, try again.'));
}
$this->set(compact('jira'));
}
/**
* Edit method
*
* @param string|null $id Jira id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function edit($id = null)
{
$jira = $this->Jiras->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$jira = $this->Jiras->patchEntity($jira, $this->request->getData());
if ($this->Jiras->save($jira)) {
$this->Flash->success(__('The jira has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The jira could not be saved. Please, try again.'));
}
$this->set(compact('jira'));
}
/**
* Delete method
*
* @param string|null $id Jira id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$jira = $this->Jiras->get($id);
if ($this->Jiras->delete($jira)) {
$this->Flash->success(__('The jira has been deleted.'));
} else {
$this->Flash->error(__('The jira could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

32
src/Model/Entity/Jira.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Jira Entity
*
* @property int $id
* @property string $name
* @property string $tickets
* @property \Cake\I18n\FrozenTime $created
* @property \Cake\I18n\FrozenTime $modified
*/
class Jira extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'name' => true,
'tickets' => true,
'created' => true,
'modified' => true
];
}

View File

@@ -0,0 +1,67 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Jiras Model
*
* @method \App\Model\Entity\Jira get($primaryKey, $options = [])
* @method \App\Model\Entity\Jira newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Jira[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Jira|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Jira saveOrFail(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Jira patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Jira[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Jira findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class JirasTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->setTable('jiras');
$this->setDisplayField('name');
$this->setPrimaryKey('id');
$this->addBehavior('Timestamp');
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmptyString('id', 'create');
$validator
->scalar('name')
->maxLength('name', 255)
->requirePresence('name', 'create')
->notEmptyString('name');
$validator
->scalar('tickets')
->requirePresence('tickets', 'create')
->notEmptyString('tickets');
return $validator;
}
}

View File

@@ -0,0 +1,110 @@
<?php
echo '<h4 style="margin-left: 30px;">UP 2020 (PARA) - Stand: ' . $time->i18nFormat('dd.MM.yyyy HH:mm') . '</h4>';
?>
<script type="text/javascript">
$(function(){
var origin = window.location.origin;
if (typeof $.cookie('pivotOrg') === 'undefined'){
var org = true;
console.log(org);
$.cookie("pivotOrg", JSON.stringify(org), { expires: 1 });
}
else {
var org = JSON.parse($.cookie("pivotOrg"));
}
//console.log(origin);
console.log(origin);
if (origin == 'http://km-pc-asd-ap.stmukwk.bayern.de') {
jsonurl = '/files/para-data-up.json';
}
else {
jsonurl = '/asd-control/files/para-data-up.json';
}
$.getJSON(jsonurl, function(mps) {
if (typeof $.cookie('pivotConfig') === 'undefined'){
cookie = {};
cookie.rows = ["Schulart"];
cookie.cols = ["Übermittlungsstatus"];
}
else {
var cookie = JSON.parse($.cookie("pivotConfig"));
if (cookie == null || org == true ) {
cookie = {};
cookie.rows = ["Schulart"];
cookie.cols = ["Übermittlungsstatus"];
}
}
//console.log(cookie.exclusions);
$("#output").pivotUI(mps, {
rows: cookie.rows,
cols: cookie.cols,
exclusions: cookie.exclusions,
autoSortUnusedAttrs: true,
sorters:{
Übermittlungsstatus: $.pivotUtilities.sortAs(
["n. überm. (kein Liefervers.)", "Schulaufs. abgelehnt", "übermittelt (PL-Fehler)", "n. überm. (Lieferversuch)" , "übermittelt (keine PL-Fehler)", "abgegeben", "Schulaufs. freigegeben"]
)},
rendererOptions: {
table: {
clickCallback: function(e, value, filters, pivotData){
//console.log(filters);
$( "#heading").text(filters.Schulart + ' - ' + filters.Übermittlungsstatus);
var names = [];
pivotData.forEachMatchingRecord(filters,
function(record){ names.push(record.Schule + ' (' + record.Datum.substring(0,10) + ' ' + record.Datum.substring(11,19) + ')'); });
list = '<ul>';
$.each(names, function() {
list += '<li>' + this + '</li>';
});
list += '</ul>';
$( "#schools" ).html(list);
}
}
}
});
$("#standard").on("click", function(){
org = true;
console.log(org);
$.cookie("pivotOrg", JSON.stringify(org), { expires: 1 });
window.location.reload(true);
});
$("#load").on("click", function(){
org = false;
console.log(org);
$.cookie("pivotOrg", JSON.stringify(org), { expires: 1 });
window.location.reload(true);
});
$("#save").on("click", function(){
var config = $("#output").data("pivotUIOptions");
//console.log(config);
var config_copy = JSON.parse(JSON.stringify(config));
//console.log(config_copy);
//delete some values which will not serialize to JSON
delete config_copy["aggregators"];
delete config_copy["renderers"];
$.cookie("pivotConfig", JSON.stringify(config_copy), { expires: 365 });
});
$("#del").on("click", function(){
//$.cookie("pivotConfig", null, { path: '/' });
$.cookie("pivotConfig", null);
window.location.reload(true);
});
});
});
</script>
<div id="output" style="margin-left: 30px;"></div>
<input type="button" value="Load Standard" id="standard" style="font-size: 16px;margin-left: 30px;" />
<input type="button" value="Load Config" id="load" style="font-size: 16px;" />
<input type="button" value="Save Config" id="save" style="font-size: 16px;" />
<!-- <input type="button" value="Reset Config" id="del" style="font-size: 16px;" /> -->
<p>&nbsp;</p>
<p id="heading" style="margin-left: 30px;font-weight: bold;"><p>
<div id="schools" style="margin-left: 30px;"></div>

View File

@@ -102,6 +102,11 @@ echo '<h4 style="margin-left: 30px;">US 2019 (PROD) - Stand: ' . $time->i18nForm
$.cookie("pivotConfig", null); $.cookie("pivotConfig", null);
window.location.reload(true); window.location.reload(true);
}); });
$("button").on("click", function() {
console.log('Button clicked');
$("#heading").empty();
$("#schools").empty();
});
}); });
}); });

View File

@@ -1,5 +1,5 @@
<?php <?php
echo '<h4 style="margin-left: 30px;">US 2018 (PARA) - Stand: ' . $time->i18nFormat('dd.MM.yyyy HH:mm') . '</h4>'; echo '<h4 style="margin-left: 30px;">US 2019 (PARA) - Stand: ' . $time->i18nFormat('dd.MM.yyyy HH:mm') . '</h4>';
?> ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@@ -0,0 +1,24 @@
<?php
/**
* @var \App\View\AppView $this
* @var \App\Model\Entity\Jira $jira
*/
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('List Jiras'), ['action' => 'index']) ?></li>
</ul>
</nav>
<div class="jiras form large-9 medium-8 columns content">
<?= $this->Form->create($jira) ?>
<fieldset>
<legend><?= __('Add Jira') ?></legend>
<?php
echo $this->Form->control('name');
echo $this->Form->control('tickets');
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>

View File

@@ -0,0 +1,30 @@
<?php
/**
* @var \App\View\AppView $this
* @var \App\Model\Entity\Jira $jira
*/
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Form->postLink(
__('Delete'),
['action' => 'delete', $jira->id],
['confirm' => __('Are you sure you want to delete # {0}?', $jira->id)]
)
?></li>
<li><?= $this->Html->link(__('List Jiras'), ['action' => 'index']) ?></li>
</ul>
</nav>
<div class="jiras form large-9 medium-8 columns content">
<?= $this->Form->create($jira) ?>
<fieldset>
<legend><?= __('Edit Jira') ?></legend>
<?php
echo $this->Form->control('name');
echo $this->Form->control('tickets');
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>

View File

@@ -1,13 +1,52 @@
<table>
<?php <?php
//debug($tabledata); /**
foreach($tabledata as $line) { * @var \App\View\AppView $this
echo '<tr>'; * @var \App\Model\Entity\Jira[]|\Cake\Collection\CollectionInterface $jiras
foreach($line as $cell) { */
echo '<td>' . $cell . '</td>';
}
echo '</tr>';
}
?> ?>
</table> <nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('New Jira'), ['action' => 'add']) ?></li>
</ul>
</nav>
<div class="jiras index large-9 medium-8 columns content">
<h3><?= __('Jiras') ?></h3>
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
<th scope="col"><?= $this->Paginator->sort('name') ?></th>
<th scope="col"><?= $this->Paginator->sort('created') ?></th>
<th scope="col"><?= $this->Paginator->sort('modified') ?></th>
<th scope="col" class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($jiras as $jira): ?>
<tr>
<td><?= $this->Number->format($jira->id) ?></td>
<td><?= h($jira->name) ?></td>
<td><?= h($jira->created) ?></td>
<td><?= h($jira->modified) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $jira->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $jira->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $jira->id], ['confirm' => __('Are you sure you want to delete # {0}?', $jira->id)]) ?>
<?= $this->Html->link(__('Show'), ['action' => 'show', $jira->id]) ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="paginator">
<ul class="pagination">
<?= $this->Paginator->first('<< ' . __('first')) ?>
<?= $this->Paginator->prev('< ' . __('previous')) ?>
<?= $this->Paginator->numbers() ?>
<?= $this->Paginator->next(__('next') . ' >') ?>
<?= $this->Paginator->last(__('last') . ' >>') ?>
</ul>
<p><?= $this->Paginator->counter(['format' => __('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')]) ?></p>
</div>
</div>

View File

@@ -0,0 +1,13 @@
<table>
<?php
//debug($tabledata);
foreach($tabledata as $line) {
echo '<tr>';
foreach($line as $cell) {
echo '<td>' . $cell . '</td>';
}
echo '</tr>';
}
?>
</table>

View File

@@ -0,0 +1,40 @@
<?php
/**
* @var \App\View\AppView $this
* @var \App\Model\Entity\Jira $jira
*/
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('Edit Jira'), ['action' => 'edit', $jira->id]) ?> </li>
<li><?= $this->Form->postLink(__('Delete Jira'), ['action' => 'delete', $jira->id], ['confirm' => __('Are you sure you want to delete # {0}?', $jira->id)]) ?> </li>
<li><?= $this->Html->link(__('List Jiras'), ['action' => 'index']) ?> </li>
<li><?= $this->Html->link(__('New Jira'), ['action' => 'add']) ?> </li>
</ul>
</nav>
<div class="jiras view large-9 medium-8 columns content">
<h3><?= h($jira->name) ?></h3>
<table class="vertical-table">
<tr>
<th scope="row"><?= __('Name') ?></th>
<td><?= h($jira->name) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Id') ?></th>
<td><?= $this->Number->format($jira->id) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Created') ?></th>
<td><?= h($jira->created) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Modified') ?></th>
<td><?= h($jira->modified) ?></td>
</tr>
</table>
<div class="row">
<h4><?= __('Tickets') ?></h4>
<?= $this->Text->autoParagraph(h($jira->tickets)); ?>
</div>
</div>

View File

@@ -4,6 +4,7 @@
<?php <?php
echo '<p>' . $this->Html->link('UP Statistik Prod',['controller' => 'Curls', 'action' => 'upStatistik'],['escape' => false]) . '</p>'; echo '<p>' . $this->Html->link('UP Statistik Prod',['controller' => 'Curls', 'action' => 'upStatistik'],['escape' => false]) . '</p>';
echo '<p>' . $this->Html->link('US Statistik Prod',['controller' => 'Curls', 'action' => 'usStatistik'],['escape' => false]) . '</p>'; echo '<p>' . $this->Html->link('US Statistik Prod',['controller' => 'Curls', 'action' => 'usStatistik'],['escape' => false]) . '</p>';
echo '<p>' . $this->Html->link('US Statistik Para',['controller' => 'Curls', 'action' => 'usStatistikPara'],['escape' => false]) . '</p>';
echo '<p>' . $this->Html->link('Dienstverhältnis Analyse',['controller' => 'Employments', 'action' => 'index'],['escape' => false]) . '</p>'; echo '<p>' . $this->Html->link('Dienstverhältnis Analyse',['controller' => 'Employments', 'action' => 'index'],['escape' => false]) . '</p>';
echo '<p>' . $this->Html->link('Einbuchungsfehler',['controller' => 'Employments', 'action' => 'analyse'],['escape' => false]) . '</p>'; echo '<p>' . $this->Html->link('Einbuchungsfehler',['controller' => 'Employments', 'action' => 'analyse'],['escape' => false]) . '</p>';

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Test\Fixture;
use Cake\TestSuite\Fixture\TestFixture;
/**
* JirasFixture
*/
class JirasFixture extends TestFixture
{
/**
* Fields
*
* @var array
*/
// @codingStandardsIgnoreStart
public $fields = [
'id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null],
'name' => ['type' => 'string', 'length' => 255, 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '', 'precision' => null, 'fixed' => null],
'tickets' => ['type' => 'text', 'length' => null, 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '', 'precision' => null],
'created' => ['type' => 'datetime', 'length' => null, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null],
'modified' => ['type' => 'datetime', 'length' => null, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null],
'_constraints' => [
'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []],
],
'_options' => [
'engine' => 'InnoDB',
'collation' => 'utf8_general_ci'
],
];
// @codingStandardsIgnoreEnd
/**
* Init method
*
* @return void
*/
public function init()
{
$this->records = [
[
'id' => 1,
'name' => 'Lorem ipsum dolor sit amet',
'tickets' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.',
'created' => '2019-11-14 07:25:15',
'modified' => '2019-11-14 07:25:15'
],
];
parent::init();
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace App\Test\TestCase\Controller;
use App\Controller\JirasController;
use Cake\TestSuite\IntegrationTestTrait;
use Cake\TestSuite\TestCase;
/**
* App\Controller\JirasController Test Case
*/
class JirasControllerTest extends TestCase
{
use IntegrationTestTrait;
/**
* Fixtures
*
* @var array
*/
public $fixtures = [
'app.Jiras'
];
/**
* Test index method
*
* @return void
*/
public function testIndex()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test view method
*
* @return void
*/
public function testView()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test add method
*
* @return void
*/
public function testAdd()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test edit method
*
* @return void
*/
public function testEdit()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test delete method
*
* @return void
*/
public function testDelete()
{
$this->markTestIncomplete('Not implemented yet.');
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace App\Test\TestCase\Model\Table;
use App\Model\Table\JirasTable;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\TestCase;
/**
* App\Model\Table\JirasTable Test Case
*/
class JirasTableTest extends TestCase
{
/**
* Test subject
*
* @var \App\Model\Table\JirasTable
*/
public $Jiras;
/**
* Fixtures
*
* @var array
*/
public $fixtures = [
'app.Jiras'
];
/**
* setUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
$config = TableRegistry::getTableLocator()->exists('Jiras') ? [] : ['className' => JirasTable::class];
$this->Jiras = TableRegistry::getTableLocator()->get('Jiras', $config);
}
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
unset($this->Jiras);
parent::tearDown();
}
/**
* Test initialize method
*
* @return void
*/
public function testInitialize()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test validationDefault method
*
* @return void
*/
public function testValidationDefault()
{
$this->markTestIncomplete('Not implemented yet.');
}
}

File diff suppressed because one or more lines are too long

View File

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long