Schulsicht
This commit is contained in:
@@ -26,16 +26,33 @@ class BudgetController extends AppController
|
||||
}
|
||||
|
||||
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) {
|
||||
$session = $this->request->session();
|
||||
//debug($session->read('SchoolType'));die;
|
||||
$schooltype = $session->read('SchoolType');
|
||||
|
||||
$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();
|
||||
@@ -107,15 +124,29 @@ class BudgetController extends AppController
|
||||
}
|
||||
|
||||
public function sajax() {
|
||||
|
||||
$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');
|
||||
|
||||
|
||||
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)
|
||||
'conditions' => array('snr' => $line[0], 'wl_budget_id' => $i+$wl_offset)
|
||||
]);
|
||||
|
||||
if(!($query->isEmpty())) {
|
||||
@@ -129,9 +160,9 @@ 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';
|
||||
@@ -141,7 +172,7 @@ class BudgetController extends AppController
|
||||
$this->Budget->save($new);
|
||||
}
|
||||
fwrite($myfile,serialize($budget). PHP_EOL);
|
||||
fwrite($myfile,$line[0] . ' ' .($i-1) . ' ' . $line[$i]. PHP_EOL);
|
||||
fwrite($myfile,$line[0] . ' ' .($i+$wl_offset) . ' ' . $line[$i]. PHP_EOL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,13 +180,28 @@ class BudgetController extends AppController
|
||||
}
|
||||
|
||||
public function overview() {
|
||||
|
||||
$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('list', [
|
||||
'conditions' => array('schulart' => 'GY')
|
||||
'conditions' => array('schulart' => $schulart)
|
||||
]);
|
||||
//debug($wlBudgets);
|
||||
//debug($wlBudgets);die;
|
||||
|
||||
$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 +214,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();
|
||||
|
||||
Reference in New Issue
Block a user