mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-18 12:39:29 +00:00
add tagFilter for semester to students endpoint, add decoding jsonResult in Tags
This commit is contained in:
@@ -147,7 +147,7 @@ class Students extends FHCAPI_Controller
|
||||
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->decodeTagsJsonInResult($data);
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ class Students extends FHCAPI_Controller
|
||||
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->decodeTagsJsonInResult($data);
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ class Students extends FHCAPI_Controller
|
||||
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->decodeTagsJsonInResult($data);
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ class Students extends FHCAPI_Controller
|
||||
$result = $this->PrestudentModel->loadWhere($where);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->decodeTagsJsonInResult($data);
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
@@ -628,10 +628,22 @@ class Students extends FHCAPI_Controller
|
||||
$result = $this->PrestudentModel->loadWhere($where);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->decodeTagsJsonInResult($data);
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
protected function decodeTagsJsonInResult(&$data)
|
||||
{
|
||||
if(defined('STV_TAGS_ENABLED') && STV_TAGS_ENABLED) {
|
||||
array_walk($data, function($item, $key) {
|
||||
if(isset($item->tags))
|
||||
{
|
||||
$item->tags = json_decode($item->tags);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prestudent_id
|
||||
*
|
||||
@@ -676,7 +688,7 @@ class Students extends FHCAPI_Controller
|
||||
]);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->decodeTagsJsonInResult($data);
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
@@ -719,7 +731,7 @@ class Students extends FHCAPI_Controller
|
||||
]);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->decodeTagsJsonInResult($data);
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
@@ -761,7 +773,7 @@ class Students extends FHCAPI_Controller
|
||||
]);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->decodeTagsJsonInResult($data);
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
@@ -836,7 +848,7 @@ class Students extends FHCAPI_Controller
|
||||
$result = $this->PrestudentModel->load();
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->decodeTagsJsonInResult($data);
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
@@ -878,12 +890,31 @@ class Students extends FHCAPI_Controller
|
||||
n.text AS notiz,
|
||||
nt.style,
|
||||
n.erledigt AS done,
|
||||
nz.prestudent_id
|
||||
nz.prestudent_id,
|
||||
n.start,
|
||||
n.ende
|
||||
FROM public.tbl_notizzuordnung AS nz
|
||||
JOIN public.tbl_notiz AS n ON nz.notiz_id = n.notiz_id
|
||||
JOIN public.tbl_notiz_typ AS nt ON n.typ = nt.typ_kurzbz "
|
||||
. $whereTags .
|
||||
"
|
||||
WHERE
|
||||
COALESCE(n.start, '1970-01-01') <= (
|
||||
SELECT
|
||||
ende
|
||||
FROM
|
||||
public.tbl_studiensemester
|
||||
WHERE
|
||||
studiensemester_kurzbz = '{$studiensemester_kurzbz}'
|
||||
)
|
||||
AND COALESCE(n.ende, '2170-12-31') >= (
|
||||
SELECT
|
||||
start
|
||||
FROM
|
||||
public.tbl_studiensemester
|
||||
WHERE
|
||||
studiensemester_kurzbz = '{$studiensemester_kurzbz}'
|
||||
)
|
||||
) AS tag
|
||||
GROUP BY tag.prestudent_id
|
||||
) AS tag_data_agg
|
||||
|
||||
Reference in New Issue
Block a user