Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for PHP Reports #3

Closed
jdorn opened this issue May 18, 2012 · 1 comment
Closed

Support for PHP Reports #3

jdorn opened this issue May 18, 2012 · 1 comment
Assignees
Milestone

Comments

@jdorn
Copy link
Owner

jdorn commented May 18, 2012

A PHP report will look like the following:

<?php
//NAME: This is my report
//DESCRIPTION: This is a description

$rows = array();

...

echo json_encode($rows);

Macro values will be available in the $_REQUEST object.

<?php
//My Report
//VARIABLE: startdate, Start Date

$start_date = $_REQUEST['startdate'];

Like MongoDB, these reports will output JSON.

The report will either be run from the shell or with an include. I haven't decided yet.

@ghost ghost assigned jdorn May 18, 2012
@jdorn
Copy link
Owner Author

jdorn commented May 20, 2012

Added. Macros are accessed as variables instead of through $_REQUEST.

<?php
//My Report
//VARIABLE: startdate, Start Date

echo $startdate;

Php reports should echo json_encoded rows.

<?php

$rows = array(
    array(
        'col1'=>'value 1',
        'col2'=>'value 2'
    ),
    array(
        'col1'=>'value 3',
        'col2'=>'value 4'
    )
);

echo json_encode($rows);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant