mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 22:42:16 +00:00
Added method isLektor()
This method checks if a given user is a lector (and eventually if is fix employed)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user