From 5eacd9ef815c86d69f5fa446fc168e1c4eb57f15 Mon Sep 17 00:00:00 2001 From: kindlm Date: Thu, 28 May 2015 18:49:21 +0200 Subject: [PATCH] Neues Feature Exklusiv bei Infoscreen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Exklusive Einträge haben Vorrang von normalen Einträgen. lehrform.class: Kleine Fehlerkorrektur --- include/infoscreen.class.php | 32 ++++-- include/lehrform.class.php | 4 +- system/checksystem.php | 13 ++- vilesci/stammdaten/infoscreen_details.php | 121 +++++++++++++++++++--- 4 files changed, 147 insertions(+), 23 deletions(-) diff --git a/include/infoscreen.class.php b/include/infoscreen.class.php index a92bcde3b..6335bcbd5 100755 --- a/include/infoscreen.class.php +++ b/include/infoscreen.class.php @@ -39,6 +39,7 @@ class infoscreen extends basis_db public $insertvon; public $updateamum; public $updatevon; + public $exklusiv; /** * Konstruktor @@ -121,6 +122,7 @@ class infoscreen extends basis_db $this->insertvon = $row->insertvon; $this->updateamum = $row->updateamum; $this->updatevon = $row->updatevon; + $this->exklusiv = $this->db_parse_bool($row->exklusiv); return true; } else @@ -242,7 +244,7 @@ class infoscreen extends basis_db if($new) { $qry = "BEGIN;INSERT INTO campus.tbl_infoscreen_content(infoscreen_id, content_id, - gueltigvon, gueltigbis, refreshzeit, insertamum, insertvon, updateamum, updatevon) VALUES(". + gueltigvon, gueltigbis, refreshzeit, insertamum, insertvon, updateamum, updatevon, exklusiv) VALUES(". $this->db_add_param($this->infoscreen_id, FHC_INTEGER).','. $this->db_add_param($this->content_id, FHC_INTEGER).','. $this->db_add_param($this->gueltigvon).','. @@ -251,7 +253,8 @@ class infoscreen extends basis_db $this->db_add_param($this->insertamum).','. $this->db_add_param($this->insertvon).','. $this->db_add_param($this->updateamum).','. - $this->db_add_param($this->updatevon).');'; + $this->db_add_param($this->updatevon).','. + $this->db_add_param($this->exklusiv, FHC_BOOLEAN).');'; } else { @@ -262,7 +265,8 @@ class infoscreen extends basis_db ' gueltigbis='.$this->db_add_param($this->gueltigbis).','. ' refreshzeit='.$this->db_add_param($this->refreshzeit).','. ' updateamum='.$this->db_add_param($this->updateamum).','. - ' updatevon='.$this->db_add_param($this->updatevon).' '. + ' updatevon='.$this->db_add_param($this->updatevon).','. + ' exklusiv='.$this->db_add_param($this->exklusiv, FHC_BOOLEAN).' '. ' WHERE infoscreen_content_id='.$this->db_add_param($this->infoscreen_content_id, FHC_INTEGER).';'; } @@ -336,10 +340,11 @@ class infoscreen extends basis_db /** * * Liefert den Content der am betreffenden Infoscreen angezeigt werden soll - * @param $infoscreen_id id des Infoscreens - * @param $aktuell wenn true werden nur die aktuell gueltigen Contents geliefert + * @param integer $infoscreen_id id des Infoscreens + * @param boolean $aktuell Deafult:true. Wenn true, werden nur die aktuell gueltigen Contents geliefert + * @param boolean $exklusiv Deafult:true. Wenn true, werden Contents, die das Attribut exklusiv=true haben, vorrangig vor normalen Terminen geliefert */ - public function getScreenContent($infoscreen_id, $aktuell=true) + public function getScreenContent($infoscreen_id, $aktuell=true, $exklusiv=true) { if(!is_numeric($infoscreen_id)) { @@ -356,6 +361,20 @@ class infoscreen extends basis_db $qry.=" AND (gueltigvon<=now() OR gueltigvon is null) AND (gueltigbis>=now() OR gueltigbis is null)"; + if($aktuell) + $qry.=" + AND CASE WHEN + ( + SELECT count(exklusiv) FROM campus.tbl_infoscreen_content + WHERE (infoscreen_id=20 OR infoscreen_id is null) + AND (gueltigvon<=now() OR gueltigvon is null) + AND (gueltigbis>=now() OR gueltigbis is null) + AND exklusiv=true + )>0 THEN + exklusiv=true + ELSE + 1=1 + END"; $qry.=" ORDER BY infoscreen_content_id;"; if($result = $this->db_query($qry)) { @@ -373,6 +392,7 @@ class infoscreen extends basis_db $obj->insertvon = $row->insertvon; $obj->updateamum = $row->updateamum; $obj->updatevon = $row->updatevon; + $obj->exklusiv = $this->db_parse_bool($row->exklusiv); $this->result[] = $obj; } diff --git a/include/lehrform.class.php b/include/lehrform.class.php index 191003a27..f293ed065 100644 --- a/include/lehrform.class.php +++ b/include/lehrform.class.php @@ -66,8 +66,8 @@ class lehrform extends basis_db $this->lehrform_kurzbz = $row->lehrform_kurzbz; $this->bezeichnung = $row->bezeichnung; $this->verplanen = $this->db_parse_bool($row->verplanen); - $this->bezeichnung_kurz=$this->parseSprachResult('bezeichnung_kurz',$row); - $this->bezeichnung_lang=$this->parseSprachResult('bezeichnung_lang',$row); + $this->bezeichnung_kurz=$sprache->parseSprachResult('bezeichnung_kurz',$row); + $this->bezeichnung_lang=$sprache->parseSprachResult('bezeichnung_lang',$row); } else { diff --git a/system/checksystem.php b/system/checksystem.php index e1fe898f3..ef70e82e7 100644 --- a/system/checksystem.php +++ b/system/checksystem.php @@ -3101,7 +3101,7 @@ if(!$result = @$db->db_query("SELECT kosten FROM public.tbl_raumtyp")) if(!$db->db_query($qry)) echo 'public.tbl_raumtyp: '.$db->db_last_error().'
'; else - echo '
public.tbl_raumtyp: neue Spalte koste n hinzugefuegt'; + echo '
public.tbl_raumtyp: neue Spalte kosten hinzugefuegt'; } // Spalte onlinebewerbung fuer tbl_studiensemester @@ -3115,6 +3115,17 @@ if(!$result = @$db->db_query("SELECT onlinebewerbung FROM public.tbl_studienseme echo '
public.tbl_studiensemester: neue Spalte onlinebewerbung hinzugefuegt'; } +// Spalte exklusiv fuer campus.tbl_infoscreen_content +if(!$result = @$db->db_query("SELECT exklusiv FROM campus.tbl_infoscreen_content")) +{ + $qry = 'ALTER TABLE campus.tbl_infoscreen_content ADD COLUMN exklusiv boolean NOT NULL default false;'; + + if(!$db->db_query($qry)) + echo 'campus.tbl_infoscreen_content: '.$db->db_last_error().'
'; + else + echo '
campus.tbl_infoscreen_content: neue Spalte exklusiv hinzugefuegt'; +} + echo '


'; $tabellen=array( diff --git a/vilesci/stammdaten/infoscreen_details.php b/vilesci/stammdaten/infoscreen_details.php index 3bf2dbbda..853393d08 100755 --- a/vilesci/stammdaten/infoscreen_details.php +++ b/vilesci/stammdaten/infoscreen_details.php @@ -35,7 +35,7 @@ $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); if(!$rechte->isBerechtigt('basis/infoscreen')) - die('Sie haben keine Berechtigung fuer diese Seite'); + die($rechte->errormsg); $datum_obj = new datum(); ?> @@ -46,15 +46,46 @@ $datum_obj = new datum(); - + + + + + + + @@ -100,13 +158,14 @@ $datum_obj = new datum(); if($action=='save') { if(!$rechte->isBerechtigt('basis/infoscreen', null, 'sui')) - die('Sie haben keine Berechtigung fuer diese Seite'); + die($rechte->errormsg); $my_infoscreen_id = $_POST['infoscreen_id']; $infoscreen_content_id = $_POST['infoscreen_content_id']; $content_id = $_POST['content_id']; - $gueltigvon = $_POST['gueltigvon']; - $gueltigbis = $_POST['gueltigbis']; + $gueltigvon = $_POST['gueltigvondatum'].' '.$_POST['gueltigvonzeit']; + $gueltigbis = $_POST['gueltigbisdatum'].' '.$_POST['gueltigbiszeit']; $refreshzeit = $_POST['refreshzeit']; + $exklusiv = (isset ($_POST['exklusiv'])?true:false); $infoscreen = new infoscreen(); if($infoscreen_content_id!='') @@ -127,6 +186,7 @@ $datum_obj = new datum(); $infoscreen->refreshzeit = $refreshzeit; $infoscreen->updateamum = date('Y-m-d H:i:s'); $infoscreen->updatevon = $user; + $infoscreen->exklusiv = $exklusiv; $infoscreen_ids=explode(',',$my_infoscreen_id); if (count($infoscreen_ids)>1) @@ -198,16 +258,30 @@ $datum_obj = new datum(); Gültig von - ( Format: ',date('d.m.Y H:i:s'),' ) + + + + + + Gültig bis - ( Format: ',date('d.m.Y H:i:s'),' ) + + + + + + Refreshzeit Zeit, wie lange die Seite angezeigt wird (in Sekunden) + + Exklusiv + exklusiv===true?'checked':'').'/> Exklusiveinträge haben Vorrang vor normalen Einträgen + @@ -229,6 +303,7 @@ $datum_obj = new datum(); Gültig von Gültig bis Refreshzeit + Exklusiv Aktion @@ -237,33 +312,51 @@ $datum_obj = new datum(); $jetzt = time(); $aktiv=false; $zukunft=false; + $exklusiv = false; + //Wenn mindestens ein Content als Exklusiv markiert ist, wird dieser vorrangig behandelt foreach($infoscreen->result as $row) { + $gueltigvon=$datum_obj->mktime_fromtimestamp($row->gueltigvon); + $gueltigbis=$datum_obj->mktime_fromtimestamp($row->gueltigbis); + + if($row->exklusiv==true && (($gueltigvon<=$jetzt) || ($gueltigvon=='')) && (($gueltigbis>=$jetzt) || ($gueltigbis==''))) + $exklusiv = true; + } + foreach($infoscreen->result as $row) + { + $passiv=false; $content = new content(); $content->getContent($row->content_id, 'German'); $gueltigvon=$datum_obj->mktime_fromtimestamp($row->gueltigvon); $gueltigbis=$datum_obj->mktime_fromtimestamp($row->gueltigbis); - if ((($gueltigvon<=$jetzt) || ($gueltigvon=='')) && (($gueltigbis>=$jetzt) || ($gueltigbis==''))) + if ((($gueltigvon<=$jetzt) || ($gueltigvon=='')) && (($gueltigbis>=$jetzt) || ($gueltigbis=='')) && ($exklusiv==false && $row->exklusiv==false)) + $aktiv=true; + elseif ($exklusiv==true && $row->exklusiv==true) $aktiv=true; else + { $aktiv=false; + } if ($aktiv==false && ($gueltigvon>=$jetzt)) $zukunft=true; + elseif ((($gueltigvon<=$jetzt) || ($gueltigvon=='')) && (($gueltigbis>=$jetzt) || ($gueltigbis=='')) && ($exklusiv==true && $row->exklusiv==false)) + $passiv=true; else $zukunft=false; - echo ''; - echo ''.($aktiv==false?($zukunft==true?'ampel_gelb':'ampel_rot'):'ampel_gruen').''; + echo ''; + echo ''.($aktiv==false?($zukunft==true || $passiv==true?'ampel_gelb':'ampel_rot'):'ampel_gruen').''; echo '',$db->convert_html_chars($row->infoscreen_content_id),''; echo '',$db->convert_html_chars($row->infoscreen_id),''; echo '',$db->convert_html_chars($row->content_id),''; echo '',$db->convert_html_chars($content->titel),''; - echo '',$db->convert_html_chars($datum_obj->formatDatum($row->gueltigvon,'d.m.Y H:i:s')),''; - echo '',$db->convert_html_chars($datum_obj->formatDatum($row->gueltigbis,'d.m.Y H:i:s')),''; + echo '',$db->convert_html_chars($datum_obj->formatDatum($row->gueltigvon,'d.m.Y H:i')),''; + echo '',$db->convert_html_chars($datum_obj->formatDatum($row->gueltigbis,'d.m.Y H:i')),''; echo '',$db->convert_html_chars($row->refreshzeit),''; + echo ''.($row->exklusiv===true?'Exklusiv':'').''; echo 'bearbeiten'; echo 'entfernen'; echo '';