mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-28 17:39:28 +00:00
Added API call from employee updates
This commit is contained in:
@@ -21,7 +21,11 @@ class Mitarbeiter extends APIv1_Controller
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(array('Mitarbeiter' => 'basis/mitarbeiter:rw'));
|
||||
parent::__construct(array(
|
||||
'Mitarbeiter' => 'basis/mitarbeiter:rw',
|
||||
'Update' => 'basis/mitarbeiter:rw'
|
||||
)
|
||||
);
|
||||
// Load model MitarbeiterModel
|
||||
$this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel');
|
||||
|
||||
@@ -71,6 +75,41 @@ class Mitarbeiter extends APIv1_Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an Employee Record
|
||||
*
|
||||
* @return json Response Object
|
||||
*/
|
||||
public function postUpdate()
|
||||
{
|
||||
if ($this->_validate($this->post()))
|
||||
{
|
||||
if (isset($this->post()['mitarbeiter_uid']))
|
||||
{
|
||||
$result_load = $this->MitarbeiterModel->load($this->post()['mitarbeiter_uid']);
|
||||
if(isSuccess($result_load) && hasData($result_load))
|
||||
{
|
||||
$result = $this->MitarbeiterModel->update($this->post()['mitarbeiter_uid'], $this->post());
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = error('mitarbeiter_uid not found');
|
||||
$this->response($result, REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = error('Parameter mitarbeiter_uid is missing');
|
||||
$this->response($result, REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
private function _validate($mitarbeiter = NULL)
|
||||
{
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user