Added method isLektor()

This method checks if a given user is a lector (and eventually if is
fix employed)
This commit is contained in:
Cris
2019-09-24 10:13:08 +02:00
committed by hainberg
parent 3abfaebb1a
commit a910527109
@@ -11,4 +11,33 @@ class Mitarbeiter_model extends DB_Model
$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;
}
}
}