I am trying to find the name of my table in the LIstOptionsRendered event
The table is activebal and contains
Username varchar (5)
Activated varchar(1)
Balance decimal (8,2)
I have built column headers and body but can not find the link to the table name to complete the entries
function ListOptions_Load() {
global $flighttable;
global $actypes;
// Find all AC types to be listed on output
// - use Activated types and those with a report code > 0
$Mysql = "SELECT Code1, Value1 FROM parameters WHERE (Type = 'ACTYPE' AND Value1 <> 0 " ;
$Mysql .= " AND Activated = 'Y' ) ORDER by Value1" ;
$rswrk = ExecuteRows($Mysql);
$i = 1;
// Store codes in Header
foreach ($rswrk as $x)
{
$this->ListOptions->Add($i);
$this->ListOptions->Items[$i]->Header = $x["Code1"];
$actypes[$i] = $x["Code1"];
$i++;
}
// save number of entries
$flighttable['counter'] = $i;
and
// ListOptions Rendered event
function ListOptions_Rendered()
{
// Example:
//$this->ListOptions["new"]->Body = "xxx";
global $flighttable;
global $actypes;
// Shade alternate lines on list
for ($cntwrk = 1; $cntwrk < $flighttable['counter'];$cntwrk++)
{
$cntwrk2 = fmod($cntwrk,2);
if ($cntwrk2 == 1) $this->ListOptions->Items[$cntwrk]->CssStyle = "background-color: #00aaaa";
}
$m = "PAULM";
// $m = $this->Fields['Username']->CurrentValue;
// $m = getUsername();
// $m = $GLOBALS["activebal"]->Username->CurrentValue;
$Mysql = "SELECT Permission, Actype FROM permissions WHERE (Activated = 'Y' AND Member = '";
$Mysql .= $m . "') ORDER BY Actype ";
$rswrk = ExecuteRows($Mysql);
foreach ($rswrk as $x)
{
for ($cntwrk = 1; $cntwrk < $flighttable['counter'];$cntwrk++)
{
if ($actypes[$cntwrk] == $x["Actype"])
{
$this->ListOptions->Items[$cntwrk]->Body = $x["Permission"];
}
}
}
}
Works fine when I put a value in $m
but can't find the correct reference for the table name / field content. The $GLOBALS
option worked in PHP2018/PHP7.4
Thanks for any help you can give me.
Dave