Easily embedded reporting application - php-reports

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
kevinm
Posts: 10
Joined: 2013-10-31 09:31

Easily embedded reporting application - php-reports

Post by kevinm » 2015-09-08 07:11

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.

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Easily embedded reporting application - php-reports

Post by a.gneady » 2015-09-10 19:15

Thanks for sharing this :)
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

wplim
Veteran Member
Posts: 36
Joined: 2013-01-17 22:42

Re: Easily embedded reporting application - php-reports

Post by wplim » 2015-09-14 05:53

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.

kevinm
Posts: 10
Joined: 2013-10-31 09:31

Re: Easily embedded reporting application - php-reports

Post by kevinm » 2015-09-18 09:10

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.

kevinm
Posts: 10
Joined: 2013-10-31 09:31

Re: Easily embedded reporting application - php-reports

Post by kevinm » 2015-09-20 05:51

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!

msilkjr
Posts: 2
Joined: 2015-07-10 14:00

Re: Easily embedded reporting application - php-reports

Post by msilkjr » 2015-10-29 20:41

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

KyleRonnie
Posts: 2
Joined: 2015-11-23 10:24
Location: Chicago
Contact:

Re: Easily embedded reporting application - php-reports

Post by KyleRonnie » 2015-12-08 06:22

Thanks for the useful sharing.....

arminjavan
Posts: 12
Joined: 2015-05-20 09:24

Re: Easily embedded reporting application - php-reports

Post by arminjavan » 2016-01-27 09:44

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?

lawrencekeru
Posts: 29
Joined: 2016-06-24 02:51

Re: Easily embedded reporting application - php-reports

Post by lawrencekeru » 2016-07-22 10:54

Thanks for sharing this.

lawrencekeru
Posts: 29
Joined: 2016-06-24 02:51

Re: Easily embedded reporting application - php-reports

Post by lawrencekeru » 2016-07-23 03:26

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

Post Reply