update(Searchbar/Student):shows dummy image if the student has foto_spere true

This commit is contained in:
SimonGschnell
2024-12-13 10:47:34 +01:00
parent 9a1777d1aa
commit a3840d4c77
2 changed files with 13 additions and 12 deletions
+7 -3
View File
@@ -362,7 +362,7 @@ EOSC;
private function _student($searchstr, $type)
{
$dbModel = new DB_Model();
$gesperrtes_foto = base64_encode(file_get_contents(DOC_ROOT.'skin/images/profilbild_dummy.jpg'));
$students = $dbModel->execReadOnlyQuery('
SELECT
\''.$type.'\' AS type,
@@ -373,7 +373,11 @@ EOSC;
stg.bezeichnung AS studiengang,
p.person_id AS person_id,
p.vorname || \' \' || p.nachname AS name,
p.foto
CASE
when s.student_uid = \''.getAuthUID().'\' then p.foto
when p.foto_sperre = false then p.foto
else \''.$gesperrtes_foto.'\'
end as foto
FROM public.tbl_student s
JOIN public.tbl_studiengang stg USING(studiengang_kz)
JOIN public.tbl_benutzer b ON(b.uid = s.student_uid)
@@ -388,7 +392,7 @@ EOSC;
AND (b.uid ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR p.vorname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR p.nachname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\')
GROUP BY type, s.student_uid, s.matrikelnr, p.person_id, name, email, p.foto, s.verband, s.semester, stg.bezeichnung, stg.kurzbzlang
GROUP BY type, s.student_uid, s.matrikelnr, p.person_id, name, email, p.foto, s.verband, s.semester, stg.bezeichnung, stg.kurzbzlang
');
// If something has been found then return it
+6 -9
View File
@@ -15,7 +15,7 @@ export default {
<div class="searchbar_icon">
<action :res="this.res" :action="this.actions.defaultaction" @actionexecuted="$emit('actionexecuted')">
<img v-if="(typeof res.foto !== 'undefined') && (res.foto !== null)"
:src="'data:image/jpeg;base64,' + res.foto"
:src="studentImage"
class="rounded" style="max-height: 120px; max-width: 90px;" />
<i v-else class="fas fa-user-circle fa-5x"></i>
</action>
@@ -30,13 +30,6 @@ export default {
<div class="searchbar_table">
<div class="searchbar_tablerow">
<div class="searchbar_tablecell">Student_uid</div>
<div class="searchbar_tablecell">
{{ res.uid }}
</div>
</div>
<div class="searchbar_tablerow">
<div class="searchbar_tablecell">Studiengang</div>
<div class="searchbar_tablecell">
@@ -82,6 +75,10 @@ export default {
computed: {
mailtourl: function() {
return 'mailto:' + this.res.email;
}
},
studentImage: function () {
if (!this.res.foto) return;
return 'data:image/jpeg;base64,'.concat(this.res.foto);
},
}
};