mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-05 22:29:27 +00:00
030fe2ba74
Conflicts: application/core/FHC_Model.php application/models/Nation_model.php application/models/lehre/Studiengang_model.php application/models/lehre/Studienplan_model.php
45 lines
889 B
PHP
45 lines
889 B
PHP
<?php
|
|
|
|
if(!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class File extends APIv1_Controller
|
|
{
|
|
/**
|
|
* Person API constructor.
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
// Load model FileModel
|
|
$this->load->model('file_model', 'FileModel');
|
|
// Load set the uid of the model to let to check the permissions
|
|
$this->FileModel->setUID($this->_getUID());
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function postFile()
|
|
{
|
|
$result = $this->FileModel->saveFile($this->post());
|
|
|
|
if($result === TRUE)
|
|
{
|
|
$httpstatus = REST_Controller::HTTP_OK;
|
|
$payload = [
|
|
'success' => true,
|
|
'message' => 'File saved.'
|
|
];
|
|
$payload['data'] = $result;
|
|
}
|
|
else
|
|
{
|
|
$payload = [
|
|
'success' => false,
|
|
'message' => 'Could not save file.'
|
|
];
|
|
$httpstatus = REST_Controller::HTTP_OK;
|
|
}
|
|
$this->response($payload, $httpstatus);
|
|
}
|
|
} |