printable_report modification
Posted: Mon Aug 08, 2011 5:26 am
Hello all,
This may be a simple one, but I can't figure it out...
I'm using the printable_report. However, I've modified the class actions_printable_report file so as to have a series of if/elseif statements; my goal is to print out a simple, different report depending on which table is creating the data. Thus, on my 'depts' page, some fields from my fire departments table is accessed and printed; but on the 'apparatus' page, some fields from my fire apparatus table is accessed and printed.
I believe that this line in the actions.ini file is the one to mod:
condition="query['-table'] == 'depts' "
Rather than specifying a single table, I'd like to specify the current table from which the information is generated. Here is how I've written up the
action:
if ( $query['-table'] = 'apparatus' ){
$apparatus = df_get_records_array('apparatus', $query);
foreach ($apparatus as $p){
echo '<table>'
.'<tr><th>Department</th><td>'.$p->htmlValue('fdname').'</td></tr>'
.'<tr><th>Designation</th><td>'.$p->htmlValue('designation').'</td></tr>'
.'<tr><th>NIMS Resource</th><td>'.$p->htmlValue('resource').'</td></tr>'
.'<tr><th>Availability</th><td>'.$p->htmlValue('status').'</td></tr>'
.'</table>';
}
}
elseif ( $query['-table'] = 'depts' ){
$depts = df_get_records_array('depts', $query);
foreach ($depts as $p){
echo '<table>'
.'<tr><th>Department</th><td>'.$p->htmlValue('fdname').'</td></tr>'
.'<tr><th>City</th><td>'.$p->htmlValue('city').'</td></tr>'
.'<tr><th>State</th><td>'.$p->htmlValue('state').'</td></tr>'
.'<tr><th>Type</th><td>'.$p->htmlValue('type').'</td></tr>'
.'</table>';
}
}
... and so on.
Initially, all that would get printed would be the information from the first table referenced, since its existence was 'true'.
I've tried replacing the single element assignment in the actions.ini file (condition="query['-table'] == 'depts' ") with a multiple elements like so:
condition="query['-table'] == 'apparatus', 'depts', 'gis', 'nims', 'workorders', 'users' " ... but this doesn't work.
With this change, even the printer icon vanishes, and I can print nothing.
So, I need to find a way to indicate 'current table' rather than hard-code a specific table in the actions.ini file... or do something else?
I'd appreciate any suggestions!
TYIA,
-manifold
This may be a simple one, but I can't figure it out...
I'm using the printable_report. However, I've modified the class actions_printable_report file so as to have a series of if/elseif statements; my goal is to print out a simple, different report depending on which table is creating the data. Thus, on my 'depts' page, some fields from my fire departments table is accessed and printed; but on the 'apparatus' page, some fields from my fire apparatus table is accessed and printed.
I believe that this line in the actions.ini file is the one to mod:
condition="query['-table'] == 'depts' "
Rather than specifying a single table, I'd like to specify the current table from which the information is generated. Here is how I've written up the
action:
if ( $query['-table'] = 'apparatus' ){
$apparatus = df_get_records_array('apparatus', $query);
foreach ($apparatus as $p){
echo '<table>'
.'<tr><th>Department</th><td>'.$p->htmlValue('fdname').'</td></tr>'
.'<tr><th>Designation</th><td>'.$p->htmlValue('designation').'</td></tr>'
.'<tr><th>NIMS Resource</th><td>'.$p->htmlValue('resource').'</td></tr>'
.'<tr><th>Availability</th><td>'.$p->htmlValue('status').'</td></tr>'
.'</table>';
}
}
elseif ( $query['-table'] = 'depts' ){
$depts = df_get_records_array('depts', $query);
foreach ($depts as $p){
echo '<table>'
.'<tr><th>Department</th><td>'.$p->htmlValue('fdname').'</td></tr>'
.'<tr><th>City</th><td>'.$p->htmlValue('city').'</td></tr>'
.'<tr><th>State</th><td>'.$p->htmlValue('state').'</td></tr>'
.'<tr><th>Type</th><td>'.$p->htmlValue('type').'</td></tr>'
.'</table>';
}
}
... and so on.
Initially, all that would get printed would be the information from the first table referenced, since its existence was 'true'.
I've tried replacing the single element assignment in the actions.ini file (condition="query['-table'] == 'depts' ") with a multiple elements like so:
condition="query['-table'] == 'apparatus', 'depts', 'gis', 'nims', 'workorders', 'users' " ... but this doesn't work.
With this change, even the printer icon vanishes, and I can print nothing.
So, I need to find a way to indicate 'current table' rather than hard-code a specific table in the actions.ini file... or do something else?
I'd appreciate any suggestions!
TYIA,
-manifold