[PHPVortex-Commit] phpvortex TB_Base.class.php,1.5,1.6
Brought to you by:
nop144666
From: Thiago R. <nop...@us...> - 2004-10-04 16:35:51
|
Update of /cvsroot/phpvortex/phpvortex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2177 Modified Files: TB_Base.class.php Log Message: Completed TB_Base::ShowList() Index: TB_Base.class.php =================================================================== RCS file: /cvsroot/phpvortex/phpvortex/TB_Base.class.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TB_Base.class.php 1 Oct 2004 20:52:29 -0000 1.5 --- TB_Base.class.php 4 Oct 2004 16:35:32 -0000 1.6 *************** *** 273,278 **** * Outputs a list for viewing/editing records. * - * @todo Use the $url parameter, and add the pkeys to the select - * * @param string $url URL to link the records to. The function replaces the string "PKEY" with the pkeys and values for the record. Leave blank for no links. * @param int $page Current page to show the records. Leave -1 to show all records. --- 273,276 ---- *************** *** 285,288 **** --- 283,289 ---- $fields .= (strlen($fields)?', ':'').$field->name_db; } + foreach ($this->fields as $field) if ($field->pkey) { + $fields .= (strlen($fields)?', ':'').$field->name_db; + } $sql = "SELECT $fields FROM {$this->name_db}"; if (!empty($this->list_order)) $sql .= " ORDER BY {$this->list_order}"; *************** *** 296,308 **** return FALSE; } ! echo "<div class='div_list'><table class='tb_{$this->name}'>\n<thead><tr>\n"; foreach ($this->fields_list as $field) { ! echo "<th>{$field->label}</th>\n"; } echo "</tr></thead>\n<tbody>\n"; foreach ($rows as $row) { echo "<tr>\n"; foreach ($this->fields_list as $field) { ! echo "<td>"; $field->ShowPlain($row[$field->name_db]); echo "</td>\n"; --- 297,316 ---- return FALSE; } ! echo "<div class='div_list'><table id='tb_{$this->name}'>\n<thead><tr>\n"; foreach ($this->fields_list as $field) { ! echo "<th class='fd_{$field->name}'>{$field->label}</th>\n"; } echo "</tr></thead>\n<tbody>\n"; foreach ($rows as $row) { echo "<tr>\n"; + if (!empty($url)) { + $pkeys = ''; + foreach ($this->fields as $field) if ($field->pkey) { + $pkeys .= (strlen($pkeys)?'&':'')."{$field->name_db}={$row[$field->name_db]}"; + } + } foreach ($this->fields_list as $field) { ! echo "<td class='fd_{$field->name}'>"; ! if (!empty($url)) echo "<a href='".str_replace('PKEY',$pkeys,$url)."'>"; $field->ShowPlain($row[$field->name_db]); echo "</td>\n"; |