mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
corrects the translation of the ampel queries
This commit is contained in:
@@ -74,10 +74,10 @@ class Ampeln extends FHCAPI_Controller
|
||||
|
||||
// fetch active ampeln
|
||||
$activeAmpeln = $this->AmpelModel->active();
|
||||
|
||||
|
||||
$activeAmpeln = $this->getDataOrTerminateWithError($activeAmpeln);
|
||||
|
||||
foreach($activeAmpeln as $ampel){
|
||||
|
||||
foreach($activeAmpeln as $ampel){
|
||||
|
||||
// check if ampel is confirmed by user
|
||||
$confirmedByUser = $this->AmpelModel->isConfirmed($ampel->ampel_id,$this->uid);
|
||||
@@ -108,8 +108,8 @@ class Ampeln extends FHCAPI_Controller
|
||||
$userAmpeln = array();
|
||||
|
||||
$ampel_result = $this->AmpelModel->active();
|
||||
|
||||
$ampel_result = $this->getDataOrTerminateWithError($ampel_result);
|
||||
|
||||
$ampel_result = $this->getDataOrTerminateWithError($ampel_result);
|
||||
|
||||
foreach($ampel_result as $ampel){
|
||||
$confirmedByUser = $this->AmpelModel->isConfirmed($ampel->ampel_id,$this->uid);
|
||||
@@ -120,7 +120,7 @@ class Ampeln extends FHCAPI_Controller
|
||||
|
||||
$zugeteilt = $this->getDataOrTerminateWithError($zugeteilt);
|
||||
|
||||
if($zugeteilt) $userAmpeln[] = $this->translateAmpel($ampel);
|
||||
if($zugeteilt) $userAmpeln[] = $ampel;
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess($userAmpeln);
|
||||
@@ -142,8 +142,7 @@ class Ampeln extends FHCAPI_Controller
|
||||
// check if ampel is confirmed by user
|
||||
$confirmedByUser = $this->AmpelModel->isConfirmed($ampel->ampel_id,$this->uid);
|
||||
$ampel->bestaetigt = $confirmedByUser;
|
||||
// translate ampeln
|
||||
return $this->translateAmpel($ampel);
|
||||
return $ampel;
|
||||
}, $alle_ampeln);
|
||||
|
||||
$this->terminateWithSuccess($alle_ampeln);
|
||||
|
||||
@@ -22,12 +22,12 @@ class Ampel_model extends DB_Model
|
||||
{
|
||||
$userLanguage = getUserLanguage();
|
||||
|
||||
$parametersArray = null;
|
||||
$parametersArray = [];
|
||||
$query = '
|
||||
SELECT *, beschreibung[('.$this->getLanguageIndex($this->escape($userLanguage)).')], buttontext[('. $this->getLanguageIndex($this->escape($userLanguage)).')]
|
||||
SELECT *, beschreibung[('.$this->getLanguageIndex($this->escape($userLanguage)).')] as beschreibung_trans, buttontext[('.$this->getLanguageIndex($this->escape($userLanguage)).')] as buttontext_trans
|
||||
FROM public.tbl_ampel
|
||||
WHERE';
|
||||
|
||||
|
||||
if ($email === true)
|
||||
{
|
||||
$parametersArray['email'] = $email;
|
||||
@@ -108,10 +108,15 @@ class Ampel_model extends DB_Model
|
||||
*/
|
||||
public function confirmAmpel($ampel_id, $uid)
|
||||
{
|
||||
if(isset($ampel_id) && isset($uid))
|
||||
return error("parameter were missing to execute the insert into");
|
||||
|
||||
return $this->execQuery('
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data(['ampel_id' => $ampel_id, 'uid' => $uid]);
|
||||
$this->form_validation->set_rules('ampel_id', 'Ampel ID', 'required|integer');
|
||||
$this->form_validation->set_rules('uid', 'UID', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
return $this->execQuery('
|
||||
INSERT INTO public.tbl_ampel_benutzer_bestaetigt (ampel_id, uid)
|
||||
VALUES (?,?);', array($ampel_id, $uid));
|
||||
}
|
||||
@@ -140,9 +145,8 @@ class Ampel_model extends DB_Model
|
||||
return success(current($zugeteilt)->zugeteilt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// THIS FUNCTION IS NOT IN USE
|
||||
// fetches all ampeln that were assigned to the user after the working start_date
|
||||
function alleAmpeln($uid){
|
||||
$userLanguage = getUserLanguage();
|
||||
|
||||
@@ -157,7 +161,7 @@ class Ampel_model extends DB_Model
|
||||
$benutzerStartDate = $datum->mktime_fromdate(date(current(getData($benutzerStartDate))->insertamum));
|
||||
|
||||
$allAmpeln = $this->execReadOnlyQuery("
|
||||
SELECT *, beschreibung[(".$this->getLanguageIndex($this->escape($userLanguage)).")], buttontext[(".$this->getLanguageIndex($this->escape($userLanguage)).")] FROM
|
||||
SELECT *, beschreibung[(".$this->getLanguageIndex($this->escape($userLanguage)).")] as beschreibung_trans, buttontext[(".$this->getLanguageIndex($this->escape($userLanguage)).")] as buttontext_trans FROM
|
||||
public.tbl_ampel");
|
||||
|
||||
if(isError($allAmpeln)) return error(getError($allAmpeln));
|
||||
|
||||
@@ -139,7 +139,7 @@ export default {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div v-if="activeAmpeln && activeAmpeln.length == 0" class="card card-body mt-4 p-4 text-center">
|
||||
<span class="text-success h2"><i class="fa fa-solid fa-circle-check"></i></span>
|
||||
<span class="text-success h5">{{$p.t('ampeln','super')}}</span><br>
|
||||
@@ -149,7 +149,7 @@ export default {
|
||||
<div v-else>
|
||||
<header class="me-auto"><b>{{$p.t('ampeln','newestAmpeln')}} </b></header>
|
||||
<template v-for="n in WIDGET_AMPEL_MAX">
|
||||
|
||||
|
||||
<div class="mt-2 card" aria-hidden="true">
|
||||
<div class="card-body">
|
||||
<p class="card-text placeholder-glow">
|
||||
@@ -161,7 +161,7 @@ export default {
|
||||
</template>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- All Ampeln Offcanvas -->
|
||||
@@ -196,9 +196,9 @@ export default {
|
||||
<a :href="'#ampelCollapse_' + ampel.ampel_id" data-bs-toggle="collapse" class="stretched-link">{{ ampel.kurzbz }}</a><br>
|
||||
</div>
|
||||
<div class="collapse my-3" :id="'ampelCollapse_' + ampel.ampel_id" :ref="'ampelCollapse_' + ampel.ampel_id">
|
||||
<div v-html="ampel.beschreibung"></div>
|
||||
<div v-html="ampel.beschreibung_trans"></div>
|
||||
<div v-if="!ampel.bestaetigt " class="d-flex justify-content-end mt-3">
|
||||
<button class="btn btn-sm btn-primary" :class="{disabled: ampel.bestaetigt}" @click="confirm(ampel.ampel_id)">{{ validateBtnTxt(ampel.buttontext) }}</button>
|
||||
<button class="btn btn-sm btn-primary" :class="{disabled: ampel.bestaetigt}" @click="confirm(ampel.ampel_id)">{{ validateBtnTxt(ampel.buttontext_trans) }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user