This commit is contained in:
Stefan Puraner
2016-05-11 08:00:48 +02:00
15 changed files with 757 additions and 3755 deletions
@@ -1,80 +0,0 @@
<?php
/**
* FH-Complete
*
* @package FHC-API
* @author FHC-Team
* @copyright Copyright (c) 2016, fhcomplete.org
* @license GPLv3
* @link http://fhcomplete.org
* @since Version 1.0
* @filesource
*/
// ------------------------------------------------------------------------
defined('BASEPATH') || exit('No direct script access allowed');
class Kontakt extends APIv1_Controller
{
//public $session;
/**
* Person API constructor.
*/
public function __construct()
{
parent::__construct();
$this->load->model('kontakt/Kontakt_model');
}
public function kontaktPerson_get()
{
$result = $this->Kontakt_model->getKontaktPerson($this->get("person_id"));
if($result != FALSE)
{
$httpstatus = REST_Controller::HTTP_OK;
$payload = [
'success' => true,
'message' => 'Kontakt found.'
];
$payload['data'] = $result;
}
else
{
$payload = [
'success' => false,
'message' => 'Could not find Kontakt.'
];
$httpstatus = REST_Controller::HTTP_OK;
}
$this->response($payload, $httpstatus);
}
public function kontakt_post()
{
$result = $this->Kontakt_model->saveKontakt($this->post());
if($result != FALSE)
{
$httpstatus = REST_Controller::HTTP_OK;
$payload = [
'success' => true,
'message' => 'Kontakt saved.'
];
$payload['data'] = $result;
}
else
{
$payload = [
'success' => false,
'message' => 'Could not save Kontakt.'
];
$httpstatus = REST_Controller::HTTP_OK;
}
$this->response($payload, $httpstatus);
}
}
@@ -13,7 +13,7 @@
// ------------------------------------------------------------------------
if(!defined('BASEPATH')) exit('No direct script access allowed');
class Studiengang extends APIv1_Controller
class Studiengang2 extends APIv1_Controller
{
/**
* Course API constructor.
@@ -29,8 +29,6 @@ class Studiengang extends APIv1_Controller
public function getAllForBewerbung()
{
$result = $this->StudiengangModel->getAllForBewerbung();
$this->response($result, REST_Controller::HTTP_OK);
$this->response($this->StudiengangModel->getAllForBewerbung(), REST_Controller::HTTP_OK);
}
}
@@ -0,0 +1,70 @@
<?php
/**
* FH-Complete
*
* @package FHC-API
* @author FHC-Team
* @copyright Copyright (c) 2016, fhcomplete.org
* @license GPLv3
* @link http://fhcomplete.org
* @since Version 1.0
* @filesource
*/
// ------------------------------------------------------------------------
defined('BASEPATH') || exit('No direct script access allowed');
class Kontakt extends APIv1_Controller
{
/**
* Person API constructor.
*/
public function __construct()
{
parent::__construct();
// Load model PersonModel
$this->load->model('person/kontakt_model', 'KontaktModel');
// Load set the uid of the model to let to check the permissions
$this->KontaktModel->setUID($this->_getUID());
}
public function getKontakt()
{
$personID = $this->get("person_id");
if(isset($personID))
{
$result = $this->KontaktModel->loadWhere(array('person_id' => $personID));
$this->response($result, REST_Controller::HTTP_OK);
}
else
{
$this->response();
}
}
public function postKontakt()
{
$post = $this->post();
if(is_array($post))
{
if(isset($post['kontakt_id']))
{
$result = $this->KontaktModel->update($post['kontakt_id'], $post);
}
else
{
$result = $this->KontaktModel->insert($post);
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
{
$this->response();
}
}
}