Location: PHPKode > projects > tbvs > tbvs-1.1/AbteilungsList.php
<? // this section is managed by php-mgr : you may change / enhance the part with the program versions
//
//  This php section is being managed by php-mgr ver 1, 
//  If you make changes in this section then your changes will be overwritten in later releases of this file !
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  File          : ./AbteilungsList.php ( 05/24/2010 )
//  Language      : php
//  Description   : Formular, um alle vorhandenen Abteilungen als Liste anzuzeigen 
//  Project       : tbvs - Das Tiefbauverwaltungssystem
//  Project Site  : http://tbvs.sourceforge.net/
//  Project wiki  : http://scratchpad.wikia.com/wiki/Tbvs
//  Created by    : Rainer Stötter ( hide@address.com ), 03/14/2008
//  Copyright (c) : 2007 - 2008, Rainer Stötter, All rights reserved
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  License
//
//  This file has been released under GNU GENERAL PUBLIC LICENSE
//  (see http://www.gnu.org/licenses/gpl.html)
//
//
// * GNU General Public License (Version 3, June 2009 )
// *
// * 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 3 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. 
//   
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Requests]]
//
//
//		_GET['bk']
//		_GET['mandant']
//
//	[[End of requests]]
//
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Functions]]
//
//
//		function CheckParams()
//		function DisplayAbteilungsList($mandant,$bk)
//
//	[[End of functions]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Classes]]
//
//
//	no classes were found
//
//	[[End of classes]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Versions of file ./AbteilungsList.php]]
//
//	14.03.2008	Rainer Stötter (tbvs-0.93)
//			Module created
//	08.11.2008	Rainer Stötter (tbvs-1.01)
//	03.12.2008	Rainer Stötter (tbvs-1.02)
//	16.07.2009	Rainer Stötter (tbvs-1.032)
//	02.02.2010	Rainer Stötter (tbvs-1.048)
//	05.03.2010	Rainer Stötter (tbvs-1.08006)
//			a
//
//	[[End of versions]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  CVS
//
//  $Log:…$
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 
// here ends the section which is managed by php-mgr ver 1
//

//{TOOLVER=01,00000}{OLSTART=00492}{OLLEN=00063}
?><?php
/*

AbteilungsList.php : Anzeige einer Liste der einzelnen Abteilungen

*/


require_once("./functions/checkuser.inc.php");	//	Login ist erforderlich
require_once("./functions/prolog.inc.php");	//	Datei mit vorgestellten Routinen
require_once("./functions/debug.inc.php");	//	Debugging-Funktionen
require_once("./functions/tbvs.inc.php");	//	systemweite Konstanten und Funktionen
require_once("./functions/tbvs-db.inc.php");	// systemweite Datenbankfunktionen
require_once("./classes/cUserRights.class.inc");  // Zugangs&uuml;berpr&uuml;fung


function DisplayAbteilungsList($mandant, $bk) {

        $msgbk = id2msg( 2165 );
        $msgNeueAbteilung = id2msg( 2166 );

        $msgID = id2msg( 2167 );
        $msgAbteilung = id2msg( 2168 );
        $msgAnsprechpartner = id2msg( 2169 );
        $msgAktionen = id2msg( 2170 );

	echo "<br><a href=BuchungskreisList.php?mandant=$mandant>$msgbk</a>  ";

        if ( UserMayDo($mandant, $bk, "adddel", "ABTEILUNG") ) {
        echo "<a href=AbteilungAdd.php?mandant=$mandant&bk=$bk>$msgNeueAbteilung </a>  ";
        }
        echo "<p>";

    $ueberschrift = "<h2>" . sprintf( id2msg( 2990 ) ) . "</h2><p>";    echo( $ueberschrift );

	/* Connect to a MySQL server */
	$mysqli = OpenTBVSDB();
	
	/* Send a query to the server
	* mysqli::query returns an object of class mysqli_result */

	$result = $mysqli->query(
		"SELECT ID_ABTEILUNG, Abteilung, Name
		FROM ABTEILUNG WHERE ID_MANDANT='$mandant' AND ID_BUCHKR='$bk' ORDER BY Abteilung");
	
	echo "<table border='1' >";
	echo "<tbody>";
	echo "<tr>";
	echo "	<th width=10%>$msgID</th>";
	echo "	<th width=20%>$msgAbteilung</th>";
	echo "	<th width=20%>$msgAnsprechpartner</th>";
	echo "	<th width=10%>$msgAktionen</th>";
	echo "</tr>";
	
	

	# dann zeige Ergebnisse an...

	while($row = $result->fetch_object()) {

//		$bk=$row->ID_BUCHKR;
//		$mandant=$row->ID_MANDANT;
                $abt=$row->ID_ABTEILUNG;

                $doedit ="";
                $dodel ="";

                if ( UserMayDo($mandant, $bk, "edit", "ABTEILUNG") ) {
                    $doedit = "<A HREF=AbteilungEdit.php?mandant=$mandant&bk=$bk&abt=$abt>".
			"<IMG SRC='images/edit.gif' ALT='EDIT'></A>";
                }
                if ( UserMayDo($mandant, $bk, "adddel", "ABTEILUNG") ) {
                    if ( activeUserMayDeleteAbteilung( $mandant, $bk, $abt ) )
                    $dodel = "<A HREF=AbteilungDel.php?mandant=$mandant&bk=$bk&abt=$abt>".
			"<IMG SRC='images/delete.gif' ALT='DEL'></A>";
                }

		printf("<tr>\n  <td align=\"center\">%s</td><td>%s</td><td>%s <td> %s %s %s </td>\n</tr>\n",
			$row->ID_ABTEILUNG, 
			hent($row->Abteilung),
                        hent($row->Name),
                        $doedit,
			$dodel,
			"<A HREF=AbteilungShow.php?mandant=$mandant&bk=$bk&abt=$abt>".
			"<IMG SRC='images/show.gif' ALT='SHOW'></A>"
		);
	}	
	
	/* Destroy the result set and free the memory used */
	$result->close();
	
	/* Close the connection and free the memory used*/
	$mysqli->close();
		
	
	echo"</tbody>";
	echo"</table>";
}	// function DisplayAbteilungsList

function CheckParams() {
# Mandantennummer mu&szlig; Parameter sein
if (! isset($_GET['mandant'])) 
	die( id2msg( 1103 ) );
if (! isset($_GET['bk'])) 
	die( id2msg( 1104 ) );

} // function CheckParams() 

CheckParams();

$mandant=$_GET['mandant'];
$bk=$_GET['bk'];

$MandName=hent(ID2NameMandant($mandant));
$bkName=hent(ID2NameBuchungskreis($mandant,$bk));

display_title( sprintf( id2msg( 2164 ), $bkName, $MandName) );
display_logo();


DisplayAbteilungsList($mandant, $bk);

require_once("./functions/epilog.inc.php");	//	Datei mit nachgestellten Routinen

?>

Return current item: tbvs