mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 10:22:18 +00:00
Merge branch 'ci' of https://github.com/FH-Complete/FHC-Core into ci
This commit is contained in:
@@ -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 Adresse extends APIv1_Controller
|
||||
{
|
||||
/**
|
||||
* Person API constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model PersonModel
|
||||
$this->load->model('person/adresse_model', 'AdresseModel');
|
||||
// Load set the uid of the model to let to check the permissions
|
||||
$this->AdresseModel->setUID($this->_getUID());
|
||||
}
|
||||
|
||||
public function getAdresse()
|
||||
{
|
||||
$personID = $this->get("person_id");
|
||||
|
||||
if(isset($personID))
|
||||
{
|
||||
$result = $this->AdresseModel->loadWhere(array('person_id' => $personID));
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
public function postAdresse()
|
||||
{
|
||||
$post = $this->post();
|
||||
|
||||
if(is_array($post))
|
||||
{
|
||||
if(isset($post['adresse_id']))
|
||||
{
|
||||
$result = $this->AdresseModel->update($post['adresse_id'], $post);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->AdresseModel->insert($post);
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user