This commit is contained in:
Stefan Puraner
2016-05-10 14:12:54 +02:00
13 changed files with 181 additions and 258 deletions
-45
View File
@@ -1,45 +0,0 @@
<?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);
}
}
@@ -94,43 +94,21 @@ class Person extends APIv1_Controller
*/
public function getCheckBewerbung()
{
$result = $this->PersonModel->checkBewerbung($this->get("email"), $this->get("studiensemester_kurzbz"));
$httpstatus = REST_Controller::HTTP_OK;
$payload = [
'success' => true,
'message' => 'Bewerbung exists.'
];
$payload['data'] = $result;
$this->response($payload, $httpstatus);
}
/**
* @return void
*/
public function getCheckZugangscodePerson()
{
$result = $this->PersonModel->checkZugangscodePerson($this->get("code"));
$httpstatus = REST_Controller::HTTP_OK;
if(!empty($result))
$email = $this->get('email');
$studiensemester_kurzbz = $this->get('studiensemester_kurzbz');
if(isset($email))
{
$payload = [
'success' => true,
'message' => 'Zugangscode exists.'
];
$payload['data'] = $result;
$result = $this->PersonModel->checkBewerbung($email, $studiensemester_kurzbz);
$this->response($result, REST_Controller::HTTP_OK);
}
else
{
$payload = [
'success' => false,
'message' => 'Zugangscode does not exist.'
];
$httpstatus = REST_Controller::HTTP_OK;
$this->response();
}
$this->response($payload, $httpstatus);
}
private function _validate($person = NULL)
{
if(!isset($person))