Reportico Laravel Module

Embedding Reports

You can easily embed reportico within your web pages by inserting code within your site views. To embed Reportico you just import the Reportico module, set properties and run it.

In the examples below, note the use of access modes through the access_mode parameter and starting view set through the initial_execute_mode parameter.

The access mode allows you to limit whether the web visitor is able to access the administrator page, a single project menu or a single report either with or without access to criteria entry. The following access modes are allowed :-

  • FULL - ability to access administrator page and access to report design if the admin password is entered
  • ONEPROJECT - ability to run a report project suite with access to all reports in that project
  • ONEREPORT - ability to run a single report choose crtieria and show report output
  • REPORTOUTPUT - ability to view a single report output but with no access to criteria entry

The initial_execute_mode parameter indicates what view you give on the loading the page :-

  • ADMIN - access to the administrator page
  • MENU - load a project menu - an initial project must be provided
  • PREPARE - show the criteria screen and output selection screen for a report - an initial report must be provided
  • EXECUTE - show report output

See the Reportico documentation section embedding a report within a web page for all the options available for embedding, including suppressing elements of report output, specifiying criteria to reports, specifying external parameters to reportico ( like user, role and other session parameters ).

Examples are below :-

Embedding Repotico in Administrator mode

To embed in admin mode, include the following :-

    $engine = App::make("getReporticoEngine");
    $engine->initial_execute_mode = "ADMIN";
    $engine->access_mode = "FULL";
    $engine->initial_project = "admin";
    $engine->clear_reportico_session = true;
    $engine->execute();
See this in action >>

Embedding a Project Menu

To embed a project menu, include the following :-

    $engine = App::make("getReporticoEngine");
    $engine = $reportico->getReporticoEngine();
    $engine->initial_execute_mode = "MENU";
    $engine->access_mode = "ONEPROJECT";
    $engine->initial_project = "northwind";
    $engine->initial_project_password = "password"; // If project password required
    $engine->clear_reportico_session = true;
    $engine->execute();
See this in action >>

Embedding a Report in Criteria Entry Mode

To embed a report in criteria entry mode :-

    $engine = App::make("getReporticoEngine");
    $engine->initial_execute_mode = "PREPARE";
    $engine->initial_report = "salestotals.xml";
    $engine->access_mode = "ONEREPORT";
    $engine->initial_project = "northwind";
    $engine->initial_project_password = "password"; // If project password required
    $engine->clear_reportico_session = true;
    $engine->execute();
See this in action >>

Embedding Report Ouput

To embed the output of a report :-

    $engine = App::make("getReporticoEngine");
    $engine->initial_execute_mode = "EXECUTE";
    $engine->initial_report = "salestotals.xml";
    $engine->access_mode = "ONEREPORT";
    $engine->initial_project = "northwind";
    $engine->initial_project_password = "password"; // If project password required
    $engine->clear_reportico_session = true;
    $engine->execute();
See this in action >>

Embedding SQL Results without a Report

You can run report output without having to create a report. Just set the reportico project that relates to the database you want to run against (using the initial_project parameter) and use the initial_sql parameter to provide the SQL query. Note you cannot use the SELECT * notation in Reportico, you have to specify report columns.
Notice how column aliases in the SQL are used to set column titles.

    $engine = App::make("getReporticoEngine");
    $engine->initial_execute_mode = "EXECUTE";
    $engine->access_mode = "REPORTOUTPUT";
    $engine->initial_project = "northwind";
    $engine->initial_project_password = "password"; // If project password required
    $engine->initial_sql = "SELECT CustomerID AS Id, companyname as company, contactname as contact_name FROM northwind_customers";
    $engine->set_attribute("ReportTitle","Customer List");
    $engine->clear_reportico_session = true;
    $engine->execute();
See this in action >>

Creating links to reports >>