mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-18 15:32:17 +00:00
adds the endpoint that fetches all ampeln of a user that are not confirmed by the user yet and also removes some unnecessary comments from other enpoints
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Ampeln extends FHCAPI_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Object initialization
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct([
|
||||
'getAmpeln' => self::PERM_LOGGED,
|
||||
|
||||
]);
|
||||
|
||||
|
||||
$this->load->model('content/Ampel_model', 'AmpelModel');
|
||||
|
||||
|
||||
//? put the uid and pid inside the controller for reusability
|
||||
$this->uid = getAuthUID();
|
||||
$this->pid = getAuthPersonID();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
|
||||
/**
|
||||
* function that queries all the ampeln that are addressed to the user uid
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
public function getAmpeln()
|
||||
{
|
||||
$userAmpeln = array();
|
||||
$ampel_result = $this->AmpelModel->active();
|
||||
|
||||
$ampel_result = $this->getDataOrTerminateWithError($ampel_result);
|
||||
|
||||
$is_confirmed_array = array();
|
||||
foreach($ampel_result as $ampel){
|
||||
|
||||
$confirmedByUser = $this->AmpelModel->isConfirmed($ampel->ampel_id,$this->uid);
|
||||
if(!$confirmedByUser){
|
||||
$userUID_array = $this->AmpelModel->execBenutzerSelect($ampel->benutzer_select);
|
||||
$userUID_array = $this->getDataOrTerminateWithError($userUID_array);
|
||||
foreach($userUID_array as $user_obj){
|
||||
|
||||
$user_uid = property_exists($user_obj,"uid") ? $user_obj->uid : $user_obj->mitarbeiter_uid;
|
||||
if($user_uid === $this->uid){
|
||||
$userAmpeln[] = $ampel;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess($userAmpeln);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -18,11 +18,6 @@
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This controller operates between (interface) the JS (GUI) and the SearchBarLib (back-end)
|
||||
* Provides data to the ajax get calls about the searchbar component
|
||||
* This controller works with JSON calls on the HTTP GET and the output is always JSON
|
||||
*/
|
||||
class Profil extends FHCAPI_Controller
|
||||
{
|
||||
|
||||
|
||||
@@ -18,11 +18,6 @@
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This controller operates between (interface) the JS (GUI) and the SearchBarLib (back-end)
|
||||
* Provides data to the ajax get calls about the searchbar component
|
||||
* This controller works with JSON calls on the HTTP GET and the output is always JSON
|
||||
*/
|
||||
class ProfilUpdate extends FHCAPI_Controller
|
||||
{
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
export default {
|
||||
|
||||
getAmpeln: function () {
|
||||
return this.$fhcApi.get(
|
||||
FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
`/api/frontend/v1/Ampeln/getAmpeln`,{});
|
||||
},
|
||||
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import filter from "./filter.js";
|
||||
import studstatus from "./studstatus.js";
|
||||
import profil from "./profil.js";
|
||||
import profilUpdate from "./profilUpdate.js";
|
||||
import ampeln from "./ampeln.js";
|
||||
|
||||
export default {
|
||||
search,
|
||||
@@ -31,4 +32,5 @@ export default {
|
||||
studstatus,
|
||||
profil,
|
||||
profilUpdate,
|
||||
ampeln,
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import FhcDashboard from '../../components/Dashboard/Dashboard.js';
|
||||
import Phrasen from "../../plugin/Phrasen.js"
|
||||
|
||||
const app = Vue.createApp({
|
||||
data: () => ({
|
||||
@@ -9,4 +10,5 @@ const app = Vue.createApp({
|
||||
}
|
||||
});
|
||||
app.config.unwrapInjectedRef = true;
|
||||
app.use(Phrasen);
|
||||
app.mount('#content');
|
||||
|
||||
Reference in New Issue
Block a user