mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
der Gantt Chart zeigt jetzt auch die Projekte der markierten OE an
This commit is contained in:
@@ -185,7 +185,8 @@ function treeProjektmenueSelect()
|
||||
else
|
||||
{
|
||||
document.getElementById('toolbarbutton-projektdokument-neu').disabled=true;
|
||||
document.getElementById('toolbarbutton-projektdokument-zuweisung').disabled=true;
|
||||
document.getElementById('toolbarbutton-projektdokument-zuweisung').disabled=true;
|
||||
drawGantt();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>
|
||||
* Authors: Karl Burkhart <burkhart@technikum-wien.at>
|
||||
*/
|
||||
|
||||
require_once('../../config/vilesci.config.inc.php');
|
||||
@@ -51,7 +51,6 @@ function showStudienjahr()
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var tree=document.getElementById('tree-projektmenue');
|
||||
|
||||
// Wenn auf die Ueberschrift geklickt wird, soll nix passieren
|
||||
if(tree.currentIndex==-1)
|
||||
{
|
||||
@@ -59,9 +58,17 @@ function showStudienjahr()
|
||||
return;
|
||||
}
|
||||
projekt_kurzbz=getTreeCellText(tree, "treecol-projektmenue-projekt_kurzbz", tree.currentIndex);
|
||||
|
||||
var url = 'projekt/gantt.svg.php?projekt='+projekt_kurzbz+'&studienjahr='+(global_year-1)+'&ansicht=studienjahr';
|
||||
global_url = url;
|
||||
if(projekt_kurzbz == '')
|
||||
{
|
||||
oe_kurzbz = getTreeCellText(tree, "treecol-projektmenue-oe", tree.currentIndex);
|
||||
var url = 'projekt/gantt.svg.php?oe='+oe_kurzbz+'&studienjahr='+(global_year-1)+'&ansicht=studienjahr';
|
||||
}
|
||||
else
|
||||
{
|
||||
var url = 'projekt/gantt.svg.php?projekt='+projekt_kurzbz+'&studienjahr='+(global_year-1)+'&ansicht=studienjahr';
|
||||
global_url = url;
|
||||
}
|
||||
|
||||
document.getElementById('iframe-ressource-projekt').contentWindow.location.href=url;
|
||||
}
|
||||
|
||||
@@ -84,8 +91,17 @@ function showKalenderjahr()
|
||||
return;
|
||||
}
|
||||
projekt_kurzbz=getTreeCellText(tree, "treecol-projektmenue-projekt_kurzbz", tree.currentIndex);
|
||||
if(projekt_kurzbz == '')
|
||||
{
|
||||
oe_kurzbz = getTreeCellText(tree, "treecol-projektmenue-oe", tree.currentIndex);
|
||||
var url = 'projekt/gantt.svg.php?oe='+oe_kurzbz+'&studienjahr='+global_year+'&ansicht=kalenderjahr';
|
||||
}
|
||||
else
|
||||
{
|
||||
var url = 'projekt/gantt.svg.php?projekt='+projekt_kurzbz+'&studienjahr='+global_year+'&ansicht=kalenderjahr';
|
||||
global_url = url;
|
||||
}
|
||||
|
||||
var url = 'projekt/gantt.svg.php?projekt='+projekt_kurzbz+'&studienjahr='+global_year+'&ansicht=kalenderjahr';
|
||||
global_url = url;
|
||||
document.getElementById('iframe-ressource-projekt').contentWindow.location.href=url;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>
|
||||
* Authors: Karl Burkhart <burkhart@technikum-wien.at>
|
||||
*/
|
||||
|
||||
header("Cache-Control: no-cache");
|
||||
|
||||
+598
-276
@@ -18,10 +18,18 @@
|
||||
* Authors: Karl Burkhart <burkhart@technikum-wien.at>
|
||||
*/
|
||||
|
||||
if(isset($_REQUEST['projekt']))
|
||||
$projekt_kurzbz = $_REQUEST['projekt'];
|
||||
global $projekt_kurzbz;
|
||||
global $oe;
|
||||
global $studienjahr;
|
||||
global $ansicht;
|
||||
|
||||
if(isset($_REQUEST['projekt']) || isset($_REQUEST['oe']))
|
||||
{
|
||||
$projekt_kurzbz = isset($_REQUEST['projekt'])?$_REQUEST['projekt']: '';
|
||||
$oe = isset($_REQUEST['oe'])?$_REQUEST['oe']:'';
|
||||
}
|
||||
else
|
||||
die ('Kein Projekt übergeben!');
|
||||
die ('Kein Projekt oder OE übergeben!');
|
||||
|
||||
if(isset($_REQUEST['studienjahr']))
|
||||
$studienjahr = $_REQUEST['studienjahr'];
|
||||
@@ -47,289 +55,603 @@ require_once('../../include/projekt.class.php');
|
||||
require_once('../../include/functions.inc.php');
|
||||
require_once('../../include/datum.class.php');
|
||||
|
||||
$projektphasen = new projektphase();
|
||||
if(!$projektphasen->getProjektphasen($projekt_kurzbz))
|
||||
die('Kein gültiges Projekt übergeben.');
|
||||
|
||||
$projekt = new projekt();
|
||||
if(!$projekt->load($projekt_kurzbz))
|
||||
die('Konnte Projekt nicht laden.');
|
||||
|
||||
$datum = new datum();
|
||||
$widthPerWeek = 16;
|
||||
$startX = 20;
|
||||
$startY = 90;
|
||||
// KW in der 28.12 liegt ist lezte KW
|
||||
$datum_gesamt = $studienjahr.'-12-28';
|
||||
$timestamp_gesamt = $datum->mktime_fromdate($datum_gesamt);
|
||||
$kw_gesamt = date('W',$timestamp_gesamt);
|
||||
|
||||
// kommt auf Anzahl der Phasen an
|
||||
$height = (count($projektphasen->result)) * 50;
|
||||
|
||||
// Zeichne Kalenderjahr -> beginnend mit KW 1
|
||||
if($ansicht=='kalenderjahr')
|
||||
if($projekt_kurzbz != '')
|
||||
{
|
||||
echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">';
|
||||
|
||||
echo '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="100%" height="100%">
|
||||
<rect x="'.$startX.'" y="'.$startY.'" width="'.($kw_gesamt*$widthPerWeek).'" height="'.$height.'"
|
||||
style="color:#000000;fill:none;stroke:#e1e1e1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />';
|
||||
|
||||
// Überschriften
|
||||
echo'<text x="30%" y="40" style="font-size:33px">Kalenderjahr: '.$studienjahr.'</text>';
|
||||
echo'<text x="'.($startX-10).'" y="'.($startY-5).'" style="font-size:13px" text-anchor="end"> KW:</text>';
|
||||
|
||||
// Zeichne Raster
|
||||
for($i=1; $i<=$kw_gesamt; $i++)
|
||||
{
|
||||
$x1 = $startX + $i*$widthPerWeek;
|
||||
echo '<line x1="'.$x1.'" y1="'.$startY.'" x2="'.$x1.'" y2="'.($height+$startY).'" style="stroke:#e1e1e1; stroke-width:2px;" />';
|
||||
if($i%2 == 1)
|
||||
echo '<text x="'.($x1-$widthPerWeek).'" y="'.($startY-5).'" style="font-size:13px">'.$i.'</text>';
|
||||
|
||||
}
|
||||
|
||||
// aktuelle KW markieren
|
||||
$timestamp_now = time();
|
||||
$kw_now = kalenderwoche($timestamp_now);
|
||||
$year_now=date("Y",$timestamp_now);
|
||||
if($year_now == $studienjahr)
|
||||
{
|
||||
$x = (($startX +($kw_now*$widthPerWeek))-$widthPerWeek/2);
|
||||
echo '<line x1="'.$x.'" y1="'.($startY-20).'" x2="'.$x.'" y2="'.($height+$startY+20).'" style="stroke:red; stroke-width:4px;" />';
|
||||
}
|
||||
|
||||
$i=0;
|
||||
foreach($projektphasen->result as $phase)
|
||||
{
|
||||
$width = 0;
|
||||
$x = 0;
|
||||
// wenn kein start oder ende angegeben -> nichts zeichnen -> width=0
|
||||
if($phase->start != '' && $phase->ende != '')
|
||||
{
|
||||
$timestamp_beginn = $datum->mktime_fromdate($phase->start);
|
||||
$timestamp_end = $datum->mktime_fromdate($phase->ende);
|
||||
$kw_beginn = kalenderwoche($timestamp_beginn);
|
||||
$kw_end = kalenderwoche($timestamp_end);
|
||||
// kw soll bei 0 zu zeichnen beginnen
|
||||
$kw_beginn = $kw_beginn -1;
|
||||
$kw_end = $kw_end -1;
|
||||
|
||||
$year_beginn=date("Y",$timestamp_beginn);
|
||||
$year_end=date("Y",$timestamp_end);
|
||||
|
||||
// phase beginnt und endet im Jahr
|
||||
if($year_end == $year_beginn && $year_beginn == $studienjahr)
|
||||
{
|
||||
$width = ($kw_end - $kw_beginn+1)*$widthPerWeek;
|
||||
$x = ($startX+$kw_beginn*$widthPerWeek);
|
||||
}
|
||||
// endet im nächsten jahr
|
||||
else if($year_beginn == $studienjahr && $year_end > $year_beginn)
|
||||
{
|
||||
$width = ($kw_gesamt - $kw_beginn)*$widthPerWeek;
|
||||
$x = ($startX+$kw_beginn*$widthPerWeek);
|
||||
}
|
||||
// geht über gesamtes jahr
|
||||
else if($year_beginn < $studienjahr && $year_end > $studienjahr)
|
||||
{
|
||||
$width = ($kw_gesamt*$widthPerWeek);
|
||||
$x = $startX;
|
||||
}
|
||||
// beginnt im vorigen und endet im aktuellen
|
||||
else if($year_beginn < $studienjahr && $year_end == $studienjahr)
|
||||
{
|
||||
$width = ($kw_end+1)*$widthPerWeek;
|
||||
$x = $startX;
|
||||
}
|
||||
}
|
||||
|
||||
// zeichne balken
|
||||
echo '<rect x="'.$x.'" y="'.($startY+10+$i*50).'" width ="'.$width.'" height ="30" fill="blue" stroke="black" />';
|
||||
echo'<text x="'.($startX-10).'" y="'.($startY+30+$i*50).'" style="font-size:15px" text-anchor="end">'.$phase->bezeichnung.'</text>';
|
||||
$i++;
|
||||
}
|
||||
echo'<text x="10%" y="'.((($i+1)*50)+$startY).'" style="font-size:16px">Projekt: '.$projekt->titel.'</text>';
|
||||
|
||||
echo '</svg>';
|
||||
// Zeichne alle Phasen vom übergebenen Projekt
|
||||
getProjektGantt();
|
||||
}
|
||||
else if($ansicht == 'studienjahr')
|
||||
else
|
||||
{
|
||||
echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">';
|
||||
echo '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="100%" height="100%" viewBox="0 0 750 600">
|
||||
>';
|
||||
|
||||
// Überschriften
|
||||
echo'<text x="30%" y="40" style="font-size:33px">Studienjahr: '.$studienjahr.'/'.($studienjahr+1).'</text>';
|
||||
echo'<text x="'.($startX-10).'" y="'.($startY-5).'" style="font-size:13px" text-anchor="end"> KW:</text>';
|
||||
|
||||
// WS
|
||||
$year_old = $studienjahr.'-09-01';
|
||||
$timestamp_old = $datum->mktime_fromdate($year_old);
|
||||
$kw_old = kalenderwoche($timestamp_old);
|
||||
|
||||
// SS
|
||||
$year_new = ($studienjahr+1).'-09-01';
|
||||
$timestamp_new = $datum->mktime_fromdate($year_new);
|
||||
$kw_new = kalenderwoche($timestamp_new);
|
||||
|
||||
// gesamtanzahl der KWs im Studienjahr
|
||||
$y = 0;
|
||||
// Zeichne Raster studienjahr WS
|
||||
for($i=$kw_old; $i<=$kw_gesamt; $i++)
|
||||
{
|
||||
$x1 = ($startX +$y*$widthPerWeek);
|
||||
echo '<line x1="'.$x1.'" y1="'.$startY.'" x2="'.$x1.'" y2="'.($height+$startY).'" style="stroke:#e1e1e1; stroke-width:2px;" />';
|
||||
if($y%2 == 0)
|
||||
echo '<text x="'.$x1.'" y="'.($startY-5).'" style="font-size:13px">'.$i.'</text>';
|
||||
$y++;
|
||||
}
|
||||
// Zeichne Raster studienjahr SS
|
||||
for($i=1; $i<=$kw_new; $i++)
|
||||
{
|
||||
$x1 = ($startX +$y*$widthPerWeek);
|
||||
echo '<line x1="'.$x1.'" y1="'.$startY.'" x2="'.$x1.'" y2="'.($height+$startY).'" style="stroke:#e1e1e1; stroke-width:2px;" />';
|
||||
if($y%2 == 0)
|
||||
echo '<text x="'.$x1.'" y="'.($startY-5).'" style="font-size:13px">'.$i.'</text>';
|
||||
$y++;
|
||||
}
|
||||
echo '<rect x="'.$startX.'" y="'.$startY.'" width="'.($y*$widthPerWeek).'" height="'.$height.'"
|
||||
style="color:#000000;fill:none;stroke:#e1e1e1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />';
|
||||
|
||||
$i=0;
|
||||
foreach($projektphasen->result as $phase)
|
||||
{
|
||||
$width = 0;
|
||||
$x = 0;
|
||||
// wenn kein start oder ende angegeben -> nichts zeichnen -> width=0
|
||||
if($phase->start != '' && $phase->ende != '')
|
||||
{
|
||||
$timestamp_beginn = $datum->mktime_fromdate($phase->start);
|
||||
$timestamp_end = $datum->mktime_fromdate($phase->ende);
|
||||
$kw_beginn = kalenderwoche($timestamp_beginn);
|
||||
$kw_end = kalenderwoche($timestamp_end);
|
||||
$kw_beginn = $kw_beginn;
|
||||
$kw_end = $kw_end;
|
||||
|
||||
$startSS = $kw_gesamt-$kw_old;
|
||||
|
||||
$year_beginn=date("Y",$timestamp_beginn);
|
||||
$year_end=date("Y",$timestamp_end);
|
||||
$test = 0;
|
||||
// phase beginnt und endet im WS
|
||||
if($year_end == $year_beginn && $year_beginn == $studienjahr && $kw_beginn >= $kw_old)
|
||||
{
|
||||
$width = ($kw_end - $kw_beginn + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn-$kw_old)*$widthPerWeek);
|
||||
$test = 1;
|
||||
}
|
||||
// phase beginnt und endet im SS
|
||||
if($year_end == $year_beginn && $year_beginn == $studienjahr+1 && $kw_beginn >= 1 && $kw_end <=$kw_new)
|
||||
{
|
||||
if($kw_end == 1)// es kann auch sein dass 31.12 des kalenderjahres schon in der 1. KW liegt
|
||||
$kw_end =$kw_new;
|
||||
$width = ($kw_end - $kw_beginn + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn+$startSS)*$widthPerWeek);
|
||||
$test = 2;
|
||||
}
|
||||
// phase beginnt im WS und endet im SS
|
||||
else if($year_beginn == $studienjahr && $year_end == $studienjahr+1 && $kw_beginn >= $kw_old && $kw_end <= $kw_new)
|
||||
{
|
||||
$width = ($kw_gesamt - $kw_beginn + $kw_end + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn-$kw_old)*$widthPerWeek);
|
||||
$test = 3;
|
||||
}
|
||||
// geht über gesamtes studienjahr
|
||||
else if($year_beginn == $studienjahr && $kw_beginn <= $kw_old && (($year_end == $studienjahr+1 && $kw_end >= $kw_new) || $year_end > $studienjahr+1))
|
||||
{
|
||||
$width = $y*$widthPerWeek;
|
||||
$x = $startX;
|
||||
$test = 4;
|
||||
}
|
||||
// geht über gesamtes studienjahr
|
||||
else if($year_beginn < $studienjahr && $year_end > $studienjahr+1)
|
||||
{
|
||||
$width = $y*$widthPerWeek;
|
||||
$x = $startX;
|
||||
$test = 5;
|
||||
}
|
||||
// beginnt früher und endet im aktuellen WS
|
||||
else if((($year_beginn == $studienjahr && $kw_beginn < $kw_old) || ($year_beginn < $studienjahr)) && ($year_end == $studienjahr && $kw_end >= $kw_old))
|
||||
{
|
||||
// Zeichne alle Projekte der übergebenen OE
|
||||
getOeGantt();
|
||||
|
||||
}
|
||||
|
||||
$width = ($kw_end - $kw_old + 1)*$widthPerWeek;
|
||||
$x = $startX;
|
||||
$test = 6;
|
||||
}
|
||||
// beginnt früher und endet im aktuellen SS
|
||||
else if((($year_beginn == $studienjahr && $kw_beginn < $kw_old) || ($year_beginn < $studienjahr)) && ($year_end == $studienjahr+1 && $kw_end <= $kw_new))
|
||||
{
|
||||
if($kw_end == 1) // es kann auch sein dass 31.12 des kalenderjahres schon in der 1. KW liegt
|
||||
$kw_end =$kw_new;
|
||||
$width = ($kw_gesamt - $kw_old + $kw_end + 1)*$widthPerWeek;
|
||||
$x = $startX;
|
||||
$test = 7;
|
||||
}
|
||||
// beginnt im aktuellen WS und endet nach Studienjahr im aktuellen Kalenderjahr
|
||||
else if(($year_beginn == $studienjahr && $kw_beginn >= $kw_old) && ($year_end == $studienjahr+1 && $kw_end > $kw_new))
|
||||
{
|
||||
$width = ($kw_gesamt - $kw_beginn + $kw_new + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn-$kw_old)*$widthPerWeek);
|
||||
$test = 8;
|
||||
}
|
||||
// beginnt im aktuellen WS und endet nach Studienjahr und nach aktuellem Kalenderjahr
|
||||
else if(($year_beginn == $studienjahr && $kw_beginn > $kw_old) && ($year_end > $studienjahr+1))
|
||||
{
|
||||
$width = ($kw_gesamt - $kw_beginn + $kw_new + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn-$kw_old)*$widthPerWeek);
|
||||
$test = 9;
|
||||
}
|
||||
// beginnt im aktuellen SS und endet nach Studienjahr im aktuellen Kalenderjahr
|
||||
else if(($year_beginn == $studienjahr+1 && $kw_beginn <= $kw_new) && ($year_end == $studienjahr+1 && ($kw_end > $kw_new || $kw_end == 1))) // da 31.123
|
||||
{
|
||||
$width = ($y-$kw_beginn - $startSS)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn+$startSS)*$widthPerWeek);
|
||||
$test = 10;
|
||||
}
|
||||
// beginnt im aktuellen SS und endet nach Studienjahr und nach aktuellem Kalenderjahr
|
||||
else if(($year_beginn == $studienjahr+1 && $kw_beginn <= $kw_new) && ($year_end > $studienjahr+1))
|
||||
{
|
||||
$width = ($y-$kw_beginn - $startSS)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn+$startSS)*$widthPerWeek);
|
||||
$test = 11;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Zeichnet den Chart für alle Projekte einer Übergebenen Organisationseinheit
|
||||
*/
|
||||
function getOeGantt()
|
||||
{
|
||||
global $oe;
|
||||
global $studienjahr;
|
||||
global $ansicht;
|
||||
|
||||
$projekt = new projekt();
|
||||
if(!$projekt->getProjekte($oe))
|
||||
die('Keine gültige OE übergeben.');
|
||||
|
||||
$datum = new datum();
|
||||
$widthPerWeek = 16;
|
||||
$startX =50;
|
||||
$startY = 90;
|
||||
// KW in der 28.12 liegt ist letzte KW
|
||||
$datum_gesamt = $studienjahr.'-12-28';
|
||||
$timestamp_gesamt = $datum->mktime_fromdate($datum_gesamt);
|
||||
$kw_gesamt = date('W',$timestamp_gesamt);
|
||||
|
||||
// kommt auf Anzahl der Phasen an
|
||||
$height = (count($projekt->result)) * 50;
|
||||
|
||||
// Zeichne Kalenderjahr -> beginnend mit KW 1
|
||||
if($ansicht=='kalenderjahr')
|
||||
{
|
||||
echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">';
|
||||
|
||||
echo '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="100%" height="100%" viewBox="0 0 750 600">
|
||||
<rect x="'.$startX.'" y="'.$startY.'" width="'.($kw_gesamt*$widthPerWeek).'" height="'.$height.'"
|
||||
style="color:#000000;fill:none;stroke:#e1e1e1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />';
|
||||
|
||||
// Überschriften
|
||||
echo'<text x="30%" y="40" style="font-size:33px">Kalenderjahr: '.$studienjahr.'</text>';
|
||||
echo'<text x="'.($startX-10).'" y="'.($startY-5).'" style="font-size:13px" text-anchor="end"> KW:</text>';
|
||||
|
||||
// Zeichne Raster
|
||||
for($i=1; $i<=$kw_gesamt; $i++)
|
||||
{
|
||||
$x1 = $startX + $i*$widthPerWeek;
|
||||
echo '<line x1="'.$x1.'" y1="'.$startY.'" x2="'.$x1.'" y2="'.($height+$startY).'" style="stroke:#e1e1e1; stroke-width:2px;" />';
|
||||
if($i%2 == 1)
|
||||
echo '<text x="'.($x1-$widthPerWeek).'" y="'.($startY-5).'" style="font-size:13px">'.$i.'</text>';
|
||||
|
||||
}
|
||||
|
||||
// zeichne balken
|
||||
echo "test:".$test.$phase->bezeichnung."jahr".$studienjahr;
|
||||
echo '<rect x="'.$x.'" y="'.($startY+10+$i*50).'" width ="'.$width.'" height ="30" fill="blue" stroke="black" />';
|
||||
echo'<text x="'.($startX-10).'" y="'.($startY+30+$i*50).'" style="font-size:15px" text-anchor="end">'.$phase->bezeichnung.'</text>';
|
||||
$i++;
|
||||
|
||||
// aktuelle KW markieren
|
||||
$timestamp_now = time();
|
||||
$kw_now = kalenderwoche($timestamp_now);
|
||||
$year_now=date("Y",$timestamp_now);
|
||||
if($year_now == $studienjahr)
|
||||
{
|
||||
$x = (($startX +($kw_now*$widthPerWeek))-$widthPerWeek/2);
|
||||
echo '<line x1="'.$x.'" y1="'.($startY-20).'" x2="'.$x.'" y2="'.($height+$startY+20).'" style="stroke:red; stroke-width:4px;" />';
|
||||
}
|
||||
|
||||
$i=0;
|
||||
foreach($projekt->result as $projekt)
|
||||
{
|
||||
$width = 0;
|
||||
$x = 0;
|
||||
// wenn kein start oder ende angegeben -> nichts zeichnen -> width=0
|
||||
if($projekt->beginn != '' && $projekt->ende != '')
|
||||
{
|
||||
$timestamp_beginn = $datum->mktime_fromdate($projekt->beginn);
|
||||
$timestamp_end = $datum->mktime_fromdate($projekt->ende);
|
||||
$kw_beginn = kalenderwoche($timestamp_beginn);
|
||||
$kw_end = kalenderwoche($timestamp_end);
|
||||
// kw soll bei 0 zu zeichnen beginnen
|
||||
$kw_beginn = $kw_beginn -1;
|
||||
$kw_end = $kw_end -1;
|
||||
|
||||
$year_beginn=date("Y",$timestamp_beginn);
|
||||
$year_end=date("Y",$timestamp_end);
|
||||
|
||||
// phase beginnt und endet im Jahr
|
||||
if($year_end == $year_beginn && $year_beginn == $studienjahr)
|
||||
{
|
||||
$width = ($kw_end - $kw_beginn+1)*$widthPerWeek;
|
||||
$x = ($startX+$kw_beginn*$widthPerWeek);
|
||||
}
|
||||
// endet im nächsten jahr
|
||||
else if($year_beginn == $studienjahr && $year_end > $year_beginn)
|
||||
{
|
||||
$width = ($kw_gesamt - $kw_beginn)*$widthPerWeek;
|
||||
$x = ($startX+$kw_beginn*$widthPerWeek);
|
||||
}
|
||||
// geht über gesamtes jahr
|
||||
else if($year_beginn < $studienjahr && $year_end > $studienjahr)
|
||||
{
|
||||
$width = ($kw_gesamt*$widthPerWeek);
|
||||
$x = $startX;
|
||||
}
|
||||
// beginnt im vorigen und endet im aktuellen
|
||||
else if($year_beginn < $studienjahr && $year_end == $studienjahr)
|
||||
{
|
||||
$width = ($kw_end+1)*$widthPerWeek;
|
||||
$x = $startX;
|
||||
}
|
||||
}
|
||||
|
||||
// zeichne balken
|
||||
echo '<rect x="'.$x.'" y="'.($startY+10+$i*50).'" width ="'.$width.'" height ="30" fill="blue" stroke="black" />';
|
||||
echo'<text x="'.($startX-10).'" y="'.($startY+30+$i*50).'" style="font-size:15px" text-anchor="end">'.$projekt->titel.'</text>';
|
||||
$i++;
|
||||
}
|
||||
echo'<text x="10%" y="'.((($i+1)*50)+$startY).'" style="font-size:16px">Organisationseinheit: '.$projekt->oe_kurzbz.'</text>';
|
||||
|
||||
echo '</svg>';
|
||||
}
|
||||
|
||||
echo'<text x="10%" y="'.((($i+1)*50)+$startY).'" style="font-size:16px">Projekt: '.$projekt->titel.'</text>';
|
||||
|
||||
// aktuelle KW markieren
|
||||
$timestamp_now = time();
|
||||
$kw_now = kalenderwoche($timestamp_now);
|
||||
$year_now=date("Y",$timestamp_now);
|
||||
if($year_now == $studienjahr && $kw_now > $kw_old)
|
||||
else if($ansicht == 'studienjahr')
|
||||
{
|
||||
$x = (($startX +(($kw_now-$kw_old)*$widthPerWeek))-$widthPerWeek/2);
|
||||
echo '<line x1="'.$x.'" y1="'.($startY-20).'" x2="'.$x.'" y2="'.($height+$startY+20).'" style="stroke:red; stroke-width:4px;" />';
|
||||
echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">';
|
||||
echo '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="100%" height="100%" viewBox="0 0 750 600">';
|
||||
|
||||
// Überschriften
|
||||
echo'<text x="30%" y="40" style="font-size:33px">Studienjahr: '.$studienjahr.'/'.($studienjahr+1).'</text>';
|
||||
echo'<text x="'.($startX-10).'" y="'.($startY-5).'" style="font-size:13px" text-anchor="end"> KW:</text>';
|
||||
|
||||
// WS
|
||||
$year_old = $studienjahr.'-09-01';
|
||||
$timestamp_old = $datum->mktime_fromdate($year_old);
|
||||
$kw_old = kalenderwoche($timestamp_old);
|
||||
|
||||
// SS
|
||||
$year_new = ($studienjahr+1).'-09-01';
|
||||
$timestamp_new = $datum->mktime_fromdate($year_new);
|
||||
$kw_new = kalenderwoche($timestamp_new);
|
||||
|
||||
// gesamtanzahl der KWs im Studienjahr
|
||||
$y = 0;
|
||||
// Zeichne Raster studienjahr WS
|
||||
for($i=$kw_old; $i<=$kw_gesamt; $i++)
|
||||
{
|
||||
$x1 = ($startX +$y*$widthPerWeek);
|
||||
echo '<line x1="'.$x1.'" y1="'.$startY.'" x2="'.$x1.'" y2="'.($height+$startY).'" style="stroke:#e1e1e1; stroke-width:2px;" />';
|
||||
if($y%2 == 0)
|
||||
echo '<text x="'.$x1.'" y="'.($startY-5).'" style="font-size:13px">'.$i.'</text>';
|
||||
$y++;
|
||||
}
|
||||
// Zeichne Raster studienjahr SS
|
||||
for($i=1; $i<=$kw_new; $i++)
|
||||
{
|
||||
$x1 = ($startX +$y*$widthPerWeek);
|
||||
echo '<line x1="'.$x1.'" y1="'.$startY.'" x2="'.$x1.'" y2="'.($height+$startY).'" style="stroke:#e1e1e1; stroke-width:2px;" />';
|
||||
if($y%2 == 0)
|
||||
echo '<text x="'.$x1.'" y="'.($startY-5).'" style="font-size:13px">'.$i.'</text>';
|
||||
$y++;
|
||||
}
|
||||
echo '<rect x="'.$startX.'" y="'.$startY.'" width="'.($y*$widthPerWeek).'" height="'.$height.'"
|
||||
style="color:#000000;fill:none;stroke:#e1e1e1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />';
|
||||
|
||||
$i=0;
|
||||
foreach($projekt->result as $projekt)
|
||||
{
|
||||
$width = 0;
|
||||
$x = 0;
|
||||
// wenn kein start oder ende angegeben -> nichts zeichnen -> width=0
|
||||
if($projekt->beginn != '' && $projekt->ende != '')
|
||||
{
|
||||
$timestamp_beginn = $datum->mktime_fromdate($projekt->beginn);
|
||||
$timestamp_end = $datum->mktime_fromdate($projekt->ende);
|
||||
$kw_beginn = kalenderwoche($timestamp_beginn);
|
||||
$kw_end = kalenderwoche($timestamp_end);
|
||||
$kw_beginn = $kw_beginn;
|
||||
$kw_end = $kw_end;
|
||||
|
||||
$startSS = $kw_gesamt-$kw_old;
|
||||
|
||||
$year_beginn=date("Y",$timestamp_beginn);
|
||||
$year_end=date("Y",$timestamp_end);
|
||||
$test = 0;
|
||||
// phase beginnt und endet im WS
|
||||
if($year_end == $year_beginn && $year_beginn == $studienjahr && $kw_beginn >= $kw_old)
|
||||
{
|
||||
$width = ($kw_end - $kw_beginn + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn-$kw_old)*$widthPerWeek);
|
||||
$test = 1;
|
||||
}
|
||||
// phase beginnt und endet im SS
|
||||
if($year_end == $year_beginn && $year_beginn == $studienjahr+1 && $kw_beginn >= 1 && $kw_end <=$kw_new)
|
||||
{
|
||||
if($kw_end == 1)// es kann auch sein dass 31.12 des kalenderjahres schon in der 1. KW liegt
|
||||
$kw_end =$kw_new;
|
||||
$width = ($kw_end - $kw_beginn + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn+$startSS)*$widthPerWeek);
|
||||
$test = 2;
|
||||
}
|
||||
// phase beginnt im WS und endet im SS
|
||||
else if($year_beginn == $studienjahr && $year_end == $studienjahr+1 && $kw_beginn >= $kw_old && $kw_end <= $kw_new)
|
||||
{
|
||||
$width = ($kw_gesamt - $kw_beginn + $kw_end + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn-$kw_old)*$widthPerWeek);
|
||||
$test = 3;
|
||||
}
|
||||
// geht über gesamtes studienjahr
|
||||
else if($year_beginn == $studienjahr && $kw_beginn <= $kw_old && (($year_end == $studienjahr+1 && $kw_end >= $kw_new) || $year_end > $studienjahr+1))
|
||||
{
|
||||
$width = $y*$widthPerWeek;
|
||||
$x = $startX;
|
||||
$test = 4;
|
||||
}
|
||||
// geht über gesamtes studienjahr
|
||||
else if($year_beginn < $studienjahr && $year_end > $studienjahr+1)
|
||||
{
|
||||
$width = $y*$widthPerWeek;
|
||||
$x = $startX;
|
||||
$test = 5;
|
||||
}
|
||||
// beginnt früher und endet im aktuellen WS
|
||||
else if((($year_beginn == $studienjahr && $kw_beginn < $kw_old) || ($year_beginn < $studienjahr)) && ($year_end == $studienjahr && $kw_end >= $kw_old))
|
||||
{
|
||||
|
||||
$width = ($kw_end - $kw_old + 1)*$widthPerWeek;
|
||||
$x = $startX;
|
||||
$test = 6;
|
||||
}
|
||||
// beginnt früher und endet im aktuellen SS
|
||||
else if((($year_beginn == $studienjahr && $kw_beginn < $kw_old) || ($year_beginn < $studienjahr)) && ($year_end == $studienjahr+1 && $kw_end <= $kw_new))
|
||||
{
|
||||
if($kw_end == 1) // es kann auch sein dass 31.12 des kalenderjahres schon in der 1. KW liegt
|
||||
$kw_end =$kw_new;
|
||||
$width = ($kw_gesamt - $kw_old + $kw_end + 1)*$widthPerWeek;
|
||||
$x = $startX;
|
||||
$test = 7;
|
||||
}
|
||||
// beginnt im aktuellen WS und endet nach Studienjahr im aktuellen Kalenderjahr
|
||||
else if(($year_beginn == $studienjahr && $kw_beginn >= $kw_old) && ($year_end == $studienjahr+1 && $kw_end > $kw_new))
|
||||
{
|
||||
$width = ($kw_gesamt - $kw_beginn + $kw_new + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn-$kw_old)*$widthPerWeek);
|
||||
$test = 8;
|
||||
}
|
||||
// beginnt im aktuellen WS und endet nach Studienjahr und nach aktuellem Kalenderjahr
|
||||
else if(($year_beginn == $studienjahr && $kw_beginn > $kw_old) && ($year_end > $studienjahr+1))
|
||||
{
|
||||
$width = ($kw_gesamt - $kw_beginn + $kw_new + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn-$kw_old)*$widthPerWeek);
|
||||
$test = 9;
|
||||
}
|
||||
// beginnt im aktuellen SS und endet nach Studienjahr im aktuellen Kalenderjahr
|
||||
else if(($year_beginn == $studienjahr+1 && $kw_beginn <= $kw_new) && ($year_end == $studienjahr+1 && ($kw_end > $kw_new || $kw_end == 1))) // da 31.123
|
||||
{
|
||||
$width = ($y-$kw_beginn - $startSS)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn+$startSS)*$widthPerWeek);
|
||||
$test = 10;
|
||||
}
|
||||
// beginnt im aktuellen SS und endet nach Studienjahr und nach aktuellem Kalenderjahr
|
||||
else if(($year_beginn == $studienjahr+1 && $kw_beginn <= $kw_new) && ($year_end > $studienjahr+1))
|
||||
{
|
||||
$width = ($y-$kw_beginn - $startSS)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn+$startSS)*$widthPerWeek);
|
||||
$test = 11;
|
||||
}
|
||||
}
|
||||
|
||||
// zeichne balken
|
||||
echo "test:".$test.$projekt->titel."jahr".$studienjahr;
|
||||
echo '<rect x="'.$x.'" y="'.($startY+10+$i*50).'" width ="'.$width.'" height ="30" fill="blue" stroke="black" />';
|
||||
echo'<text x="'.($startX-10).'" y="'.($startY+30+$i*50).'" style="font-size:15px" text-anchor="end">'.$projekt->titel.'</text>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo'<text x="10%" y="'.((($i+1)*50)+$startY).'" style="font-size:16px">Organistationseinheit: '.$projekt->oe_kurzbz.'</text>';
|
||||
|
||||
// aktuelle KW markieren
|
||||
$timestamp_now = time();
|
||||
$kw_now = kalenderwoche($timestamp_now);
|
||||
$year_now=date("Y",$timestamp_now);
|
||||
if($year_now == $studienjahr && $kw_now > $kw_old)
|
||||
{
|
||||
$x = (($startX +(($kw_now-$kw_old)*$widthPerWeek))-$widthPerWeek/2);
|
||||
echo '<line x1="'.$x.'" y1="'.($startY-20).'" x2="'.$x.'" y2="'.($height+$startY+20).'" style="stroke:red; stroke-width:4px;" />';
|
||||
}
|
||||
else if($year_now == $studienjahr+1 && $kw_now < $kw_new)
|
||||
{
|
||||
$x = (($startX +(($kw_now+$kw_gesamt - $kw_old +1 )*$widthPerWeek))-$widthPerWeek/2);
|
||||
echo '<line x1="'.$x.'" y1="'.($startY-20).'" x2="'.$x.'" y2="'.($height+$startY+20).'" style="stroke:red; stroke-width:4px;" />';
|
||||
}
|
||||
echo '</svg>';
|
||||
}
|
||||
else if($year_now == $studienjahr+1 && $kw_now < $kw_new)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Zeichnet den Chart für alle Phasen eines übergebenen PRojektes
|
||||
*/
|
||||
function getProjektGantt()
|
||||
{
|
||||
global $projekt_kurzbz;
|
||||
global $studienjahr;
|
||||
global $ansicht;
|
||||
|
||||
$projektphasen = new projektphase();
|
||||
if(!$projektphasen->getProjektphasen($projekt_kurzbz))
|
||||
die('Kein gültiges Projekt übergeben.');
|
||||
$projekt = new projekt();
|
||||
if(!$projekt->load($projekt_kurzbz))
|
||||
die('Konnte Projekt nicht laden.');
|
||||
|
||||
$datum = new datum();
|
||||
$widthPerWeek = 16;
|
||||
$startX = 20;
|
||||
$startY = 90;
|
||||
// KW in der 28.12 liegt ist letzte KW
|
||||
$datum_gesamt = $studienjahr.'-12-28';
|
||||
$timestamp_gesamt = $datum->mktime_fromdate($datum_gesamt);
|
||||
$kw_gesamt = date('W',$timestamp_gesamt);
|
||||
|
||||
// kommt auf Anzahl der Phasen an
|
||||
$height = (count($projektphasen->result)) * 50;
|
||||
|
||||
// Zeichne Kalenderjahr -> beginnend mit KW 1
|
||||
if($ansicht=='kalenderjahr')
|
||||
{
|
||||
$x = (($startX +(($kw_now+$kw_gesamt - $kw_old +1 )*$widthPerWeek))-$widthPerWeek/2);
|
||||
echo '<line x1="'.$x.'" y1="'.($startY-20).'" x2="'.$x.'" y2="'.($height+$startY+20).'" style="stroke:red; stroke-width:4px;" />';
|
||||
echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">';
|
||||
|
||||
echo '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="100%" height="100%" viewBox="0 0 750 600">
|
||||
<rect x="'.$startX.'" y="'.$startY.'" width="'.($kw_gesamt*$widthPerWeek).'" height="'.$height.'"
|
||||
style="color:#000000;fill:none;stroke:#e1e1e1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />';
|
||||
|
||||
// Überschriften
|
||||
echo'<text x="30%" y="40" style="font-size:33px">Kalenderjahr: '.$studienjahr.'</text>';
|
||||
echo'<text x="'.($startX-10).'" y="'.($startY-5).'" style="font-size:13px" text-anchor="end"> KW:</text>';
|
||||
|
||||
// Zeichne Raster
|
||||
for($i=1; $i<=$kw_gesamt; $i++)
|
||||
{
|
||||
$x1 = $startX + $i*$widthPerWeek;
|
||||
echo '<line x1="'.$x1.'" y1="'.$startY.'" x2="'.$x1.'" y2="'.($height+$startY).'" style="stroke:#e1e1e1; stroke-width:2px;" />';
|
||||
if($i%2 == 1)
|
||||
echo '<text x="'.($x1-$widthPerWeek).'" y="'.($startY-5).'" style="font-size:13px">'.$i.'</text>';
|
||||
|
||||
}
|
||||
|
||||
// aktuelle KW markieren
|
||||
$timestamp_now = time();
|
||||
$kw_now = kalenderwoche($timestamp_now);
|
||||
$year_now=date("Y",$timestamp_now);
|
||||
if($year_now == $studienjahr)
|
||||
{
|
||||
$x = (($startX +($kw_now*$widthPerWeek))-$widthPerWeek/2);
|
||||
echo '<line x1="'.$x.'" y1="'.($startY-20).'" x2="'.$x.'" y2="'.($height+$startY+20).'" style="stroke:red; stroke-width:4px;" />';
|
||||
}
|
||||
|
||||
$i=0;
|
||||
foreach($projektphasen->result as $phase)
|
||||
{
|
||||
$width = 0;
|
||||
$x = 0;
|
||||
// wenn kein start oder ende angegeben -> nichts zeichnen -> width=0
|
||||
if($phase->start != '' && $phase->ende != '')
|
||||
{
|
||||
$timestamp_beginn = $datum->mktime_fromdate($phase->start);
|
||||
$timestamp_end = $datum->mktime_fromdate($phase->ende);
|
||||
$kw_beginn = kalenderwoche($timestamp_beginn);
|
||||
$kw_end = kalenderwoche($timestamp_end);
|
||||
// kw soll bei 0 zu zeichnen beginnen
|
||||
$kw_beginn = $kw_beginn -1;
|
||||
$kw_end = $kw_end -1;
|
||||
|
||||
$year_beginn=date("Y",$timestamp_beginn);
|
||||
$year_end=date("Y",$timestamp_end);
|
||||
|
||||
// phase beginnt und endet im Jahr
|
||||
if($year_end == $year_beginn && $year_beginn == $studienjahr)
|
||||
{
|
||||
$width = ($kw_end - $kw_beginn+1)*$widthPerWeek;
|
||||
$x = ($startX+$kw_beginn*$widthPerWeek);
|
||||
}
|
||||
// endet im nächsten jahr
|
||||
else if($year_beginn == $studienjahr && $year_end > $year_beginn)
|
||||
{
|
||||
$width = ($kw_gesamt - $kw_beginn)*$widthPerWeek;
|
||||
$x = ($startX+$kw_beginn*$widthPerWeek);
|
||||
}
|
||||
// geht über gesamtes jahr
|
||||
else if($year_beginn < $studienjahr && $year_end > $studienjahr)
|
||||
{
|
||||
$width = ($kw_gesamt*$widthPerWeek);
|
||||
$x = $startX;
|
||||
}
|
||||
// beginnt im vorigen und endet im aktuellen
|
||||
else if($year_beginn < $studienjahr && $year_end == $studienjahr)
|
||||
{
|
||||
$width = ($kw_end+1)*$widthPerWeek;
|
||||
$x = $startX;
|
||||
}
|
||||
}
|
||||
|
||||
// zeichne balken
|
||||
echo '<rect x="'.$x.'" y="'.($startY+10+$i*50).'" width ="'.$width.'" height ="30" fill="blue" stroke="black" />';
|
||||
echo'<text x="'.($startX-10).'" y="'.($startY+30+$i*50).'" style="font-size:15px" text-anchor="end">'.$phase->bezeichnung.'</text>';
|
||||
$i++;
|
||||
}
|
||||
echo'<text x="10%" y="'.((($i+1)*50)+$startY).'" style="font-size:16px">Projekt: '.$projekt->titel.'</text>';
|
||||
|
||||
echo '</svg>';
|
||||
}
|
||||
else if($ansicht == 'studienjahr')
|
||||
{
|
||||
echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">';
|
||||
echo '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="100%" height="100%" viewBox="0 0 750 600">';
|
||||
|
||||
// Überschriften
|
||||
echo'<text x="30%" y="40" style="font-size:33px">Studienjahr: '.$studienjahr.'/'.($studienjahr+1).'</text>';
|
||||
echo'<text x="'.($startX-10).'" y="'.($startY-5).'" style="font-size:13px" text-anchor="end"> KW:</text>';
|
||||
|
||||
// WS
|
||||
$year_old = $studienjahr.'-09-01';
|
||||
$timestamp_old = $datum->mktime_fromdate($year_old);
|
||||
$kw_old = kalenderwoche($timestamp_old);
|
||||
|
||||
// SS
|
||||
$year_new = ($studienjahr+1).'-09-01';
|
||||
$timestamp_new = $datum->mktime_fromdate($year_new);
|
||||
$kw_new = kalenderwoche($timestamp_new);
|
||||
|
||||
// gesamtanzahl der KWs im Studienjahr
|
||||
$y = 0;
|
||||
// Zeichne Raster studienjahr WS
|
||||
for($i=$kw_old; $i<=$kw_gesamt; $i++)
|
||||
{
|
||||
$x1 = ($startX +$y*$widthPerWeek);
|
||||
echo '<line x1="'.$x1.'" y1="'.$startY.'" x2="'.$x1.'" y2="'.($height+$startY).'" style="stroke:#e1e1e1; stroke-width:2px;" />';
|
||||
if($y%2 == 0)
|
||||
echo '<text x="'.$x1.'" y="'.($startY-5).'" style="font-size:13px">'.$i.'</text>';
|
||||
$y++;
|
||||
}
|
||||
// Zeichne Raster studienjahr SS
|
||||
for($i=1; $i<=$kw_new; $i++)
|
||||
{
|
||||
$x1 = ($startX +$y*$widthPerWeek);
|
||||
echo '<line x1="'.$x1.'" y1="'.$startY.'" x2="'.$x1.'" y2="'.($height+$startY).'" style="stroke:#e1e1e1; stroke-width:2px;" />';
|
||||
if($y%2 == 0)
|
||||
echo '<text x="'.$x1.'" y="'.($startY-5).'" style="font-size:13px">'.$i.'</text>';
|
||||
$y++;
|
||||
}
|
||||
echo '<rect x="'.$startX.'" y="'.$startY.'" width="'.($y*$widthPerWeek).'" height="'.$height.'"
|
||||
style="color:#000000;fill:none;stroke:#e1e1e1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />';
|
||||
|
||||
$i=0;
|
||||
foreach($projektphasen->result as $phase)
|
||||
{
|
||||
$width = 0;
|
||||
$x = 0;
|
||||
// wenn kein start oder ende angegeben -> nichts zeichnen -> width=0
|
||||
if($phase->start != '' && $phase->ende != '')
|
||||
{
|
||||
$timestamp_beginn = $datum->mktime_fromdate($phase->start);
|
||||
$timestamp_end = $datum->mktime_fromdate($phase->ende);
|
||||
$kw_beginn = kalenderwoche($timestamp_beginn);
|
||||
$kw_end = kalenderwoche($timestamp_end);
|
||||
$kw_beginn = $kw_beginn;
|
||||
$kw_end = $kw_end;
|
||||
|
||||
$startSS = $kw_gesamt-$kw_old;
|
||||
|
||||
$year_beginn=date("Y",$timestamp_beginn);
|
||||
$year_end=date("Y",$timestamp_end);
|
||||
$test = 0;
|
||||
// phase beginnt und endet im WS
|
||||
if($year_end == $year_beginn && $year_beginn == $studienjahr && $kw_beginn >= $kw_old)
|
||||
{
|
||||
$width = ($kw_end - $kw_beginn + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn-$kw_old)*$widthPerWeek);
|
||||
$test = 1;
|
||||
}
|
||||
// phase beginnt und endet im SS
|
||||
if($year_end == $year_beginn && $year_beginn == $studienjahr+1 && $kw_beginn >= 1 && $kw_end <=$kw_new)
|
||||
{
|
||||
if($kw_end == 1)// es kann auch sein dass 31.12 des kalenderjahres schon in der 1. KW liegt
|
||||
$kw_end =$kw_new;
|
||||
$width = ($kw_end - $kw_beginn + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn+$startSS)*$widthPerWeek);
|
||||
$test = 2;
|
||||
}
|
||||
// phase beginnt im WS und endet im SS
|
||||
else if($year_beginn == $studienjahr && $year_end == $studienjahr+1 && $kw_beginn >= $kw_old && $kw_end <= $kw_new)
|
||||
{
|
||||
$width = ($kw_gesamt - $kw_beginn + $kw_end + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn-$kw_old)*$widthPerWeek);
|
||||
$test = 3;
|
||||
}
|
||||
// geht über gesamtes studienjahr
|
||||
else if($year_beginn == $studienjahr && $kw_beginn <= $kw_old && (($year_end == $studienjahr+1 && $kw_end >= $kw_new) || $year_end > $studienjahr+1))
|
||||
{
|
||||
$width = $y*$widthPerWeek;
|
||||
$x = $startX;
|
||||
$test = 4;
|
||||
}
|
||||
// geht über gesamtes studienjahr
|
||||
else if($year_beginn < $studienjahr && $year_end > $studienjahr+1)
|
||||
{
|
||||
$width = $y*$widthPerWeek;
|
||||
$x = $startX;
|
||||
$test = 5;
|
||||
}
|
||||
// beginnt früher und endet im aktuellen WS
|
||||
else if((($year_beginn == $studienjahr && $kw_beginn < $kw_old) || ($year_beginn < $studienjahr)) && ($year_end == $studienjahr && $kw_end >= $kw_old))
|
||||
{
|
||||
|
||||
$width = ($kw_end - $kw_old + 1)*$widthPerWeek;
|
||||
$x = $startX;
|
||||
$test = 6;
|
||||
}
|
||||
// beginnt früher und endet im aktuellen SS
|
||||
else if((($year_beginn == $studienjahr && $kw_beginn < $kw_old) || ($year_beginn < $studienjahr)) && ($year_end == $studienjahr+1 && $kw_end <= $kw_new))
|
||||
{
|
||||
if($kw_end == 1) // es kann auch sein dass 31.12 des kalenderjahres schon in der 1. KW liegt
|
||||
$kw_end =$kw_new;
|
||||
$width = ($kw_gesamt - $kw_old + $kw_end + 1)*$widthPerWeek;
|
||||
$x = $startX;
|
||||
$test = 7;
|
||||
}
|
||||
// beginnt im aktuellen WS und endet nach Studienjahr im aktuellen Kalenderjahr
|
||||
else if(($year_beginn == $studienjahr && $kw_beginn >= $kw_old) && ($year_end == $studienjahr+1 && $kw_end > $kw_new))
|
||||
{
|
||||
$width = ($kw_gesamt - $kw_beginn + $kw_new + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn-$kw_old)*$widthPerWeek);
|
||||
$test = 8;
|
||||
}
|
||||
// beginnt im aktuellen WS und endet nach Studienjahr und nach aktuellem Kalenderjahr
|
||||
else if(($year_beginn == $studienjahr && $kw_beginn > $kw_old) && ($year_end > $studienjahr+1))
|
||||
{
|
||||
$width = ($kw_gesamt - $kw_beginn + $kw_new + 1)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn-$kw_old)*$widthPerWeek);
|
||||
$test = 9;
|
||||
}
|
||||
// beginnt im aktuellen SS und endet nach Studienjahr im aktuellen Kalenderjahr
|
||||
else if(($year_beginn == $studienjahr+1 && $kw_beginn <= $kw_new) && ($year_end == $studienjahr+1 && ($kw_end > $kw_new || $kw_end == 1))) // da 31.123
|
||||
{
|
||||
$width = ($y-$kw_beginn - $startSS)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn+$startSS)*$widthPerWeek);
|
||||
$test = 10;
|
||||
}
|
||||
// beginnt im aktuellen SS und endet nach Studienjahr und nach aktuellem Kalenderjahr
|
||||
else if(($year_beginn == $studienjahr+1 && $kw_beginn <= $kw_new) && ($year_end > $studienjahr+1))
|
||||
{
|
||||
$width = ($y-$kw_beginn - $startSS)*$widthPerWeek;
|
||||
$x = ($startX+($kw_beginn+$startSS)*$widthPerWeek);
|
||||
$test = 11;
|
||||
}
|
||||
}
|
||||
|
||||
// zeichne balken
|
||||
echo "test:".$test.$phase->bezeichnung."jahr".$studienjahr;
|
||||
echo '<rect x="'.$x.'" y="'.($startY+10+$i*50).'" width ="'.$width.'" height ="30" fill="blue" stroke="black" />';
|
||||
echo'<text x="'.($startX-10).'" y="'.($startY+30+$i*50).'" style="font-size:15px" text-anchor="end">'.$phase->bezeichnung.'</text>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo'<text x="10%" y="'.((($i+1)*50)+$startY).'" style="font-size:16px">Projekt: '.$projekt->titel.'</text>';
|
||||
|
||||
// aktuelle KW markieren
|
||||
$timestamp_now = time();
|
||||
$kw_now = kalenderwoche($timestamp_now);
|
||||
$year_now=date("Y",$timestamp_now);
|
||||
if($year_now == $studienjahr && $kw_now > $kw_old)
|
||||
{
|
||||
$x = (($startX +(($kw_now-$kw_old)*$widthPerWeek))-$widthPerWeek/2);
|
||||
echo '<line x1="'.$x.'" y1="'.($startY-20).'" x2="'.$x.'" y2="'.($height+$startY+20).'" style="stroke:red; stroke-width:4px;" />';
|
||||
}
|
||||
else if($year_now == $studienjahr+1 && $kw_now < $kw_new)
|
||||
{
|
||||
$x = (($startX +(($kw_now+$kw_gesamt - $kw_old +1 )*$widthPerWeek))-$widthPerWeek/2);
|
||||
echo '<line x1="'.$x.'" y1="'.($startY-20).'" x2="'.$x.'" y2="'.($height+$startY+20).'" style="stroke:red; stroke-width:4px;" />';
|
||||
}
|
||||
echo '</svg>';
|
||||
}
|
||||
echo '</svg>';
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user