mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 22:42:16 +00:00
Merge branch 'feature-25999/SearchbarStudent'
This commit is contained in:
@@ -88,7 +88,7 @@ class Profil extends FHCAPI_Controller
|
||||
$res->data = $this->studentProfil();
|
||||
$res->data->pid = $this->pid;
|
||||
}
|
||||
|
||||
// editing your own profil - true
|
||||
$editAllowed = true;
|
||||
}
|
||||
// UID is availabe when accessing Profil/View/:uid
|
||||
@@ -495,12 +495,11 @@ class Profil extends FHCAPI_Controller
|
||||
*/
|
||||
private function getPersonInfo($uid, $geburtsInfo = null)
|
||||
{
|
||||
$selectClause = ["foto", "anrede", "titelpost as postnomen", "titelpre as titel", "vorname", "nachname"];
|
||||
$selectClause = ["foto", "foto_sperre", "anrede", "titelpost as postnomen", "titelpre as titel", "vorname", "nachname"];
|
||||
/** @param integer $geburtsInfo */
|
||||
if ($geburtsInfo) {
|
||||
array_push($selectClause, "gebort");
|
||||
array_push($selectClause, "gebdatum");
|
||||
array_push($selectClause, "foto_sperre");
|
||||
}
|
||||
$this->BenutzerModel->addSelect($selectClause);
|
||||
$this->BenutzerModel->addJoin("tbl_person", "person_id");
|
||||
@@ -512,6 +511,12 @@ class Profil extends FHCAPI_Controller
|
||||
$person_res = hasData($person_res) ? getData($person_res)[0] : null;
|
||||
}
|
||||
|
||||
if( ($person_res->foto === null) || (($this->uid !== $uid) && ($person_res->foto_sperre !== false)) )
|
||||
{
|
||||
$dummy_foto = base64_encode(file_get_contents(DOC_ROOT.'skin/images/profilbild_dummy.jpg'));
|
||||
$person_res->foto = $dummy_foto;
|
||||
}
|
||||
|
||||
return $person_res;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class SearchBarLib
|
||||
const ERROR_NOT_AUTH = 'ERR005';
|
||||
|
||||
// List of allowed types of search
|
||||
const ALLOWED_TYPES = ['mitarbeiter', 'mitarbeiter_ohne_zuordnung', 'organisationunit', 'raum', 'person', 'student', 'prestudent', 'document', 'cms'];
|
||||
const ALLOWED_TYPES = ['mitarbeiter', 'mitarbeiter_ohne_zuordnung', 'organisationunit', 'raum', 'person', 'student','studentStv', 'prestudent', 'document', 'cms'];
|
||||
|
||||
const PHOTO_IMG_URL = '/cis/public/bild.php?src=person&person_id=';
|
||||
|
||||
@@ -362,17 +362,26 @@ 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,
|
||||
s.student_uid AS uid,
|
||||
CONCAT(s.student_uid,\'@'.DOMAIN.'\') AS email,
|
||||
s.matrikelnr,
|
||||
CONCAT(UPPER(stg.typ),UPPER(stg.kurzbz),\'-\',s.semester,s.verband) as verband,
|
||||
stg.bezeichnung AS studiengang,
|
||||
p.person_id AS person_id,
|
||||
p.vorname || \' \' || p.nachname AS name,
|
||||
k.kontakt as email ,
|
||||
p.foto
|
||||
CASE
|
||||
when s.student_uid = \''.getAuthUID().'\' then p.foto
|
||||
when p.foto IS NULL then \''.$gesperrtes_foto.'\'
|
||||
when p.foto_sperre = false then p.foto
|
||||
else \''.$gesperrtes_foto.'\'
|
||||
end as foto,
|
||||
b.aktiv
|
||||
FROM public.tbl_student s
|
||||
JOIN public.tbl_studiengang stg USING(studiengang_kz)
|
||||
JOIN public.tbl_benutzer b ON(b.uid = s.student_uid)
|
||||
JOIN public.tbl_person p USING(person_id)
|
||||
LEFT JOIN (
|
||||
@@ -380,10 +389,57 @@ EOSC;
|
||||
FROM public.tbl_kontakt
|
||||
WHERE kontakttyp = \'email\'
|
||||
) as k USING(person_id)
|
||||
WHERE b.uid ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
|
||||
WHERE
|
||||
b.aktiv = TRUE
|
||||
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.typ, stg.kurzbz, b.aktiv
|
||||
ORDER BY b.aktiv DESC, p.nachname ASC, p.vorname ASC
|
||||
');
|
||||
|
||||
// If something has been found then return it
|
||||
if (hasData($students)) return getData($students);
|
||||
|
||||
// Otherwise return an empty array
|
||||
return array();
|
||||
}
|
||||
|
||||
private function _studentStv($searchstr, $type)
|
||||
{
|
||||
$dbModel = new DB_Model();
|
||||
|
||||
$students = $dbModel->execReadOnlyQuery('
|
||||
SELECT
|
||||
\''.$type.'\' AS type,
|
||||
s.student_uid AS uid,
|
||||
s.matrikelnr,
|
||||
CONCAT(UPPER(stg.typ),UPPER(stg.kurzbz),\'-\',s.semester,s.verband) as verband,
|
||||
stg.bezeichnung AS studiengang,
|
||||
p.person_id AS person_id,
|
||||
p.vorname || \' \' || p.nachname AS name,
|
||||
k.kontakt AS email,
|
||||
p.foto,
|
||||
b.aktiv
|
||||
FROM public.tbl_student s
|
||||
JOIN public.tbl_studiengang stg USING(studiengang_kz)
|
||||
JOIN public.tbl_benutzer b ON(b.uid = s.student_uid)
|
||||
JOIN public.tbl_person p USING(person_id)
|
||||
LEFT JOIN (
|
||||
SELECT kontakt, person_id
|
||||
FROM public.tbl_kontakt
|
||||
WHERE kontakttyp = \'email\'
|
||||
) as k USING(person_id)
|
||||
WHERE
|
||||
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
|
||||
GROUP BY type, s.student_uid, s.matrikelnr, p.person_id, name,
|
||||
k.kontakt, p.foto, s.verband, s.semester, stg.bezeichnung,
|
||||
stg.typ, stg.kurzbz, b.aktiv
|
||||
ORDER BY b.aktiv DESC, p.nachname ASC, p.vorname ASC
|
||||
');
|
||||
|
||||
// If something has been found then return it
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
width: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
box-shadow: 2px 2px 4px rgba(0, 0, 0, .4);
|
||||
}
|
||||
|
||||
.searchbar_results_scroller {
|
||||
@@ -109,3 +110,7 @@
|
||||
-moz-user-select: none; /* Firefox */
|
||||
-ms-user-select: none; /* IE/Edge */
|
||||
}
|
||||
|
||||
.searchbar_inaktiv {
|
||||
opacity: .6;
|
||||
}
|
||||
@@ -18,6 +18,7 @@ const app = Vue.createApp({
|
||||
calcheightonly: true,
|
||||
types: [
|
||||
"mitarbeiter",
|
||||
"student",
|
||||
"raum",
|
||||
"organisationunit"
|
||||
],
|
||||
@@ -33,6 +34,17 @@ const app = Vue.createApp({
|
||||
},
|
||||
childactions: []
|
||||
},
|
||||
student: {
|
||||
defaultaction: {
|
||||
type: "link",
|
||||
action: function (data) {
|
||||
return FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
"/Cis/Profil/View/" + data.uid;
|
||||
|
||||
}
|
||||
},
|
||||
childactions: []
|
||||
},
|
||||
raum: {
|
||||
defaultaction: {
|
||||
type: "link",
|
||||
|
||||
@@ -70,7 +70,7 @@ export default {
|
||||
cssclass: "position-relative",
|
||||
calcheightonly: true,
|
||||
types: [
|
||||
"student",
|
||||
"studentStv",
|
||||
"prestudent"
|
||||
],
|
||||
actions: {
|
||||
|
||||
@@ -52,7 +52,7 @@ export default {
|
||||
<div v-else-if="searchresult.length < 1">Es wurden keine Ergebnisse gefunden.</div>
|
||||
<template v-else="" v-for="res in searchresult">
|
||||
<person v-if="res.type === 'person'" :res="res" :actions="this.searchoptions.actions.person" @actionexecuted="this.hideresult"></person>
|
||||
<student v-else-if="res.type === 'student'" :res="res" :actions="this.searchoptions.actions.student" @actionexecuted="this.hideresult"></student>
|
||||
<student v-else-if="res.type === 'student' || res.type === 'studentStv'" :res="res" :actions="this.searchoptions.actions.student" @actionexecuted="this.hideresult"></student>
|
||||
<prestudent v-else-if="res.type === 'prestudent'" :res="res" :actions="this.searchoptions.actions.prestudent" @actionexecuted="this.hideresult"></prestudent>
|
||||
<employee v-else-if="res.type === 'mitarbeiter' || res.type === 'mitarbeiter_ohne_zuordnung'" :res="res" :actions="this.searchoptions.actions.employee" @actionexecuted="this.hideresult"></employee>
|
||||
<organisationunit v-else-if="res.type === 'organisationunit'" :res="res" :actions="this.searchoptions.actions.organisationunit" @actionexecuted="this.hideresult"></organisationunit>
|
||||
|
||||
@@ -9,14 +9,14 @@ export default {
|
||||
},
|
||||
emits: [ 'actionexecuted' ],
|
||||
template: `
|
||||
<div class="searchbar_result searchbar_student">
|
||||
<div class="searchbar_result searchbar_student" :class="(!res?.aktiv) ? 'searchbar_inaktiv' : ''">
|
||||
|
||||
<div class="searchbar_grid">
|
||||
<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"
|
||||
class="rounded-circle" height="100"/>
|
||||
:src="studentImage"
|
||||
class="rounded" style="max-height: 120px; max-width: 90px;" />
|
||||
<i v-else class="fas fa-user-circle fa-5x"></i>
|
||||
</action>
|
||||
</div>
|
||||
@@ -29,18 +29,25 @@ export default {
|
||||
<div class="mb-3"></div>
|
||||
|
||||
<div class="searchbar_table">
|
||||
|
||||
|
||||
<div class="searchbar_tablerow">
|
||||
<div class="searchbar_tablecell">Student_uid</div>
|
||||
<div class="searchbar_tablecell">Student UID</div>
|
||||
<div class="searchbar_tablecell">
|
||||
{{ res.uid }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="searchbar_tablerow">
|
||||
<div class="searchbar_tablecell">Person_id</div>
|
||||
<div class="searchbar_tablecell">Studiengang</div>
|
||||
<div class="searchbar_tablecell">
|
||||
{{ res.person_id }}
|
||||
{{ res.studiengang }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="searchbar_tablerow">
|
||||
<div class="searchbar_tablecell">Verband</div>
|
||||
<div class="searchbar_tablecell">
|
||||
{{ res.verband }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -75,6 +82,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);
|
||||
},
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user