mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 15:04:04 +00:00
Studienjahr getAktNext endpoint
This commit is contained in:
@@ -24,7 +24,8 @@ class Studienjahr extends FHCAPI_Controller
|
||||
parent::__construct(
|
||||
array(
|
||||
'getAll' => self::PERM_LOGGED,
|
||||
'getNext' => self::PERM_LOGGED
|
||||
'getNext' => self::PERM_LOGGED,
|
||||
'getAktNext' => self::PERM_LOGGED
|
||||
)
|
||||
);
|
||||
// Load model StudiensemesterModel
|
||||
@@ -77,4 +78,32 @@ class Studienjahr extends FHCAPI_Controller
|
||||
|
||||
$this->terminateWithSuccess(current(getData($result)));
|
||||
}
|
||||
|
||||
public function getAktNext()
|
||||
{
|
||||
$this->StudienjahrModel->addJoin('public.tbl_studiensemester', 'studienjahr_kurzbz');
|
||||
$this->StudienjahrModel->addOrder('ende');
|
||||
$this->StudienjahrModel->addLimit(1);
|
||||
|
||||
$result = $this->StudienjahrModel->loadWhere([
|
||||
'start <=' => 'NOW()',
|
||||
'ende >=' => 'NOW()'
|
||||
]);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
if (!$data) {
|
||||
$this->StudienjahrModel->addJoin('public.tbl_studiensemester', 'studienjahr_kurzbz');
|
||||
$this->StudienjahrModel->addOrder('ende');
|
||||
$this->StudienjahrModel->addLimit(1);
|
||||
|
||||
$result = $this->StudienjahrModel->loadWhere([
|
||||
'ende >=' => 'NOW()'
|
||||
]);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess(current($data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (C) 2026 fhcomplete.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export default {
|
||||
getAktNext() {
|
||||
return {
|
||||
method: 'get',
|
||||
url: '/api/frontend/v1/organisation/studienjahr/getAktNext',
|
||||
};
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user