Stability Schooltype
This commit is contained in:
@@ -16,6 +16,10 @@ namespace App\Controller;
|
|||||||
|
|
||||||
use Cake\Controller\Controller;
|
use Cake\Controller\Controller;
|
||||||
use Cake\Event\Event;
|
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
|
* Application Controller
|
||||||
@@ -43,12 +47,44 @@ class AppController extends Controller
|
|||||||
|
|
||||||
$this->loadComponent('RequestHandler');
|
$this->loadComponent('RequestHandler');
|
||||||
$this->loadComponent('Flash');
|
$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();
|
$session = $this->request->session();
|
||||||
|
|
||||||
if(!($session->check('SchoolType'))) {
|
if(!($session->check('SchoolType'))) {
|
||||||
$session->write('SchoolType','02');
|
$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.
|
* Enable the following components for recommended CakePHP security settings.
|
||||||
|
|||||||
@@ -22,6 +22,21 @@ class BudgetController extends AppController
|
|||||||
else {
|
else {
|
||||||
$session->write('SchoolType','02');
|
$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());
|
$this->redirect($this->referer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,14 +92,26 @@ class BudgetController extends AppController
|
|||||||
$budget = $this->Budget->wlBudgets->get($id);
|
$budget = $this->Budget->wlBudgets->get($id);
|
||||||
$this->set('budget',$budget);
|
$this->set('budget',$budget);
|
||||||
$this->set('data',$data_arr);
|
$this->set('data',$data_arr);
|
||||||
|
$this->set('schooltype',$schooltype);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editajax($id = null) {
|
public function editajax() {
|
||||||
$this->autoRender = false;
|
$this->autoRender = false;
|
||||||
$myfile = fopen(WWW_ROOT . DS . 'files' . DS . 'debug-edit.txt', "w");
|
$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');
|
$data = $this->request->input('json_decode');
|
||||||
//fwrite($myfile,json_encode($data) . PHP_EOL);
|
$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) {
|
foreach($data as $line) {
|
||||||
|
|
||||||
@@ -118,7 +145,7 @@ class BudgetController extends AppController
|
|||||||
else {
|
else {
|
||||||
fwrite($myfile,'empty' . PHP_EOL);
|
fwrite($myfile,'empty' . PHP_EOL);
|
||||||
$new = $this->Budget->newEntity();
|
$new = $this->Budget->newEntity();
|
||||||
$new_budget['wl_schooltype_id'] = 4;
|
$new_budget['wl_schooltype_id'] = $schooltype_nr;
|
||||||
$new_budget['snr'] = $line[0];
|
$new_budget['snr'] = $line[0];
|
||||||
$new_budget['wl_budget_id'] = $id;
|
$new_budget['wl_budget_id'] = $id;
|
||||||
$new_budget['count'] = $line[2];
|
$new_budget['count'] = $line[2];
|
||||||
@@ -134,11 +161,11 @@ class BudgetController extends AppController
|
|||||||
fclose($myfile);
|
fclose($myfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sajax() {
|
public function sajax($schooltype = null) {
|
||||||
|
|
||||||
$session = $this->request->session();
|
//$session = $this->request->session();
|
||||||
//debug($session->read('SchoolType'));die;
|
//debug($session->read('SchoolType'));die;
|
||||||
$schooltype = $session->read('SchoolType');
|
//$schooltype = $session->read('SchoolType');
|
||||||
if ($schooltype == '02') {
|
if ($schooltype == '02') {
|
||||||
$wl_offset = 31;
|
$wl_offset = 31;
|
||||||
$schooltype_id = '2';
|
$schooltype_id = '2';
|
||||||
@@ -162,7 +189,7 @@ class BudgetController extends AppController
|
|||||||
$key = $entry['snr'] . '_' . $entry['wl_budget_id'];
|
$key = $entry['snr'] . '_' . $entry['wl_budget_id'];
|
||||||
fwrite($myfile,json_encode($key) . PHP_EOL);
|
fwrite($myfile,json_encode($key) . PHP_EOL);
|
||||||
$search_arr[$key]['count'] = $entry['count'];
|
$search_arr[$key]['count'] = $entry['count'];
|
||||||
$search_arr[$key]['comment'] = $entry['comment'];
|
//$search_arr[$key]['comment'] = $entry['comment'];
|
||||||
fwrite($myfile,json_encode($search_arr[$key]) . PHP_EOL);
|
fwrite($myfile,json_encode($search_arr[$key]) . PHP_EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,9 +257,24 @@ class BudgetController extends AppController
|
|||||||
|
|
||||||
public function overview() {
|
public function overview() {
|
||||||
|
|
||||||
|
//debug($this->Cookie->read('schooltype'));
|
||||||
|
//debug($this->request);
|
||||||
|
//$cookie = $this->response->getCookie('schooltype');
|
||||||
|
//debug($cookie['value']);
|
||||||
|
//$schooltype = $cookie['value'];
|
||||||
|
//die;
|
||||||
|
|
||||||
$session = $this->request->session();
|
$session = $this->request->session();
|
||||||
//debug($session->read('SchoolType'));die;
|
//debug($session->read('SchoolType'));die;
|
||||||
$schooltype = $session->read('SchoolType');
|
$schooltype = $session->read('SchoolType');
|
||||||
|
/**
|
||||||
|
$cookie_value = $this->Cookie->read('schooltype');
|
||||||
|
if($cookie_value == 2) {
|
||||||
|
$schooltype = '02';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$schooltype = '04';
|
||||||
|
} */
|
||||||
if ($schooltype == '02') {
|
if ($schooltype == '02') {
|
||||||
$schulart = 'RS';
|
$schulart = 'RS';
|
||||||
$offset = -31;
|
$offset = -31;
|
||||||
@@ -278,6 +320,7 @@ class BudgetController extends AppController
|
|||||||
|
|
||||||
$this->set('data',$data_arr);
|
$this->set('data',$data_arr);
|
||||||
$this->set('wlBudgets',$wlBudgets);
|
$this->set('wlBudgets',$wlBudgets);
|
||||||
|
$this->set('schooltype',$schooltype);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function gettype($id = null) {
|
public function gettype($id = null) {
|
||||||
|
|||||||
0
src/Template/Budget/change_school.ctp
Normal file
0
src/Template/Budget/change_school.ctp
Normal file
@@ -40,7 +40,7 @@ var data = <?php echo json_encode($data); ?>;
|
|||||||
//console.log(JSON.stringify({data: hot.getData()}));
|
//console.log(JSON.stringify({data: hot.getData()}));
|
||||||
$.ajax({
|
$.ajax({
|
||||||
//url: "editajax?id=<?php echo $budget['id']; ?>",
|
//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()),
|
data: JSON.stringify(hot.getData()),
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?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"]';
|
//$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();
|
$cols = array();
|
||||||
$columns = array();
|
$columns = array();
|
||||||
@@ -63,7 +63,7 @@ var data = <?php echo json_encode($data); ?>;
|
|||||||
//console.log(JSON.stringify({data: hot.getData()}));
|
//console.log(JSON.stringify({data: hot.getData()}));
|
||||||
$.ajax({
|
$.ajax({
|
||||||
//url: "sajax",
|
//url: "sajax",
|
||||||
url: "<?php echo $this->Url->build(array('controller' => 'budget', 'action' => 'sajax',$budget['id']), true); ?>",
|
url: "<?php echo $this->Url->build(array('controller' => 'budget', 'action' => 'sajax',$schooltype), true); ?>",
|
||||||
data: JSON.stringify(hot.getData()),
|
data: JSON.stringify(hot.getData()),
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
{"id":11,"wl_schooltype_id":2,"snr":"0402","wl_budget_id":33,"count":5,"comment":"auto","year":"2018","created":"2018-04-04T09:10:38+00:00","modified":"2018-04-04T09:10:38+00:00"}
|
"33"
|
||||||
|
"02"
|
||||||
|
{"id":11,"wl_schooltype_id":2,"snr":"0402","wl_budget_id":33,"count":7,"comment":"auto","year":"2018","created":"2018-04-04T09:10:38+00:00","modified":"2018-04-09T13:31:02+00:00"}
|
||||||
{"id":18,"wl_schooltype_id":2,"snr":"0403","wl_budget_id":33,"count":3,"comment":"Aichach rules","year":"2018","created":"2018-04-06T11:58:36+00:00","modified":"2018-04-09T09:23:00+00:00"}
|
{"id":18,"wl_schooltype_id":2,"snr":"0403","wl_budget_id":33,"count":3,"comment":"Aichach rules","year":"2018","created":"2018-04-06T11:58:36+00:00","modified":"2018-04-09T09:23:00+00:00"}
|
||||||
{"id":23,"wl_schooltype_id":4,"snr":"0405","wl_budget_id":33,"count":8,"comment":"rein damit","year":"2018","created":"2018-04-09T09:33:09+00:00","modified":"2018-04-09T09:33:09+00:00"}
|
|
||||||
full-count
|
|
||||||
empty
|
|
||||||
empty
|
|
||||||
empty
|
|
||||||
empty
|
|
||||||
empty
|
|
||||||
empty
|
empty
|
||||||
|
{"id":31,"wl_schooltype_id":2,"snr":"0407","wl_budget_id":33,"count":7,"comment":"auto","year":"2018","created":"2018-04-10T13:32:59+00:00","modified":"2018-04-10T13:32:59+00:00"}
|
||||||
|
{"id":35,"wl_schooltype_id":2,"snr":"0410","wl_budget_id":33,"count":3,"comment":"auto","year":"2018","created":"2018-04-10T13:32:59+00:00","modified":"2018-04-10T13:32:59+00:00"}
|
||||||
|
{"id":37,"wl_schooltype_id":2,"snr":"0411","wl_budget_id":33,"count":7,"comment":"auto","year":"2018","created":"2018-04-10T13:32:59+00:00","modified":"2018-04-10T13:32:59+00:00"}
|
||||||
|
{"id":41,"wl_schooltype_id":2,"snr":"0413","wl_budget_id":33,"count":3,"comment":"auto","year":"2018","created":"2018-04-10T13:33:00+00:00","modified":"2018-04-10T13:33:00+00:00"}
|
||||||
|
{"id":43,"wl_schooltype_id":2,"snr":"0415","wl_budget_id":33,"count":7,"comment":"auto","year":"2018","created":"2018-04-10T13:33:00+00:00","modified":"2018-04-10T13:33:00+00:00"}
|
||||||
|
{"id":47,"wl_schooltype_id":2,"snr":"0416","wl_budget_id":33,"count":3,"comment":"auto","year":"2018","created":"2018-04-10T13:33:00+00:00","modified":"2018-04-10T13:33:00+00:00"}
|
||||||
empty
|
empty
|
||||||
empty
|
empty
|
||||||
empty
|
empty
|
||||||
|
|||||||
15340
webroot/files/debug.txt
15340
webroot/files/debug.txt
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user