mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 09:52:22 +00:00
Merge origin/ci into ci
Conflicts: application/config/rest.php application/libraries/FHC_Auth.php tests/codeception/api/LoginCept.php
This commit is contained in:
@@ -21,7 +21,7 @@ class Test extends REST_Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get()
|
||||
public function getTest()
|
||||
{
|
||||
$payload = [
|
||||
'success' => TRUE,
|
||||
@@ -38,7 +38,7 @@ class Test extends REST_Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_post()
|
||||
public function postTest()
|
||||
{
|
||||
$payload = [
|
||||
'success' => TRUE,
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?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 Nation extends REST_Controller
|
||||
{
|
||||
/**
|
||||
* Course API constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model PersonModel
|
||||
$this->load->model('nation_model', 'NationModel');
|
||||
// Load set the addonID of the model to let to check the permissions
|
||||
$this->NationModel->setAddonID($this->_getAddonID());
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
$notLocked = $this->get('ohnesperre');
|
||||
$orderEnglish = $this->get('orderEnglish');
|
||||
|
||||
$result = $this->NationModel->getAll($notLocked, $orderEnglish);
|
||||
|
||||
if(!is_null($result) && $result->num_rows() > 0)
|
||||
{
|
||||
$payload = [
|
||||
'success' => TRUE,
|
||||
'message' => 'Nation found',
|
||||
'data' => $result->result()[0]
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
$payload = [
|
||||
'success' => FALSE,
|
||||
'message' => 'Nation not found'
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
|
||||
public function getFederalState()
|
||||
{
|
||||
$result = $this->NationModel->getFederalState();
|
||||
|
||||
if(!is_null($result) && $result->num_rows() > 0)
|
||||
{
|
||||
$payload = [
|
||||
'success' => TRUE,
|
||||
'message' => 'Bundesland found',
|
||||
'data' => $result->result_array()
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
$payload = [
|
||||
'success' => FALSE,
|
||||
'message' => 'Bundesland not found'
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* FH-Complete
|
||||
*
|
||||
@@ -13,97 +12,74 @@
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (! defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
if(!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Person extends APIv1_Controller
|
||||
class Person extends REST_Controller
|
||||
{
|
||||
/**
|
||||
* Person API constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
/**
|
||||
* Person API constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('person/person_model');
|
||||
}
|
||||
// Load model PersonModel
|
||||
$this->load->model('person/person_model', 'PersonModel');
|
||||
// Load set the addonID of the model to let to check the permissions
|
||||
$this->PersonModel->setAddonID($this->_getAddonID());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function person_get()
|
||||
{
|
||||
//if(!$this->session_model->validate($this->get('session_id'), $this->get('device_id')))
|
||||
// $this->response(array(['success' => false, 'message' => 'access denied']), REST_Controller::HTTP_UNAUTHORIZED);
|
||||
|
||||
public function getPerson()
|
||||
{
|
||||
$personID = $this->get('person_id');
|
||||
$code = $this->get('code');
|
||||
$email = $this->get('email');
|
||||
$person_id = $this->get('person_id');
|
||||
|
||||
if ((!is_null($code)) && (!is_null($email)))
|
||||
$result = $this->PersonModel->getPerson($personID, $code, $email);
|
||||
|
||||
if(!is_null($result) && $result->num_rows() > 0)
|
||||
{
|
||||
$result = $this->person_model->getPersonByCodeAndEmail($code, $email);
|
||||
}
|
||||
elseif (! is_null($code))
|
||||
{
|
||||
$result = $this->person_model->getPersonByCode($code);
|
||||
}
|
||||
elseif (! is_null($person_id))
|
||||
{
|
||||
$result = $this->person_model->getPerson($person_id);
|
||||
if($result->num_rows() > 1)
|
||||
{
|
||||
$payload = [
|
||||
'success' => TRUE,
|
||||
'message' => 'People found',
|
||||
'data' => $result->result()[0]
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
else if($result->num_rows() == 1)
|
||||
{
|
||||
$payload = [
|
||||
'success' => TRUE,
|
||||
'message' => 'Person found',
|
||||
'data' => $result->result()[0]
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->person_model->getPerson();
|
||||
}
|
||||
|
||||
if ($result['err'])
|
||||
{
|
||||
$payload = [
|
||||
'success' => false,
|
||||
'message' => $result['msg'].': '.$result['retval']
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
// return all available persons
|
||||
$payload = [
|
||||
'success' => true,
|
||||
'message' => 'Persons found'
|
||||
];
|
||||
$payload['data'] = $result;
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
|
||||
if (empty($result))
|
||||
{
|
||||
$payload = [
|
||||
'success' => false,
|
||||
'message' => 'Person not found'
|
||||
'success' => FALSE,
|
||||
'message' => 'Person not found'
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
// return all available persons
|
||||
$payload = [
|
||||
'success' => true,
|
||||
'message' => 'Persons found'
|
||||
];
|
||||
$payload['data'] = $result;
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
// Set the response and exit
|
||||
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function person_post()
|
||||
{
|
||||
$result = $this->person_model->savePerson($this->post());
|
||||
if ($result != false)
|
||||
public function postPerson()
|
||||
{
|
||||
$result = $this->PersonModel->savePerson($this->post());
|
||||
|
||||
if($result === TRUE)
|
||||
{
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
$payload = [
|
||||
@@ -121,40 +97,14 @@ class Person extends APIv1_Controller
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function personUpdate_post()
|
||||
{
|
||||
$result = $this->person_model->updatePerson($this->post());
|
||||
if ($result != false)
|
||||
{
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
$payload = [
|
||||
'success' => true,
|
||||
'message' => 'Person updated.'
|
||||
];
|
||||
$payload['data'] = $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$payload = [
|
||||
'success' => false,
|
||||
'message' => 'Could not update person.'
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function checkBewerbung_get()
|
||||
{
|
||||
$result = $this->person_model->checkBewerbung($this->get("email"), $this->get("studiensemester_kurzbz"));
|
||||
public function getCheckBewerbung()
|
||||
{
|
||||
$result = $this->PersonModel->checkBewerbung($this->get("email"), $this->get("studiensemester_kurzbz"));
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
$payload = [
|
||||
'success' => true,
|
||||
@@ -162,16 +112,16 @@ class Person extends APIv1_Controller
|
||||
];
|
||||
$payload['data'] = $result;
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function checkZugangscodePerson_get()
|
||||
{
|
||||
$result = $this->person_model->checkZugangscodePerson($this->get("code"));
|
||||
public function getCheckZugangscodePerson()
|
||||
{
|
||||
$result = $this->PersonModel->checkZugangscodePerson($this->get("code"));
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
if (!empty($result))
|
||||
if(!empty($result))
|
||||
{
|
||||
$payload = [
|
||||
'success' => true,
|
||||
@@ -189,5 +139,32 @@ class Person extends APIv1_Controller
|
||||
}
|
||||
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function postInterestedStudent()
|
||||
{
|
||||
$result = $this->PersonModel->saveInterestedStudent($this->post());
|
||||
|
||||
if($result === TRUE)
|
||||
{
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
$payload = [
|
||||
'success' => true,
|
||||
'message' => 'Interested student saved.'
|
||||
];
|
||||
$payload['data'] = $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$payload = [
|
||||
'success' => false,
|
||||
'message' => 'Could not save interested student.'
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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 Course extends REST_Controller
|
||||
{
|
||||
/**
|
||||
* Course API constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model PersonModel
|
||||
$this->load->model('studies/course_model', 'CourseModel');
|
||||
// Load set the addonID of the model to let to check the permissions
|
||||
$this->CourseModel->setAddonID($this->_getAddonID());
|
||||
}
|
||||
|
||||
public function getEnabledCourses()
|
||||
{
|
||||
$result = $this->CourseModel->getEnabledCourses();
|
||||
|
||||
if(!is_null($result) && $result->num_rows() > 0)
|
||||
{
|
||||
$payload = [
|
||||
'success' => TRUE,
|
||||
'message' => 'Courses found',
|
||||
'data' => $result->result()[0]
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
$payload = [
|
||||
'success' => FALSE,
|
||||
'message' => 'Person not found'
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?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 Plan extends REST_Controller
|
||||
{
|
||||
/**
|
||||
* Course API constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model PersonModel
|
||||
$this->load->model('studies/plan_model', 'PlanModel');
|
||||
// Load set the addonID of the model to let to check the permissions
|
||||
$this->PlanModel->setAddonID($this->_getAddonID());
|
||||
}
|
||||
|
||||
public function getCurricula()
|
||||
{
|
||||
$courseOfStudiesID = $this->get('studiengang_kz');
|
||||
|
||||
$result = $this->PlanModel->getCurricula($courseOfStudiesID);
|
||||
|
||||
if(!is_null($result) && $result->num_rows() > 0)
|
||||
{
|
||||
$payload = [
|
||||
'success' => TRUE,
|
||||
'message' => 'Curricula found',
|
||||
'data' => $result->result()[0]
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
$payload = [
|
||||
'success' => FALSE,
|
||||
'message' => 'Curricula not found'
|
||||
];
|
||||
$httpstatus = REST_Controller::HTTP_OK;
|
||||
}
|
||||
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user