Files
FHC-Core/application/controllers/api/v1/crm/Dokument.php
T
bison-paolo f3b79cd731 - Added method chkRights to DB_Model
- Added method toPhp to DB_Model to convert array and boolean types from PostgresSQL to php
- Added method execQuery to DB_Model to execute a query (it calls toPhp)
- Added method pgsqlArrayToPhpArray to convert a pgsql array to php
- Updated DB_Model methods to using chkRights (and toPhp where it is needed)
- Removed methods escapeArray and _pgsqlArrayToPhpArray from controller APIv1_Controller
- Removed escapeArray from controllers Dokumentstudiengang and Dokument
- Updated models to use execQuery (and chkRights where it is needed)
2016-10-17 17:07:51 +02:00

76 lines
1.4 KiB
PHP

<?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
*/
// ------------------------------------------------------------------------
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Dokument extends APIv1_Controller
{
/**
* Dokument API constructor.
*/
public function __construct()
{
parent::__construct();
// Load model DokumentModel
$this->load->model('crm/dokument_model', 'DokumentModel');
}
/**
* @return void
*/
public function getDokument()
{
$dokument_kurzbz = $this->get('dokument_kurzbz');
if (isset($dokument_kurzbz))
{
$result = $this->DokumentModel->load($dokument_kurzbz);
$this->response($result, REST_Controller::HTTP_OK);
}
else
{
$this->response();
}
}
/**
* @return void
*/
public function postDokument()
{
if ($this->_validate($this->post()))
{
if (isset($this->post()['dokument_kurzbz']))
{
$result = $this->DokumentModel->update($this->post()['dokument_kurzbz'], $this->post());
}
else
{
$result = $this->DokumentModel->insert($this->post());
}
$this->response($result, REST_Controller::HTTP_OK);
}
else
{
$this->response();
}
}
private function _validate($dokument = NULL)
{
return true;
}
}