Files
FHC-Core/application/models/ressource/Mitarbeiter_model.php
T
Cris a910527109 Added method isLektor()
This method checks if a given user is a lector (and eventually if is
fix employed)
2019-09-24 10:13:08 +02:00

44 lines
940 B
PHP

<?php
class Mitarbeiter_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_mitarbeiter';
$this->pk = 'mitarbeiter_uid';
}
/**
* Checks if the user is a lector.
* @param string $uid
* @param boolean null $fixangestellt
* @return bool
*/
public function isLektor($uid, $fixangestellt = null)
{
$this->addSelect('1');
if (is_bool($fixangestellt))
{
$result = $this->loadWhere(array('mitarbeiter_uid' => $uid, 'lektor' => true, 'fixangestellt' => $fixangestellt));
}
else // Default: if lektor is true
{
$result = $this->loadWhere(array('mitarbeiter_uid' => $uid, 'lektor' => true));
}
if(hasData($result))
{
return true;
}
else
{
return false;
}
}
}