mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-11 00:59:34 +00:00
1d2233152c
Signed-off-by: Cris <hainberg@technikum-wien.at>
55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
class Betriebsmittelperson_model extends DB_Model
|
|
{
|
|
/**
|
|
* Constructor
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->dbTable = 'wawi.tbl_betriebsmittelperson';
|
|
$this->pk = 'betriebsmittelperson_id';
|
|
}
|
|
|
|
/**
|
|
* Get Betriebsmittel by person.
|
|
* @param string $person_id
|
|
* @param string $betriebsmitteltyp
|
|
* @param bool $isRetourniert False to retrieve only active Betriebsmittel.
|
|
* @return array|bool
|
|
*/
|
|
public function getBetriebsmittel($person_id, $betriebsmitteltyp = null, $isRetourniert = null)
|
|
{
|
|
if (!is_numeric($person_id))
|
|
{
|
|
$this->errormsg = 'Person_id type is not valid.';
|
|
return false;
|
|
}
|
|
|
|
$this->addJoin('wawi.tbl_betriebsmittel', 'betriebsmittel_id');
|
|
|
|
$condition = '
|
|
person_id = '. $this->escape($person_id). '
|
|
';
|
|
|
|
if (is_string($betriebsmitteltyp)) {
|
|
$condition .= '
|
|
AND betriebsmitteltyp = ' . $this->escape($betriebsmitteltyp);
|
|
}
|
|
|
|
if ($isRetourniert === true) {
|
|
$condition .= '
|
|
AND retouram IS NOT NULL'; // return date is given
|
|
}
|
|
elseif ($isRetourniert === false)
|
|
{
|
|
$condition .= '
|
|
AND retouram IS NULL'; // default
|
|
}
|
|
|
|
$this->addOrder('ausgegebenam', 'DESC'); // default
|
|
|
|
return $this->loadWhere($condition);
|
|
}
|
|
}
|