44 lines
951 B
PHP
44 lines
951 B
PHP
|
<?php
|
||
|
//Programmierung: Sven Alteköster 100%
|
||
|
//Getestet durch:
|
||
|
|
||
|
namespace ppb\Controller;
|
||
|
|
||
|
use ppb\Library\Msg;
|
||
|
use ppb\Model\GerichtModel;
|
||
|
|
||
|
class GerichtController {
|
||
|
|
||
|
private $db;
|
||
|
|
||
|
public function __construct() {
|
||
|
$this->db = new GerichtModel();
|
||
|
}
|
||
|
|
||
|
public function getGericht($id=false) {
|
||
|
$result=$this->db->selectGericht($id);
|
||
|
if($id !== false){
|
||
|
if($result)
|
||
|
$result=$result[0];
|
||
|
else
|
||
|
$result=false;
|
||
|
}
|
||
|
|
||
|
return json_encode($result);
|
||
|
}
|
||
|
|
||
|
public function writeGericht($data){
|
||
|
$result=$this->db->insertGericht($data);
|
||
|
return json_encode($result);
|
||
|
}
|
||
|
|
||
|
public function updateGericht($id, $data){
|
||
|
$result=$this->db->updateGericht($id, $data);
|
||
|
return json_encode($result);
|
||
|
}
|
||
|
|
||
|
public function deleteGericht($id){
|
||
|
$result=$this->db->deleteGericht($id);
|
||
|
return json_encode($result);
|
||
|
}
|
||
|
}
|