This topic is locked

Chart Manipulation

2/15/2013 4:53:03 PM
PHPRunner General questions
M
marcusone author

I want to add some custom buttons to the chart page; for example a quick button to return only the last 30 days.

I know how to use events to manipulate the where clause and then the data. But how do I add the button and post back to that page and pickup the "click" event?

C
cgphp 2/15/2013

Add a custom button to the chart page and in the "Server" tab enter this code:

$_SERVER['chart_days'] = 30;


in the "Client after" event of the button, redirect to the chart page:

location.href = 'yourchartpagename_chart.php';


In the "Before SQL query" event of the chart page enter the following code:



if(isset($_SERVER['chart_days']))

{

$strWhereClause = whereAdd($strWhereClause,"num_days = ".$_SERVER['chart_days']);

}


Replace num_days with the real name of the field.

M
marcusone author 2/15/2013

Thanks...but I'm a real noob with PHPRunner 6.2 ... Where is the option to add a custom button? or Do I need to setup the <form> etc myself?
Also, what is "Server" tab?

M
marcusone author 2/15/2013



Thanks...but I'm a real noob with PHPRunner 6.2 ... Where is the option to add a custom button? or Do I need to setup the <form> etc myself?
Also, what is "Server" tab?



Never mind, found it!

M
marcusone author 2/15/2013



http://xlinesoft.com/phprunner/docs/inserting_button.htm


Thanks, but why do I have to redirect, isn't the click of the button sending information to the server and brining back to the same chart page? can't I just do the sql edit that first time, rather than loading the page a 3rd time?

C
cgphp 2/15/2013

This is not a PHPrunner feature.

M
marcusone author 2/15/2013



This is not a PHPrunner feature.


ok... i think i've found another way ... will post back if it works.
But to help testing. what's the easiest way to get the SQL statement executed to display on screen?

C
cgphp 2/15/2013

In the "After application initialized" event add the following code:

$dDebug = true;
M
marcusone author 2/15/2013



In the "After application initialized" event add the following code:

$dDebug = true;



Hummmm... works on other pages, but the chart page i'm working on now shows "XML Parser failure: The element type must be terminated by the matching end-tag."
I removed all my code and it still says that when debug is enabled.

C
cgphp 2/15/2013

Chart pages use flash plugin for charts rendering. Output text before rendering might be a problem.