mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
d8cd786079
- application/libraries/* -> CS compliant - FHC_Model isEntitled method now return error() or success() - Updated all code that uses isEntitled method from FHC_Model - Removed Squiz.PHP.DisallowSizeFunctionsInLoops from CS ruleset - Removed depracated method replace from DB_Model - Removed unused method pgArrayPhp from DB_Model - Renamed method arrayMergeIndex to _arrayCombine in DB_Model and set as private - Added method _manageUDFs to DB_Model (a wrapper for UDFLib->manageUDFs)
85 lines
1.9 KiB
PHP
85 lines
1.9 KiB
PHP
<?php
|
|
|
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class ReihungstestLib
|
|
{
|
|
/**
|
|
* Object initialization
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->ci =& get_instance();
|
|
|
|
$this->ci->load->model('crm/RtPerson_model', 'RtPersonModel');
|
|
$this->ci->load->model('crm/Reihungstest_model', 'ReihungstestModel');
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function insertPersonReihungstest($ddReihungstest)
|
|
{
|
|
if (isset($ddReihungstest['rt_id']) && $this->checkAvailability($ddReihungstest['rt_id']))
|
|
{
|
|
return $this->ci->RtPersonModel->insert($ddReihungstest);
|
|
}
|
|
else
|
|
{
|
|
return error('This test is not more available');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function updatePersonReihungstest($ddReihungstest)
|
|
{
|
|
$pksArray = array($ddReihungstest['person_id'], $ddReihungstest['rt_id']);
|
|
|
|
return $this->ci->RtPersonModel->update($pksArray, $ddReihungstest);
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function deletePersonReihungstest($ddReihungstest)
|
|
{
|
|
return $this->ci->RtPersonModel->delete($ddReihungstest['rt_person_id'], $ddReihungstest);
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function getReihungstestByPersonID($person_id, $available = null)
|
|
{
|
|
$this->ci->ReihungstestModel->addJoin('public.tbl_rt_person', 'reihungstest_id = rt_id');
|
|
$this->ci->ReihungstestModel->addJoin('public.tbl_person', 'person_id');
|
|
$this->ci->ReihungstestModel->addJoin('public.tbl_ort', 'tbl_ort.ort_kurzbz = tbl_rt_person.ort_kurzbz', 'LEFT');
|
|
|
|
$parametersArray = array('person_id' => $person_id);
|
|
|
|
if (isset($available))
|
|
{
|
|
$parametersArray['anmeldefrist >='] = 'NOW()';
|
|
}
|
|
|
|
return $this->ci->ReihungstestModel->loadWhere($parametersArray);
|
|
}
|
|
|
|
/**
|
|
* It checks if the test is available
|
|
*/
|
|
public function checkAvailability($reihungstest_id)
|
|
{
|
|
$result = $this->ci->ReihungstestModel->checkAvailability($reihungstest_id);
|
|
|
|
if (hasData($result))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|