Initial commit

This commit is contained in:
2018-04-02 08:23:14 +02:00
commit 9b83d1dc09
151 changed files with 20566 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @since 0.2.9
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
namespace App\Controller;
use Cake\Controller\Controller;
use Cake\Event\Event;
/**
* Application Controller
*
* Add your application-wide methods in the class below, your controllers
* will inherit them.
*
* @link https://book.cakephp.org/3.0/en/controllers.html#the-app-controller
*/
class AppController extends Controller
{
/**
* Initialization hook method.
*
* Use this method to add common initialization code like loading components.
*
* e.g. `$this->loadComponent('Security');`
*
* @return void
*/
public function initialize()
{
parent::initialize();
$this->loadComponent('RequestHandler');
$this->loadComponent('Flash');
/*
* Enable the following components for recommended CakePHP security settings.
* see https://book.cakephp.org/3.0/en/controllers/components/security.html
*/
//$this->loadComponent('Security');
//$this->loadComponent('Csrf');
}
}

View File

@@ -0,0 +1,369 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use AsdCurl\AsdUp;
/**
* Budget Controller
*
* @property \App\Model\Table\BudgetTable $Budget
*
* @method \App\Model\Entity\Budget[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class BudgetController extends AppController
{
public function sajax() {
$this->autoRender = false;
$myfile = fopen(WWW_ROOT . DS . 'files' . DS . 'debug.txt', "w");
$data = $this->request->input('json_decode');
foreach($data as $line) {
//fwrite($myfile,json_encode($line). PHP_EOL);
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] ) {
$budget['count'] = $line[$i];
$this->Budget->save($budget);
}
fwrite($myfile,'full' . 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'] = $i-1;
$new_budget['count'] = $line[$i];
$new_budget['comment'] = 'auto';
$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);
}
}
}
fclose($myfile);
//debug(json_encode($this->request->data));
//debug($this->request);
//return(true);
}
public function overview() {
$wlBudgets = $this->Budget->wlBudgets->find('list', [
'conditions' => array('schulart' => 'GY')
]);
//debug($wlBudgets);
$this->loadModel('Schools');
$schools = $this->Schools->find('all');
$data = array();
foreach($schools as $school) {
$line = array();
array_push($line,$school['dst_schluessel']);
array_push($line,$school['dst_name']);
foreach($wlBudgets as $wlbudget) {
array_push($line,'');
//debug($budget);
}
$data[$school['dst_schluessel']] = $line;
}
$budgets = $this->Budget->find('all');
foreach($budgets as $budget) {
$i = $budget['wl_budget_id']+1;
$data[$budget['snr']][$i] = $budget['count'];
}
$data_arr = array();
foreach($data as $entry) {
array_push($data_arr,$entry);
}
$this->set('data',$data_arr);
$this->set('wlBudgets',$wlBudgets);
}
public function gettype($id = null) {
$budget = $this->Budget->newEntity();
if ($this->request->is('post')) {
//debug($this->request);
$r = $this->request;
debug($r->params);
$wl_id = $r->params['pass']['0'];
//debug($wl_id);die;
$wlBudget = $this->Budget->WlBudgets->get($wl_id);
debug($wlBudget);
debug($r->data);
die;
}
$budgettype = $this->Budget->WlBudgets->get($id);
//debug($budgettype);
$this->loadModel('Schools');
$schools = $this->Schools->find('all');
//debug($schools);
$this->set('budget',$budget);
$this->set('schools',$schools);
}
public function importCsv() {
$uploadData = '';
if ($this->request->is('post')) {
if(!empty($this->request->data['file']['name'])){
$fileName = $this->request->data['file']['name'];
$uploadPath = 'uploads/';
$uploadFile = $uploadPath.$fileName;
if(move_uploaded_file($this->request->data['file']['tmp_name'],$uploadFile)){
$this->Flash->success(__('The File has been uploaded.'));
return $this->redirect(['action' => 'displayCsv', $fileName]);
} else {
$this->Flash->error(__('Unable to upload file, please try again.'));
}
} else {
$this->Flash->error(__('Please choose a file to upload.'));
}
}
$this->set('uploadData', $uploadData);
}
public function displayCsv($filename) {
//debug($filename);die;
$uploadPath = 'uploads/';
$handle = fopen($uploadPath.$filename, "r");
$head = true;
$content_arr = array();
if ($handle) {
while (($line = fgets($handle)) !== false) {
if(strlen($line) > 2) {
if($head) {
$headers = explode(';',$line);
$head = false;
}
else {
array_push($content_arr,explode(';',$line));
}
}
}
fclose($handle);
} else {
// error opening the file.
}
$this->set('headers',$headers);
$this->set('content_arr',$content_arr);
}
public function exportCsv() {
$this->response->download('export.csv');
$exports = $this->Budget->find('all', [
'contain' => ['WlBudgets'],
'fields' => ['Budget.snr','WlBudgets.wl_werteliste_id','WlBudgets.wl_kurz_bezeichnung','Budget.count','Budget.comment']
]);
$data = array();
foreach($exports as $export) {
$line['snr'] = $export->snr;
$line['werteliste_id'] = $export->wl_budget->wl_werteliste_id;
$line['bezeichnung'] = $export->wl_budget->wl_kurz_bezeichnung;
$line['count'] = $export->count;
$line['comment'] = $export->comment;
array_push($data,$line);
//debug(json_decode(json_encode($export)));
}
//debug($data);die;
$_serialize = 'data';
$_header = ['Schulnummer', 'Werteliste ID', 'Bezeichnung', 'Count', 'Comment'];
$_delimiter = ';';
$this->set(compact('data', '_serialize', '_header', '_delimiter'));
$this->viewBuilder()->className('CsvView.Csv');
}
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($curl->html);
$budget['snr'] = '9310';
$budget['budget_id'] = '1519';
$budget['count'] = '5';
$budget['comment'] = 'Schüler Hans Mustermann';
$curl->goto_budget($ch,$budget);
$curl->write_budget($ch,$budget);
$snr = '0181';
$curl->change_school($ch,$snr);
$this->set('html',$curl->html);
}
public function readAsd($snr) {
//debug($snr);
$snr = '9310';
$curl = new AsdUp();
$ch = $curl->init_curl_params();
$curl->login_asd($ch);
$budget['snr'] = $snr;
$curl->goto_budget($ch,$budget);
$data = $curl->read_budget($ch,$snr);
//debug($data);
$asd_budget = $this->Budget->find('all',array('conditions' => array('snr' => $snr)));
foreach($asd_budget as $entry) {
$new['herkunft'] = 'ASD';
//debug($entry);
$wl_budget = json_decode(json_encode($this->Budget->WlBudgets->get($entry['wl_budget_id'])));
//debug($wl_budget);
$new['budget'] = $wl_budget->wl_kurz_bezeichnung;
$new['von'] = '01.08.2018';
$new['bis'] = '31.07.2019';
$new['count'] = $entry['count'];
$new['comment'] = $entry['comment'];
//debug($new);
array_push($data,$new);
}
//debug($data);
//die;
$budget = $this->Budget->newEntity();
if ($this->request->is('post')) {
$budget = $this->Budget->patchEntity($budget, $this->request->getData());
//debug($budget);
//debug($this->referer);die;
if ($this->Budget->save($budget)) {
$this->Flash->success(__('The budget has been saved.'));
return $this->redirect(['action' => 'readAsd',$snr]);
}
$this->Flash->error(__('The budget could not be saved. Please, try again.'));
}
$wlSchooltypes = $this->Budget->WlSchooltypes->find('list', ['limit' => 200]);
$wlBudgets = $this->Budget->WlBudgets->find('list', ['limit' => 200]);
$this->set(compact('budget', 'wlSchooltypes', 'wlBudgets'));
$this->set('data',$data);
$this->set('snr',$snr);
}
public function delAllAsd($snr) {
$curl = new AsdUp();
$ch = $curl->init_curl_params();
$curl->login_asd($ch);
$budget['snr'] = $snr;
$curl->goto_budget($ch,$budget);
$to_del = $curl->del_all_budget($ch,$snr);
$this->set('to_del',$to_del);
}
/**
* Index method
*
* @return \Cake\Http\Response|void
*/
public function index()
{
$this->paginate = [
'contain' => ['WlSchooltypes', 'WlBudgets']
];
$budget = $this->paginate($this->Budget);
$this->set(compact('budget'));
}
/**
* View method
*
* @param string|null $id Budget id.
* @return \Cake\Http\Response|void
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$budget = $this->Budget->get($id, [
'contain' => ['WlSchooltypes', 'Schools', 'WlBudgets']
]);
$this->set('budget', $budget);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$budget = $this->Budget->newEntity();
if ($this->request->is('post')) {
$budget = $this->Budget->patchEntity($budget, $this->request->getData());
debug($budget);die;
if ($this->Budget->save($budget)) {
$this->Flash->success(__('The budget has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The budget could not be saved. Please, try again.'));
}
$wlSchooltypes = $this->Budget->WlSchooltypes->find('list', ['limit' => 200]);
$wlBudgets = $this->Budget->WlBudgets->find('list', ['limit' => 200]);
$this->set(compact('budget', 'wlSchooltypes', 'wlBudgets'));
}
/**
* Edit method
*
* @param string|null $id Budget id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$budget = $this->Budget->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$budget = $this->Budget->patchEntity($budget, $this->request->getData());
if ($this->Budget->save($budget)) {
$this->Flash->success(__('The budget has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The budget could not be saved. Please, try again.'));
}
$wlSchooltypes = $this->Budget->WlSchooltypes->find('list', ['limit' => 200]);
$wlBudgets = $this->Budget->WlBudgets->find('list', ['limit' => 200]);
$this->set(compact('budget', 'wlSchooltypes', 'wlBudgets'));
}
/**
* Delete method
*
* @param string|null $id Budget id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$budget = $this->Budget->get($id);
if ($this->Budget->delete($budget)) {
$this->Flash->success(__('The budget has been deleted.'));
} else {
$this->Flash->error(__('The budget could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

View File

@@ -0,0 +1,68 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @since 3.3.4
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
namespace App\Controller;
use Cake\Event\Event;
/**
* Error Handling Controller
*
* Controller used by ExceptionRenderer to render error responses.
*/
class ErrorController extends AppController
{
/**
* Initialization hook method.
*
* @return void
*/
public function initialize()
{
$this->loadComponent('RequestHandler');
}
/**
* beforeFilter callback.
*
* @param \Cake\Event\Event $event Event.
* @return \Cake\Http\Response|null|void
*/
public function beforeFilter(Event $event)
{
}
/**
* beforeRender callback.
*
* @param \Cake\Event\Event $event Event.
* @return \Cake\Http\Response|null|void
*/
public function beforeRender(Event $event)
{
parent::beforeRender($event);
$this->viewBuilder()->setTemplatePath('Error');
}
/**
* afterFilter callback.
*
* @param \Cake\Event\Event $event Event.
* @return \Cake\Http\Response|null|void
*/
public function afterFilter(Event $event)
{
}
}

