diff --git a/application/controllers/lehre/Pruefungsprotokoll.php b/application/controllers/lehre/Pruefungsprotokoll.php index 594d3a9e1..d9793ef06 100644 --- a/application/controllers/lehre/Pruefungsprotokoll.php +++ b/application/controllers/lehre/Pruefungsprotokoll.php @@ -51,7 +51,14 @@ class Pruefungsprotokoll extends Auth_Controller public function index() { $this->load->library('WidgetLib'); - $this->load->view('lehre/pruefungsprotokollUebersicht.php'); + + // Protokolle anzeigen seit heute / letzte Woche / alle + $period = $this->input->post('period'); + $period = (!is_null($period)) ? $period : 'today'; + + $data = array('period' => $period); + + $this->load->view('lehre/pruefungsprotokollUebersicht.php', $data); } /** diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index f023c9150..17824bbb8 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -284,9 +284,11 @@ class Messages_model extends CI_Model $sender = getData($senderResult)[0]; // Found sender data - // If the sender is not the system sender and are present configurations to reply + // If the sender is not the system sender and the receiver is not the system sender + // and are present configurations to reply $hrefReply = ''; if ($message->sender_id != $this->config->item(MessageLib::CFG_SYSTEM_PERSON_ID) + && $message->receiver_id != $this->config->item(MessageLib::CFG_SYSTEM_PERSON_ID) && !isEmptyString($this->config->item(MessageLib::CFG_REDIRECT_VIEW_MESSAGE_URL))) { $hrefReply = $this->config->item(MessageLib::CFG_MESSAGE_SERVER). @@ -294,6 +296,13 @@ class Messages_model extends CI_Model $token; } + // If the receiver is the system sender (the message was sent to an organization unit) + // redirect the reply to an authenticated controller to reply + if ($message->receiver_id == $this->config->item(MessageLib::CFG_SYSTEM_PERSON_ID)) + { + $hrefReply = site_url('system/messages/MessageClient/writeReply?token='.$token); + } + return array ( 'sender' => $sender, 'message' => $message, diff --git a/application/models/education/Abschlusspruefung_model.php b/application/models/education/Abschlusspruefung_model.php index 2762496f9..268e786cb 100644 --- a/application/models/education/Abschlusspruefung_model.php +++ b/application/models/education/Abschlusspruefung_model.php @@ -26,7 +26,7 @@ class Abschlusspruefung_model extends DB_Model $abschlusspruefungdata = array(); - $this->addSelect('tbl_abschlusspruefung.abschlusspruefung_id, tbl_abschlusspruefung.datum, tbl_abschlusspruefung.abschlussbeurteilung_kurzbz, tbl_abschlusspruefung.uhrzeit AS pruefungsbeginn, tbl_abschlusspruefung.endezeit AS pruefungsende, + $this->addSelect('tbl_abschlusspruefung.abschlusspruefung_id, tbl_abschlusspruefung.datum, tbl_abschlusspruefung.pruefungstyp_kurzbz AS studiengangstyp, tbl_abschlusspruefung.abschlussbeurteilung_kurzbz, tbl_abschlusspruefung.uhrzeit AS pruefungsbeginn, tbl_abschlusspruefung.endezeit AS pruefungsende, tbl_abschlusspruefung.freigabedatum, tbl_abschlusspruefung_antritt.bezeichnung AS pruefungsantritt_bezeichnung, tbl_abschlusspruefung_antritt.bezeichnung_english AS pruefungsantritt_bezeichnung_english, tbl_abschlusspruefung.protokoll, studentpers.vorname AS vorname_student, studentpers.nachname AS nachname_student, studentpers.titelpre AS titelpre_student, studentpers.titelpost AS titelpost_student, studentben.uid AS uid_student, matrikelnr, vorsitzenderben.uid AS uid_vorsitz, vorsitzenderpers.vorname AS vorname_vorsitz, vorsitzenderpers.nachname AS nachname_vorsitz, vorsitzenderpers.titelpre AS titelpre_vorsitz, vorsitzenderpers.titelpost AS titelpost_vorsitz, @@ -71,29 +71,42 @@ class Abschlusspruefung_model extends DB_Model $abschlusspruefungdata->studiengang_kz = $studienordnungdata->studiengang_kz; $abschlusspruefungdata->studiengangbezeichnung = $studienordnungdata->studiengangbezeichnung; $abschlusspruefungdata->studiengangbezeichnung_englisch = $studienordnungdata->studiengangbezeichnung_englisch; - - $this->StudiengangModel->addSelect('typ'); - $typ = $this->StudiengangModel->load($studienordnungdata->studiengang_kz); - if (isError($typ)) - return $typ; - elseif (hasData($typ)) + } + // if no Studienordnung available (e.g. Incomings), use Studiengangname provided by table student + elseif (!hasData($studienordnung)) + { + $this->resetQuery(); + + $this->load->model('crm/Student_model', 'StudentModel'); + $this->addSelect('studiengang_kz, bezeichnung, english'); + $this->addJoin('public.tbl_studiengang', 'studiengang_kz'); + $result = $this->StudentModel->load(array( + 'student_uid' => $student_uid) + ); + + if ($result = getData($result)[0]) { - $abschlusspruefungdata->studiengangstyp = getData($typ)[0]->typ; + $abschlusspruefungdata->studiengang_kz = $result->studiengang_kz; + $abschlusspruefungdata->studiengangbezeichnung = $result->bezeichnung; + $abschlusspruefungdata->studiengangbezeichnung_englisch = $result->english; } - - // get Abschlussarbeit + } + + // get Abschlussarbeit + if (isset($abschlusspruefungdata->studiengang_kz) && !empty($abschlusspruefungdata->studiengang_kz)) + { $projekttyp = array('Bachelor','Diplom','Master','Dissertation','Lizenziat','Magister'); - $abschlussarbeit = $this->ProjektarbeitModel->getProjektarbeit($student_uid, $studienordnungdata->studiengang_kz, null, $projekttyp, true); + $abschlussarbeit = $this->ProjektarbeitModel->getProjektarbeit($student_uid, $abschlusspruefungdata->studiengang_kz, null, $projekttyp, true); if (isError($abschlussarbeit)) return $abschlussarbeit; if (hasData($abschlussarbeit)) { - $abschlussarbeit = getData($abschlussarbeit)[0]; - $abschlusspruefungdata->projektarbeit_studiengangstyp_name = $abschlussarbeit->projekttyp_kurzbz; - $abschlusspruefungdata->abschlussarbeit_titel = $abschlussarbeit->titel; - $abschlusspruefungdata->abschlussarbeit_note = $abschlussarbeit->note; - } + $abschlussarbeit = getData($abschlussarbeit)[0]; + $abschlusspruefungdata->projektarbeit_studiengangstyp_name = $abschlussarbeit->projekttyp_kurzbz; + $abschlusspruefungdata->abschlussarbeit_titel = $abschlussarbeit->titel; + $abschlusspruefungdata->abschlussarbeit_note = $abschlussarbeit->note; + } } } } diff --git a/application/models/person/Adresse_model.php b/application/models/person/Adresse_model.php index e049f5ad6..fb5112a8d 100644 --- a/application/models/person/Adresse_model.php +++ b/application/models/person/Adresse_model.php @@ -14,12 +14,14 @@ class Adresse_model extends DB_Model /** - * gets person data from uid - * @param $uid + * Get Zustelladress of given person. + * @param string $person_id + * @param string $select * @return array */ - public function getZustellAdresse($person_id) + public function getZustellAdresse($person_id, $select = '*') { + $this->addSelect($select); return $this->loadWhere(array('person_id' => $person_id, 'zustelladresse'=> true)); } } diff --git a/application/models/person/Kontakt_model.php b/application/models/person/Kontakt_model.php index 33dc66c86..50ef18e15 100644 --- a/application/models/person/Kontakt_model.php +++ b/application/models/person/Kontakt_model.php @@ -119,4 +119,54 @@ class Kontakt_model extends DB_Model } return $firmentelefon; } + + /** + * Get all latest contact data of person, where Zustellung is true + * @param $person_id + * @return array + */ + public function getAll_byPersonID($person_id) + { + $this->addSelect('DISTINCT ON (kontakttyp) kontakttyp, kontakt'); + $this->addJoin('public.tbl_standort', 'standort_id', 'LEFT'); + $this->addJoin('public.tbl_firma', 'firma_id', 'LEFT'); + $this->addOrder('kontakttyp, kontakt, tbl_kontakt.updateamum, tbl_kontakt.insertamum'); + + return $this->loadWhere(array( + 'zustellung' => TRUE, + 'person_id' => $person_id + )); + } + + /** + * Get all latest phones of person where zustellung is true. Ordered by + * telefon > mobil > firmenhandy > else. + * @param string person_id + */ + public function getPhones_byPerson($person_id) + { + $qry = ' + WITH latest_phones AS( + SELECT DISTINCT ON (kontakttyp) kontakttyp, kontakt + FROM public.tbl_kontakt kontakt + LEFT JOIN public.tbl_standort USING (standort_id) + LEFT JOIN public.tbl_firma USING (firma_id) + WHERE person_id = ? + AND zustellung + AND kontakttyp IN (\'telefon\', \'mobil\', \'firmenhandy\') + ORDER BY kontakttyp, kontakt, kontakt.updateamum + ) + + SELECT * FROM latest_phones + ORDER BY + CASE + WHEN kontakttyp = \'telefon\' THEN 0 + WHEN kontakttyp = \'mobil\' THEN 1 + WHEN kontakttyp = \'firmenhandy\' THEN 2 + ELSE 3 + END + '; + + return $this->execQuery($qry, array($person_id)); + } } diff --git a/application/models/ressource/Betriebsmittelperson_model.php b/application/models/ressource/Betriebsmittelperson_model.php index 924f670e0..87915cfa8 100644 --- a/application/models/ressource/Betriebsmittelperson_model.php +++ b/application/models/ressource/Betriebsmittelperson_model.php @@ -1,7 +1,6 @@ dbTable = 'wawi.tbl_betriebsmittelperson'; $this->pk = 'betriebsmittelperson_id'; } + + /** + * Get Betriebsmittel by person. + * @param string $person_id + * @param string $betriebsmitteltyp + * @param bool $isRetourniert False to retrieve only active Betriebsmittel. + * @return array|bool + */ + public function getBetriebsmittel($person_id, $betriebsmitteltyp = null, $isRetourniert = null) + { + if (!is_numeric($person_id)) + { + $this->errormsg = 'Person_id type is not valid.'; + return false; + } + + $this->addJoin('wawi.tbl_betriebsmittel', 'betriebsmittel_id'); + + $condition = ' + person_id = '. $this->escape($person_id). ' + '; + + if (is_string($betriebsmitteltyp)) { + $condition .= ' + AND betriebsmitteltyp = ' . $this->escape($betriebsmitteltyp); + } + + if ($isRetourniert === true) { + $condition .= ' + AND retouram IS NOT NULL'; // return date is given + } + elseif ($isRetourniert === false) + { + $condition .= ' + AND retouram IS NULL'; // default + } + + $this->addOrder('ausgegebenam', 'DESC'); // default + + return $this->loadWhere($condition); + } } diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php index 385845026..e87f0945c 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php @@ -189,7 +189,7 @@ $this->load->view(
- + diff --git a/application/views/lehre/pruefungsprotokoll.php b/application/views/lehre/pruefungsprotokoll.php index 7a06f3286..6e0404e1e 100644 --- a/application/views/lehre/pruefungsprotokoll.php +++ b/application/views/lehre/pruefungsprotokoll.php @@ -45,10 +45,10 @@ $this->load->view(
studiengangstyp == 'b' ? 'Bachelor' : 'Master'; - $pruefung_name = $abschlusspruefung->studiengangstyp == 'b' ? $this->p->t('abschlusspruefung', 'pruefungBachelor') : $this->p->t('abschlusspruefung', 'pruefungMaster'); - $arbeit_name = $abschlusspruefung->studiengangstyp == 'b' ? $this->p->t('abschlusspruefung', 'arbeitBachelor') : $this->p->t('abschlusspruefung', 'arbeitMaster'); - $protokolltextvorlage = $abschlusspruefung->studiengangstyp == 'b' ? $this->p->t('abschlusspruefung', 'pruefungsnotizenBachelor') : $this->p->t('abschlusspruefung', 'pruefungsnotizenMaster'); + $studiengangstyp_name = $abschlusspruefung->studiengangstyp == 'Bachelor' ? 'Bachelor' : 'Master'; + $pruefung_name = $abschlusspruefung->studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'pruefungBachelor') : $this->p->t('abschlusspruefung', 'pruefungMaster'); + $arbeit_name = $abschlusspruefung->studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'arbeitBachelor') : $this->p->t('abschlusspruefung', 'arbeitMaster'); + $protokolltextvorlage = $abschlusspruefung->studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'pruefungsnotizenBachelor') : $this->p->t('abschlusspruefung', 'pruefungsnotizenMaster'); $protokolltext = isset($abschlusspruefung->protokoll) ? $abschlusspruefung->protokoll : $protokolltextvorlage; ?>
@@ -57,7 +57,7 @@ $this->load->view( p->t('abschlusspruefung', 'protokoll') ?> 

- studiengangstyp == 'b' ? $this->p->t('abschlusspruefung', 'abgehaltenAmBachelor') : $this->p->t('abschlusspruefung', 'abgehaltenAmMaster'); ?> + studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'abgehaltenAmBachelor') : $this->p->t('abschlusspruefung', 'abgehaltenAmMaster'); ?> studiengangbezeichnung : $abschlusspruefung->studiengangbezeichnung_englisch ?>, p->t('abschlusspruefung', 'studiengangskennzahl') ?>  studiengang_kz ?>

@@ -156,7 +156,7 @@ $this->load->view( p->t('abschlusspruefung', 'pruefungsgegenstand') ?> - studiengangstyp == 'b' ? $this->p->t('abschlusspruefung', 'pruefungsgegenstandBachelor') : $this->p->t('abschlusspruefung', 'pruefungsgegenstandMaster')) ?> + studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'pruefungsgegenstandBachelor') : $this->p->t('abschlusspruefung', 'pruefungsgegenstandMaster')) ?> @@ -172,12 +172,12 @@ $this->load->view( - studiengangstyp == 'b' ? $this->p->t('abschlusspruefung', 'beurteilungKriterienBachelor') : $this->p->t('abschlusspruefung', 'beurteilungKriterienMaster') ?> + studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'beurteilungKriterienBachelor') : $this->p->t('abschlusspruefung', 'beurteilungKriterienMaster') ?> - studiengangstyp == 'b' ? $this->p->t('abschlusspruefung', 'beurteilungBachelor') : $this->p->t('abschlusspruefung', 'beurteilungMaster') ?>: + studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'beurteilungBachelor') : $this->p->t('abschlusspruefung', 'beurteilungMaster') ?>: