Compare commits
10 Commits
1e9a4e65c5
...
d36aeab9e8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d36aeab9e8 | ||
|
|
b5c0090f87 | ||
|
|
0996682d8b | ||
|
|
f419ce6c23 | ||
|
|
9ef747a51e | ||
|
|
10e9fed11c | ||
|
|
d94a8e88c5 | ||
|
|
6247ec5037 | ||
|
|
a350bc7228 | ||
|
|
4c83767fe7 |
9381
budget.sql
9381
budget.sql
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"cakephp/cakephp": "3.5.*",
|
||||
"cakephp/cakephp": "3.8.*",
|
||||
"cakephp/migrations": "^1.0",
|
||||
"cakephp/plugin-installer": "^1.0",
|
||||
"friendsofcake/cakephp-csvview": "~3.0",
|
||||
@@ -16,7 +16,7 @@
|
||||
"require-dev": {
|
||||
"cakephp/bake": "^1.1",
|
||||
"cakephp/cakephp-codesniffer": "^3.0",
|
||||
"cakephp/debug_kit": "^3.2",
|
||||
"cakephp/debug_kit": "~3.0",
|
||||
"psy/psysh": "@stable"
|
||||
},
|
||||
"suggest": {
|
||||
|
||||
1191
composer.lock
generated
1191
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -41,6 +41,7 @@ use Cake\Error\ErrorHandler;
|
||||
use Cake\Http\ServerRequest;
|
||||
use Cake\Log\Log;
|
||||
use Cake\Mailer\Email;
|
||||
use Cake\Mailer\TransportFactory;
|
||||
use Cake\Utility\Inflector;
|
||||
use Cake\Utility\Security;
|
||||
|
||||
@@ -144,7 +145,8 @@ if (!Configure::read('App.fullBaseUrl')) {
|
||||
|
||||
Cache::setConfig(Configure::consume('Cache'));
|
||||
ConnectionManager::setConfig(Configure::consume('Datasources'));
|
||||
Email::setConfigTransport(Configure::consume('EmailTransport'));
|
||||
//Email::setConfigTransport(Configure::consume('EmailTransport'));
|
||||
TransportFactory::setConfig(Configure::consume('EmailTransport'));
|
||||
Email::setConfig(Configure::consume('Email'));
|
||||
Log::setConfig(Configure::consume('Log'));
|
||||
Security::setSalt(Configure::consume('Security.salt'));
|
||||
@@ -212,7 +214,8 @@ Type::build('timestamp')
|
||||
* Debug Kit should not be installed on a production system
|
||||
*/
|
||||
if (Configure::read('debug')) {
|
||||
Plugin::load('DebugKit', ['bootstrap' => true]);
|
||||
//Plugin::load('DebugKit', ['bootstrap' => true]);
|
||||
//Application::addPlugin('DebugKit', ['bootstrap' => true]);
|
||||
}
|
||||
|
||||
Plugin::load('AsdCurl', ['autoload' => true, 'bootstrap' => true, 'routes' => true]);
|
||||
//Plugin::load('AsdCurl', ['autoload' => true, 'bootstrap' => true, 'routes' => true]);
|
||||
@@ -49,7 +49,8 @@ Router::scope('/', function (RouteBuilder $routes) {
|
||||
* its action called 'display', and we pass a param to select the view file
|
||||
* to use (in this case, src/Template/Pages/home.ctp)...
|
||||
*/
|
||||
$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
|
||||
//$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
|
||||
$routes->connect('/', ['controller' => 'Budget', 'action' => 'overview']);
|
||||
|
||||
/**
|
||||
* ...and connect the rest of 'Pages' controller's URLs.
|
||||
|
||||
@@ -10,24 +10,27 @@ try {
|
||||
exit($e->getMessage() . "\n");
|
||||
}
|
||||
|
||||
//define('SCHULPORTAL_BASE0_URL', "https://portal.schulen.bayern.de");
|
||||
//define('SCHULPORTAL_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig2d1dfad4a11c25e42c462e53b4721e48/uniquesig0');
|
||||
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_ASD_BASE_URL', 'http://192.168.56.3:8280/asd');
|
||||
|
||||
define('SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/f5-w-687474703a2f2f6173642d6170702d70726f642e727a2d737565642e62617965726e2e64653a38323830$$/asd/');
|
||||
|
||||
//define('SCHULPORTAL_ASD_BASE_URL', 'http://192.168.56.3:8280/asd');
|
||||
|
||||
|
||||
Configure::write('AsdCurl.proxy','127.0.0.1:8080');
|
||||
//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.cookiejar', 'C:/xampp/tmp/cookies.txt');
|
||||
Configure::write('AsdCurl.cookiefile', 'C:/xampp/tmp/cookies.txt');
|
||||
Configure::write('AsdCurl.cookiejar', '/tmp/cookies.txt');
|
||||
Configure::write('AsdCurl.cookiefile', '/tmp/cookies.txt');
|
||||
//Configure::write('AsdCurl.cookiejar', 'C:/xampp/tmp/cookies.txt');
|
||||
//Configure::write('AsdCurl.cookiefile', 'C:/xampp/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','C:/xampp/htdocs/ssl_KM_Z2016_asd.trinkl.pem');
|
||||
//Configure::write('AsdCurl.schulbase0url',SCHULPORTAL_BASE0_URL);
|
||||
//Configure::write('AsdCurl.schulbaseurl',SCHULPORTAL_BASE_URL);
|
||||
//Configure::write('AsdCurl.cert','C:/xampp/htdocs/ssl_KM_Z2016_asd.trinkl.pem');
|
||||
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);
|
||||
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ class AsdCurl
|
||||
|
||||
public function init_curl_params()
|
||||
{
|
||||
$ch = curl_init();
|
||||
$ch = curl_init('https://portal.schulen.bayern.de/');
|
||||
//curl_setopt($ch, CURLOPT_PROXY, Configure::read('AsdCurl.proxy'));
|
||||
curl_setopt($ch, CURLOPT_PROXY, false);
|
||||
//curl_setopt($ch, CURLOPT_PROXY, true);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, Configure::read('AsdCurl.useragent'));
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
@@ -32,12 +32,28 @@ class AsdCurl
|
||||
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);
|
||||
//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_akt_schuljahr_id() {
|
||||
$akt_jahr = date("Y");
|
||||
return (int)substr($akt_jahr,2,2) + 5;
|
||||
}
|
||||
|
||||
public function get_akt_schuljahr() {
|
||||
$akt_jahr = date("Y");
|
||||
return $akt_jahr;
|
||||
}
|
||||
|
||||
public function get_ende_akt_schuljahr() {
|
||||
$akt_jahr = date("Y");
|
||||
$date = '31.07.'. (string)((int)$akt_jahr + 1);
|
||||
return $date;
|
||||
}
|
||||
|
||||
public function get_string_between($string, $start, $end)
|
||||
{
|
||||
//debug($start);
|
||||
@@ -69,6 +85,7 @@ class AsdCurl
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
$this->html = curl_exec($ch);
|
||||
//debug($this->html);
|
||||
//debug(curl_errno($ch));
|
||||
//debug(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
||||
if (curl_errno($ch)) {
|
||||
@@ -93,10 +110,10 @@ class AsdCurl
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
|
||||
$login_data = [
|
||||
//'asd_username' => 'A005_TrinklW',
|
||||
//'asd_password' => 'HiegTzs!12',
|
||||
'asd_username' => 'A005_Superuser',
|
||||
'asd_password' => 'asdtest01',
|
||||
'asd_username' => 'A005_TrinklW',
|
||||
'asd_password' => 'HiegTzs!195',
|
||||
//'asd_username' => 'A005_Superuser',
|
||||
//'asd_password' => 'asdtest01',
|
||||
];
|
||||
$post = [
|
||||
'login:username' => $login_data['asd_username'],
|
||||
@@ -113,48 +130,7 @@ class AsdCurl
|
||||
}
|
||||
$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)
|
||||
@@ -162,37 +138,46 @@ class AsdCurl
|
||||
$SCHULPORTAL_BASE0_URL = Configure::read('AsdCurl.schulbase0url');
|
||||
$SCHULPORTAL_BASE_URL = Configure::read('AsdCurl.schulbaseurl');
|
||||
//$login_data = $this->request->session()->read('data');
|
||||
|
||||
//debug($SCHULPORTAL_BASE_URL);
|
||||
$this->exec_curl($ch, $SCHULPORTAL_BASE_URL, false);
|
||||
//debug($this->html);
|
||||
|
||||
if(!($this->status)) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
$login_data = [
|
||||
'portal_username' => 'asd.trinkl',
|
||||
'portal_password' => 'HiegTzs!181',
|
||||
'portal_password' => 'HiegTzs!193',
|
||||
];
|
||||
|
||||
$post = [
|
||||
'user_name' => $login_data['portal_username'],
|
||||
'username' => $login_data['portal_username'],
|
||||
'password' => $login_data['portal_password'],
|
||||
'repository' => 'schulen.bayern.de',
|
||||
'site_name' => 'schulportal',
|
||||
'secure' => '1',
|
||||
'resource_id' => '2',
|
||||
'login_type' => '2',
|
||||
//'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);
|
||||
$this->exec_curl($ch, 'https://portal.schulen.bayern.de/my.policy', $post);
|
||||
//debug($this->html);die;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class AsdUp extends AsdCurl
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'mainForm:schulnr' => $snr,
|
||||
'mainForm:action_anzeigen' => 'Direkt zur gewählten Schule',
|
||||
'mainForm:schuljahr' => '23',
|
||||
'mainForm:schuljahr' => $this->get_akt_schuljahr_id(),
|
||||
'javax.faces.ViewState' => $viewstate
|
||||
];
|
||||
|
||||
@@ -45,10 +45,10 @@ class AsdUp extends AsdCurl
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
echo $this->html;die;
|
||||
//echo $this->html;die;
|
||||
}
|
||||
|
||||
public function goto_budget($ch,$budget) {
|
||||
public function goto_budget($ch,$schooltype) {
|
||||
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl');
|
||||
// Reiter Unterrichtsplanung aufrufen
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
@@ -63,6 +63,7 @@ class AsdUp extends AsdCurl
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
|
||||
// Im linken Menue Budget GY anzeigen
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
|
||||
@@ -97,7 +98,8 @@ class AsdUp extends AsdCurl
|
||||
'mainForm:nameOffiziell' => 'Bayer.Staatsministerium für Unterricht und Kultus München',
|
||||
'mainForm:schulstellePlzStrasse' => '80333',
|
||||
'mainForm:schulstelleOrt' => 'München',
|
||||
'mainForm:schulnummer' => $budget['snr'],
|
||||
//'mainForm:schulnummer' => $budget['snr'],
|
||||
'mainForm:schulnummer' => '0001',
|
||||
'mainForm:action_anzeigen' => 'Direkt zur gewählten Schule',
|
||||
'javax.faces.ViewState' => $viewstate
|
||||
];
|
||||
@@ -125,7 +127,8 @@ class AsdUp extends AsdCurl
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'mainForm:schulnr' => '',
|
||||
'mainForm:schuljahr' => '23',
|
||||
'mainForm:schulnummer' => $budget['snr'],
|
||||
//'mainForm:schulnummer' => $budget['snr'],
|
||||
'mainForm:schulnummer' => '0001',
|
||||
'mainForm:tabs.1' => 'Budgetzuschläge',
|
||||
'javax.faces.ViewState' => $viewstate
|
||||
];
|
||||
@@ -133,7 +136,7 @@ class AsdUp extends AsdCurl
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
|
||||
//echo $this->html;die;
|
||||
}
|
||||
|
||||
public function read_budget($ch,$snr) {
|
||||
@@ -143,26 +146,34 @@ class AsdUp extends AsdCurl
|
||||
$htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml
|
||||
$htmlParser->preserveWhiteSpace = false;
|
||||
|
||||
//echo $this->html;die;
|
||||
|
||||
$headers = ['checkbox','herkunft','budget','von','bis','count','comment'];
|
||||
$table = $htmlParser->getElementById('mainForm:dataTable:zuschlaege');
|
||||
|
||||
|
||||
$rows = $table->getElementsByTagName('tr');
|
||||
|
||||
for($i=0;$i < (sizeof($rows)-1);$i++) {
|
||||
$cols = $rows[$i]->getElementsByTagName('td');
|
||||
$i=0;
|
||||
foreach($rows as $row) {
|
||||
//for($i=0;$i < (sizeof($rows)-1);$i++) {
|
||||
$cols = $row->getElementsByTagName('td');
|
||||
$j = 0;
|
||||
foreach($cols as $col) {
|
||||
$span = $col->getElementsByTagName('span');
|
||||
//debug(sizeof($span));
|
||||
if(sizeof($span) > 0) {
|
||||
//print_r($span);
|
||||
// debug($span->length);
|
||||
if($span->length > 0) {
|
||||
$data[$i][$headers[$j]] = $span->item(0)->nodeValue;
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$cols = $rows[sizeof($rows)-1]->getElementsByTagName('td');
|
||||
$span = $cols[1]->getElementsByTagName('span');
|
||||
$sum = $span->item(0)->nodeValue;
|
||||
//debug($data);
|
||||
//die;
|
||||
//$cols = $rows[sizeof($rows)-1]->getElementsByTagName('td');
|
||||
//$span = $cols[1]->getElementsByTagName('span');
|
||||
//$sum = $span->item(0)->nodeValue;
|
||||
//$data['sum'] = $sum;
|
||||
return($data);
|
||||
}
|
||||
@@ -262,41 +273,50 @@ class AsdUp extends AsdCurl
|
||||
return($to_del);
|
||||
}
|
||||
|
||||
public function write_budget($ch,$budget) {
|
||||
public function del_budget($ch,$snr,$linenr) {
|
||||
//debug($snr);
|
||||
//echo($this->html);
|
||||
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl');
|
||||
|
||||
// Budget eintragen
|
||||
$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;
|
||||
|
||||
$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' => 'true',
|
||||
'mainForm:hasChanged' => 'true',
|
||||
'mainForm:hasNotReleased' => 'false',
|
||||
'mainForm:hasPopUpChanged' => 'false',
|
||||
'mainForm:hasAdresseChanged' => 'false',
|
||||
'mainForm:confirmedOverride' => 'true',
|
||||
'mainForm:zuordnungNotification' => 'false',
|
||||
'skipvalidation' => 'false',
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'mainForm:schulnr' => '',
|
||||
'mainForm:schuljahr' => '23',
|
||||
'mainForm:schulnummer' => $budget['snr'],
|
||||
'mainForm:tab2:artZuschlag' => 'com.hp.asd.wl.domain.standard.Budgetform:' . $budget['budget_id'],
|
||||
'mainForm:tab2:datumBis' => '31.07.2019',
|
||||
'mainForm:tab2:_edit_budget' => $budget['count'],
|
||||
'mainForm:tab2:_edit_bemerkung' => $budget['comment'],
|
||||
'mainForm:tab2:hinzufuegen' => 'Hinzufügen',
|
||||
'javax.faces.ViewState' => $viewstate
|
||||
];
|
||||
'referenzBaumAnzeigen' => 'false',
|
||||
'conversationId' => $conversationId,
|
||||
'changeNotification' => 'true',
|
||||
'mainForm:hasChanged' => 'true',
|
||||
'mainForm:hasNotReleased' => 'false',
|
||||
'mainForm:hasPopUpChanged' => 'false',
|
||||
'mainForm:hasAdresseChanged' => 'false',
|
||||
'mainForm:confirmedOverride' => 'true',
|
||||
'mainForm:zuordnungNotification' => 'false',
|
||||
'skipvalidation' => 'false',
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'mainForm:schulnr' => '',
|
||||
'mainForm:schuljahr' => '23',
|
||||
'mainForm:schulnummer' => $snr,
|
||||
'mainForm:tab2:artZuschlag' => 'com.hp.asd.wl.domain.standard.Budgetform:1502',
|
||||
'mainForm:tab2:datumBis' => '31.07.2019',
|
||||
'mainForm:tab2:_edit_budget' => '',
|
||||
'mainForm:tab2:_edit_bemerkung' => '',
|
||||
'mainForm:loeschen' => 'Löschen',
|
||||
'javax.faces.ViewState' => $viewstate
|
||||
];
|
||||
$post['mainForm:tab2:_' . $linenr .'_select'] = 'on';
|
||||
//debug($post);die;
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdbu/up_07_50.jsf?cid=' . $conversationId, $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
|
||||
//echo $this->html;
|
||||
//die;
|
||||
// Budget speichern
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
|
||||
@@ -316,8 +336,8 @@ class AsdUp extends AsdCurl
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'mainForm:schulnr' => '',
|
||||
'mainForm:schuljahr' => '23',
|
||||
'mainForm:schulnummer' => $budget['snr'],
|
||||
'mainForm:tab2:artZuschlag' => 'com.hp.asd.wl.domain.standard.Budgetform:' . $budget['budget_id'],
|
||||
'mainForm:schulnummer' => $snr,
|
||||
'mainForm:tab2:artZuschlag' => 'com.hp.asd.wl.domain.standard.Budgetform:1502',
|
||||
'mainForm:tab2:datumBis' => '31.07.2019',
|
||||
'mainForm:tab2:_edit_budget' => '',
|
||||
'mainForm:tab2:_edit_bemerkung' => '',
|
||||
@@ -328,8 +348,80 @@ class AsdUp extends AsdCurl
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
//return($to_del);
|
||||
}
|
||||
|
||||
//echo $this->html;die;
|
||||
public function write_budget($ch,$budget) {
|
||||
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl');
|
||||
//debug($budget);die;
|
||||
// Budget eintragen
|
||||
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
|
||||
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
|
||||
|
||||
//debug($budget['comment']);
|
||||
//debug(urlencode($budget['comment']));
|
||||
|
||||
$post = [
|
||||
'mainForm' => 'mainForm',
|
||||
'referenzBaumAnzeigen' => 'false',
|
||||
'conversationId' => $conversationId,
|
||||
'changeNotification' => 'true',
|
||||
'mainForm:hasChanged' => 'true',
|
||||
'mainForm:hasNotReleased' => 'false',
|
||||
'mainForm:hasPopUpChanged' => 'false',
|
||||
'mainForm:hasAdresseChanged' => 'false',
|
||||
'mainForm:confirmedOverride' => 'true',
|
||||
'mainForm:zuordnungNotification' => 'false',
|
||||
'skipvalidation' => 'false',
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'mainForm:schulnr' => '',
|
||||
'mainForm:schuljahr' => $this->get_akt_schuljahr_id(),
|
||||
'mainForm:schulnummer' => $budget['snr'],
|
||||
'mainForm:tab2:artZuschlag' => 'com.hp.asd.wl.domain.standard.Budgetform:' . $budget['wl_werteliste_nr'],
|
||||
'mainForm:tab2:datumBis' => $this->get_ende_akt_schuljahr(),
|
||||
'mainForm:tab2:_edit_budget' => $budget['count'],
|
||||
'mainForm:tab2:_edit_bemerkung' => $budget['comment'],
|
||||
'mainForm:tab2:hinzufuegen' => 'Hinzufügen',
|
||||
'javax.faces.ViewState' => $viewstate
|
||||
];
|
||||
//debug(http_build_query($post));
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdbu/up_07_50.jsf?cid=' . $conversationId, $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
// Budget speichern
|
||||
$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' => 'true',
|
||||
'mainForm:hasChanged' => 'true',
|
||||
'mainForm:hasNotReleased' => 'false',
|
||||
'mainForm:hasPopUpChanged' => 'false',
|
||||
'mainForm:hasAdresseChanged' => 'false',
|
||||
'mainForm:confirmedOverride' => 'true',
|
||||
'mainForm:zuordnungNotification' => 'false',
|
||||
'skipvalidation' => 'false',
|
||||
'mainForm:istAnzeigeMaske' => 'false',
|
||||
'mainForm:schulnr' => '',
|
||||
'mainForm:schuljahr' => $this->get_akt_schuljahr_id(),
|
||||
'mainForm:schulnummer' => $budget['snr'],
|
||||
'mainForm:tab2:artZuschlag' => 'com.hp.asd.wl.domain.standard.Budgetform:' . $budget['wl_werteliste_nr'],
|
||||
'mainForm:tab2:datumBis' => $this->get_ende_akt_schuljahr(),
|
||||
'mainForm:tab2:_edit_budget' => '',
|
||||
'mainForm:tab2:_edit_bemerkung' => '',
|
||||
'mainForm:speichern' => 'Speichern',
|
||||
'javax.faces.ViewState' => $viewstate
|
||||
];
|
||||
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdbu/up_07_50.jsf?cid=' . $conversationId, $post);
|
||||
if(!($this->status)) {
|
||||
die($this->error);
|
||||
}
|
||||
//echo $this->html;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,13 @@ use Cake\Routing\Middleware\RoutingMiddleware;
|
||||
*/
|
||||
class Application extends BaseApplication
|
||||
{
|
||||
public function bootstrap()
|
||||
{
|
||||
parent::bootstrap();
|
||||
// Load the contact manager plugin by class name
|
||||
$this->addPlugin('DebugKit', ['bootstrap' => true]);
|
||||
$this->addPlugin('AsdCurl', ['autoload' => true, 'bootstrap' => true, 'routes' => true]);
|
||||
}
|
||||
/**
|
||||
* Setup the middleware queue your application will use.
|
||||
*
|
||||
|
||||
@@ -16,6 +16,10 @@ namespace App\Controller;
|
||||
|
||||
use Cake\Controller\Controller;
|
||||
use Cake\Event\Event;
|
||||
use Cake\Http\Cookie\Cookie;
|
||||
use Cake\Http\Cookie\CookieCollection;
|
||||
use Cake\I18n\Time;
|
||||
use Cake\Controller\Component\CookieComponent;
|
||||
|
||||
/**
|
||||
* Application Controller
|
||||
@@ -43,12 +47,44 @@ class AppController extends Controller
|
||||
|
||||
$this->loadComponent('RequestHandler');
|
||||
$this->loadComponent('Flash');
|
||||
|
||||
$this->loadComponent('Cookie');
|
||||
|
||||
$this->Cookie->config('encryption', false);
|
||||
$this->Cookie->config('path', '/');
|
||||
$this->Cookie->config([
|
||||
'expires' => '+100 days',
|
||||
'httpOnly' => true
|
||||
]);
|
||||
|
||||
$session = $this->request->session();
|
||||
|
||||
|
||||
if(!($session->check('SchoolType'))) {
|
||||
$session->write('SchoolType','02');
|
||||
}
|
||||
/**
|
||||
debug($this->Cookie->check('schooltype'));
|
||||
|
||||
if(!$this->Cookie->check('schooltype')) {
|
||||
|
||||
debug('Cookie neu');
|
||||
$this->Cookie->write('schooltype', '2');
|
||||
}
|
||||
debug($this->Cookie->read('schooltype'));
|
||||
*/
|
||||
/** if(!($this->request->getCookie('schooltype'))) {
|
||||
debug('Hallo');
|
||||
$cookie = (new Cookie('schooltype'))
|
||||
->withValue('2')
|
||||
->withExpiry(new \DateTime('+1 year'))
|
||||
->withSecure(false)
|
||||
->withHttpOnly(true);
|
||||
$this->response = $this->response->withCookie($cookie);
|
||||
debug($this->response->getCookie('schooltype'));
|
||||
$cookies = new CookieCollection([$cookie]);
|
||||
$cookies = $cookies->add($cookie);
|
||||
debug(count($cookies));
|
||||
//die;
|
||||
} */
|
||||
|
||||
/*
|
||||
* Enable the following components for recommended CakePHP security settings.
|
||||
|
||||
@@ -22,20 +22,116 @@ class BudgetController extends AppController
|
||||
else {
|
||||
$session->write('SchoolType','02');
|
||||
}
|
||||
/* debug($this->Cookie->read('schooltype'));
|
||||
if($this->Cookie->read('schooltype') == '2') {
|
||||
debug('Gymnasium');
|
||||
//$this->Cookie->delete('schooltype');
|
||||
$this->Cookie->write('schooltype', '4');
|
||||
debug($this->Cookie->read('schooltype'));
|
||||
}
|
||||
else {
|
||||
debug('Realschule');
|
||||
//$this->Cookie->delete('schooltype');
|
||||
$this->Cookie->write('schooltype', '2');
|
||||
debug($this->Cookie->read('schooltype'));
|
||||
}
|
||||
*/
|
||||
//die;
|
||||
$this->redirect($this->referer());
|
||||
}
|
||||
|
||||
public function listBudgets() {
|
||||
|
||||
$session = $this->request->session();
|
||||
//debug($session->read('SchoolType'));die;
|
||||
$schooltype = $session->read('SchoolType');
|
||||
if ($schooltype == '02') {
|
||||
$schulart = 'RS';
|
||||
}
|
||||
else {
|
||||
$schulart = 'GY';
|
||||
|
||||
}
|
||||
|
||||
$wlBudgets = $this->Budget->wlBudgets->find('all', [
|
||||
'conditions' => array('schulart' => 'GY')
|
||||
'conditions' => array('schulart' => $schulart)
|
||||
]);
|
||||
$this->set('wlBudgets',$wlBudgets);
|
||||
}
|
||||
|
||||
public function editBudget($id = null) {
|
||||
|
||||
$curl = new AsdUp();
|
||||
|
||||
$session = $this->request->session();
|
||||
//debug($session->read('SchoolType'));die;
|
||||
$schooltype = $session->read('SchoolType');
|
||||
//debug($schooltype);
|
||||
if($schooltype == '02') {
|
||||
$schooltype_nr = 2;
|
||||
}
|
||||
else {
|
||||
$schooltype_nr = 4;
|
||||
}
|
||||
|
||||
//debug($this->referer());
|
||||
$budget_id = $this->request->params['pass'][0];
|
||||
//debug($budget_id);
|
||||
$uploadData = '';
|
||||
if ($this->request->is('post')) {
|
||||
// csv file mit 1.Spalte: SNR; 2. Spalte: Anzahl; 3. Spalte: Kommentar
|
||||
if(!empty($this->request->data['file']['name'])){
|
||||
$result = $this->Budget->deleteAll(['wl_budget_id' => $budget_id]);
|
||||
//debug($result);die;
|
||||
$handle = fopen($this->request->data['file']['tmp_name'], "r");
|
||||
$head = true;
|
||||
$snr_arr = array();
|
||||
if ($handle) {
|
||||
while (($line = fgets($handle)) !== false) {
|
||||
if(strlen($line) > 2) {
|
||||
if($head) {
|
||||
$headers = explode(';',$line);
|
||||
$head = false;
|
||||
}
|
||||
else {
|
||||
$line_arr = explode(';',$line);
|
||||
if(!isset($snr_arr[$line_arr[0]])) {
|
||||
$new_budget['wl_schooltype_id'] = $schooltype_nr;
|
||||
$new_budget['snr'] = $line_arr[0];
|
||||
$new_budget['wl_budget_id'] = $budget_id;
|
||||
$new_budget['count'] = $line_arr[1];
|
||||
$new_budget['comment'] = trim($line_arr[2]);
|
||||
$new_budget['year'] = $curl->get_akt_schuljahr();
|
||||
$new_budget['asd'] = false;
|
||||
$snr_arr[$line_arr[0]] = $new_budget;
|
||||
}
|
||||
else {
|
||||
$snr_arr[$line_arr[0]]['count'] = $snr_arr[$line_arr[0]]['count'] + $line_arr[1];
|
||||
//debug($snr_arr[$line_arr[0]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
//debug($snr_arr);die;
|
||||
foreach ($snr_arr as $item) {
|
||||
//debug($item);
|
||||
$new = $this->Budget->newEntity();
|
||||
$new = $this->Budget->patchEntity($new, $item);
|
||||
$result = $this->Budget->save($new);
|
||||
//debug($result);die;
|
||||
}
|
||||
//die;
|
||||
} else {
|
||||
$this->Flash->error(__('Please choose a file to upload.'));
|
||||
}
|
||||
}
|
||||
$this->set('uploadData', $uploadData);
|
||||
$this->loadModel('Schools');
|
||||
$schools = $this->Schools->find('all');
|
||||
$schools = $this->Schools->find('all', [
|
||||
'conditions' => array('dst_schulart' => $schooltype)
|
||||
]);
|
||||
$data = array();
|
||||
foreach($schools as $school) {
|
||||
$line = array();
|
||||
@@ -49,10 +145,14 @@ class BudgetController extends AppController
|
||||
'conditions' => array('wl_budget_id' => $id)
|
||||
]);
|
||||
|
||||
foreach($budgets as $budget) {
|
||||
foreach($budgets as $budget) {
|
||||
//debug($budget);
|
||||
$data[$budget['snr']][2] = $budget['count'];
|
||||
$data[$budget['snr']][3] = $budget['comment'];
|
||||
$data[$budget['snr']][4] = $budget['asd'];
|
||||
}
|
||||
//debug($data);
|
||||
//die;
|
||||
$data_arr = array();
|
||||
foreach($data as $entry) {
|
||||
array_push($data_arr,$entry);
|
||||
@@ -60,67 +160,128 @@ class BudgetController extends AppController
|
||||
$budget = $this->Budget->wlBudgets->get($id);
|
||||
$this->set('budget',$budget);
|
||||
$this->set('data',$data_arr);
|
||||
$this->set('schooltype',$schooltype);
|
||||
}
|
||||
|
||||
public function editajax($id = null) {
|
||||
public function editajax() {
|
||||
$curl = new AsdUp();
|
||||
$this->autoRender = false;
|
||||
$myfile = fopen(WWW_ROOT . DS . 'files' . DS . 'debug-edit.txt', "w");
|
||||
fwrite($myfile,$id . PHP_EOL);
|
||||
//fwrite($myfile,$id . PHP_EOL);
|
||||
$data = $this->request->input('json_decode');
|
||||
$params = $this->request->params;
|
||||
debug($params['?']);
|
||||
fwrite($myfile,json_encode($params['?']['budget']) . PHP_EOL);
|
||||
fwrite($myfile,json_encode($params['?']['schooltype']) . PHP_EOL);
|
||||
$id = $params['?']['budget'];
|
||||
$schooltype = $params['?']['schooltype'];
|
||||
if($schooltype == '02') {
|
||||
$schooltype_nr = '2';
|
||||
}
|
||||
else {
|
||||
$schooltype_nr = '4';
|
||||
}
|
||||
|
||||
foreach($data as $line) {
|
||||
if($line[2] > 0) {
|
||||
$query = $this->Budget->find('all', [
|
||||
'conditions' => array('snr' => $line[0], 'wl_budget_id' => $id)
|
||||
]);
|
||||
|
||||
//fwrite($myfile,json_encode($line[0]) . PHP_EOL);
|
||||
//$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
|
||||
//preg_match_all("/$regexp/siU", $line[0], $matches);
|
||||
//fwrite($myfile,json_encode($line) . PHP_EOL);
|
||||
$query = $this->Budget->find('all', [
|
||||
'conditions' => array('snr' => $line[0], 'wl_budget_id' => $id)
|
||||
]);
|
||||
|
||||
if(!($query->isEmpty())) {
|
||||
$budget = $query->first();
|
||||
if($budget['count'] != $line[2] ) {
|
||||
if(!($query->isEmpty())) {
|
||||
$budget = $query->first();
|
||||
fwrite($myfile,json_encode($budget) . PHP_EOL);
|
||||
if($budget['count'] != $line[2] ) {
|
||||
if($line[2] > 0) {
|
||||
$budget['count'] = $line[2];
|
||||
$budget['asd'] = 0;
|
||||
$this->Budget->save($budget);
|
||||
fwrite($myfile,'full-count' . PHP_EOL);
|
||||
}
|
||||
if($budget['comment'] != $line[3] ) {
|
||||
$budget['comment'] = $line[3];
|
||||
$this->Budget->save($budget);
|
||||
fwrite($myfile,'full-comment' . PHP_EOL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
fwrite($myfile,'empty' . PHP_EOL);
|
||||
$new = $this->Budget->newEntity();
|
||||
$new_budget['wl_schooltype_id'] = 4;
|
||||
$new_budget['snr'] = $line[0];
|
||||
$new_budget['wl_budget_id'] = $id;
|
||||
$new_budget['count'] = $line[2];
|
||||
$new_budget['comment'] = $line[3];
|
||||
$new_budget['year'] = '2018';
|
||||
$new = $this->Budget->patchEntity($new, $new_budget);
|
||||
$this->Budget->save($new);
|
||||
}
|
||||
fwrite($myfile,serialize($budget). PHP_EOL);
|
||||
fwrite($myfile,$line[0] . ' ' .($i-1) . ' ' . $line[$i]. PHP_EOL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->Budget->delete($budget);
|
||||
}
|
||||
fwrite($myfile,'full-count' . PHP_EOL);
|
||||
}
|
||||
if($budget['comment'] != $line[3] ) {
|
||||
$budget['comment'] = $line[3];
|
||||
$budget['asd'] = 0;
|
||||
$this->Budget->save($budget);
|
||||
fwrite($myfile,'full-comment' . PHP_EOL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
fwrite($myfile,'empty' . PHP_EOL);
|
||||
$new = $this->Budget->newEntity();
|
||||
$new_budget['wl_schooltype_id'] = $schooltype_nr;
|
||||
$new_budget['snr'] = $line[0];
|
||||
$new_budget['wl_budget_id'] = $id;
|
||||
$new_budget['count'] = $line[2];
|
||||
$new_budget['comment'] = $line[3];
|
||||
$new_budget['year'] = $curl->get_akt_schuljahr();
|
||||
$new_budget['asd'] = 0;
|
||||
$new = $this->Budget->patchEntity($new, $new_budget);
|
||||
$this->Budget->save($new);
|
||||
}
|
||||
//fwrite($myfile,serialize($budget). PHP_EOL);
|
||||
//fwrite($myfile,$line[0] . ' ' .($i-1) . ' ' . $line[$i]. PHP_EOL);
|
||||
|
||||
}
|
||||
fclose($myfile);
|
||||
}
|
||||
|
||||
public function sajax() {
|
||||
public function sajax($schooltype = null) {
|
||||
|
||||
$curl = new AsdUp();
|
||||
//$session = $this->request->session();
|
||||
//debug($session->read('SchoolType'));die;
|
||||
//$schooltype = $session->read('SchoolType');
|
||||
if ($schooltype == '02') {
|
||||
$wl_offset = 31;
|
||||
$schooltype_id = '2';
|
||||
}
|
||||
else {
|
||||
$schooltype_id = '4';
|
||||
$wl_offset = -1;
|
||||
}
|
||||
|
||||
$this->autoRender = false;
|
||||
$myfile = fopen(WWW_ROOT . DS . 'files' . DS . 'debug.txt', "w");
|
||||
$data = $this->request->input('json_decode');
|
||||
|
||||
$query = $this->Budget->find('all', [
|
||||
'conditions' => array('wl_schooltype_id' => $schooltype_id)
|
||||
]);
|
||||
$count = $query->count();
|
||||
fwrite($myfile,json_encode($count) . PHP_EOL);
|
||||
$dbdata = $query->toArray();
|
||||
$search_arr = array();
|
||||
foreach($dbdata as $entry) {
|
||||
$key = $entry['snr'] . '_' . $entry['wl_budget_id'];
|
||||
fwrite($myfile,json_encode($key) . PHP_EOL);
|
||||
$search_arr[$key]['count'] = $entry['count'];
|
||||
//$search_arr[$key]['comment'] = $entry['comment'];
|
||||
fwrite($myfile,json_encode($search_arr[$key]) . PHP_EOL);
|
||||
}
|
||||
|
||||
|
||||
$data = $this->request->input('json_decode');
|
||||
//fwrite($myfile,json_encode($dbdata) . PHP_EOL);
|
||||
//fwrite($myfile,'hallo' . PHP_EOL);
|
||||
// neue und geänderte Daten eintragen
|
||||
foreach($data as $line) {
|
||||
for($i=2;$i < sizeof($line);$i++) {
|
||||
if($line[$i] > 0) {
|
||||
$query = $this->Budget->find('all', [
|
||||
'conditions' => array('snr' => $line[0], 'wl_budget_id' => $i-1)
|
||||
]);
|
||||
|
||||
if(!($query->isEmpty())) {
|
||||
$budget = $query->first();
|
||||
if($budget['count'] != $line[$i] ) {
|
||||
$key = $line[0] . '_' . ($i+$wl_offset);
|
||||
fwrite($myfile,json_encode($key) . PHP_EOL);
|
||||
if(isset($search_arr[$key])) {
|
||||
if($search_arr[$key]['count'] != $line[$i] ) {
|
||||
$query = $this->Budget->find('all', [
|
||||
'conditions' => array('snr' => $line[0], 'wl_budget_id' => $i+$wl_offset)
|
||||
]);
|
||||
$budget = $query->first();
|
||||
$budget['count'] = $line[$i];
|
||||
$this->Budget->save($budget);
|
||||
}
|
||||
@@ -129,33 +290,75 @@ class BudgetController extends AppController
|
||||
else {
|
||||
fwrite($myfile,'empty' . PHP_EOL);
|
||||
$new = $this->Budget->newEntity();
|
||||
$new_budget['wl_schooltype_id'] = 4;
|
||||
$new_budget['wl_schooltype_id'] = $schooltype_id;
|
||||
$new_budget['snr'] = $line[0];
|
||||
$new_budget['wl_budget_id'] = $i-1;
|
||||
$new_budget['wl_budget_id'] = $i+$wl_offset;
|
||||
$new_budget['count'] = $line[$i];
|
||||
$new_budget['comment'] = 'auto';
|
||||
$new_budget['year'] = '2018';
|
||||
$new_budget['year'] = $curl->get_akt_schuljahr();
|
||||
|
||||
$new = $this->Budget->patchEntity($new, $new_budget);
|
||||
|
||||
$this->Budget->save($new);
|
||||
}
|
||||
fwrite($myfile,serialize($budget). PHP_EOL);
|
||||
fwrite($myfile,$line[0] . ' ' .($i-1) . ' ' . $line[$i]. PHP_EOL);
|
||||
$new = $this->Budget->patchEntity($new, $new_budget);
|
||||
$this->Budget->save($new);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// wurde etwas gelöscht?
|
||||
|
||||
foreach($dbdata as $entry) {
|
||||
fwrite($myfile,json_encode($entry) . PHP_EOL);
|
||||
fwrite($myfile,$entry->snr . PHP_EOL);
|
||||
$value = array_search($entry->snr,array_column($data,0));
|
||||
|
||||
fwrite($myfile,json_encode($value). PHP_EOL);
|
||||
fwrite($myfile,json_encode($data[$value]). PHP_EOL);
|
||||
fwrite($myfile,json_encode($data[$value][$entry->wl_budget_id - $wl_offset]). PHP_EOL);
|
||||
if($data[$value][$entry->wl_budget_id - $wl_offset] > 0) {
|
||||
fwrite($myfile,'passt' . PHP_EOL);
|
||||
}
|
||||
else {
|
||||
fwrite($myfile,'loeschen' . PHP_EOL);
|
||||
//$budget = $this->Budget->get($id);
|
||||
$this->Budget->delete($entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fclose($myfile);
|
||||
}
|
||||
|
||||
public function overview() {
|
||||
$wlBudgets = $this->Budget->wlBudgets->find('list', [
|
||||
'conditions' => array('schulart' => 'GY')
|
||||
|
||||
//debug($this->Cookie->read('schooltype'));
|
||||
//debug($this->request);
|
||||
//$cookie = $this->response->getCookie('schooltype');
|
||||
//debug($cookie['value']);
|
||||
//$schooltype = $cookie['value'];
|
||||
//die;
|
||||
|
||||
$session = $this->request->session();
|
||||
//debug($session->read('SchoolType'));die;
|
||||
$schooltype = $session->read('SchoolType');
|
||||
if ($schooltype == '02') {
|
||||
$schulart = 'RS';
|
||||
$offset = -31;
|
||||
}
|
||||
else {
|
||||
$schulart = 'GY';
|
||||
$offset = 1;
|
||||
}
|
||||
|
||||
$wlBudgets = $this->Budget->wlBudgets->find('all', [
|
||||
'conditions' => array('schulart' => $schulart), 'order' => 'wl_sort_nr ASC'
|
||||
]);
|
||||
//debug($wlBudgets);
|
||||
//debug($wlBudgets);die;
|
||||
//, 'order' => array('wl_sort_nr' => 'ASC')
|
||||
|
||||
$this->loadModel('Schools');
|
||||
$schools = $this->Schools->find('all');
|
||||
$schools = $this->Schools->find('all', [
|
||||
'conditions' => array('dst_schulart' => $schooltype)
|
||||
]);
|
||||
$data = array();
|
||||
foreach($schools as $school) {
|
||||
$line = array();
|
||||
@@ -168,9 +371,12 @@ class BudgetController extends AppController
|
||||
$data[$school['dst_schluessel']] = $line;
|
||||
}
|
||||
|
||||
$budgets = $this->Budget->find('all');
|
||||
$budgets = $this->Budget->find('all', [
|
||||
'contain' => ['WlSchooltypes'],
|
||||
'conditions' => array('WlSchooltypes.key_value' => $schooltype)
|
||||
]);
|
||||
foreach($budgets as $budget) {
|
||||
$i = $budget['wl_budget_id']+1;
|
||||
$i = $budget['wl_budget_id']+$offset;
|
||||
$data[$budget['snr']][$i] = $budget['count'];
|
||||
}
|
||||
$data_arr = array();
|
||||
@@ -180,6 +386,7 @@ class BudgetController extends AppController
|
||||
|
||||
$this->set('data',$data_arr);
|
||||
$this->set('wlBudgets',$wlBudgets);
|
||||
$this->set('schooltype',$schooltype);
|
||||
}
|
||||
|
||||
public function gettype($id = null) {
|
||||
@@ -256,7 +463,7 @@ class BudgetController extends AppController
|
||||
|
||||
$exports = $this->Budget->find('all', [
|
||||
'contain' => ['WlBudgets'],
|
||||
'fields' => ['Budget.snr','WlBudgets.wl_werteliste_id','WlBudgets.wl_kurz_bezeichnung','Budget.count','Budget.comment']
|
||||
'fields' => ['Budget.snr','WlBudgets.wl_werteliste_nr','WlBudgets.wl_kurz_bezeichnung','Budget.count','Budget.comment']
|
||||
]);
|
||||
$data = array();
|
||||
foreach($exports as $export) {
|
||||
@@ -277,15 +484,86 @@ class BudgetController extends AppController
|
||||
|
||||
}
|
||||
|
||||
public function writeBudgetById() {
|
||||
|
||||
$budget_id = $this->request->params['?']['id'];
|
||||
//$overwrite = $this->request->params['?']['overwrite'];
|
||||
|
||||
$curl = new AsdUp();
|
||||
|
||||
$ch = $curl->init_curl_params();
|
||||
$curl->login_school($ch); //Login Schulportal
|
||||
$curl->login_asd($ch); //Login ASD Applikation
|
||||
$budget_typ = $this->Budget->wlBudgets->get($budget_id);
|
||||
$curl->goto_budget($ch,$budget_typ['schulart']);
|
||||
$output = array();
|
||||
|
||||
$budgets = $this->Budget->find('all',[
|
||||
'conditions' => ['wl_budget_id' => $budget_id,'asd' => 0],
|
||||
'limit' => 100
|
||||
]);
|
||||
//foreach($budgets as $budget) {
|
||||
// debug($budget);
|
||||
//}
|
||||
//die;
|
||||
foreach ($budgets as $budget) {
|
||||
$curl->change_school($ch,$budget['snr']);
|
||||
$budget['wl_werteliste_nr'] = $budget_typ['wl_werteliste_nr'];
|
||||
|
||||
//$pos = strpos($curl->html,'class="hideOverflow200px" title="'. $budget_typ['wl_kurz_bezeichnung']. '"'); //ist das Budget schon eingetragen?
|
||||
/*if(!$overwrite) {
|
||||
//debug('Ja');die;
|
||||
$data = $curl->read_budget($ch,$budget['snr']);
|
||||
|
||||
|
||||
foreach($data as $key => $line) {
|
||||
|
||||
if(isset($line['budget'])) {
|
||||
if ($line['budget'] == $budget_typ['wl_kurz_bezeichnung']) {
|
||||
//debug($key);
|
||||
$curl->del_budget($ch,$budget['snr'],$key);
|
||||
$budget['count'] = $budget['count'] + $line['count'];
|
||||
if(strlen($budget['comment']) > 1) {
|
||||
$budget['comment'] = $line['comment'] . '; ' . $budget['comment'] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//debug($budget);
|
||||
$curl->write_budget($ch,$budget);
|
||||
$budget->asd = true;
|
||||
$this->Budget->save($budget);
|
||||
array_push($output,$budget);
|
||||
}
|
||||
else {
|
||||
//debug('Nein');die;
|
||||
//if(!$pos) {
|
||||
if(true) { */
|
||||
//debug($budget);
|
||||
//die;
|
||||
if($curl->write_budget($ch,$budget)) {
|
||||
$budget->asd = true;
|
||||
$this->Budget->save($budget);
|
||||
array_push($output,$budget);
|
||||
}
|
||||
//}
|
||||
|
||||
//die;
|
||||
}
|
||||
$this->set('output',$output);
|
||||
}
|
||||
|
||||
public function writeAsd()
|
||||
{
|
||||
$curl = new AsdUp();
|
||||
//debug($curl->status);
|
||||
$ch = $curl->init_curl_params();
|
||||
//$curl->login_school($ch); //Login Schulportal
|
||||
$curl->login_asd($ch);
|
||||
//debug($ch);
|
||||
$curl->login_school($ch); //Login Schulportal
|
||||
//debug($curl->html);
|
||||
|
||||
$curl->login_asd($ch);
|
||||
debug($curl->html);
|
||||
die;
|
||||
$budget['snr'] = '9310';
|
||||
$budget['budget_id'] = '1519';
|
||||
$budget['count'] = '5';
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\AppController;
|
||||
use AsdCurl\AsdUp;
|
||||
|
||||
|
||||
/**
|
||||
* Schools Controller
|
||||
@@ -12,6 +14,147 @@ use App\Controller\AppController;
|
||||
*/
|
||||
class SchoolsController extends AppController
|
||||
{
|
||||
public function showlist($snr = null) {
|
||||
$session = $this->request->session();
|
||||
$schooltype = $session->read('SchoolType');
|
||||
|
||||
$curl = new AsdUp();
|
||||
$ch = $curl->init_curl_params();
|
||||
$curl->login_school($ch); //Login Schulportal
|
||||
$curl->login_asd($ch);
|
||||
//$budget['snr'] = $snr;
|
||||
$curl->goto_budget($ch,$schooltype);
|
||||
//debug($snr);
|
||||
$curl->change_school($ch,$snr);
|
||||
$data = $curl->read_budget($ch,$snr);
|
||||
$this->set('data',$data);
|
||||
}
|
||||
|
||||
public function showajax($snr = null) {
|
||||
$session = $this->request->session();
|
||||
$schooltype = $session->read('SchoolType');
|
||||
|
||||
$this->autoRender = false;
|
||||
$myfile = fopen(WWW_ROOT . DS . 'files' . DS . 'debug-single.txt', "w");
|
||||
$data = $this->request->input('json_decode');
|
||||
$this->loadModel('Budget');
|
||||
$this->loadModel('wl_Budgets');
|
||||
//fwrite($myfile,$schooltype . PHP_EOL);
|
||||
fwrite($myfile,$snr . PHP_EOL);
|
||||
|
||||
foreach($data as $line) {
|
||||
fwrite($myfile,json_encode($line) . PHP_EOL);
|
||||
//fwrite($myfile,'Size: ' . strlen($line[0]) . PHP_EOL);
|
||||
if(strlen($line[0]) > 0) {
|
||||
//fwrite($myfile,'Budget: ' . $line[0] . PHP_EOL);
|
||||
$query = $this->wl_Budgets->find('all', [
|
||||
'conditions' => array('wl_kurz_bezeichnung' => $line[0])
|
||||
]);
|
||||
$wl_budget = $query->first();
|
||||
//fwrite($myfile,json_encode($wl_budget). PHP_EOL);
|
||||
$query = $this->Budget->find('all', [
|
||||
'conditions' => array('snr' => $snr, 'wl_budget_id' => $wl_budget['id'])
|
||||
]);
|
||||
//fwrite($myfile,$wl_budget['id'] . PHP_EOL);
|
||||
|
||||
if(!($query->isEmpty())) {
|
||||
$budget = $query->first();
|
||||
//fwrite($myfile,json_encode($budget). PHP_EOL);
|
||||
if($budget['wl_budget_id'] != $wl_budget['id'] ) {
|
||||
$budget['wl_budget_id'] = $wl_budget['id'];
|
||||
$this->Budget->save($budget);
|
||||
}
|
||||
elseif($budget['count'] != $line[1] ) {
|
||||
if($line[1] > 0) {
|
||||
$budget['count'] = $line[1];
|
||||
$this->Budget->save($budget);
|
||||
}
|
||||
else {
|
||||
$this->Budget->delete($budget);
|
||||
}
|
||||
}
|
||||
elseif($budget['comment'] != $line[2] ) {
|
||||
$budget['comment'] = $line[2];
|
||||
$this->Budget->save($budget);
|
||||
}
|
||||
//fwrite($myfile,'full' . PHP_EOL);
|
||||
}
|
||||
else {
|
||||
//fwrite($myfile,'empty' . PHP_EOL);
|
||||
$new = $this->Budget->newEntity();
|
||||
$new_budget['wl_schooltype_id'] = $schooltype;
|
||||
$new_budget['snr'] = $snr;
|
||||
$new_budget['wl_budget_id'] = $wl_budget['id'];
|
||||
$new_budget['count'] = $line[1];
|
||||
$new_budget['comment'] = $line[2];
|
||||
$new_budget['year'] = '2018';
|
||||
//fwrite($myfile,'New: ' . json_encode($new_budget). PHP_EOL);
|
||||
$new = $this->Budget->patchEntity($new, $new_budget);
|
||||
|
||||
$this->Budget->save($new);
|
||||
}
|
||||
//fwrite($myfile,serialize($budget). PHP_EOL);
|
||||
//fwrite($myfile,$line[0] . ' ' .($i+$wl_offset) . ' ' . $line[$i]. PHP_EOL);
|
||||
}
|
||||
}
|
||||
fclose($myfile);
|
||||
}
|
||||
|
||||
|
||||
public function showbudgets($snr = null) {
|
||||
$session = $this->request->session();
|
||||
//debug($session->read('SchoolType'));die;
|
||||
$schooltype = $session->read('SchoolType');
|
||||
if ($schooltype == '02') {
|
||||
$schulart = 'RS';
|
||||
}
|
||||
else {
|
||||
$schulart = 'GY';
|
||||
}
|
||||
|
||||
$query = $this->Schools->find('all', [
|
||||
'conditions' => array('dst_schluessel' => $snr)
|
||||
]);
|
||||
$school = $query->first();
|
||||
$this->loadModel('Budget');
|
||||
$budgets = $this->Budget->find('all', [
|
||||
'conditions' => ['snr' => $snr]
|
||||
]);
|
||||
$this->loadModel('wl_Budgets');
|
||||
$data = array();
|
||||
foreach($budgets as $budget) {
|
||||
$line = array();
|
||||
//debug($budget);
|
||||
$wl_budget = $this->wl_Budgets->get($budget['wl_budget_id']);
|
||||
//debug($wl_budget);
|
||||
array_push($line,$wl_budget['wl_kurz_bezeichnung']);
|
||||
array_push($line,$budget['count']);
|
||||
array_push($line,$budget['comment']);
|
||||
array_push($data,$line);
|
||||
}
|
||||
for($i=0;$i<5;$i++) {
|
||||
$line = array();
|
||||
array_push($line,'');
|
||||
array_push($line,'');
|
||||
array_push($line,'');
|
||||
array_push($data,$line);
|
||||
}
|
||||
$query = $this->wl_Budgets->find('list', [
|
||||
'conditions' => array('schulart' => $schulart),
|
||||
'valueField' => 'wl_kurz_bezeichnung'
|
||||
]);
|
||||
$wl_budgets = $query->toArray();
|
||||
$budgets_arr = array();
|
||||
foreach ($wl_budgets as $wl_budget) {
|
||||
array_push($budgets_arr,$wl_budget);
|
||||
}
|
||||
//debug(json_encode($budgets_arr));die;
|
||||
$this->set('budgets_arr',$budgets_arr);
|
||||
$this->set('school',$school);
|
||||
$this->set('data',$data);
|
||||
|
||||
}
|
||||
|
||||
public function show() {
|
||||
$results = $this->Schools->find('all');
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use Cake\ORM\Entity;
|
||||
* @property int $count
|
||||
* @property string $comment
|
||||
* @property string $year
|
||||
* @property bool $asd
|
||||
* @property \Cake\I18n\FrozenTime $created
|
||||
* @property \Cake\I18n\FrozenTime $modified
|
||||
*
|
||||
@@ -38,6 +39,7 @@ class Budget extends Entity
|
||||
'count' => true,
|
||||
'comment' => true,
|
||||
'year' => true,
|
||||
'asd' => true,
|
||||
'created' => true,
|
||||
'modified' => true,
|
||||
'wl_schooltype' => true,
|
||||
|
||||
@@ -77,14 +77,18 @@ class BudgetTable extends Table
|
||||
$validator
|
||||
->scalar('comment')
|
||||
->maxLength('comment', 255)
|
||||
->requirePresence('comment', 'create')
|
||||
->notEmpty('comment');
|
||||
->allowEmpty('comment');
|
||||
|
||||
$validator
|
||||
->scalar('year')
|
||||
->requirePresence('year', 'create')
|
||||
->notEmpty('year');
|
||||
|
||||
$validator
|
||||
->boolean('asd')
|
||||
->requirePresence('asd', 'create')
|
||||
->notEmpty('asd');
|
||||
|
||||
return $validator;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,10 @@ class WlBudgetsTable extends Table
|
||||
->integer('id')
|
||||
->allowEmpty('id', 'create');
|
||||
|
||||
$validator
|
||||
->integer('wl_sort_nr')
|
||||
->allowEmpty('wl_sort_nr');
|
||||
|
||||
$validator
|
||||
->scalar('wl_werteliste_nr')
|
||||
->maxLength('wl_werteliste_nr', 10)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
echo $this->Form->control('count');
|
||||
echo $this->Form->control('comment');
|
||||
echo $this->Form->control('year');
|
||||
echo $this->Form->control('asd');
|
||||
?>
|
||||
</fieldset>
|
||||
<?= $this->Form->button(__('Submit')) ?>
|
||||
|
||||
0
src/Template/Budget/change_school.ctp
Normal file
0
src/Template/Budget/change_school.ctp
Normal file
@@ -31,6 +31,7 @@
|
||||
echo $this->Form->control('count');
|
||||
echo $this->Form->control('comment');
|
||||
echo $this->Form->control('year');
|
||||
echo $this->Form->control('asd');
|
||||
?>
|
||||
</fieldset>
|
||||
<?= $this->Form->button(__('Submit')) ?>
|
||||
|
||||
@@ -1,21 +1,30 @@
|
||||
<?php
|
||||
//debug($budget);
|
||||
//debug($data);
|
||||
for($i=0;$i<sizeof($data);$i++) {
|
||||
$data[$i][1] = $this->Html->link($data[$i][1],array('controller' => 'schools', 'action' => 'showbudgets',$data[$i][0]));
|
||||
//debug($data[$i]);
|
||||
}
|
||||
echo '<h2>' . $budget['wl_kurz_bezeichnung'] .'</h2>';
|
||||
$budget_id = $this->request->params['pass'][0];
|
||||
echo $this->Html->link('Upload to ASD',array('controller' => 'budget', 'action' => 'writeBudgetById' . '/?id=' . $budget_id));
|
||||
//debug($data);
|
||||
?>
|
||||
|
||||
<div class="controls">
|
||||
<button name="load" id="load" class="intext-btn">Load</button>
|
||||
<button name="save" id="save" class="intext-btn">Save</button>
|
||||
<label><input name="autosave" id="autosave" checked="checked" autocomplete="off" type="checkbox">Autosave</label>
|
||||
</div>
|
||||
<pre id="example1console" class="console">Data loaded</pre>
|
||||
</div>
|
||||
<div class="upload-frm">
|
||||
<?php echo $this->Form->create($uploadData, ['type' => 'file']); ?>
|
||||
<?php echo $this->Form->input('file', ['type' => 'file', 'class' => 'form-control']); ?>
|
||||
<?php echo $this->Form->button(__('Upload File'), ['type'=>'submit', 'class' => 'form-controlbtn btn-default']); ?>
|
||||
<?php echo $this->Form->end(); ?>
|
||||
</div>
|
||||
<div id="editbudget"></div>
|
||||
<script>
|
||||
var data = <?php echo json_encode($data); ?>;
|
||||
|
||||
var container = document.getElementById('editbudget');
|
||||
var exampleConsole = document.getElementById('example1console');
|
||||
var autosave = document.getElementById('autosave');
|
||||
var load = document.getElementById('load');
|
||||
var save = document.getElementById('save');
|
||||
var autosaveNotification;
|
||||
@@ -24,11 +33,12 @@ var data = <?php echo json_encode($data); ?>;
|
||||
var hot = new Handsontable(container, {
|
||||
data: data,
|
||||
width: 1400,
|
||||
height: 1000,
|
||||
height: 800,
|
||||
rowHeaders: true,
|
||||
wordWrap: false,
|
||||
colHeaders: ['SNR','Name','Count','Comment'] ,
|
||||
colWidths: ['50','500','50','500'],
|
||||
colHeaders: ['SNR','Name','Count','Comment','ASD'] ,
|
||||
colWidths: ['50','500','50','500','50'],
|
||||
columns: [{renderer: "text", readOnly: true},{renderer: "html", readOnly: true},{renderer: "text"},{renderer: "text"},{renderer: "text", readOnly: true}],
|
||||
filters: true,
|
||||
dropdownMenu: true
|
||||
});
|
||||
@@ -39,15 +49,20 @@ var data = <?php echo json_encode($data); ?>;
|
||||
//console.log(JSON.stringify({data: hot.getData()}));
|
||||
$.ajax({
|
||||
//url: "editajax?id=<?php echo $budget['id']; ?>",
|
||||
url: "<?php echo $this->Url->build(array('controller' => 'budget', 'action' => 'editajax',$budget['id']), true); ?>",
|
||||
url: "<?php echo $this->Url->build(array('controller' => 'budget', 'action' => 'editajax'), true) . '?budget=' . $budget['id'] . '&schooltype=' . $schooltype ?>",
|
||||
data: JSON.stringify(hot.getData()),
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
//console.log(res);
|
||||
//var data = JSON.parse(res);
|
||||
|
||||
location.reload(true);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#load').click(function() {
|
||||
location.reload(true);
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -26,6 +26,7 @@
|
||||
<th scope="col"><?= $this->Paginator->sort('count') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('comment') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('year') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('asd') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('created') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('modified') ?></th>
|
||||
<th scope="col" class="actions"><?= __('Actions') ?></th>
|
||||
@@ -41,6 +42,7 @@
|
||||
<td><?= $this->Number->format($budget->count) ?></td>
|
||||
<td><?= h($budget->comment) ?></td>
|
||||
<td><?= h($budget->year) ?></td>
|
||||
<td><?= h($budget->asd) ?></td>
|
||||
<td><?= h($budget->created) ?></td>
|
||||
<td><?= h($budget->modified) ?></td>
|
||||
<td class="actions">
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<?php
|
||||
echo '<h1>Wählen Sie eine Budgetart aus.</h1>';
|
||||
echo '<ul>';
|
||||
foreach ($wlBudgets as $wlBudget) {
|
||||
//debug($wlBudget);
|
||||
echo '<p>' . $this->Html->link($wlBudget['wl_kurz_bezeichnung'],['controller' => 'Budget', 'action' => 'edit_budget' , $wlBudget['id']]) . '</p>';
|
||||
echo '<li>' . $this->Html->link($wlBudget['wl_kurz_bezeichnung'],['controller' => 'Budget', 'action' => 'edit_budget' , $wlBudget['id']]) . '</li>';
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
?>
|
||||
@@ -1,29 +1,39 @@
|
||||
<?php
|
||||
//debug($schooltype);
|
||||
//$test = '["<a href=\"test\">SNR<\/a>","Schule","RS Modellversuch","RS geb. Ganztagsklassen","RS St\u00fctzpunktschule Schulsport","RS Partnerschule Wintersport","RS Sonderp\u00e4d. F\u00f6rderbedarf","Abordnung Grundschullehrkraft","Bilingualer Unterricht","Inklusion","sonstige Budgetzuschl\u00e4ge","RS Koop. mit and. Schulart","RS Integrierte Lehrerres.","RS Bestenf\u00f6rderung","MINT","Musikrealschule"]';
|
||||
$cols = array();
|
||||
$columns = array();
|
||||
array_push($cols,'SNR');
|
||||
array_push($columns,['renderer' => 'text', 'readOnly' => true]);
|
||||
|
||||
array_push($cols,'Schule');
|
||||
array_push($columns,['renderer' => 'html', 'readOnly' => true]);
|
||||
|
||||
$col_width = array();
|
||||
array_push($col_width,'50');
|
||||
array_push($col_width,'300');
|
||||
foreach($wlBudgets as $budget) {
|
||||
array_push($cols,$budget);
|
||||
//debug($budget);die;
|
||||
array_push($cols,$this->Html->link($budget['wl_kurz_bezeichnung'],array('controller' => 'budget', 'action' => 'edit-budget',$budget['id'])));
|
||||
array_push($col_width,'30');
|
||||
array_push($columns,['renderer' => 'text']);
|
||||
}
|
||||
for($i=0;$i<sizeof($data);$i++) {
|
||||
$data[$i][1] = $this->Html->link($data[$i][1],array('controller' => 'schools', 'action' => 'showbudgets',$data[$i][0]));
|
||||
}
|
||||
//debug($columns);
|
||||
//debug(json_encode($columns));die;
|
||||
//debug(json_encode($cols));
|
||||
?>
|
||||
<div class="controls">
|
||||
<button name="load" id="load" class="intext-btn">Load</button>
|
||||
<button name="save" id="save" class="intext-btn">Save</button>
|
||||
<label><input name="autosave" id="autosave" checked="checked" autocomplete="off" type="checkbox">Autosave</label>
|
||||
</div>
|
||||
<pre id="example1console" class="console">Data loaded</pre>
|
||||
<div id="example"></div>
|
||||
<div id="overview"></div>
|
||||
<script>
|
||||
var data = <?php echo json_encode($data); ?>;
|
||||
|
||||
var container = document.getElementById('example');
|
||||
var exampleConsole = document.getElementById('example1console');
|
||||
var autosave = document.getElementById('autosave');
|
||||
var container = document.getElementById('overview');
|
||||
var load = document.getElementById('load');
|
||||
var save = document.getElementById('save');
|
||||
var autosaveNotification;
|
||||
@@ -31,10 +41,11 @@ var data = <?php echo json_encode($data); ?>;
|
||||
|
||||
var hot = new Handsontable(container, {
|
||||
data: data,
|
||||
width: 1400,
|
||||
width: 1420,
|
||||
height: 1000,
|
||||
rowHeaders: true,
|
||||
wordWrap: false,
|
||||
columns: <?php echo json_encode($columns) ?> ,
|
||||
colHeaders: <?php echo json_encode($cols) ?> ,
|
||||
colWidths: <?php echo json_encode($col_width) ?>,
|
||||
filters: true,
|
||||
@@ -51,7 +62,8 @@ var data = <?php echo json_encode($data); ?>;
|
||||
//console.log(hot.getData());
|
||||
//console.log(JSON.stringify({data: hot.getData()}));
|
||||
$.ajax({
|
||||
url: "sajax",
|
||||
//url: "sajax",
|
||||
url: "<?php echo $this->Url->build(array('controller' => 'budget', 'action' => 'sajax',$schooltype), true); ?>",
|
||||
data: JSON.stringify(hot.getData()),
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
@@ -62,4 +74,9 @@ var data = <?php echo json_encode($data); ?>;
|
||||
});
|
||||
});
|
||||
|
||||
$('#load').click(function() {
|
||||
location.reload(true);
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
@@ -56,5 +56,9 @@
|
||||
<th scope="row"><?= __('Modified') ?></th>
|
||||
<td><?= h($budget->modified) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?= __('Asd') ?></th>
|
||||
<td><?= $budget->asd ? __('Yes') : __('No'); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
8
src/Template/Budget/write_budget_by_id.ctp
Normal file
8
src/Template/Budget/write_budget_by_id.ctp
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
echo '<table>';
|
||||
foreach($output as $line) {
|
||||
echo '<tr><td>' . $line['snr'] . '</td><td>' . $line['count'] . '</td></tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
|
||||
?>
|
||||
@@ -13,13 +13,14 @@
|
||||
* @license https://opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
$cakeDescription = 'CakePHP: the rapid development php framework';
|
||||
$cakeDescription = 'KM Bayern';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<?= $this->Html->charset() ?>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>
|
||||
<?= $cakeDescription ?>:
|
||||
<?= $this->fetch('title') ?>
|
||||
|
||||
86
src/Template/Schools/showbudgets.ctp
Normal file
86
src/Template/Schools/showbudgets.ctp
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
echo '<h1>'. $school->dst_schluessel . ' ' . $school->dst_name .'</h1>';
|
||||
?>
|
||||
|
||||
<div class="controls">
|
||||
<button name="load" id="load" class="intext-btn">Load</button>
|
||||
<button name="save" id="save" class="intext-btn">Save</button>
|
||||
<button name="list" id="list" class="intext-btn">List</button>
|
||||
</div>
|
||||
<div id="showbudget"></div>
|
||||
<div id="table"></div>
|
||||
<script>
|
||||
var data = <?php echo json_encode($data); ?>;
|
||||
|
||||
var container = document.getElementById('showbudget');
|
||||
var load = document.getElementById('load');
|
||||
var save = document.getElementById('save');
|
||||
var list = document.getElementById('list');
|
||||
var autosaveNotification;
|
||||
var rotated = false;
|
||||
|
||||
var hot = new Handsontable(container, {
|
||||
data: data,
|
||||
width: 1400,
|
||||
height: 800,
|
||||
rowHeaders: true,
|
||||
wordWrap: false,
|
||||
colHeaders: ['Name','Count','Comment'] ,
|
||||
colWidths: ['500','50','500'],
|
||||
columns: [{type: 'dropdown', source: <?php echo json_encode($budgets_arr); ?>},{renderer: "text"},{renderer: "text"}],
|
||||
filters: true,
|
||||
dropdownMenu: true
|
||||
});
|
||||
|
||||
Handsontable.dom.addEvent(save, 'click', function() {
|
||||
// save all cell's data
|
||||
//console.log(hot.getData());
|
||||
//console.log(JSON.stringify({data: hot.getData()}));
|
||||
$.ajax({
|
||||
url: "<?php echo $this->Url->build(array('controller' => 'schools', 'action' => 'showajax',$school->dst_schluessel), true); ?>",
|
||||
data: JSON.stringify(hot.getData()),
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
//console.log(res.response);
|
||||
//var data = JSON.parse(res.resonse);
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Handsontable.dom.addEvent(list, 'click', function() {
|
||||
// save all cell's data
|
||||
//console.log(hot.getData());
|
||||
//console.log(JSON.stringify({data: hot.getData()}));
|
||||
//console.log('hallo');
|
||||
|
||||
$.ajax({
|
||||
url: "<?php echo $this->Url->build(array('controller' => 'schools', 'action' => 'showlist',$school->dst_schluessel), true); ?>",
|
||||
//data: JSON.stringify(hot.getData()),
|
||||
type: 'GET',
|
||||
success: function (res) {
|
||||
//console.log(res);
|
||||
var list = JSON.parse(res);
|
||||
//console.log(list);
|
||||
$('#table').empty();
|
||||
var content = "<table>";
|
||||
content += '<tr><th>' + 'Herkunft' + '</th><th>' + 'Budget' + '</th><th>' + 'Count' + '</th><th>' + 'Comment' + '</th></tr>';
|
||||
$.each(list, function(i, item) {
|
||||
//console.log(i);
|
||||
//console.log(item);
|
||||
if(item.budget != undefined) {
|
||||
content += '<tr><td>' + item.herkunft + '</td><td>' + item.budget + '</td><td>' + item.count + '</td><td>' + item.comment + '</td></tr>';
|
||||
}
|
||||
});
|
||||
content += "</table>";
|
||||
//console.log(content);
|
||||
$('#table').append(content);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#load').click(function() {
|
||||
location.reload(true);
|
||||
});
|
||||
|
||||
</script>
|
||||
4
src/Template/Schools/showlist.ctp
Normal file
4
src/Template/Schools/showlist.ctp
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
//$test['Template'] ='test';
|
||||
echo json_encode($data);
|
||||
?>
|
||||
@@ -23,6 +23,7 @@
|
||||
<fieldset>
|
||||
<legend><?= __('Edit Wl Budget') ?></legend>
|
||||
<?php
|
||||
echo $this->Form->control('wl_sort_nr');
|
||||
echo $this->Form->control('wl_werteliste_nr');
|
||||
echo $this->Form->control('wl_kurz_bezeichnung');
|
||||
echo $this->Form->control('schulart');
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('wl_sort_nr') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('wl_werteliste_nr') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('wl_kurz_bezeichnung') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('schulart') ?></th>
|
||||
@@ -30,7 +31,8 @@
|
||||
<?php foreach ($wlBudgets as $wlBudget): ?>
|
||||
<tr>
|
||||
<td><?= $this->Number->format($wlBudget->id) ?></td>
|
||||
<td><?= h($wlBudget->wl_werteliste_nr) ?></td>
|
||||
<td><?= h($wlBudget->wl_sort_nr) ?></td>
|
||||
<td><?= h($wlBudget->wl_schluessel) ?></td>
|
||||
<td><?= h($wlBudget->wl_kurz_bezeichnung) ?></td>
|
||||
<td><?= h($wlBudget->schulart) ?></td>
|
||||
<td><?= h($wlBudget->created) ?></td>
|
||||
|
||||
@@ -19,7 +19,11 @@
|
||||
<h3><?= h($wlBudget->wl_kurz_bezeichnung) ?></h3>
|
||||
<table class="vertical-table">
|
||||
<tr>
|
||||
<th scope="row"><?= __('Wl Werteliste Nr') ?></th>
|
||||
<th scope="row"><?= __('Wl Sort Nr') ?></th>
|
||||
<td><?= h($wlBudget->wl_sort_nr) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?= __('Wl Wertelsite Nr') ?></th>
|
||||
<td><?= h($wlBudget->wl_werteliste_nr) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -29,8 +29,9 @@ class BudgetFixture extends TestFixture
|
||||
'snr' => ['type' => 'string', 'length' => 4, 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '', 'precision' => null, 'fixed' => null],
|
||||
'wl_budget_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],
|
||||
'count' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],
|
||||
'comment' => ['type' => 'string', 'length' => 255, 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '', 'precision' => null, 'fixed' => null],
|
||||
'comment' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '', 'precision' => null, 'fixed' => null],
|
||||
'year' => ['type' => 'string', 'length' => null, 'null' => false, 'default' => null, 'collate' => null, 'comment' => '', 'precision' => null, 'fixed' => null],
|
||||
'asd' => ['type' => 'boolean', 'length' => null, 'null' => false, 'default' => null, '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' => [
|
||||
@@ -57,8 +58,9 @@ class BudgetFixture extends TestFixture
|
||||
'count' => 1,
|
||||
'comment' => 'Lorem ipsum dolor sit amet',
|
||||
'year' => 'Lorem ipsum dolor sit amet',
|
||||
'created' => '2018-03-14 07:15:25',
|
||||
'modified' => '2018-03-14 07:15:25'
|
||||
'asd' => 1,
|
||||
'created' => '2018-05-09 05:27:14',
|
||||
'modified' => '2018-05-09 05:27:14'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -26,8 +26,7 @@ class BudgetTableTest extends TestCase
|
||||
public $fixtures = [
|
||||
'app.budget',
|
||||
'app.wl_schooltypes',
|
||||
'app.wl_budgets',
|
||||
'app.wl_wertelistes'
|
||||
'app.wl_budgets'
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
1
webroot/asd_curl
Symbolic link
1
webroot/asd_curl
Symbolic link
@@ -0,0 +1 @@
|
||||
/var/www/html/budget/plugins/AsdCurl/webroot
|
||||
@@ -1,3 +1,3 @@
|
||||
h1 {
|
||||
nav.top-bar.expanded h1 {
|
||||
color: aliceblue;
|
||||
}
|
||||
@@ -17,4 +17,10 @@ div#editbudget.handsontable.htRowHeaders.htColumnHeaders thead th {
|
||||
line-height: 10px;
|
||||
padding: 0px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div#showbudget.handsontable.htRowHeaders.htColumnHeaders thead th {
|
||||
line-height: 10px;
|
||||
padding: 0px;
|
||||
font-weight: bold;
|
||||
}
|
||||
1
webroot/debug_kit
Symbolic link
1
webroot/debug_kit
Symbolic link
@@ -0,0 +1 @@
|
||||
/var/www/html/budget/vendor/cakephp/debug_kit/webroot
|
||||
Binary file not shown.
8
webroot/files/debug-single.txt
Normal file
8
webroot/files/debug-single.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
0181
|
||||
["Begabt.f\u00f6rd.\/Innov. Proj. (MB)",1,""]
|
||||
["Inklusion",3,""]
|
||||
["","",""]
|
||||
["","",""]
|
||||
["","",""]
|
||||
["","",""]
|
||||
["","",""]
|
||||
Binary file not shown.
283
webroot/uploads/import-shah.csv
Normal file
283
webroot/uploads/import-shah.csv
Normal file
@@ -0,0 +1,283 @@
|
||||
snr;count;comment
|
||||
0071;4;
|
||||
0234;3;
|
||||
0092;5;
|
||||
0385;3;
|
||||
0384;4;
|
||||
0236;3;
|
||||
0231;2;
|
||||
0233;2;
|
||||
0072;1;
|
||||
0073;8;
|
||||
0071;2;
|
||||
0074;1;
|
||||
0359;1;
|
||||
0087;2;
|
||||
0113;2;
|
||||
0276;2;
|
||||
0282;2;
|
||||
0283;2;
|
||||
0965;2;
|
||||
0324;2;
|
||||
0010;2;
|
||||
0011;2;
|
||||
0012;2;
|
||||
0080;2;
|
||||
0999;1;
|
||||
0030;2;
|
||||
0109;2;
|
||||
0966;1;
|
||||
0232;2;
|
||||
0279;2;
|
||||
0359;2;
|
||||
0356;1;
|
||||
0059;1;
|
||||
0357;1;
|
||||
0062;1;
|
||||
0066;2;
|
||||
0122;1;
|
||||
0088;1;
|
||||
0105;1;
|
||||
0131;2;
|
||||
0144;1;
|
||||
0146;2;
|
||||
0147;1;
|
||||
0158;2;
|
||||
0392;1;
|
||||
0252;2;
|
||||
0251;2;
|
||||
0257;3;
|
||||
0259;1;
|
||||
0292;1;
|
||||
0299;2;
|
||||
0297;1;
|
||||
0298;1;
|
||||
0312;1;
|
||||
0316;1;
|
||||
0379;2;
|
||||
0317;2;
|
||||
0318;2;
|
||||
0341;1;
|
||||
0058;1;
|
||||
0029;1;
|
||||
0097;1;
|
||||
0125;2;
|
||||
0174;1;
|
||||
0177;1;
|
||||
0189;1;
|
||||
0145;1;
|
||||
0295;1;
|
||||
0029;8;
|
||||
0068;1;
|
||||
0100;8;
|
||||
0102;2;
|
||||
0104;1;
|
||||
0125;6;
|
||||
0145;8;
|
||||
0177;2;
|
||||
0179;2;
|
||||
0189;2;
|
||||
0261;1;
|
||||
0280;1;
|
||||
0295;1;
|
||||
0309;4;
|
||||
0323;2;
|
||||
0389;2;
|
||||
0955;2;
|
||||
0967;2;
|
||||
0968;1;
|
||||
0058;2;
|
||||
0067;2;
|
||||
0089;2;
|
||||
0097;2;
|
||||
0123;1;
|
||||
0124;2;
|
||||
0170;2;
|
||||
0174;1;
|
||||
0175;2;
|
||||
0188;2;
|
||||
0256;2;
|
||||
0304;1;
|
||||
0354;1;
|
||||
0369;1;
|
||||
0371;1;
|
||||
0951;1;
|
||||
0973;1;
|
||||
0981;2;
|
||||
0959;1;
|
||||
0031;1;
|
||||
0032;2;
|
||||
0033;1;
|
||||
0034;2;
|
||||
0035;1;
|
||||
0039;1;
|
||||
0040;1;
|
||||
0041;2;
|
||||
0042;2;
|
||||
0046;1;
|
||||
0054;2;
|
||||
0055;1;
|
||||
0056;1;
|
||||
0057;2;
|
||||
0082;1;
|
||||
0115;2;
|
||||
0116;2;
|
||||
0117;1;
|
||||
0140;2;
|
||||
0142;2;
|
||||
0143;1;
|
||||
0153;1;
|
||||
0161;1;
|
||||
0173;1;
|
||||
0219;2;
|
||||
0226;3;
|
||||
0255;1;
|
||||
0291;2;
|
||||
0340;1;
|
||||
0358;1;
|
||||
0953;1;
|
||||
0970;1;
|
||||
1012;1;
|
||||
0004;1;
|
||||
0050;1;
|
||||
0053;4;
|
||||
0052;1;
|
||||
0077;1;
|
||||
0139;1;
|
||||
0218;1;
|
||||
0375;1;
|
||||
0223;1;
|
||||
0381;1;
|
||||
0399;1;
|
||||
0229;1;
|
||||
0247;1;
|
||||
0263;9;
|
||||
0265;1;
|
||||
0266;1;
|
||||
0284;2;
|
||||
0301;1;
|
||||
0303;1;
|
||||
0320;1;
|
||||
0322;5;
|
||||
0322;1;
|
||||
0321;2;
|
||||
0047;1;
|
||||
0017;1;
|
||||
0019;2;
|
||||
0020;5;
|
||||
0060;4;
|
||||
0069;1;
|
||||
0094;1;
|
||||
0107;1;
|
||||
0129;2;
|
||||
0133;2;
|
||||
0137;3;
|
||||
0151;1;
|
||||
0154;3;
|
||||
0155;1;
|
||||
0160;6;
|
||||
0164;9;
|
||||
0165;1;
|
||||
0227;1;
|
||||
0258;2;
|
||||
0285;4;
|
||||
0294;1;
|
||||
0325;3;
|
||||
0343;2;
|
||||
0360;2;
|
||||
0364;1;
|
||||
0370;1;
|
||||
0950;2;
|
||||
0958;1;
|
||||
0383;1;
|
||||
0394;1;
|
||||
0336;3;
|
||||
0332;1;
|
||||
0335;1;
|
||||
0334;1;
|
||||
0333;1;
|
||||
0969;1;
|
||||
0136;2;
|
||||
0159;1;
|
||||
0288;1;
|
||||
0026;1;
|
||||
0287;3;
|
||||
0111;2;
|
||||
0289;2;
|
||||
0163;1;
|
||||
0065;1;
|
||||
0215;1;
|
||||
0003;2;
|
||||
0009;2;
|
||||
0015;2;
|
||||
0014;3;
|
||||
0013;2;
|
||||
0342;3;
|
||||
0076;2;
|
||||
0393;2;
|
||||
0168;1;
|
||||
0101;2;
|
||||
0157;2;
|
||||
0361;2;
|
||||
0372;2;
|
||||
0028;3;
|
||||
0044;1;
|
||||
0048;1;
|
||||
0049;3;
|
||||
0070;2;
|
||||
0084;3;
|
||||
0085;3;
|
||||
0086;3;
|
||||
0099;1;
|
||||
0106;1;
|
||||
0150;1;
|
||||
0152;6;
|
||||
0162;1;
|
||||
0167;1;
|
||||
0172;1;
|
||||
0176;1;
|
||||
0178;1;
|
||||
0180;1;
|
||||
0181;1;
|
||||
0182;2;
|
||||
0184;1;
|
||||
0186;1;
|
||||
0187;1;
|
||||
0190;1;
|
||||
0191;1;
|
||||
0200;1;
|
||||
0205;1;
|
||||
0213;2;
|
||||
0209;1;
|
||||
0244;1;
|
||||
0250;1;
|
||||
0260;1;
|
||||
0273;1;
|
||||
0274;1;
|
||||
0275;1;
|
||||
0286;3;
|
||||
0302;1;
|
||||
0305;2;
|
||||
0306;1;
|
||||
0307;1;
|
||||
0308;2;
|
||||
0319;1;
|
||||
0355;2;
|
||||
0362;1;
|
||||
0363;1;
|
||||
0365;2;
|
||||
0367;7;
|
||||
0378;2;
|
||||
0380;1;
|
||||
0388;1;
|
||||
0390;1;
|
||||
0397;1;
|
||||
0398;1;
|
||||
0952;2;
|
||||
0954;5;
|
||||
0971;2;
|
||||
0972;2;
|
||||
0989;1;
|
||||
0983;1;
|
||||
0986;3;
|
||||
0366;1;
|
||||
|
Reference in New Issue
Block a user