Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

towninfo.php

Go to the documentation of this file.
00001 <?php
00009 /***************************************************************************
00010  This program is free software; you can redistribute it and/or
00011  modify it under the terms of the GNU General Public License
00012  as published by the Free Software Foundation; either version 2
00013  of the License, or (at your option) any later version.
00014 
00015  This program is distributed in the hope that it will be useful,
00016  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  GNU General Public License for more details.
00019 
00020  You should have received a copy of the GNU General Public License
00021  along with this program; if not, write to the Free Software
00022  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023  ***************************************************************************/
00024 
00025 require_once( './general.php' );
00026 require_once( './lib/towninfo.php' );
00027 
00028 // get styles
00029 $oStyle->setTemplate( 'towninfo.html' );
00030 $oStyle->split_area( 'Info' );
00031 
00032 $oTown = new TownInfo( $oMysql, $oLog );
00033 
00034 if(isset($_POST['id']))    $intTownId = intval($_POST['id']);
00035 elseif(isset($_GET['id'])) $intTownId = intval($_GET['id']);
00036 else $intTownId = -1;
00037 
00038 if(isset($_POST['action']))    $action = $_POST['action'];
00039 elseif(isset($_GET['action'])) $action = $_GET['action'];
00040 else $action = 'show';
00041 
00042 
00043 // Änderungen speichern
00044 if( $action == 'save' && $oUser->isAdmin( 'town_edit' ) )
00045 {
00046     $strNewName = isset( $_POST['townname'] ) ? htmlspecialchars( $_POST['townname'] ) : '';
00047     $strInfo = isset( $_POST['towninfo'] ) ? htmlspecialchars( $_POST['towninfo'] ) : '';
00048     $oTown->set( $intTownId, $strNewName, -1, -1, -1, $strInfo );
00049 
00050     // weiterleiten, damit man refresh machen kann, ohne Nachfrage wegen POST Data
00051     header( 'location: towninfo.php?id='.$intTownId );
00052     die();
00053 }
00054 
00055 $aTown = $oTown->getById( $intTownId );
00056 
00057 if( $aTown === false || !is_array( $aTown ) )
00058 {
00059     $strTmpl_inhalt = '<b>Fehler:</b><br />Stadt nicht gefunden.';
00060     output();
00061 }
00062 
00063 // Weitere Städte...
00064 $strMoreTowns = '';
00065 $aMoreTowns = $oTown->getTowns( $aTown['ownerid'], $intTownId );
00066 foreach( $aMoreTowns AS $aData )
00067 {
00068     $strMoreTowns .= '<a href="towninfo.php?id='.$aData['town_id'].'">'.$aData['name'].' '.$aData['x'].':'.$aData['y'].'</a><br />';
00069 }
00070 
00071 $strMoreTowns = 'Weitere St&auml;dte von '.$aTown['owner'].'<br />'. ( $strMoreTowns == '' ? '<b>Keine</b>' : $strMoreTowns);
00072 
00073 // Anzeige
00074 $oStyle->addReplacements( array( 'INFO_ID' => $intTownId,
00075                                  'INFO_KOORDS' => '<a href="map.php?x='.$aTown['x'].'&amp;y='.$aTown['y'].'">'.$aTown['x'].':'.$aTown['y'].'</a>',
00076                                  'INFO_TOWN' => $aTown['name'],
00077                                  'INFO_TEXT' => $aTown['infos'],
00078                                  'INFO_MORE' => $strMoreTowns,
00079                                  'INFO_TIME' => ($aTown['last_update'] > 0 ) ? date("d.m.Y H:i",intval($aTown['last_update']) ) : '--.--.----',
00080                                  'INFO_USER' => $aTown['username'],
00081                                  'INFO_TIME_CREATE' => date("d.m.Y H:i",intval($aTown['created']) ),
00082                                  'INFO_USER_CREATE' => $aTown['username2'] ) );
00083 
00084 $strTmpl_inhalt = $oStyle->get_area( 'Info' );
00085 output();

Generated on Sun May 8 19:29:45 2005 for PhpMap by  doxygen 1.4.2