Page 1 of 1
Easily embedded reporting application - php-reports
Posted: 2015-09-08 07:11
by kevinm
Just for info, I found this package easy to install, and relatively straightforward to incorporate into the Appgini projects:
php-reports
http://jdorn.github.io/php-reports/
Installation is as simple as putting the downloaded files into the htdocs directory, and the Appgini security can be added by putting the following code at the start of the main (index.php) file:
Code: Select all
<?php
$d="/your/actual/path/to/your/AppginiProject"; //eg: /home/user/html_public/myproj/"
require_once("$d/admin/incConnection.php");
include("$d/defaultLang.php");
include("$d/language.php");
include("$d/lib.php");
/* grant access to all logged users */
$mi = getMemberInfo();
if(!$mi['username'] || $mi['username'] == 'guest'){
echo "Sorry, you don't have authority to access this page.";
echo '<script language="javaScript">setInterval("window.location=\'/yourAppginiProjectPath/index.php?signOut=1\'", 2000);</script>';
exit;
}
session_start(); // <== This is the first line of the original file
For additional security I also added an .htaccess "Deny from all" file in each of the report folders that didn't require access from the web. (ie. NOT php-reports/public)
After that I added this in the "links-home.php" hooks file:
Code: Select all
$homeLinks[] = array(
'url' => '../php-reports" target="blank"',
'title' => 'Reports',
'description' => '',
'groups' => array('*')
);
and the button link to the reports shows up in the Appgini project home page.
Hope this is useful to someone.
Re: Easily embedded reporting application - php-reports
Posted: 2015-09-10 19:15
by a.gneady
Thanks for sharing this

Re: Easily embedded reporting application - php-reports
Posted: 2015-09-14 05:53
by wplim
Hi Kevin,
First of all, thanks for sharing. The custom link show up in my appgini project.
After clicking on the link, it returns an error.
It can't find incConnection.php file in the admin folder. Am I missing something?
Also, I believe there is an additional "/" at the end of defining $d.
Please advise. Thank you.
Re: Easily embedded reporting application - php-reports
Posted: 2015-09-18 09:10
by kevinm
Hi, and you're welcome!
You're right, my bad, I left the include for the custom connection file (incConnection.php) in there by mistake. It's not relevant to this subject and shouldn't be there. I'd edit it out but don't seem to be able to edit my original post.
Aside: I use this function to connect to the mysql database for the separately written reports that I have. If I was smarter, I would work out how Appgini does this and use the same method.

)
I wasn't consistent with the $d line - the example had a slash on the end and the actual assign didn't! (I suspect that double slashes would be ignored, but still best to get it right)
Thanks for the feedback.
Re: Easily embedded reporting application - php-reports
Posted: 2015-09-20 05:51
by kevinm
And by the way, although I'm still only getting acquainted with this package, it really is super easy to provide simple and straightforward reports!
For example, just using sql, a nicely formatted report is as easy as:
-- My Report
-- This lists all the products that cost
-- more than a given price.
-- VARIABLE: { name: "min_price", display: "Minimum Price" }
SELECT Name, Price FROM Products WHERE Price > "{{ min_price }}"
And that's it! You get a prompt for "Minimum Price" and a report with headers in a table. If you want totals you can either achieve this in php-reports or by using 'with rollup' in the sql. I wish I'd found this years ago!
Re: Easily embedded reporting application - php-reports
Posted: 2015-10-29 20:41
by msilkjr
trying to get this to work as I really would like to add reports to one of my apps. I followed the steps here and think i made a sample report right. any time I click a report link. I get a "You don't have permission to access /reports/report/html/ on this server."
so it says it cant get to a folder called report/html in the phpreports root. that folder wasn't there so i created it and chmod 777 it.
can some one give a more detailed step by step
Re: Easily embedded reporting application - php-reports
Posted: 2015-12-08 06:22
by KyleRonnie
Thanks for the useful sharing.....
Re: Easily embedded reporting application - php-reports
Posted: 2016-01-27 09:44
by arminjavan
I have a little knowledge about this subject but i wanna try this in my app.
i need a step by step glue to make this available.
my php version is 5.2.6 and composer need newer but my pc work only with this.
i add this code:
Code: Select all
$d="../budget/"; //eg: /home/user/html_public/myproj/"
//require_once("$d/admin/incCommon.php");
include("$d/defaultLang.php");
include("$d/language.php");
include("$d/lib.php");
/* grant access to all logged users */
$mi = getMemberInfo();
if(!$mi['username'] || $mi['username'] == 'guest'){
echo "Sorry, you don't have authority to access this page.";
echo '<script language="javaScript">setInterval("window.location=\'/yourAppginiProjectPath/index.php?signOut=1\'", 2000);</script>';
exit;
}
but get this error:
Code: Select all
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
can anyone help me by the details?
Re: Easily embedded reporting application - php-reports
Posted: 2016-07-22 10:54
by lawrencekeru
Thanks for sharing this.
Re: Easily embedded reporting application - php-reports
Posted: 2016-07-23 03:26
by lawrencekeru
I inserted the above code in my real estate but when i click the reports button is displaying a blank page. How can i configure my application to display the reports example?
Am using
http://jdorn.github.io/php-reports/ documentation but cant figure my way out how to get the reports up and running. Please help