mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
add semester filter for tags
- in detailheader: use currentSem for manual triggering and refactor formatter - in list: preload list of ids with start and end for tabulator formatter to enable filtering
This commit is contained in:
@@ -15,11 +15,12 @@ class Tag_Controller extends FHCAPI_Controller
|
||||
'getTag' => self::BERECHTIGUNG_KURZBZ,
|
||||
'getTags' => self::BERECHTIGUNG_KURZBZ,
|
||||
'addTag' => self::BERECHTIGUNG_KURZBZ,
|
||||
|
||||
'updateTag' => self::BERECHTIGUNG_KURZBZ,
|
||||
'doneTag' => self::BERECHTIGUNG_KURZBZ,
|
||||
'deleteTag' => self::BERECHTIGUNG_KURZBZ,
|
||||
'getAllTags' => self::BERECHTIGUNG_KURZBZ,
|
||||
'getSemDates' => self::BERECHTIGUNG_KURZBZ,
|
||||
'getAllStartAndEndAutomatedTags' => self::BERECHTIGUNG_KURZBZ,
|
||||
'rebuildTagsForTypeId' => self::BERECHTIGUNG_KURZBZ,
|
||||
];
|
||||
|
||||
@@ -341,16 +342,46 @@ class Tag_Controller extends FHCAPI_Controller
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$typeId = $this->input->post('typeId');
|
||||
$semester = $this->input->post('sem');
|
||||
|
||||
$result = $this->taglib->rebuildTagsForTypeId($typeId, $id, $semester);
|
||||
|
||||
$result = $this->taglib->rebuildTagsForTypeId($typeId, $id);
|
||||
//TODO (refactor; um semester, studiengang_kz)
|
||||
//$result = $this->taglib->rebuildTagsForTypeId($params);
|
||||
if (isError($result))
|
||||
return error ('Error occurred during updateAutomatedTags');
|
||||
|
||||
$this->terminateWithSuccess($result);
|
||||
}
|
||||
|
||||
public function getSemDates()
|
||||
{
|
||||
$studiensemester_kurzbz = $this->input->get('semester');
|
||||
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
$result = $this->StudiensemesterModel->loadWhere(array('studiensemester_kurzbz' => $studiensemester_kurzbz));
|
||||
if (isError($result))
|
||||
return error('Error occurred during retrieving studiensemester');
|
||||
$data = getData($result);
|
||||
$this->terminateWithSuccess(current($data));
|
||||
|
||||
}
|
||||
|
||||
public function getAllStartAndEndAutomatedTags()
|
||||
{
|
||||
$this->NotizModel->addSelect('notiz_id as id');
|
||||
$this->NotizModel->addSelect('start');
|
||||
$this->NotizModel->addSelect('ende');
|
||||
$this->NotizModel->addSelect('typ');
|
||||
|
||||
$result = $this->NotizModel->loadWhere(array(
|
||||
'titel' => 'TAG',
|
||||
'verfasser_uid' => 'sftest'
|
||||
));
|
||||
|
||||
if (isError($result))
|
||||
return error('Error occurred during retrieving intervalls automated tags');
|
||||
$data = getData($result);
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
private function _setAuthUID()
|
||||
{
|
||||
$this->_uid = getAuthUID();
|
||||
|
||||
@@ -241,21 +241,18 @@ class TagLib
|
||||
/*
|
||||
* main function for rebuild Tags for typeId
|
||||
* */
|
||||
public function rebuildTagsForTypeId($typeId, $id) //TODO aktSem of frontend
|
||||
public function rebuildTagsForTypeId($typeId, $id, $studiensemester_kurzbz)
|
||||
{
|
||||
$automatedTagsRes = $this->_ci->NotiztypModel->loadWhere(array('automatisiert' => true, 'taglib IS NOT NULL' => null));
|
||||
$automatedTags = hasData($automatedTagsRes) ? getData($automatedTagsRes) : [];
|
||||
|
||||
//TODO change to chosen Studiensemester in frontend
|
||||
$result = $this->_ci->StudiensemesterModel->getAktOrNextSemester();
|
||||
$result = $this->_ci->StudiensemesterModel->load($studiensemester_kurzbz);
|
||||
if (isError($result))
|
||||
return error('Error occurred during retrieving studiensemester');
|
||||
if (empty($result->retval) || !isset($result->retval[0])) {
|
||||
return error('No studiensemester found');
|
||||
}
|
||||
$studiensemester_kurzbz = $result->retval[0]->studiensemester_kurzbz ?? null;
|
||||
|
||||
//for checkDelete
|
||||
$startSem = $result->retval[0]->start ?? null;
|
||||
$endeSem = $result->retval[0]->ende ?? null;
|
||||
$return = [];
|
||||
|
||||
Reference in New Issue
Block a user