I am getting steps further now. I only have one problem now, the files are showing but the first file is for the first record and the second for the second record etc.
"reactie op dispuut.pdf" must display in the second row. I know it's something with the do-while loop, but i can't solve it myself.
Code: Select all
<?php require_once('Connections/tekening_db.php'); ?>
<?php
// Load the common classes
require_once('includes/common/KT_common.php');
// Load the tNG classes
require_once('includes/tng/tNG.inc.php');
// Load the required classes
require_once('includes/tfi/TFI.php');
require_once('includes/tso/TSO.php');
require_once('includes/nav/NAV.php');
// Make unified connection variable
$conn_tekening_db = new KT_connection($tekening_db, $database_tekening_db);
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
// Filter
$tfi_listtbl_tekeningen8 = new TFI_TableFilter($conn_tekening_db, "tfi_listtbl_tekeningen8");
$tfi_listtbl_tekeningen8->addColumn("tbl_tekeningen.nummer", "NUMERIC_TYPE", "nummer", "=");
$tfi_listtbl_tekeningen8->addColumn("tbl_tekeningen.omschrijving", "STRING_TYPE", "omschrijving", "%");
$tfi_listtbl_tekeningen8->addColumn("tbl_tekeningen.pdf", "FILE_TYPE", "pdf", "%");
$tfi_listtbl_tekeningen8->addColumn("tbl_tekeningen.dxf", "FILE_TYPE", "dxf", "%");
$tfi_listtbl_tekeningen8->addColumn("tbl_tekeningen.dwg", "FILE_TYPE", "dwg", "%");
$tfi_listtbl_tekeningen8->addColumn("tbl_klanten.naam", "STRING_TYPE", "klant", "%");
$tfi_listtbl_tekeningen8->addColumn("tbl_leveranciers.naam", "STRING_TYPE", "leverancier", "%");
$tfi_listtbl_tekeningen8->addColumn("tbl_tekeningen.commentaar", "STRING_TYPE", "commentaar", "%");
$tfi_listtbl_tekeningen8->Execute();
// Sorter
$tso_listtbl_tekeningen8 = new TSO_TableSorter("rstbl_tekeningen1", "tso_listtbl_tekeningen8");
$tso_listtbl_tekeningen8->addColumn("tbl_tekeningen.nummer");
$tso_listtbl_tekeningen8->addColumn("tbl_tekeningen.omschrijving");
$tso_listtbl_tekeningen8->addColumn("tbl_tekeningen.pdf");
$tso_listtbl_tekeningen8->addColumn("tbl_tekeningen.dxf");
$tso_listtbl_tekeningen8->addColumn("tbl_tekeningen.dwg");
$tso_listtbl_tekeningen8->addColumn("tbl_klanten.naam");
$tso_listtbl_tekeningen8->addColumn("tbl_leveranciers.naam");
$tso_listtbl_tekeningen8->addColumn("tbl_tekeningen.commentaar");
$tso_listtbl_tekeningen8->setDefault("tbl_tekeningen.nummer");
$tso_listtbl_tekeningen8->Execute();
// Navigation
$nav_listtbl_tekeningen8 = new NAV_Regular("nav_listtbl_tekeningen8", "rstbl_tekeningen1", "", $_SERVER['PHP_SELF'], 10);
mysql_select_db($database_tekening_db, $tekening_db);
$query_Recordset2 = "SELECT naam, naam FROM tbl_klanten ORDER BY naam";
$Recordset2 = mysql_query($query_Recordset2, $tekening_db) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
mysql_select_db($database_tekening_db, $tekening_db);
$query_Recordset1 = "SELECT naam, naam FROM tbl_leveranciers ORDER BY naam";
$Recordset1 = mysql_query($query_Recordset1, $tekening_db) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_tekening_db, $tekening_db);
$query_download = "SELECT id, nummer, pdf, dxf, dwg FROM tbl_tekeningen";
$download = mysql_query($query_download, $tekening_db) or die(mysql_error());
$row_download = mysql_fetch_assoc($download);
$totalRows_download = mysql_num_rows($download);
//NeXTenesio3 Special List Recordset
$maxRows_rstbl_tekeningen1 = $_SESSION['max_rows_nav_listtbl_tekeningen8'];
$pageNum_rstbl_tekeningen1 = 0;
if (isset($_GET['pageNum_rstbl_tekeningen1'])) {
$pageNum_rstbl_tekeningen1 = $_GET['pageNum_rstbl_tekeningen1'];
}
$startRow_rstbl_tekeningen1 = $pageNum_rstbl_tekeningen1 * $maxRows_rstbl_tekeningen1;
// Defining List Recordset variable
$NXTFilter_rstbl_tekeningen1 = "1=1";
if (isset($_SESSION['filter_tfi_listtbl_tekeningen8'])) {
$NXTFilter_rstbl_tekeningen1 = $_SESSION['filter_tfi_listtbl_tekeningen8'];
}
// Defining List Recordset variable
$NXTSort_rstbl_tekeningen1 = "tbl_tekeningen.nummer";
if (isset($_SESSION['sorter_tso_listtbl_tekeningen8'])) {
$NXTSort_rstbl_tekeningen1 = $_SESSION['sorter_tso_listtbl_tekeningen8'];
}
mysql_select_db($database_tekening_db, $tekening_db);
$query_rstbl_tekeningen1 = "SELECT tbl_tekeningen.nummer, tbl_tekeningen.omschrijving, tbl_tekeningen.pdf, tbl_tekeningen.dxf, tbl_tekeningen.dwg, tbl_klanten.naam AS klant, tbl_leveranciers.naam AS leverancier, tbl_tekeningen.commentaar, tbl_tekeningen.id FROM (tbl_tekeningen LEFT JOIN tbl_klanten ON tbl_tekeningen.klant = tbl_klanten.naam) LEFT JOIN tbl_leveranciers ON tbl_tekeningen.leverancier = tbl_leveranciers.naam WHERE {$NXTFilter_rstbl_tekeningen1} ORDER BY {$NXTSort_rstbl_tekeningen1}";
$query_limit_rstbl_tekeningen1 = sprintf("%s LIMIT %d, %d", $query_rstbl_tekeningen1, $startRow_rstbl_tekeningen1, $maxRows_rstbl_tekeningen1);
$rstbl_tekeningen1 = mysql_query($query_limit_rstbl_tekeningen1, $tekening_db) or die(mysql_error());
$row_rstbl_tekeningen1 = mysql_fetch_assoc($rstbl_tekeningen1);
if (isset($_GET['totalRows_rstbl_tekeningen1'])) {
$totalRows_rstbl_tekeningen1 = $_GET['totalRows_rstbl_tekeningen1'];
} else {
$all_rstbl_tekeningen1 = mysql_query($query_rstbl_tekeningen1);
$totalRows_rstbl_tekeningen1 = mysql_num_rows($all_rstbl_tekeningen1);
}
$totalPages_rstbl_tekeningen1 = ceil($totalRows_rstbl_tekeningen1/$maxRows_rstbl_tekeningen1)-1;
//End NeXTenesio3 Special List Recordset
$nav_listtbl_tekeningen8->checkBoundries();
// Download File downloadObj1
$downloadObj1 = new tNG_Download("", "KT_download1");
// Execute
$downloadObj1->setFolder("tekeningen/{download.nummer}/");
$downloadObj1->setRenameRule("{download.pdf}");
$downloadObj1->Execute();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tekening DB Manager</title>
<link href="includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<script src="includes/common/js/base.js" type="text/javascript"></script>
<script src="includes/common/js/utility.js" type="text/javascript"></script>
<script src="includes/skins/style.js" type="text/javascript"></script>
<script src="includes/nxt/scripts/list.js" type="text/javascript"></script>
<script src="includes/nxt/scripts/list.js.php" type="text/javascript"></script>
<script type="text/javascript">
$NXT_LIST_SETTINGS = {
duplicate_buttons: true,
duplicate_navigation: true,
row_effects: true,
show_as_buttons: true,
record_counter: false
}
</script>
<style type="text/css">
/* Dynamic List row settings */
.KT_col_nummer {width:140px; overflow:hidden;}
.KT_col_omschrijving {width:140px; overflow:hidden;}
.KT_col_pdf {width:140px; overflow:hidden;}
.KT_col_dxf {width:140px; overflow:hidden;}
.KT_col_dwg {width:140px; overflow:hidden;}
.KT_col_klant {width:140px; overflow:hidden;}
.KT_col_leverancier {width:140px; overflow:hidden;}
.KT_col_commentaar {width:140px; overflow:hidden;}
</style>
</head>
<body>
<div class="KT_tng" id="listtbl_tekeningen8">
<h1>Overzicht tekeningen</h1>
<div class="KT_tnglist">
<form action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>" method="post" id="form1">
<div class="KT_options"> <a href="<?php echo $nav_listtbl_tekeningen8->getShowAllLink(); ?>"><?php echo NXT_getResource("Show"); ?>
<?php
// Show IF Conditional region1
if (@$_GET['show_all_nav_listtbl_tekeningen8'] == 1) {
?>
<?php echo $_SESSION['default_max_rows_nav_listtbl_tekeningen8']; ?>
<?php
// else Conditional region1
} else { ?>
<?php echo NXT_getResource("all"); ?>
<?php }
// endif Conditional region1
?>
<?php echo NXT_getResource("records"); ?></a>
<?php
// Show IF Conditional region2
if (@$_SESSION['has_filter_tfi_listtbl_tekeningen8'] == 1) {
?>
<a href="<?php echo $tfi_listtbl_tekeningen8->getResetFilterLink(); ?>"><?php echo NXT_getResource("Reset filter"); ?></a>
<?php
// else Conditional region2
} else { ?>
<a href="<?php echo $tfi_listtbl_tekeningen8->getShowFilterLink(); ?>"><?php echo NXT_getResource("Show filter"); ?></a>
<?php }
// endif Conditional region2
?>
</div>
<table cellpadding="2" cellspacing="0" class="KT_tngtable">
<thead>
<tr class="KT_row_order">
<th> <input type="checkbox" name="KT_selAll" id="KT_selAll"/>
</th>
<th id="nummer" class="KT_sorter KT_col_nummer <?php echo $tso_listtbl_tekeningen8->getSortIcon('tbl_tekeningen.nummer'); ?>"> <a href="<?php echo $tso_listtbl_tekeningen8->getSortLink('tbl_tekeningen.nummer'); ?>">Tekeningnummer</a></th>
<th id="omschrijving" class="KT_sorter KT_col_omschrijving <?php echo $tso_listtbl_tekeningen8->getSortIcon('tbl_tekeningen.omschrijving'); ?>"> <a href="<?php echo $tso_listtbl_tekeningen8->getSortLink('tbl_tekeningen.omschrijving'); ?>">Omschrijving</a></th>
<th id="pdf" class="KT_sorter KT_col_pdf <?php echo $tso_listtbl_tekeningen8->getSortIcon('tbl_tekeningen.pdf'); ?>"> <a href="<?php echo $tso_listtbl_tekeningen8->getSortLink('tbl_tekeningen.pdf'); ?>">PDF</a></th>
<th id="dxf" class="KT_sorter KT_col_dxf <?php echo $tso_listtbl_tekeningen8->getSortIcon('tbl_tekeningen.dxf'); ?>"> <a href="<?php echo $tso_listtbl_tekeningen8->getSortLink('tbl_tekeningen.dxf'); ?>">DXF</a></th>
<th id="dwg" class="KT_sorter KT_col_dwg <?php echo $tso_listtbl_tekeningen8->getSortIcon('tbl_tekeningen.dwg'); ?>"> <a href="<?php echo $tso_listtbl_tekeningen8->getSortLink('tbl_tekeningen.dwg'); ?>">DWG</a></th>
<th id="klant" class="KT_sorter KT_col_klant <?php echo $tso_listtbl_tekeningen8->getSortIcon('tbl_klanten.naam'); ?>"> <a href="<?php echo $tso_listtbl_tekeningen8->getSortLink('tbl_klanten.naam'); ?>">Klant</a></th>
<th id="leverancier" class="KT_sorter KT_col_leverancier <?php echo $tso_listtbl_tekeningen8->getSortIcon('tbl_leveranciers.naam'); ?>"> <a href="<?php echo $tso_listtbl_tekeningen8->getSortLink('tbl_leveranciers.naam'); ?>">Leverancier</a></th>
<th id="commentaar" class="KT_sorter KT_col_commentaar <?php echo $tso_listtbl_tekeningen8->getSortIcon('tbl_tekeningen.commentaar'); ?>"> <a href="<?php echo $tso_listtbl_tekeningen8->getSortLink('tbl_tekeningen.commentaar'); ?>">Commentaar</a></th>
<th> </th>
</tr>
<?php
// Show IF Conditional region3
if (@$_SESSION['has_filter_tfi_listtbl_tekeningen8'] == 1) {
?>
<tr class="KT_row_filter">
<td> </td>
<td><input type="text" name="tfi_listtbl_tekeningen8_nummer" id="tfi_listtbl_tekeningen8_nummer" value="<?php echo KT_escapeAttribute(@$_SESSION['tfi_listtbl_tekeningen8_nummer']); ?>" size="20" maxlength="100" /></td>
<td><input type="text" name="tfi_listtbl_tekeningen8_omschrijving" id="tfi_listtbl_tekeningen8_omschrijving" value="<?php echo KT_escapeAttribute(@$_SESSION['tfi_listtbl_tekeningen8_omschrijving']); ?>" size="20" maxlength="100" /></td>
<td><input type="text" name="tfi_listtbl_tekeningen8_pdf" id="tfi_listtbl_tekeningen8_pdf" value="<?php echo KT_escapeAttribute(@$_SESSION['tfi_listtbl_tekeningen8_pdf']); ?>" size="20" maxlength="100" /></td>
<td><input type="text" name="tfi_listtbl_tekeningen8_dxf" id="tfi_listtbl_tekeningen8_dxf" value="<?php echo KT_escapeAttribute(@$_SESSION['tfi_listtbl_tekeningen8_dxf']); ?>" size="20" maxlength="100" /></td>
<td><input type="text" name="tfi_listtbl_tekeningen8_dwg" id="tfi_listtbl_tekeningen8_dwg" value="<?php echo KT_escapeAttribute(@$_SESSION['tfi_listtbl_tekeningen8_dwg']); ?>" size="20" maxlength="100" /></td>
<td><select name="tfi_listtbl_tekeningen8_klant" id="tfi_listtbl_tekeningen8_klant">
<option value="" <?php if (!(strcmp("", @$_SESSION['tfi_listtbl_tekeningen8_klant']))) {echo "SELECTED";} ?>><?php echo NXT_getResource("None"); ?></option>
<?php
do {
?>
<option value="<?php echo $row_Recordset2['naam']?>"<?php if (!(strcmp($row_Recordset2['naam'], @$_SESSION['tfi_listtbl_tekeningen8_klant']))) {echo "SELECTED";} ?>><?php echo $row_Recordset2['naam']?></option>
<?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
$rows = mysql_num_rows($Recordset2);
if($rows > 0) {
mysql_data_seek($Recordset2, 0);
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
}
?>
</select></td>
<td><select name="tfi_listtbl_tekeningen8_leverancier" id="tfi_listtbl_tekeningen8_leverancier">
<option value="" <?php if (!(strcmp("", @$_SESSION['tfi_listtbl_tekeningen8_leverancier']))) {echo "SELECTED";} ?>><?php echo NXT_getResource("None"); ?></option>
<?php
do {
?>
<option value="<?php echo $row_Recordset1['naam']?>"<?php if (!(strcmp($row_Recordset1['naam'], @$_SESSION['tfi_listtbl_tekeningen8_leverancier']))) {echo "SELECTED";} ?>><?php echo $row_Recordset1['naam']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select></td>
<td><input type="text" name="tfi_listtbl_tekeningen8_commentaar" id="tfi_listtbl_tekeningen8_commentaar" value="<?php echo KT_escapeAttribute(@$_SESSION['tfi_listtbl_tekeningen8_commentaar']); ?>" size="20" maxlength="100" /></td>
<td><input type="submit" name="tfi_listtbl_tekeningen8" value="<?php echo NXT_getResource("Filter"); ?>" /></td>
</tr>
<?php }
// endif Conditional region3
?>
</thead>
<tbody>
<?php if ($totalRows_rstbl_tekeningen1 == 0) { // Show if recordset empty ?>
<tr>
<td colspan="10"><?php echo NXT_getResource("The table is empty or the filter you've selected is too restrictive."); ?></td>
</tr>
<?php } // Show if recordset empty ?>
<?php if ($totalRows_rstbl_tekeningen1 > 0) { // Show if recordset not empty ?>
<?php do { ?>
<tr class="<?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?>">
<td><input type="checkbox" name="kt_pk_tbl_tekeningen" class="id_checkbox" value="<?php echo $row_rstbl_tekeningen1['id']; ?>" />
<input type="hidden" name="id" class="id_field" value="<?php echo $row_rstbl_tekeningen1['id']; ?>" /></td>
<td><div class="KT_col_nummer"><?php echo KT_FormatForList($row_rstbl_tekeningen1['nummer'], 20); ?></div></td>
<td><div class="KT_col_omschrijving"><?php echo KT_FormatForList($row_rstbl_tekeningen1['omschrijving'], 20); ?></div></td>
<td><div class="KT_col_pdf"></div> <?php do { ?>
<a href="<?php echo $downloadObj1->getDownloadLink(); ?>"><?php echo $row_download['pdf']; ?></a>
<?php } while ($row_download = mysql_fetch_assoc($download)); ?>
</td>
<td><div class="KT_col_dxf"><?php echo KT_FormatForList($row_rstbl_tekeningen1['dxf'], 20); ?></div></td>
<td><div class="KT_col_dwg"><?php echo KT_FormatForList($row_rstbl_tekeningen1['dwg'], 20); ?></div></td>
<td><div class="KT_col_klant"><?php echo KT_FormatForList($row_rstbl_tekeningen1['klant'], 20); ?></div></td>
<td><div class="KT_col_leverancier"><?php echo KT_FormatForList($row_rstbl_tekeningen1['leverancier'], 20); ?></div></td>
<td><div class="KT_col_commentaar"><?php echo KT_FormatForList($row_rstbl_tekeningen1['commentaar'], 20); ?></div></td>
<td><a class="KT_edit_link" href="db_man_edit_tek.php?id=<?php echo $row_rstbl_tekeningen1['id']; ?>&KT_back=1"><?php echo NXT_getResource("edit_one"); ?></a> <a class="KT_delete_link" href="#delete"><?php echo NXT_getResource("delete_one"); ?></a></td>
</tr>
<?php } while ($row_rstbl_tekeningen1 = mysql_fetch_assoc($rstbl_tekeningen1)); ?>
<?php } // Show if recordset not empty ?>
</tbody>
</table>
<div class="KT_bottomnav">
<div>
<?php
$nav_listtbl_tekeningen8->Prepare();
require("includes/nav/NAV_Text_Navigation.inc.php");
?>
</div>
</div>
<div class="KT_bottombuttons">
<div class="KT_operations"> <a class="KT_edit_op_link" href="#" onclick="nxt_list_edit_link_form(this); return false;"><?php echo NXT_getResource("edit_all"); ?></a> <a class="KT_delete_op_link" href="#" onclick="nxt_list_delete_link_form(this); return false;"><?php echo NXT_getResource("delete_all"); ?></a></div>
<span> </span>
<select name="no_new" id="no_new">
<option value="1">1</option>
<option value="3">3</option>
<option value="6">6</option>
</select>
<a class="KT_additem_op_link" href="db_man_edit_tek.php?KT_back=1" onclick="return nxt_list_additem(this)"><?php echo NXT_getResource("add new"); ?></a></div>
</form>
</div>
<br class="clearfixplain" />
</div>
</body>
</html>
<?php
mysql_free_result($Recordset2);
mysql_free_result($Recordset1);
mysql_free_result($download);
mysql_free_result($rstbl_tekeningen1);
?>