Planner - Übersicht über die Auslastung der Ressourcen

This commit is contained in:
Andreas Österreicher
2011-10-19 14:49:26 +00:00
parent a2b4351651
commit 612908c01c
5 changed files with 252 additions and 49 deletions
+3 -3
View File
@@ -11,7 +11,7 @@ echo '<?xul-overlay href="'.APP_ROOT.'content/projekt/projekttask.overlay.xul.ph
echo '<?xul-overlay href="'.APP_ROOT.'content/projekt/projektdokument.overlay.xul.php"?>';
echo '<?xul-overlay href="'.APP_ROOT.'content/projekt/gantt.overlay.xul.php"?>';
echo '<?xul-overlay href="'.APP_ROOT.'content/projekt/bestellung.overlay.xul.php"?>';
/*echo '<?xul-overlay href="'.APP_ROOT.'content/projekt/ressource.overlay.xul.php"?>';*/
echo '<?xul-overlay href="'.APP_ROOT.'content/projekt/ressource.overlay.xul.php"?>';
?>
<!DOCTYPE overlay >
@@ -109,9 +109,9 @@ echo '<?xul-overlay href="'.APP_ROOT.'content/projekt/bestellung.overlay.xul.php
<tab id="tab-projektphase" label="Phasen" />
<tab id="tab-projekttask" label="Tasks" selected="true" />
<tab id="tab-dokumente" label="Dokumente" />
<tab id="tab-ressource" label="Ressourcen" />
<!--
<tab id="tab-bestellung" label="Bestellungen" />
<tab id="tab-ressource" label="Ressourcen" />
<tab id="tab-gantt" label="Gantt" />
-->
<tab id="tab-notiz" label="Eigene Notizen" />
@@ -121,9 +121,9 @@ echo '<?xul-overlay href="'.APP_ROOT.'content/projekt/bestellung.overlay.xul.php
<vbox id="box-projektphase" />
<vbox id="box-projekttask" />
<vbox id="box-dokumente" />
<vbox id="box-ressource" />
<!--
<vbox id="box-bestellung" />
<vbox id="box-ressource" />
<vbox id="box-gantt" />
-->
<vbox id="box-notiz" />
+20 -45
View File
@@ -25,12 +25,12 @@ header("Pragma: no-cache");
header("Content-type: application/vnd.mozilla.xul+xml");
require_once('../../config/vilesci.config.inc.php');
require_once('../../include/projektbenutzer.class.php');
/*require_once('../../include/projektbenutzer.class.php');
$pb= new projektbenutzer();
$pb->load();
$pb->getUIDs();
$datum=$pb->jump_week(time(),0);
$showWeeks=15;
$pb->getUIDs();*/
//$datum=$pb->jump_week(time(),0);
//$showWeeks=15;
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
?>
@@ -50,56 +50,31 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
<!-- * Projekttask * -->
<!-- ************************ -->
<vbox id="box-ressource" flex="1" uid="" stg_kz="">
<popupset>
<popup id="popup-ressource">
<menuitem label="Entfernen" oncommand="TaskDelete();" id="ressource-tree-popup-entf" disabled="false"/>
</popup>
</popupset>
<tabbox id="ressource-tabbox" flex="3" orient="vertical">
<tabs orient="horizontal" id="ressource-tabs">
<tab id="tab-ressource-projekt" label="Projekte" />
<tab id="tab-ressource-projektphase" label="Projektphasen" />
</tabs>
<tabpanels id="tabpanels-ressource-main" flex="1">
<box orient="vertical" id="box-ressource-projekt">
<vbox>
<toolbox>
<toolbar id="toolbar-ressource-projektase-nav-toolbar">
<toolbarbutton id="toolbarbutton-ressource-zoomin" label="Zoom In" oncommand="PhaseNeu();" disabled="true" image="../skin/images/NeuDokument.png" tooltiptext="Neuen Task anlegen" />
<toolbarbutton id="toolbarbutton-ressource-zoomout" label="Zoom Out" oncommand="PhaseDelete();" disabled="true" image="../skin/images/DeleteIcon.png" tooltiptext="Task löschen"/>
<toolbarbutton id="toolbarbutton-ressource-print" label="Drucken" oncommand="PhaseTreeRefresh()" disabled="false" image="../skin/images/refresh.png" tooltiptext="Liste neu laden"/>
<toolbar>
<toolbarbutton id="toolbarbutton-ressource-projekt-aktualisieren" label="Aktualisieren" oncommand="document.getElementById('iframe-ressource-projekt').setAttribute('src','<?php echo APP_ROOT; ?>content/projekt/ressourcenauslastung.php?typ=projekt&amp;'+gettimestamp());" image="../skin/images/refresh.png" tooltiptext="Neu laden"/>
<toolbarbutton id="toolbarbutton-ressource-projekt-drucken" label="Drucken" oncommand="foo = window.open('<?php echo APP_ROOT; ?>content/projekt/ressourcenauslastung.php?typ=projekt');foo.print();" image="../skin/images/drucken.png" tooltiptext="Drucken"/>
</toolbar>
</toolbox>
<grid id="grid-ressource-projekt">
<columns>
<column style="background-color:lightblue; border:1px solid black" />
<?php
for ($i=0; $i<$showWeeks; $i++)
echo '<column />';
?>
</columns>
<rows>
<row style="background-color:lightgreen; border:1px solid black">
<label value="Ressource" />
<?php
for ($i=0; $i<$showWeeks; $i++)
echo '<box><label value="KW ',($pb->kw($pb->jump_week($datum,$i))),' " /></box>';
?>
</row>
<?php
//echo count($pb->uids);
foreach ($pb->uids as $uid)
{
echo '<row style="background-color:lightgreen; border:1px solid black">
<label value="',$uid,'" />';
for ($j=0; $j<$showWeeks; $j++)
echo '<box><label value=" ',($pb->getProjektePerUID($uid,$pb->jump_week($datum,$i))),' " /></box>';
echo '</row>';
}
?>
</rows>
</grid>
</box>
<vbox id="ressource-ressource" />
<iframe id="iframe-ressource-projekt" flex="5" src="<?php echo APP_ROOT; ?>content/projekt/ressourcenauslastung.php?typ=projekt" />
</vbox>
<vbox>
<toolbox>
<toolbar>
<toolbarbutton id="toolbarbutton-ressource-projektphase-aktualisieren" label="Aktualisieren" oncommand="document.getElementById('iframe-ressource-projektphase').setAttribute('src','<?php echo APP_ROOT; ?>content/projekt/ressourcenauslastung.php?typ=phase&amp;'+gettimestamp());" image="../skin/images/refresh.png" tooltiptext="Neu laden"/>
<toolbarbutton id="toolbarbutton-ressource-projektphase-drucken" label="Drucken" oncommand="foo = window.open('<?php echo APP_ROOT; ?>content/projekt/ressourcenauslastung.php?typ=phase');foo.print();" image="../skin/images/drucken.png" tooltiptext="Drucken"/>
</toolbar>
</toolbox>
<iframe id="iframe-ressource-projektphase" flex="5" src="<?php echo APP_ROOT; ?>content/projekt/ressourcenauslastung.php?typ=phase" />
</vbox>
</tabpanels>
</tabbox>
</vbox>
+137
View File
@@ -0,0 +1,137 @@
<?php
/* Copyright (C) 2011 FH Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>
*/
require_once('../../config/vilesci.config.inc.php');
require_once('../../include/functions.inc.php');
require_once('../../include/ressource.class.php');
require_once('../../include/datum.class.php');
require_once('../../include/projektphase.class.php');
$showweeks=15;
$timestamp = time();
$ressource = new ressource();
$ressource_arr = array();
$datum_obj = new datum();
$datum = date('Y-m-d',$timestamp);
if(isset($_GET['typ']) && $_GET['typ']=='projekt')
{
$ressource->getProjektRessoureDatum($datum);
$typ = 'projekt';
$anzahl_warnung = 6;
}
else
{
$ressource->getProjektphaseRessoureDatum($datum);
$typ = 'phase';
$anzahl_warnung = 3;
}
foreach($ressource->result as $row)
$ressource_arr[]=$row->bezeichnung;
$ressource_arr = array_unique($ressource_arr);
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Auslastung</title>
<style>
body
{
font-size: small;
}
table
{
border: 1px solid black;
}
.warning
{
color: red;
font-weight: bold;
}
</style>
</head>
<body>
<table>
<tr>
<th>Ressource ('.$typ.')</th>';
for($i=0;$i<$showweeks;$i++)
{
$timestamp_kw = jump_week($timestamp,$i);
echo '<th>KW '.kalenderwoche($timestamp_kw).'</th>';
}
echo '</tr>';
foreach($ressource_arr as $bezeichnung)
{
echo '<tr>';
echo '<td>'.$bezeichnung.'</td>';
for($i=0;$i<$showweeks;$i++)
{
$timestamp_kw = jump_week($timestamp,$i);
$anzahl=0;
$title='';
reset($ressource->result);
foreach($ressource->result as $row)
{
$start = $datum_obj->mktime_fromdate($row->start);
$ende = $datum_obj->mktime_fromdate($row->ende);
if($row->bezeichnung == $bezeichnung
&& ($row->start=='' || $start<=$timestamp_kw)
&& ($row->ende=='' || $ende>=$timestamp_kw)
)
{
if($typ=='projekt' && $row->projekt_kurzbz!='')
{
$anzahl++;
$title .= $row->projekt_kurzbz.',';
}
elseif($typ=='phase' && $row->projektphase_id!='')
{
$anzahl++;
$phase = new projektphase();
$phase->load($row->projektphase_id);
$title .= $phase->bezeichnung.'('.$row->projektphase_id.'),';
}
}
}
$title = mb_substr($title,0,-1);
echo '<td title="'.$title.'" align="center">';
if($anzahl>=$anzahl_warnung)
echo '<span class="warning">'.$anzahl.'</span>';
else
echo $anzahl;
echo '</td>';
}
echo '</tr>';
}
echo '
</body>
</html>';
?>
+90
View File
@@ -419,5 +419,95 @@ class ressource extends basis_db
return false;
}
}
/**
* Liefert die Ressourcen aller Projekte die zu einem bestimmten Datum aktiv sind
*
* @param $datum
*/
public function getProjektRessoureDatum($datum)
{
$qry = "
SELECT
distinct
tbl_projekt_ressource.*, tbl_projekt.beginn as start, tbl_projekt.ende,
tbl_ressource.student_uid, tbl_ressource.mitarbeiter_uid, tbl_ressource.betriebsmittel_id, tbl_ressource.firma_id,
tbl_ressource.bezeichnung, tbl_ressource.beschreibung
FROM
fue.tbl_ressource
LEFT JOIN fue.tbl_projekt_ressource USING(ressource_id)
LEFT JOIN fue.tbl_projekt USING(projekt_kurzbz)
WHERE
(tbl_projekt.beginn<='".addslashes($datum)."' OR tbl_projekt.beginn is null) AND
(tbl_projekt.ende>='".addslashes($datum)."' OR tbl_projekt.ende is null) ";
if($result = $this->db_query($qry))
{
while($row = $this->db_fetch_object($result))
{
$obj = new ressource();
$obj->projekt_ressource_id = $row->projekt_ressource_id;
$obj->projekt_kurzbz = $row->projekt_kurzbz;
$obj->projektphase_id = $row->projektphase_id;
$obj->start = $row->start;
$obj->ende = $row->ende;
$obj->ressource_id = $row->ressource_id;
$obj->student_uid = $row->student_uid;
$obj->mitarbeiter_uid = $row->mitarbeiter_uid;
$obj->betriebsmittel_id = $row->betriebsmittel_id;
$obj->firma_id = $row->firma_id;
$obj->bezeichnung = $row->bezeichnung;
$obj->beschreibung = $row->beschreibung;
$this->result[] = $obj;
}
}
}
/**
* Liefert die Ressourcen aller Projektphasen die zu einem bestimmten Datum aktiv sind
*
* @param $datum
*/
public function getProjektphaseRessoureDatum($datum)
{
$qry = "
SELECT
distinct
tbl_projekt_ressource.*, tbl_projektphase.start, tbl_projektphase.ende,
tbl_ressource.student_uid, tbl_ressource.mitarbeiter_uid, tbl_ressource.betriebsmittel_id, tbl_ressource.firma_id,
tbl_ressource.bezeichnung, tbl_ressource.beschreibung
FROM
fue.tbl_ressource
LEFT JOIN fue.tbl_projekt_ressource USING(ressource_id)
LEFT JOIN fue.tbl_projektphase USING(projektphase_id)
WHERE
(tbl_projektphase.start<='".addslashes($datum)."' OR tbl_projektphase.start is null) AND
(tbl_projektphase.ende>='".addslashes($datum)."' OR tbl_projektphase.ende is null) ";
if($result = $this->db_query($qry))
{
while($row = $this->db_fetch_object($result))
{
$obj = new ressource();
$obj->projekt_ressource_id = $row->projekt_ressource_id;
$obj->projekt_kurzbz = $row->projekt_kurzbz;
$obj->projektphase_id = $row->projektphase_id;
$obj->start = $row->start;
$obj->ende = $row->ende;
$obj->ressource_id = $row->ressource_id;
$obj->student_uid = $row->student_uid;
$obj->mitarbeiter_uid = $row->mitarbeiter_uid;
$obj->betriebsmittel_id = $row->betriebsmittel_id;
$obj->firma_id = $row->firma_id;
$obj->bezeichnung = $row->bezeichnung;
$obj->beschreibung = $row->beschreibung;
$this->result[] = $obj;
}
}
}
}
?>
+2 -1
View File
@@ -41,7 +41,8 @@
$berechtigung->isBerechtigt('support') ||
$berechtigung->isBerechtigt('preinteressent') ||
$berechtigung->isBerechtigt('lehre') ||
$berechtigung->isBerechtigt('basis/statistik') ||
$berechtigung->isBerechtigt('basis/statistik') ||
$berechtigung->isBerechtigt('assistenz') ||
$berechtigung->isBerechtigt('lv-plan') ))
die ('Keine Berechtigung!');