Files
wachter/admin/inhalte/home.php

8 lines
6.6 KiB
PHP

<?php
if ( $_SESSION['IsAdmin'] )
{
$_GET['sortRow'] = ( !isset ( $_GET['sortRow'] ) OR empty ( $_GET['sortRow'] ) ) ? 'Datum' : $_GET['sortRow'];
$_GET['sortDir'] = ( !isset ( $_GET['sortDir'] ) OR empty ( $_GET['sortDir'] ) ) ? 'DESC' : $_GET['sortDir'];
$tmp_imgDatum = ( $_GET['sortRow'] == 'Datum' ) ? ( $_GET['sortDir'] == 'ASC' ) ? 'sort_up.gif' : 'sort_down.gif' : 'sort_wo.gif';
$tmp_imgID = ( $_GET['sortRow'] == 'ID' ) ? ( $_GET['sortDir'] == 'ASC' ) ? 'sort_up.gif' : 'sort_down.gif' : 'sort_wo.gif';
$tmp_imgKurz = ( $_GET['sortRow'] == 'Kurz' ) ? ( $_GET['sortDir'] == 'ASC' ) ? 'sort_up.gif' : 'sort_down.gif' : 'sort_wo.gif';
$tmp_imgTID = ( $_GET['sortRow'] == 'TID' ) ? ( $_GET['sortDir'] == 'ASC' ) ? 'sort_up.gif' : 'sort_down.gif' : 'sort_wo.gif';
$tmp_linkDatum = ( $_GET['sortRow'] == 'Datum' ) ? ( $_GET['sortDir'] == 'ASC' ) ? 'index.php?section=home&sortRow=Datum&sortDir=DESC' : 'index.php?section=home&sortRow=Datum&sortDir=ASC' : 'index.php?section=home&sortRow=Datum&sortDir=ASC';
$tmp_linkID = ( $_GET['sortRow'] == 'ID' ) ? ( $_GET['sortDir'] == 'ASC' ) ? 'index.php?section=home&sortRow=ID&sortDir=DESC' : 'index.php?section=home&sortRow=ID&sortDir=ASC' : 'index.php?section=home&sortRow=ID&sortDir=ASC';
$tmp_linkKurz = ( $_GET['sortRow'] == 'Kurz' ) ? ( $_GET['sortDir'] == 'ASC' ) ? 'index.php?section=home&sortRow=Zimmer&sortDir=DESC' : 'index.php?section=home&sortRow=Zimmer&sortDir=ASC' : 'index.php?section=home&sortRow=Zimmer&sortDir=ASC';
$tmp_linkTID = ( $_GET['sortRow'] == 'TID' ) ? ( $_GET['sortDir'] == 'ASC' ) ? 'index.php?section=home&sortRow=TID&sortDir=DESC' : 'index.php?section=home&sortRow=TID&sortDir=ASC' : 'index.php?section=home&sortRow=TID&sortDir=ASC';
echo "<h1>" . str_replace ( '%user%', fnc_getUsernameById ( $_SESSION['TID'], 'welcome' ), $arr_rist['portal']['welcome01'] ) . "</h1>\n";
echo "<p>" . $arr_rist['portal']['welcome02'] . "</p>\n";
$sql = "SELECT *, DATE_FORMAT ( Akt_Datum, '%d.%m.%Y (%H:%i)' ) AS Datum FROM objekte WHERE Aktiv = '0' AND Deaktiv = '0' ORDER BY " . $_GET['sortRow'] . " " . $_GET['sortDir'] . ";";
$result = $db->query ( $sql );
$anz = $result->num_rows;
?>
<table class="home">
<colgroup>
<col width="100px" />
<col width="300px" />
<col width="150px" />
<col width="150px" />
<col width="50px;" />
</colgroup>
<tr height="30">
<td colspan="5"><b><?php echo $anz; ?> zu bearbeitende Objekte</b></td>
</tr>
<tr height="30">
<th style="text-align:left;"><a style="text-decoration:none;color:black;border:none;" href="<?php echo $tmp_linkID; ?>"><img style="margin-bottom:-3px;border:0px;" height="16px" src="../img/<?php echo $tmp_imgID; ?>" /> O-Id</a></th>
<th style="text-align:left;"><a style="text-decoration:none;color:black;border:none;" href="<?php echo $tmp_linkKurz; ?>"><img style="margin-bottom:-3px;border:0px;" height="16px" src="../img/<?php echo $tmp_imgKurz; ?>" /> Kurzbeschreibung</a></th>
<th style="text-align:left;"><a style="text-decoration:none;color:black;border:none;" href="<?php echo $tmp_linkTID; ?>"><img style="margin-bottom:-3px;border:0px;" height="16px" src="../img/<?php echo $tmp_imgTID; ?>" /> Benutzer</a></th>
<th style="text-align:left;"><a style="text-decoration:none;color:black;border:none;" href="<?php echo $tmp_linkDatum; ?>"><img style="margin-bottom:-3px;border:0px;" height="16px" src="../img/<?php echo $tmp_imgDatum; ?>" /> Erstellt am</a></th>
<th style="text-align:left;">Intern</th>
</tr>
<?php
while ( $nt = $result->fetch_assoc () )
{
if ( "Wohnung" == $nt['O_TYP'] )
{
if ( "Miete" == $nt['V_TYP'] )
{
$topic = "wm";
}
if ( "Kauf" == $nt['V_TYP'] )
{
$topic = "wk";
}
}
if ( "Haus" == $nt['O_TYP'] )
{
if ( "Miete" == $nt['V_TYP'] )
{
$topic = "hm";
}
if ( "Kauf" == $nt['V_TYP'] )
{
$topic = "hk";
}
}
if ( "gewerbe" == $nt['KAT'] )
{
if ( "Miete" == $nt['V_TYP'] )
{
$topic = "gm";
}
if ( "Kauf" == $nt['V_TYP'] )
{
$topic = "gk";
}
}
if ( "anlage" == $nt['KAT'] )
{
if ( "Kauf" == $nt['V_TYP'] )
{
$topic = "ro";
}
}
?>
<tr height="16" style="overflow:hidden;border-top:2px solid #cccccc;">
<td width="100"><a href="javascript:void(0);" onclick="if ( document.getElementById('<?php echo $nt['ID']; ?>').style.display == 'none' ) { document.getElementById('<?php echo $nt['ID']; ?>').style.display = 'block'; } else { document.getElementById('<?php echo $nt['ID']; ?>').style.display = 'none'; } ;" title="<?php echo $nt['O_TYP'] . " " . $nt['V_TYP']; ?>"><?php echo $nt['ID']; ?></a></td>
<td width="300">
<form name="view<?php echo $nt['ID']; ?>" action="index.php?section=objekte&t=<?php echo $topic; ?>" method="post">
<input type="hidden" name="ID" value="<?php echo $nt['ID']; ?>" />
<input type="hidden" name="formaction" value="Anzeigen" />
</form>
<form name="edit<?php echo $nt['ID']; ?>" action="index.php?section=objekte&t=<?php echo $topic; ?>" method="post">
<input type="hidden" name="ID" value="<?php echo $nt['ID']; ?>" />
<input type="hidden" name="formaction" value="Bearbeiten" />
</form>
<a href="javascript:void(0);" onclick="if ( document.getElementById('<?php echo $nt['ID']; ?>').style.display == 'none' ) { document.getElementById('<?php echo $nt['ID']; ?>').style.display = 'block'; } else { document.getElementById('<?php echo $nt['ID']; ?>').style.display = 'none'; } ;" title="<?php echo $nt['O_TYP'] . " " . $nt['V_TYP']; ?>"><?php echo substr ( $nt['Kurz'], 0, 40 ); ?></a>
</td>
<td width="150"><?php echo fnc_getUsernameById ( $nt['TID'], 'logfiles' ); ?></td>
<td width="150"><?php echo $nt['Datum']; ?></td>
<td width="50"><?php echo ( $nt['Intern'] != '' ) ? '!' : ''; ?></td>
</tr>
<tr>
<td colspan="5">
<div id="<?php echo $nt['ID']; ?>" style="display:none;padding:16px 0px;">
<div style="width:100px;float:left;">Intern</div>
<div style="width:650px;float:right;"><?php echo $nt['Intern']; ?>
<br/>
<div class="button" onclick="document.view<?php echo $nt['ID']; ?>.submit();">Anzeigen</div>
<div class="button" onclick="document.edit<?php echo $nt['ID']; ?>.submit();">Bearbeiten</div>
<br/>
</div>
<br style="clear:both;" />
</div>
</td>
<!-- document.view<?php echo $nt['ID']; ?>.submit(); -->
</tr>
<?php
}
}
?>
</table>