mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Removed _parseData workaround
This commit is contained in:
@@ -51,7 +51,7 @@ class Dms extends APIv1_Controller
|
||||
*/
|
||||
public function postDms()
|
||||
{
|
||||
$dms = $this->_parseData($this->post());
|
||||
$dms = $this->post();
|
||||
|
||||
if ($this->_validatePost($dms))
|
||||
{
|
||||
@@ -70,9 +70,9 @@ class Dms extends APIv1_Controller
|
||||
*/
|
||||
public function postDelDms()
|
||||
{
|
||||
$dms = $this->_parseData($this->post());
|
||||
$dms = $this->post();
|
||||
|
||||
if ($this->_validateDelete($dms))
|
||||
if ($this->_validateDelete($this->post()))
|
||||
{
|
||||
$result = $this->dmslib->delete($dms["person_id"], $dms["dms_id"]);
|
||||
|
||||
|
||||
@@ -140,9 +140,9 @@ class Prestudent extends APIv1_Controller
|
||||
*/
|
||||
public function postPrestudent()
|
||||
{
|
||||
$prestudent = $this->_parseData($this->post());
|
||||
$prestudent = $this->post();
|
||||
|
||||
if ($this->_validate($prestudent))
|
||||
if ($this->_validate($this->post()))
|
||||
{
|
||||
if (isset($prestudent['prestudent_id']))
|
||||
{
|
||||
@@ -183,7 +183,7 @@ class Prestudent extends APIv1_Controller
|
||||
*/
|
||||
public function postAddReihungstest()
|
||||
{
|
||||
$ddReihungstest = $this->_parseData($this->post());
|
||||
$ddReihungstest = $this->post();
|
||||
|
||||
if ($this->_validateReihungstest($ddReihungstest))
|
||||
{
|
||||
@@ -212,7 +212,7 @@ class Prestudent extends APIv1_Controller
|
||||
*/
|
||||
public function postDelReihungstest()
|
||||
{
|
||||
$ddReihungstest = $this->_parseData($this->post());
|
||||
$ddReihungstest = $this->post();
|
||||
|
||||
if (isset($ddReihungstest['rt_person_id']))
|
||||
{
|
||||
|
||||
@@ -74,7 +74,7 @@ class Prestudentstatus extends APIv1_Controller
|
||||
*/
|
||||
public function postPrestudentstatus()
|
||||
{
|
||||
$prestudentstatus = $this->_parseData($this->post());
|
||||
$prestudentstatus = $this->post();
|
||||
|
||||
if ($this->_validate($prestudentstatus))
|
||||
{
|
||||
@@ -109,7 +109,7 @@ class Prestudentstatus extends APIv1_Controller
|
||||
*/
|
||||
public function deletePrestudentstatus()
|
||||
{
|
||||
$prestudentstatus = $this->_parseData($this->delete());
|
||||
$prestudentstatus = $this->delete();
|
||||
|
||||
if ($this->_validate($prestudentstatus))
|
||||
{
|
||||
|
||||
@@ -47,17 +47,17 @@ class Adresse extends APIv1_Controller
|
||||
|
||||
public function postAdresse()
|
||||
{
|
||||
$post = $this->_parseData($this->post());
|
||||
$adresse = $this->post();
|
||||
|
||||
if (is_array($post))
|
||||
if (is_array($adresse))
|
||||
{
|
||||
if (isset($post['adresse_id']))
|
||||
if (isset($adresse['adresse_id']))
|
||||
{
|
||||
$result = $this->AdresseModel->update($post['adresse_id'], $post);
|
||||
$result = $this->AdresseModel->update($adresse['adresse_id'], $adresse);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->AdresseModel->insert($post);
|
||||
$result = $this->AdresseModel->insert($adresse);
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
@@ -67,4 +67,4 @@ class Adresse extends APIv1_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (! defined("BASEPATH")) exit("No direct script access allowed");
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Kontakt extends APIv1_Controller
|
||||
{
|
||||
@@ -23,13 +23,14 @@ class Kontakt extends APIv1_Controller
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Load model PersonModel
|
||||
$this->load->model("person/kontakt_model", "KontaktModel");
|
||||
$this->load->model('person/kontakt_model', 'KontaktModel');
|
||||
}
|
||||
|
||||
public function getKontakt()
|
||||
{
|
||||
$kontakt_id = $this->get("kontakt_id");
|
||||
$kontakt_id = $this->get('kontakt_id');
|
||||
|
||||
if (isset($kontakt_id))
|
||||
{
|
||||
@@ -45,7 +46,7 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
public function getOnlyKontakt()
|
||||
{
|
||||
$kontakt_id = $this->get("kontakt_id");
|
||||
$kontakt_id = $this->get('kontakt_id');
|
||||
|
||||
if (isset($kontakt_id))
|
||||
{
|
||||
@@ -61,7 +62,7 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
public function getKontaktByPersonID()
|
||||
{
|
||||
$person_id = $this->get("person_id");
|
||||
$person_id = $this->get('person_id');
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
@@ -77,11 +78,11 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
public function getOnlyKontaktByPersonID()
|
||||
{
|
||||
$person_id = $this->get("person_id");
|
||||
$person_id = $this->get('person_id');
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$result = $this->KontaktModel->loadWhere(array("person_id" => $person_id));
|
||||
$result = $this->KontaktModel->loadWhere(array('person_id' => $person_id));
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -93,8 +94,8 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
public function getKontaktByPersonIDKontaktTyp()
|
||||
{
|
||||
$person_id = $this->get("person_id");
|
||||
$kontakttyp = $this->get("kontakttyp");
|
||||
$person_id = $this->get('person_id');
|
||||
$kontakttyp = $this->get('kontakttyp');
|
||||
|
||||
if (isset($person_id) && isset($kontakttyp))
|
||||
{
|
||||
@@ -110,17 +111,17 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
public function postKontakt()
|
||||
{
|
||||
$post = $this->_parseData($this->post());
|
||||
$kontakt = $this->post();
|
||||
|
||||
if (is_array($post))
|
||||
if (is_array($kontakt))
|
||||
{
|
||||
if (isset($post["kontakt_id"]))
|
||||
if (isset($kontakt['kontakt_id']))
|
||||
{
|
||||
$result = $this->KontaktModel->update($post["kontakt_id"], $post);
|
||||
$result = $this->KontaktModel->update($kontakt['kontakt_id'], $kontakt);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->KontaktModel->insert($post);
|
||||
$result = $this->KontaktModel->insert($kontakt);
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
|
||||
@@ -90,8 +90,8 @@ class Person extends APIv1_Controller
|
||||
*/
|
||||
public function postPerson()
|
||||
{
|
||||
$person = $this->_parseData($this->post());
|
||||
$validation = $this->_validate($this->post());
|
||||
$person = $this->post();
|
||||
$validation = $this->_validate($person);
|
||||
|
||||
if (isSuccess($validation))
|
||||
{
|
||||
|
||||
@@ -11,35 +11,4 @@ class APIv1_Controller extends REST_Controller
|
||||
// Loads return messages
|
||||
$this->load->helper('Message');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $data
|
||||
* @return typeparses empty string to NULL
|
||||
*/
|
||||
protected function _parseData($data)
|
||||
{
|
||||
if(is_array($data))
|
||||
{
|
||||
foreach($data as $key=>$value)
|
||||
{
|
||||
if($value === '')
|
||||
{
|
||||
$data[$key] = NULL;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
elseif(is_object($data))
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
if($data == '')
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user