author | Bettina Schwarzer |
Fri, 05 Feb 2016 14:03:40 +0100 | |
changeset 44 | d652bbba2d43 |
parent 43 | 70cea8f0e807 |
permissions | -rw-r--r-- |
43 | 1 |
<?php |
2 |
||
3 |
/** |
|
4 |
* @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 |
* @copyright 7/2011 |
|
6 |
* |
|
7 |
* Liste Vertragsdaten mit Sortierung und Filter |
|
8 |
*/ |
|
9 |
||
10 |
error_reporting(E_ALL ^ E_NOTICE); |
|
11 |
||
12 |
session_start(); |
|
13 |
if (! isset($_SESSION["userid"])) |
|
14 |
{ |
|
15 |
include_once ("inc/func_lib.inc.php"); |
|
16 |
login("vertrag_flist1.php?g=1"); |
|
17 |
exit; |
|
18 |
} |
|
19 |
||
20 |
if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("vr",$_SESSION["recht"]) && !in_array("ve",$_SESSION["recht"]))) |
|
21 |
{ |
|
22 |
header("Location: start.php"); |
|
23 |
exit; |
|
24 |
} |
|
25 |
||
26 |
?> |
|
27 |
||
28 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
29 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
30 |
||
31 |
<head> |
|
32 |
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> |
|
33 |
<link href="/fhiiqm/css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen" /> |
|
34 |
<link href="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print" /> |
|
35 |
||
36 |
<title>Liste Vertragsdaten</title> |
|
37 |
<script type="text/javascript"> |
|
38 |
function winopen (addr,title) |
|
39 |
{ |
|
40 |
mywin = window.open(addr,title, "width=1400,height=700,left=400,top=300,menubar=yes,status=yes,scrollbars=yes,resizable=yes,toolbar=yes"); |
|
41 |
mywin.focus(); |
|
42 |
} |
|
43 |
</script> |
|
44 |
</head> |
|
45 |
||
46 |
<body onload="document.ffilter.filter.focus();"> |
|
47 |
||
48 |
<?php |
|
49 |
echo " "; |
|
50 |
echo "<div class=\"float-br smaller\" valign='top'>"; |
|
51 |
echo " user: " . $_SESSION["userid"]; |
|
52 |
echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n"; |
|
53 |
echo "<div class=\"float-r\"> <img src=\"img/document_mark_as_final.png\" border=\"0\" alt=\"Verträge\" title=\"Verträge\"/></div>\n"; |
|
54 |
||
55 |
$mfile = $_GET['g']; // Multifile = mehrere Vertragsdokumente moeglich |
|
56 |
if (!$mfile) $mfile = $_POST['g']; |
|
57 |
$zeil = $_GET["z"]; |
|
58 |
if (!$zeil) $zeil = $_POST["z"]; |
|
59 |
if (!$zeil) $zeil = 20; // Anzahl der gezeigten Zeilen |
|
60 |
$start = $_GET["st"]; // Start bei DS $start+1 |
|
61 |
if (!$start) $start=0; |
|
62 |
||
63 |
// Felder, nach denen gefiltert werden kann |
|
64 |
$fields = array(2=>"Bezeichnung",4=>"Bearbeiter",6=>"Vertragstyp",7=>"Produkt",8=>"Partner"); |
|
65 |
||
66 |
$sort = $_GET["s"]; // Sortierung nach Spalte |
|
67 |
if (!isset($sort) && !$sort) $sort = $_POST["s"]; |
|
68 |
||
69 |
$dir = $_GET["d"]; // Sortierrichtung |
|
70 |
if (!isset($dir) && !$dir) $dir = $_POST["d"]; |
|
71 |
||
72 |
$fnum = $_GET["f"]; // Spaltennummer, nach der aktuell gefiltert wird |
|
73 |
if (!isset($fnum) && !$fnum) $fnum = $_POST["f"]; |
|
74 |
||
75 |
$filter = $_POST["filter"]; |
|
76 |
if (!isset($filter) && !$filter) $filter = $_GET["b"]; |
|
77 |
||
78 |
$subf = $_POST["subf"]; // submit |
|
79 |
||
80 |
if (!isset($fnum) || !$fnum) $fnum = 1; |
|
81 |
if (!isset($sort) || !$sort) $sort = 2; |
|
82 |
if (!isset($dir) || !$dir) $dir = ""; |
|
83 |
// $_GET-Parameter zurueck zur Vertragliste mit den selben Einstellungen wie zuvor fuer Update |
|
84 |
$getp = "s=$sort&d=$dir&f=$fnum&b=$filter&st=$start&z=$zeil&g=$mfile"; |
|
85 |
||
86 |
// Recht Produktgruppe beruecksichtigen |
|
87 |
if (is_array($_SESSION["prodg"])) |
|
88 |
{ |
|
89 |
foreach ($_SESSION["prodg"] as $val) |
|
90 |
$listg .= "," .$val; |
|
91 |
$listg = substr($listg,1); |
|
92 |
} |
|
93 |
else $listg = ""; |
|
94 |
||
95 |
// echo "sort=$sort, fnum=$fnum, filter=$filter <br />"; |
|
96 |
include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
97 |
include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
98 |
$dbc = new dbconnection(); |
|
99 |
||
100 |
echo "<div align='center'>\n"; |
|
101 |
//echo "$sort, $dir, $fnum, $filter<br><br>\n"; |
|
102 |
// $sql = "CALL fhiiqm.vertrag_flist1(" . $sort . ",'" . $dir . "', " . $fnum . ", '" . $filter . "',$start,$zeil, @anz)"; |
|
103 |
if ($mfile) |
|
104 |
$sql = "CALL fhiiqm.vertrag_flist1_mf(" . $sort . ",'" . $dir . "', " . $fnum . ", '" . $filter . "', '" . $listg . "', $start,$zeil, @anz)"; |
|
105 |
else |
|
106 |
$sql = "CALL fhiiqm.vertrag_flist1_1(" . $sort . ",'" . $dir . "', " . $fnum . ", '" . $filter . "', '" . $listg . "', $start,$zeil, @anz)"; |
|
107 |
// Parameter: Nr. Sortfelf, Sortierrichtung, Nr. Filterfeld, Filterbegriff, Liste der berechtigten prodgroup, Start bei DS $start+1, Anzahl DS/Seite, Anzahl gefundener Vertraege |
|
108 |
// liefert Felder: contract_ID,cname,clong,bearb,doc,typ,prod |
|
109 |
$result = $dbc -> queryObjectArray($sql); |
|
110 |
if ($result) |
|
111 |
{ |
|
112 |
$bg1 = "#F8F8F8"; |
|
113 |
$bg2 = "#DEDFE1"; |
|
114 |
$bg = "#FFFFFF"; |
|
115 |
||
116 |
$heute = new DateTime(); |
|
117 |
||
118 |
$vanz = $dbc -> querySingleItem("SELECT @anz"); |
|
119 |
||
120 |
echo "<p><b>Verträge - Übersicht</b></p>\n"; |
|
121 |
echo "<table border='0' cellspacing='0'>\n"; |
|
122 |
echo "<tr><td class='bigger'>Mittels '<img src='/fhiiqm/img/auf.gif' border='0' width='11' hight='11' />' / '<img src='/fhiiqm/img/ab.gif' border='0' width='11' hight='11' />' |
|
123 |
können Sie nach jeder Spalte auf- bzw. absteigend sortieren</td></tr> |
|
124 |
<tr><td class='bigger'>'<img src='/fhiiqm/img/filter.gif' border='0' width='14' hight='11' />' ermöglicht das Filtern nach ausgewählten Spalten der Liste</td></tr> |
|
125 |
<tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' hight='11'>' - Bearbeiten der Vertragsdaten, |
|
126 |
'<img src='/fhiiqm/img/file_extension_xls.png' border='0' hight='11'>' - Excel-Export</td></tr>\n"; |
|
127 |
echo "</table>\n"; |
|
128 |
printf ("<p>Anzahl Verträge: %s </p>", $vanz); |
|
129 |
echo "</div>\n"; |
|
130 |
echo "<p> <a href=\"/fhiiqm/vertrag_flist12.php?$getp\" class=\"sc\" title=\"Vertragliste 2\" onclick=\"winopen(this.href,'Vertragsliste 2'); return false\">Verträge Teil 2</a></p>\n"; |
|
131 |
echo "<div align='center'>\n"; |
|
132 |
||
133 |
||
134 |
if (isset($fnum) && $fnum>1 && !$filter && !$subf) |
|
135 |
{ |
|
136 |
// Formular anzeigen fuer Filterbegriff |
|
137 |
$text = $fields[$fnum]; |
|
138 |
$azeil = array(10=>'10',20=>'20',25=>'25',50=>'50',100=>'100',9999=>'alle'); // Anzahl gezeigter rows |
|
139 |
echo "<form action=" . $_SERVER['PHP_SELF'] . " method='post' enctype='application/x-www-form-urlencoded' id='ffilter' name='ffilter' target='_self'>\n"; |
|
140 |
echo "<input type='hidden' name='s' value='$sort'>"; |
|
141 |
echo "<input type='hidden' name='d' value='$dir'>"; |
|
142 |
echo "<input type='hidden' name='f' value='$fnum'>"; |
|
143 |
echo "<input type='hidden' name='g' value='$mfile'>"; |
|
144 |
echo "<table width=\"40%\" border=\"0\">\n"; |
|
145 |
echo "<tr><td>filtern nach $text: </td>"; |
|
146 |
echo "<td><input id='filter' name='filter' type=\"text\" size=\"30\" maxlength=\"30\" value=\"$filter\""; |
|
147 |
if ($fnum == 6) |
|
148 |
{ |
|
149 |
$sql = "SELECT vtyp_kurz, vtyp_bezeichnung FROM Vertrag_Typ ORDER BY 1"; |
|
150 |
if ($res = $dbc->queryObjectArray($sql)) |
|
151 |
{ |
|
152 |
foreach ($res as $row) |
|
153 |
$title .= ", " . $row->vtyp_kurz." - ".$row->vtyp_bezeichnung; |
|
154 |
echo "title='".substr($title,2)."' "; |
|
155 |
} |
|
156 |
} |
|
157 |
echo "/></td>"; |
|
158 |
echo "<td>Zeilen/Seite? <select name='z'>\n"; |
|
159 |
foreach ($azeil as $key=>$val) |
|
160 |
{ |
|
161 |
if ($key == $zeil) $select = "selected"; else $select = ""; |
|
162 |
echo "<option $select value='$key'>$val</option>\n"; |
|
163 |
} |
|
164 |
echo "</select></td>\n"; |
|
165 |
echo "<td><input class=\"button\" type=\"submit\" value=\"finden\" name=\"subf\" title=\"subf\" /></td></tr></table>\n"; |
|
166 |
echo "</form>\n"; |
|
167 |
echo "<p> </p>\n"; |
|
168 |
} |
|
169 |
echo "<table width='99%'>\n"; |
|
170 |
||
171 |
if ($filter>'!') echo "<tr><td class='bigger' colspan=6>Filter: ". $fields["$fnum"] . " wie '$filter'</td><tr>\n"; |
|
172 |
// echo "<tr bgcolor='#CFDEF0'><th>Bezeichnung</th><th>Titel</th><th>Beschreibung</th><th>Typ</th><th>Beginn</th><th>Ende</th><th>Künd.frist(mon)</th> |
|
173 |
// <th>Dokument</th><th>Bemerkung</th><th> </th></tr>\n"; |
|
174 |
||
175 |
echo "<tr bgcolor='#68ACBF'>"; |
|
176 |
tab_column(8,"Partner",$sort,$dir,8,$fnum,$filter,$start,$zeil,"",$mfile); |
|
177 |
tab_column(2,"Bezeichnung",$sort,$dir,2,$fnum,$filter,$start,$zeil,"",$mfile); |
|
178 |
tab_column(3,"Beschreibung",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",$mfile); |
|
179 |
tab_column(6,"Typ",$sort,$dir,6,$fnum,$filter,$start,$zeil,"",$mfile); |
|
180 |
tab_column(7,"zu Produkt",$sort,$dir,7,$fnum,$filter,$start,$zeil,"",$mfile); |
|
181 |
tab_column(4,"Bearbeiter",$sort,$dir,4,$fnum,$filter,$start,$zeil,"",$mfile); |
|
182 |
if ($mfile) |
|
183 |
tab_column(5,"Dokument, Schlagwort",$sort,$dir,5,$fnum,$filter,$start,$zeil,"",$mfile); |
|
184 |
else |
|
185 |
tab_column(5,"Dokument",$sort,$dir,0,$fnum,$filter,$start,$zeil); |
|
186 |
echo "<th> </th></tr>\n"; |
|
187 |
foreach ($result as $row) |
|
188 |
{ |
|
189 |
if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
190 |
echo "<tr bgcolor='" . $bg . "'>"; |
|
191 |
echo "<td>$row->partfirma</td>"; |
|
192 |
if ($row->cend) |
|
193 |
{ |
|
194 |
$ce = new DateTime($row->cend); |
|
195 |
if ((!$row->cauto || is_null($row->cauto)) && $heute > $ce) $class="class='red'"; else $class=""; |
|
196 |
} |
|
197 |
else $class=""; |
|
198 |
echo "<td width='17%' $class><b>$row->cname<br /></b></td>"; |
|
199 |
// echo "<td>$row->contract_s</td>"; |
|
200 |
echo "<td width='22%'>" . nl2br($row->clong) . "</td>"; |
|
201 |
echo "<td>$row->typ</td>"; |
|
202 |
echo "<td>$row->prod</td>"; |
|
203 |
echo "<td>$row->bearb</td>"; |
|
204 |
if ($mfile) |
|
205 |
{ |
|
206 |
$docsw = explode("; ", $row->doc); |
|
207 |
if (isset($docsw) && is_array($docsw)) |
|
208 |
{ |
|
209 |
echo "<td>"; |
|
210 |
foreach ($docsw as $val) |
|
211 |
{ |
|
212 |
$file = substr($val,0,strpos($val,'|')); |
|
213 |
$sw = substr($val,strpos($val,'|')+1); |
|
214 |
if ($fnum == 5 && $filter > '!') // Filterbegriff in Schlagwort hervorheben |
|
215 |
{ |
|
216 |
$sw = str_replace(lcfirst($filter),"<b>".lcfirst($filter)."</b>",$sw); |
|
217 |
$sw = str_replace(ucfirst($filter),"<b>".ucfirst($filter)."</b>",$sw); |
|
218 |
} |
|
219 |
if ($sw) $sw = " → <em>$sw</em>"; else $sw = ""; |
|
220 |
if (file_exists("documents/$file")) |
|
221 |
{ |
|
222 |
$doc = substr($file,strpos($file,"_")+1); |
|
223 |
echo "<a href='documents/$file'>$doc</a>$sw<br />"; |
|
224 |
} |
|
225 |
else |
|
226 |
echo "$file$sw<br />"; |
|
227 |
} |
|
228 |
echo "</td>"; |
|
229 |
} |
|
230 |
} |
|
231 |
else |
|
232 |
{ |
|
233 |
if (file_exists("documents/".$row->doc)) |
|
234 |
{ |
|
235 |
$doc = substr($row->doc,strpos($row->doc,"_")+1); |
|
236 |
echo "<td><a href='documents/$row->doc'>$doc</a></td>"; |
|
237 |
} |
|
238 |
else |
|
239 |
echo "<td>$row->doc</td>"; |
|
240 |
} |
|
241 |
if ($mfile) $part = "ed"; else $part = "upd"; |
|
242 |
echo "<td><a href='/fhiiqm/vertrag_$part.php?uid=$row->contract_ID&$getp'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n"; |
|
243 |
} |
|
244 |
echo "</table></div>\n"; |
|
245 |
echo "<br /> "; |
|
246 |
||
247 |
// Sortierung und Filter aus $_GET fuer weitere Seiten |
|
248 |
foreach ($_GET as $key=>$val) |
|
249 |
{ |
|
250 |
if ($key != "st") $liste .= "&" . $key ."=".$val; |
|
251 |
} |
|
252 |
// Sortierung und Filter aus $_POST fuer weitere Seiten |
|
253 |
if ($subf) |
|
254 |
foreach ($_POST as $key=>$val) |
|
255 |
{ |
|
256 |
if ($key != "st" && $key != "subf" && $key != "filter") $liste .= "&" . $key ."=".$val; |
|
257 |
if ($key == "filter") $liste .= "&b=" . $val; |
|
258 |
} |
|
259 |
||
260 |
// Links auf andere Seiten generieren |
|
261 |
liste_links($start,$zeil,$vanz,$liste); |
|
262 |
||
263 |
// Export csv-Datei |
|
264 |
echo " <span class='sc'><a href='/fhiiqm/vertrag_list12_csv.php?$getp'> |
|
265 |
<img src='/fhiiqm/img/file_extension_xls.png' border='0' title='Export dieser Auswahl nach Excel(csv)' /></a></span>"; |
|
266 |
} |
|
267 |
else |
|
268 |
{ |
|
269 |
echo "<p class='red'>Leider wurde nichts gefunden mit Ihrem Suchbegriff '$filter'!</p>\n"; |
|
270 |
echo "<p><a href=\"vertrag_flist1.php?g=1\" title=\"Vertragliste 1\" >Vertragsliste zeigen</a></p>\n"; |
|
271 |
echo "</div>\n"; |
|
272 |
} |
|
273 |
||
274 |
$dbc -> close(); |
|
275 |
||
276 |
echo "<p> <a href=\"/fhiiqm/vertrag_flist12.php?$getp\" class=\"sc\" title=\"Vertragliste 2\" onclick=\"winopen(this.href,'Vertragsliste 2'); return false\">Verträge Teil 2</a></p>\n"; |
|
277 |
if (!is_null($_SESSION["recht"]) && in_array("ve",$_SESSION["recht"])) |
|
278 |
{ |
|
279 |
if ($mfile) |
|
280 |
echo "<p> <a href=\"/fhiiqm/vertrag_ed.php?$getp\" target=\"_self\" class=\"sc\" title=\"Vertrag erfassen\">Weiteren Vertrag erfassen</a></p>\n"; |
|
281 |
else |
|
282 |
echo "<p> <a href=\"/fhiiqm/vertrag_ins.php\" target=\"_self\" class=\"sc\" title=\"Vertrag erfassen\">Weiteren Vertrag erfassen</a></p>\n"; |
|
283 |
} |
|
284 |
?> |
|
285 |
||
286 |
</body> |
|
1
6288d5685bff
Stand v. 31.08.2011
Bettina Schwarzer <schwarzer@fhi-berlin.mpg.de>
parents:
diff
changeset
|
287 |
</html> |