View File

@@ -0,0 +1,69 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @since 0.2.9
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
namespace App\Controller;
use Cake\Core\Configure;
use Cake\Network\Exception\ForbiddenException;
use Cake\Network\Exception\NotFoundException;
use Cake\View\Exception\MissingTemplateException;
/**
* Static content controller
*
* This controller will render views from Template/Pages/
*
* @link https://book.cakephp.org/3.0/en/controllers/pages-controller.html
*/
class PagesController extends AppController
{
/**
* Displays a view
*
* @param array ...$path Path segments.
* @return \Cake\Http\Response|null
* @throws \Cake\Network\Exception\ForbiddenException When a directory traversal attempt.
* @throws \Cake\Network\Exception\NotFoundException When the view file could not
* be found or \Cake\View\Exception\MissingTemplateException in debug mode.
*/
public function display(...$path)
{
$count = count($path);
if (!$count) {
return $this->redirect('/');
}
if (in_array('..', $path, true) || in_array('.', $path, true)) {
throw new ForbiddenException();
}
$page = $subpage = null;
if (!empty($path[0])) {
$page = $path[0];
}
if (!empty($path[1])) {
$subpage = $path[1];
}
$this->set(compact('page', 'subpage'));
try {
$this->render(implode('/', $path));
} catch (MissingTemplateException $exception) {
if (Configure::read('debug')) {
throw $exception;
}
throw new NotFoundException();
}
}
}

