Merge branch 'master' into permissions

- Added new core controller called Auth_Controller that extends FHC_Controller and manage the authentication
- All the controllers that were extending the CI_Controller now they extend the FHC_Controller
- All the controllers that were extending the FHC_Controller now they extend the Auth_Controller
- Added the method isAllowed to the FiltersLib to check if the authenticated user has the required permissions
- FilterWidget and controller Filters are using the method isAllowed from the FiltersLib
This commit is contained in:
Paolo
2018-06-08 17:53:12 +02:00
109 changed files with 9580 additions and 4707 deletions
@@ -21,7 +21,9 @@ class Geschaeftsjahr_model extends DB_Model
$query = 'SELECT *
FROM public.tbl_geschaeftsjahr
WHERE start <= now()
AND ende >= now()';
AND ende >= now()
ORDER BY start DESC
LIMIT 1';
return $this->execQuery($query);
}
@@ -12,4 +12,21 @@ class Studienjahr_model extends DB_Model
$this->pk = 'studienjahr_kurzbz';
$this->hasSequence = false;
}
/**
* Gets current Studienjahr, as determined by its start and enddate
* @return array|null
*/
public function getCurrStudienjahr()
{
$query = 'SELECT *
FROM public.tbl_studienjahr
JOIN public.tbl_studiensemester using(studienjahr_kurzbz)
WHERE start <= now()
AND ende >= now()
ORDER by start DESC
LIMIT 1';
return $this->execQuery($query);
}
}
@@ -44,7 +44,6 @@ class Filters_model extends DB_Model
$filterParametersArray = array(
'app' => $app,
'dataset_name' => $dataset_name,
'default_filter' => false,
'array_length(description, 1) >' => 0,
'uid' => $uid
);
@@ -80,4 +80,36 @@ class PersonLog_model extends CI_Model
return success($result->result());
}
/**
* Gets all logs with zeitpunkt > today
* @param $person_id
* @return array
*/
public function getLogsInFuture($person_id)
{
$this->db->order_by('zeitpunkt', 'DESC');
$this->db->order_by('log_id', 'DESC');
$where = "logtype_kurzbz = 'Processstate'
AND person_id=".$this->db->escape($person_id)."
AND zeitpunkt >= now()";
$result = $this->db->get_where($this->dbTable, $where);
return success($result->result());
}
/**
* Deletes a log
* @param $log_id
* @return array
*/
public function deleteLog($log_id)
{
$this->db->where('log_id', $log_id);
$result = $this->db->delete($this->dbTable);
return success($result);
}
}
@@ -71,4 +71,32 @@ class Phrase_model extends DB_Model
return $this->execQuery($query, array($categories, $language));
}
/**
* Loads phrases using category(s) and language as keys using associative category array
* that contains also phrases for each category
*/
public function getPhrasesByCategoryAndPhrasesAndLanguage($phrasesParams, $language)
{
$query = '
SELECT p.category, p.phrase, pt.orgeinheit_kurzbz, pt.orgform_kurzbz, pt.text
FROM system.tbl_phrase p
INNER JOIN system.tbl_phrasentext pt USING(phrase_id)
WHERE pt.sprache = ? AND ';
$parametersArray = array($language);
foreach ($phrasesParams as $category => $phrases)
{
$query .= '(category = ? AND phrase IN ?) OR ';
$parametersArray[] = $category;
$parametersArray[] = $phrases;
}
$query = rtrim($query, ' OR ');
$query .= ' ORDER BY p.category, p.phrase, pt.orgeinheit_kurzbz DESC, pt.orgform_kurzbz DESC';
return $this->execQuery($query, $parametersArray);
}
}