show all contacts in profile

display type firmenhandy if no extension available
added bezeichnung_mehrsprachig to tbl_kontakttyp
This commit is contained in:
Gerald Raab
2018-11-02 15:29:53 +01:00
parent 38d8ea33f7
commit 01826bf88a
5 changed files with 91 additions and 23 deletions
+39 -3
View File
@@ -43,6 +43,7 @@ require_once('../../../include/fotostatus.class.php');
require_once('../../../include/addon.class.php');
require_once('../../../include/gruppe.class.php');
require_once('../../../include/adresse.class.php');
require_once('../../../include/benutzerberechtigung.class.php');
$sprache = getSprache();
$p = new phrasen($sprache);
@@ -52,14 +53,21 @@ if (!$db = new basis_db())
$uid = get_uid();
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($uid);
$datum_obj = new datum();
$ansicht = false; //Wenn ein anderer User sich das Profil ansieht (Bei Personensuche)
if (isset($_GET['uid']))
// Wenn ein anderer User sich das Profil ansieht (Bei Personensuche) sollen bestimmte persönliche Daten nicht angezeigt werden
// außer der User selber oder berechtigte Personen
$ansicht = false;
if (isset($_GET['uid']) && $_GET['uid'] != $uid)
{
$uid = stripslashes($_GET['uid']);
$ansicht = true;
}
if ($rechte->isBerechtigt('basis/kontakt'))
$ansicht = false;
if (!$ansicht && isset($_GET['action']))
{
@@ -232,7 +240,8 @@ echo '</td><td width="30%" valign="top">';
echo '
<b>'.($type == "student"?$p->t("profil/student"):$p->t('profil/mitarbeiter')).'</b><br><br>
'.$p->t('global/username').': '.$user->uid.'<br>';
echo ($type == 'student') ? $p->t('global/matrikelnummer'). ": ". $user->matrikelnr. "<br>" : '';
if ($type == 'student' && $person->matr_nr)
echo $p->t('global/matrikelnummer'). ": ". $person->matr_nr. "<br>";
echo '
'.$p->t('global/anrede').': '.$user->anrede.'<br>
'.$p->t('global/titel').': '.$user->titelpre.' <br>';
@@ -329,6 +338,16 @@ if ($type == 'mitarbeiter')
echo $p->t('profil/telefonTw').": $vorwahl - $user->telefonklappe<BR>";
//echo $p->t('profil/faxTw').": $vorwahl - 99 $user->telefonklappe<BR>";
}
else {
$kontakt = new kontakt();
$kontakt->load_pers($user->person_id);
foreach($kontakt->result as $k)
{
if ($k->kontakttyp == 'firmenhandy')
echo $p->t('profil/telefonTw').': '.$k->kontakt.'<br>';
}
}
if ($user->ort_kurzbz != '')
echo $p->t('profil/buero').': '.$user->ort_kurzbz.'<br>';
}
@@ -403,9 +422,24 @@ if (!$ansicht)
$kontakt = new kontakt();
$kontakt->load_pers($user->person_id);
usort($kontakt->result, "sortKontakt");
echo '<table>';
foreach($kontakt->result as $k)
{
if ($k->kontakttyp != 'firmenhandy' && $k->kontakttyp != 'hidden')
{
if ($k->zustellung)
$zustellung = '&#10003;';
else
$zustellung = '&#10007;';
echo '<tr>';
echo '<td>'.$k->bezeichnung_mehrsprachig[$sprache].'</td>';
echo '<td>'.$k->kontakt.'</td>';
echo '<td>'.$k->anmerkung.'</td>';
echo '<td>'.$zustellung.'</td>';
echo '</tr>';
}
/*
if ($k->zustellung === TRUE)
{
switch($k->kontakttyp)
@@ -423,7 +457,9 @@ if (!$ansicht)
break;
}
}
*/
}
echo '</table>';
}
if ($user->homepage != '')
Regular → Executable
+20 -16
View File
@@ -24,6 +24,7 @@
* @create 20-12-2006
*/
require_once(dirname(__FILE__).'/basis_db.class.php');
require_once(dirname(__FILE__).'/sprache.class.php');
class kontakt extends basis_db
{
@@ -281,7 +282,7 @@ class kontakt extends basis_db
$qry = "SELECT tbl_kontakt.*, tbl_firma.name as firma_name, tbl_firma.firma_id
FROM public.tbl_kontakt LEFT JOIN public.tbl_standort USING(standort_id) LEFT JOIN public.tbl_firma USING(firma_id) WHERE person_id=".$this->db_add_param($person_id, FHC_INTEGER)."
AND kontakttyp =".$this->db_add_param($kontakttyp, FHC_STRING);
if ($order != null)
$qry .= " ORDER BY ".$order;
@@ -332,9 +333,10 @@ class kontakt extends basis_db
$this->errormsg = 'Person_id ist ungueltig';
return false;
}
$qry = "SELECT tbl_kontakt.*, tbl_firma.name as firma_name, tbl_firma.firma_id
FROM public.tbl_kontakt LEFT JOIN public.tbl_standort USING(standort_id) LEFT JOIN public.tbl_firma USING(firma_id) WHERE person_id=".$this->db_add_param($person_id, FHC_INTEGER).';';
$sprache = new sprache();
$bezeichnung_mehrsprachig = $sprache->getSprachQuery('bezeichnung_mehrsprachig');
$qry = "SELECT tbl_kontakt.*, tbl_firma.name as firma_name, tbl_firma.firma_id, tbl_kontakttyp.beschreibung as kontakttyp_name, $bezeichnung_mehrsprachig
FROM public.tbl_kontakt JOIN tbl_kontakttyp USING (kontakttyp) LEFT JOIN public.tbl_standort USING(standort_id) LEFT JOIN public.tbl_firma USING(firma_id) WHERE person_id=".$this->db_add_param($person_id, FHC_INTEGER).';';
if($this->db_query($qry))
{
@@ -356,6 +358,8 @@ class kontakt extends basis_db
$obj->insertamum = $row->insertamum;
$obj->insertvon = $row->insertvon;
$obj->ext_id = $row->ext_id;
$obj->kontakttyp_name = $row->kontakttyp_name;
$obj->bezeichnung_mehrsprachig = $sprache->parseSprachResult('bezeichnung_mehrsprachig',$row);
$this->result[] = $obj;
}
@@ -512,15 +516,15 @@ class kontakt extends basis_db
return false;
}
}
/**
* Sucht nach Kontaktdaten, die den Suchkriterien entsprechen
* @param string $searchstring String, nach dem gesucht werden soll.
* @param string $searchstring String, nach dem gesucht werden soll.
* Wenn $typ = nummer ist, werden eventuelle nicht-numerische Zeichen mit preg_replace entfernt,
* und es wird nach den Typen "telefon","mobil","so.tel","firmenhandy" und "notfallkontakt" gesucht
* @param string $typ Optional. Kontakttyp. Möglich sind <b>"nummer"</b>,"telefon","mobil","so.tel","firmenhandy","firmenhandy","email","fax" und "homepage".
* Wenn $typ = nummer ist, werden eventuelle nicht-numerische Zeichen mit preg_replace entfernt,
* und es wird nach den Typen "telefon","mobil","so.tel","firmenhandy" und "notfallkontakt" gesucht
* und es wird nach den Typen "telefon","mobil","so.tel","firmenhandy" und "notfallkontakt" gesucht
* @return boolean
*/
public function searchKontakt ($searchstring, $typ = '')
@@ -534,18 +538,18 @@ class kontakt extends basis_db
return false;
}
}
$qry = "SELECT
$qry = "SELECT
*
FROM
FROM
public.tbl_kontakt
WHERE
WHERE
1=1";
if ($typ == 'nummer')
$qry .= " AND regexp_replace(kontakt , '[^0-9]', '', 'g') LIKE ('%".$this->db_escape($searchstring)."%')";
else
$qry .= " AND LOWER (kontakt) LIKE LOWER ('%".$this->db_escape($searchstring)."%')";
if ($typ != '' && $typ != 'nummer')
$qry .= " AND kontakttyp=".$this->db_add_param($typ);
@@ -554,7 +558,7 @@ class kontakt extends basis_db
while($row = $this->db_fetch_object())
{
$obj = new kontakt();
$obj->kontakt_id = $row->kontakt_id;
$obj->person_id = $row->person_id;
$obj->standort_id = $row->standort_id;
@@ -567,10 +571,10 @@ class kontakt extends basis_db
$obj->insertamum = $row->insertamum;
$obj->insertvon = $row->insertvon;
$obj->ext_id = $row->ext_id;
$this->result[] = $obj;
}
return true;
}
else
@@ -580,4 +584,4 @@ class kontakt extends basis_db
}
}
}
?>
?>
Regular → Executable
+1 -1
View File
@@ -5,7 +5,7 @@ $this->phrasen['profil/home']='HOME';
$this->phrasen['profil/meinCis']='Mein CIS';
$this->phrasen['profil/bildHochladen']='Profilfoto hochladen';
$this->phrasen['profil/email']='eMail';
$this->phrasen['profil/kontaktPrivat']='Privat';
$this->phrasen['profil/kontaktPrivat']='Private Kontakte';
$this->phrasen['profil/mobil']='Mobil';
$this->phrasen['profil/telefon']='Telefon';
$this->phrasen['profil/intern']='Intern';
Regular → Executable
+1
View File
@@ -5,6 +5,7 @@ $this->phrasen['profil/mitarbeiter']='Employee';
$this->phrasen['profil/meinCis']='My CIS';
$this->phrasen['profil/bildHochladen']='Upload picture';
$this->phrasen['profil/email']='eMail';
$this->phrasen['profil/kontaktPrivat']='Private Contacts';
$this->phrasen['profil/intern']='Intern';
$this->phrasen['profil/alias']='Alias';
$this->phrasen['profil/homepage']='Homepage';
+30 -3
View File
@@ -1522,6 +1522,33 @@ if (!$result = @$db->db_query("SELECT 1 FROM system.tbl_person_lock LIMIT 1"))
echo ' system.tbl_person_lock hinzugefügt<br>';
}
// Spalte bezeichnung_mehrsprachig in public.tbl_kontakttyp
if(!$result = @$db->db_query("SELECT bezeichnung_mehrsprachig FROM public.tbl_kontakttyp LIMIT 1"))
{
$qry = "ALTER TABLE public.tbl_kontakttyp ADD COLUMN bezeichnung_mehrsprachig varchar(128)[];";
if(!$db->db_query($qry))
echo '<strong>public.tbl_kontakttyp '.$db->db_last_error().'</strong><br>';
else
echo 'public.tbl_kontakttyp: Spalte bezeichnung_mehrsprachig hinzugefuegt!<br>';
// Bezeichnung_mehrsprachig aus existierender Bezeichnung vorausfuellen. Ein Eintrag fuer jede Sprache mit Content aktiv.
$qry_help = "SELECT index FROM public.tbl_sprache WHERE content=TRUE;";
if(!$result = $db->db_query($qry_help))
echo '<strong>tbl_kontakttyp bezeichnung_mehrsprachig: Fehler beim ermitteln der Sprachen: '.$db->db_last_error().'</strong>';
else
{
$qry='';
while($row = $db->db_fetch_object($result))
$qry.= "UPDATE public.tbl_kontakttyp set bezeichnung_mehrsprachig[".$row->index."] = beschreibung;";
if(!$db->db_query($qry))
echo '<strong>Setzen der bezeichnung_mehrsprachig fehlgeschlagen: '.$db->db_last_error().'</strong><br>';
else
echo 'public.tbl_kontakttyp: bezeichnung_mehrprachig automatisch aus existierender Beschreibung uebernommen<br>';
}
}
// INSERT Berechtigungen fuer web User erteilen fuer tbl_msg_status
if($result = @$db->db_query("SELECT * FROM information_schema.role_table_grants WHERE table_name='tbl_msg_status' AND table_schema='public' AND grantee='web' AND privilege_type='INSERT'"))
{
@@ -2456,14 +2483,14 @@ if(!$result = @$db->db_query("SELECT lieferant FROM public.tbl_firma LIMIT 1"))
echo '<br>public.tbl_firma: Spalte lieferant hinzugefuegt';
}
// INSERT, UPDATE und DELETE Berechtigungen fuer web User erteilen fuer tbl_rt_person und SEQUENCE public.tbl_rt_person_rt_person_id_seq
// INSERT, UPDATE und DELETE Berechtigungen fuer web User erteilen fuer tbl_rt_person und SEQUENCE public.tbl_rt_person_rt_person_id_seq
if($result = @$db->db_query("SELECT * FROM information_schema.role_table_grants WHERE table_name='tbl_rt_person' AND table_schema='public' AND grantee='web' AND privilege_type='INSERT'"))
{
if($db->db_num_rows($result)==0)
{
$qry = "GRANT SELECT, INSERT, UPDATE, DELETE ON public.tbl_rt_person TO web;
GRANT SELECT, UPDATE ON SEQUENCE public.tbl_rt_person_rt_person_id_seq TO web;";
if(!$db->db_query($qry))
echo '<strong>public.tbl_rt_person Berechtigungen: '.$db->db_last_error().'</strong><br>';
else
@@ -2648,7 +2675,7 @@ $tabellen=array(
"public.tbl_gruppe" => array("gruppe_kurzbz","studiengang_kz","semester","bezeichnung","beschreibung","sichtbar","lehre","aktiv","sort","mailgrp","generiert","updateamum","updatevon","insertamum","insertvon","ext_id","orgform_kurzbz","gid","content_visible","gesperrt","zutrittssystem","aufnahmegruppe"),
"public.tbl_kontakt" => array("kontakt_id","person_id","kontakttyp","anmerkung","kontakt","zustellung","updateamum","updatevon","insertamum","insertvon","ext_id","standort_id"),
"public.tbl_kontaktmedium" => array("kontaktmedium_kurzbz","beschreibung"),
"public.tbl_kontakttyp" => array("kontakttyp","beschreibung"),
"public.tbl_kontakttyp" => array("kontakttyp","beschreibung","bezeichnung_mehrsprachig"),
"public.tbl_konto" => array("buchungsnr","person_id","studiengang_kz","studiensemester_kurzbz","buchungstyp_kurzbz","buchungsnr_verweis","betrag","buchungsdatum","buchungstext","mahnspanne","updateamum","updatevon","insertamum","insertvon","ext_id","credit_points", "zahlungsreferenz", "anmerkung"),
"public.tbl_lehrverband" => array("studiengang_kz","semester","verband","gruppe","aktiv","bezeichnung","ext_id","orgform_kurzbz","gid"),
"public.tbl_log" => array("log_id","executetime","mitarbeiter_uid","beschreibung","sql","sqlundo"),