| Index
» Projekty
» phpMyEdit
» Fórum
» PHP Expressions not working for Table List |
 |
t22harris
Založený: 19.03.2009
Príspevky: 15
Zaslal: 2011-06-03 08:25
Návrat hore
Odpovedať s citátom
|
I have an indirect lookup (Join) that is two tables down. Using a PHP Expression it is working fine for Add, Change and View. But, it doesn't work for the Table List. For Table List, the lookup is correct for the first record and then that same value is incorrectly repeated for every record in the Table. Any advice?
|
t22harris
Založený: 19.03.2009
Príspevky: 15
Zaslal: 2011-06-03 09:13
Návrat hore
Odpovedať s citátom
|
Using the sql expression does exactly the same thing in list view as does the php expression. The first result found is repeated for all rows in the table. This must be a general limitation of the list_table() function?
| Kód: |
$opts['fdd']['reservation_id'] = array(
'name' => 'Reservation ID',
'php|ACV' => 'selectReservationId.php',
'sql|L' => '(SELECT `visitors`.`lastName`
FROM (`payments`, `reservations`, `visitors`)
WHERE (`payments`.`reservation_id` = `reservations`.`id` AND `reservations`.`visitorCode` = `visitors`.`id`)
LIMIT 1) ',
'options' => 'VCAL',
'select' => 'T',
'maxlen' => 11,
'sort' => true
); |
|
t22harris
Založený: 19.03.2009
Príspevky: 15
Zaslal: 2011-06-03 18:06
Návrat hore
Odpovedať s citátom
|
I had to modify the phpMyEdit.class.php to get the PHP Expression to function properly in Table List. In
function list_table()
I added:
| Kód: |
else if($this->col_has_php($k)){
$this->rec = $key_rec;
include($this->fdd[$k]['php']);
}
|
inside the column iterator. This now calls the php function for each row on the list table. However,
$this->rec
was not available so I used
$key_rec
to set it.
Also I'm wondering why
$this->operation
is empty for the list table operation? The fact that it is empty is what I had to use in the php code to detect the list operation.
Bottom line, the code is doing what I need it to do now.
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2011-06-04 14:33
Návrat hore
Odpovedať s citátom
|
That's a nice fix. Congratulations. Hopefully this will appear in the CVS in a future update.
|
kayvaan
Založený: 01.12.2011
Príspevky: 1
Zaslal: 2011-12-01 13:50
Návrat hore
Odpovedať s citátom
|
| t22harris Napísal: |
I had to modify the phpMyEdit.class.php to get the PHP Expression to function properly in Table List. In
function list_table()
I added:
| Kód: |
else if($this->col_has_php($k)){
$this->rec = $key_rec;
include($this->fdd[$k]['php']);
}
|
inside the column iterator. This now calls the php function for each row on the list table. However,
$this->rec
was not available so I used
$key_rec
to set it.
Also I'm wondering why
$this->operation
is empty for the list table operation? The fact that it is empty is what I had to use in the php code to detect the list operation.
|
Hi t22harris,
I've tried your solution several times, but I'm afraid I can't find the right place inside function list_table to put your code.
Please, could you explain me where I must put that code?
Thanks.
|
t22harris
Založený: 19.03.2009
Príspevky: 15
Zaslal: 2011-12-01 17:28
Návrat hore
Odpovedať s citátom
|
In the phpMyEdit.class.php in the list_table() funcntion and around line 2440 (I've added so much to my class elsewhere that this line# is now just a guess). My three additional lines are shown here in context:
| Kód: |
for ($k = 0; $k < $this->num_fds; $k++) { /* {{{ */
$fd = $this->fds[$k];
if (! $this->displayed[$k]) {
continue;
}
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('cell', null, true, $css_postfix);
if ($this->password($k)) {
echo '<td class="',$css_class_name,'">',$this->labels['hidden'],'</td>',"\n";
continue;
}
// added by Bob
echo '<td class="',$css_class_name,'"',$this->getColAttributes($fd),'>';
if($this->col_has_dateformat($k))
echo $this->process_date($this->cellDisplay($k, $row, $css_class_name),false);
elseif($this->col_has_php($k)){
$this->rec = $key_rec;
include($this->fdd[$k]['php']);
}else
echo $this->cellDisplay($k, $row, $css_class_name);
echo '</td>',"\n";
} /* }}} */ |
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|