Stability Schooltype

This commit is contained in:
2018-04-10 16:31:25 +02:00
parent 6247ec5037
commit d94a8e88c5
7 changed files with 188 additions and 15272 deletions

View File

@@ -22,6 +22,21 @@ 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());
}
@@ -77,14 +92,26 @@ 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() {
$this->autoRender = false;
$myfile = fopen(WWW_ROOT . DS . 'files' . DS . 'debug-edit.txt', "w");
//fwrite($myfile,$id . PHP_EOL);
$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) {
@@ -118,7 +145,7 @@ 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_nr;
$new_budget['snr'] = $line[0];
$new_budget['wl_budget_id'] = $id;
$new_budget['count'] = $line[2];
@@ -134,11 +161,11 @@ class BudgetController extends AppController
fclose($myfile);
}
public function sajax() {
public function sajax($schooltype = null) {
$session = $this->request->session();
//$session = $this->request->session();
//debug($session->read('SchoolType'));die;
$schooltype = $session->read('SchoolType');
//$schooltype = $session->read('SchoolType');
if ($schooltype == '02') {
$wl_offset = 31;
$schooltype_id = '2';
@@ -162,7 +189,7 @@ class BudgetController extends AppController
$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'];
//$search_arr[$key]['comment'] = $entry['comment'];
fwrite($myfile,json_encode($search_arr[$key]) . PHP_EOL);
}
@@ -230,9 +257,24 @@ class BudgetController extends AppController
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();
//debug($session->read('SchoolType'));die;
$schooltype = $session->read('SchoolType');
/**
$cookie_value = $this->Cookie->read('schooltype');
if($cookie_value == 2) {
$schooltype = '02';
}
else {
$schooltype = '04';
} */
if ($schooltype == '02') {
$schulart = 'RS';
$offset = -31;
@@ -278,6 +320,7 @@ class BudgetController extends AppController
$this->set('data',$data_arr);
$this->set('wlBudgets',$wlBudgets);
$this->set('schooltype',$schooltype);
}
public function gettype($id = null) {