View File

@@ -0,0 +1,114 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* Schools Controller
*
* @property \App\Model\Table\SchoolsTable $Schools
*
* @method \App\Model\Entity\School[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class SchoolsController extends AppController
{
public function show() {
$results = $this->Schools->find('all');
//$results = $query->all();
//debug($results);
$this->set('results',$results);
}
/**
* Index method
*
* @return \Cake\Http\Response|void
*/
public function index()
{
$schools = $this->paginate($this->Schools);
$this->set(compact('schools'));
}
/**
* View method
*
* @param string|null $id School id.
* @return \Cake\Http\Response|void
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$school = $this->Schools->get($id, [
'contain' => ['Budget']
]);
$this->set('school', $school);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$school = $this->Schools->newEntity();
if ($this->request->is('post')) {
$school = $this->Schools->patchEntity($school, $this->request->getData());
if ($this->Schools->save($school)) {
$this->Flash->success(__('The school has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The school could not be saved. Please, try again.'));
}
$this->set(compact('school'));
}
/**
* Edit method
*
* @param string|null $id School id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$school = $this->Schools->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$school = $this->Schools->patchEntity($school, $this->request->getData());
if ($this->Schools->save($school)) {
$this->Flash->success(__('The school has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The school could not be saved. Please, try again.'));
}
$this->set(compact('school'));
}
/**
* Delete method
*
* @param string|null $id School id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$school = $this->Schools->get($id);
if ($this->Schools->delete($school)) {
$this->Flash->success(__('The school has been deleted.'));
} else {
$this->Flash->error(__('The school could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,127 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* WlBudgets Controller
*
* @property \App\Model\Table\WlBudgetsTable $WlBudgets
*
* @method \App\Model\Entity\WlBudget[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class WlBudgetsController extends AppController
{
/**
* Index method
*
* @return \Cake\Http\Response|void
*/
public function select() {
if ($this->request->is('post')) {
//debug($this->request['data']);
$budget_id = $this->request['data']['wl_Budgets'];
//debug($budget_id);
return $this->redirect(['controller' => 'budget', 'action' => 'gettype', $budget_id]);
}
else {
$wlBudget = $this->WlBudgets->newEntity();
$wlBudgets = $this->WlBudgets->find('list', [
'conditions' => array('schulart' => 'GY')
]);
//debug($wlBudgets);
$this->set(compact('wlBudget','wlBudgets'));
}
}
public function index()
{
$wlBudgets = $this->paginate($this->WlBudgets);
$this->set(compact('wlBudgets'));
}
/**
* View method
*
* @param string|null $id Wl Budget id.
* @return \Cake\Http\Response|void
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$wlBudget = $this->WlBudgets->get($id, [
'contain' => ['Budget']
]);
$this->set('wlBudget', $wlBudget);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$wlBudget = $this->WlBudgets->newEntity();
if ($this->request->is('post')) {
$wlBudget = $this->WlBudgets->patchEntity($wlBudget, $this->request->getData());
if ($this->WlBudgets->save($wlBudget)) {
$this->Flash->success(__('The wl budget has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The wl budget could not be saved. Please, try again.'));
}
$this->set(compact('wlBudget'));
}
/**
* Edit method
*
* @param string|null $id Wl Budget id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$wlBudget = $this->WlBudgets->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$wlBudget = $this->WlBudgets->patchEntity($wlBudget, $this->request->getData());
if ($this->WlBudgets->save($wlBudget)) {
$this->Flash->success(__('The wl budget has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The wl budget could not be saved. Please, try again.'));
}
$this->set(compact('wlBudget'));
}
/**
* Delete method
*
* @param string|null $id Wl Budget id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$wlBudget = $this->WlBudgets->get($id);
if ($this->WlBudgets->delete($wlBudget)) {
$this->Flash->success(__('The wl budget has been deleted.'));
} else {
$this->Flash->error(__('The wl budget could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,107 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* WlDstTyp Controller
*
* @property \App\Model\Table\WlDstTypTable $WlDstTyp
*
* @method \App\Model\Entity\WlDstTyp[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class WlDstTypController extends AppController
{
/**
* Index method
*
* @return \Cake\Http\Response|void
*/
public function index()
{
$wlDstTyp = $this->paginate($this->WlDstTyp);
$this->set(compact('wlDstTyp'));
}
/**
* View method
*
* @param string|null $id Wl Dst Typ id.
* @return \Cake\Http\Response|void
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$wlDstTyp = $this->WlDstTyp->get($id, [
'contain' => []
]);
$this->set('wlDstTyp', $wlDstTyp);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$wlDstTyp = $this->WlDstTyp->newEntity();
if ($this->request->is('post')) {
$wlDstTyp = $this->WlDstTyp->patchEntity($wlDstTyp, $this->request->getData());
if ($this->WlDstTyp->save($wlDstTyp)) {
$this->Flash->success(__('The wl dst typ has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The wl dst typ could not be saved. Please, try again.'));
}
$this->set(compact('wlDstTyp'));
}
/**
* Edit method
*
* @param string|null $id Wl Dst Typ id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$wlDstTyp = $this->WlDstTyp->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$wlDstTyp = $this->WlDstTyp->patchEntity($wlDstTyp, $this->request->getData());
if ($this->WlDstTyp->save($wlDstTyp)) {
$this->Flash->success(__('The wl dst typ has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The wl dst typ could not be saved. Please, try again.'));
}
$this->set(compact('wlDstTyp'));
}
/**
* Delete method
*
* @param string|null $id Wl Dst Typ id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$wlDstTyp = $this->WlDstTyp->get($id);
if ($this->WlDstTyp->delete($wlDstTyp)) {
$this->Flash->success(__('The wl dst typ has been deleted.'));
} else {
$this->Flash->error(__('The wl dst typ could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,107 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* WlSchooltypes Controller
*
* @property \App\Model\Table\WlSchooltypesTable $WlSchooltypes
*
* @method \App\Model\Entity\WlSchooltype[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class WlSchooltypesController extends AppController
{
/**
* Index method
*
* @return \Cake\Http\Response|void
*/
public function index()
{
$wlSchooltypes = $this->paginate($this->WlSchooltypes);
$this->set(compact('wlSchooltypes'));
}
/**
* View method
*
* @param string|null $id Wl Schooltype id.
* @return \Cake\Http\Response|void
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$wlSchooltype = $this->WlSchooltypes->get($id, [
'contain' => ['Budget']
]);
$this->set('wlSchooltype', $wlSchooltype);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$wlSchooltype = $this->WlSchooltypes->newEntity();
if ($this->request->is('post')) {
$wlSchooltype = $this->WlSchooltypes->patchEntity($wlSchooltype, $this->request->getData());
if ($this->WlSchooltypes->save($wlSchooltype)) {
$this->Flash->success(__('The wl schooltype has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The wl schooltype could not be saved. Please, try again.'));
}
$this->set(compact('wlSchooltype'));
}
/**
* Edit method
*
* @param string|null $id Wl Schooltype id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$wlSchooltype = $this->WlSchooltypes->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$wlSchooltype = $this->WlSchooltypes->patchEntity($wlSchooltype, $this->request->getData());
if ($this->WlSchooltypes->save($wlSchooltype)) {
$this->Flash->success(__('The wl schooltype has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The wl schooltype could not be saved. Please, try again.'));
}
$this->set(compact('wlSchooltype'));
}
/**
* Delete method
*
* @param string|null $id Wl Schooltype id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$wlSchooltype = $this->WlSchooltypes->get($id);
if ($this->WlSchooltypes->delete($wlSchooltype)) {
$this->Flash->success(__('The wl schooltype has been deleted.'));
} else {
$this->Flash->error(__('The wl schooltype could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}